Search in sources :

Example 1 with NameLookupInputHandler

use of cx.ring.utils.NameLookupInputHandler in project ring-client-android by savoirfairelinux.

the class RingSearchPresenter method queryTextChanged.

public void queryTextChanged(String query) {
    if (query.equals("")) {
        getView().clearSearch();
    } else {
        Account currentAccount = mAccountService.getCurrentAccount();
        if (currentAccount == null) {
            return;
        }
        Uri uri = new Uri(query);
        if (uri.isRingId()) {
            mCallContact = CallContact.buildUnknown(uri);
            getView().displayContact(mCallContact);
        } else {
            getView().clearSearch();
            // Ring search
            if (mNameLookupInputHandler == null) {
                mNameLookupInputHandler = new NameLookupInputHandler(mAccountService, currentAccount.getAccountID());
            }
            mLastBlockchainQuery = query;
            mNameLookupInputHandler.enqueueNextLookup(query);
        }
    }
}
Also used : Account(cx.ring.model.Account) NameLookupInputHandler(cx.ring.utils.NameLookupInputHandler) Uri(cx.ring.model.Uri)

Example 2 with NameLookupInputHandler

use of cx.ring.utils.NameLookupInputHandler in project ring-client-android by savoirfairelinux.

the class SmartListPresenter method queryTextChanged.

public void queryTextChanged(String query) {
    if (query.equals("")) {
        getView().hideSearchRow();
        getView().setLoading(false);
    } else {
        Account currentAccount = mAccountService.getCurrentAccount();
        if (currentAccount == null) {
            return;
        }
        if (currentAccount.isSip()) {
            // sip search
            mCallContact = CallContact.buildUnknown(query, null);
            getView().displayContact(mCallContact);
        } else {
            Uri uri = new Uri(query);
            if (uri.isRingId()) {
                mCallContact = CallContact.buildUnknown(uri);
                getView().displayContact(mCallContact);
            } else {
                getView().hideSearchRow();
                // Ring search
                if (mNameLookupInputHandler == null) {
                    mNameLookupInputHandler = new NameLookupInputHandler(mAccountService, currentAccount.getAccountID());
                }
                mLastBlockchainQuery = query;
                mNameLookupInputHandler.enqueueNextLookup(query);
                getView().setLoading(true);
            }
        }
    }
    getView().updateList(filter(mSmartListViewModels, query));
}
Also used : Account(cx.ring.model.Account) NameLookupInputHandler(cx.ring.utils.NameLookupInputHandler) Uri(cx.ring.model.Uri)

Example 3 with NameLookupInputHandler

use of cx.ring.utils.NameLookupInputHandler in project ring-client-android by savoirfairelinux.

the class RingAccountCreationPresenter method userNameChanged.

public void userNameChanged(String userName) {
    if (!userName.isEmpty()) {
        if (mNameLookupInputHandler == null) {
            mNameLookupInputHandler = new NameLookupInputHandler(mAccountService, "");
        }
        mRingAccountViewModel.setUsername(userName);
        mNameLookupInputHandler.enqueueNextLookup(userName);
        isRingUserNameCorrect = false;
        getView().enableTextError();
    } else {
        getView().disableTextError();
    }
    checkForms();
}
Also used : NameLookupInputHandler(cx.ring.utils.NameLookupInputHandler)

Aggregations

NameLookupInputHandler (cx.ring.utils.NameLookupInputHandler)3 Account (cx.ring.model.Account)2 Uri (cx.ring.model.Uri)2