Loading core/java/android/view/LayoutInflater.java +6 −0 Original line number Diff line number Diff line Loading @@ -639,6 +639,11 @@ public abstract class LayoutInflater { } } Object lastContext = mConstructorArgs[0]; if (mConstructorArgs[0] == null) { // Fill in the context if not already within inflation. mConstructorArgs[0] = mContext; } Object[] args = mConstructorArgs; args[1] = attrs; Loading @@ -648,6 +653,7 @@ public abstract class LayoutInflater { final ViewStub viewStub = (ViewStub) view; viewStub.setLayoutInflater(cloneInContext((Context) args[0])); } mConstructorArgs[0] = lastContext; return view; } catch (NoSuchMethodException e) { Loading packages/SettingsLib/src/com/android/settingslib/Utils.java +7 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,13 @@ public class Utils { return colorAccent; } public static int getThemeAttr(Context context, int attr) { TypedArray ta = context.obtainStyledAttributes(new int[]{attr}); int theme = ta.getResourceId(0, 0); ta.recycle(); return theme; } public static Drawable getDrawable(Context context, int attr) { TypedArray ta = context.obtainStyledAttributes(new int[]{attr}); Drawable drawable = ta.getDrawable(0); Loading packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java +0 −39 Original line number Diff line number Diff line Loading @@ -88,12 +88,6 @@ public class BatteryMeterDrawableBase extends Drawable { private final Path mClipPath = new Path(); private final Path mTextPath = new Path(); private int mDarkModeBackgroundColor; private int mDarkModeFillColor; private int mLightModeBackgroundColor; private int mLightModeFillColor; public BatteryMeterDrawableBase(Context context, int frameColor) { mContext = context; final Resources res = context.getResources(); Loading Loading @@ -156,15 +150,6 @@ public class BatteryMeterDrawableBase extends Drawable { mPlusPaint = new Paint(mBoltPaint); mPlusPoints = loadPoints(res, R.array.batterymeter_plus_points); mDarkModeBackgroundColor = Utils.getDefaultColor(mContext, R.color.dark_mode_icon_color_dual_tone_background); mDarkModeFillColor = Utils.getDefaultColor(mContext, R.color.dark_mode_icon_color_dual_tone_fill); mLightModeBackgroundColor = Utils.getDefaultColor(mContext, R.color.light_mode_icon_color_dual_tone_background); mLightModeFillColor = Utils.getDefaultColor(mContext, R.color.light_mode_icon_color_dual_tone_fill); mIntrinsicWidth = context.getResources().getDimensionPixelSize(R.dimen.battery_width); mIntrinsicHeight = context.getResources().getDimensionPixelSize(R.dimen.battery_height); } Loading Loading @@ -259,16 +244,6 @@ public class BatteryMeterDrawableBase extends Drawable { return color; } public void setDarkIntensity(float darkIntensity) { if (darkIntensity == mOldDarkIntensity) { return; } int backgroundColor = getBackgroundColor(darkIntensity); int fillColor = getFillColor(darkIntensity); setColors(fillColor, backgroundColor); mOldDarkIntensity = darkIntensity; } public void setColors(int fillColor, int backgroundColor) { mIconTint = fillColor; mFramePaint.setColor(backgroundColor); Loading @@ -277,20 +252,6 @@ public class BatteryMeterDrawableBase extends Drawable { invalidateSelf(); } private int getBackgroundColor(float darkIntensity) { return getColorForDarkIntensity( darkIntensity, mLightModeBackgroundColor, mDarkModeBackgroundColor); } private int getFillColor(float darkIntensity) { return getColorForDarkIntensity( darkIntensity, mLightModeFillColor, mDarkModeFillColor); } private int getColorForDarkIntensity(float darkIntensity, int lightColor, int darkColor) { return (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, lightColor, darkColor); } @Override public void draw(Canvas c) { final int level = mLevel; Loading packages/SystemUI/res/layout/signal_cluster_view.xml +6 −6 Original line number Diff line number Diff line Loading @@ -40,13 +40,13 @@ android:layout_width="wrap_content" > <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/ethernet" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/ethernet_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading Loading @@ -79,13 +79,13 @@ android:layout_width="wrap_content" > <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/wifi_signal" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/wifi_signal_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading Loading @@ -120,14 +120,14 @@ android:layout_width="wrap_content" android:contentDescription="@string/accessibility_no_sims"> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/no_sims" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/stat_sys_no_sims" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/no_sims_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading packages/SystemUI/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -128,5 +128,8 @@ <!-- The initial color for the scrim. --> <attr name="scrimColor" format="color" /> </declare-styleable> <attr name="lightIconTheme" format="reference" /> <attr name="darkIconTheme" format="reference" /> </resources> Loading
core/java/android/view/LayoutInflater.java +6 −0 Original line number Diff line number Diff line Loading @@ -639,6 +639,11 @@ public abstract class LayoutInflater { } } Object lastContext = mConstructorArgs[0]; if (mConstructorArgs[0] == null) { // Fill in the context if not already within inflation. mConstructorArgs[0] = mContext; } Object[] args = mConstructorArgs; args[1] = attrs; Loading @@ -648,6 +653,7 @@ public abstract class LayoutInflater { final ViewStub viewStub = (ViewStub) view; viewStub.setLayoutInflater(cloneInContext((Context) args[0])); } mConstructorArgs[0] = lastContext; return view; } catch (NoSuchMethodException e) { Loading
packages/SettingsLib/src/com/android/settingslib/Utils.java +7 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,13 @@ public class Utils { return colorAccent; } public static int getThemeAttr(Context context, int attr) { TypedArray ta = context.obtainStyledAttributes(new int[]{attr}); int theme = ta.getResourceId(0, 0); ta.recycle(); return theme; } public static Drawable getDrawable(Context context, int attr) { TypedArray ta = context.obtainStyledAttributes(new int[]{attr}); Drawable drawable = ta.getDrawable(0); Loading
packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java +0 −39 Original line number Diff line number Diff line Loading @@ -88,12 +88,6 @@ public class BatteryMeterDrawableBase extends Drawable { private final Path mClipPath = new Path(); private final Path mTextPath = new Path(); private int mDarkModeBackgroundColor; private int mDarkModeFillColor; private int mLightModeBackgroundColor; private int mLightModeFillColor; public BatteryMeterDrawableBase(Context context, int frameColor) { mContext = context; final Resources res = context.getResources(); Loading Loading @@ -156,15 +150,6 @@ public class BatteryMeterDrawableBase extends Drawable { mPlusPaint = new Paint(mBoltPaint); mPlusPoints = loadPoints(res, R.array.batterymeter_plus_points); mDarkModeBackgroundColor = Utils.getDefaultColor(mContext, R.color.dark_mode_icon_color_dual_tone_background); mDarkModeFillColor = Utils.getDefaultColor(mContext, R.color.dark_mode_icon_color_dual_tone_fill); mLightModeBackgroundColor = Utils.getDefaultColor(mContext, R.color.light_mode_icon_color_dual_tone_background); mLightModeFillColor = Utils.getDefaultColor(mContext, R.color.light_mode_icon_color_dual_tone_fill); mIntrinsicWidth = context.getResources().getDimensionPixelSize(R.dimen.battery_width); mIntrinsicHeight = context.getResources().getDimensionPixelSize(R.dimen.battery_height); } Loading Loading @@ -259,16 +244,6 @@ public class BatteryMeterDrawableBase extends Drawable { return color; } public void setDarkIntensity(float darkIntensity) { if (darkIntensity == mOldDarkIntensity) { return; } int backgroundColor = getBackgroundColor(darkIntensity); int fillColor = getFillColor(darkIntensity); setColors(fillColor, backgroundColor); mOldDarkIntensity = darkIntensity; } public void setColors(int fillColor, int backgroundColor) { mIconTint = fillColor; mFramePaint.setColor(backgroundColor); Loading @@ -277,20 +252,6 @@ public class BatteryMeterDrawableBase extends Drawable { invalidateSelf(); } private int getBackgroundColor(float darkIntensity) { return getColorForDarkIntensity( darkIntensity, mLightModeBackgroundColor, mDarkModeBackgroundColor); } private int getFillColor(float darkIntensity) { return getColorForDarkIntensity( darkIntensity, mLightModeFillColor, mDarkModeFillColor); } private int getColorForDarkIntensity(float darkIntensity, int lightColor, int darkColor) { return (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, lightColor, darkColor); } @Override public void draw(Canvas c) { final int level = mLevel; Loading
packages/SystemUI/res/layout/signal_cluster_view.xml +6 −6 Original line number Diff line number Diff line Loading @@ -40,13 +40,13 @@ android:layout_width="wrap_content" > <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/ethernet" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/ethernet_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading Loading @@ -79,13 +79,13 @@ android:layout_width="wrap_content" > <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/wifi_signal" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/wifi_signal_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading Loading @@ -120,14 +120,14 @@ android:layout_width="wrap_content" android:contentDescription="@string/accessibility_no_sims"> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneLightTheme" android:theme="?attr/lightIconTheme" android:id="@+id/no_sims" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/stat_sys_no_sims" /> <com.android.systemui.statusbar.AlphaOptimizedImageView android:theme="@style/DualToneDarkTheme" android:theme="?attr/darkIconTheme" android:id="@+id/no_sims_dark" android:layout_height="wrap_content" android:layout_width="wrap_content" Loading
packages/SystemUI/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -128,5 +128,8 @@ <!-- The initial color for the scrim. --> <attr name="scrimColor" format="color" /> </declare-styleable> <attr name="lightIconTheme" format="reference" /> <attr name="darkIconTheme" format="reference" /> </resources>