use of flying.grub.tamtime.adapter.HomeAdapter in project TamTime by flyingrub.
the class HomeFragment method setupFavStopLine.
public void setupFavStopLine() {
homeAdapter = new HomeAdapter(favoriteStopLine.getFavStopLines(), getActivity(), favHomeView, searchView);
homeAdapter.SetOnItemClickListener(new HomeAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
PopupMenu popup = new PopupMenu(getActivity(), view);
// Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.remove_from_home, popup.getMenu());
// registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
favoriteStopLine.removeLineStop(position - 1);
setupFavStopLine();
return true;
}
});
popup.show();
}
});
favStopLinesRecycler.swapAdapter(homeAdapter, false);
}
Aggregations