Merge changes I209e3ec7,If70df129 into main

* changes:
  Change collapse to use adapterItems instead of getting the childCount()
  Upon expanding, expand just enough so the header shows.
This commit is contained in:
Brandon Dayauon
2024-03-13 22:49:02 +00:00
committed by Android (Google) Code Review
3 changed files with 219 additions and 14 deletions

View File

@@ -189,6 +189,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
private float mBottomSheetAlpha = 1f;
private boolean mForceBottomSheetVisible;
private int mTabsProtectionAlpha;
private float mTotalHeaderProtectionHeight;
@Nullable private AllAppsTransitionController mAllAppsTransitionController;
private PrivateSpaceHeaderViewController mPrivateSpaceHeaderViewController;
@@ -1431,9 +1432,11 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mTmpPath.reset();
mTmpPath.addRoundRect(mTmpRectF, mBottomSheetCornerRadii, Direction.CW);
canvas.drawPath(mTmpPath, mHeaderPaint);
mTotalHeaderProtectionHeight = headerBottomWithScaleOnTablet;
}
} else {
canvas.drawRect(0, 0, canvas.getWidth(), headerBottomWithScaleOnPhone, mHeaderPaint);
mTotalHeaderProtectionHeight = headerBottomWithScaleOnPhone;
}
// If tab exist (such as work profile), extend header with tab height
@@ -1463,9 +1466,18 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
right,
tabBottomWithScale,
mHeaderPaint);
mTotalHeaderProtectionHeight = tabBottomWithScale;
}
}
/**
* The height of the header protection is dynamically calculated during the time of drawing the
* header.
*/
float getHeaderProtectionHeight() {
return mTotalHeaderProtectionHeight;
}
/**
* redraws header protection
*/