diff --git a/res/layout/all_apps_tabs.xml b/res/layout/all_apps_tabs.xml index cf68f5149c..6dcae21911 100644 --- a/res/layout/all_apps_tabs.xml +++ b/res/layout/all_apps_tabs.xml @@ -25,7 +25,7 @@ android:clipChildren="true" android:clipToPadding="false" android:descendantFocusability="afterDescendants" - android:paddingTop="@dimen/all_apps_header_top_padding" + android:paddingTop="@dimen/all_apps_paged_view_top_padding" launcher:pageIndicator="@+id/tabs" > diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 83d40d59f7..3722e329f2 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -111,7 +111,9 @@ 2dp 33dp 36dp - 6dp + 14dp + 6dp + 4dp 16dp 20dp 4dp @@ -122,6 +124,7 @@ 8dp 6dp 0dp + 40dp 2dp diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index ed8761eac5..72f14a872e 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -82,6 +82,9 @@ public class FloatingHeaderView extends LinearLayout implements protected final Map mPluginRows = new ArrayMap<>(); private final int mHeaderTopPadding; + // These two values are necessary to ensure that the header protection is drawn correctly. + private final int mHeaderTopAdjustment; + private final int mHeaderBottomAdjustment; private final boolean mHeaderProtectionSupported; protected ViewGroup mTabLayout; @@ -118,6 +121,10 @@ public class FloatingHeaderView extends LinearLayout implements super(context, attrs); mHeaderTopPadding = context.getResources() .getDimensionPixelSize(R.dimen.all_apps_header_top_padding); + mHeaderTopAdjustment = context.getResources() + .getDimensionPixelSize(R.dimen.all_apps_header_top_adjustment); + mHeaderBottomAdjustment = context.getResources() + .getDimensionPixelSize(R.dimen.all_apps_header_bottom_adjustment); mHeaderProtectionSupported = context.getResources().getBoolean( R.bool.config_header_protection_supported) // TODO(b/208599118) Support header protection for bottom sheet. @@ -255,6 +262,9 @@ public class FloatingHeaderView extends LinearLayout implements for (FloatingHeaderRow row : mAllRows) { mMaxTranslation += row.getExpectedHeight(); } + if (!mTabsHidden) { + mMaxTranslation += mHeaderBottomAdjustment; + } } public void setMainActive(boolean active) { @@ -317,9 +327,9 @@ public class FloatingHeaderView extends LinearLayout implements mTabLayout.setTranslationY(mTranslationY); - int clipHeight = mHeaderTopPadding - getPaddingBottom(); - mRVClip.top = mTabsHidden ? clipHeight : 0; - mHeaderClip.top = clipHeight; + int clipTop = mHeaderTopPadding - mHeaderTopAdjustment; + mRVClip.top = mTabsHidden ? clipTop : 0; + mHeaderClip.top = clipTop; // clipping on a draw might cause additional redraw setClipBounds(mHeaderClip); mMainRV.setClipBounds(mRVClip); @@ -447,5 +457,3 @@ public class FloatingHeaderView extends LinearLayout implements return Math.max(getHeight() - getPaddingTop() + mTranslationY, 0); } } - -