This commit is contained in:
androiddevkkotlin 2020-12-07 10:27:17 +02:00
parent 13795524f8
commit 842c4b0f99

View file

@ -270,11 +270,8 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
final View itemView = UiUtilities.getInflater(app, nightMode).inflate( final View itemView = UiUtilities.getInflater(app, nightMode).inflate(
R.layout.bottom_sheet_item_with_switch_and_dialog, null, false); R.layout.bottom_sheet_item_with_switch_and_dialog, null, false);
final SwitchCompat switchButton = itemView.findViewById(R.id.switchWidget); final SwitchCompat switchButton = itemView.findViewById(R.id.switchWidget);
int selectedModeColor = ContextCompat.getColor(app, selectedModeColorId);
View itemsContainer = itemView.findViewById(R.id.selectable_list_item); View itemsContainer = itemView.findViewById(R.id.selectable_list_item);
switchButton.setChecked(!active);
switchButton.setFocusable(false); switchButton.setFocusable(false);
UiUtilities.setupCompoundButton(nightMode, selectedModeColor, switchButton);
itemsContainer.setOnClickListener(new View.OnClickListener() { itemsContainer.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -295,6 +292,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
}); });
item[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() item[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(!active)
.setCompoundButtonColorId(selectedModeColorId) .setCompoundButtonColorId(selectedModeColorId)
.setDescription(getElevationDescription(parameter)) .setDescription(getElevationDescription(parameter))
.setIcon(getContentIcon(active ? parameter.getActiveIconId() : parameter.getDisabledIconId())) .setIcon(getContentIcon(active ? parameter.getActiveIconId() : parameter.getDisabledIconId()))
@ -533,15 +531,8 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
builder.setOnClickListener(new View.OnClickListener() { builder.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (USE_HEIGHT_OBSTACLES.equals(parameter.getKey()) && hasReliefParameters()) {
FragmentManager fm = getFragmentManager();
if (fm != null) {
ElevationDateBottomSheet.showInstance(fm, applicationMode, RouteOptionsBottomSheet.this, false);
}
} else {
applyParameter(item[0], parameter); applyParameter(item[0], parameter);
} }
}
}); });
} }
if (iconId != -1) { if (iconId != -1) {