Search in sources :

Example 1 with AccountAdapter

use of de.pixart.messenger.ui.adapter.AccountAdapter in project Pix-Art-Messenger by kriztan.

the class ShareViaAccountActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_manage_accounts);
    accountListView = findViewById(R.id.account_list);
    this.mAccountAdapter = new AccountAdapter(this, accountList);
    accountListView.setAdapter(this.mAccountAdapter);
    accountListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
            final Account account = accountList.get(position);
            final String body = getIntent().getStringExtra(EXTRA_BODY);
            try {
                final Jid contact = Jid.fromString(getIntent().getStringExtra(EXTRA_CONTACT));
                final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, contact, false, false);
                switchToConversation(conversation, body, false);
            } catch (InvalidJidException e) {
            // ignore error
            }
            finish();
        }
    });
}
Also used : Account(de.pixart.messenger.entities.Account) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Jid(de.pixart.messenger.xmpp.jid.Jid) InvalidJidException(de.pixart.messenger.xmpp.jid.InvalidJidException) Conversation(de.pixart.messenger.entities.Conversation) AccountAdapter(de.pixart.messenger.ui.adapter.AccountAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 2 with AccountAdapter

use of de.pixart.messenger.ui.adapter.AccountAdapter in project Pix-Art-Messenger by kriztan.

the class ManageAccountActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_manage_accounts);
    if (savedInstanceState != null) {
        String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT);
        if (jid != null) {
            try {
                this.selectedAccountJid = Jid.fromString(jid);
            } catch (InvalidJidException e) {
                this.selectedAccountJid = null;
            }
        }
    }
    accountListView = findViewById(R.id.account_list);
    this.mAccountAdapter = new AccountAdapter(this, accountList);
    accountListView.setAdapter(this.mAccountAdapter);
    accountListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
            switchToAccount(accountList.get(position));
        }
    });
    registerForContextMenu(accountListView);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) InvalidJidException(de.pixart.messenger.xmpp.jid.InvalidJidException) AccountAdapter(de.pixart.messenger.ui.adapter.AccountAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

View (android.view.View)2 AdapterView (android.widget.AdapterView)2 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)2 ListView (android.widget.ListView)2 AccountAdapter (de.pixart.messenger.ui.adapter.AccountAdapter)2 InvalidJidException (de.pixart.messenger.xmpp.jid.InvalidJidException)2 Account (de.pixart.messenger.entities.Account)1 Conversation (de.pixart.messenger.entities.Conversation)1 Jid (de.pixart.messenger.xmpp.jid.Jid)1