Controls UI polish
Adjust padding to get closer to redlines. Set a default black scrim to
be used in all cases.
Bug: 148207527
Test: atest SystemUiTests
Change-Id: I4332e5b729174e244d2f067972825518b8cc4015
diff --git a/packages/SystemUI/res/drawable/control_no_favorites_background.xml b/packages/SystemUI/res/drawable/control_no_favorites_background.xml
index 1e282ad..947c77b 100644
--- a/packages/SystemUI/res/drawable/control_no_favorites_background.xml
+++ b/packages/SystemUI/res/drawable/control_no_favorites_background.xml
@@ -17,6 +17,6 @@
*/
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <stroke android:width="1dp" android:color="?android:attr/colorBackgroundFloating"/>
+ <stroke android:width="1dp" android:color="@*android:color/foreground_material_dark"/>
<corners android:radius="@dimen/control_corner_radius" />
</shape>
diff --git a/packages/SystemUI/res/layout/controls_base_item.xml b/packages/SystemUI/res/layout/controls_base_item.xml
index 3c4c61e..cd7ec5e 100644
--- a/packages/SystemUI/res/layout/controls_base_item.xml
+++ b/packages/SystemUI/res/layout/controls_base_item.xml
@@ -23,8 +23,8 @@
android:padding="@dimen/control_padding"
android:clickable="true"
android:focusable="true"
- android:layout_marginLeft="3dp"
- android:layout_marginRight="3dp"
+ android:layout_marginLeft="2dp"
+ android:layout_marginRight="2dp"
android:background="@drawable/control_background">
<ImageView
@@ -60,9 +60,9 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="18sp"
+ android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
- android:fontFamily="@*android:string/config_headlineFontFamily"
+ android:textAppearance="?android:attr/textAppearanceSmall"
app:layout_constraintBottom_toTopOf="@+id/subtitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/icon" />
@@ -71,9 +71,9 @@
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="16sp"
+ android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
- android:fontFamily="@*android:string/config_headlineFontFamily"
+ android:textAppearance="?android:attr/textAppearanceSmall"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/res/layout/controls_no_favorites.xml b/packages/SystemUI/res/layout/controls_no_favorites.xml
index 79672ca..096f1f4 100644
--- a/packages/SystemUI/res/layout/controls_no_favorites.xml
+++ b/packages/SystemUI/res/layout/controls_no_favorites.xml
@@ -12,7 +12,7 @@
android:paddingBottom="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="@*android:color/foreground_material_dark"
android:fontFamily="@*android:string/config_headlineFontFamily"
android:background="@drawable/control_no_favorites_background"/>
</merge>
diff --git a/packages/SystemUI/res/layout/controls_with_favorites.xml b/packages/SystemUI/res/layout/controls_with_favorites.xml
index 7804fe6..6a3e95d 100644
--- a/packages/SystemUI/res/layout/controls_with_favorites.xml
+++ b/packages/SystemUI/res/layout/controls_with_favorites.xml
@@ -4,7 +4,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingBottom="20dp">
<TextView
android:text="@string/quick_controls_title"
@@ -13,17 +14,23 @@
android:singleLine="true"
android:gravity="center"
android:textSize="25dp"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="@*android:color/foreground_material_dark"
android:fontFamily="@*android:string/config_headlineFontFamily"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent"/>
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
<ImageView
android:id="@+id/controls_more"
android:src="@drawable/ic_more_vert"
android:layout_width="34dp"
android:layout_height="24dp"
android:layout_marginEnd="10dp"
- app:layout_constraintEnd_toEndOf="parent"/>
+ android:tint="@*android:color/foreground_material_dark"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/packages/SystemUI/res/layout/global_actions_grid_v2.xml b/packages/SystemUI/res/layout/global_actions_grid_v2.xml
index 6741484..f90012d 100644
--- a/packages/SystemUI/res/layout/global_actions_grid_v2.xml
+++ b/packages/SystemUI/res/layout/global_actions_grid_v2.xml
@@ -96,18 +96,18 @@
app:layout_constraintTop_toBottomOf="@id/global_actions_view">
<FrameLayout
- android:translationY="@dimen/global_actions_plugin_offset"
android:id="@+id/global_actions_panel_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
- android:translationY="@dimen/global_actions_plugin_offset"
android:id="@+id/global_actions_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
+ android:layout_marginRight="@dimen/global_actions_grid_horizontal_padding"
+ android:layout_marginLeft="@dimen/global_actions_grid_horizontal_padding"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/global_actions_panel">
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index cc58b20..1f9fb05 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -972,7 +972,6 @@
<!-- Global actions power menu -->
<dimen name="global_actions_top_margin">12dp</dimen>
- <dimen name="global_actions_plugin_offset">-145dp</dimen>
<dimen name="global_actions_panel_width">120dp</dimen>
<dimen name="global_actions_padding">12dp</dimen>
@@ -1182,7 +1181,7 @@
<dimen name="magnifier_up_down_controls_height">40dp</dimen>
<!-- Home Controls -->
- <dimen name="control_spacing">5dp</dimen>
+ <dimen name="control_spacing">4dp</dimen>
<dimen name="control_corner_radius">15dp</dimen>
<dimen name="control_height">100dp</dimen>
<dimen name="control_padding">15dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
index 926fb6e..40a93d6 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
@@ -29,6 +29,8 @@
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.LinearLayout
+import android.widget.Space
import android.widget.TextView
import com.android.systemui.controls.controller.ControlsController
@@ -144,10 +146,17 @@
inflater.inflate(R.layout.controls_no_favorites, parent, true)
val textView = parent.requireViewById(R.id.controls_title) as TextView
- textView.setOnClickListener {
+ textView.setOnClickListener(launchSelectorActivityListener(context))
+ }
+
+ private fun launchSelectorActivityListener(context: Context): (View) -> Unit {
+ return { _ ->
+ val closeDialog = Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
+ context.sendBroadcast(closeDialog)
+
val i = Intent()
i.setComponent(ComponentName(context, ControlsProviderSelectorActivity::class.java))
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
}
}
@@ -171,13 +180,12 @@
controlViewsById.put(it.controlId, cvh)
}
- val moreImageView = parent.requireViewById(R.id.controls_more) as View
- moreImageView.setOnClickListener {
- val i = Intent()
- i.setComponent(ComponentName(context, ControlsProviderSelectorActivity::class.java))
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
- context.startActivity(i)
+ if ((controlInfos.size % 2) == 1) {
+ lastRow.addView(Space(context), LinearLayout.LayoutParams(0, 0, 1f))
}
+
+ val moreImageView = parent.requireViewById(R.id.controls_more) as View
+ moreImageView.setOnClickListener(launchSelectorActivityListener(context))
}
override fun hide() {
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 80d776a..f33c931 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -40,6 +40,7 @@
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.database.ContentObserver;
+import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.net.ConnectivityManager;
@@ -100,7 +101,6 @@
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
-import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.EmergencyDialerConstants;
@@ -459,12 +459,10 @@
mKeyguardManager.isDeviceLocked())
: null;
- boolean showControls = !mKeyguardManager.isDeviceLocked() && isControlsEnabled(mContext);
-
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, panelViewController,
mBlurUtils, mSysuiColorExtractor, mStatusBarService,
mNotificationShadeWindowController,
- showControls ? mControlsUiController : null);
+ shouldShowControls() ? mControlsUiController : null);
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
dialog.setKeyguardShowing(mKeyguardShowing);
@@ -538,7 +536,7 @@
@Override
public boolean shouldBeSeparated() {
- return !isControlsEnabled(mContext);
+ return !shouldShowControls();
}
@Override
@@ -1135,7 +1133,8 @@
* A single press action maintains no state, just responds to a press
* and takes an action.
*/
- private static abstract class SinglePressAction implements Action {
+
+ private abstract class SinglePressAction implements Action {
private final int mIconResId;
private final Drawable mIcon;
private final int mMessageResId;
@@ -1174,7 +1173,7 @@
}
protected int getActionLayoutId(Context context) {
- if (isControlsEnabled(context)) {
+ if (shouldShowControls()) {
return com.android.systemui.R.layout.global_actions_grid_item_v2;
}
return com.android.systemui.R.layout.global_actions_grid_item;
@@ -1640,8 +1639,6 @@
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
panelContainer.addView(mPanelController.getPanelContent(), panelParams);
- mBackgroundDrawable = mPanelController.getBackgroundDrawable();
- mScrimAlpha = 1f;
}
}
@@ -1669,7 +1666,7 @@
}
if (mBackgroundDrawable == null) {
mBackgroundDrawable = new ScrimDrawable();
- mScrimAlpha = ScrimController.GRADIENT_SCRIM_ALPHA;
+ mScrimAlpha = 0.8f;
}
getWindow().setBackgroundDrawable(mBackgroundDrawable);
}
@@ -1728,7 +1725,7 @@
if (!(mBackgroundDrawable instanceof ScrimDrawable)) {
return;
}
- ((ScrimDrawable) mBackgroundDrawable).setColor(colors.getMainColor(), animate);
+ ((ScrimDrawable) mBackgroundDrawable).setColor(Color.BLACK, animate);
View decorView = getWindow().getDecorView();
if (colors.supportsDarkText()) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
@@ -1900,8 +1897,10 @@
return true;
}
- private static boolean isControlsEnabled(Context context) {
- return Settings.Secure.getInt(
- context.getContentResolver(), "systemui.controls_available", 0) == 1;
+ private boolean shouldShowControls() {
+ return isCurrentUserOwner()
+ && !mKeyguardManager.isDeviceLocked()
+ && Settings.Secure.getInt(mContext.getContentResolver(),
+ "systemui.controls_available", 0) == 1;
}
}