diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index 9911d9db6c03a..e0b4ec5027bb4 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -748,12 +748,12 @@ easier. - diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java index 78ad34acf8f02..0ab296e3405a2 100644 --- a/packages/SettingsLib/src/com/android/settingslib/Utils.java +++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java @@ -186,6 +186,11 @@ public class Utils { TypedArray ta = context.obtainStyledAttributes(new int[]{attr}); float alpha = ta.getFloat(0, 0); ta.recycle(); + return applyAlpha(alpha, inputColor); + } + + @ColorInt + public static int applyAlpha(float alpha, int inputColor) { alpha *= Color.alpha(inputColor); return Color.argb((int) (alpha), Color.red(inputColor), Color.green(inputColor), Color.blue(inputColor)); diff --git a/packages/SystemUI/res/drawable/qs_background_primary.xml b/packages/SystemUI/res/drawable/qs_background_primary.xml index 8ea9e06391088..0bdbc5f17be62 100644 --- a/packages/SystemUI/res/drawable/qs_background_primary.xml +++ b/packages/SystemUI/res/drawable/qs_background_primary.xml @@ -15,6 +15,6 @@ --> - + diff --git a/packages/SystemUI/res/layout/qs_divider.xml b/packages/SystemUI/res/layout/qs_divider.xml index 660e4afbb43cd..39d48ea4746ef 100644 --- a/packages/SystemUI/res/layout/qs_divider.xml +++ b/packages/SystemUI/res/layout/qs_divider.xml @@ -16,6 +16,5 @@ diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 2e6116dba7e9a..38485c729b213 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -32,6 +32,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.plugins.qs.DetailAdapter; @@ -118,7 +119,8 @@ public class QSPanel extends LinearLayout implements Tunable, Callback { protected void addDivider() { mDivider = LayoutInflater.from(mContext).inflate(R.layout.qs_divider, this, false); - mDivider.setBackgroundColor(getColorForState(mContext, Tile.STATE_INACTIVE)); + mDivider.setBackgroundColor(Utils.applyAlpha(mDivider.getAlpha(), + getColorForState(mContext, Tile.STATE_ACTIVE))); addView(mDivider); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index d0d6f61836701..7518527a30938 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -21,15 +21,19 @@ import android.graphics.Color; import android.graphics.Rect; import android.support.annotation.VisibleForTesting; import android.util.AttributeSet; +import android.view.View; import android.widget.RelativeLayout; +import android.widget.TextClock; import com.android.settingslib.Utils; import com.android.systemui.BatteryMeterView; import com.android.systemui.Dependency; import com.android.systemui.R; +import com.android.systemui.R.id; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.SignalClusterView; +import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; public class QuickStatusBarHeader extends RelativeLayout { @@ -63,19 +67,27 @@ public class QuickStatusBarHeader extends RelativeLayout { updateResources(); // Set the light/dark theming on the header status UI to match the current theme. - SignalClusterView cluster = findViewById(R.id.signal_cluster); int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); float intensity = colorForeground == Color.WHITE ? 0 : 1; - cluster.onDarkChanged(new Rect(0, 0, 0, 0), intensity, colorForeground); + Rect tintArea = new Rect(0, 0, 0, 0); + + applyDarkness(R.id.signal_cluster, tintArea, intensity, colorForeground); + applyDarkness(R.id.battery, tintArea, intensity, colorForeground); + applyDarkness(R.id.clock, tintArea, intensity, colorForeground); BatteryMeterView battery = findViewById(R.id.battery); battery.setForceShowPercent(true); - int colorSecondary = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary); - battery.setRawColors(colorForeground, colorSecondary); mActivityStarter = Dependency.get(ActivityStarter.class); } + private void applyDarkness(int id, Rect tintArea, float intensity, int color) { + View v = findViewById(id); + if (v instanceof DarkReceiver) { + ((DarkReceiver) v).onDarkChanged(tintArea, intensity, color); + } + } + @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java index df2a9fb0892df..6781c1673408b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -22,6 +22,7 @@ import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_ import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_ACTION; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; +import android.R.attr; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; @@ -342,9 +343,9 @@ public abstract class QSTileImpl implements QSTile { Utils.getColorAttr(context, android.R.attr.textColorTertiary)); case Tile.STATE_INACTIVE: return Utils.getDisabled(context, - Utils.getColorAttr(context, android.R.attr.colorForeground)); + Utils.getColorAttr(context, android.R.attr.textColorSecondary)); case Tile.STATE_ACTIVE: - return Utils.getColorAttr(context, android.R.attr.colorForeground); + return Utils.getColorAttr(context, attr.textColorSecondary); default: Log.e("QSTile", "Invalid state " + state); return 0;