Search in sources :

Example 1 with ReportAdapter

use of flying.grub.tamtime.adapter.ReportAdapter in project TamTime by flyingrub.

the class OneStopActivity method updateAllReportDialog.

private void updateAllReportDialog() {
    if (current_dialog != null && current_dialog.isShowing()) {
        View view = current_dialog.getCustomView();
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
        ReportAdapter adapter = new ReportAdapter(stop.getReports(), getBaseContext());
        recyclerView.setAdapter(adapter);
        adapter.SetOnItemClickListener(new ReportAdapter.OnItemClickListener() {

            @Override
            public void onItemClick(View v, int position) {
                confirmDialog(position);
            }
        });
    }
}
Also used : ReportAdapter(flying.grub.tamtime.adapter.ReportAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 2 with ReportAdapter

use of flying.grub.tamtime.adapter.ReportAdapter in project TamTime by flyingrub.

the class OneStopActivity method createAllReportDialog.

private void createAllReportDialog() {
    String title = getBaseContext().getResources().getQuantityString(R.plurals.report, stop.getReports().size());
    current_dialog = new MaterialDialog.Builder(this).title(title).customView(R.layout.view_recycler, false).positiveText(R.string.OK).build();
    View view = current_dialog.getCustomView();
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new org.solovyev.android.views.llm.LinearLayoutManager(getBaseContext(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getBaseContext());
    recyclerView.addItemDecoration(itemDecoration);
    ReportAdapter adapter = new ReportAdapter(stop.getReports(), getBaseContext());
    recyclerView.setAdapter(adapter);
    adapter.SetOnItemClickListener(new ReportAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View v, int position) {
            confirmDialog(position);
        }
    });
    current_dialog.show();
}
Also used : ReportAdapter(flying.grub.tamtime.adapter.ReportAdapter) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(flying.grub.tamtime.adapter.DividerItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 ReportAdapter (flying.grub.tamtime.adapter.ReportAdapter)2 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 DividerItemDecoration (flying.grub.tamtime.adapter.DividerItemDecoration)1