summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-06-27 09:25:15 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-27 09:25:15 -0700
commit46473c5f8f772d3cb869d712c596308ba10722d3 (patch)
tree5ec88a5c34a9e7e1e58f540626660194d3bb993d /src/com
parentbcba77a5bb4ec468bb6dc8aa298e5093d2d7121f (diff)
parent38def32cdfcbe03924d7991f901f8e6a9fe229d5 (diff)
downloadpackages_apps_Browser-46473c5f8f772d3cb869d712c596308ba10722d3.zip
packages_apps_Browser-46473c5f8f772d3cb869d712c596308ba10722d3.tar.gz
packages_apps_Browser-46473c5f8f772d3cb869d712c596308ba10722d3.tar.bz2
Merge "Tweak title bar animation"
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/TitleBarBase.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/browser/TitleBarBase.java b/src/com/android/browser/TitleBarBase.java
index cf3a6ef..c7fb9c6 100644
--- a/src/com/android/browser/TitleBarBase.java
+++ b/src/com/android/browser/TitleBarBase.java
@@ -16,16 +16,13 @@
package com.android.browser;
-import com.android.browser.UI.DropdownChangeListener;
-import com.android.browser.UrlInputView.UrlInputListener;
-import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
-
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -44,6 +41,7 @@ import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
+import android.view.animation.DecelerateInterpolator;
import android.webkit.WebView;
import android.widget.AbsoluteLayout;
import android.widget.ArrayAdapter;
@@ -57,6 +55,10 @@ import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
+import com.android.browser.UI.DropdownChangeListener;
+import com.android.browser.UrlInputView.UrlInputListener;
+import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
+
import java.util.List;
/**
@@ -68,6 +70,7 @@ public class TitleBarBase extends RelativeLayout
OnMenuItemClickListener {
protected static final int PROGRESS_MAX = 100;
+ private static final float ANIM_TITLEBAR_DECELERATE = 2.5f;
// These need to be set by the subclass.
protected ImageView mFavicon;
@@ -149,6 +152,14 @@ public class TitleBarBase extends RelativeLayout
mSkipTitleBarAnimations = skip;
}
+ void setupTitleBarAnimator(Animator animator) {
+ Resources res = mContext.getResources();
+ int duration = res.getInteger(R.integer.titlebar_animation_duration);
+ animator.setInterpolator(new DecelerateInterpolator(
+ ANIM_TITLEBAR_DECELERATE));
+ animator.setDuration(duration);
+ }
+
void show() {
if (mUseQuickControls) {
mParent.addView(this);
@@ -163,6 +174,7 @@ public class TitleBarBase extends RelativeLayout
mTitleBarAnimator = ObjectAnimator.ofFloat(this,
"translationY",
startPos, 0);
+ setupTitleBarAnimator(mTitleBarAnimator);
mTitleBarAnimator.start();
}
mBaseUi.setTitleGravity(Gravity.TOP);
@@ -181,6 +193,7 @@ public class TitleBarBase extends RelativeLayout
"translationY", getTranslationY(),
(-getEmbeddedHeight() + visibleHeight));
mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
+ setupTitleBarAnimator(mTitleBarAnimator);
mTitleBarAnimator.start();
} else {
mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);