Loading packages/SystemUI/res/drawable/ic_sysbar_back.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> Loading packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> <path Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +1 −3 Original line number Diff line number Diff line Loading @@ -507,9 +507,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav final boolean useAltBack = (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float degrees = useAltBack ? (isRtl ? 270 : -90) : (isRtl ? 180 : 0); float degrees = useAltBack ? (isRtl ? 90 : -90) : 0; if (drawable.getRotation() == degrees) { return; } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +24 −8 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.view.ContextThemeWrapper; import android.view.View; import com.android.settingslib.Utils; import com.android.systemui.R; Loading Loading @@ -79,9 +80,10 @@ public class KeyButtonDrawable extends Drawable { private final ShadowDrawableState mState; private AnimatedVectorDrawable mAnimatedDrawable; public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor) { public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor, boolean horizontalFlip) { this(d, new ShadowDrawableState(lightColor, darkColor, d instanceof AnimatedVectorDrawable)); d instanceof AnimatedVectorDrawable, horizontalFlip)); } private KeyButtonDrawable(Drawable d, ShadowDrawableState state) { Loading Loading @@ -282,7 +284,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); canvas.save(); if (mState.mHorizontalFlip) { canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); } d.draw(canvas); canvas.restore(); if (mState.mIsHardwareBitmap) { bitmap = bitmap.copy(Bitmap.Config.HARDWARE, false); Loading @@ -305,7 +312,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); canvas.save(); if (mState.mHorizontalFlip) { canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); } d.draw(canvas); canvas.restore(); // Draws the shadow from original drawable Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); Loading Loading @@ -357,6 +369,7 @@ public class KeyButtonDrawable extends Drawable { int mShadowColor; float mDarkIntensity; int mAlpha; boolean mHorizontalFlip; boolean mIsHardwareBitmap; Bitmap mLastDrawnIcon; Loading @@ -368,11 +381,12 @@ public class KeyButtonDrawable extends Drawable { final boolean mSupportsAnimation; public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor, boolean animated) { boolean animated, boolean horizontalFlip) { mLightColor = lightColor; mDarkColor = darkColor; mSupportsAnimation = animated; mAlpha = 255; mHorizontalFlip = horizontalFlip; } @Override Loading Loading @@ -418,10 +432,12 @@ public class KeyButtonDrawable extends Drawable { public static KeyButtonDrawable create(Context context, @ColorInt int lightColor, @ColorInt int darkColor, @DrawableRes int iconResId, boolean hasShadow) { final KeyButtonDrawable drawable = new KeyButtonDrawable(context.getDrawable(iconResId), lightColor, darkColor); if (hasShadow) { final Resources res = context.getResources(); boolean isRtl = res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Drawable d = context.getDrawable(iconResId); final KeyButtonDrawable drawable = new KeyButtonDrawable(d, lightColor, darkColor, isRtl && d.isAutoMirrored()); if (hasShadow) { int offsetX = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_x); int offsetY = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_y); int radius = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_radius); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,10 @@ public class NavigationBarContextTest extends SysuiTestCase { final int unusedColor = 0; final Drawable d = mock(Drawable.class); final ContextualButton button = spy(mBtn0); final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, false /* horizontalFlip */)); final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, false /* horizontalFlip */)); kbd1.setDarkIntensity(TEST_DARK_INTENSITY); kbd2.setDarkIntensity(0f); Loading Loading
packages/SystemUI/res/drawable/ic_sysbar_back.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> Loading
packages/SystemUI/res/drawable/ic_sysbar_back_quick_step.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:autoMirrored="true" android:viewportWidth="28" android:viewportHeight="28"> <path Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +1 −3 Original line number Diff line number Diff line Loading @@ -507,9 +507,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav final boolean useAltBack = (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float degrees = useAltBack ? (isRtl ? 270 : -90) : (isRtl ? 180 : 0); float degrees = useAltBack ? (isRtl ? 90 : -90) : 0; if (drawable.getRotation() == degrees) { return; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +24 −8 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.view.ContextThemeWrapper; import android.view.View; import com.android.settingslib.Utils; import com.android.systemui.R; Loading Loading @@ -79,9 +80,10 @@ public class KeyButtonDrawable extends Drawable { private final ShadowDrawableState mState; private AnimatedVectorDrawable mAnimatedDrawable; public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor) { public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor, boolean horizontalFlip) { this(d, new ShadowDrawableState(lightColor, darkColor, d instanceof AnimatedVectorDrawable)); d instanceof AnimatedVectorDrawable, horizontalFlip)); } private KeyButtonDrawable(Drawable d, ShadowDrawableState state) { Loading Loading @@ -282,7 +284,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); canvas.save(); if (mState.mHorizontalFlip) { canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); } d.draw(canvas); canvas.restore(); if (mState.mIsHardwareBitmap) { bitmap = bitmap.copy(Bitmap.Config.HARDWARE, false); Loading @@ -305,7 +312,12 @@ public class KeyButtonDrawable extends Drawable { // Call mutate, so that the pixel allocation by the underlying vector drawable is cleared. final Drawable d = mState.mChildState.newDrawable().mutate(); setDrawableBounds(d); canvas.save(); if (mState.mHorizontalFlip) { canvas.scale(-1f, 1f, width * 0.5f, height * 0.5f); } d.draw(canvas); canvas.restore(); // Draws the shadow from original drawable Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); Loading Loading @@ -357,6 +369,7 @@ public class KeyButtonDrawable extends Drawable { int mShadowColor; float mDarkIntensity; int mAlpha; boolean mHorizontalFlip; boolean mIsHardwareBitmap; Bitmap mLastDrawnIcon; Loading @@ -368,11 +381,12 @@ public class KeyButtonDrawable extends Drawable { final boolean mSupportsAnimation; public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor, boolean animated) { boolean animated, boolean horizontalFlip) { mLightColor = lightColor; mDarkColor = darkColor; mSupportsAnimation = animated; mAlpha = 255; mHorizontalFlip = horizontalFlip; } @Override Loading Loading @@ -418,10 +432,12 @@ public class KeyButtonDrawable extends Drawable { public static KeyButtonDrawable create(Context context, @ColorInt int lightColor, @ColorInt int darkColor, @DrawableRes int iconResId, boolean hasShadow) { final KeyButtonDrawable drawable = new KeyButtonDrawable(context.getDrawable(iconResId), lightColor, darkColor); if (hasShadow) { final Resources res = context.getResources(); boolean isRtl = res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Drawable d = context.getDrawable(iconResId); final KeyButtonDrawable drawable = new KeyButtonDrawable(d, lightColor, darkColor, isRtl && d.isAutoMirrored()); if (hasShadow) { int offsetX = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_x); int offsetY = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_y); int radius = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_radius); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,10 @@ public class NavigationBarContextTest extends SysuiTestCase { final int unusedColor = 0; final Drawable d = mock(Drawable.class); final ContextualButton button = spy(mBtn0); final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor)); final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, false /* horizontalFlip */)); final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor, false /* horizontalFlip */)); kbd1.setDarkIntensity(TEST_DARK_INTENSITY); kbd2.setDarkIntensity(0f); Loading