This commit is contained in:
Vitaliy 2020-01-06 10:14:46 +02:00
parent c0ed1d1eca
commit a39595177a

View file

@ -61,7 +61,8 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
private RoutingHelper routingHelper; private RoutingHelper routingHelper;
private RoutingOptionsHelper routingOptionsHelper; private RoutingOptionsHelper routingOptionsHelper;
private ApplicationMode applicationMode; private ApplicationMode applicationMode;
@ColorRes private int selectedModeColorId; @ColorRes
private int selectedModeColorId;
private MapActivity mapActivity; private MapActivity mapActivity;
@Override @Override
@ -166,15 +167,15 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
final BottomSheetItemWithCompoundButton[] timeConditionalRoutingItem = new BottomSheetItemWithCompoundButton[1]; final BottomSheetItemWithCompoundButton[] timeConditionalRoutingItem = new BottomSheetItemWithCompoundButton[1];
timeConditionalRoutingItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() timeConditionalRoutingItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setCompoundButtonColorId(selectedModeColorId) .setCompoundButtonColorId(selectedModeColorId)
.setChecked(settings.ENABLE_TIME_CONDITIONAL_ROUTING.get()) .setChecked(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getModeValue(applicationMode))
.setIcon(getContentIcon((optionsItem.getActiveIconId()))) .setIcon(getContentIcon((optionsItem.getActiveIconId())))
.setTitle(getString(R.string.temporary_conditional_routing)) .setTitle(getString(R.string.temporary_conditional_routing))
.setLayoutId(R.layout.bottom_sheet_item_with_switch_56dp) .setLayoutId(R.layout.bottom_sheet_item_with_switch_56dp)
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean enabled = !settings.ENABLE_TIME_CONDITIONAL_ROUTING.get(); boolean enabled = !settings.ENABLE_TIME_CONDITIONAL_ROUTING.getModeValue(applicationMode);
settings.ENABLE_TIME_CONDITIONAL_ROUTING.set(enabled); settings.ENABLE_TIME_CONDITIONAL_ROUTING.setModeValue(applicationMode, enabled);
timeConditionalRoutingItem[0].setChecked(enabled); timeConditionalRoutingItem[0].setChecked(enabled);
app.getRoutingHelper().recalculateRouteDueToSettingsChange(); app.getRoutingHelper().recalculateRouteDueToSettingsChange();
} }