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

Commit bf57c157 authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Avoid AllApps bottom sheet from being and add collapse handle"

parents adfdfd88 fb54cf54
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@
        android:saveEnabled="false"
        android:theme="?attr/allAppsTheme">

        <include
            layout="@layout/all_apps_bottom_sheet_background"
            android:visibility="gone" />

        <include
            layout="@layout/all_apps_rv_layout"
            android:visibility="gone" />
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@
    android:focusable="false"
    android:saveEnabled="false">

    <include
        layout="@layout/all_apps_bottom_sheet_background"
        android:visibility="gone" />

    <include
        layout="@layout/all_apps_rv_layout"
        android:visibility="gone" />
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 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.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bottom_sheet_background"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_all_apps_bottom_sheet">

    <View
        android:id="@+id/bottom_sheet_handle_area"
        android:layout_width="match_parent"
        android:layout_height="34dp" />

    <View
        android:id="@+id/bottom_sheet_handle"
        android:layout_width="48dp"
        android:layout_height="2dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        android:background="?android:attr/textColorSecondary" />
</FrameLayout>
+5 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
        android:onClick="onAppsButtonClicked" />

    <view
        class="com.android.launcher3.allapps.ActivityAllAppsContainerView"
        class="com.android.launcher3.allapps.SecondaryLauncherAllAppsContainerView"
        android:id="@+id/apps_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
@@ -55,6 +55,10 @@
        android:elevation="2dp"
        android:visibility="invisible" >

        <include
            layout="@layout/all_apps_bottom_sheet_background"
            android:visibility="gone" />

        <include
            layout="@layout/all_apps_rv_layout"
            android:visibility="gone" />
+13 −9
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
    private AllAppsPagedView mViewPager;

    protected FloatingHeaderView mHeader;
    private View mBottomSheetBackground;
    private View mBottomSheetHandleArea;

    protected boolean mUsingTabs;
    private boolean mHasWorkApps;
@@ -146,8 +148,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
        mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));

        mAllAppsStore.addUpdateListener(this::onAppsUpdated);

        updateBackground(mActivityContext.getDeviceProfile());
    }

    /** Creates the adapter provider for the main section. */
@@ -222,10 +222,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
        updateBackground(dp);
    }

    private void updateBackground(DeviceProfile deviceProfile) {
        setBackground(deviceProfile.isTablet
                ? getContext().getDrawable(R.drawable.bg_all_apps_bottom_sheet)
                : null);
    protected void updateBackground(DeviceProfile deviceProfile) {
        mBottomSheetBackground.setVisibility(deviceProfile.isTablet ? View.VISIBLE : View.GONE);
    }

    private void onAppsUpdated() {
@@ -253,7 +251,9 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
        if (!mActivityContext.getDragLayer().isEventOverView(this, ev)) {
            return true;
        }
        // TODO(b/216203409) Support dragging down from bottom sheet divider, if present.
        if (mActivityContext.getDragLayer().isEventOverView(mBottomSheetHandleArea, ev)) {
            return true;
        }
        AllAppsRecyclerView rv = getActiveRecyclerView();
        if (rv == null) {
            return true;
@@ -375,6 +375,11 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte

        mHeader = findViewById(R.id.all_apps_header);
        rebindAdapters(true /* force */);

        mBottomSheetBackground = findViewById(R.id.bottom_sheet_background);
        updateBackground(mActivityContext.getDeviceProfile());

        mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area);
    }

    @Override
@@ -392,7 +397,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
        }

        MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
        mlp.topMargin = grid.isTablet ? insets.top : 0;
        int leftRightMargin = grid.allAppsLeftRightMargin;
        mlp.leftMargin = insets.left + leftRightMargin;
        mlp.rightMargin = insets.right + leftRightMargin;
@@ -401,7 +405,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
        if (grid.isVerticalBarLayout()) {
            setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0);
        } else {
            setPadding(0, 0, 0, 0);
            setPadding(0, grid.isTablet ? insets.top : 0, 0, 0);
        }

        InsettableFrameLayout.dispatchInsets(this, insets);
Loading