Upon expanding, expand just enough so the header shows.

This issue only happens when there is a lot of private space apps that scrolling to the bottom
will not sure the private space header.

Formula to calculate how many rows to scroll to =
	(appListHeight - privateHeaderHeight - headerProtectionHeight) / cellHeight.

bug: 299294792
Test:
manually - https://screenshot.googleplex.com/76UJPT2Jnpnp2Ab
before: it just scrolls all the way to the bottom
after: https://drive.google.com/file/d/1AbprxFm1RWTQKvpt7M4khbUfc1o6-XGF/view?usp=sharing
after PHONE WITH TABS:
2x2- https://drive.google.com/file/d/1SLPsWPHenCuZuisiS7HeEy5JwtNPeONs/view?usp=sharing
3x3- https://drive.google.com/file/d/1SK82jeNZMzFJK2odIuHnfTNLYfppne83/view?usp=sharing
4x4- https://drive.google.com/file/d/1T7EhFRq2tDv2zYIvs_FMsTKcFZXwGUaD/view?usp=sharing
4x5- https://drive.google.com/file/d/1SMUPuKjO1Yg36U6P6cDOb6dTkHn6Bh7D/view?usp=sharing
5x5- https://drive.google.com/file/d/1SJCQn1O_Yq5P7C__VUfZHc5I67CEdIpb/view?usp=sharing

AFTER PHONE NO TABS:
2x2: https://drive.google.com/file/d/1THU2xrAIt0hTmN5_GwBrgN9Lqj-W4Kfr/view?usp=sharing
3x3: https://drive.google.com/file/d/1TPTUx7PcHW3GsVwVAg_L5rCcn0QYoiY2/view?usp=sharing
4x4: https://drive.google.com/file/d/1TWVWpAX6bZp_JfFKtmXYO0askl4e5qKO/view?usp=sharing
4x5: https://drive.google.com/file/d/1TDJK-swmY3Y3C4ARH_2eljqUkBGEnD3e/view?usp=sharing
5x5- https://drive.google.com/file/d/1TBJtAynwvZrGyOc-29f637wyrJZpMXBJ/view?usp=sharing

Tablet:
landscape: https://drive.google.com/file/d/1SfyPdoUnCV7e7BWLnpxXWN2HiBOQkRo2/view?usp=sharing
portrait: https://drive.google.com/file/d/1SgZq0iE9WMvIFtc8mBb577nYlS9jBa_g/view?usp=sharing
Flag: ACONFIG com.android.launcher3.Flags.private_space_animation TRUNKFOOD

Change-Id: If70df1299572f8f2edc6376dd2a6df5d74287264
This commit is contained in:
Brandon Dayauon
2024-02-26 14:10:04 -08:00
parent 4b12762881
commit d0bec45d37
3 changed files with 207 additions and 2 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;
@@ -1429,9 +1430,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
@@ -1461,9 +1464,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
*/