Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b56c5bc3 authored by Steve Elliott's avatar Steve Elliott Committed by android-build-merger
Browse files

Merge "Constrain global actions panel to available space" into qt-dev

am: e4de9d2c

Change-Id: Ib6f1b6e14627b53a184d226db7405d431c180b58
parents aab01138 e4de9d2c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ android_library {
        "androidx.arch.core_core-runtime",
        "androidx.lifecycle_lifecycle-extensions",
        "androidx.dynamicanimation_dynamicanimation",
        "androidx-constraintlayout_constraintlayout",
        "iconloader_base",
        "SystemUI-tags",
        "SystemUI-proto",
@@ -111,6 +112,7 @@ android_library {
        "androidx.arch.core_core-runtime",
        "androidx.lifecycle_lifecycle-extensions",
        "androidx.dynamicanimation_dynamicanimation",
        "androidx-constraintlayout_constraintlayout",
        "SystemUI-tags",
        "SystemUI-proto",
        "metrics-helper-lib",
+74 −52
Original line number Diff line number Diff line
<?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"
    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_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: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:clipChildren="false"
        android:clipToPadding="false"
@@ -71,3 +92,4 @@
        </LinearLayout>

    </com.android.systemui.globalactions.GlobalActionsGridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
 No newline at end of file
+14 −7
Original line number Diff line number Diff line
@@ -1588,17 +1588,13 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                // Disable rotation suggestions, if enabled
                setRotationSuggestionsEnabled(false);

                FrameLayout panelContainer = new FrameLayout(mContext);
                FrameLayout panelContainer =
                        findViewById(com.android.systemui.R.id.global_actions_panel_container);
                FrameLayout.LayoutParams panelParams =
                        new FrameLayout.LayoutParams(
                                FrameLayout.LayoutParams.MATCH_PARENT,
                                FrameLayout.LayoutParams.WRAP_CONTENT);
                                FrameLayout.LayoutParams.MATCH_PARENT);
                panelContainer.addView(mPanelController.getPanelContent(), panelParams);
                addContentView(
                        panelContainer,
                        new ViewGroup.LayoutParams(
                                ViewGroup.LayoutParams.MATCH_PARENT,
                                ViewGroup.LayoutParams.MATCH_PARENT));
                mBackgroundDrawable = mPanelController.getBackgroundDrawable();
                mScrimAlpha = 1f;
            }
@@ -1606,8 +1602,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,

        private void initializeLayout() {
            setContentView(getGlobalActionsLayoutId(mContext));
            fixNavBarClipping();
            mGlobalActionsLayout = findViewById(com.android.systemui.R.id.global_actions_view);
            mGlobalActionsLayout.setOutsideTouchListener(view -> dismiss());
            ((View) mGlobalActionsLayout.getParent()).setOnClickListener(view -> dismiss());
            mGlobalActionsLayout.setListViewAccessibilityDelegate(new View.AccessibilityDelegate() {
                @Override
                public boolean dispatchPopulateAccessibilityEvent(
@@ -1630,6 +1628,15 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            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) {
            int rotation = RotationUtils.getRotation(context);
            boolean useGridLayout = isForceGridEnabled(context)
+0 −15
Original line number Diff line number Diff line
@@ -42,8 +42,6 @@ public class GlobalActionsGridLayout extends GlobalActionsLayout {
        listView.setReverseSublists(shouldReverseSublists());
        listView.setReverseItems(shouldReverseListItems());
        listView.setSwapRowsAndColumns(shouldSwapRowsAndColumns());

        fixNavBarClipping();
    }

    @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
    protected ListGridLayout getListView() {
        return (ListGridLayout) super.getListView();
+3 −2
Original line number Diff line number Diff line
@@ -48,8 +48,9 @@ public class GlobalActionsGridLayoutTest extends SysuiTestCase {

    @Before
    public void setUp() throws Exception {
        mGridLayout = spy((GlobalActionsGridLayout)
                LayoutInflater.from(mContext).inflate(R.layout.global_actions_grid, null));
        mGridLayout = spy(LayoutInflater.from(mContext)
                .inflate(R.layout.global_actions_grid, null)
                .requireViewById(R.id.global_actions_view));
        mListGrid = spy(mGridLayout.getListView());
        doReturn(mListGrid).when(mGridLayout).getListView();
    }
Loading