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

Commit 403b725a authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "[phone] Don't start search loader before it's ready"

parents 095af25e ad8fefe9
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE

    private static final String KEY_FILTER = "filter";

    /** true if the loader has started at least once. */
    private boolean mLoaderStarted;

    // A complete copy from DefaultContactBrowserListFragment
    // TODO: should be able to share logic around filter header.
    private class FilterHeaderClickListener implements OnClickListener {
@@ -203,6 +206,12 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
        }
    }

    @Override
    protected void startLoading() {
        mLoaderStarted = true;
        super.startLoading();
    }

    @Override
    protected ContactEntryListAdapter createListAdapter() {
        if (!isLegacyCompatibilityMode()) {
@@ -272,7 +281,11 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
            ContactListFilter.storeToPreferences(mPrefs, mFilter);
        }

        // This method can be called before {@link #onStart} where we start the loader.  In that
        // case we shouldn't start the loader yet, as we haven't done all initialization yet.
        if (mLoaderStarted) {
            reloadData();
        }
        updateFilterHeaderView();
    }
}