Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e093068e authored by Jason Monk's avatar Jason Monk Committed by android-build-merger
Browse files

Merge "Fix the status icon colors in QS" into oc-dev

am: d4723492

Change-Id: I052e36141f36ed48ae9b60d210efd9be7bd4cc2b
parents ae8e0149 d4723492
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;

@@ -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) {
+7 −0
Original line number Diff line number Diff line
@@ -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);
+0 −39
Original line number Diff line number Diff line
@@ -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();
@@ -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);
    }
@@ -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);
@@ -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;
+6 −6
Original line number Diff line number Diff line
@@ -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"
@@ -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"
@@ -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"
+3 −0
Original line number Diff line number Diff line
@@ -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