diff options
author | John Reck <jreck@google.com> | 2011-06-24 16:13:24 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-06-24 16:16:13 -0700 |
commit | 38def32cdfcbe03924d7991f901f8e6a9fe229d5 (patch) | |
tree | 0344270b0655a6d94b7ccd1403a577f7cb0948cb | |
parent | f7b45bc4344aec44506ac0fa0a1517148ba8a2cb (diff) | |
download | packages_apps_Browser-38def32cdfcbe03924d7991f901f8e6a9fe229d5.zip packages_apps_Browser-38def32cdfcbe03924d7991f901f8e6a9fe229d5.tar.gz packages_apps_Browser-38def32cdfcbe03924d7991f901f8e6a9fe229d5.tar.bz2 |
Tweak title bar animation
Values from UX
Change-Id: I5f975c4b68e890d51a8668cfad0c4f458ac7e918
-rw-r--r-- | res/values/integers.xml | 2 | ||||
-rw-r--r-- | src/com/android/browser/TitleBarBase.java | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/res/values/integers.xml b/res/values/integers.xml index 5a8c15f..fe92a79 100644 --- a/res/values/integers.xml +++ b/res/values/integers.xml @@ -29,4 +29,6 @@ <integer name="tabFadeDuration">300</integer> <!-- The maximum number of columns in the bookmark grid view --> <integer name="max_bookmark_columns">5</integer> + <!-- The duration of the titlebar animation in millisecs --> + <integer name="titlebar_animation_duration">200</integer> </resources> 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); |