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

Commit 30d6df45 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add pseudo-filtering on authenticated views." into oc-mr1-dev

parents f243b1f4 d56a4978
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -229,6 +229,13 @@ final class FillUi {
    public void setFilterText(@Nullable String filterText) {
        throwIfDestroyed();
        if (mAdapter == null) {
            // ViewState doesn't not support filtering - typically when it's for an authenticated
            // FillResponse.
            if (TextUtils.isEmpty(filterText)) {
                mCallback.requestShowFillUi(mContentWidth, mContentHeight, mWindowPresenter);
            } else {
                mCallback.requestHideFillUi();
            }
            return;
        }

@@ -510,8 +517,9 @@ final class FillUi {
                        final ViewItem item = mAllItems.get(i);
                        final String value = item.getValue();
                        // No value, i.e. null, matches any filter
                        if (value == null
                                || value.toLowerCase().startsWith(constraintLowerCase)) {
                        if ((value == null && item.mDataset.getAuthentication() == null)
                                || (value != null
                                        && value.toLowerCase().startsWith(constraintLowerCase))) {
                            filteredItems.add(item);
                        }
                    }
@@ -525,9 +533,11 @@ final class FillUi {
                    final boolean resultCountChanged;
                    final int oldItemCount = mFilteredItems.size();
                    mFilteredItems.clear();
                    if (results.count > 0) {
                        @SuppressWarnings("unchecked")
                        final List<ViewItem> items = (List<ViewItem>) results.values;
                        mFilteredItems.addAll(items);
                    }
                    resultCountChanged = (oldItemCount != mFilteredItems.size());
                    if (resultCountChanged) {
                        announceSearchResultIfNeeded();