Android Open Source - EBrowser Animation Manager






From Project

Back to project page EBrowser.

License

The source code is released under:

GNU General Public License

If you think the Android project EBrowser listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Zirco Browser for Android/*from w  w w. j  a va2  s  .  c  o  m*/
 * 
 * Copyright (C) 2010 J. Devauchelle and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 3 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package org.zirco.utils;

import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

/**
 * Holder for animation objects.
 */
public final class AnimationManager {

  private static final int BARS_ANIMATION_DURATION = 150;
  private static final int ANIMATION_DURATION = 350;

  private Animation mTopBarShowAnimation = null;
  private Animation mTopBarHideAnimation = null;  
  private Animation mBottomBarShowAnimation = null;
  private Animation mBottomBarHideAnimation = null;
  
  private Animation mPreviousTabViewShowAnimation = null;
  private Animation mPreviousTabViewHideAnimation = null;  
  private Animation mNextTabViewShowAnimation = null;
  private Animation mNextTabViewHideAnimation = null;
  
  private Animation mInFromRightAnimation;
  private Animation mOutToLeftAnimation;
  private Animation mInFromLeftAnimation;
  private Animation mOutToRightAnimation;

  /**
   * Holder for singleton implementation.
   */
  private static class AnimationManagerHolder {
    private static final AnimationManager INSTANCE = new AnimationManager();
  }

  /**
   * Get the unique instance of the Controller.
   * @return The instance of the Controller
   */
  public static AnimationManager getInstance() {
    return AnimationManagerHolder.INSTANCE;
  }

  /**
   * Contructor.
   */
  private AnimationManager() {
    
    mTopBarShowAnimation = new TranslateAnimation(
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mTopBarShowAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mTopBarHideAnimation = new TranslateAnimation(
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f
      );
    
    mTopBarHideAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mBottomBarShowAnimation = new TranslateAnimation(
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mBottomBarShowAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mBottomBarHideAnimation = new TranslateAnimation(
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f
      );
    
    mBottomBarHideAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mPreviousTabViewShowAnimation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mPreviousTabViewShowAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mPreviousTabViewHideAnimation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mPreviousTabViewHideAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mNextTabViewShowAnimation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mNextTabViewShowAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mNextTabViewHideAnimation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f,
          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
      );
    
    mNextTabViewHideAnimation.setDuration(BARS_ANIMATION_DURATION);
    
    mInFromRightAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT,
        0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);

    mInFromRightAnimation.setDuration(ANIMATION_DURATION);
    mInFromRightAnimation.setInterpolator(new AccelerateInterpolator());

    mOutToLeftAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, -1.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f);

    mOutToLeftAnimation.setDuration(ANIMATION_DURATION);
    mOutToLeftAnimation.setInterpolator(new AccelerateInterpolator());

    mInFromLeftAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f);

    mInFromLeftAnimation.setDuration(ANIMATION_DURATION);
    mInFromLeftAnimation.setInterpolator(new AccelerateInterpolator());

    mOutToRightAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, +1.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f,
        Animation.RELATIVE_TO_PARENT, 0.0f);

    mOutToRightAnimation.setDuration(ANIMATION_DURATION);
    mOutToRightAnimation.setInterpolator(new AccelerateInterpolator());
  }

  public Animation getTopBarShowAnimation() {
    return mTopBarShowAnimation;
  }
  
  public Animation getTopBarHideAnimation() {
    return mTopBarHideAnimation;
  }
  
  public Animation getBottomBarShowAnimation() {
    return mBottomBarShowAnimation;
  }
  
  public Animation getBottomBarHideAnimation() {
    return mBottomBarHideAnimation;
  }
  
  public Animation getPreviousTabViewShowAnimation() {
    return mPreviousTabViewShowAnimation;
  }
  
  public Animation getPreviousTabViewHideAnimation() {
    return mPreviousTabViewHideAnimation;
  }
  
  public Animation getNextTabViewShowAnimation() {
    return mNextTabViewShowAnimation;
  }
  
  public Animation getNextTabViewHideAnimation() {
    return mNextTabViewHideAnimation;
  }
  
  /**
   * Get the in from right animation object.
   * @return The animation object.
   */
  public Animation getInFromRightAnimation() {
    return mInFromRightAnimation;
  }

  /**
   * Get the out to left animation object.
   * @return The animation object.
   */
  public Animation getOutToLeftAnimation() {
    return mOutToLeftAnimation;
  }

  /**
   * Get the in from left animation object.
   * @return The animation object.
   */
  public Animation getInFromLeftAnimation() {
    return mInFromLeftAnimation;
  }

  /**
   * Get the out to right animation object.
   * @return The animation object.
   */
  public Animation getOutToRightAnimation() {
    return mOutToRightAnimation;
  }

}




Java Source Code List

org.emergent.android.weave.client.Base32.java
org.emergent.android.weave.client.Base64Encoder.java
org.emergent.android.weave.client.Base64.java
org.emergent.android.weave.client.BulkKeyCouplet.java
org.emergent.android.weave.client.Dbg.java
org.emergent.android.weave.client.HexEncoder.java
org.emergent.android.weave.client.Hex.java
org.emergent.android.weave.client.QueryParams.java
org.emergent.android.weave.client.QueryResult.java
org.emergent.android.weave.client.UserWeave.java
org.emergent.android.weave.client.WeaveAccountInfo.java
org.emergent.android.weave.client.WeaveBasicObject.java
org.emergent.android.weave.client.WeaveConstants.java
org.emergent.android.weave.client.WeaveCryptoUtil.java
org.emergent.android.weave.client.WeaveException.java
org.emergent.android.weave.client.WeaveFactory.java
org.emergent.android.weave.client.WeaveHeader.java
org.emergent.android.weave.client.WeaveResponse.java
org.emergent.android.weave.client.WeaveSSLSocketFactory.java
org.emergent.android.weave.client.WeaveTransport.java
org.emergent.android.weave.client.WeaveUtil.java
org.greendroid.QuickActionGrid.java
org.greendroid.QuickActionWidget.java
org.greendroid.QuickAction.java
org.zirco.controllers.Controller.java
org.zirco.events.EventConstants.java
org.zirco.events.EventController.java
org.zirco.events.IDownloadEventsListener.java
org.zirco.model.DbAdapter.java
org.zirco.model.UrlSuggestionItemComparator.java
org.zirco.model.adapters.BookmarksCursorAdapter.java
org.zirco.model.adapters.DownloadListAdapter.java
org.zirco.model.adapters.HistoryExpandableListAdapter.java
org.zirco.model.adapters.UrlSuggestionCursorAdapter.java
org.zirco.model.adapters.WeaveBookmarksCursorAdapter.java
org.zirco.model.items.BookmarkItem.java
org.zirco.model.items.DownloadItem.java
org.zirco.model.items.HistoryItem.java
org.zirco.model.items.UrlSuggestionItem.java
org.zirco.model.items.WeaveBookmarkItem.java
org.zirco.providers.BookmarksProviderWrapper.java
org.zirco.providers.WeaveColumns.java
org.zirco.providers.WeaveContentProvider.java
org.zirco.providers.ZircoBookmarksContentProvider.java
org.zirco.sync.ISyncListener.java
org.zirco.sync.WeaveSyncTask.java
org.zirco.ui.activities.AboutActivity.java
org.zirco.ui.activities.AdBlockerWhiteListActivity.java
org.zirco.ui.activities.BookmarksHistoryActivity.java
org.zirco.ui.activities.BookmarksListActivity.java
org.zirco.ui.activities.ChangelogActivity.java
org.zirco.ui.activities.DownloadsListActivity.java
org.zirco.ui.activities.EditBookmarkActivity.java
org.zirco.ui.activities.HistoryListActivity.java
org.zirco.ui.activities.IToolbarsContainer.java
org.zirco.ui.activities.MainActivity.java
org.zirco.ui.activities.MobileViewListActivity.java
org.zirco.ui.activities.WeaveBookmarksListActivity.java
org.zirco.ui.activities.preferences.BaseSpinnerCustomPreferenceActivity.java
org.zirco.ui.activities.preferences.HomepagePreferenceActivity.java
org.zirco.ui.activities.preferences.PreferencesActivity.java
org.zirco.ui.activities.preferences.SearchUrlPreferenceActivity.java
org.zirco.ui.activities.preferences.UserAgentPreferenceActivity.java
org.zirco.ui.activities.preferences.WeavePreferencesActivity.java
org.zirco.ui.activities.preferences.WeaveServerPreferenceActivity.java
org.zirco.ui.components.CustomWebViewClient.java
org.zirco.ui.components.CustomWebView.java
org.zirco.ui.runnables.DownloadRunnable.java
org.zirco.ui.runnables.FaviconUpdaterRunnable.java
org.zirco.ui.runnables.HideToolbarsRunnable.java
org.zirco.ui.runnables.HistoryUpdater.java
org.zirco.ui.runnables.XmlHistoryBookmarksExporter.java
org.zirco.ui.runnables.XmlHistoryBookmarksImporter.java
org.zirco.utils.AnimationManager.java
org.zirco.utils.ApplicationUtils.java
org.zirco.utils.Constants.java
org.zirco.utils.DateUtils.java
org.zirco.utils.IOUtils.java
org.zirco.utils.ProxyChangeReceiver.java
org.zirco.utils.ProxySettings.java
org.zirco.utils.UrlUtils.java