use of net.osmand.plus.routepreparationmenu.RouteOptionsBottomSheet in project Osmand by osmandapp.
the class ElevationDateBottomSheet method createReliefFactorButtons.
private void createReliefFactorButtons(Context context) {
for (int i = 0; i < parameters.size(); i++) {
RoutingParameter parameter = parameters.get(i);
final BottomSheetItemWithCompoundButton[] preferenceItem = new BottomSheetItemWithCompoundButton[1];
preferenceItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(i == selectedEntryIndex).setButtonTintList(createColorStateList(context, nightMode)).setTitle(getRoutingParameterTitle(app, parameter)).setLayoutId(R.layout.bottom_sheet_item_with_radio_btn_left).setTag(i).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectedEntryIndex = (int) preferenceItem[0].getTag();
if (selectedEntryIndex >= 0) {
RoutingParameter parameter = parameters.get(selectedEntryIndex);
updateSelectedParameters(app, appMode, parameters, parameter.getId());
}
Fragment target = getTargetFragment();
if (target instanceof BaseSettingsFragment) {
((BaseSettingsFragment) target).updateSetting(useHeightPref.getId());
}
if (target instanceof RouteOptionsBottomSheet) {
((RouteOptionsBottomSheet) target).updateMenuItems();
}
updateReliefButtons();
app.runInUIThread(new Runnable() {
@Override
public void run() {
dismiss();
}
}, 500);
}
}).create();
items.add(preferenceItem[0]);
reliefFactorButtons.add(preferenceItem[0]);
}
}
Aggregations