diff options
author | Jim Miller <jaggies@google.com> | 2009-11-11 17:53:53 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2009-11-11 18:00:48 -0800 |
commit | 753401aa471d2fb87ab937c2b02b182ebc215c3a (patch) | |
tree | 5b49e067b6a1c076c4e3b0f11c29a62c656d00a7 /core/java/com | |
parent | 3e584fc944e3d694b4233450f386bd2a930420bf (diff) | |
download | frameworks_base-753401aa471d2fb87ab937c2b02b182ebc215c3a.zip frameworks_base-753401aa471d2fb87ab937c2b02b182ebc215c3a.tar.gz frameworks_base-753401aa471d2fb87ab937c2b02b182ebc215c3a.tar.bz2 |
Fix 2209086: add drawables for SlidingTab states in PhoneApp. Update string file for new SlidingTab sound states.
Tweak "animation" to be 250ms based on conversation with ui guys. Some minor performance tweaks to SlidingTab.
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/widget/SlidingTab.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java index 6bcecc3..dfd4f40 100644 --- a/core/java/com/android/internal/widget/SlidingTab.java +++ b/core/java/com/android/internal/widget/SlidingTab.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; import android.os.Vibrator; @@ -41,6 +42,7 @@ import com.android.internal.R; * */ public class SlidingTab extends ViewGroup { + private static final int ANIMATION_DURATION = 250; // animation transition duration (in ms) private static final String LOG_TAG = "SlidingTab"; private static final boolean DBG = false; private static final int HORIZONTAL = 0; // as defined in attrs.xml @@ -249,10 +251,12 @@ public class SlidingTab extends ViewGroup { * @param alignment which side to align the widget to */ void layout(int l, int t, int r, int b, int alignment) { - final int handleWidth = tab.getBackground().getIntrinsicWidth(); - final int handleHeight = tab.getBackground().getIntrinsicHeight(); - final int targetWidth = target.getDrawable().getIntrinsicWidth(); - final int targetHeight = target.getDrawable().getIntrinsicHeight(); + final Drawable tabBackground = tab.getBackground(); + final int handleWidth = tabBackground.getIntrinsicWidth(); + final int handleHeight = tabBackground.getIntrinsicHeight(); + final Drawable targetDrawable = target.getDrawable(); + final int targetWidth = targetDrawable.getIntrinsicWidth(); + final int targetHeight = targetDrawable.getIntrinsicHeight(); final int parentWidth = r - l; final int parentHeight = b - t; @@ -347,10 +351,11 @@ public class SlidingTab extends ViewGroup { throw new RuntimeException(LOG_TAG + " cannot have UNSPECIFIED dimensions"); } - final int leftTabWidth = (int) (mDensity * mLeftSlider.getTabWidth() + 0.5f); - final int rightTabWidth = (int) (mDensity * mRightSlider.getTabWidth() + 0.5f); - final int leftTabHeight = (int) (mDensity * mLeftSlider.getTabHeight() + 0.5f); - final int rightTabHeight = (int) (mDensity * mRightSlider.getTabHeight() + 0.5f); + final float density = mDensity; + final int leftTabWidth = (int) (density * mLeftSlider.getTabWidth() + 0.5f); + final int rightTabWidth = (int) (density * mRightSlider.getTabWidth() + 0.5f); + final int leftTabHeight = (int) (density * mLeftSlider.getTabHeight() + 0.5f); + final int rightTabHeight = (int) (density * mRightSlider.getTabHeight() + 0.5f); final int width; final int height; if (isHorizontal()) { @@ -441,14 +446,14 @@ public class SlidingTab extends ViewGroup { OnTriggerListener.LEFT_HANDLE : OnTriggerListener.RIGHT_HANDLE); // TODO: This is a place holder for the real animation. It just holds - // the screen for 500ms. + // the screen for the duration of the animation for now. mAnimating = true; mHandler.postDelayed(new Runnable() { public void run() { resetView(); mAnimating = false; } - }, 500); + }, ANIMATION_DURATION); } if (isHorizontal() && (y <= handle.getBottom() && y >= handle.getTop()) || |