Loading packages/SystemUI/res/layout/quick_qs_status_icons.xml +15 −3 Original line number Diff line number Diff line Loading @@ -13,13 +13,25 @@ See the License for the specific language governing permissions and limitations under the License. --> <View <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/quick_qs_status_icons" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginBottom="22dp" android:layout_marginTop="8dp" android:layout_marginBottom="14dp" android:layout_below="@id/quick_status_bar_system_icons" > </View> <com.android.systemui.statusbar.phone.StatusIconContainer android:id="@+id/statusIcons" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <include layout="@layout/signal_cluster_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginStart="@dimen/signal_cluster_margin_start" /> </LinearLayout> packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +44 −11 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; Loading @@ -56,6 +57,10 @@ public class QuickStatusBarHeader extends RelativeLayout protected QuickQSPanel mHeaderQsPanel; protected QSTileHost mHost; private TintedIconManager mIconManager; private TouchAnimator mAlphaAnimator; private View mQuickQsStatusIcons; private View mDate; Loading @@ -71,16 +76,25 @@ public class QuickStatusBarHeader extends RelativeLayout mHeaderQsPanel = findViewById(R.id.quick_qs_panel); mDate = findViewById(R.id.date); mDate.setOnClickListener(this); mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons); mIconManager = new TintedIconManager(findViewById(R.id.statusIcons)); // RenderThread is doing more harm than good when touching the header (to expand quick // settings), so disable it for this view updateResources(); // Set light text on the header icons because they will always be on a black background int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); Rect tintArea = new Rect(0, 0, 0, 0); int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); float intensity = colorForeground == Color.WHITE ? 0 : 1; int fillColor = fillColorForIntensity(intensity, getContext()); // Set light text on the header icons because they will always be on a black background applyDarkness(R.id.clock, tintArea, 0, DarkIconDispatcher.DEFAULT_ICON_TINT); applyDarkness(id.signal_cluster, tintArea, intensity, colorForeground); // Set the correct tint for the status icons so they contrast mIconManager.setTint(fillColor); BatteryMeterView battery = findViewById(R.id.battery); battery.setFillColor(Color.WHITE); Loading @@ -96,6 +110,13 @@ public class QuickStatusBarHeader extends RelativeLayout } } private int fillColorForIntensity(float intensity, Context context) { if (intensity == 0) { return context.getColor(R.color.light_mode_icon_color_dual_tone_fill); } return context.getColor(R.color.dark_mode_icon_color_dual_tone_fill); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading @@ -109,6 +130,13 @@ public class QuickStatusBarHeader extends RelativeLayout } private void updateResources() { updateAlphaAnimator(); } private void updateAlphaAnimator() { mAlphaAnimator = new TouchAnimator.Builder() .addFloat(mQuickQsStatusIcons, "alpha", 1, 0) .build(); } public int getCollapsedHeight() { Loading @@ -127,6 +155,9 @@ public class QuickStatusBarHeader extends RelativeLayout } public void setExpansion(float headerExpansionFraction) { if (mAlphaAnimator != null ) { mAlphaAnimator.setPosition(headerExpansionFraction); } } @Override Loading @@ -142,6 +173,7 @@ public class QuickStatusBarHeader extends RelativeLayout @Override public void onAttachedToWindow() { SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); Dependency.get(StatusBarIconController.class).addIconGroup(mIconManager); } @Override Loading @@ -149,17 +181,10 @@ public class QuickStatusBarHeader extends RelativeLayout public void onDetachedFromWindow() { setListening(false); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallbacks(this); Dependency.get(StatusBarIconController.class).removeIconGroup(mIconManager); super.onDetachedFromWindow(); } @Override public void onClick(View v) { if (v == mDate) { Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent( AlarmClock.ACTION_SHOW_ALARMS), 0); } } public void setListening(boolean listening) { if (listening == mListening) { return; Loading @@ -168,6 +193,14 @@ public class QuickStatusBarHeader extends RelativeLayout mListening = listening; } @Override public void onClick(View v) { if(v == mDate){ Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent( AlarmClock.ACTION_SHOW_ALARMS),0); } } public void updateEverything() { post(() -> setClickable(false)); } Loading Loading
packages/SystemUI/res/layout/quick_qs_status_icons.xml +15 −3 Original line number Diff line number Diff line Loading @@ -13,13 +13,25 @@ See the License for the specific language governing permissions and limitations under the License. --> <View <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/quick_qs_status_icons" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginBottom="22dp" android:layout_marginTop="8dp" android:layout_marginBottom="14dp" android:layout_below="@id/quick_status_bar_system_icons" > </View> <com.android.systemui.statusbar.phone.StatusIconContainer android:id="@+id/statusIcons" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <include layout="@layout/signal_cluster_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginStart="@dimen/signal_cluster_margin_start" /> </LinearLayout>
packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +44 −11 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.SignalClusterView; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; Loading @@ -56,6 +57,10 @@ public class QuickStatusBarHeader extends RelativeLayout protected QuickQSPanel mHeaderQsPanel; protected QSTileHost mHost; private TintedIconManager mIconManager; private TouchAnimator mAlphaAnimator; private View mQuickQsStatusIcons; private View mDate; Loading @@ -71,16 +76,25 @@ public class QuickStatusBarHeader extends RelativeLayout mHeaderQsPanel = findViewById(R.id.quick_qs_panel); mDate = findViewById(R.id.date); mDate.setOnClickListener(this); mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons); mIconManager = new TintedIconManager(findViewById(R.id.statusIcons)); // RenderThread is doing more harm than good when touching the header (to expand quick // settings), so disable it for this view updateResources(); // Set light text on the header icons because they will always be on a black background int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); Rect tintArea = new Rect(0, 0, 0, 0); int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); float intensity = colorForeground == Color.WHITE ? 0 : 1; int fillColor = fillColorForIntensity(intensity, getContext()); // Set light text on the header icons because they will always be on a black background applyDarkness(R.id.clock, tintArea, 0, DarkIconDispatcher.DEFAULT_ICON_TINT); applyDarkness(id.signal_cluster, tintArea, intensity, colorForeground); // Set the correct tint for the status icons so they contrast mIconManager.setTint(fillColor); BatteryMeterView battery = findViewById(R.id.battery); battery.setFillColor(Color.WHITE); Loading @@ -96,6 +110,13 @@ public class QuickStatusBarHeader extends RelativeLayout } } private int fillColorForIntensity(float intensity, Context context) { if (intensity == 0) { return context.getColor(R.color.light_mode_icon_color_dual_tone_fill); } return context.getColor(R.color.dark_mode_icon_color_dual_tone_fill); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading @@ -109,6 +130,13 @@ public class QuickStatusBarHeader extends RelativeLayout } private void updateResources() { updateAlphaAnimator(); } private void updateAlphaAnimator() { mAlphaAnimator = new TouchAnimator.Builder() .addFloat(mQuickQsStatusIcons, "alpha", 1, 0) .build(); } public int getCollapsedHeight() { Loading @@ -127,6 +155,9 @@ public class QuickStatusBarHeader extends RelativeLayout } public void setExpansion(float headerExpansionFraction) { if (mAlphaAnimator != null ) { mAlphaAnimator.setPosition(headerExpansionFraction); } } @Override Loading @@ -142,6 +173,7 @@ public class QuickStatusBarHeader extends RelativeLayout @Override public void onAttachedToWindow() { SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); Dependency.get(StatusBarIconController.class).addIconGroup(mIconManager); } @Override Loading @@ -149,17 +181,10 @@ public class QuickStatusBarHeader extends RelativeLayout public void onDetachedFromWindow() { setListening(false); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).removeCallbacks(this); Dependency.get(StatusBarIconController.class).removeIconGroup(mIconManager); super.onDetachedFromWindow(); } @Override public void onClick(View v) { if (v == mDate) { Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent( AlarmClock.ACTION_SHOW_ALARMS), 0); } } public void setListening(boolean listening) { if (listening == mListening) { return; Loading @@ -168,6 +193,14 @@ public class QuickStatusBarHeader extends RelativeLayout mListening = listening; } @Override public void onClick(View v) { if(v == mDate){ Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent( AlarmClock.ACTION_SHOW_ALARMS),0); } } public void updateEverything() { post(() -> setClickable(false)); } Loading