use class name of fragment for saving preferences

This commit is contained in:
Milos Kozak 2016-07-18 21:44:14 +02:00
parent 87dd8712b4
commit 4aad8c1310

View file

@ -778,8 +778,8 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
for (int type = 1; type < PluginBase.LAST; type++) { for (int type = 1; type < PluginBase.LAST; type++) {
for (PluginBase p : pluginList) { for (PluginBase p : pluginList) {
String settingEnabled = "ConfigBuilder_" + type + "_" + p.getName() + "_Enabled"; String settingEnabled = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Enabled";
String settingVisible = "ConfigBuilder_" + type + "_" + p.getName() + "_Visible"; String settingVisible = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Visible";
editor.putBoolean(settingEnabled, p.isEnabled(type)); editor.putBoolean(settingEnabled, p.isEnabled(type));
editor.putBoolean(settingVisible, p.isVisibleInTabs(type)); editor.putBoolean(settingVisible, p.isVisibleInTabs(type));
} }
@ -795,8 +795,8 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
for (int type = 1; type < PluginBase.LAST; type++) { for (int type = 1; type < PluginBase.LAST; type++) {
for (PluginBase p : pluginList) { for (PluginBase p : pluginList) {
String settingEnabled = "ConfigBuilder_" + type + "_" + p.getName() + "_Enabled"; String settingEnabled = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Enabled";
String settingVisible = "ConfigBuilder_" + type + "_" + p.getName() + "_Visible"; String settingVisible = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Visible";
if (SP.contains(settingEnabled)) if (SP.contains(settingEnabled))
p.setFragmentEnabled(type, SP.getBoolean(settingEnabled, true)); p.setFragmentEnabled(type, SP.getBoolean(settingEnabled, true));
if (SP.contains(settingVisible)) if (SP.contains(settingVisible))