Search in sources :

Example 1 with RecyclerViewClickListener

use of org.odk.collect.android.listeners.RecyclerViewClickListener in project collect by opendatakit.

the class AppListActivity method setupBottomSheet.

private void setupBottomSheet() {
    bottomSheetDialog = new BottomSheetDialog(this, R.style.MaterialDialogSheet);
    View sheetView = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(this, recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
            isBottomDialogShown = false;
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
    if (isBottomDialogShown) {
        bottomSheetDialog.show();
    }
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 2 with RecyclerViewClickListener

use of org.odk.collect.android.listeners.RecyclerViewClickListener in project collect by opendatakit.

the class AppListActivity method showBottomSheetDialog.

private void showBottomSheetDialog() {
    bottomSheetDialog = new BottomSheetDialog(this);
    final View sheetView = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(this, recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
    bottomSheetDialog.show();
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(androidx.appcompat.widget.SearchView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 3 with RecyclerViewClickListener

use of org.odk.collect.android.listeners.RecyclerViewClickListener in project collect by opendatakit.

the class AppListFragment method setupBottomSheet.

private void setupBottomSheet() {
    CollectAbstractActivity activity = (CollectAbstractActivity) getActivity();
    if (activity == null) {
        Timber.e("Activity is null");
        return;
    }
    bottomSheetDialog = new BottomSheetDialog(activity);
    View sheetView = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(getActivity(), recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
}
Also used : CollectAbstractActivity(org.odk.collect.android.activities.CollectAbstractActivity) BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(androidx.appcompat.widget.SearchView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Aggregations

View (android.view.View)3 ListView (android.widget.ListView)3 SortDialogAdapter (org.odk.collect.android.adapters.SortDialogAdapter)3 RecyclerViewClickListener (org.odk.collect.android.listeners.RecyclerViewClickListener)3 AdapterView (android.widget.AdapterView)2 SearchView (androidx.appcompat.widget.SearchView)2 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 BottomSheetDialog (com.google.android.material.bottomsheet.BottomSheetDialog)2 BottomSheetDialog (android.support.design.widget.BottomSheetDialog)1 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SearchView (android.support.v7.widget.SearchView)1 TextView (android.widget.TextView)1 CollectAbstractActivity (org.odk.collect.android.activities.CollectAbstractActivity)1