summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Chau <alexchau@google.com>2022-02-08 17:08:38 +0000
committerAlex Chau <alexchau@google.com>2022-02-10 20:03:56 +0000
commitfb54cf54e3232cbfe5c74e712c17f30c988257f6 (patch)
tree6856535a259e09a1e500a11e55f02bcfe18d914b /src
parent69928557420d9e298b27477780eb8e032ccf927b (diff)
downloadLauncher3-fb54cf54e3232cbfe5c74e712c17f30c988257f6.tar.gz
Avoid AllApps bottom sheet from being and add collapse handle
- Instead of using top margin, use top padding instead - Add a separate LinearView for the bottom sheet background - Added a handle to bottom sheet background that handle touches Bug: 208599118 Test: phone, tablet and taskbar Change-Id: Id8d3cb5ee6c58193926e2cf5ea7b0cb2280098be
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/allapps/BaseAllAppsContainerView.java22
-rw-r--r--src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java45
2 files changed, 58 insertions, 9 deletions
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index 2b2c7c55c5..a66ae78c12 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -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);
diff --git a/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java
new file mode 100644
index 0000000000..0719c4342f
--- /dev/null
+++ b/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package com.android.launcher3.allapps;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher;
+
+/**
+ * AllAppsContainerView for secondary launcher
+ */
+public class SecondaryLauncherAllAppsContainerView extends
+ ActivityAllAppsContainerView<SecondaryDisplayLauncher> {
+
+ public SecondaryLauncherAllAppsContainerView(Context context) {
+ this(context, null);
+ }
+
+ public SecondaryLauncherAllAppsContainerView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public SecondaryLauncherAllAppsContainerView(Context context, AttributeSet attrs,
+ int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected void updateBackground(DeviceProfile deviceProfile) {}
+}