Search in sources :

Example 1 with SimpleItemTouchHelperCallback

use of com.xabber.android.ui.widget.SimpleItemTouchHelperCallback in project xabber-android by redsolution.

the class AccountListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_list);
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(AccountListActivity.this);
        }
    });
    toolbar.setTitle(R.string.title_reordering_account);
    toolbar.inflateMenu(R.menu.toolbar_account_list);
    toolbar.setOnMenuItemClickListener(this);
    barPainter = new BarPainter(this, toolbar);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.account_list_recycler_view);
    tvSummary = (TextView) findViewById(R.id.tvSummary);
    accountListAdapter = new AccountListReorderAdapter(this, this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(accountListAdapter);
    ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(accountListAdapter);
    touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(recyclerView);
}
Also used : ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) SimpleItemTouchHelperCallback(com.xabber.android.ui.widget.SimpleItemTouchHelperCallback) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) AccountListReorderAdapter(com.xabber.android.ui.adapter.AccountListReorderAdapter) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

View (android.view.View)1 TextView (android.widget.TextView)1 ItemTouchHelper (androidx.recyclerview.widget.ItemTouchHelper)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 AccountListReorderAdapter (com.xabber.android.ui.adapter.AccountListReorderAdapter)1 BarPainter (com.xabber.android.ui.color.BarPainter)1 SimpleItemTouchHelperCallback (com.xabber.android.ui.widget.SimpleItemTouchHelperCallback)1