Loading quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); } } res/layout/all_apps_bottom_sheet_background.xml +1 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ <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_rounded_corner_bottom_sheet"> android:layout_height="match_parent"> <View android:id="@+id/bottom_sheet_handle_area" Loading src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +4 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> @Override public int getHeaderBottom() { if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { if (mActivityContext.getDeviceProfile().isTablet) { return super.getHeaderBottom() + mHeader.getClipTop() + mBottomSheetBackground.getTop(); } return super.getHeaderBottom() + mHeader.getClipTop(); } return super.getHeaderBottom() + mSearchContainer.getBottom(); Loading src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +76 −18 Original line number Diff line number Diff line Loading @@ -26,8 +26,11 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Path.Direction; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.os.Bundle; import android.os.Parcelable; import android.os.Process; Loading @@ -35,6 +38,7 @@ import android.os.UserManager; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -121,7 +125,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte private SearchRecyclerView mSearchRecyclerView; protected FloatingHeaderView mHeader; private View mBottomSheetBackground; protected View mBottomSheetBackground; private View mBottomSheetHandleArea; @Nullable private View mSearchBarProtection; Loading @@ -134,8 +138,12 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte private final int mScrimColor; private final int mHeaderProtectionColor; protected final float mHeaderThreshold; private final Path mTmpPath = new Path(); private final RectF mTmpRectF = new RectF(); private float[] mBottomSheetCornerRadii; private ScrimView mScrimView; private int mHeaderColor; private int mBottomSheetBackgroundColor; private int mTabsProtectionAlpha; protected BaseAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { Loading Loading @@ -236,6 +244,9 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte protected void updateBackground(DeviceProfile deviceProfile) { mBottomSheetBackground.setVisibility(deviceProfile.isTablet ? View.VISIBLE : View.GONE); // Note: For tablets, the opaque background and header protection are added in drawOnScrim. // For the taskbar entrypoint, the scrim is drawn differently, so a static background is // added in TaskbarAllAppsContainerView and header protection is not yet supported. } private void onAppsUpdated() { Loading Loading @@ -428,9 +439,22 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte rebindAdapters(true /* force */); mBottomSheetBackground = findViewById(R.id.bottom_sheet_background); updateBackground(mActivityContext.getDeviceProfile()); mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area); float cornerRadius = Themes.getDialogCornerRadius(getContext()); mBottomSheetCornerRadii = new float[]{ cornerRadius, cornerRadius, // Top left radius in px cornerRadius, cornerRadius, // Top right radius in px 0, 0, // Bottom right 0, 0 // Bottom left }; final TypedValue value = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true); mBottomSheetBackgroundColor = value.data; updateBackground(mActivityContext.getDeviceProfile()); } @Override Loading Loading @@ -743,6 +767,20 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte @Override public void drawOnScrim(Canvas canvas) { boolean isTablet = mActivityContext.getDeviceProfile().isTablet; // Draw full background panel for tablets. if (isTablet) { mHeaderPaint.setColor(mBottomSheetBackgroundColor); View panel = (View) mBottomSheetBackground; float translationY = ((View) panel.getParent()).getTranslationY(); mTmpRectF.set(panel.getLeft(), panel.getTop() + translationY, panel.getRight(), panel.getBottom()); mTmpPath.reset(); mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW); canvas.drawPath(mTmpPath, mHeaderPaint); } if (!mHeader.isHeaderProtectionSupported()) { return; } Loading @@ -753,14 +791,29 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte mHeaderPaint.setColor(mHeaderColor); mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor))); } if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) { if (mHeaderPaint.getColor() == mScrimColor || mHeaderPaint.getColor() == 0) { return; } int bottom = getHeaderBottom(); FloatingHeaderView headerView = getFloatingHeaderView(); if (!mUsingTabs && !FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { // Add protection which is otherwise added when tabs scroll up. bottom += headerView.getTabsAdditionalPaddingTop(); } if (isTablet) { // Start adding header protection if search bar or tabs will attach to the top. if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) { View panel = (View) mBottomSheetBackground; float translationY = ((View) panel.getParent()).getTranslationY(); mTmpRectF.set(panel.getLeft(), panel.getTop() + translationY, panel.getRight(), bottom); mTmpPath.reset(); mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW); canvas.drawPath(mTmpPath, mHeaderPaint); } } else { canvas.drawRect(0, 0, canvas.getWidth(), bottom, mHeaderPaint); } int tabsHeight = headerView.getPeripheralProtectionHeight(); if (mTabsProtectionAlpha > 0 && tabsHeight != 0) { if (DEBUG_HEADER_PROTECTION) { Loading @@ -769,8 +822,13 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte } else { mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); } canvas.drawRect(0, bottom, canvas.getWidth(), bottom + tabsHeight, mHeaderPaint); int left = 0; int right = canvas.getWidth(); if (isTablet) { left = mBottomSheetBackground.getLeft(); right = mBottomSheetBackground.getRight(); } canvas.drawRect(left, bottom, right, bottom + tabsHeight, mHeaderPaint); } } Loading Loading
quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); } }
res/layout/all_apps_bottom_sheet_background.xml +1 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ <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_rounded_corner_bottom_sheet"> android:layout_height="match_parent"> <View android:id="@+id/bottom_sheet_handle_area" Loading
src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +4 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> @Override public int getHeaderBottom() { if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { if (mActivityContext.getDeviceProfile().isTablet) { return super.getHeaderBottom() + mHeader.getClipTop() + mBottomSheetBackground.getTop(); } return super.getHeaderBottom() + mHeader.getClipTop(); } return super.getHeaderBottom() + mSearchContainer.getBottom(); Loading
src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +76 −18 Original line number Diff line number Diff line Loading @@ -26,8 +26,11 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Path.Direction; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.os.Bundle; import android.os.Parcelable; import android.os.Process; Loading @@ -35,6 +38,7 @@ import android.os.UserManager; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -121,7 +125,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte private SearchRecyclerView mSearchRecyclerView; protected FloatingHeaderView mHeader; private View mBottomSheetBackground; protected View mBottomSheetBackground; private View mBottomSheetHandleArea; @Nullable private View mSearchBarProtection; Loading @@ -134,8 +138,12 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte private final int mScrimColor; private final int mHeaderProtectionColor; protected final float mHeaderThreshold; private final Path mTmpPath = new Path(); private final RectF mTmpRectF = new RectF(); private float[] mBottomSheetCornerRadii; private ScrimView mScrimView; private int mHeaderColor; private int mBottomSheetBackgroundColor; private int mTabsProtectionAlpha; protected BaseAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { Loading Loading @@ -236,6 +244,9 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte protected void updateBackground(DeviceProfile deviceProfile) { mBottomSheetBackground.setVisibility(deviceProfile.isTablet ? View.VISIBLE : View.GONE); // Note: For tablets, the opaque background and header protection are added in drawOnScrim. // For the taskbar entrypoint, the scrim is drawn differently, so a static background is // added in TaskbarAllAppsContainerView and header protection is not yet supported. } private void onAppsUpdated() { Loading Loading @@ -428,9 +439,22 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte rebindAdapters(true /* force */); mBottomSheetBackground = findViewById(R.id.bottom_sheet_background); updateBackground(mActivityContext.getDeviceProfile()); mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area); float cornerRadius = Themes.getDialogCornerRadius(getContext()); mBottomSheetCornerRadii = new float[]{ cornerRadius, cornerRadius, // Top left radius in px cornerRadius, cornerRadius, // Top right radius in px 0, 0, // Bottom right 0, 0 // Bottom left }; final TypedValue value = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true); mBottomSheetBackgroundColor = value.data; updateBackground(mActivityContext.getDeviceProfile()); } @Override Loading Loading @@ -743,6 +767,20 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte @Override public void drawOnScrim(Canvas canvas) { boolean isTablet = mActivityContext.getDeviceProfile().isTablet; // Draw full background panel for tablets. if (isTablet) { mHeaderPaint.setColor(mBottomSheetBackgroundColor); View panel = (View) mBottomSheetBackground; float translationY = ((View) panel.getParent()).getTranslationY(); mTmpRectF.set(panel.getLeft(), panel.getTop() + translationY, panel.getRight(), panel.getBottom()); mTmpPath.reset(); mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW); canvas.drawPath(mTmpPath, mHeaderPaint); } if (!mHeader.isHeaderProtectionSupported()) { return; } Loading @@ -753,14 +791,29 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte mHeaderPaint.setColor(mHeaderColor); mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor))); } if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) { if (mHeaderPaint.getColor() == mScrimColor || mHeaderPaint.getColor() == 0) { return; } int bottom = getHeaderBottom(); FloatingHeaderView headerView = getFloatingHeaderView(); if (!mUsingTabs && !FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { // Add protection which is otherwise added when tabs scroll up. bottom += headerView.getTabsAdditionalPaddingTop(); } if (isTablet) { // Start adding header protection if search bar or tabs will attach to the top. if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) { View panel = (View) mBottomSheetBackground; float translationY = ((View) panel.getParent()).getTranslationY(); mTmpRectF.set(panel.getLeft(), panel.getTop() + translationY, panel.getRight(), bottom); mTmpPath.reset(); mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW); canvas.drawPath(mTmpPath, mHeaderPaint); } } else { canvas.drawRect(0, 0, canvas.getWidth(), bottom, mHeaderPaint); } int tabsHeight = headerView.getPeripheralProtectionHeight(); if (mTabsProtectionAlpha > 0 && tabsHeight != 0) { if (DEBUG_HEADER_PROTECTION) { Loading @@ -769,8 +822,13 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte } else { mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); } canvas.drawRect(0, bottom, canvas.getWidth(), bottom + tabsHeight, mHeaderPaint); int left = 0; int right = canvas.getWidth(); if (isTablet) { left = mBottomSheetBackground.getLeft(); right = mBottomSheetBackground.getRight(); } canvas.drawRect(left, bottom, right, bottom + tabsHeight, mHeaderPaint); } } Loading