mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Update tests to support floating search.
Tests need to be updated to account for the new placement of the searchbar because it overlapped with touch events for scrolling: - Scroll back to top: Instead of scrolling from the top of the container which could overlap status bar in landscape, scroll from the bottom of the top-most visible app icon. - Scroll down: swipe up from bottom padding to top of top-most visible icon. - Close all apps: swipe down more quickly from top icon insetad of the search bar (more quickly helps it be detected as a fling on more cramped devices). For Launcher3, the floating flag is not fully supported yet, so there were some layout issues which are now resolved by ignoring the flag if the searchbar is still at the top. Fix: 268052768 Test: Ran tests, manual Change-Id: If54717e2835c7cc4ed1368554bbc493193945c1d Merged-In: I406fbcbe12acddb1dd4b862a380576a48cabbebc
This commit is contained in:
@@ -473,7 +473,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
}
|
||||
setupHeader();
|
||||
|
||||
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
if (isSearchBarOnBottom()) {
|
||||
// Keep the scroller above the search bar.
|
||||
RelativeLayout.LayoutParams scrollerLayoutParams =
|
||||
(LayoutParams) findViewById(R.id.fast_scroller).getLayoutParams();
|
||||
@@ -519,7 +519,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
removeCustomRules(getSearchRecyclerView());
|
||||
if (!isSearchSupported()) {
|
||||
layoutWithoutSearchContainer(rvContainer, showTabs);
|
||||
} else if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
} else if (isSearchBarOnBottom()) {
|
||||
alignParentTop(rvContainer, showTabs);
|
||||
alignParentTop(getSearchRecyclerView(), /* tabs= */ false);
|
||||
layoutAboveSearchContainer(rvContainer);
|
||||
@@ -554,7 +554,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
removeCustomRules(mHeader);
|
||||
if (!isSearchSupported()) {
|
||||
layoutWithoutSearchContainer(mHeader, false /* includeTabsMargin */);
|
||||
} else if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
} else if (isSearchBarOnBottom()) {
|
||||
alignParentTop(mHeader, false /* includeTabsMargin */);
|
||||
} else {
|
||||
layoutBelowSearchContainer(mHeader, false /* includeTabsMargin */);
|
||||
@@ -593,6 +593,19 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
(int) (mSearchContainer.getAlpha() * 255));
|
||||
}
|
||||
|
||||
/**
|
||||
* It is up to the search container view created by {@link #inflateSearchBox()} to use the
|
||||
* floating search bar flag to move itself to the bottom of this container. This method checks
|
||||
* if that had been done; otherwise the flag will be ignored.
|
||||
*
|
||||
* @return true if the search bar is at the bottom of the container (as opposed to the top).
|
||||
**/
|
||||
private boolean isSearchBarOnBottom() {
|
||||
return FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()
|
||||
&& ((RelativeLayout.LayoutParams) mSearchContainer.getLayoutParams()).getRule(
|
||||
ALIGN_PARENT_BOTTOM) == RelativeLayout.TRUE;
|
||||
}
|
||||
|
||||
private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) {
|
||||
if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) {
|
||||
return;
|
||||
@@ -891,7 +904,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0);
|
||||
} else {
|
||||
int topPadding = grid.allAppsTopPadding;
|
||||
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() && !grid.isTablet) {
|
||||
if (isSearchBarOnBottom() && !grid.isTablet) {
|
||||
topPadding += getResources().getDimensionPixelSize(
|
||||
R.dimen.all_apps_additional_top_padding_floating_search);
|
||||
}
|
||||
@@ -1092,7 +1105,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
FloatingHeaderView headerView = getFloatingHeaderView();
|
||||
if (isTablet) {
|
||||
// Start adding header protection if search bar or tabs will attach to the top.
|
||||
if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) {
|
||||
if (!isSearchBarOnBottom() || mUsingTabs) {
|
||||
View panel = (View) mBottomSheetBackground;
|
||||
float translationY = ((View) panel.getParent()).getTranslationY();
|
||||
mTmpRectF.set(panel.getLeft(), panel.getTop() + translationY, panel.getRight(),
|
||||
@@ -1134,7 +1147,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
/** Returns the position of the bottom edge of the header */
|
||||
public int getHeaderBottom() {
|
||||
int bottom = (int) getTranslationY() + mHeader.getClipTop();
|
||||
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
if (isSearchBarOnBottom()) {
|
||||
if (mActivityContext.getDeviceProfile().isTablet) {
|
||||
return bottom + mBottomSheetBackground.getTop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user