small refactor

This commit is contained in:
veliymolfar 2020-06-11 12:10:08 +03:00
parent 5a67f1fbb6
commit 2fc466f546
2 changed files with 7 additions and 7 deletions

View file

@ -408,7 +408,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
InputZoomLevelsBottomSheet.showInstance( InputZoomLevelsBottomSheet.showInstance(
fm, EditMapSourceDialogFragment.this, fm, EditMapSourceDialogFragment.this,
R.string.map_source_zoom_levels, R.string.map_source_zoom_levels_descr, R.string.map_source_zoom_levels, R.string.map_source_zoom_levels_descr,
minZoom, maxZoom, editedLayerName != null minZoom, maxZoom, editedLayerName == null
); );
break; break;
case EXPIRE_TIME: case EXPIRE_TIME:

View file

@ -41,7 +41,7 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
private static final String MAX_ZOOM_KEY = "max_zoom_key"; private static final String MAX_ZOOM_KEY = "max_zoom_key";
private static final String SLIDER_DESCR_RES_KEY = "slider_descr_key"; private static final String SLIDER_DESCR_RES_KEY = "slider_descr_key";
private static final String DIALOG_DESCR_RES_KEY = "dialog_descr_key"; private static final String DIALOG_DESCR_RES_KEY = "dialog_descr_key";
private static final String SHOW_WARNING_KEY = "show_warning_key"; private static final String NEW_MAP_SOURCE = "new_map_source";
private static final int SLIDER_FROM = 1; private static final int SLIDER_FROM = 1;
private static final int SLIDER_TO = 22; private static final int SLIDER_TO = 22;
@StringRes @StringRes
@ -77,7 +77,7 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
maxZoom = savedInstanceState.getInt(MAX_ZOOM_KEY); maxZoom = savedInstanceState.getInt(MAX_ZOOM_KEY);
dialogDescrRes = savedInstanceState.getInt(DIALOG_DESCR_RES_KEY); dialogDescrRes = savedInstanceState.getInt(DIALOG_DESCR_RES_KEY);
sliderDescrRes = savedInstanceState.getInt(SLIDER_DESCR_RES_KEY); sliderDescrRes = savedInstanceState.getInt(SLIDER_DESCR_RES_KEY);
newMapSource = savedInstanceState.getBoolean(SHOW_WARNING_KEY); newMapSource = savedInstanceState.getBoolean(NEW_MAP_SOURCE);
} }
LayoutInflater inflater = UiUtilities.getMaterialInflater(app, nightMode); LayoutInflater inflater = UiUtilities.getMaterialInflater(app, nightMode);
TitleItem titleItem = new TitleItem(getString(R.string.shared_string_zoom_levels)); TitleItem titleItem = new TitleItem(getString(R.string.shared_string_zoom_levels));
@ -141,14 +141,14 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
outState.putInt(MAX_ZOOM_KEY, maxZoom); outState.putInt(MAX_ZOOM_KEY, maxZoom);
outState.putInt(SLIDER_DESCR_RES_KEY, sliderDescrRes); outState.putInt(SLIDER_DESCR_RES_KEY, sliderDescrRes);
outState.putInt(DIALOG_DESCR_RES_KEY, dialogDescrRes); outState.putInt(DIALOG_DESCR_RES_KEY, dialogDescrRes);
outState.putBoolean(SHOW_WARNING_KEY, newMapSource); outState.putBoolean(NEW_MAP_SOURCE, newMapSource);
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@Override @Override
protected void onRightBottomButtonClick() { protected void onRightBottomButtonClick() {
if (newMapSource) { if (!newMapSource) {
showWarningDialog(); showClearTilesWarningDialog();
} else { } else {
applySelectedZooms(); applySelectedZooms();
} }
@ -164,7 +164,7 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
return R.string.shared_string_apply; return R.string.shared_string_apply;
} }
private void showWarningDialog() { private void showClearTilesWarningDialog() {
Context themedContext = UiUtilities.getThemedContext(getActivity(), nightMode); Context themedContext = UiUtilities.getThemedContext(getActivity(), nightMode);
AlertDialog.Builder dismissDialog = new AlertDialog.Builder(themedContext); AlertDialog.Builder dismissDialog = new AlertDialog.Builder(themedContext);
dismissDialog.setTitle(getString(R.string.osmand_parking_warning)); dismissDialog.setTitle(getString(R.string.osmand_parking_warning));