diff --git a/packages/SystemUI/res/layout-sw600dp-land/global_actions_grid_v2.xml b/packages/SystemUI/res/layout-sw600dp-land/global_actions_grid_v2.xml new file mode 100644 index 0000000000000..953a29e3a07e7 --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp-land/global_actions_grid_v2.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/layout-sw600dp/global_actions_controls_list_view.xml b/packages/SystemUI/res/layout-sw600dp/global_actions_controls_list_view.xml new file mode 100644 index 0000000000000..ef49b9c3b6adb --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp/global_actions_controls_list_view.xml @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/layout-sw600dp/global_actions_grid_v2.xml b/packages/SystemUI/res/layout-sw600dp/global_actions_grid_v2.xml new file mode 100644 index 0000000000000..6ffcef7b24e6b --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp/global_actions_grid_v2.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/layout/controls_with_favorites.xml b/packages/SystemUI/res/layout/controls_with_favorites.xml index 065ff68774ebe..b060afdc18e3b 100644 --- a/packages/SystemUI/res/layout/controls_with_favorites.xml +++ b/packages/SystemUI/res/layout/controls_with_favorites.xml @@ -58,11 +58,5 @@ android:background="?android:attr/selectableItemBackgroundBorderless" /> - + diff --git a/packages/SystemUI/res/layout/global_actions_controls_list_view.xml b/packages/SystemUI/res/layout/global_actions_controls_list_view.xml new file mode 100644 index 0000000000000..e1c2611cc4d4f --- /dev/null +++ b/packages/SystemUI/res/layout/global_actions_controls_list_view.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file 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 99b9ced530909..14a5e584a06d8 100644 --- a/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml +++ b/packages/SystemUI/res/layout/global_actions_grid_item_v2.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="0dp" android:layout_weight="1" - android:layout_height="98dp" + android:layout_height="@dimen/global_actions_grid_item_layout_height" android:gravity="bottom|center_horizontal" android:orientation="vertical" android:paddingTop="12dp" diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml index be66320975d90..d886f00cf0282 100644 --- a/packages/SystemUI/res/values-sw600dp/config.xml +++ b/packages/SystemUI/res/values-sw600dp/config.xml @@ -32,4 +32,7 @@ 0 + + true + diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index fdf4e3b1b7961..3be73ba8df25f 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -94,4 +94,11 @@ 18sp + + + 5dp + 12dp + 24dp + + 80dp diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 880dd378e390d..2bf513c604bd7 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -570,4 +570,7 @@ false + + + false diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 3a5d607e92ef2..e1f7e7e567260 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1005,6 +1005,7 @@ 3dp 3dp + 98dp 5dp 4dp 64dp diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 9c90510099a29..ad4c447679956 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -50,6 +50,7 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.UserInfo; import android.content.res.ColorStateList; +import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Color; @@ -256,6 +257,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, private UserContextProvider mUserContextProvider; @VisibleForTesting boolean mShowLockScreenCardsAndControls = false; + private int mSmallestScreenWidthDp; @VisibleForTesting public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum { @@ -344,6 +346,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mSysUiState = sysUiState; mMainHandler = handler; mUserContextProvider = userContextProvider; + mSmallestScreenWidthDp = mContext.getResources().getConfiguration().smallestScreenWidthDp; // receive broadcasts IntentFilter filter = new IntentFilter(); @@ -760,6 +763,15 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } } + @Override + public void onConfigChanged(Configuration newConfig) { + if (mDialog != null && mDialog.isShowing() + && (newConfig.smallestScreenWidthDp != mSmallestScreenWidthDp)) { + mSmallestScreenWidthDp = newConfig.smallestScreenWidthDp; + mDialog.refreshDialog(); + } + } + public void destroy() { mConfigurationController.removeCallback(this); } @@ -2230,6 +2242,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, return; } + boolean isLandscapeWalletViewShown = mContext.getResources().getBoolean( + com.android.systemui.R.bool.global_actions_show_landscape_wallet_view); + int rotation = RotationUtils.getRotation(mContext); boolean rotationLocked = RotationPolicy.isRotationLocked(mContext); if (rotation != RotationUtils.ROTATION_NONE) { @@ -2246,6 +2261,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mGlobalActionsLayout.post(() -> RotationPolicy.setRotationLockAtAngle( mContext, false, RotationUtils.ROTATION_NONE)); + + if (!isLandscapeWalletViewShown) { + return; + } } } else { if (!rotationLocked) { @@ -2253,44 +2272,48 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mResetOrientationData = new ResetOrientationData(); mResetOrientationData.locked = false; } + } - // Lock to portrait, so the user doesn't accidentally hide the panel. + boolean shouldLockRotation = !isLandscapeWalletViewShown; + if (rotationLocked != shouldLockRotation) { + // Locks the screen to portrait if the landscape / seascape orientation does not + // show the wallet view, so the user doesn't accidentally hide the panel. // This call is posted so that the rotation does not change until post-layout, // otherwise onConfigurationChanged() may not get invoked. mGlobalActionsLayout.post(() -> RotationPolicy.setRotationLockAtAngle( - mContext, true, RotationUtils.ROTATION_NONE)); + mContext, shouldLockRotation, RotationUtils.ROTATION_NONE)); } + } - // Disable rotation suggestions, if enabled - setRotationSuggestionsEnabled(false); + // Disable rotation suggestions, if enabled + setRotationSuggestionsEnabled(false); - FrameLayout panelContainer = - findViewById(com.android.systemui.R.id.global_actions_wallet); - FrameLayout.LayoutParams panelParams = - new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.MATCH_PARENT, - FrameLayout.LayoutParams.MATCH_PARENT); - if (!mControlsAvailable) { - panelParams.topMargin = mContext.getResources().getDimensionPixelSize( - com.android.systemui.R.dimen.global_actions_wallet_top_margin); - } - View walletView = mWalletViewController.getPanelContent(); - panelContainer.addView(walletView, panelParams); - // Smooth transitions when wallet is resized, which can happen when a card is added - ViewGroup root = findViewById(com.android.systemui.R.id.global_actions_grid_root); - if (root != null) { - walletView.addOnLayoutChangeListener((v, l, t, r, b, ol, ot, or, ob) -> { - int oldHeight = ob - ot; - int newHeight = b - t; - if (oldHeight > 0 && oldHeight != newHeight) { - TransitionSet transition = new AutoTransition() - .setDuration(250) - .setOrdering(TransitionSet.ORDERING_TOGETHER); - TransitionManager.beginDelayedTransition(root, transition); - } - }); - } + FrameLayout panelContainer = + findViewById(com.android.systemui.R.id.global_actions_wallet); + FrameLayout.LayoutParams panelParams = + new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.MATCH_PARENT); + if (!mControlsAvailable) { + panelParams.topMargin = mContext.getResources().getDimensionPixelSize( + com.android.systemui.R.dimen.global_actions_wallet_top_margin); + } + View walletView = mWalletViewController.getPanelContent(); + panelContainer.addView(walletView, panelParams); + // Smooth transitions when wallet is resized, which can happen when a card is added + ViewGroup root = findViewById(com.android.systemui.R.id.global_actions_grid_root); + if (root != null) { + walletView.addOnLayoutChangeListener((v, l, t, r, b, ol, ot, or, ob) -> { + int oldHeight = ob - ot; + int newHeight = b - t; + if (oldHeight > 0 && oldHeight != newHeight) { + TransitionSet transition = new AutoTransition() + .setDuration(250) + .setOrdering(TransitionSet.ORDERING_TOGETHER); + TransitionManager.beginDelayedTransition(root, transition); + } + }); } }