Allow LauncherState to define floating search side margins.

This lets home screen align to workspace icons while All Apps
aligns with those icons. In addition, on tablets where the QSB
is inlined with the hotseat, floating search bar can also move
horizontally accordingly.

Bug: 275635606
Bug: 259619990
Test: Manual on tablet as well as foldable.
Flag: ENABLE_FLOATING_SEARCH_BAR

Change-Id: I67745c66390736cdf39d969ef7767096ae13c671
This commit is contained in:
Andy Wickham
2023-06-08 16:33:15 -07:00
parent 64896f3098
commit bd9a180fbc
5 changed files with 118 additions and 0 deletions

View File

@@ -748,6 +748,32 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
return 0;
}
/**
* How far from the start of the screen the <em>floating</em> search bar should rest.
* <p>
* To use original margin, return a negative value.
* <p>
* Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely
* makes sense to use that method to derive an appropriate value for the current/target state.
*/
public int getFloatingSearchBarRestingMarginStart() {
DeviceProfile dp = mActivityContext.getDeviceProfile();
return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin();
}
/**
* How far from the end of the screen the <em>floating</em> search bar should rest.
* <p>
* To use original margin, return a negative value.
* <p>
* Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely
* makes sense to use that method to derive an appropriate value for the current/target state.
*/
public int getFloatingSearchBarRestingMarginEnd() {
DeviceProfile dp = mActivityContext.getDeviceProfile();
return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin();
}
private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) {
if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) {
return;