Merge "Constrain global actions panel to available space" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e4de9d2c56
@@ -58,6 +58,7 @@ android_library {
|
|||||||
"androidx.arch.core_core-runtime",
|
"androidx.arch.core_core-runtime",
|
||||||
"androidx.lifecycle_lifecycle-extensions",
|
"androidx.lifecycle_lifecycle-extensions",
|
||||||
"androidx.dynamicanimation_dynamicanimation",
|
"androidx.dynamicanimation_dynamicanimation",
|
||||||
|
"androidx-constraintlayout_constraintlayout",
|
||||||
"iconloader_base",
|
"iconloader_base",
|
||||||
"SystemUI-tags",
|
"SystemUI-tags",
|
||||||
"SystemUI-proto",
|
"SystemUI-proto",
|
||||||
@@ -111,6 +112,7 @@ android_library {
|
|||||||
"androidx.arch.core_core-runtime",
|
"androidx.arch.core_core-runtime",
|
||||||
"androidx.lifecycle_lifecycle-extensions",
|
"androidx.lifecycle_lifecycle-extensions",
|
||||||
"androidx.dynamicanimation_dynamicanimation",
|
"androidx.dynamicanimation_dynamicanimation",
|
||||||
|
"androidx-constraintlayout_constraintlayout",
|
||||||
"SystemUI-tags",
|
"SystemUI-tags",
|
||||||
"SystemUI-proto",
|
"SystemUI-proto",
|
||||||
"metrics-helper-lib",
|
"metrics-helper-lib",
|
||||||
|
|||||||
@@ -1,17 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.android.systemui.globalactions.GlobalActionsGridLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@id/global_actions_view"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/global_actions_grid_root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:layout_marginBottom="@dimen/global_actions_grid_container_negative_shadow_offset"
|
||||||
|
>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/global_actions_panel_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/global_actions_view"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.android.systemui.globalactions.GlobalActionsGridLayout
|
||||||
|
android:id="@id/global_actions_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:theme="@style/qs_theme"
|
android:theme="@style/qs_theme"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:gravity="bottom | center_horizontal"
|
android:gravity="bottom | center_horizontal"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="@dimen/global_actions_grid_container_shadow_offset"
|
android:paddingBottom="@dimen/global_actions_grid_container_shadow_offset"
|
||||||
android:layout_marginBottom="@dimen/global_actions_grid_container_negative_shadow_offset"
|
android:layout_marginBottom="@dimen/global_actions_grid_container_negative_shadow_offset"
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -70,4 +91,5 @@
|
|||||||
</com.android.systemui.globalactions.ListGridLayout>
|
</com.android.systemui.globalactions.ListGridLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.android.systemui.globalactions.GlobalActionsGridLayout>
|
</com.android.systemui.globalactions.GlobalActionsGridLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1588,17 +1588,13 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
// Disable rotation suggestions, if enabled
|
// Disable rotation suggestions, if enabled
|
||||||
setRotationSuggestionsEnabled(false);
|
setRotationSuggestionsEnabled(false);
|
||||||
|
|
||||||
FrameLayout panelContainer = new FrameLayout(mContext);
|
FrameLayout panelContainer =
|
||||||
|
findViewById(com.android.systemui.R.id.global_actions_panel_container);
|
||||||
FrameLayout.LayoutParams panelParams =
|
FrameLayout.LayoutParams panelParams =
|
||||||
new FrameLayout.LayoutParams(
|
new FrameLayout.LayoutParams(
|
||||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
panelContainer.addView(mPanelController.getPanelContent(), panelParams);
|
panelContainer.addView(mPanelController.getPanelContent(), panelParams);
|
||||||
addContentView(
|
|
||||||
panelContainer,
|
|
||||||
new ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
|
||||||
mBackgroundDrawable = mPanelController.getBackgroundDrawable();
|
mBackgroundDrawable = mPanelController.getBackgroundDrawable();
|
||||||
mScrimAlpha = 1f;
|
mScrimAlpha = 1f;
|
||||||
}
|
}
|
||||||
@@ -1606,8 +1602,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
|
|
||||||
private void initializeLayout() {
|
private void initializeLayout() {
|
||||||
setContentView(getGlobalActionsLayoutId(mContext));
|
setContentView(getGlobalActionsLayoutId(mContext));
|
||||||
|
fixNavBarClipping();
|
||||||
mGlobalActionsLayout = findViewById(com.android.systemui.R.id.global_actions_view);
|
mGlobalActionsLayout = findViewById(com.android.systemui.R.id.global_actions_view);
|
||||||
mGlobalActionsLayout.setOutsideTouchListener(view -> dismiss());
|
mGlobalActionsLayout.setOutsideTouchListener(view -> dismiss());
|
||||||
|
((View) mGlobalActionsLayout.getParent()).setOnClickListener(view -> dismiss());
|
||||||
mGlobalActionsLayout.setListViewAccessibilityDelegate(new View.AccessibilityDelegate() {
|
mGlobalActionsLayout.setListViewAccessibilityDelegate(new View.AccessibilityDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchPopulateAccessibilityEvent(
|
public boolean dispatchPopulateAccessibilityEvent(
|
||||||
@@ -1630,6 +1628,15 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
getWindow().setBackgroundDrawable(mBackgroundDrawable);
|
getWindow().setBackgroundDrawable(mBackgroundDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fixNavBarClipping() {
|
||||||
|
ViewGroup content = findViewById(android.R.id.content);
|
||||||
|
content.setClipChildren(false);
|
||||||
|
content.setClipToPadding(false);
|
||||||
|
ViewGroup contentParent = (ViewGroup) content.getParent();
|
||||||
|
contentParent.setClipChildren(false);
|
||||||
|
contentParent.setClipToPadding(false);
|
||||||
|
}
|
||||||
|
|
||||||
private int getGlobalActionsLayoutId(Context context) {
|
private int getGlobalActionsLayoutId(Context context) {
|
||||||
int rotation = RotationUtils.getRotation(context);
|
int rotation = RotationUtils.getRotation(context);
|
||||||
boolean useGridLayout = isForceGridEnabled(context)
|
boolean useGridLayout = isForceGridEnabled(context)
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public class GlobalActionsGridLayout extends GlobalActionsLayout {
|
|||||||
listView.setReverseSublists(shouldReverseSublists());
|
listView.setReverseSublists(shouldReverseSublists());
|
||||||
listView.setReverseItems(shouldReverseListItems());
|
listView.setReverseItems(shouldReverseListItems());
|
||||||
listView.setSwapRowsAndColumns(shouldSwapRowsAndColumns());
|
listView.setSwapRowsAndColumns(shouldSwapRowsAndColumns());
|
||||||
|
|
||||||
fixNavBarClipping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,19 +73,6 @@ public class GlobalActionsGridLayout extends GlobalActionsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows the dialog to clip over the navbar, which prevents shadows and animations from being
|
|
||||||
* cut off.
|
|
||||||
*/
|
|
||||||
private void fixNavBarClipping() {
|
|
||||||
ViewGroup parent = (ViewGroup) this.getParent();
|
|
||||||
ViewGroup parentParent = (ViewGroup) parent.getParent();
|
|
||||||
parent.setClipChildren(false);
|
|
||||||
parent.setClipToPadding(false);
|
|
||||||
parentParent.setClipChildren(false);
|
|
||||||
parentParent.setClipToPadding(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ListGridLayout getListView() {
|
protected ListGridLayout getListView() {
|
||||||
return (ListGridLayout) super.getListView();
|
return (ListGridLayout) super.getListView();
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ public class GlobalActionsGridLayoutTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
mGridLayout = spy((GlobalActionsGridLayout)
|
mGridLayout = spy(LayoutInflater.from(mContext)
|
||||||
LayoutInflater.from(mContext).inflate(R.layout.global_actions_grid, null));
|
.inflate(R.layout.global_actions_grid, null)
|
||||||
|
.requireViewById(R.id.global_actions_view));
|
||||||
mListGrid = spy(mGridLayout.getListView());
|
mListGrid = spy(mGridLayout.getListView());
|
||||||
doReturn(mListGrid).when(mGridLayout).getListView();
|
doReturn(mListGrid).when(mGridLayout).getListView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ public class ListGridLayoutTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
GlobalActionsGridLayout globalActions = (GlobalActionsGridLayout)
|
GlobalActionsGridLayout globalActions = LayoutInflater.from(mContext)
|
||||||
LayoutInflater.from(mContext).inflate(R.layout.global_actions_grid, null);
|
.inflate(R.layout.global_actions_grid, null)
|
||||||
|
.requireViewById(R.id.global_actions_view);
|
||||||
mListGridLayout = globalActions.getListView();
|
mListGridLayout = globalActions.getListView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user