use of io.jawg.osmcontributor.utils.helper.DragSwipeItemTouchHelperCallback in project osm-contributor by jawg.
the class TypeListActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_type_list);
ButterKnife.bind(this);
((OsmTemplateApplication) getApplication()).getOsmTemplateComponent().inject(this);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
presenter = new TypeListActivityPresenter(this, savedInstanceState);
typesAdapter = new PoiTypeAdapter(new ArrayList<PoiType>(), bitmapHandler);
typesAdapter.setPoiTypeAdapterListener(presenter.getPoiTypeAdapterListener());
recyclerTypes.setAdapter(typesAdapter);
recyclerTypes.setLayoutManager(new LinearLayoutManager(this));
ItemTouchHelper.Callback callback = new SwipeItemTouchHelperCallback(typesAdapter);
ItemTouchHelper swipeItemTouchHelper = new ItemTouchHelper(callback);
swipeItemTouchHelper.attachToRecyclerView(recyclerTypes);
tagsAdapter = new PoiTypeTagAdapter(new ArrayList<PoiTypeTag>());
tagsAdapter.setPoiTypeTagAdapterListener(presenter.getPoiTypeTagAdapterListener());
tagsAdapter.setOnStartDragListener(this);
recyclerTags.setAdapter(tagsAdapter);
recyclerTags.setLayoutManager(new LinearLayoutManager(this));
ItemTouchHelper.Callback dragSwipeCallback = new DragSwipeItemTouchHelperCallback(tagsAdapter);
dragSwipeItemTouchHelper = new ItemTouchHelper(dragSwipeCallback);
dragSwipeItemTouchHelper.attachToRecyclerView(recyclerTags);
listSwitcher.prepareViews(showingTypes);
if (savedInstanceState != null) {
filterConstraint = savedInstanceState.getString(FILTER_CONSTRAINT);
}
}
Aggregations