mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
[Toast] Polish the layout of the QSB, tabs and header protection.
Specs and screenshot in the bug. Fixes: b/227902759 Test: manual Change-Id: Ia713c923a71207cfaab7068f20c8606d816f8b43
This commit is contained in:
@@ -82,6 +82,9 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
protected final Map<AllAppsRow, PluginHeaderRow> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user