Show toast after prefs restored

This commit is contained in:
Vitaliy 2020-01-28 13:23:55 +02:00
parent 285749921b
commit 746932386c
5 changed files with 12 additions and 4 deletions

View file

@ -11,6 +11,8 @@
Thx - Hardy
-->
<string name="plugin_prefs_reset_successful">All plugin settings restored to default state.</string>
<string name="profile_prefs_reset_successful">All profile settings restored to default state.</string>
<string name="ltr_or_rtl_combine_via_slash">%1$s/%2$s</string>
<string name="sunset_at">Sunset at %1$s</string>
<string name="sunrise_at">Sunrise at %1$s</string>

View file

@ -189,6 +189,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
app.getSettings().resetProfilePreferences(appMode, plugin.getPreferences());
app.showToastMessage(R.string.plugin_prefs_reset_successful);
updateAllSettings();
}
}

View file

@ -484,6 +484,7 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
if (plugin != null) {
app.getSettings().resetProfilePreferences(appMode, plugin.getPreferences());
app.showToastMessage(R.string.plugin_prefs_reset_successful);
updateAllSettings();
}
}

View file

@ -299,6 +299,7 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements
OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
app.getSettings().resetProfilePreferences(appMode, plugin.getPreferences());
app.showToastMessage(R.string.plugin_prefs_reset_successful);
updateAllSettings();
}
}

View file

@ -165,12 +165,15 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
@Override
public void resetAppModePrefs(ApplicationMode appMode) {
if (appMode != null) {
app.getSettings().resetPreferencesForProfile(appMode);
boolean prefsRestored = app.getSettings().resetPreferencesForProfile(appMode);
if (prefsRestored) {
app.showToastMessage(R.string.profile_prefs_reset_successful);
ApplicationMode.initModeParams(app, appMode);
updateToolbar();
updateAllSettings();
}
}
}
private RecyclerView.ItemDecoration createDividerItemDecoration() {
final Drawable dividerLight = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_light));