Loading packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -236,6 +236,9 @@ <!-- Height of search panel including navigation bar height --> <dimen name="navbar_search_panel_height">230dip</dimen> <!-- Move the back button drawable for 3 button layout upwards in ime mode and in portrait --> <dimen name="navbar_back_button_ime_offset">2dp</dimen> <!-- Height of the draggable handle at the bottom of the phone notification panel --> <dimen name="close_handle_height">36dp</dimen> Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +31 −8 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ import android.animation.LayoutTransition; import android.animation.LayoutTransition.TransitionListener; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.DrawableRes; Loading Loading @@ -61,6 +62,7 @@ import android.widget.FrameLayout; import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.DockedStackExistsListener; import com.android.systemui.Interpolators; import com.android.systemui.OverviewProxyService; import com.android.systemui.R; import com.android.systemui.RecentsComponent; Loading Loading @@ -483,14 +485,15 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme); Context darkContext = new ContextThemeWrapper(ctx, dualToneDarkTheme); if (oldConfig.orientation != newConfig.orientation || oldConfig.densityDpi != newConfig.densityDpi) { final boolean orientationChange = oldConfig.orientation != newConfig.orientation; final boolean densityChange = oldConfig.densityDpi != newConfig.densityDpi; final boolean dirChange = oldConfig.getLayoutDirection() != newConfig.getLayoutDirection(); if (orientationChange || densityChange) { mDockedIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_docked); mHomeDefaultIcon = getHomeDrawable(lightContext, darkContext); } if (oldConfig.densityDpi != newConfig.densityDpi || oldConfig.getLayoutDirection() != newConfig.getLayoutDirection()) { mBackIcon = getBackDrawable(lightContext, darkContext); if (densityChange || dirChange) { mRecentIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_recent); mMenuIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_menu); Loading @@ -506,6 +509,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav updateCarModeIcons(ctx); } } if (orientationChange || densityChange || dirChange) { mBackIcon = getBackDrawable(lightContext, darkContext); } } public KeyButtonDrawable getBackDrawable(Context lightContext, Context darkContext) { Loading @@ -528,8 +534,25 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav private void orientBackButton(KeyButtonDrawable drawable) { final boolean useAltBack = (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; drawable.setRotation(useAltBack ? -90 : (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) ? 180 : 0); final boolean isRtl = getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float degrees = useAltBack ? (isRtl ? 270 : -90) : (isRtl ? 180 : 0); if (drawable.getRotation() == degrees) { return; } // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons float targetY = !mOverviewProxyService.shouldShowSwipeUpUI() && !mVertical && useAltBack ? - getResources().getDimension(R.dimen.navbar_back_button_ime_offset) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_ROTATE, degrees), PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_TRANSLATE_Y, targetY)); navBarAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); navBarAnimator.setDuration(200); navBarAnimator.start(); } private void orientHomeButton(KeyButtonDrawable drawable) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadowKeyDrawable.java +30 −4 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; import com.android.systemui.R; /** * A drawable which adds shadow around a child drawable. */ Loading Loading @@ -60,6 +58,23 @@ public class ShadowKeyDrawable extends Drawable { } } public void setTranslationX(float x) { setTranslation(x, mState.mTranslationY); } public void setTranslationY(float y) { setTranslation(mState.mTranslationX, y); } public void setTranslation(float x, float y) { if (mState.mTranslationX != x || mState.mTranslationY != y) { mState.mTranslationX = x; mState.mTranslationY = y; mState.mLastDrawnBitmap = null; invalidateSelf(); } } public void setShadowProperties(int x, int y, int size, int color) { if (mState.mShadowOffsetX != x || mState.mShadowOffsetY != y || mState.mShadowSize != size || mState.mShadowColor != color) { Loading @@ -76,6 +91,14 @@ public class ShadowKeyDrawable extends Drawable { return mState.mRotateDegrees; } public float getTranslationX() { return mState.mTranslationX; } public float getTranslationY() { return mState.mTranslationY; } @Override public void draw(Canvas canvas) { Rect bounds = getBounds(); Loading Loading @@ -151,6 +174,7 @@ public class ShadowKeyDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); d.setBounds(0, 0, mState.mBaseWidth, mState.mBaseHeight); canvas.translate(mState.mTranslationX, mState.mTranslationY); d.draw(canvas); if (mState.mShadowSize > 0) { Loading @@ -168,9 +192,9 @@ public class ShadowKeyDrawable extends Drawable { canvas.rotate(mState.mRotateDegrees, width / 2, height / 2); final float shadowOffsetX = (float) (Math.sin(radians) * mState.mShadowOffsetY + Math.cos(radians) * mState.mShadowOffsetX); + Math.cos(radians) * mState.mShadowOffsetX) - mState.mTranslationX; final float shadowOffsetY = (float) (Math.cos(radians) * mState.mShadowOffsetY - Math.sin(radians) * mState.mShadowOffsetX); - Math.sin(radians) * mState.mShadowOffsetX) - mState.mTranslationY; canvas.drawBitmap(shadow, offset[0] + shadowOffsetX, offset[1] + shadowOffsetY, paint); d.draw(canvas); Loading @@ -189,6 +213,8 @@ public class ShadowKeyDrawable extends Drawable { int mBaseWidth; int mBaseHeight; float mRotateDegrees; float mTranslationX; float mTranslationY; int mShadowOffsetX; int mShadowOffsetY; int mShadowSize; Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +56 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.util.FloatProperty; import android.view.Gravity; import com.android.systemui.R; Loading @@ -33,6 +34,32 @@ import com.android.systemui.statusbar.phone.ShadowKeyDrawable; */ public class KeyButtonDrawable extends LayerDrawable { public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_ROTATE = new FloatProperty<KeyButtonDrawable>("KeyButtonRotation") { @Override public void setValue(KeyButtonDrawable drawable, float degree) { drawable.setRotation(degree); } @Override public Float get(KeyButtonDrawable drawable) { return drawable.getRotation(); } }; public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_TRANSLATE_Y = new FloatProperty<KeyButtonDrawable>("KeyButtonTranslateY") { @Override public void setValue(KeyButtonDrawable drawable, float y) { drawable.setTranslationY(y); } @Override public Float get(KeyButtonDrawable drawable) { return drawable.getTranslationY(); } }; private final boolean mHasDarkDrawable; public static KeyButtonDrawable create(Context lightContext, Drawable lightDrawable, Loading Loading @@ -83,4 +110,33 @@ public class KeyButtonDrawable extends LayerDrawable { ((ShadowKeyDrawable) getDrawable(1)).setRotation(degrees); } } public void setTranslationY(float y) { if (getDrawable(0) instanceof ShadowKeyDrawable) { ((ShadowKeyDrawable) getDrawable(0)).setTranslationY(y); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { ((ShadowKeyDrawable) getDrawable(1)).setTranslationY(y); } } public float getRotation() { if (getDrawable(0) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(0)).getRotation(); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(1)).getRotation(); } return 0; } public float getTranslationY() { if (getDrawable(0) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(0)).getTranslationY(); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(1)).getTranslationY(); } return 0; } } Loading
packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -236,6 +236,9 @@ <!-- Height of search panel including navigation bar height --> <dimen name="navbar_search_panel_height">230dip</dimen> <!-- Move the back button drawable for 3 button layout upwards in ime mode and in portrait --> <dimen name="navbar_back_button_ime_offset">2dp</dimen> <!-- Height of the draggable handle at the bottom of the phone notification panel --> <dimen name="close_handle_height">36dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +31 −8 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ import android.animation.LayoutTransition; import android.animation.LayoutTransition.TransitionListener; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.DrawableRes; Loading Loading @@ -61,6 +62,7 @@ import android.widget.FrameLayout; import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.DockedStackExistsListener; import com.android.systemui.Interpolators; import com.android.systemui.OverviewProxyService; import com.android.systemui.R; import com.android.systemui.RecentsComponent; Loading Loading @@ -483,14 +485,15 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme); Context darkContext = new ContextThemeWrapper(ctx, dualToneDarkTheme); if (oldConfig.orientation != newConfig.orientation || oldConfig.densityDpi != newConfig.densityDpi) { final boolean orientationChange = oldConfig.orientation != newConfig.orientation; final boolean densityChange = oldConfig.densityDpi != newConfig.densityDpi; final boolean dirChange = oldConfig.getLayoutDirection() != newConfig.getLayoutDirection(); if (orientationChange || densityChange) { mDockedIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_docked); mHomeDefaultIcon = getHomeDrawable(lightContext, darkContext); } if (oldConfig.densityDpi != newConfig.densityDpi || oldConfig.getLayoutDirection() != newConfig.getLayoutDirection()) { mBackIcon = getBackDrawable(lightContext, darkContext); if (densityChange || dirChange) { mRecentIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_recent); mMenuIcon = getDrawable(lightContext, darkContext, R.drawable.ic_sysbar_menu); Loading @@ -506,6 +509,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav updateCarModeIcons(ctx); } } if (orientationChange || densityChange || dirChange) { mBackIcon = getBackDrawable(lightContext, darkContext); } } public KeyButtonDrawable getBackDrawable(Context lightContext, Context darkContext) { Loading @@ -528,8 +534,25 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav private void orientBackButton(KeyButtonDrawable drawable) { final boolean useAltBack = (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; drawable.setRotation(useAltBack ? -90 : (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) ? 180 : 0); final boolean isRtl = getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float degrees = useAltBack ? (isRtl ? 270 : -90) : (isRtl ? 180 : 0); if (drawable.getRotation() == degrees) { return; } // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons float targetY = !mOverviewProxyService.shouldShowSwipeUpUI() && !mVertical && useAltBack ? - getResources().getDimension(R.dimen.navbar_back_button_ime_offset) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_ROTATE, degrees), PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_TRANSLATE_Y, targetY)); navBarAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); navBarAnimator.setDuration(200); navBarAnimator.start(); } private void orientHomeButton(KeyButtonDrawable drawable) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadowKeyDrawable.java +30 −4 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; import com.android.systemui.R; /** * A drawable which adds shadow around a child drawable. */ Loading Loading @@ -60,6 +58,23 @@ public class ShadowKeyDrawable extends Drawable { } } public void setTranslationX(float x) { setTranslation(x, mState.mTranslationY); } public void setTranslationY(float y) { setTranslation(mState.mTranslationX, y); } public void setTranslation(float x, float y) { if (mState.mTranslationX != x || mState.mTranslationY != y) { mState.mTranslationX = x; mState.mTranslationY = y; mState.mLastDrawnBitmap = null; invalidateSelf(); } } public void setShadowProperties(int x, int y, int size, int color) { if (mState.mShadowOffsetX != x || mState.mShadowOffsetY != y || mState.mShadowSize != size || mState.mShadowColor != color) { Loading @@ -76,6 +91,14 @@ public class ShadowKeyDrawable extends Drawable { return mState.mRotateDegrees; } public float getTranslationX() { return mState.mTranslationX; } public float getTranslationY() { return mState.mTranslationY; } @Override public void draw(Canvas canvas) { Rect bounds = getBounds(); Loading Loading @@ -151,6 +174,7 @@ public class ShadowKeyDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); d.setBounds(0, 0, mState.mBaseWidth, mState.mBaseHeight); canvas.translate(mState.mTranslationX, mState.mTranslationY); d.draw(canvas); if (mState.mShadowSize > 0) { Loading @@ -168,9 +192,9 @@ public class ShadowKeyDrawable extends Drawable { canvas.rotate(mState.mRotateDegrees, width / 2, height / 2); final float shadowOffsetX = (float) (Math.sin(radians) * mState.mShadowOffsetY + Math.cos(radians) * mState.mShadowOffsetX); + Math.cos(radians) * mState.mShadowOffsetX) - mState.mTranslationX; final float shadowOffsetY = (float) (Math.cos(radians) * mState.mShadowOffsetY - Math.sin(radians) * mState.mShadowOffsetX); - Math.sin(radians) * mState.mShadowOffsetX) - mState.mTranslationY; canvas.drawBitmap(shadow, offset[0] + shadowOffsetX, offset[1] + shadowOffsetY, paint); d.draw(canvas); Loading @@ -189,6 +213,8 @@ public class ShadowKeyDrawable extends Drawable { int mBaseWidth; int mBaseHeight; float mRotateDegrees; float mTranslationX; float mTranslationY; int mShadowOffsetX; int mShadowOffsetY; int mShadowSize; Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +56 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.util.FloatProperty; import android.view.Gravity; import com.android.systemui.R; Loading @@ -33,6 +34,32 @@ import com.android.systemui.statusbar.phone.ShadowKeyDrawable; */ public class KeyButtonDrawable extends LayerDrawable { public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_ROTATE = new FloatProperty<KeyButtonDrawable>("KeyButtonRotation") { @Override public void setValue(KeyButtonDrawable drawable, float degree) { drawable.setRotation(degree); } @Override public Float get(KeyButtonDrawable drawable) { return drawable.getRotation(); } }; public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_TRANSLATE_Y = new FloatProperty<KeyButtonDrawable>("KeyButtonTranslateY") { @Override public void setValue(KeyButtonDrawable drawable, float y) { drawable.setTranslationY(y); } @Override public Float get(KeyButtonDrawable drawable) { return drawable.getTranslationY(); } }; private final boolean mHasDarkDrawable; public static KeyButtonDrawable create(Context lightContext, Drawable lightDrawable, Loading Loading @@ -83,4 +110,33 @@ public class KeyButtonDrawable extends LayerDrawable { ((ShadowKeyDrawable) getDrawable(1)).setRotation(degrees); } } public void setTranslationY(float y) { if (getDrawable(0) instanceof ShadowKeyDrawable) { ((ShadowKeyDrawable) getDrawable(0)).setTranslationY(y); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { ((ShadowKeyDrawable) getDrawable(1)).setTranslationY(y); } } public float getRotation() { if (getDrawable(0) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(0)).getRotation(); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(1)).getRotation(); } return 0; } public float getTranslationY() { if (getDrawable(0) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(0)).getTranslationY(); } if (mHasDarkDrawable && getDrawable(1) instanceof ShadowKeyDrawable) { return ((ShadowKeyDrawable) getDrawable(1)).getTranslationY(); } return 0; } }