Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3091f0a4 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing ununsed append logic in search

Bug: 229860311
Test: Manual
Change-Id: Id6a72784b186fc5f0aaeac52f2a66fa35711fe4c
parent 8073fc8d
Loading
Loading
Loading
Loading
+10 −23
Original line number Diff line number Diff line
@@ -192,27 +192,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
        return true;
    }

    public boolean appendSearchResults(ArrayList<AdapterItem> results) {
        if (hasFilter() && results != null && results.size() > 0) {
            updateSearchAdapterItems(results, mSearchResults.size());
            refreshRecyclerView();
            return true;
        }
        return false;
    }

    void updateSearchAdapterItems(ArrayList<AdapterItem> list, int offset) {
        for (int i = 0; i < list.size(); i++) {
            AdapterItem adapterItem = list.get(i);
            adapterItem.position = offset + i;
            mAdapterItems.add(adapterItem);

            if (adapterItem.isCountedForAccessibility()) {
                mAccessibilityResultsCount++;
            }
        }
    }

    /**
     * Updates internals when the set of apps are updated.
     */
@@ -282,7 +261,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
        String lastSectionName = null;
        FastScrollSectionInfo lastFastScrollerSectionInfo = null;
        int position = 0;
        int appIndex = 0;

        // Prepare to update the list of sections, filtered apps, etc.
        mAccessibilityResultsCount = 0;
@@ -319,7 +297,16 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
                mAdapterItems.add(appItem);
            }
        } else {
            updateSearchAdapterItems(mSearchResults, 0);
            int count = mSearchResults.size();
            for (int i = 0; i < count; i++) {
                AdapterItem adapterItem = mSearchResults.get(i);
                adapterItem.position = i;
                mAdapterItems.add(adapterItem);

                if (adapterItem.isCountedForAccessibility()) {
                    mAccessibilityResultsCount++;
                }
            }
            if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
                // Append the search market item
                if (hasNoFilteredResults()) {
+0 −8
Original line number Diff line number Diff line
@@ -176,14 +176,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText
        }
    }

    @Override
    public void onAppendSearchResult(String query, ArrayList<AdapterItem> items) {
        if (items != null) {
            mApps.appendSearchResults(items);
            notifyResultChanged();
        }
    }

    @Override
    public void clearSearchResult() {
        if (mApps.setSearchResults(null)) {
+0 −7
Original line number Diff line number Diff line
@@ -31,13 +31,6 @@ public interface SearchCallback<T> {
     */
    void onSearchResult(String query, ArrayList<T> items);

    /**
     * Called when the search from secondary source is complete.
     *
     * @param items list of search results
     */
    void onAppendSearchResult(String query, ArrayList<T> items);

    /**
     * Called when the search results should be cleared.
     */
+0 −5
Original line number Diff line number Diff line
@@ -94,11 +94,6 @@ public class WidgetsSearchBarController implements TextWatcher,
        mSearchModeListener.onSearchResults(items);
    }

    @Override
    public void onAppendSearchResult(String query, ArrayList<WidgetsListBaseEntry> items) {
        // Not needed.
    }

    @Override
    public void clearSearchResult() {
        // Any existing search session will be cancelled by setting text to empty.