From 67642d9286ef9b7475889de70467c8bff62bb78a Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 21 Dec 2020 17:57:02 +0200 Subject: [PATCH] Remove unnecessary alert dialog --- .../fragments/ConfigureMenuItemsFragment.java | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java index dee6cdb541..9b55f53128 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java @@ -38,7 +38,6 @@ import net.osmand.plus.dialogs.ConfigureMapMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet; import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet; import net.osmand.plus.settings.fragments.ConfigureMenuRootFragment.ScreenType; import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.MenuItemsAdapterListener; @@ -451,7 +450,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment new View.OnClickListener() { @Override public void onClick(View view) { - showResetDialog(); + resetToDefault(); } }))); items.add(new RearrangeMenuAdapterItem(BUTTON, new RearrangeMenuItemsAdapter.ButtonItem( @@ -497,29 +496,18 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment dismissDialog.show(); } - public void showResetDialog() { - Context themedContext = UiUtilities.getThemedContext(getActivity(), nightMode); - AlertDialog.Builder dismissDialog = new AlertDialog.Builder(themedContext); - dismissDialog.setTitle(getString(R.string.shared_string_reset)); - dismissDialog.setMessage(getString(R.string.reset_deafult_order)); - dismissDialog.setNegativeButton(R.string.shared_string_cancel, null); - dismissDialog.setPositiveButton(R.string.shared_string_reset, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - hiddenMenuItems.clear(); - menuItemsOrder.clear(); - wasReset = true; - isChanged = true; - if (screenType == ScreenType.CONTEXT_MENU_ACTIONS) { - mainActionItems.clear(); - } - instantiateContextMenuAdapter(); - initSavedIds(appMode, true); - initMainActionsIds(appMode, true); - rearrangeAdapter.updateItems(getAdapterItems()); - } - }); - dismissDialog.show(); + public void resetToDefault() { + hiddenMenuItems.clear(); + menuItemsOrder.clear(); + wasReset = true; + isChanged = true; + if (screenType == ScreenType.CONTEXT_MENU_ACTIONS) { + mainActionItems.clear(); + } + instantiateContextMenuAdapter(); + initSavedIds(appMode, true); + initMainActionsIds(appMode, true); + rearrangeAdapter.updateItems(getAdapterItems()); } private void dismissFragment() {