spyglass-sample/src/main/java/com/linkedin/android/spyglass/sample/samples/MultiSourceMentions.java
@Override
    public List<String> onQueryReceived(final @NonNull QueryToken queryToken) {
        final boolean hasPeople = peopleCheckBox.isChecked();
        final boolean hasCities = citiesCheckBox.isChecked();

        final List<String> buckets = new ArrayList<>();
        final SuggestionsResultListener listener = editor;
        final Handler handler = new Handler(Looper.getMainLooper());

        // Fetch people if necessary
        if (hasPeople) {
            buckets.add(PERSON_BUCKET);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    List<Person> suggestions = people.getSuggestions(queryToken);
                    lastPersonSuggestions = new SuggestionsResult(queryToken, suggestions);
                    listener.onReceiveSuggestionsResult(lastPersonSuggestions, PERSON_BUCKET);
                }
            }, PERSON_DELAY);
        }

        // Fetch cities if necessary
        if (hasCities) {
            buckets.add(CITY_BUCKET);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    List<City> suggestions = cities.getSuggestions(queryToken);
                    lastCitySuggestions = new SuggestionsResult(queryToken, suggestions);
                    listener.onReceiveSuggestionsResult(lastCitySuggestions, CITY_BUCKET);
                }
            }, CITY_DELAY);
        }

        // Return buckets, one for each source (serves as promise to editor that we will call
        // onReceiveSuggestionsResult at a later time)
        return buckets;
    }
@Override
    public List<String> onQueryReceived(final @NonNull QueryToken queryToken) {
        final boolean hasPeople = peopleCheckBox.isChecked();
        final boolean hasCities = citiesCheckBox.isChecked();

        final List<String> buckets = new ArrayList<>();
        final SuggestionsResultListener listener = editor;
        final Handler handler = new Handler(Looper.getMainLooper());

        // Fetch people if necessary
        if (hasPeople) {
            buckets.add(PERSON_BUCKET);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    List<Person> suggestions = people.getSuggestions(queryToken);
                    lastPersonSuggestions = new SuggestionsResult(queryToken, suggestions);
                    listener.onReceiveSuggestionsResult(lastPersonSuggestions, PERSON_BUCKET);
                }
            }, PERSON_DELAY);
        }

        // Fetch cities if necessary
        if (hasCities) {
            buckets.add(CITY_BUCKET);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    List<City> suggestions = cities.getSuggestions(queryToken);
                    lastCitySuggestions = new SuggestionsResult(queryToken, suggestions);
                    listener.onReceiveSuggestionsResult(lastCitySuggestions, CITY_BUCKET);
                }
            }, CITY_DELAY);
        }

        // Return buckets, one for each source (serves as promise to editor that we will call
        // onReceiveSuggestionsResult at a later time)
        return buckets;
    }
@ Override public List < String > onQueryReceived ( final @ NonNull QueryToken queryToken ) { final boolean hasPeople = peopleCheckBox . isChecked ( ) ; final boolean hasCities = citiesCheckBox . isChecked ( ) ; final List < String > buckets = new ArrayList <> ( ) ; final SuggestionsResultListener listener = editor ; final Handler handler = new Handler ( Looper . getMainLooper ( ) ) ; // Fetch people if necessary if ( hasPeople ) { buckets . add ( PERSON_BUCKET ) ; handler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { List < Person > suggestions = people . getSuggestions ( queryToken ) ; lastPersonSuggestions = new SuggestionsResult ( queryToken , suggestions ) ; listener . onReceiveSuggestionsResult ( lastPersonSuggestions , PERSON_BUCKET ) ; } } , PERSON_DELAY ) ; } // Fetch cities if necessary if ( hasCities ) { buckets . add ( CITY_BUCKET ) ; handler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { List < City > suggestions = cities . getSuggestions ( queryToken ) ; lastCitySuggestions = new SuggestionsResult ( queryToken , suggestions ) ; listener . onReceiveSuggestionsResult ( lastCitySuggestions , CITY_BUCKET ) ; } } , CITY_DELAY ) ; } // Return buckets, one for each source (serves as promise to editor that we will call // onReceiveSuggestionsResult at a later time) return buckets ; }
--------------------------------------------------
--------------------------------------------------