Search in sources :

Example 1 with AllLinesAdapter

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);
    }
}
Also used : AllLinesAdapter(flying.grub.tamtime.adapter.AllLinesAdapter)

Example 2 with AllLinesAdapter

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;
}
Also used : AllLinesAdapter(flying.grub.tamtime.adapter.AllLinesAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(flying.grub.tamtime.adapter.DividerItemDecoration) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

AllLinesAdapter (flying.grub.tamtime.adapter.AllLinesAdapter)2 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 DividerItemDecoration (flying.grub.tamtime.adapter.DividerItemDecoration)1