Moves Search results into a separate RV (take 2).

Bug: 206905515
Test: Manually verified b/230648542 did not resurface. Tested
on phone and tablet with and without work profile.

Change-Id: If724f635286b9dff2c64255f9ece3568a5cb4ea9
This commit is contained in:
Andy Wickham
2022-05-17 00:01:54 +00:00
parent 3c0f4c156d
commit 2ba7797edb
18 changed files with 392 additions and 212 deletions

View File

@@ -82,7 +82,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
OnClickListener marketSearchClickListener = (v) -> mActivityContext.startActivitySafely(v,
marketSearchIntent, null);
for (int i = 0; i < mAH.size(); i++) {
mAH.get(i).adapter.setLastSearchQuery(query, marketSearchClickListener);
mAH.get(i).mAdapter.setLastSearchQuery(query, marketSearchClickListener);
}
mIsSearching = true;
rebindAdapters();
@@ -101,7 +101,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
* Sets results list for search
*/
public void setSearchResults(ArrayList<AdapterItem> results) {
if (getApps().setSearchResults(results)) {
if (getSearchResultList().setSearchResults(results)) {
for (int i = 0; i < mAH.size(); i++) {
if (mAH.get(i).mRecyclerView != null) {
mAH.get(i).mRecyclerView.onSearchResultsChanged();
@@ -148,7 +148,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
@Override
public String getDescription() {
if (!mUsingTabs && mIsSearching) {
if (!mUsingTabs && isSearching()) {
return getContext().getString(R.string.all_apps_search_results);
} else {
return super.getDescription();
@@ -156,8 +156,13 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
}
@Override
protected boolean showTabs() {
return super.showTabs() && !mIsSearching;
protected boolean shouldShowTabs() {
return super.shouldShowTabs() && !isSearching();
}
@Override
public boolean isSearching() {
return mIsSearching;
}
@Override
@@ -179,15 +184,19 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
}
@Override
protected View replaceRVContainer(boolean showTabs) {
View rvContainer = super.replaceRVContainer(showTabs);
protected View replaceAppsRVContainer(boolean showTabs) {
View rvContainer = super.replaceAppsRVContainer(showTabs);
removeCustomRules(rvContainer);
removeCustomRules(getSearchRecyclerView());
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
alignParentTop(rvContainer, showTabs);
alignParentTop(getSearchRecyclerView(), /* tabs= */ false);
layoutAboveSearchContainer(rvContainer);
layoutAboveSearchContainer(getSearchRecyclerView());
} else {
layoutBelowSearchContainer(rvContainer, showTabs);
layoutBelowSearchContainer(getSearchRecyclerView(), /* tabs= */ false);
}
return rvContainer;
@@ -214,7 +223,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
float prog = Utilities.boundToRange((float) scrolledOffset / mHeaderThreshold, 0f, 1f);
boolean bgVisible = mSearchUiManager.getBackgroundVisibility();
if (scrolledOffset == 0 && !mIsSearching) {
if (scrolledOffset == 0 && !isSearching()) {
bgVisible = true;
} else if (scrolledOffset > mHeaderThreshold) {
bgVisible = false;
@@ -248,7 +257,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
int topMargin = getContext().getResources().getDimensionPixelSize(
R.dimen.all_apps_header_top_margin);
if (includeTabsMargin) {
topMargin = topMargin + getContext().getResources().getDimensionPixelSize(
topMargin += getContext().getResources().getDimensionPixelSize(
R.dimen.all_apps_header_pill_height);
}
layoutParams.topMargin = topMargin;
@@ -289,9 +298,9 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
}
@Override
protected BaseAllAppsAdapter getAdapter(AlphabeticalAppsList<T> mAppsList,
protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList,
BaseAdapterProvider[] adapterProviders) {
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), mAppsList,
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), appsList,
adapterProviders);
}
}