Search in sources :

Example 6 with AccountJid

use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.

the class ContactListPresenter method getSearchResults.

private ArrayList<AbstractContact> getSearchResults(Collection<RosterContact> rosterContacts, Comparator<AbstractContact> comparator, Map<AccountJid, Map<UserJid, AbstractChat>> abstractChats) {
    final ArrayList<AbstractContact> baseEntities = new ArrayList<>();
    // Build structure.
    for (RosterContact rosterContact : rosterContacts) {
        if (!rosterContact.isEnabled()) {
            continue;
        }
        final AccountJid account = rosterContact.getAccount();
        final Map<UserJid, AbstractChat> users = abstractChats.get(account);
        if (users != null) {
            users.remove(rosterContact.getUser());
        }
        if (rosterContact.getName().toLowerCase(locale).contains(filterString)) {
            baseEntities.add(rosterContact);
        }
    }
    for (Map<UserJid, AbstractChat> users : abstractChats.values()) {
        for (AbstractChat abstractChat : users.values()) {
            final AbstractContact abstractContact;
            if (abstractChat instanceof RoomChat) {
                abstractContact = new RoomContact((RoomChat) abstractChat);
            } else {
                abstractContact = new ChatContact(abstractChat);
            }
            if (abstractContact.getName().toLowerCase(locale).contains(filterString)) {
                baseEntities.add(abstractContact);
            }
        }
    }
    Collections.sort(baseEntities, comparator);
    return baseEntities;
}
Also used : RoomContact(com.xabber.android.data.extension.muc.RoomContact) RosterContact(com.xabber.android.data.roster.RosterContact) AbstractChat(com.xabber.android.data.message.AbstractChat) AccountJid(com.xabber.android.data.entity.AccountJid) ArrayList(java.util.ArrayList) UserJid(com.xabber.android.data.entity.UserJid) AbstractContact(com.xabber.android.data.roster.AbstractContact) RoomChat(com.xabber.android.data.extension.muc.RoomChat) ChatContact(com.xabber.android.data.message.ChatContact)

Example 7 with AccountJid

use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.

the class ContactListPresenter method onItemClick.

public void onItemClick(IFlexible item) {
    if (item instanceof ContactVO) {
        AccountJid accountJid = ((ContactVO) item).getAccountJid();
        UserJid userJid = ((ContactVO) item).getUserJid();
        if (view != null)
            view.onContactClick(RosterManager.getInstance().getAbstractContact(accountJid, userJid));
    } else if (item instanceof ButtonVO) {
        ButtonVO button = (ButtonVO) item;
        if (view != null)
            view.onButtonItemClick(button);
    }
}
Also used : ChatWithButtonVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ChatWithButtonVO) ButtonVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ButtonVO) AccountJid(com.xabber.android.data.entity.AccountJid) ExtContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ExtContactVO) ContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO) UserJid(com.xabber.android.data.entity.UserJid)

Example 8 with AccountJid

use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.

the class AccountHistorySettingsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_history_settings);
    AccountJid account = getAccount(getIntent());
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setTitle(R.string.account_chat_history);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.account_history_settings_fragment, AccountHistorySettingsFragment.newInstance(account)).commit();
    }
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 9 with AccountJid

use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.

the class AccountSyncActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_synchronization);
    final Intent intent = getIntent();
    AccountJid account = getAccount(intent);
    if (account == null) {
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    jid = accountItem.getAccount().getFullJid().asBareJid().toString();
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.setTitle(R.string.account_sync);
    barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    btnDeleteSettings = (Button) findViewById(R.id.btnDeleteSettings);
    switchSync = (Switch) findViewById(R.id.switchSync);
    rlSyncSwitch = (RelativeLayout) findViewById(R.id.rlSyncSwitch);
    tvJid = (TextView) findViewById(R.id.tvJid);
    tvStatus = (TextView) findViewById(R.id.tvStatus);
    ivStatus = (ImageView) findViewById(R.id.ivStatus);
    syncStatusView = (LinearLayout) findViewById(R.id.syncStatusView);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    rlSyncSwitch.setOnClickListener(this);
    btnDeleteSettings.setOnClickListener(this);
    syncStatusView.setOnClickListener(this);
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 10 with AccountJid

use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.

the class BookmarksActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bokmarks);
    final Intent intent = getIntent();
    AccountJid account = getAccount(intent);
    if (account == null) {
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.setTitle(R.string.account_bookmarks);
    toolbar.inflateMenu(R.menu.toolbar_bookmark_list);
    toolbar.setOnMenuItemClickListener(this);
    barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
    bookmarksAdapter = new BookmarkAdapter(this);
    bookmarksAdapter.setListener(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(bookmarksAdapter);
    progressBar = findViewById(R.id.server_info_progress_bar);
    tvNotSupport = (TextView) findViewById(R.id.tvNotSupport);
    requestBookmarks(false);
}
Also used : BookmarkAdapter(com.xabber.android.ui.adapter.BookmarkAdapter) AccountJid(com.xabber.android.data.entity.AccountJid) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

AccountJid (com.xabber.android.data.entity.AccountJid)74 UserJid (com.xabber.android.data.entity.UserJid)38 AccountItem (com.xabber.android.data.account.AccountItem)21 Jid (org.jxmpp.jid.Jid)13 Intent (android.content.Intent)11 ArrayList (java.util.ArrayList)11 View (android.view.View)10 NetworkException (com.xabber.android.data.NetworkException)9 AbstractChat (com.xabber.android.data.message.AbstractChat)7 Message (org.jivesoftware.smack.packet.Message)7 Presence (org.jivesoftware.smack.packet.Presence)7 ExtensionElement (org.jivesoftware.smack.packet.ExtensionElement)6 TextView (android.widget.TextView)5 StatusMode (com.xabber.android.data.account.StatusMode)5 Resourcepart (org.jxmpp.jid.parts.Resourcepart)5 ImageView (android.widget.ImageView)4 AccountManager (com.xabber.android.data.account.AccountManager)4 RosterContact (com.xabber.android.data.roster.RosterContact)4 ContactVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO)4 BarPainter (com.xabber.android.ui.color.BarPainter)4