use of flying.grub.tamtime.adapter.AllLinesAdapter in project TamTime by flyingrub.
the class AllLinesFragment method onEvent.
public void onEvent(MessageUpdate event) {
if (event.type == MessageUpdate.Type.LINES_UPDATE) {
lines = Data.getData().getMap().getLines();
recyclerView.swapAdapter(new AllLinesAdapter(lines), false);
}
}
use of flying.grub.tamtime.adapter.AllLinesAdapter in project TamTime by flyingrub.
the class AllLinesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.view_recycler, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
getActivity().setTitle(getString(R.string.all_lines));
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity());
recyclerView.addItemDecoration(itemDecoration);
// specify an adapter (see also next example)
lines = Data.getData().getMap().getLines();
adapter = new AllLinesAdapter(lines);
recyclerView.setAdapter(adapter);
adapter.SetOnItemClickListener(new AllLinesAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
selectitem(position);
}
});
return view;
}
Aggregations