Search in sources :

Example 1 with UserSearchResult

use of com.waz.api.UserSearchResult in project wire-android by wireapp.

the class PickUserFragment method loadStartUi.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  List and grid helpers
//
//////////////////////////////////////////////////////////////////////////////////////////
@DebugLog
public void loadStartUi() {
    if (searchResultAdapter.getItemCount() == 0) {
        getContainer().getLoadingViewIndicator().show(LoadingIndicatorView.SPINNER);
    } else {
        getContainer().getLoadingViewIndicator().show(LoadingIndicatorView.INFINITE_LOADING_BAR, showLoadingBarDelay);
    }
    String filter = getControllerFactory().getPickUserController().getSearchFilter();
    boolean hasSelectedUsers = getControllerFactory().getPickUserController().hasSelectedUsers();
    switch(getDataState(hasSelectedUsers)) {
        case SHOW_ALL_USERS_TO_ADD_TO_CONVERSATION:
            filter = "";
        case SHOW_SEARCH_RESULTS_TO_ADD_TO_CONVERSATION:
            String[] excludedUsers = getStoreFactory().getPickUserStore().getExcludedUsers();
            UserSearchResult usersSearchResult = getStoreFactory().getZMessagingApiStore().getApi().search().getConnectionsByName(filter, NUM_SEARCH_RESULTS_ADD_TO_CONV, excludedUsers);
            usersSearchModelObserver.setAndUpdate(usersSearchResult);
            break;
        case SHOW_SEARCH_RESULTS:
            getStoreFactory().getPickUserStore().loadSearchByFilter(filter, NUM_SEARCH_RESULTS_LIST, false);
            if (!hasSelectedUsers) {
                getStoreFactory().getPickUserStore().searchContacts(filter);
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new EnteredSearchEvent(isAddingToConversation(), filter));
            break;
        case SHOW_TOP_USERS_AS_LIST:
        case SHOW_TOP_USERS_AND_RECOMMENDED:
            boolean excludeConversationParticipants = isAddingToConversation() && getArguments().getBoolean(ARGUMENT_GROUP_CONVERSATION);
            getStoreFactory().getPickUserStore().loadTopUserList(NUM_SEARCH_RESULTS_TOP_USERS, excludeConversationParticipants);
            break;
    }
}
Also used : EnteredSearchEvent(com.waz.zclient.controllers.tracking.events.connect.EnteredSearchEvent) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) UserSearchResult(com.waz.api.UserSearchResult) DebugLog(hugo.weaving.DebugLog)

Aggregations

UserSearchResult (com.waz.api.UserSearchResult)1 EnteredSearchEvent (com.waz.zclient.controllers.tracking.events.connect.EnteredSearchEvent)1 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)1 DebugLog (hugo.weaving.DebugLog)1