use of flying.grub.tamtime.adapter.OneStopAdapter in project TamTime by flyingrub.
the class StopLineFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.view_swype_refresh, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
circularIndeterminate = (ProgressBarCircularIndeterminate) view.findViewById(R.id.progressBarCircularIndeterminate);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
recyclerView.setHasFixedSize(true);
recyclerView.setBackgroundColor(getResources().getColor(R.color.windowBackgroundCard));
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
adapter = new OneStopAdapter(stopZone.getStops(line));
recyclerView.setAdapter(adapter);
adapter.SetOnItemClickListener(new OneStopAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
// Unneeded ?
}
});
circularIndeterminate.setVisibility(View.GONE);
refreshLayout.setVisibility(View.VISIBLE);
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Data.getData().update();
}
});
refreshLayout.setColorSchemeResources(R.color.primaryColor);
return view;
}
use of flying.grub.tamtime.adapter.OneStopAdapter in project TamTime by flyingrub.
the class StopLineFragment method onEvent.
public void onEvent(MessageUpdate event) {
if (event.type == MessageUpdate.Type.TIMES_UPDATE) {
refreshLayout.setRefreshing(false);
stopZone = Data.getData().getMap().getStopZoneById(getArguments().getInt("stop_zone_id"));
line = stopZone.getLines().get(getArguments().getInt("linePosition"));
adapter = new OneStopAdapter(stopZone.getStops(line));
recyclerView.swapAdapter(adapter, true);
}
}
Aggregations