Fixing search behavior in Launcher3

> Showing no-result found only when there are no results
> Removing unnecessary view inflation in RecyclerViewPool for
  various search vide types
> Removing unused market-search link and no-empty-result illustration

Bug: 240343082
Bug: 207573083
Test: Verified Launcher3
Change-Id: Ia44799cd2385ea5dc837ef25732ca237975abde7
This commit is contained in:
Sunny Goyal
2022-07-27 16:38:27 -07:00
parent f6003ff070
commit af95ddbadc
16 changed files with 33 additions and 623 deletions

View File

@@ -15,17 +15,12 @@
*/
package com.android.launcher3.allapps;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_ALL_APPS_DIVIDER;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_EMPTY_SEARCH;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_SEARCH_MARKET;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DiffUtil;
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.util.LabelComparator;
@@ -172,13 +167,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
return !mSearchResults.isEmpty();
}
/**
* Returns whether there are no filtered results.
*/
public boolean hasNoFilteredResults() {
return hasSearchResults() && mAccessibilityResultsCount == 0;
}
/**
* Sets results list for search
*/
@@ -249,15 +237,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
// ordered set of sections
if (hasSearchResults()) {
mAdapterItems.addAll(mSearchResults);
if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
// Append the search market item
if (hasNoFilteredResults()) {
mAdapterItems.add(new AdapterItem(VIEW_TYPE_EMPTY_SEARCH));
} else {
mAdapterItems.add(new AdapterItem(VIEW_TYPE_ALL_APPS_DIVIDER));
}
mAdapterItems.add(new AdapterItem(VIEW_TYPE_SEARCH_MARKET));
}
} else {
int position = 0;
if (mWorkProviderManager != null) {