Search in sources :

Example 1 with Callback

use of androidx.recyclerview.widget.ItemTouchHelper.Callback in project collect by opendatakit.

the class RankingWidgetDialog method setUpRecyclerView.

private RecyclerView setUpRecyclerView() {
    rankingListAdapter = new RankingListAdapter(viewModel.getItems(), viewModel.getFormIndex());
    RecyclerView recyclerView = new RecyclerView(getContext());
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(rankingListAdapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    Callback callback = new RankingItemTouchHelperCallback(rankingListAdapter);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
    itemTouchHelper.attachToRecyclerView(recyclerView);
    return recyclerView;
}
Also used : ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) RankingListAdapter(org.odk.collect.android.adapters.RankingListAdapter) LayoutParams(android.widget.LinearLayout.LayoutParams) RankingItemTouchHelperCallback(org.odk.collect.android.utilities.RankingItemTouchHelperCallback) Callback(androidx.recyclerview.widget.ItemTouchHelper.Callback) RankingItemTouchHelperCallback(org.odk.collect.android.utilities.RankingItemTouchHelperCallback) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

LayoutParams (android.widget.LinearLayout.LayoutParams)1 ItemTouchHelper (androidx.recyclerview.widget.ItemTouchHelper)1 Callback (androidx.recyclerview.widget.ItemTouchHelper.Callback)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 RankingListAdapter (org.odk.collect.android.adapters.RankingListAdapter)1 RankingItemTouchHelperCallback (org.odk.collect.android.utilities.RankingItemTouchHelperCallback)1