diff options
6 files changed, 90 insertions, 50 deletions
diff --git a/packages/SystemUI/res/layout/global_actions_grid.xml b/packages/SystemUI/res/layout/global_actions_grid.xml index d90d5e9f676b..8651e5a463c9 100644 --- a/packages/SystemUI/res/layout/global_actions_grid.xml +++ b/packages/SystemUI/res/layout/global_actions_grid.xml @@ -31,7 +31,6 @@ android:paddingTop="@dimen/global_actions_grid_vertical_padding" android:paddingBottom="@dimen/global_actions_grid_vertical_padding" android:orientation="vertical" - android:background="?android:attr/colorBackgroundFloating" android:gravity="center" android:translationZ="@dimen/global_actions_translate" /> @@ -48,7 +47,6 @@ android:paddingRight="@dimen/global_actions_grid_horizontal_padding" android:paddingTop="@dimen/global_actions_grid_vertical_padding" android:paddingBottom="@dimen/global_actions_grid_vertical_padding" - android:background="?android:attr/colorBackgroundFloating" > <LinearLayout android:layout_width="wrap_content" diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml index 5803bf129c24..d74d25846e3c 100644 --- a/packages/SystemUI/res/values-night/colors.xml +++ b/packages/SystemUI/res/values-night/colors.xml @@ -47,4 +47,16 @@ <!-- The color of the background in the bottom part of QSCustomizer --> <color name="qs_customize_decoration">@color/GM2_grey_800</color> + + <!-- The color of the background in the separated list of the Global Actions menu --> + <color name="global_actions_separated_background">@color/GM2_grey_900</color> + + <!-- The color of the background in the grid of the Global Actions menu --> + <color name="global_actions_grid_background">@color/GM2_grey_800</color> + + <!-- The color of the text in the Global Actions menu --> + <color name="global_actions_text">@color/GM2_grey_200</color> + + <!-- The color of the text in the Global Actions menu --> + <color name="global_actions_alert_text">@color/GM2_red_300</color> </resources>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 0e4ffee81165..b82c250e2bd2 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -38,6 +38,18 @@ <color name="qs_customize_background">@color/GM2_grey_50</color> <color name="qs_customize_decoration">@color/GM2_grey_100</color> + <!-- The color of the background in the separated list of the Global Actions menu --> + <color name="global_actions_separated_background">@color/GM2_grey_300</color> + + <!-- The color of the background in the grid of the Global Actions menu --> + <color name="global_actions_grid_background">@color/GM2_grey_200</color> + + <!-- The color of the text in the Global Actions menu --> + <color name="global_actions_text">@color/GM2_grey_900</color> + + <!-- The color of the text in the Global Actions menu --> + <color name="global_actions_alert_text">@color/GM2_red_500</color> + <!-- Tint color for the content on the notification overflow card. --> <color name="keyguard_overflow_content_color">#ff686868</color> @@ -149,4 +161,7 @@ <color name="GM2_grey_700">#5F6368</color> <color name="GM2_grey_800">#3C4043</color> <color name="GM2_grey_900">#202124</color> + + <color name="GM2_red_300">#F28B82</color> + <color name="GM2_red_500">#B71C1C</color> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java index 97d799909ed9..d631cf3551d9 100644 --- a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java @@ -115,4 +115,4 @@ public class HardwareBgDrawable extends LayerDrawable { public void setRotatedBackground(boolean rotatedBackground) { mRotatedBackground = rotatedBackground; } -} +}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index ce588955298c..50530ff46e8d 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -379,8 +379,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mHasLogoutButton = true; } } else if (GLOBAL_ACTION_KEY_EMERGENCY.equals(actionKey)) { - if (shouldUseSeparatedView() - && !mEmergencyAffordanceManager.needsEmergencyAffordance()) { + if (!mEmergencyAffordanceManager.needsEmergencyAffordance()) { mItems.add(new EmergencyDialerAction()); } } else { @@ -391,7 +390,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } if (mEmergencyAffordanceManager.needsEmergencyAffordance()) { - mItems.add(getEmergencyAction()); + mItems.add(new EmergencyAffordanceAction()); } mAdapter = new MyAdapter(); @@ -469,22 +468,33 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } } - private class EmergencyDialerAction extends SinglePressAction { - private EmergencyDialerAction() { - super(R.drawable.ic_faster_emergency, - R.string.global_action_emergency); + private abstract class EmergencyAction extends SinglePressAction { + EmergencyAction(int iconResId, int messageResId) { + super(iconResId, messageResId); } @Override - public void onPress() { - MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU); - Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK - | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS - | Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE, - EmergencyDialerConstants.ENTRY_TYPE_POWER_MENU); - mContext.startActivityAsUser(intent, UserHandle.CURRENT); + public boolean shouldBeSeparated() { + return shouldUseSeparatedView(); + } + + @Override + public View create( + Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { + View v = super.create(context, convertView, parent, inflater); + int textColor; + if (shouldBeSeparated()) { + textColor = v.getResources().getColor( + com.android.systemui.R.color.global_actions_alert_text); + } else { + textColor = v.getResources().getColor( + com.android.systemui.R.color.global_actions_text); + } + TextView messageView = v.findViewById(R.id.message); + messageView.setTextColor(textColor); + ImageView icon = (ImageView) v.findViewById(R.id.icon); + icon.getDrawable().setTint(textColor); + return v; } @Override @@ -496,10 +506,36 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, public boolean showBeforeProvisioning() { return true; } + } + + private class EmergencyAffordanceAction extends EmergencyAction { + EmergencyAffordanceAction() { + super(R.drawable.emergency_icon, + R.string.global_action_emergency); + } @Override - public boolean shouldBeSeparated() { - return true; + public void onPress() { + mEmergencyAffordanceManager.performEmergencyCall(); + } + } + + private class EmergencyDialerAction extends EmergencyAction { + private EmergencyDialerAction() { + super(R.drawable.ic_faster_emergency, + R.string.global_action_emergency); + } + + @Override + public void onPress() { + MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU); + Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS + | Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE, + EmergencyDialerConstants.ENTRY_TYPE_POWER_MENU); + mContext.startActivityAsUser(intent, UserHandle.CURRENT); } } @@ -688,32 +724,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, }; } - private Action getEmergencyAction() { - Drawable emergencyIcon = mContext.getDrawable(R.drawable.emergency_icon); - if (!shouldUseSeparatedView()) { - // use un-colored legacy treatment - emergencyIcon.setTintList(null); - } - - return new SinglePressAction(R.drawable.emergency_icon, - R.string.global_action_emergency) { - @Override - public void onPress() { - mEmergencyAffordanceManager.performEmergencyCall(); - } - - @Override - public boolean showDuringKeyguard() { - return true; - } - - @Override - public boolean showBeforeProvisioning() { - return true; - } - }; - } - private Action getAssistAction() { return new SinglePressAction(R.drawable.ic_action_assist_focused, R.string.global_action_assist) { diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java index 058ea605bc87..9a0759c70b5b 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java @@ -42,11 +42,16 @@ public class GlobalActionsGridLayout extends MultiListLayout { } private void setBackgrounds() { + int gridBackgroundColor = getResources().getColor( + com.android.systemui.R.color.global_actions_grid_background, null); + int separatedBackgroundColor = getResources().getColor( + com.android.systemui.R.color.global_actions_separated_background, null); HardwareBgDrawable listBackground = new HardwareBgDrawable(true, true, getContext()); - HardwareBgDrawable separatedViewBackground = new HardwareBgDrawable(true, true, - getContext()); + HardwareBgDrawable separatedBackground = new HardwareBgDrawable(true, true, getContext()); + listBackground.setTint(gridBackgroundColor); + separatedBackground.setTint(separatedBackgroundColor); getListView().setBackground(listBackground); - getSeparatedView().setBackground(separatedViewBackground); + getSeparatedView().setBackground(separatedBackground); } @Override |