use of flying.grub.tamtime.adapter.OneRouteAdapter in project TamTime by flyingrub.
the class LineRouteFragment 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);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity());
recyclerView.addItemDecoration(itemDecoration);
direction = Data.getData().getMap().getLine(linePosition).getDirections().get(routePosition);
adapter = new OneRouteAdapter(direction.getStops(), getContext(), isTheoritical);
recyclerView.setAdapter(adapter);
adapter.SetOnItemClickListener(new OneRouteAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
selectitem(position);
}
});
if (isTheoritical) {
getActivity().setTitle("Théorique : Ligne " + Data.getData().getMap().getLine(linePosition).getShortName());
} else {
getActivity().setTitle("Ligne " + Data.getData().getMap().getLine(linePosition).getShortName());
}
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);
setHasOptionsMenu(true);
return view;
}
use of flying.grub.tamtime.adapter.OneRouteAdapter in project TamTime by flyingrub.
the class LineRouteFragment method onEvent.
public void onEvent(MessageUpdate event) {
if (event.type == MessageUpdate.Type.TIMES_UPDATE) {
direction = Data.getData().getMap().getLine(linePosition).getDirections().get(routePosition);
adapter = new OneRouteAdapter(direction.getStops(), getContext(), isTheoritical);
adapter.SetOnItemClickListener(new OneRouteAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
selectitem(position);
}
});
refreshLayout.setRefreshing(false);
recyclerView.swapAdapter(adapter, true);
}
}
Aggregations