From 0adad2440854d0f8dd70fa39016671d44fca5f65 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Tue, 22 Nov 2022 17:14:44 -0800 Subject: [PATCH] Adds header protection on tablet all apps panel. Removes background and manually draws it while drawing scrim. Then draws header protection on top as needed. Currently this only applies to all apps from Launcher, as Taskbar doesn't seem to use the same scrim flow. So taskbar adds the same static background that was previously used. Demo videos: https://drive.google.com/drive/folders/11PyFsrLV6-QhU_E-zD3s5bfzZK2nOU87?resourcekey=0-E41uw5TP9xuqTifLAs71yw&usp=sharing Test: Manually on phone and tablet with dark/light mode, floating search bar on/off, work profile present/absent, taskbar/home entry Bug: 240670050 Change-Id: I81dcc956d9dbbc7552c8a227a49741bcf71eed71 --- .../allapps/TaskbarAllAppsContainerView.java | 9 ++ .../all_apps_bottom_sheet_background.xml | 3 +- .../allapps/ActivityAllAppsContainerView.java | 4 + .../allapps/BaseAllAppsContainerView.java | 94 +++++++++++++++---- 4 files changed, 90 insertions(+), 20 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java index f8d9d11d39..70405d94cb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java @@ -19,6 +19,8 @@ import android.content.Context; import android.util.AttributeSet; import android.view.WindowInsets; +import com.android.launcher3.DeviceProfile; +import com.android.launcher3.R; import com.android.launcher3.allapps.ActivityAllAppsContainerView; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; @@ -44,4 +46,11 @@ public class TaskbarAllAppsContainerView extends protected boolean isSearchSupported() { return false; } + + @Override + protected void updateBackground(DeviceProfile deviceProfile) { + super.updateBackground(deviceProfile); + // TODO(b/240670050): Remove this and add header protection for the taskbar entrypoint. + mBottomSheetBackground.setBackgroundResource(R.drawable.bg_rounded_corner_bottom_sheet); + } } diff --git a/res/layout/all_apps_bottom_sheet_background.xml b/res/layout/all_apps_bottom_sheet_background.xml index 3e47690197..b0157c9c3e 100644 --- a/res/layout/all_apps_bottom_sheet_background.xml +++ b/res/layout/all_apps_bottom_sheet_background.xml @@ -16,8 +16,7 @@ + android:layout_height="match_parent"> 0 && tabsHeight != 0) { - if (DEBUG_HEADER_PROTECTION) { - mHeaderPaint.setColor(Color.BLUE); - mHeaderPaint.setAlpha(255); - } else { - mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); - } - canvas.drawRect(0, bottom, canvas.getWidth(), bottom + tabsHeight, mHeaderPaint); + } + int tabsHeight = headerView.getPeripheralProtectionHeight(); + if (mTabsProtectionAlpha > 0 && tabsHeight != 0) { + if (DEBUG_HEADER_PROTECTION) { + mHeaderPaint.setColor(Color.BLUE); + mHeaderPaint.setAlpha(255); + } else { + mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); } + int left = 0; + int right = canvas.getWidth(); + if (isTablet) { + left = mBottomSheetBackground.getLeft(); + right = mBottomSheetBackground.getRight(); + } + canvas.drawRect(left, bottom, right, bottom + tabsHeight, mHeaderPaint); } }