verify plugins after import
This commit is contained in:
parent
d793135339
commit
60d5567c91
|
@ -100,6 +100,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
if (L.isEnabled(L.CONFIGBUILDER))
|
if (L.isEnabled(L.CONFIGBUILDER))
|
||||||
log.debug("Storing settings from: " + from);
|
log.debug("Storing settings from: " + from);
|
||||||
|
|
||||||
|
verifySelectionInCategories();
|
||||||
|
|
||||||
for (PluginBase p : pluginList) {
|
for (PluginBase p : pluginList) {
|
||||||
PluginType type = p.getType();
|
PluginType type = p.getType();
|
||||||
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwayVisible)
|
if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwayVisible)
|
||||||
|
@ -113,7 +115,6 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verifySelectionInCategories();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +288,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
if (activeInsulin == null) {
|
if (activeInsulin == null) {
|
||||||
activeInsulin = InsulinOrefRapidActingPlugin.getPlugin();
|
activeInsulin = InsulinOrefRapidActingPlugin.getPlugin();
|
||||||
InsulinOrefRapidActingPlugin.getPlugin().setPluginEnabled(PluginType.INSULIN, true);
|
InsulinOrefRapidActingPlugin.getPlugin().setPluginEnabled(PluginType.INSULIN, true);
|
||||||
|
if (L.isEnabled(L.CONFIGBUILDER))
|
||||||
|
log.debug("Defaulting InsulinOrefRapidActingPlugin");
|
||||||
}
|
}
|
||||||
this.setFragmentVisiblities(((PluginBase) activeInsulin).getName(), pluginsInCategory, PluginType.INSULIN);
|
this.setFragmentVisiblities(((PluginBase) activeInsulin).getName(), pluginsInCategory, PluginType.INSULIN);
|
||||||
|
|
||||||
|
@ -296,6 +299,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
if (activeSensitivity == null) {
|
if (activeSensitivity == null) {
|
||||||
activeSensitivity = SensitivityOref0Plugin.getPlugin();
|
activeSensitivity = SensitivityOref0Plugin.getPlugin();
|
||||||
SensitivityOref0Plugin.getPlugin().setPluginEnabled(PluginType.SENSITIVITY, true);
|
SensitivityOref0Plugin.getPlugin().setPluginEnabled(PluginType.SENSITIVITY, true);
|
||||||
|
if (L.isEnabled(L.CONFIGBUILDER))
|
||||||
|
log.debug("Defaulting SensitivityOref0Plugin");
|
||||||
}
|
}
|
||||||
this.setFragmentVisiblities(((PluginBase) activeSensitivity).getName(), pluginsInCategory, PluginType.SENSITIVITY);
|
this.setFragmentVisiblities(((PluginBase) activeSensitivity).getName(), pluginsInCategory, PluginType.SENSITIVITY);
|
||||||
|
|
||||||
|
@ -311,6 +316,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
if (activePump == null) {
|
if (activePump == null) {
|
||||||
activePump = VirtualPumpPlugin.getPlugin();
|
activePump = VirtualPumpPlugin.getPlugin();
|
||||||
VirtualPumpPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, true);
|
VirtualPumpPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, true);
|
||||||
|
if (L.isEnabled(L.CONFIGBUILDER))
|
||||||
|
log.debug("Defaulting VirtualPumpPlugin");
|
||||||
}
|
}
|
||||||
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
|
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Map;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.utils.OKDialog;
|
import info.nightscout.utils.OKDialog;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
|
@ -79,8 +80,7 @@ public class ImportExportPrefs {
|
||||||
|
|
||||||
new AlertDialog.Builder(c)
|
new AlertDialog.Builder(c)
|
||||||
.setMessage(MainApp.gs(R.string.export_to) + " " + file + " ?")
|
.setMessage(MainApp.gs(R.string.export_to) + " " + file + " ?")
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
|
||||||
try {
|
try {
|
||||||
|
@ -99,7 +99,6 @@ public class ImportExportPrefs {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.show();
|
.show();
|
||||||
|
@ -112,8 +111,7 @@ public class ImportExportPrefs {
|
||||||
public static void importSharedPreferences(final Context context) {
|
public static void importSharedPreferences(final Context context) {
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setMessage(MainApp.gs(R.string.import_from) + " " + file + " ?")
|
.setMessage(MainApp.gs(R.string.import_from) + " " + file + " ?")
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
@ -136,9 +134,8 @@ public class ImportExportPrefs {
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
editor.commit();
|
editor.commit();
|
||||||
OKDialog.show(context, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), new Runnable() {
|
ConfigBuilderPlugin.getPlugin().storeSettings("importSharedPreferences"); // process potentially missing plugins
|
||||||
@Override
|
OKDialog.show(context, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), () -> {
|
||||||
public void run() {
|
|
||||||
log.debug("Exiting");
|
log.debug("Exiting");
|
||||||
MainApp.instance().stopKeepAliveService();
|
MainApp.instance().stopKeepAliveService();
|
||||||
MainApp.bus().post(new EventAppExit());
|
MainApp.bus().post(new EventAppExit());
|
||||||
|
@ -148,7 +145,6 @@ public class ImportExportPrefs {
|
||||||
}
|
}
|
||||||
System.runFinalization();
|
System.runFinalization();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.filenotfound) + " " + file);
|
ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.filenotfound) + " " + file);
|
||||||
|
@ -156,7 +152,6 @@ public class ImportExportPrefs {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.show();
|
.show();
|
||||||
|
|
Loading…
Reference in a new issue