Merge "Use different colors for grid-based global actions menu."

This commit is contained in:
Aaron Heuckroth
2019-03-18 17:12:48 +00:00
committed by Android (Google) Code Review
6 changed files with 91 additions and 51 deletions

View File

@@ -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"

View File

@@ -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>

View File

@@ -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>

View File

@@ -115,4 +115,4 @@ public class HardwareBgDrawable extends LayerDrawable {
public void setRotatedBackground(boolean rotatedBackground) {
mRotatedBackground = rotatedBackground;
}
}
}

View File

@@ -383,8 +383,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 {
@@ -395,7 +394,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
}
if (mEmergencyAffordanceManager.needsEmergencyAffordance()) {
mItems.add(getEmergencyAction());
mItems.add(new EmergencyAffordanceAction());
}
mAdapter = new MyAdapter();
@@ -484,7 +483,59 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
}
}
private class EmergencyDialerAction extends SinglePressAction {
private abstract class EmergencyAction extends SinglePressAction {
EmergencyAction(int iconResId, int messageResId) {
super(iconResId, messageResId);
}
@Override
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
public boolean showDuringKeyguard() {
return true;
}
@Override
public boolean showBeforeProvisioning() {
return true;
}
}
private class EmergencyAffordanceAction extends EmergencyAction {
EmergencyAffordanceAction() {
super(R.drawable.emergency_icon,
R.string.global_action_emergency);
}
@Override
public void onPress() {
mEmergencyAffordanceManager.performEmergencyCall();
}
}
private class EmergencyDialerAction extends EmergencyAction {
private EmergencyDialerAction() {
super(R.drawable.ic_faster_emergency,
R.string.global_action_emergency);
@@ -501,21 +552,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
EmergencyDialerConstants.ENTRY_TYPE_POWER_MENU);
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
}
@Override
public boolean showDuringKeyguard() {
return true;
}
@Override
public boolean showBeforeProvisioning() {
return true;
}
@Override
public boolean shouldBeSeparated() {
return true;
}
}
private final class RestartAction extends SinglePressAction implements LongPressAction {
@@ -703,32 +739,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) {

View File

@@ -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