Search in sources :

Example 1 with BlockedListAdapter

use of com.xabber.android.ui.adapter.BlockedListAdapter in project xabber-android by redsolution.

the class BlockedListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    account = getAccount(getIntent());
    if (account == null) {
        finish();
        return;
    }
    setContentView(R.layout.activity_with_toolbar_and_container);
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.inflateMenu(R.menu.toolbar_block_list);
    toolbar.setOnMenuItemClickListener(this);
    barPainter = new BarPainter(this, toolbar);
    RecyclerView recyclerView = new RecyclerView(this);
    ((RelativeLayout) findViewById(R.id.fragment_container)).addView(recyclerView);
    adapter = new BlockedListAdapter(account);
    adapter.setListener(this);
    if (savedInstanceState != null) {
        final ArrayList<String> checkedContacts = savedInstanceState.getStringArrayList(SAVED_CHECKED_CONTACTS);
        if (checkedContacts != null) {
            List<UserJid> checkedJids = new ArrayList<>();
            for (String contactString : checkedContacts) {
                try {
                    checkedJids.add(UserJid.from(contactString));
                } catch (UserJid.UserJidCreateException e) {
                    LogManager.exception(this, e);
                }
            }
            adapter.setCheckedContacts(checkedJids);
        }
    }
    previousSize = -1;
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Also used : RelativeLayout(android.widget.RelativeLayout) ArrayList(java.util.ArrayList) UserJid(com.xabber.android.data.entity.UserJid) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) BlockedListAdapter(com.xabber.android.ui.adapter.BlockedListAdapter) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

RelativeLayout (android.widget.RelativeLayout)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 UserJid (com.xabber.android.data.entity.UserJid)1 BlockedListAdapter (com.xabber.android.ui.adapter.BlockedListAdapter)1 BarPainter (com.xabber.android.ui.color.BarPainter)1 ArrayList (java.util.ArrayList)1