From 38def32cdfcbe03924d7991f901f8e6a9fe229d5 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 24 Jun 2011 16:13:24 -0700 Subject: Tweak title bar animation Values from UX Change-Id: I5f975c4b68e890d51a8668cfad0c4f458ac7e918 --- res/values/integers.xml | 2 ++ 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 @@ 300 5 + + 200 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); -- cgit v1.1