use of net.osmand.plus.base.MultipleSelectionBottomSheet.SelectionUpdateListener in project Osmand by osmandapp.
the class SelectIndexesHelper method showSrtmMultipleSelectionDialog.
private void showSrtmMultipleSelectionDialog() {
MultipleDownloadItem mdi = (MultipleDownloadItem) downloadItem;
List<SelectableItem<DownloadItem>> allItems = new ArrayList<>();
List<SelectableItem<DownloadItem>> selectedItems = new ArrayList<>();
for (DownloadItem di : mdi.getAllItems()) {
SelectableItem<DownloadItem> si = createSrtmSelectableItem((SrtmDownloadItem) di);
allItems.add(si);
if (itemsToDownload.contains(di)) {
selectedItems.add(si);
}
}
final RadioItem meterBtn = createSrtmRadioBtn(true);
final RadioItem feetBtn = createSrtmRadioBtn(false);
List<RadioItem> radioItems = new ArrayList<>();
radioItems.add(meterBtn);
radioItems.add(feetBtn);
MultipleSelectionBottomSheet<DownloadItem> msDialog = MultipleSelectionWithModeBottomSheet.showInstance(activity, allItems, selectedItems, radioItems, true);
this.dialog = msDialog;
msDialog.setDialogStateListener(new DialogStateListener() {
@Override
public void onDialogCreated() {
dialog.setTitle(app.getString(R.string.welmode_download_maps));
dialog.setSelectedMode(useMetricByDefault ? meterBtn : feetBtn);
dialog.setSecondaryDescription(app.getString(R.string.srtm_download_list_help_message));
}
@Override
public void onCloseDialog() {
resetUseMeters();
}
});
msDialog.setSelectionUpdateListener(new SelectionUpdateListener() {
@Override
public void onSelectionUpdate() {
updateSize();
}
});
msDialog.setOnApplySelectionListener(getOnApplySelectionListener(listener));
}
Aggregations