use of io.jawg.osmcontributor.utils.helper.SwipeItemTouchHelperCallback 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);
}
}
use of io.jawg.osmcontributor.utils.helper.SwipeItemTouchHelperCallback in project osm-contributor by jawg.
the class UploadActivity method onCreate.
/*=========================================*/
/*----------------OVERRIDE-----------------*/
/*=========================================*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload);
((OsmTemplateApplication) getApplication()).getOsmTemplateComponent().inject(this);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
OsmAnswers.visitedActivity("Page de synchronisation");
adapter = new PoisAdapter(this, poisWrapper);
adapter.setOnStartSwipeListener(this);
poisListView.setAdapter(adapter);
poisListView.setLayoutManager(new LinearLayoutManager(this));
syncTutoManager = new SyncTutoManager(this, TutorialManager.forceDisplaySyncTuto);
ItemTouchHelper.Callback callback = new SwipeItemTouchHelperCallback(adapter);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
itemTouchHelper.attachToRecyclerView(poisListView);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
View childAt = poisListView.getChildAt(0);
if (childAt != null) {
syncTutoManager.launchTuto(childAt.findViewById(R.id.revert), findViewById(R.id.comment_edit_text), findViewById(R.id.action_confirm));
}
}
}, 500);
}
Aggregations