This commit is contained in:
Milos Kozak 2016-09-09 11:05:07 +02:00
commit f48faccdd8
4 changed files with 17 additions and 11 deletions

View file

@ -150,12 +150,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
for (int type = 1; type < PluginBase.LAST; type++) {
for (PluginBase p : pluginList) {
try {
String settingEnabled = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Enabled";
String settingVisible = "ConfigBuilder_" + type + "_" + p.getClass().getSimpleName() + "_Visible";
if (SP.contains(settingEnabled))
p.setFragmentEnabled(type, SP.getBoolean(settingEnabled, true));
if (SP.contains(settingVisible))
p.setFragmentVisible(type, SP.getBoolean(settingVisible, true));
} catch (Exception e) {
e.printStackTrace();
}
}
}
verifySelectionInCategories();

View file

@ -589,12 +589,12 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
if (isTempBasalInProgress()) {
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
extended.put("TempBasalStart", DateUtil.toISOString(getTempBasal().timeStart));
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes());
extended.put("IsExtended", getTempBasal().isExtended);
}
extended.put("PumpIOB", getDanaRPump().iob);
extended.put("LastBolus", DateUtil.toISOString(getDanaRPump().lastBolusTime));
extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
pump.put("battery", battery);

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
@ -125,7 +126,8 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
final Double finalBasal = basalAbsolute;
final int finalDurationInMinutes = durationInMinutes;
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
final Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(this.getContext().getString(R.string.confirmation));
builder.setMessage(confirmMessage);
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@ -141,7 +143,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
result = pump.setTempBasalAbsolute(finalBasal, finalDurationInMinutes);
}
if (!result.success) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(getContext().getString(R.string.treatmentdeliveryerror));
builder.setMessage(result.comment);
builder.setPositiveButton(getContext().getString(R.string.ok), null);

View file

@ -40,7 +40,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
log.debug("KeepAlive received");
final DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
if (Config.DANAR && danaRPlugin.isEnabled(PluginBase.PUMP)) {
if (danaRPlugin != null && Config.DANAR && danaRPlugin.isEnabled(PluginBase.PUMP)) {
if (danaRPlugin.getDanaRPump().lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime() && !danaRPlugin.isConnected() && !danaRPlugin.isConnecting()) {
Thread t = new Thread(new Runnable() {
@Override