diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java | 22 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BatteryStatusChip.kt | 11 |
2 files changed, 16 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java index f25f994bf8f3..b1a153aa86aa 100644 --- a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java @@ -47,9 +47,9 @@ import androidx.annotation.VisibleForTesting; import com.android.app.animation.Interpolators; import com.android.systemui.DualToneHandler; -import com.android.systemui.res.R; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; +import com.android.systemui.res.R; import com.android.systemui.statusbar.policy.BatteryController; import java.io.PrintWriter; @@ -87,10 +87,7 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { private Drawable mUnknownStateDrawable; private DualToneHandler mDualToneHandler; - - private int mNonAdaptedSingleToneColor; - private int mNonAdaptedForegroundColor; - private int mNonAdaptedBackgroundColor; + private boolean mIsStaticColor = false; private BatteryEstimateFetcher mBatteryEstimateFetcher; @@ -447,13 +444,18 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { @Override public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { + if (mIsStaticColor) return; float intensity = DarkIconDispatcher.isInAreas(areas, this) ? darkIntensity : 0; - mNonAdaptedSingleToneColor = mDualToneHandler.getSingleColor(intensity); - mNonAdaptedForegroundColor = mDualToneHandler.getFillColor(intensity); - mNonAdaptedBackgroundColor = mDualToneHandler.getBackgroundColor(intensity); + int nonAdaptedSingleToneColor = mDualToneHandler.getSingleColor(intensity); + int nonAdaptedForegroundColor = mDualToneHandler.getFillColor(intensity); + int nonAdaptedBackgroundColor = mDualToneHandler.getBackgroundColor(intensity); + + updateColors(nonAdaptedForegroundColor, nonAdaptedBackgroundColor, + nonAdaptedSingleToneColor); + } - updateColors(mNonAdaptedForegroundColor, mNonAdaptedBackgroundColor, - mNonAdaptedSingleToneColor); + public void setStaticColor(boolean isStaticColor) { + mIsStaticColor = isStaticColor; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BatteryStatusChip.kt b/packages/SystemUI/src/com/android/systemui/statusbar/BatteryStatusChip.kt index 2281ea02aaf8..835225009110 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BatteryStatusChip.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BatteryStatusChip.kt @@ -22,9 +22,8 @@ import android.util.AttributeSet import android.view.View import android.widget.FrameLayout import android.widget.LinearLayout -import com.android.settingslib.Utils -import com.android.systemui.res.R import com.android.systemui.battery.BatteryMeterView +import com.android.systemui.res.R import com.android.systemui.statusbar.events.BackgroundAnimatableView class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : @@ -39,6 +38,9 @@ class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: Attri inflate(context, R.layout.battery_status_chip, this) roundedContainer = requireViewById(R.id.rounded_container) batteryMeterView = requireViewById(R.id.battery_meter_view) + batteryMeterView.setStaticColor(true) + val primaryColor = context.resources.getColor(android.R.color.black, context.theme) + batteryMeterView.updateColors(primaryColor, primaryColor, primaryColor) updateResources() } @@ -63,11 +65,6 @@ class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: Attri @SuppressLint("UseCompatLoadingForDrawables") private fun updateResources() { - val primaryColor = - Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.colorPrimary) - val textColorSecondary = - Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorSecondary) - batteryMeterView.updateColors(primaryColor, textColorSecondary, primaryColor) roundedContainer.background = mContext.getDrawable(R.drawable.statusbar_chip_bg) } } |