diff options
author | John Spurlock <jspurlock@google.com> | 2013-10-03 02:54:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-03 02:54:48 +0000 |
commit | 0ea4a5fb8de62acb057651a4821af9b8699d9fcf (patch) | |
tree | ffb1d4c0fd3a5d466f8926a836f5db08a1738c33 | |
parent | 02fa2332ac9f2972a0c651229ae456641f519363 (diff) | |
parent | 7057d2c3a9a88f1d221bc69780385bd20c5b4999 (diff) | |
download | frameworks_base-0ea4a5fb8de62acb057651a4821af9b8699d9fcf.zip frameworks_base-0ea4a5fb8de62acb057651a4821af9b8699d9fcf.tar.gz frameworks_base-0ea4a5fb8de62acb057651a4821af9b8699d9fcf.tar.bz2 |
Merge "Replace linear GradientDrawable with asset-based approach." into klp-dev
12 files changed, 18 insertions, 27 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/nav_background.9.png b/packages/SystemUI/res/drawable-hdpi/nav_background.9.png Binary files differnew file mode 100644 index 0000000..db36d2b --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/nav_background.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/status_background.9.png b/packages/SystemUI/res/drawable-hdpi/status_background.9.png Binary files differnew file mode 100644 index 0000000..66d1467 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/status_background.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/nav_background.9.png b/packages/SystemUI/res/drawable-mdpi/nav_background.9.png Binary files differnew file mode 100644 index 0000000..45e6e8f --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/nav_background.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/status_background.9.png b/packages/SystemUI/res/drawable-mdpi/status_background.9.png Binary files differnew file mode 100644 index 0000000..49076d3 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/status_background.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/nav_background.9.png b/packages/SystemUI/res/drawable-xhdpi/nav_background.9.png Binary files differnew file mode 100644 index 0000000..152e4ac --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/nav_background.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/status_background.9.png b/packages/SystemUI/res/drawable-xhdpi/status_background.9.png Binary files differnew file mode 100644 index 0000000..75ec8f5 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/status_background.9.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/nav_background.9.png b/packages/SystemUI/res/drawable-xxhdpi/nav_background.9.png Binary files differnew file mode 100644 index 0000000..cce2e06 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/nav_background.9.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/status_background.9.png b/packages/SystemUI/res/drawable-xxhdpi/status_background.9.png Binary files differnew file mode 100644 index 0000000..679ca5d --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/status_background.9.png diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 2f0d0f9..ce94162 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -21,8 +21,6 @@ <drawable name="ticker_background_color">#ff1d1d1d</drawable> <drawable name="system_bar_background">#ff000000</drawable> <color name="system_bar_background_semi_transparent">#66000000</color> <!-- 40% black --> - <color name="system_bar_background_gradient_start">#8c000000</color> <!-- 55% black --> - <color name="system_bar_background_gradient_end">#00000000</color> <color name="notification_panel_solid_background">#ff000000</color> <drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable> <color name="status_bar_recents_app_label_color">#ffffffff</color> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java index 0c25c83..ce578e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java @@ -23,8 +23,6 @@ import android.app.ActivityManager; import android.content.res.Resources; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.GradientDrawable; -import android.graphics.drawable.GradientDrawable.Orientation; import android.graphics.drawable.TransitionDrawable; import android.util.Log; import android.view.View; @@ -50,15 +48,12 @@ public class BarTransitions { private final int mOpaque; private final int mSemiTransparent; - private final int mGradientStart; - private final int mGradientEnd; private int mMode; private ValueAnimator mColorDrawableAnimator; private boolean mColorDrawableShowing; private final ColorDrawable mColorDrawable; - private final GradientDrawable mGradientDrawable; private final TransitionDrawable mTransitionDrawable; private final AnimatorUpdateListener mAnimatorListener = new AnimatorUpdateListener() { @Override @@ -67,7 +62,7 @@ public class BarTransitions { } }; - public BarTransitions(View view) { + public BarTransitions(View view, int gradientResourceId) { mTag = "BarTransitions." + view.getClass().getSimpleName(); mView = view; final Resources res = mView.getContext().getResources(); @@ -75,20 +70,14 @@ public class BarTransitions { if (DEBUG_COLORS) { mOpaque = 0xff0000ff; mSemiTransparent = 0x7f0000ff; - mGradientStart = 0x7fff0000; - mGradientEnd = 0x7f00ff00; } else { mOpaque = res.getColor(R.drawable.system_bar_background); mSemiTransparent = res.getColor(R.color.system_bar_background_semi_transparent); - mGradientStart = res.getColor(R.color.system_bar_background_gradient_start); - mGradientEnd = res.getColor(R.color.system_bar_background_gradient_end); } mColorDrawable = new ColorDrawable(mOpaque); - mGradientDrawable = new GradientDrawable(Orientation.BOTTOM_TOP, - new int[] { mGradientStart, mGradientEnd }); mTransitionDrawable = new TransitionDrawable( - new Drawable[] { mGradientDrawable, mColorDrawable }); + new Drawable[] { res.getDrawable(gradientResourceId), mColorDrawable }); mTransitionDrawable.setCrossFadeEnabled(true); mTransitionDrawable.resetTransition(); if (mSupportsTransitions) { @@ -96,13 +85,6 @@ public class BarTransitions { } } - protected void setOrientation(GradientDrawable.Orientation orientation) { - if (orientation.equals(mGradientDrawable.getOrientation())) return; // GD doesn't check - if (DEBUG) Log.d(mTag, "setOrientation " + orientation); - mGradientDrawable.mutate(); - mGradientDrawable.setOrientation(orientation); - } - public int getMode() { return mMode; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index 04922fb..4e92179 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; -import android.graphics.drawable.GradientDrawable.Orientation; import android.os.ServiceManager; import android.view.MotionEvent; import android.view.View; @@ -35,9 +34,11 @@ public final class NavigationBarTransitions extends BarTransitions { private final IStatusBarService mBarService; private boolean mLightsOut; + private boolean mVertical; + private int mRequestedMode; public NavigationBarTransitions(NavigationBarView view) { - super(view); + super(view, R.drawable.nav_background); mView = view; mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); @@ -50,7 +51,18 @@ public final class NavigationBarTransitions extends BarTransitions { } public void setVertical(boolean isVertical) { - setOrientation(isVertical ? Orientation.RIGHT_LEFT : Orientation.BOTTOM_TOP); + mVertical = isVertical; + transitionTo(mRequestedMode, false /*animate*/); + } + + @Override + public void transitionTo(int mode, boolean animate) { + mRequestedMode = mode; + if (mVertical && mode == MODE_TRANSPARENT) { + // fully transparent mode not allowed when vertical + mode = MODE_OPAQUE; + } + super.transitionTo(mode, animate); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java index a492d76..6bb6776 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarTransitions.java @@ -37,7 +37,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions { private Animator mCurrentAnimation; public PhoneStatusBarTransitions(PhoneStatusBarView view) { - super(view); + super(view, R.drawable.status_background); mView = view; final Resources res = mView.getContext().getResources(); mIconAlphaWhenOpaque = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1); @@ -49,7 +49,6 @@ public final class PhoneStatusBarTransitions extends BarTransitions { mSignalCluster = mView.findViewById(R.id.signal_cluster); mBattery = mView.findViewById(R.id.battery); mClock = mView.findViewById(R.id.clock); - setOrientation(Orientation.TOP_BOTTOM); applyModeBackground(-1, getMode(), false /*animate*/); applyMode(getMode(), false /*animate*/); } |