summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout-sw600dp-land/global_actions_grid_v2.xml68
-rw-r--r--packages/SystemUI/res/layout-sw600dp/global_actions_controls_list_view.xml30
-rw-r--r--packages/SystemUI/res/layout-sw600dp/global_actions_grid_v2.xml76
-rw-r--r--packages/SystemUI/res/layout/controls_with_favorites.xml8
-rw-r--r--packages/SystemUI/res/layout/global_actions_controls_list_view.xml9
-rw-r--r--packages/SystemUI/res/layout/global_actions_grid_item_v2.xml2
-rw-r--r--packages/SystemUI/res/values-sw600dp/config.xml3
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml7
-rw-r--r--packages/SystemUI/res/values/config.xml3
-rw-r--r--packages/SystemUI/res/values/dimens.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java85
11 files changed, 253 insertions, 39 deletions
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 000000000000..953a29e3a07e
--- /dev/null
+++ b/packages/SystemUI/res/layout-sw600dp-land/global_actions_grid_v2.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/global_actions_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_weight="1"
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:clipChildren="false"
+ android:orientation="vertical"
+ android:clipToPadding="false"
+ android:id="@+id/controls_pane"
+ >
+ <LinearLayout
+ android:id="@+id/global_actions_controls"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_weight="1"
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:orientation="vertical"
+ android:id="@+id/nfc_pane"
+ >
+ <include layout="@layout/global_actions_view" />
+
+ <include layout="@layout/global_actions_lock_view" />
+
+ <LinearLayout
+ android:id="@+id/global_actions_grid_root"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:orientation="vertical"
+ android:clipToPadding="false">
+
+ <FrameLayout
+ android:id="@+id/global_actions_wallet"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+</LinearLayout>
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 000000000000..ef49b9c3b6ad
--- /dev/null
+++ b/packages/SystemUI/res/layout-sw600dp/global_actions_controls_list_view.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<com.android.systemui.globalactions.MinHeightScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:scrollbars="none">
+ <LinearLayout
+ android:id="@+id/global_actions_controls_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginLeft="@dimen/global_actions_side_margin"
+ android:layout_marginRight="@dimen/global_actions_side_margin" />
+</com.android.systemui.globalactions.MinHeightScrollView> \ 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 000000000000..6ffcef7b24e6
--- /dev/null
+++ b/packages/SystemUI/res/layout-sw600dp/global_actions_grid_v2.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/global_actions_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_weight="1"
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/nfc_pane"
+ >
+
+ <include layout="@layout/global_actions_view" />
+
+ <include layout="@layout/global_actions_lock_view" />
+
+
+ <com.android.systemui.globalactions.MinHeightScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:scrollbars="none">
+
+ <LinearLayout
+ android:id="@+id/global_actions_grid_root"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:orientation="vertical"
+ android:clipToPadding="false">
+
+ <FrameLayout
+ android:id="@+id/global_actions_wallet"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+ </LinearLayout>
+ </com.android.systemui.globalactions.MinHeightScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_weight="1"
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/controls_pane"
+ android:clipToPadding="false"
+ android:clipChildren="false">
+ <LinearLayout
+ android:id="@+id/global_actions_controls"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"/>
+ </LinearLayout>
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/controls_with_favorites.xml b/packages/SystemUI/res/layout/controls_with_favorites.xml
index 065ff68774eb..b060afdc18e3 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" />
</LinearLayout>
- <LinearLayout
- android:id="@+id/global_actions_controls_list"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginLeft="@dimen/global_actions_side_margin"
- android:layout_marginRight="@dimen/global_actions_side_margin" />
+ <include layout="@layout/global_actions_controls_list_view" />
</merge>
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 000000000000..e1c2611cc4d4
--- /dev/null
+++ b/packages/SystemUI/res/layout/global_actions_controls_list_view.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/global_actions_controls_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginLeft="@dimen/global_actions_side_margin"
+ android:layout_marginRight="@dimen/global_actions_side_margin" /> \ 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 99b9ced53090..14a5e584a06d 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 be66320975d9..d886f00cf028 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -32,4 +32,7 @@
<!-- orientation of the dead zone when touches have recently occurred elsewhere on screen -->
<integer name="navigation_bar_deadzone_orientation">0</integer>
+ <!-- Whether wallet view is shown in landscape / seascape orientations -->
+ <bool name="global_actions_show_landscape_wallet_view">true</bool>
+
</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index fdf4e3b1b796..3be73ba8df25 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -94,4 +94,11 @@
<!-- Text size for user name in user switcher -->
<dimen name="kg_user_switcher_text_size">18sp</dimen>
+
+ <!-- TODO(himanshujaju) - add comments -->
+ <dimen name="global_actions_wallet_top_margin">5dp</dimen>
+ <dimen name="controls_header_bottom_margin">12dp</dimen>
+ <dimen name="controls_top_margin">24dp</dimen>
+
+ <dimen name="global_actions_grid_item_layout_height">80dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 880dd378e390..2bf513c604bd 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -570,4 +570,7 @@
<bool name="config_showNotificationForUnknownBatteryState">false</bool>
<!-- content URL in a notification when ACTION_BATTERY_CHANGED.EXTRA_PRESENT field is false -->
<string translatable="false" name="config_batteryStateUnknownUrl"></string>
+
+ <!-- Whether wallet view is shown in landscape / seascape orientations -->
+ <bool name="global_actions_show_landscape_wallet_view">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 3a5d607e92ef..e1f7e7e56726 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1005,6 +1005,7 @@
<dimen name="global_actions_grid_vertical_padding">3dp</dimen>
<dimen name="global_actions_grid_horizontal_padding">3dp</dimen>
+ <dimen name="global_actions_grid_item_layout_height">98dp</dimen>
<dimen name="global_actions_grid_item_side_margin">5dp</dimen>
<dimen name="global_actions_grid_item_vertical_margin">4dp</dimen>
<dimen name="global_actions_grid_item_width">64dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 9c90510099a2..ad4c44767995 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);
-
- 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);
- }
- });
- }
+ // 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);
+ }
+ });
}
}