use of net.osmand.plus.widgets.multistatetoggle.RadioItem 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));
}
use of net.osmand.plus.widgets.multistatetoggle.RadioItem in project Osmand by osmandapp.
the class SelectIndexesHelper method createSrtmRadioBtn.
private RadioItem createSrtmRadioBtn(final boolean useMeters) {
int titleId = useMeters ? R.string.shared_string_meters : R.string.shared_string_feet;
String title = Algorithms.capitalizeFirstLetter(app.getString(titleId));
RadioItem radioItem = new TextRadioItem(title);
radioItem.setOnClickListener(new OnRadioItemClickListener() {
@Override
public boolean onRadioItemClick(RadioItem radioItem, View view) {
setUseMetersForAllItems(useMeters);
updateListItems();
updateSize();
return true;
}
});
return radioItem;
}
Aggregations