diff --git a/packages/SystemUI/res/layout/controls_with_favorites.xml b/packages/SystemUI/res/layout/controls_with_favorites.xml index 91beeb88d87f7..623f2a0d34236 100644 --- a/packages/SystemUI/res/layout/controls_with_favorites.xml +++ b/packages/SystemUI/res/layout/controls_with_favorites.xml @@ -72,6 +72,6 @@ android:layout_height="wrap_content" android:orientation="vertical" android:paddingTop="30dp" - android:layout_marginLeft="@dimen/controls_list_side_margin" - android:layout_marginRight="@dimen/controls_list_side_margin" /> + android:layout_marginLeft="@dimen/global_actions_side_margin" + android:layout_marginRight="@dimen/global_actions_side_margin" /> diff --git a/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml b/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml index cb53fe619b248..72cc2ddba282c 100644 --- a/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml +++ b/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml @@ -18,15 +18,16 @@ work around this for now with LinearLayouts. --> 4dp - 10dp + 10dp diff --git a/packages/SystemUI/res/values-sw360dp/dimens.xml b/packages/SystemUI/res/values-sw360dp/dimens.xml index 35a653608a90b..fc510bf03efd4 100644 --- a/packages/SystemUI/res/values-sw360dp/dimens.xml +++ b/packages/SystemUI/res/values-sw360dp/dimens.xml @@ -27,6 +27,6 @@ 40dip - 12dp + 12dp diff --git a/packages/SystemUI/res/values-sw392dp/dimens.xml b/packages/SystemUI/res/values-sw392dp/dimens.xml index 308bc69656dab..4c9d02e30bfa9 100644 --- a/packages/SystemUI/res/values-sw392dp/dimens.xml +++ b/packages/SystemUI/res/values-sw392dp/dimens.xml @@ -31,6 +31,6 @@ 4dp - 16dp + 16dp diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 288487acec792..4482cdac33274 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -50,6 +50,10 @@ @color/GM2_red_700 + + @color/GM2_red_400 + @color/GM2_grey_100 + #ff686868 @@ -211,6 +215,7 @@ #FCE8E6 #F6AEA9 #F28B82 + #EE675C #B71C1C #C5221F diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index bce5fac76cfcb..be591c3957086 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1008,6 +1008,9 @@ 20dp -20dp + + 16dp + 8dp @@ -1231,7 +1234,6 @@ 4dp 48dp 40dp - 16dp 44dp 22sp 14sp diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 4dd5e87d2c93f..800f217ed9f77 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -39,6 +39,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.UserInfo; +import android.content.res.ColorStateList; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Color; @@ -188,7 +189,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, private boolean mKeyguardShowing = false; private boolean mDeviceProvisioned = false; - private ToggleAction.State mAirplaneState = ToggleAction.State.Off; + private ToggleState mAirplaneState = ToggleState.Off; private boolean mIsWaitingForEcmExit = false; private boolean mHasTelephony; private boolean mHasVibrator; @@ -594,7 +595,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, @Override public boolean shouldBeSeparated() { - return true; + return !shouldShowControls(); } @Override @@ -602,7 +603,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = super.create(context, convertView, parent, inflater); int textColor; - if (shouldBeSeparated()) { + if (shouldShowControls()) { + v.setBackgroundTintList(ColorStateList.valueOf(v.getResources().getColor( + com.android.systemui.R.color.global_actions_emergency_background))); + textColor = v.getResources().getColor( + com.android.systemui.R.color.global_actions_emergency_text); + } else if (shouldBeSeparated()) { textColor = v.getResources().getColor( com.android.systemui.R.color.global_actions_alert_text); } else { @@ -612,7 +618,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, TextView messageView = v.findViewById(R.id.message); messageView.setTextColor(textColor); messageView.setSelected(true); // necessary for marquee to work - ImageView icon = (ImageView) v.findViewById(R.id.icon); + ImageView icon = v.findViewById(R.id.icon); icon.getDrawable().setTint(textColor); return v; } @@ -993,7 +999,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, final boolean silentModeOn = mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL; ((ToggleAction) mSilentModeAction).updateState( - silentModeOn ? ToggleAction.State.On : ToggleAction.State.Off); + silentModeOn ? ToggleState.On : ToggleState.Off); } } @@ -1023,6 +1029,13 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mUiEventLogger.log(GlobalActionsEvent.GA_POWER_MENU_OPEN); } + private int getActionLayoutId() { + if (shouldShowControls()) { + return com.android.systemui.R.layout.global_actions_grid_item_v2; + } + return com.android.systemui.R.layout.global_actions_grid_item; + } + /** * The adapter used for the list within the global actions dialog, taking into account whether * the keyguard is showing via @@ -1234,20 +1247,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } } - protected int getActionLayoutId(Context context) { - if (shouldShowControls()) { - return com.android.systemui.R.layout.global_actions_grid_item_v2; - } - return com.android.systemui.R.layout.global_actions_grid_item; - } - public View create( Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { - View v = inflater.inflate(getActionLayoutId(context), parent, - false); + View v = inflater.inflate(getActionLayoutId(), parent, false /* attach */); - ImageView icon = (ImageView) v.findViewById(R.id.icon); - TextView messageView = (TextView) v.findViewById(R.id.message); + ImageView icon = v.findViewById(R.id.icon); + TextView messageView = v.findViewById(R.id.message); messageView.setSelected(true); // necessary for marquee to work if (mIcon != null) { @@ -1266,30 +1271,30 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } } + private enum ToggleState { + Off(false), + TurningOn(true), + TurningOff(true), + On(false); + + private final boolean mInTransition; + + ToggleState(boolean intermediate) { + mInTransition = intermediate; + } + + public boolean inTransition() { + return mInTransition; + } + } + /** * A toggle action knows whether it is on or off, and displays an icon and status message * accordingly. */ - private static abstract class ToggleAction implements Action { + private abstract class ToggleAction implements Action { - enum State { - Off(false), - TurningOn(true), - TurningOff(true), - On(false); - - private final boolean inTransition; - - State(boolean intermediate) { - inTransition = intermediate; - } - - public boolean inTransition() { - return inTransition; - } - } - - protected State mState = State.Off; + protected ToggleState mState = ToggleState.Off; // prefs protected int mEnabledIconResId; @@ -1333,13 +1338,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, LayoutInflater inflater) { willCreate(); - View v = inflater.inflate(com.android.systemui.R - .layout.global_actions_grid_item, parent, false); + View v = inflater.inflate(getActionLayoutId(), parent, false /* attach */); ImageView icon = (ImageView) v.findViewById(R.id.icon); TextView messageView = (TextView) v.findViewById(R.id.message); final boolean enabled = isEnabled(); - boolean on = ((mState == State.On) || (mState == State.TurningOn)); + boolean on = ((mState == ToggleState.On) || (mState == ToggleState.TurningOn)); if (messageView != null) { messageView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId); @@ -1364,7 +1368,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, return; } - final boolean nowOn = !(mState == State.On); + final boolean nowOn = !(mState == ToggleState.On); onToggle(nowOn); changeStateFromPress(nowOn); } @@ -1381,12 +1385,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, * @param buttonOn Whether the button was turned on or off */ protected void changeStateFromPress(boolean buttonOn) { - mState = buttonOn ? State.On : State.Off; + mState = buttonOn ? ToggleState.On : ToggleState.Off; } abstract void onToggle(boolean on); - public void updateState(State state) { + public void updateState(ToggleState state) { mState = state; } } @@ -1420,7 +1424,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, // In ECM mode airplane state cannot be changed if (!TelephonyProperties.in_ecm_mode().orElse(false)) { - mState = buttonOn ? State.TurningOn : State.TurningOff; + mState = buttonOn ? ToggleState.TurningOn : ToggleState.TurningOff; mAirplaneState = mState; } } @@ -1555,7 +1559,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, public void onServiceStateChanged(ServiceState serviceState) { if (!mHasTelephony) return; final boolean inAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF; - mAirplaneState = inAirplaneMode ? ToggleAction.State.On : ToggleAction.State.Off; + mAirplaneState = inAirplaneMode ? ToggleState.On : ToggleState.Off; mAirplaneModeOn.updateState(mAirplaneState); mAdapter.notifyDataSetChanged(); } @@ -1614,7 +1618,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 0) == 1; - mAirplaneState = airplaneModeOn ? ToggleAction.State.On : ToggleAction.State.Off; + mAirplaneState = airplaneModeOn ? ToggleState.On : ToggleState.Off; mAirplaneModeOn.updateState(mAirplaneState); } @@ -1631,7 +1635,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, intent.putExtra("state", on); mContext.sendBroadcastAsUser(intent, UserHandle.ALL); if (!mHasTelephony) { - mAirplaneState = on ? ToggleAction.State.On : ToggleAction.State.Off; + mAirplaneState = on ? ToggleState.On : ToggleState.Off; } }