Search in sources :

Example 6 with SelectableItem

use of net.osmand.plus.base.SelectionBottomSheet.SelectableItem in project Osmand by osmandapp.

the class SelectIndexesHelper method showMultipleSelectionDialog.

private void showMultipleSelectionDialog() {
    MultipleDownloadItem mdi = (MultipleDownloadItem) downloadItem;
    List<SelectableItem<DownloadItem>> allItems = new ArrayList<>();
    List<SelectableItem<DownloadItem>> selectedItems = new ArrayList<>();
    for (DownloadItem di : mdi.getAllItems()) {
        SelectableItem<DownloadItem> si = createSelectableItem(di);
        allItems.add(si);
        if (itemsToDownload.contains(di)) {
            selectedItems.add(si);
        }
    }
    MultipleSelectionBottomSheet<DownloadItem> msDialog = MultipleSelectionBottomSheet.showInstance(activity, allItems, selectedItems, true);
    this.dialog = msDialog;
    msDialog.setDialogStateListener(new DialogStateListener() {

        @Override
        public void onDialogCreated() {
            dialog.setTitle(app.getString(R.string.welmode_download_maps));
        }

        @Override
        public void onCloseDialog() {
        }
    });
    msDialog.setSelectionUpdateListener(this::updateSize);
    msDialog.setOnApplySelectionListener(getOnApplySelectionListener(listener));
}
Also used : DialogStateListener(net.osmand.plus.base.SelectionBottomSheet.DialogStateListener) SelectableItem(net.osmand.plus.base.SelectionBottomSheet.SelectableItem) ArrayList(java.util.ArrayList)

Aggregations

SelectableItem (net.osmand.plus.base.SelectionBottomSheet.SelectableItem)6 ArrayList (java.util.ArrayList)5 DialogStateListener (net.osmand.plus.base.SelectionBottomSheet.DialogStateListener)4 NonNull (androidx.annotation.NonNull)2 DownloadItem (net.osmand.plus.download.DownloadItem)2 Intent (android.content.Intent)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ProgressBar (android.widget.ProgressBar)1 TextView (android.widget.TextView)1 FragmentManager (androidx.fragment.app.FragmentManager)1 DateFormat (java.text.DateFormat)1 List (java.util.List)1 WorldRegion (net.osmand.map.WorldRegion)1 R (net.osmand.plus.R)1 MapActivity (net.osmand.plus.activities.MapActivity)1 MultipleSelectionBottomSheet (net.osmand.plus.base.MultipleSelectionBottomSheet)1 SelectionUpdateListener (net.osmand.plus.base.MultipleSelectionBottomSheet.SelectionUpdateListener)1 DownloadIndexesThread (net.osmand.plus.download.DownloadIndexesThread)1 DownloadEvents (net.osmand.plus.download.DownloadIndexesThread.DownloadEvents)1