Singleton & Crashlytics logging part 2
This commit is contained in:
parent
0e763724f6
commit
d6fb912ff9
36 changed files with 388 additions and 351 deletions
|
@ -42,13 +42,12 @@ import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugi
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.receivers.AckAlarmReceiver;
|
import info.nightscout.androidaps.plugins.NSClientInternal.receivers.AckAlarmReceiver;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
|
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
|
||||||
import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPercentageProfileFragment;
|
import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPercentageProfileFragment;
|
||||||
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfileFragment;
|
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfileFragment;
|
||||||
import info.nightscout.androidaps.plugins.ProfileNS.NSProfileFragment;
|
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfileFragment;
|
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.services.DanaRExecutionService;
|
import info.nightscout.androidaps.plugins.PumpDanaR.services.DanaRExecutionService;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||||
|
@ -60,12 +59,12 @@ import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin;
|
import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorFragment;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Wear.WearFragment;
|
import info.nightscout.androidaps.plugins.Wear.WearFragment;
|
||||||
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
||||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||||
|
@ -131,12 +130,12 @@ public class MainApp extends Application {
|
||||||
if (Config.LOOPENABLED) pluginsList.add(LoopPlugin.getPlugin());
|
if (Config.LOOPENABLED) pluginsList.add(LoopPlugin.getPlugin());
|
||||||
if (Config.OPENAPSENABLED) pluginsList.add(OpenAPSMAPlugin.getPlugin());
|
if (Config.OPENAPSENABLED) pluginsList.add(OpenAPSMAPlugin.getPlugin());
|
||||||
if (Config.OPENAPSENABLED) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
|
if (Config.OPENAPSENABLED) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
|
||||||
pluginsList.add(NSProfileFragment.getPlugin());
|
pluginsList.add(NSProfilePlugin.getPlugin());
|
||||||
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfileFragment.getPlugin());
|
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin());
|
||||||
if (Config.OTHERPROFILES) pluginsList.add(LocalProfileFragment.getPlugin());
|
if (Config.OTHERPROFILES) pluginsList.add(LocalProfileFragment.getPlugin());
|
||||||
if (Config.OTHERPROFILES)
|
if (Config.OTHERPROFILES)
|
||||||
pluginsList.add(CircadianPercentageProfileFragment.getPlugin());
|
pluginsList.add(CircadianPercentageProfileFragment.getPlugin());
|
||||||
pluginsList.add(TreatmentsFragment.getPlugin());
|
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
if (!Config.NSCLIENT)
|
||||||
|
@ -146,7 +145,7 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
if (!Config.NSCLIENT)
|
||||||
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
||||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.getPlugin());
|
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||||
|
|
||||||
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
|
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
|
||||||
pluginsList.add(StatuslinePlugin.getPlugin(this));
|
pluginsList.add(StatuslinePlugin.getPlugin(this));
|
||||||
|
|
|
@ -10,8 +10,8 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
public class ActionsPlugin implements PluginBase {
|
public class ActionsPlugin implements PluginBase {
|
||||||
|
|
||||||
boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
public class CareportalPlugin implements PluginBase {
|
public class CareportalPlugin implements PluginBase {
|
||||||
|
|
||||||
boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
|
|
@ -14,8 +14,8 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
public class InsulinFastactingPlugin implements PluginBase, InsulinInterface {
|
public class InsulinFastactingPlugin implements PluginBase, InsulinInterface {
|
||||||
|
|
||||||
private static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private static InsulinFastactingPlugin plugin = null;
|
private static InsulinFastactingPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInterface {
|
public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInterface {
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private static InsulinFastactingProlongedPlugin plugin = null;
|
private static InsulinFastactingProlongedPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin {
|
public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin {
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private static InsulinOrefFreePeakPlugin plugin = null;
|
private static InsulinOrefFreePeakPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin {
|
public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private static InsulinOrefRapidActingPlugin plugin = null;
|
private static InsulinOrefRapidActingPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
private static InsulinOrefUltraRapidActingPlugin plugin = null;
|
private static InsulinOrefUltraRapidActingPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import info.nightscout.utils.DecimalFormatter;
|
||||||
public class PersistentNotificationPlugin implements PluginBase {
|
public class PersistentNotificationPlugin implements PluginBase {
|
||||||
|
|
||||||
private static final int ONGOING_NOTIFICATION_ID = 4711;
|
private static final int ONGOING_NOTIFICATION_ID = 4711;
|
||||||
static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
|
|
||||||
public PersistentNotificationPlugin(Context ctx) {
|
public PersistentNotificationPlugin(Context ctx) {
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
||||||
public static final String SETTINGS_PREFIX = "CircadianPercentageProfile";
|
public static final String SETTINGS_PREFIX = "CircadianPercentageProfile";
|
||||||
private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfilePlugin.class);
|
private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfilePlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
private static ProfileStore convertedProfile = null;
|
private static ProfileStore convertedProfile = null;
|
||||||
private static String convertedProfileName = null;
|
private static String convertedProfileName = null;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import info.nightscout.utils.SP;
|
||||||
public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class);
|
private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
private static ProfileStore convertedProfile = null;
|
private static ProfileStore convertedProfile = null;
|
||||||
private static String convertedProfileName = null;
|
private static String convertedProfileName = null;
|
||||||
|
|
|
@ -2,12 +2,12 @@ package info.nightscout.androidaps.plugins.ProfileNS;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -18,12 +18,6 @@ import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateG
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
||||||
public class NSProfileFragment extends SubscriberFragment {
|
public class NSProfileFragment extends SubscriberFragment {
|
||||||
private static NSProfilePlugin nsProfilePlugin = new NSProfilePlugin();
|
|
||||||
|
|
||||||
public static NSProfilePlugin getPlugin() {
|
|
||||||
return nsProfilePlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextView noProfile;
|
private TextView noProfile;
|
||||||
private TextView units;
|
private TextView units;
|
||||||
private TextView dia;
|
private TextView dia;
|
||||||
|
@ -36,6 +30,7 @@ public class NSProfileFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View layout = inflater.inflate(R.layout.nsprofileviewer_fragment, container, false);
|
View layout = inflater.inflate(R.layout.nsprofileviewer_fragment, container, false);
|
||||||
|
|
||||||
noProfile = (TextView) layout.findViewById(R.id.profileview_noprofile);
|
noProfile = (TextView) layout.findViewById(R.id.profileview_noprofile);
|
||||||
|
@ -49,6 +44,11 @@ public class NSProfileFragment extends SubscriberFragment {
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return layout;
|
return layout;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -29,17 +29,25 @@ import info.nightscout.utils.SP;
|
||||||
public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(NSProfilePlugin.class);
|
private static Logger log = LoggerFactory.getLogger(NSProfilePlugin.class);
|
||||||
|
|
||||||
|
private static NSProfilePlugin nsProfilePlugin;
|
||||||
|
|
||||||
|
public static NSProfilePlugin getPlugin() {
|
||||||
|
if (nsProfilePlugin == null)
|
||||||
|
nsProfilePlugin = new NSProfilePlugin();
|
||||||
|
return nsProfilePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFragmentClass() {
|
public String getFragmentClass() {
|
||||||
return NSProfileFragment.class.getName();
|
return NSProfileFragment.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
static boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
static ProfileStore profile = null;
|
private static ProfileStore profile = null;
|
||||||
|
|
||||||
public NSProfilePlugin() {
|
private NSProfilePlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
loadNSProfile();
|
loadNSProfile();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.ProfileSimple;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -13,6 +12,7 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -31,12 +31,6 @@ import info.nightscout.utils.SafeParse;
|
||||||
public class SimpleProfileFragment extends SubscriberFragment {
|
public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class);
|
private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class);
|
||||||
|
|
||||||
private static SimpleProfilePlugin simpleProfilePlugin = new SimpleProfilePlugin();
|
|
||||||
|
|
||||||
public static SimpleProfilePlugin getPlugin() {
|
|
||||||
return simpleProfilePlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
EditText diaView;
|
EditText diaView;
|
||||||
RadioButton mgdlView;
|
RadioButton mgdlView;
|
||||||
RadioButton mmolView;
|
RadioButton mmolView;
|
||||||
|
@ -50,6 +44,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View layout = inflater.inflate(R.layout.simpleprofile_fragment, container, false);
|
View layout = inflater.inflate(R.layout.simpleprofile_fragment, container, false);
|
||||||
diaView = (EditText) layout.findViewById(R.id.simpleprofile_dia);
|
diaView = (EditText) layout.findViewById(R.id.simpleprofile_dia);
|
||||||
mgdlView = (RadioButton) layout.findViewById(R.id.simpleprofile_mgdl);
|
mgdlView = (RadioButton) layout.findViewById(R.id.simpleprofile_mgdl);
|
||||||
|
@ -69,31 +64,31 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
|
||||||
mgdlView.setChecked(simpleProfilePlugin.mgdl);
|
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
|
||||||
mmolView.setChecked(simpleProfilePlugin.mmol);
|
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
|
||||||
diaView.setText(simpleProfilePlugin.dia.toString());
|
diaView.setText(SimpleProfilePlugin.getPlugin().dia.toString());
|
||||||
icView.setText(simpleProfilePlugin.ic.toString());
|
icView.setText(SimpleProfilePlugin.getPlugin().ic.toString());
|
||||||
isfView.setText(simpleProfilePlugin.isf.toString());
|
isfView.setText(SimpleProfilePlugin.getPlugin().isf.toString());
|
||||||
basalView.setText(simpleProfilePlugin.basal.toString());
|
basalView.setText(SimpleProfilePlugin.getPlugin().basal.toString());
|
||||||
targetlowView.setText(simpleProfilePlugin.targetLow.toString());
|
targetlowView.setText(SimpleProfilePlugin.getPlugin().targetLow.toString());
|
||||||
targethighView.setText(simpleProfilePlugin.targetHigh.toString());
|
targethighView.setText(SimpleProfilePlugin.getPlugin().targetHigh.toString());
|
||||||
|
|
||||||
mgdlView.setOnClickListener(new View.OnClickListener() {
|
mgdlView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
simpleProfilePlugin.mgdl = mgdlView.isChecked();
|
SimpleProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
|
||||||
simpleProfilePlugin.mmol = !simpleProfilePlugin.mgdl;
|
SimpleProfilePlugin.getPlugin().mmol = !SimpleProfilePlugin.getPlugin().mgdl;
|
||||||
mmolView.setChecked(simpleProfilePlugin.mmol);
|
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
|
||||||
simpleProfilePlugin.storeSettings();
|
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mmolView.setOnClickListener(new View.OnClickListener() {
|
mmolView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
simpleProfilePlugin.mmol = mmolView.isChecked();
|
SimpleProfilePlugin.getPlugin().mmol = mmolView.isChecked();
|
||||||
simpleProfilePlugin.mgdl = !simpleProfilePlugin.mmol;
|
SimpleProfilePlugin.getPlugin().mgdl = !SimpleProfilePlugin.getPlugin().mmol;
|
||||||
mgdlView.setChecked(simpleProfilePlugin.mgdl);
|
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
|
||||||
simpleProfilePlugin.storeSettings();
|
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -122,13 +117,13 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start,
|
public void onTextChanged(CharSequence s, int start,
|
||||||
int before, int count) {
|
int before, int count) {
|
||||||
simpleProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString());
|
SimpleProfilePlugin.getPlugin().dia = SafeParse.stringToDouble(diaView.getText().toString());
|
||||||
simpleProfilePlugin.ic = SafeParse.stringToDouble(icView.getText().toString());
|
SimpleProfilePlugin.getPlugin().ic = SafeParse.stringToDouble(icView.getText().toString());
|
||||||
simpleProfilePlugin.isf = SafeParse.stringToDouble(isfView.getText().toString());
|
SimpleProfilePlugin.getPlugin().isf = SafeParse.stringToDouble(isfView.getText().toString());
|
||||||
simpleProfilePlugin.basal = SafeParse.stringToDouble(basalView.getText().toString());
|
SimpleProfilePlugin.getPlugin().basal = SafeParse.stringToDouble(basalView.getText().toString());
|
||||||
simpleProfilePlugin.targetLow = SafeParse.stringToDouble(targetlowView.getText().toString());
|
SimpleProfilePlugin.getPlugin().targetLow = SafeParse.stringToDouble(targetlowView.getText().toString());
|
||||||
simpleProfilePlugin.targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
|
SimpleProfilePlugin.getPlugin().targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
|
||||||
simpleProfilePlugin.storeSettings();
|
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,6 +137,11 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -24,8 +24,16 @@ import info.nightscout.utils.SP;
|
||||||
public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(SimpleProfilePlugin.class);
|
private static Logger log = LoggerFactory.getLogger(SimpleProfilePlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private static SimpleProfilePlugin simpleProfilePlugin;
|
||||||
private static boolean fragmentVisible = true;
|
|
||||||
|
public static SimpleProfilePlugin getPlugin() {
|
||||||
|
if (simpleProfilePlugin == null)
|
||||||
|
simpleProfilePlugin = new SimpleProfilePlugin();
|
||||||
|
return simpleProfilePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean fragmentEnabled = false;
|
||||||
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
private static ProfileStore convertedProfile = null;
|
private static ProfileStore convertedProfile = null;
|
||||||
|
|
||||||
|
@ -38,7 +46,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
Double targetLow;
|
Double targetLow;
|
||||||
Double targetHigh;
|
Double targetHigh;
|
||||||
|
|
||||||
public SimpleProfilePlugin() {
|
private SimpleProfilePlugin() {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +125,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
editor.putString("SimpleProfile" + "targetlow", targetLow.toString());
|
editor.putString("SimpleProfile" + "targetlow", targetLow.toString());
|
||||||
editor.putString("SimpleProfile" + "targethigh", targetHigh.toString());
|
editor.putString("SimpleProfile" + "targethigh", targetHigh.toString());
|
||||||
|
|
||||||
editor.commit();
|
editor.apply();
|
||||||
createConvertedProfile();
|
createConvertedProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +182,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
"created_at": "2016-06-16T08:34:41.256Z"
|
"created_at": "2016-06-16T08:34:41.256Z"
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void createConvertedProfile() {
|
private void createConvertedProfile() {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
JSONObject store = new JSONObject();
|
JSONObject store = new JSONObject();
|
||||||
JSONObject profile = new JSONObject();
|
JSONObject profile = new JSONObject();
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -15,13 +14,12 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
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.EventExtendedBolusChange;
|
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||||
|
@ -89,6 +87,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View view = inflater.inflate(R.layout.danar_fragment, container, false);
|
View view = inflater.inflate(R.layout.danar_fragment, container, false);
|
||||||
btConnectionView = (TextView) view.findViewById(R.id.danar_btconnection);
|
btConnectionView = (TextView) view.findViewById(R.id.danar_btconnection);
|
||||||
lastConnectionView = (TextView) view.findViewById(R.id.danar_lastconnection);
|
lastConnectionView = (TextView) view.findViewById(R.id.danar_lastconnection);
|
||||||
|
@ -146,6 +145,11 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -59,11 +59,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
return DanaRFragment.class.getName();
|
return DanaRFragment.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean fragmentPumpEnabled = false;
|
private static boolean fragmentPumpEnabled = false;
|
||||||
static boolean fragmentProfileEnabled = false;
|
private static boolean fragmentProfileEnabled = false;
|
||||||
static boolean fragmentPumpVisible = true;
|
private static boolean fragmentPumpVisible = true;
|
||||||
|
|
||||||
public static DanaRExecutionService sExecutionService;
|
private static DanaRExecutionService sExecutionService;
|
||||||
|
|
||||||
|
|
||||||
private static DanaRPump pump = DanaRPump.getInstance();
|
private static DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
@ -199,22 +199,22 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PluginBase.PROFILE)
|
if (type == PluginBase.PROFILE)
|
||||||
this.fragmentProfileEnabled = fragmentEnabled;
|
fragmentProfileEnabled = fragmentEnabled;
|
||||||
else if (type == PluginBase.PUMP)
|
else if (type == PluginBase.PUMP)
|
||||||
this.fragmentPumpEnabled = fragmentEnabled;
|
fragmentPumpEnabled = fragmentEnabled;
|
||||||
// if pump profile was enabled need to switch to another too
|
// if pump profile was enabled need to switch to another too
|
||||||
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
if (type == PluginBase.PUMP && !fragmentEnabled && fragmentProfileEnabled) {
|
||||||
setFragmentEnabled(PluginBase.PROFILE, false);
|
setFragmentEnabled(PluginBase.PROFILE, false);
|
||||||
setFragmentVisible(PluginBase.PROFILE, false);
|
setFragmentVisible(PluginBase.PROFILE, false);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentEnabled(PluginBase.PROFILE, true);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentVisible(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||||
if (type == PluginBase.PUMP)
|
if (type == PluginBase.PUMP)
|
||||||
this.fragmentPumpVisible = fragmentVisible;
|
fragmentPumpVisible = fragmentVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,15 +61,15 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
return DanaRFragment.class.getName();
|
return DanaRFragment.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean fragmentPumpEnabled = false;
|
private boolean fragmentPumpEnabled = false;
|
||||||
static boolean fragmentProfileEnabled = false;
|
private boolean fragmentProfileEnabled = false;
|
||||||
static boolean fragmentPumpVisible = true;
|
private boolean fragmentPumpVisible = true;
|
||||||
|
|
||||||
public static DanaRKoreanExecutionService sExecutionService;
|
private static DanaRKoreanExecutionService sExecutionService;
|
||||||
|
|
||||||
|
|
||||||
private static DanaRPump pump = DanaRPump.getInstance();
|
private DanaRPump pump = DanaRPump.getInstance();
|
||||||
private static boolean useExtendedBoluses = false;
|
private boolean useExtendedBoluses = false;
|
||||||
|
|
||||||
private static DanaRKoreanPlugin plugin = null;
|
private static DanaRKoreanPlugin plugin = null;
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
||||||
setFragmentEnabled(PluginBase.PROFILE, false);
|
setFragmentEnabled(PluginBase.PROFILE, false);
|
||||||
setFragmentVisible(PluginBase.PROFILE, false);
|
setFragmentVisible(PluginBase.PROFILE, false);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentEnabled(PluginBase.PROFILE, true);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentVisible(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,11 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
return DanaRFragment.class.getName();
|
return DanaRFragment.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean fragmentPumpEnabled = false;
|
private boolean fragmentPumpEnabled = false;
|
||||||
static boolean fragmentProfileEnabled = false;
|
private boolean fragmentProfileEnabled = false;
|
||||||
static boolean fragmentPumpVisible = false;
|
private boolean fragmentPumpVisible = false;
|
||||||
|
|
||||||
public static DanaRv2ExecutionService sExecutionService;
|
private static DanaRv2ExecutionService sExecutionService;
|
||||||
|
|
||||||
|
|
||||||
private static DanaRv2Plugin plugin = null;
|
private static DanaRv2Plugin plugin = null;
|
||||||
|
@ -77,9 +77,9 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
|
|
||||||
private static DanaRPump pump = DanaRPump.getInstance();
|
private static DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
public static PumpDescription pumpDescription = new PumpDescription();
|
private static PumpDescription pumpDescription = new PumpDescription();
|
||||||
|
|
||||||
public DanaRv2Plugin() {
|
private DanaRv2Plugin() {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
Context context = MainApp.instance().getApplicationContext();
|
||||||
Intent intent = new Intent(context, DanaRv2ExecutionService.class);
|
Intent intent = new Intent(context, DanaRv2ExecutionService.class);
|
||||||
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
@ -192,8 +192,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
|
||||||
setFragmentEnabled(PluginBase.PROFILE, false);
|
setFragmentEnabled(PluginBase.PROFILE, false);
|
||||||
setFragmentVisible(PluginBase.PROFILE, false);
|
setFragmentVisible(PluginBase.PROFILE, false);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentEnabled(PluginBase.PROFILE, true);
|
||||||
MainApp.getSpecificPlugin(NSProfilePlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
|
NSProfilePlugin.getPlugin().setFragmentVisible(PluginBase.PROFILE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ import info.nightscout.utils.DateUtil;
|
||||||
public class MDIPlugin implements PluginBase, PumpInterface {
|
public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(MDIPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(MDIPlugin.class);
|
||||||
|
|
||||||
boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
PumpDescription pumpDescription = new PumpDescription();
|
private PumpDescription pumpDescription = new PumpDescription();
|
||||||
|
|
||||||
static MDIPlugin plugin = null;
|
private static MDIPlugin plugin = null;
|
||||||
|
|
||||||
public static MDIPlugin getPlugin() {
|
public static MDIPlugin getPlugin() {
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
|
@ -38,7 +38,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MDIPlugin() {
|
private MDIPlugin() {
|
||||||
pumpDescription.isBolusCapable = true;
|
pumpDescription.isBolusCapable = true;
|
||||||
pumpDescription.bolusStep = 0.5d;
|
pumpDescription.bolusStep = 0.5d;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -50,6 +51,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View view = inflater.inflate(R.layout.vitualpump_fragment, container, false);
|
View view = inflater.inflate(R.layout.vitualpump_fragment, container, false);
|
||||||
basaBasalRateView = (TextView) view.findViewById(R.id.virtualpump_basabasalrate);
|
basaBasalRateView = (TextView) view.findViewById(R.id.virtualpump_basabasalrate);
|
||||||
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
|
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
|
||||||
|
@ -58,6 +60,11 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
||||||
reservoirView = (TextView) view.findViewById(R.id.virtualpump_reservoir);
|
reservoirView = (TextView) view.findViewById(R.id.virtualpump_reservoir);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -39,19 +39,19 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
public static Double defaultBasalValue = 0.2d;
|
public static Double defaultBasalValue = 0.2d;
|
||||||
|
|
||||||
public static Integer batteryPercent = 50;
|
static Integer batteryPercent = 50;
|
||||||
public static Integer reservoirInUnits = 50;
|
static Integer reservoirInUnits = 50;
|
||||||
|
|
||||||
Date lastDataTime = new Date(0);
|
private Date lastDataTime = new Date(0);
|
||||||
|
|
||||||
boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
private static boolean fromNSAreCommingFakedExtendedBoluses = false;
|
private static boolean fromNSAreCommingFakedExtendedBoluses = false;
|
||||||
|
|
||||||
PumpDescription pumpDescription = new PumpDescription();
|
private PumpDescription pumpDescription = new PumpDescription();
|
||||||
|
|
||||||
static void loadFakingStatus() {
|
private static void loadFakingStatus() {
|
||||||
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean("fromNSAreCommingFakedExtendedBoluses", false);
|
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean("fromNSAreCommingFakedExtendedBoluses", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
return fromNSAreCommingFakedExtendedBoluses;
|
return fromNSAreCommingFakedExtendedBoluses;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VirtualPumpPlugin instance = null;
|
private static VirtualPumpPlugin instance = null;
|
||||||
public static VirtualPumpPlugin getInstance() {
|
public static VirtualPumpPlugin getInstance() {
|
||||||
loadFakingStatus();
|
loadFakingStatus();
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
|
@ -72,7 +72,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VirtualPumpPlugin() {
|
private VirtualPumpPlugin() {
|
||||||
pumpDescription.isBolusCapable = true;
|
pumpDescription.isBolusCapable = true;
|
||||||
pumpDescription.bolusStep = 0.1d;
|
pumpDescription.bolusStep = 0.1d;
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ import info.nightscout.utils.SafeParse;
|
||||||
public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
private static Logger log = LoggerFactory.getLogger(SensitivityAAPSPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(SensitivityAAPSPlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
static SensitivityAAPSPlugin plugin = null;
|
static SensitivityAAPSPlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ import info.nightscout.utils.SafeParse;
|
||||||
public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface {
|
public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(IobCobCalculatorPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(IobCobCalculatorPlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
static SensitivityOref0Plugin plugin = null;
|
static SensitivityOref0Plugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ import info.nightscout.utils.SafeParse;
|
||||||
public class SensitivityWeightedAveragePlugin implements PluginBase, SensitivityInterface {
|
public class SensitivityWeightedAveragePlugin implements PluginBase, SensitivityInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(SensitivityWeightedAveragePlugin.class);
|
private static Logger log = LoggerFactory.getLogger(SensitivityWeightedAveragePlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private static boolean fragmentVisible = false;
|
private boolean fragmentVisible = false;
|
||||||
|
|
||||||
static SensitivityWeightedAveragePlugin plugin = null;
|
static SensitivityWeightedAveragePlugin plugin = null;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -18,7 +19,6 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
||||||
|
@ -30,16 +30,6 @@ import info.nightscout.utils.DateUtil;
|
||||||
public class SmsCommunicatorFragment extends SubscriberFragment {
|
public class SmsCommunicatorFragment extends SubscriberFragment {
|
||||||
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorFragment.class);
|
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorFragment.class);
|
||||||
|
|
||||||
private static SmsCommunicatorPlugin smsCommunicatorPlugin;
|
|
||||||
|
|
||||||
public static SmsCommunicatorPlugin getPlugin() {
|
|
||||||
|
|
||||||
if(smsCommunicatorPlugin==null){
|
|
||||||
smsCommunicatorPlugin = new SmsCommunicatorPlugin();
|
|
||||||
}
|
|
||||||
return smsCommunicatorPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView logView;
|
TextView logView;
|
||||||
|
|
||||||
public SmsCommunicatorFragment() {
|
public SmsCommunicatorFragment() {
|
||||||
|
@ -49,12 +39,18 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View view = inflater.inflate(R.layout.smscommunicator_fragment, container, false);
|
View view = inflater.inflate(R.layout.smscommunicator_fragment, container, false);
|
||||||
|
|
||||||
logView = (TextView) view.findViewById(R.id.smscommunicator_log);
|
logView = (TextView) view.findViewById(R.id.smscommunicator_log);
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -75,14 +71,14 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
|
||||||
return (int) (object1.date.getTime() - object2.date.getTime());
|
return (int) (object1.date.getTime() - object2.date.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(getPlugin().messages, new CustomComparator());
|
Collections.sort(SmsCommunicatorPlugin.getPlugin().messages, new CustomComparator());
|
||||||
int messagesToShow = 40;
|
int messagesToShow = 40;
|
||||||
|
|
||||||
int start = Math.max(0, getPlugin().messages.size() - messagesToShow);
|
int start = Math.max(0, SmsCommunicatorPlugin.getPlugin().messages.size() - messagesToShow);
|
||||||
|
|
||||||
String logText = "";
|
String logText = "";
|
||||||
for (int x = start; x < getPlugin().messages.size(); x++) {
|
for (int x = start; x < SmsCommunicatorPlugin.getPlugin().messages.size(); x++) {
|
||||||
SmsCommunicatorPlugin.Sms sms = getPlugin().messages.get(x);
|
SmsCommunicatorPlugin.Sms sms = SmsCommunicatorPlugin.getPlugin().messages.get(x);
|
||||||
if (sms.received) {
|
if (sms.received) {
|
||||||
logText += DateUtil.timeString(sms.date) + " <<< " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
logText += DateUtil.timeString(sms.date) + " <<< " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
||||||
} else if (sms.sent) {
|
} else if (sms.sent) {
|
||||||
|
|
|
@ -53,12 +53,22 @@ import info.nightscout.utils.XdripCalibrations;
|
||||||
public class SmsCommunicatorPlugin implements PluginBase {
|
public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorPlugin.class);
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private static SmsCommunicatorPlugin smsCommunicatorPlugin;
|
||||||
private static boolean fragmentVisible = true;
|
|
||||||
|
public static SmsCommunicatorPlugin getPlugin() {
|
||||||
|
|
||||||
|
if (smsCommunicatorPlugin == null) {
|
||||||
|
smsCommunicatorPlugin = new SmsCommunicatorPlugin();
|
||||||
|
}
|
||||||
|
return smsCommunicatorPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean fragmentEnabled = false;
|
||||||
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
private final long CONFIRM_TIMEOUT = 5 * 60 * 1000L;
|
private final long CONFIRM_TIMEOUT = 5 * 60 * 1000L;
|
||||||
|
|
||||||
private List<String> allowedNumbers = new ArrayList<String>();
|
private List<String> allowedNumbers = new ArrayList<>();
|
||||||
|
|
||||||
class Sms {
|
class Sms {
|
||||||
String phoneNumber;
|
String phoneNumber;
|
||||||
|
@ -110,7 +120,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
|
|
||||||
ArrayList<Sms> messages = new ArrayList<>();
|
ArrayList<Sms> messages = new ArrayList<>();
|
||||||
|
|
||||||
public SmsCommunicatorPlugin() {
|
private SmsCommunicatorPlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
processSettings(null);
|
processSettings(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
||||||
boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
|
|
||||||
static SourceGlimpPlugin plugin = null;
|
private static SourceGlimpPlugin plugin = null;
|
||||||
|
|
||||||
public static SourceGlimpPlugin getPlugin() {
|
public static SourceGlimpPlugin getPlugin() {
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
|
|
|
@ -9,9 +9,9 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
||||||
boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
|
|
||||||
static SourceMM640gPlugin plugin = null;
|
private static SourceMM640gPlugin plugin = null;
|
||||||
|
|
||||||
public static SourceMM640gPlugin getPlugin() {
|
public static SourceMM640gPlugin getPlugin() {
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
|
|
|
@ -10,9 +10,9 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
*/
|
*/
|
||||||
public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
||||||
boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
|
|
||||||
static SourceNSClientPlugin plugin = null;
|
private static SourceNSClientPlugin plugin = null;
|
||||||
|
|
||||||
public static SourceNSClientPlugin getPlugin() {
|
public static SourceNSClientPlugin getPlugin() {
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
*/
|
*/
|
||||||
public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
||||||
|
|
||||||
static SourceXdripPlugin plugin = null;
|
private static SourceXdripPlugin plugin = null;
|
||||||
|
|
||||||
public static SourceXdripPlugin getPlugin() {
|
public static SourceXdripPlugin getPlugin() {
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
|
@ -23,7 +23,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.androidaps.plugins.Treatments;
|
package info.nightscout.androidaps.plugins.Treatments;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
@ -9,6 +8,8 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -23,12 +24,6 @@ import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTempora
|
||||||
public class TreatmentsFragment extends Fragment implements View.OnClickListener {
|
public class TreatmentsFragment extends Fragment implements View.OnClickListener {
|
||||||
private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class);
|
private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class);
|
||||||
|
|
||||||
private static TreatmentsPlugin treatmentsPlugin = new TreatmentsPlugin();
|
|
||||||
|
|
||||||
public static TreatmentsPlugin getPlugin() {
|
|
||||||
return treatmentsPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView treatmentsTab;
|
TextView treatmentsTab;
|
||||||
TextView extendedBolusesTab;
|
TextView extendedBolusesTab;
|
||||||
TextView tempBasalsTab;
|
TextView tempBasalsTab;
|
||||||
|
@ -38,6 +33,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
try {
|
||||||
View view = inflater.inflate(R.layout.treatments_fragment, container, false);
|
View view = inflater.inflate(R.layout.treatments_fragment, container, false);
|
||||||
|
|
||||||
treatmentsTab = (TextView) view.findViewById(R.id.treatments_treatments);
|
treatmentsTab = (TextView) view.findViewById(R.id.treatments_treatments);
|
||||||
|
@ -55,6 +51,12 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
setBackgroundColorOnSelected(treatmentsTab);
|
setBackgroundColorOnSelected(treatmentsTab);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Crashlytics.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,17 +45,25 @@ import info.nightscout.utils.SP;
|
||||||
public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
private static Logger log = LoggerFactory.getLogger(TreatmentsPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(TreatmentsPlugin.class);
|
||||||
|
|
||||||
public static IobTotal lastTreatmentCalculation;
|
private static TreatmentsPlugin treatmentsPlugin;
|
||||||
public static IobTotal lastTempBasalsCalculation;
|
|
||||||
|
public static TreatmentsPlugin getPlugin() {
|
||||||
|
if (treatmentsPlugin == null)
|
||||||
|
treatmentsPlugin = new TreatmentsPlugin();
|
||||||
|
return treatmentsPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IobTotal lastTreatmentCalculation;
|
||||||
|
private IobTotal lastTempBasalsCalculation;
|
||||||
|
|
||||||
public static List<Treatment> treatments;
|
public static List<Treatment> treatments;
|
||||||
private static Intervals<TemporaryBasal> tempBasals = new NonOverlappingIntervals<TemporaryBasal>();
|
private static Intervals<TemporaryBasal> tempBasals = new NonOverlappingIntervals<>();
|
||||||
private static Intervals<ExtendedBolus> extendedBoluses = new NonOverlappingIntervals<ExtendedBolus>();
|
private static Intervals<ExtendedBolus> extendedBoluses = new NonOverlappingIntervals<>();
|
||||||
private static Intervals<TempTarget> tempTargets = new OverlappingIntervals<TempTarget>();
|
private static Intervals<TempTarget> tempTargets = new OverlappingIntervals<>();
|
||||||
private static ProfileIntervals<ProfileSwitch> profiles = new ProfileIntervals<>();
|
private static ProfileIntervals<ProfileSwitch> profiles = new ProfileIntervals<>();
|
||||||
|
|
||||||
private static boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private static boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFragmentClass() {
|
public String getFragmentClass() {
|
||||||
|
@ -118,7 +126,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
return PluginBase.TREATMENT;
|
return PluginBase.TREATMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreatmentsPlugin() {
|
private TreatmentsPlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
initializeTempBasalData();
|
initializeTempBasalData();
|
||||||
initializeTreatmentData();
|
initializeTreatmentData();
|
||||||
|
@ -127,7 +135,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
initializeProfileSwitchData();
|
initializeProfileSwitchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initializeTreatmentData() {
|
private static void initializeTreatmentData() {
|
||||||
// Treatments
|
// Treatments
|
||||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||||
|
@ -135,7 +143,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
treatments = MainApp.getDbHelper().getTreatmentDataFromTime(fromMills, false);
|
treatments = MainApp.getDbHelper().getTreatmentDataFromTime(fromMills, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initializeTempBasalData() {
|
private static void initializeTempBasalData() {
|
||||||
// Treatments
|
// Treatments
|
||||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||||
|
@ -144,7 +152,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initializeExtendedBolusData() {
|
private static void initializeExtendedBolusData() {
|
||||||
// Treatments
|
// Treatments
|
||||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||||
|
@ -153,12 +161,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeTempTargetData() {
|
private void initializeTempTargetData() {
|
||||||
long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24;
|
long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24;
|
||||||
tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false));
|
tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeProfileSwitchData() {
|
private void initializeProfileSwitchData() {
|
||||||
profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(false));
|
profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +219,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTotalIOBTreatments() {
|
public void updateTotalIOBTreatments() {
|
||||||
IobTotal total = getCalculationToTimeTreatments(System.currentTimeMillis());
|
lastTreatmentCalculation = getCalculationToTimeTreatments(System.currentTimeMillis());
|
||||||
|
|
||||||
lastTreatmentCalculation = total;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -224,7 +230,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
if (profile == null) return result;
|
if (profile == null) return result;
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long dia_ago = now - (new Double(1.5d * profile.getDia() * 60 * 60 * 1000l)).longValue();
|
long dia_ago = now - (Double.valueOf(1.5d * profile.getDia() * 60 * 60 * 1000l)).longValue();
|
||||||
|
|
||||||
for (Treatment treatment : treatments) {
|
for (Treatment treatment : treatments) {
|
||||||
if (!treatment.isValid)
|
if (!treatment.isValid)
|
||||||
|
@ -340,9 +346,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTotalIOBTempBasals() {
|
public void updateTotalIOBTempBasals() {
|
||||||
IobTotal total = getCalculationToTimeTempBasals(System.currentTimeMillis());
|
lastTempBasalsCalculation = getCalculationToTimeTempBasals(System.currentTimeMillis());
|
||||||
|
|
||||||
lastTempBasalsCalculation = total;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
|
@ -25,18 +24,17 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.Services.Intents;
|
import info.nightscout.androidaps.Services.Intents;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
|
||||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -232,10 +230,10 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
recyclerView.swapAdapter(new RecyclerViewAdapter(TreatmentsPlugin.treatments), false);
|
recyclerView.swapAdapter(new RecyclerViewAdapter(TreatmentsPlugin.treatments), false);
|
||||||
if (TreatmentsPlugin.lastTreatmentCalculation != null)
|
if (TreatmentsPlugin.getPlugin().getLastCalculationTreatments() != null) {
|
||||||
iobTotal.setText(DecimalFormatter.to2Decimal(TreatmentsPlugin.lastTreatmentCalculation.iob) + " U");
|
iobTotal.setText(DecimalFormatter.to2Decimal(TreatmentsPlugin.getPlugin().getLastCalculationTreatments().iob) + " U");
|
||||||
if (TreatmentsPlugin.lastTreatmentCalculation != null)
|
activityTotal.setText(DecimalFormatter.to3Decimal(TreatmentsPlugin.getPlugin().getLastCalculationTreatments().activity) + " U");
|
||||||
activityTotal.setText(DecimalFormatter.to3Decimal(TreatmentsPlugin.lastTreatmentCalculation.activity) + " U");
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class WearPlugin implements PluginBase {
|
public class WearPlugin implements PluginBase {
|
||||||
|
|
||||||
static boolean fragmentEnabled = Config.WEAR;
|
private static boolean fragmentEnabled = Config.WEAR;
|
||||||
static boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
private static WatchUpdaterService watchUS;
|
private static WatchUpdaterService watchUS;
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
||||||
|
@ -33,16 +34,16 @@ import info.nightscout.utils.DecimalFormatter;
|
||||||
public class StatuslinePlugin implements PluginBase {
|
public class StatuslinePlugin implements PluginBase {
|
||||||
|
|
||||||
//broadcast related constants
|
//broadcast related constants
|
||||||
public static final String EXTRA_STATUSLINE = "com.eveningoutpost.dexdrip.Extras.Statusline";
|
private static final String EXTRA_STATUSLINE = "com.eveningoutpost.dexdrip.Extras.Statusline";
|
||||||
public static final String ACTION_NEW_EXTERNAL_STATUSLINE = "com.eveningoutpost.dexdrip.ExternalStatusline";
|
private static final String ACTION_NEW_EXTERNAL_STATUSLINE = "com.eveningoutpost.dexdrip.ExternalStatusline";
|
||||||
public static final String RECEIVER_PERMISSION = "com.eveningoutpost.dexdrip.permissions.RECEIVE_EXTERNAL_STATUSLINE";
|
private static final String RECEIVER_PERMISSION = "com.eveningoutpost.dexdrip.permissions.RECEIVE_EXTERNAL_STATUSLINE";
|
||||||
|
|
||||||
|
|
||||||
static boolean fragmentEnabled = false;
|
private boolean fragmentEnabled = false;
|
||||||
private static boolean lastLoopStatus;
|
private boolean lastLoopStatus;
|
||||||
|
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
|
|
||||||
private static StatuslinePlugin statuslinePlugin;
|
private static StatuslinePlugin statuslinePlugin;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
return statuslinePlugin;
|
return statuslinePlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatuslinePlugin(Context ctx) {
|
private StatuslinePlugin(Context ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
@NonNull
|
@NonNull
|
||||||
private String buildStatusString() {
|
private String buildStatusString() {
|
||||||
String status = "";
|
String status = "";
|
||||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
|
|
||||||
if (activeloop != null && !activeloop.isEnabled(PluginBase.LOOP)) {
|
if (activeloop != null && !activeloop.isEnabled(PluginBase.LOOP)) {
|
||||||
status += ctx.getString(R.string.disabledloop) + "\n";
|
status += ctx.getString(R.string.disabledloop) + "\n";
|
||||||
|
@ -239,7 +240,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
|
|
||||||
//Filter events where loop is (de)activated
|
//Filter events where loop is (de)activated
|
||||||
|
|
||||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
if (activeloop == null) return;
|
if (activeloop == null) return;
|
||||||
|
|
||||||
if ((lastLoopStatus != activeloop.isEnabled(PluginBase.LOOP))) {
|
if ((lastLoopStatus != activeloop.isEnabled(PluginBase.LOOP))) {
|
||||||
|
@ -248,7 +249,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return fragmentEnabled;
|
return fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue