Merge remote-tracking branch 'jotomoremote/watch-updater-service-worker-thread' into watchsmb2

This commit is contained in:
AdrianLxM 2018-03-04 19:25:26 +01:00
commit d2919f9577
91 changed files with 2045 additions and 304 deletions

View file

@ -158,6 +158,14 @@ android {
buildConfigField "boolean", "PUMPCONTROL", "false"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests.returnDefaultValues = true
}
}
allprojects {

View file

@ -35,9 +35,9 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Services.AlarmSoundService;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventFeatureRunning;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
@ -222,6 +222,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
super.onResume();
askForSMSPermissions();
askForLocationPermissions();
MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.MAIN));
}
@Override

View file

@ -72,6 +72,7 @@ import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
import info.nightscout.androidaps.receivers.DataReceiver;
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import io.fabric.sdk.android.Fabric;
@ -97,18 +98,26 @@ public class MainApp extends Application {
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
sInstance = this;
sResources = getResources();
try {
if (FabricPrivacy.fabricEnabled()) {
Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
}
} catch (Exception e) {
android.util.Log.e("ANDROIDAPS", "Error with Fabric init! " + e);
}
JodaTimeAndroid.init(this);
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
log.info("Version: " + BuildConfig.VERSION_NAME);
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
sInstance = this;
sResources = getResources();
registerLocalBroadcastReceiver();
if (pluginsList == null) {
@ -130,7 +139,7 @@ public class MainApp extends Application {
if (Config.DANAR) pluginsList.add(DanaRv2Plugin.getPlugin());
if (Config.DANAR) pluginsList.add(DanaRSPlugin.getPlugin());
pluginsList.add(CareportalPlugin.getPlugin());
if (Config.DANAR) pluginsList.add(InsightPumpPlugin.getPlugin());
// if (Config.DANAR) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin());
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
@ -167,15 +176,15 @@ public class MainApp extends Application {
}
NSUpload.uploadAppStart();
if (Config.NSCLIENT)
Answers.getInstance().logCustom(new CustomEvent("AppStart-NSClient"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-NSClient"));
else if (Config.G5UPLOADER)
Answers.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader"));
else if (Config.PUMPCONTROL)
Answers.getInstance().logCustom(new CustomEvent("AppStart-PumpControl"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-PumpControl"));
else if (MainApp.getConfigBuilder().isClosedModeEnabled())
Answers.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop"));
else
Answers.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop"));
new Thread(new Runnable() {
@Override

View file

@ -130,6 +130,8 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(id);
addPreferencesFromResource(R.xml.pref_advanced);
} else {
addPreferencesFromResource(R.xml.pref_overview);
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
addPreferencesFromResource(R.xml.pref_password);
}

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.data;
import android.support.v4.util.LongSparseArray;
import com.crashlytics.android.Crashlytics;
import org.json.JSONArray;
import org.json.JSONException;
@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.ToastUtils;
public class Profile {
@ -57,7 +58,7 @@ public class Profile {
if (units != null)
this.units = units;
else {
Crashlytics.log("Profile failover failed too");
FabricPrivacy.log("Profile failover failed too");
this.units = Constants.MGDL;
}
}

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Iob;
import info.nightscout.androidaps.interfaces.InsulinInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
import info.nightscout.utils.DateUtil;
@ -121,7 +122,7 @@ public class Treatment implements DataPointWithLabelInterface {
@Override
public double getY() {
return yValue;
return isSMB ? OverviewPlugin.getPlugin().determineLowLine() : yValue;
}
@Override

View file

@ -0,0 +1,36 @@
package info.nightscout.androidaps.events;
/**
* Created by jamorham on 07/02/2018.
*
* Event to indicate that an app feature is being used, for example bolus wizard being opened
*
* The purpose this has been created for is to enable opportunistic connection to the pump
* so that it is already connected before the user wishes to enact a pump function
*
*/
public class EventFeatureRunning extends Event {
private Feature feature = Feature.UNKNOWN;
public EventFeatureRunning() {
}
public EventFeatureRunning(Feature feature) {
this.feature = feature;
}
public Feature getFeature() {
return feature;
}
public enum Feature {
UNKNOWN,
MAIN,
WIZARD,
JUST_ADD_MORE_HERE
}
}

View file

@ -9,8 +9,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -32,6 +31,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SingleClickButton;
/**
@ -83,7 +83,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -203,13 +203,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
case R.id.actions_extendedbolus_cancel:
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelExtended(null);
Answers.getInstance().logCustom(new CustomEvent("CancelExtended"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelExtended"));
}
break;
case R.id.actions_canceltempbasal:
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null);
Answers.getInstance().logCustom(new CustomEvent("CancelTemp"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelTemp"));
}
break;
case R.id.actions_settempbasal:

View file

@ -14,7 +14,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -31,6 +30,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse;
@ -171,7 +171,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
}
}
});
Answers.getInstance().logCustom(new CustomEvent("Fill"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill"));
}
}
});

View file

@ -10,7 +10,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
@ -99,7 +99,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
}
}
});
Answers.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
}
});
builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.Actions.dialogs;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
@ -13,7 +12,6 @@ import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -28,6 +26,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
@ -162,7 +161,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
} else {
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback);
}
Answers.getInstance().logCustom(new CustomEvent("TempBasal"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempBasal"));
}
});
builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.BuildConfig;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
import info.nightscout.utils.FabricPrivacy;
public class CareportalFragment extends SubscriberFragment implements View.OnClickListener {
@ -111,7 +111,7 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -23,7 +23,6 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
@ -56,6 +55,7 @@ import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.NumberPicker;
@ -699,14 +699,14 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
log.debug("Creating new TempTarget db record: " + tempTarget.toString());
MainApp.getDbHelper().createOrUpdate(tempTarget);
NSUpload.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("TempTarget"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempTarget"));
}
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
} else {
NSUpload.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("NSTreatment"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSTreatment"));
}
}
});
@ -741,7 +741,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
MainApp.bus().post(new EventNewBasalProfile());
}
});
Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
}
public static void doProfileSwitch(final int duration, final int percentage, final int timeshift) {
@ -773,7 +773,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
MainApp.bus().post(new EventNewBasalProfile());
}
});
Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} else {
log.error("No profile switch existing");
}

View file

@ -17,8 +17,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.util.ArrayList;
@ -40,6 +39,7 @@ import info.nightscout.androidaps.plugins.Insulin.InsulinFastactingPlugin;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.PasswordProtection;
@ -131,7 +131,7 @@ public class ConfigBuilderFragment extends Fragment {
}
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -242,7 +242,7 @@ public class ConfigBuilderFragment extends Fragment {
MainApp.bus().post(new EventRefreshGui());
MainApp.bus().post(new EventConfigBuilderChange());
getPlugin().logPluginStatus();
Answers.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
}
});

View file

@ -263,7 +263,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
activePump = (PumpInterface) getTheOneEnabledInArray(pluginsInCategory, PluginBase.PUMP);
if (activePump == null)
activePump = VirtualPumpPlugin.getPlugin(); // for NSClient build
this.setFragmentVisiblities(((PluginBase)activePump).getName(), pluginsInCategory, PluginBase.PUMP);
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginBase.PUMP);
// PluginBase.LOOP
activeLoop = this.determineActivePlugin(PluginBase.LOOP);
@ -299,7 +299,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
* disables the visibility for all fragments of Plugins in the given pluginsInCategory
* with the given PluginType which are not equally named to the Plugin implementing the
* given Plugin Interface.
*
* <p>
* TODO we are casting an interface to PluginBase, which seems to be rather odd, since
* TODO the interface is not implementing PluginBase (this is just avoiding errors through
* TODO conventions.
@ -314,7 +314,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
T activePlugin = (T) getTheOneEnabledInArray(pluginsInCategory, pluginType);
if (activePlugin != null) {
this.setFragmentVisiblities(((PluginBase)activePlugin).getName(),
this.setFragmentVisiblities(((PluginBase) activePlugin).getName(),
pluginsInCategory, pluginType);
}
@ -743,14 +743,17 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
}
public String getProfileName(long time, boolean customized) {
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
if (profileSwitch != null) {
if (profileSwitch.profileJson != null) {
return customized ? profileSwitch.getCustomizedName() : profileSwitch.profileName;
} else {
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
if (profile != null)
return profileSwitch.profileName;
boolean ignoreProfileSwitchEvents = SP.getBoolean(R.string.key_do_not_track_profile_switch, false);
if (!ignoreProfileSwitchEvents) {
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
if (profileSwitch != null) {
if (profileSwitch.profileJson != null) {
return customized ? profileSwitch.getCustomizedName() : profileSwitch.profileName;
} else {
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
if (profile != null)
return profileSwitch.profileName;
}
}
}
// Unable to determine profile, failover to default

View file

@ -15,7 +15,6 @@ import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -25,6 +24,7 @@ import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.utils.FabricPrivacy;
public class ObjectivesFragment extends Fragment {
private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class);
@ -208,7 +208,7 @@ public class ObjectivesFragment extends Fragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -130,7 +130,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
if (profile == null) return absoluteRate;
if (absoluteRate < 0) absoluteRate = 0d;
Integer maxBasalMult = SP.getInt("openapsama_current_basal_safety_multiplier", 4);
Double maxBasalMult = SP.getDouble("openapsama_current_basal_safety_multiplier", 4d);
Integer maxBasalFromDaily = SP.getInt("openapsama_max_daily_safety_multiplier", 3);
// Check percentRate but absolute rate too, because we know real current basal in pump
Double origRate = absoluteRate;
@ -168,7 +168,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
if (absoluteRate < 0) absoluteRate = 0d;
Integer maxBasalMult = SP.getInt("openapsama_current_basal_safety_multiplier", 4);
Double maxBasalMult = SP.getDouble("openapsama_current_basal_safety_multiplier", 4d);
Integer maxBasalFromDaily = SP.getInt("openapsama_max_daily_safety_multiplier", 3);
// Check percentRate but absolute rate too, because we know real current basal in pump
Double origRate = absoluteRate;

View file

@ -18,7 +18,6 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -33,6 +32,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.Food;
import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SpinnerHelper;
@ -130,7 +130,7 @@ public class FoodFragment extends SubscriberFragment {
filterData();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -7,11 +7,11 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.FabricPrivacy;
/**
* Created by mike on 17.04.2017.
@ -37,7 +37,7 @@ public class InsulinFragment extends Fragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -9,8 +9,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -22,6 +20,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
import info.nightscout.utils.FabricPrivacy;
public class LoopFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(LoopFragment.class);
@ -53,7 +52,7 @@ public class LoopFragment extends SubscriberFragment implements View.OnClickList
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -71,7 +70,7 @@ public class LoopFragment extends SubscriberFragment implements View.OnClickList
}
});
thread.start();
Answers.getInstance().logCustom(new CustomEvent("Loop_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
break;
}

View file

@ -8,7 +8,6 @@ import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -37,6 +36,7 @@ import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP;
@ -332,7 +332,7 @@ public class LoopPlugin implements PluginBase {
MainApp.getConfigBuilder().applyAPSRequest(resultAfterConstraints, new Callback() {
@Override
public void run() {
Answers.getInstance().logCustom(new CustomEvent("APSRequest"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest"));
if (result.enacted || result.success) {
lastRun.setByPump = result;
lastRun.lastEnact = lastRun.lastAPSRun;

View file

@ -18,8 +18,6 @@ import android.widget.CompoundButton;
import android.widget.ScrollView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -33,6 +31,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP;
public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
@ -88,7 +87,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -99,11 +98,11 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
switch (view.getId()) {
case R.id.nsclientinternal_restart:
MainApp.bus().post(new EventNSClientRestart());
Answers.getInstance().logCustom(new CustomEvent("NSClientRestart"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
break;
case R.id.nsclientinternal_delivernow:
NSClientInternalPlugin.getPlugin().resend("GUI");
Answers.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
break;
case R.id.nsclientinternal_clearlog:
NSClientInternalPlugin.getPlugin().clearLog();
@ -118,7 +117,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
public void onClick(DialogInterface dialog, int id) {
UploadQueue.clearQueue();
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
}
});
builder.setNegativeButton(getString(R.string.cancel), null);
@ -126,7 +125,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
break;
case R.id.nsclientinternal_showqueue:
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientInternalPlugin.getPlugin().queue().textList()));
Answers.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
break;
}
}
@ -139,7 +138,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
NSClientInternalPlugin.getPlugin().paused = isChecked;
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientPause"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause"));
break;
case R.id.nsclientinternal_autoscroll:
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);

View file

@ -9,7 +9,7 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.PowerManager;
import com.crashlytics.android.Crashlytics;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import com.j256.ormlite.dao.CloseableIterator;
@ -62,6 +62,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotificati
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP;
import io.socket.client.IO;
import io.socket.client.Socket;
@ -123,7 +124,7 @@ public class NSClientService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
mWakeLock.release();
if (mWakeLock.isHeld()) mWakeLock.release();
}
public class LocalBinder extends Binder {
@ -345,14 +346,14 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Announcement from NS: " + args[0]);
FabricPrivacy.log("Wrong Announcement from NS: " + args[0]);
return;
}
if (Config.detailedLog)
try {
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received"));
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
log.debug(data.toString());
@ -381,7 +382,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong alarm from NS: " + args[0]);
return;
}
BroadcastAlarm.handleAlarm(data, getApplicationContext());
@ -409,7 +410,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return;
}
if (Config.detailedLog)
@ -434,7 +435,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return;
}
if (Config.detailedLog)
@ -665,7 +666,7 @@ public class NSClientService extends Service {
}
//MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
} finally {
wakeLock.release();
if (wakeLock.isHeld()) wakeLock.release();
}
}

View file

@ -206,7 +206,7 @@ public class DetermineBasalAdapterAMAJS {
mProfile.put("carb_ratio", profile.getIc());
mProfile.put("sens", Profile.toMgdl(profile.getIsf().doubleValue(), units));
mProfile.put("max_daily_safety_multiplier", SP.getInt("openapsama_max_daily_safety_multiplier", 3));
mProfile.put("current_basal_safety_multiplier", SP.getInt("openapsama_current_basal_safety_multiplier", 4));
mProfile.put("current_basal_safety_multiplier", SP.getDouble("openapsama_current_basal_safety_multiplier", 4d));
mProfile.put("skip_neutral_temps", true);
mProfile.put("current_basal", basalrate);
mProfile.put("temptargetSet", tempTargetSet);

View file

@ -9,8 +9,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -24,6 +22,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter;
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -63,7 +62,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -74,7 +73,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) {
case R.id.openapsma_run:
OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
break;
}

View file

@ -9,8 +9,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -22,6 +20,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter;
public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -57,7 +56,7 @@ public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClic
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -68,7 +67,7 @@ public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClic
switch (view.getId()) {
case R.id.openapsma_run:
OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run"));
break;
}

View file

@ -230,7 +230,7 @@ public class DetermineBasalAdapterSMBJS {
mProfile.put("carb_ratio", profile.getIc());
mProfile.put("sens", Profile.toMgdl(profile.getIsf().doubleValue(), units));
mProfile.put("max_daily_safety_multiplier", SP.getInt("openapsama_max_daily_safety_multiplier", 3));
mProfile.put("current_basal_safety_multiplier", SP.getInt("openapsama_current_basal_safety_multiplier", 4));
mProfile.put("current_basal_safety_multiplier", SP.getDouble("openapsama_current_basal_safety_multiplier", 4d));
mProfile.put("high_temptarget_raises_sensitivity", SMBDefaults.high_temptarget_raises_sensitivity);
mProfile.put("low_temptarget_lowers_sensitivity", SMBDefaults.low_temptarget_lowers_sensitivity);

View file

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -22,6 +21,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter;
public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnClickListener {
@ -66,7 +66,7 @@ public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) {
case R.id.openapsma_run:
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
break;
}

View file

@ -11,7 +11,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.XdripCalibrations;
@ -88,7 +88,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
final Double bg = SafeParse.stringToDouble(bgNumber.getText());
XdripCalibrations.confirmAndSendCalibration(bg, context);
dismiss();
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("Calibration"));
break;
case R.id.cancel:
dismiss();

View file

@ -0,0 +1,329 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.content.Context;
import android.os.Bundle;
import android.os.HandlerThread;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.Date;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.OpenAPSSMB.DetermineBasalResultSMB;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
public class NewCarbsDialog extends DialogFragment implements OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
private static Logger log = LoggerFactory.getLogger(NewCarbsDialog.class);
private EditText foodText;
private NumberPicker editCarbs;
private TextView dateButton;
private TextView timeButton;
private Date initialEventTime;
private Date eventTime;
private Button fav1Button;
private Button fav2Button;
private Button fav3Button;
private static final double FAV1_DEFAULT = 5;
private static final double FAV2_DEFAULT = 10;
private static final double FAV3_DEFAULT = 20;
private CheckBox suspendLoopCheckbox;
private CheckBox startActivityTTCheckbox;
private Integer maxCarbs;
//one shot guards
private boolean accepted;
private boolean okClicked;
public NewCarbsDialog() {
HandlerThread mHandlerThread = new HandlerThread(NewCarbsDialog.class.getSimpleName());
mHandlerThread.start();
}
final private TextWatcher textWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
validateInputs();
}
};
private void validateInputs() {
Integer carbs = SafeParse.stringToInt(editCarbs.getText());
if (carbs > maxCarbs) {
editCarbs.setValue(0d);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied));
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_newcarbs_dialog, container, false);
view.findViewById(R.id.ok).setOnClickListener(this);
view.findViewById(R.id.cancel).setOnClickListener(this);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
foodText = view.findViewById(R.id.newcarb_food);
editCarbs = view.findViewById(R.id.newcarb_carbsamount);
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt);
dateButton = view.findViewById(R.id.newcarbs_eventdate);
timeButton = view.findViewById(R.id.newcarb_eventtime);
initialEventTime = new Date();
eventTime = new Date(initialEventTime.getTime());
dateButton.setText(DateUtil.dateString(eventTime));
timeButton.setText(DateUtil.timeString(eventTime));
dateButton.setOnClickListener(this);
timeButton.setOnClickListener(this);
// TODO prefilling carbs, maybe
// TODO maybe update suggested carbs to target TT when checked
// APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
// if (lastAPSResult != null && lastAPSResult instanceof DetermineBasalResultSMB && ((DetermineBasalResultSMB) lastAPSResult).carbsReq > 0) {
// editCarbs.setValue(((DetermineBasalResultSMB) lastAPSResult).carbsReq);
// }
fav1Button = view.findViewById(R.id.newcarbs_plus1);
fav1Button.setOnClickListener(this);
fav1Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_1), String.valueOf(FAV1_DEFAULT)));
fav2Button = view.findViewById(R.id.newcarbs_plus2);
fav2Button.setOnClickListener(this);
fav2Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_2), String.valueOf(FAV2_DEFAULT)));
fav3Button = view.findViewById(R.id.newcarbs_plus3);
fav3Button.setOnClickListener(this);
fav3Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_3), String.valueOf(FAV3_DEFAULT)));
suspendLoopCheckbox = view.findViewById(R.id.newcarbs_suspend_loop);
setCancelable(true);
getDialog().setCanceledOnTouchOutside(false);
return view;
}
@Override
public synchronized void onClick(View view) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(eventTime);
switch (view.getId()) {
case R.id.ok:
submit();
break;
case R.id.cancel:
dismiss();
break;
case R.id.newcarbs_eventdate:
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
dpd.show(getActivity().getFragmentManager(), "Datepickerdialog");
break;
case R.id.newcarb_eventtime:
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(getActivity())
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
tpd.show(getActivity().getFragmentManager(), "Timepickerdialog");
break;
case R.id.newcarbs_plus1:
editCarbs.setValue(editCarbs.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_1), FAV1_DEFAULT));
validateInputs();
break;
case R.id.newcarbs_plus2:
editCarbs.setValue(editCarbs.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_2), FAV2_DEFAULT));
validateInputs();
break;
case R.id.newcarbs_plus3:
editCarbs.setValue(editCarbs.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_3), FAV3_DEFAULT));
validateInputs();
break;
}
}
private void submit() {
if (okClicked) {
log.debug("guarding: ok already clicked");
dismiss();
return;
}
okClicked = true;
try {
final String food = StringUtils.trimToNull(foodText.getText().toString());
final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(carbs);
String confirmMessage = "";
if (carbs > 0)
confirmMessage += getString(R.string.carbs) + ": " + "<font color='" + MainApp.sResources.getColor(R.color.colorCarbsButton) + "'>" + carbsAfterConstraints + "g" + "</font>";
if (!carbsAfterConstraints.equals(carbs))
confirmMessage += "<br/><font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + getString(R.string.carbsconstraintapplied) + "</font>";
if (suspendLoopCheckbox.isChecked()) {
confirmMessage += "<br/>" + "Loop: " + "<font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + "Suspend for 30 min</font>";
}
double prefTTDuration = SP.getDouble(R.string.key_activity_duration, 90d);
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 90d;
double prefTT = SP.getDouble(R.string.key_activity_target, 140d);
double tt = prefTT > 0 ? prefTT : 140d;
if (startActivityTTCheckbox.isChecked()) {
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + ((int) tt) + "mg/dl for " + ((int) ttDuration) + " min </font>";
}
if (StringUtils.isNoneEmpty(food)) {
confirmMessage += "<br/>" + "Food: " + food;
}
if (!initialEventTime.equals(eventTime)) {
confirmMessage += "<br/> Time: " + DateUtil.dateAndTimeString(eventTime);
}
final int finalCarbsAfterConstraints = carbsAfterConstraints;
final Context context = getContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(this.getContext().getString(R.string.confirmation));
if (confirmMessage.startsWith("<br/>"))
confirmMessage = confirmMessage.substring("<br/>".length());
builder.setMessage(Html.fromHtml(confirmMessage));
builder.setPositiveButton(getString(R.string.ok), (dialog, id) -> {
synchronized (builder) {
if (accepted) {
log.debug("guarding: already accepted");
return;
}
accepted = true;
if (suspendLoopCheckbox.isChecked()) {
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
activeloop.suspendTo(System.currentTimeMillis() + 30L * 60 * 1000);
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
}
});
}
if (startActivityTTCheckbox.isChecked()) {
TempTarget tempTarget = new TempTarget();
tempTarget.date = System.currentTimeMillis();
tempTarget.durationInMinutes = (int) ttDuration;
tempTarget.reason = "Activity";
tempTarget.source = Source.USER;
tempTarget.low = (int) tt;
tempTarget.high = (int) tt;
MainApp.getDbHelper().createOrUpdate(tempTarget);
}
if (finalCarbsAfterConstraints > 0 || food != null) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.date = eventTime.getTime();
detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
// detailedBolusInfo.food = food;
detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER;
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
}
}
});
builder.setNegativeButton(getString(R.string.cancel), null);
builder.show();
dismiss();
} catch (Exception e) {
log.error("Unhandled exception", e);
}
}
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
eventTime.setYear(year - 1900);
eventTime.setMonth(monthOfYear);
eventTime.setDate(dayOfMonth);
dateButton.setText(DateUtil.dateString(eventTime));
}
@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
eventTime.setHours(hourOfDay);
eventTime.setMinutes(minute);
eventTime.setSeconds(second);
timeButton.setText(DateUtil.timeString(eventTime));
}
}

View file

@ -0,0 +1,342 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.HandlerThread;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.Date;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.OpenAPSSMB.DetermineBasalResultSMB;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
public class NewInsulinDialog extends DialogFragment implements OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
private static Logger log = LoggerFactory.getLogger(NewInsulinDialog.class);
private NumberPicker editInsulin;
private TextView dateButton;
private TextView timeButton;
private Date initialEventTime;
private Date eventTime;
private Button plus1Button;
private Button plus2Button;
private Button plus3Button;
public static final double PLUS1_DEFAULT = 0.5d;
public static final double PLUS2_DEFAULT = 1d;
public static final double PLUS3_DEFAULT = 2d;
private CheckBox startESMCheckbox;
private CheckBox recordOnlyCheckbox;
private Double maxInsulin;
//one shot guards
private boolean accepted;
private boolean okClicked;
public NewInsulinDialog() {
HandlerThread mHandlerThread = new HandlerThread(NewInsulinDialog.class.getSimpleName());
mHandlerThread.start();
}
final private TextWatcher textWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
validateInputs();
}
};
private void validateInputs() {
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
if (insulin > maxInsulin) {
editInsulin.setValue(0d);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied));
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_newinsulin_dialog, container, false);
view.findViewById(R.id.ok).setOnClickListener(this);
view.findViewById(R.id.cancel).setOnClickListener(this);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newinsulin_amount);
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
dateButton = (TextView) view.findViewById(R.id.newinsulin_eventdate);
timeButton = (TextView) view.findViewById(R.id.newinsulin_eventtime);
initialEventTime = new Date();
eventTime = new Date(initialEventTime.getTime());
dateButton.setText(DateUtil.dateString(eventTime));
timeButton.setText(DateUtil.timeString(eventTime));
dateButton.setOnClickListener(this);
timeButton.setOnClickListener(this);
/*
// This makes it to easy to just bolus insulinReq, which is almost always too much
APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
if (lastAPSResult != null && lastAPSResult instanceof DetermineBasalResultSMB && ((DetermineBasalResultSMB) lastAPSResult).insulinReq > 0) {
editInsulin.setValue(((DetermineBasalResultSMB )lastAPSResult).insulinReq);
}
*/
plus1Button = (Button) view.findViewById(R.id.newinsulin_plus05);
plus1Button.setOnClickListener(this);
plus1Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_1), String.valueOf(PLUS1_DEFAULT)));
plus2Button = (Button) view.findViewById(R.id.newinsulin_plus10);
plus2Button.setOnClickListener(this);
plus2Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_2), String.valueOf(PLUS2_DEFAULT)));
plus3Button = (Button) view.findViewById(R.id.newinsulin_plus20);
plus3Button.setOnClickListener(this);
plus3Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_3), String.valueOf(PLUS3_DEFAULT)));
startESMCheckbox = (CheckBox) view.findViewById(R.id.newinsulin_start_eating_soon_tt);
recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newinsulin_record_only);
recordOnlyCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (dateButton != null) dateButton.setEnabled(isChecked);
if (timeButton != null) timeButton.setEnabled(isChecked);
});
setCancelable(true);
getDialog().setCanceledOnTouchOutside(false);
return view;
}
@Override
public synchronized void onClick(View view) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(eventTime);
switch (view.getId()) {
case R.id.ok:
submit();
break;
case R.id.cancel:
dismiss();
break;
case R.id.newinsulin_eventdate:
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
dpd.show(getActivity().getFragmentManager(), "Datepickerdialog");
break;
case R.id.newinsulin_eventtime:
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(getActivity())
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
tpd.show(getActivity().getFragmentManager(), "Timepickerdialog");
break;
case R.id.newinsulin_start_eating_soon_tt:
final Profile profile = MainApp.getConfigBuilder().getProfile();
double tt = SP.getDouble(R.string.key_eatingsoon_target, 0d);
double ttBgAdd = (tt - profile.getTargetLow()) / profile.getIsf();
editInsulin.setValue(editInsulin.getValue() + (startESMCheckbox.isChecked() ? ttBgAdd : -ttBgAdd));
break;
case R.id.newinsulin_plus05:
editInsulin.setValue(editInsulin.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT));
validateInputs();
break;
case R.id.newinsulin_plus10:
editInsulin.setValue(editInsulin.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT));
validateInputs();
break;
case R.id.newinsulin_plus20:
editInsulin.setValue(editInsulin.getValue()
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT));
validateInputs();
break;
}
}
private void submit() {
if (okClicked){
log.debug("guarding: ok already clicked");
dismiss();
return;
}
okClicked = true;
try {
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(insulin);
String confirmMessage = "";
if (insulin > 0) {
confirmMessage += getString(R.string.bolus) + ": " + "<font color='" + MainApp.sResources.getColor(R.color.colorCarbsButton) + "'>" + insulinAfterConstraints + "U" + "</font>";
if (recordOnlyCheckbox.isChecked()) {
confirmMessage += "<br/><font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + "Bolus will be recorded only</font>";
}
}
if (!insulinAfterConstraints.equals(insulin))
confirmMessage += "<br/><font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + getString(R.string.bolusconstraintapplied) + "</font>";
double prefTTDuration = SP.getDouble(R.string.key_eatingsoon_duration, 45d);
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 45d;
double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d);
double tt = prefTT > 0 ? prefTT : 80d;
if (startESMCheckbox.isChecked()) {
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + ((int) tt) + "mg/dl for " + ((int) ttDuration) + " min </font>";
}
if (!initialEventTime.equals(eventTime)) {
confirmMessage += "<br/>Time: " + DateUtil.dateAndTimeString(eventTime);
}
final double finalInsulinAfterConstraints = insulinAfterConstraints;
final Context context = getContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(this.getContext().getString(R.string.confirmation));
if (confirmMessage.startsWith("<br/>"))
confirmMessage = confirmMessage.substring("<br/>".length());
builder.setMessage(Html.fromHtml(confirmMessage));
builder.setPositiveButton(getString(R.string.ok), (dialog, id) -> {
synchronized (builder) {
if (accepted) {
log.debug("guarding: already accepted");
return;
}
accepted = true;
if (startESMCheckbox.isChecked()) {
TempTarget tempTarget = new TempTarget();
tempTarget.date = System.currentTimeMillis();
tempTarget.durationInMinutes = (int) ttDuration;
tempTarget.reason = "Eating soon";
tempTarget.source = Source.USER;
tempTarget.low = (int) tt;
tempTarget.high = (int) tt;
MainApp.getDbHelper().createOrUpdate(tempTarget);
}
if (finalInsulinAfterConstraints <= 0.01) {
return;
}
if (recordOnlyCheckbox.isChecked()) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.source = Source.USER;
detailedBolusInfo.date = eventTime.getTime();
detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
} else {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
}
});
Answers.getInstance().logCustom(new CustomEvent("Bolus"));
}
}
});
builder.setNegativeButton(getString(R.string.cancel), null);
builder.show();
dismiss();
} catch (Exception e) {
log.error("Unhandled exception", e);
}
}
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
eventTime.setYear(year - 1900);
eventTime.setMonth(monthOfYear);
eventTime.setDate(dayOfMonth);
dateButton.setText(DateUtil.dateString(eventTime));
}
@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
eventTime.setHours(hourOfDay);
eventTime.setMinutes(minute);
eventTime.setSeconds(second);
timeButton.setText(DateUtil.timeString(eventTime));
}
}

View file

@ -16,7 +16,6 @@ import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -31,9 +30,9 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
@ -176,7 +175,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
} else {
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
}
Answers.getInstance().logCustom(new CustomEvent("Bolus"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
}
}
}

View file

@ -25,7 +25,6 @@ import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -50,6 +49,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.EventFeatureRunning;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
@ -57,9 +57,8 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@ -132,6 +131,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
public void onResume() {
super.onResume();
MainApp.bus().register(this);
MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.WIZARD));
}
@Override
@ -382,7 +382,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
} else {
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
}
Answers.getInstance().logCustom(new CustomEvent("Wizard"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("Wizard"));
}
}
}

View file

@ -3,9 +3,11 @@ package info.nightscout.androidaps.plugins.Overview;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
@ -32,8 +34,6 @@ import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.jjoe64.graphview.GraphView;
import com.squareup.otto.Subscribe;
@ -95,6 +95,8 @@ import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastA
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
import info.nightscout.androidaps.plugins.Overview.Dialogs.CalibrationDialog;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewCarbsDialog;
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewInsulinDialog;
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
import info.nightscout.androidaps.plugins.Overview.activities.QuickWizardListActivity;
@ -103,12 +105,14 @@ import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock;
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.notifications.NotificationStore;
import info.nightscout.androidaps.plugins.SourceDexcomG5.SourceDexcomG5Plugin;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.OKDialog;
import info.nightscout.utils.Profiler;
@ -163,10 +167,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
LinearLayoutManager llm;
LinearLayout acceptTempLayout;
SingleClickButton acceptTempButton;
SingleClickButton treatmentButton;
SingleClickButton wizardButton;
SingleClickButton calibrationButton;
SingleClickButton acceptTempButton;
SingleClickButton insulinButton;
SingleClickButton carbsButton;
SingleClickButton cgmButton;
SingleClickButton quickWizardButton;
CheckBox lockScreen;
@ -257,6 +265,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
treatmentButton.setOnClickListener(this);
wizardButton = (SingleClickButton) view.findViewById(R.id.overview_wizardbutton);
wizardButton.setOnClickListener(this);
insulinButton = (SingleClickButton) view.findViewById(R.id.overview_insulinbutton);
if (insulinButton != null)
insulinButton.setOnClickListener(this);
carbsButton = (SingleClickButton) view.findViewById(R.id.overview_carbsbutton);
if (carbsButton != null)
carbsButton.setOnClickListener(this);
acceptTempButton = (SingleClickButton) view.findViewById(R.id.overview_accepttempbutton);
if (acceptTempButton != null)
acceptTempButton.setOnClickListener(this);
@ -266,6 +280,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
calibrationButton = (SingleClickButton) view.findViewById(R.id.overview_calibrationbutton);
if (calibrationButton != null)
calibrationButton.setOnClickListener(this);
cgmButton = (SingleClickButton) view.findViewById(R.id.overview_cgmbutton);
if (cgmButton != null)
cgmButton.setOnClickListener(this);
acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
@ -342,7 +359,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
log.debug("Runtime Exception", e);
}
@ -612,6 +629,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
@Override
public void onClick(View v) {
boolean xdrip = MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginBase.BGSOURCE);
boolean g5 = MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class) != null && MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class).isEnabled(PluginBase.BGSOURCE);
String units = MainApp.getConfigBuilder().getProfileUnits();
FragmentManager manager = getFragmentManager();
switch (v.getId()) {
case R.id.overview_accepttempbutton:
@ -625,13 +646,36 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
wizardDialog.show(manager, "WizardDialog");
break;
case R.id.overview_calibrationbutton:
CalibrationDialog calibrationDialog = new CalibrationDialog();
calibrationDialog.show(manager, "CalibrationDialog");
if (xdrip) {
CalibrationDialog calibrationDialog = new CalibrationDialog();
calibrationDialog.show(manager, "CalibrationDialog");
} else if (g5) {
try {
Intent i = new Intent("com.dexcom.cgm.activities.MeterEntryActivity");
startActivity(i);
} catch (ActivityNotFoundException e) {
ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.g5appnotdetected));
}
}
break;
case R.id.overview_cgmbutton:
if (xdrip)
openCgmApp("com.eveningoutpost.dexdrip");
else if (g5 && units.equals(Constants.MGDL))
openCgmApp("com.dexcom.cgm.region5.mgdl");
else if (g5 && units.equals(Constants.MMOL))
openCgmApp("com.dexcom.cgm.region5.mmol");
break;
case R.id.overview_treatmentbutton:
NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog();
treatmentDialogFragment.show(manager, "TreatmentDialog");
break;
case R.id.overview_insulinbutton:
new NewInsulinDialog().show(manager, "InsulinDialog");
break;
case R.id.overview_carbsbutton:
new NewCarbsDialog().show(manager, "CarbsDialog");
break;
case R.id.overview_pumpstatus:
if (ConfigBuilderPlugin.getActivePump().isSuspended() || !ConfigBuilderPlugin.getActivePump().isInitialized())
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
@ -658,6 +702,25 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
public boolean openCgmApp(String packageName) {
PackageManager packageManager = getContext().getPackageManager();
try {
Intent intent = packageManager.getLaunchIntentForPackage(packageName);
if (intent == null) {
throw new ActivityNotFoundException();
}
intent.addCategory(Intent.CATEGORY_LAUNCHER);
getContext().startActivity(intent);
return true;
} catch (ActivityNotFoundException e) {
new AlertDialog.Builder(getContext())
.setMessage(R.string.error_starting_cgm)
.setPositiveButton("OK", null)
.show();
return false;
}
}
@Override
public boolean onLongClick(View v) {
switch (v.getId()) {
@ -698,7 +761,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
scheduleUpdateGUI("onClickAcceptTemp");
}
});
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AcceptTemp"));
}
});
builder.setNegativeButton(getContext().getString(R.string.cancel), null);
@ -814,7 +877,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
}
});
Answers.getInstance().logCustom(new CustomEvent("QuickWizard"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("QuickWizard"));
}
}
}
@ -1015,16 +1078,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return;
}
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
if (lowLineSetting < 1)
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
if (highLineSetting < 1)
highLineSetting = Profile.fromMgdlToUnits(180d, units);
final double lowLine = lowLineSetting;
final double highLine = highLineSetting;
final double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
final double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
//Start with updating the BG as it is unaffected by loop.
// **** BG value ****
@ -1114,14 +1169,26 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
}
// **** Calibration button ****
// **** Calibration & CGM buttons ****
boolean xDripIsBgSource = MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginBase.BGSOURCE);
boolean g5IsBgSource = MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class) != null && MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class).isEnabled(PluginBase.BGSOURCE);
boolean bgAvailable = DatabaseHelper.actualBg() != null;
if (calibrationButton != null) {
if (MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginBase.BGSOURCE) && profile != null && DatabaseHelper.actualBg() != null) {
if ((xDripIsBgSource || g5IsBgSource) && bgAvailable && SP.getBoolean(R.string.key_show_calibration_button, true)) {
calibrationButton.setVisibility(View.VISIBLE);
} else {
calibrationButton.setVisibility(View.GONE);
}
}
if (cgmButton != null) {
if (xDripIsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) {
cgmButton.setVisibility(View.VISIBLE);
} else if (g5IsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) {
cgmButton.setVisibility(View.VISIBLE);
} else {
cgmButton.setVisibility(View.GONE);
}
}
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
String basalText = "";
@ -1218,15 +1285,40 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else
quickWizardButton.setVisibility(View.GONE);
// Bolus and calc button
if (pump.isInitialized() && !pump.isSuspended()) {
wizardButton.setVisibility(View.VISIBLE);
treatmentButton.setVisibility(View.VISIBLE);
} else {
wizardButton.setVisibility(View.GONE);
treatmentButton.setVisibility(View.GONE);
// **** Various treatment buttons ****
if (carbsButton != null) {
if (SP.getBoolean(R.string.key_show_carbs_button, true)
&& !ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo ||
(pump.isInitialized() && !pump.isSuspended())) {
carbsButton.setVisibility(View.VISIBLE);
} else {
carbsButton.setVisibility(View.GONE);
}
}
if (pump.isInitialized() && !pump.isSuspended()) {
if (treatmentButton != null){
if (SP.getBoolean(R.string.key_show_treatment_button, false)) {
treatmentButton.setVisibility(View.VISIBLE);
} else {
treatmentButton.setVisibility(View.GONE);
}
}
if (wizardButton != null) {
if (SP.getBoolean(R.string.key_show_wizard_button, true)) {
wizardButton.setVisibility(View.VISIBLE);
} else {
wizardButton.setVisibility(View.GONE);
}
}
if (insulinButton != null) {
if (SP.getBoolean(R.string.key_show_insulin_button, true)) {
insulinButton.setVisibility(View.VISIBLE);
} else {
insulinButton.setVisibility(View.GONE);
}
}
}
// **** BG value ****
if (lastBG == null) { //left this here as it seems you want to exit at this point if it is null...

View file

@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.QuickWizard;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.PluginBase;
@ -26,7 +27,6 @@ public class OverviewPlugin implements PluginBase {
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
public static OverviewPlugin getPlugin() {
if (overviewPlugin == null)
overviewPlugin = new OverviewPlugin();
return overviewPlugin;
@ -92,7 +92,7 @@ public class OverviewPlugin implements PluginBase {
@Override
public boolean showInList(int type) {
return false;
return true;
}
@Override
@ -107,7 +107,7 @@ public class OverviewPlugin implements PluginBase {
@Override
public int getPreferencesId() {
return -1;
return R.xml.pref_overview;
}
@Override
@ -128,4 +128,34 @@ public class OverviewPlugin implements PluginBase {
MainApp.bus().post(new EventRefreshOverview("EventDismissNotification"));
}
public double determineHighLine() {
Profile profile = MainApp.getConfigBuilder().getProfile();
if (profile == null) {
return bgTargetHigh;
}
return determineHighLine(profile.getUnits());
}
public double determineHighLine(String units) {
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
if (highLineSetting < 1)
highLineSetting = Profile.fromMgdlToUnits(180d, units);
return highLineSetting;
}
public double determineLowLine() {
Profile profile = MainApp.getConfigBuilder().getProfile();
if (profile == null) {
return bgTargetLow;
}
return determineLowLine(profile.getUnits());
}
public double determineLowLine(String units) {
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
if (lowLineSetting < 1)
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
return lowLineSetting;
}
}

View file

@ -13,7 +13,6 @@ import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -33,6 +32,7 @@ import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.TimeListEdit;
@ -140,7 +140,7 @@ public class LocalProfileFragment extends SubscriberFragment {
return layout;
} catch (Exception e) {
log.error("Unhandled exception: ", e);
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -10,7 +10,6 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import java.util.ArrayList;
@ -22,6 +21,7 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
public class NSProfileFragment extends SubscriberFragment implements AdapterView.OnItemSelectedListener {
@ -56,7 +56,7 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
updateGUI();
return layout;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -13,7 +13,6 @@ import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -27,6 +26,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SafeParse;
public class SimpleProfileFragment extends SubscriberFragment {
@ -137,7 +137,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
return layout;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -15,7 +15,7 @@ import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -42,6 +42,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SetWarnColor;
public class DanaRFragment extends SubscriberFragment {
@ -101,7 +102,7 @@ public class DanaRFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -9,7 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui;
import info.nightscout.androidaps.plugins.PumpInsight.utils.StatusItem;
import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter;
import info.nightscout.utils.FabricPrivacy;
public class InsightPumpFragment extends SubscriberFragment {
@ -64,7 +65,7 @@ public class InsightPumpFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -70,6 +70,7 @@ import static info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers.round
*
*/
@SuppressWarnings("AccessStaticViaInstance")
public class InsightPumpPlugin implements PluginBase, PumpInterface, ConstraintsInterface {
private static final long BUSY_WAIT_TIME = 20000;
@ -91,6 +92,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
private PumpDescription pumpDescription = new PumpDescription();
private double basalRate = 0;
private Connector connector;
private volatile boolean connector_enabled = false;
private final TaskRunner.ResultCallback statusResultHandler = new TaskRunner.ResultCallback() {
@Override
@ -119,7 +121,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
};
private InsightPumpPlugin() {
log("InsightPumpPlugin");
log("InsightPumpPlugin instantiated");
pumpDescription.isBolusCapable = true;
pumpDescription.bolusStep = 0.05d; // specification says 0.05U up to 2U then 0.1U @ 2-5U 0.2U @ 10-20U 0.5U 10-20U (are these just UI restrictions?)
@ -143,12 +145,8 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
pumpDescription.basalMinimumRate = 0.02d;
pumpDescription.isRefillingCapable = true;
//pumpDescription.storesCarbInfo = false; // uncomment when PumpDescription updated to include this
//pumpDescription.storesCarbInfo = false;
this.connector = Connector.get();
this.connector.init();
log("back from init");
}
@ -180,6 +178,31 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
MainApp.bus().post(e);
}
private void enableConnector() {
if (!connector_enabled) {
synchronized (this) {
if (!connector_enabled) {
log("Instantiating connector");
connector_enabled = true;
this.connector = Connector.get();
this.connector.init();
}
}
}
}
private void disableConnector() {
if (connector_enabled) {
synchronized (this) {
if (connector_enabled) {
log("Shutting down connector");
Connector.get().shutdown();
connector_enabled = false;
}
}
}
}
@Override
public String getFragmentClass() {
return InsightPumpFragment.class.getName();
@ -230,7 +253,14 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
@Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
if (type == PUMP) {
if (fragmentEnabled) {
enableConnector();
} else {
disableConnector();
}
this.fragmentEnabled = fragmentEnabled;
}
}
@Override
@ -285,7 +315,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
if (!connector.isPumpConnected()) {
if (Helpers.ratelimit("insight-connect-timer", 40)) {
log("Actually requesting a connect");
connector.getServiceConnector().connect();
connector.connectToPump();
}
} else {
log("Already connected");
@ -306,7 +336,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
try {
if (!SP.getBoolean("insight_always_connected", false)) {
log("Requesting disconnect");
connector.getServiceConnector().disconnect();
connector.disconnectFromPump();
} else {
log("Not disconnecting due to preference");
}
@ -322,7 +352,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
if (isConnecting()) {
if (!SP.getBoolean("insight_always_connected", false)) {
log("Requesting disconnect");
connector.getServiceConnector().disconnect();
connector.disconnectFromPump();
} else {
log("Not disconnecting due to preference");
}
@ -470,6 +500,8 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
if (percent_amount > 250) percent_amount = 250;
final SetTBRTaskRunner task = new SetTBRTaskRunner(connector.getServiceConnector(), percent_amount, durationInMinutes);
final UUID cmd = aSyncTaskRunner(task, "Set TBR abs: " + absoluteRate + " " + durationInMinutes + "m");
@ -616,7 +648,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
final UUID cmd;
if (fauxTBRcancel) {
cmd = aSyncTaskRunner(new SetTBRTaskRunner(connector.getServiceConnector(), 100, 1), "Faux Cancel TBR - setting " + "90%" + " 1m");
cmd = aSyncTaskRunner(new SetTBRTaskRunner(connector.getServiceConnector(), 100, 1), "Faux Cancel TBR - setting " + "90%" + " 1m");
} else {
cmd = aSyncSingleCommand(new CancelTBRMessage(), "Cancel Temp Basal");
}
@ -893,6 +925,16 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
l.add(new StatusItem(gs(R.string.insight_last_completed_action), LiveHistory.getStatus()));
}
final String keep_alive_status = Connector.getKeepAliveString();
if (keep_alive_status != null) {
l.add(new StatusItem(gs(R.string.insight_keep_alive_status), keep_alive_status));
}
final List<StatusItem> status_statistics = connector.getStatusStatistics();
if (status_statistics.size() > 0) {
l.addAll(status_statistics);
}
if (Helpers.ratelimit("insight-status-ui-refresh", 10)) {
connector.tryToGetPumpStatusAgain();
}
@ -910,7 +952,7 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
public void run() {
updateGui();
}
}, 500);
}, 1000);
}
}

View file

@ -3,12 +3,23 @@ package info.nightscout.androidaps.plugins.PumpInsight.connector;
import android.content.Intent;
import android.os.PowerManager;
import com.squareup.otto.Subscribe;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventFeatureRunning;
import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui;
import info.nightscout.androidaps.plugins.PumpInsight.history.HistoryReceiver;
import info.nightscout.androidaps.plugins.PumpInsight.history.LiveHistory;
import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers;
import info.nightscout.androidaps.plugins.PumpInsight.utils.StatusItem;
import info.nightscout.utils.SP;
import sugar.free.sightparser.handling.ServiceConnectionCallback;
import sugar.free.sightparser.handling.SightServiceConnector;
import sugar.free.sightparser.handling.StatusCallback;
@ -31,11 +42,17 @@ import static sugar.free.sightparser.handling.SightService.COMPATIBILITY_VERSION
public class Connector {
// TODO connection statistics
private static final String TAG = "InsightConnector";
private static final String COMPANION_APP_PACKAGE = "sugar.free.sightremote";
private final static long FRESH_MS = 70000;
private static final Map<Status, Long> statistics = new HashMap<>();
private static volatile Connector instance;
private static volatile HistoryReceiver historyReceiver;
private static volatile long stayConnectedTill = -1;
private static volatile long stayConnectedTime = 0;
private static volatile boolean disconnect_thread_running = false;
private volatile SightServiceConnector serviceConnector;
private volatile Status lastStatus = null;
private String compatabilityMessage = null;
@ -47,14 +64,22 @@ public class Connector {
@Override
public synchronized void onStatusChange(Status status) {
log("Status change: " + status);
lastStatus = status;
lastStatusTime = Helpers.tsl();
if (status == Status.CONNECTED) {
lastContactTime = lastStatusTime;
}
if ((status != lastStatus) || (Helpers.msSince(lastStatusTime) > 2000)) {
log("Status change: " + status);
MainApp.bus().post(new EventInsightPumpUpdateGui());
updateStatusStatistics(lastStatus, lastStatusTime);
lastStatus = status;
lastStatusTime = Helpers.tsl();
if (status == Status.CONNECTED) {
lastContactTime = lastStatusTime;
extendKeepAliveIfActive();
}
MainApp.bus().post(new EventInsightPumpUpdateGui());
} else {
log("Same status as before: " + status);
}
}
};
@ -97,6 +122,7 @@ public class Connector {
private Connector() {
initializeHistoryReceiver();
MainApp.bus().register(this);
}
public static Connector get() {
@ -117,10 +143,30 @@ public class Connector {
}
public static void connectToPump() {
log("Attempting to connect to pump");
connectToPump(0);
}
public synchronized static void connectToPump(long keep_alive) {
log("Attempting to connect to pump.");
if (keep_alive > 0) {
stayConnectedTime = keep_alive;
stayConnectedTill = Helpers.tsl() + keep_alive;
log("Staying connected till: " + Helpers.dateTimeText(stayConnectedTill));
delayedDisconnectionThread();
}
get().getServiceConnector().connect();
}
public static void disconnectFromPump() {
if (Helpers.tsl() >= stayConnectedTill) {
log("Requesting real pump disconnect");
get().getServiceConnector().disconnect();
} else {
log("Cannot disconnect as due to keep alive till: " + Helpers.dateTimeText(stayConnectedTill));
// TODO set a disconnection timer?
}
}
static void log(String msg) {
android.util.Log.e("INSIGHTPUMP", msg);
}
@ -160,6 +206,104 @@ public class Connector {
return MainApp.instance().getString(id);
}
private static synchronized void extendKeepAliveIfActive() {
if (keepAliveActive()) {
if (Helpers.ratelimit("extend-insight-keepalive", 10)) {
stayConnectedTill = Helpers.tsl() + stayConnectedTime;
log("Keep-alive extended until: " + Helpers.dateTimeText(stayConnectedTill));
}
}
}
private static boolean keepAliveActive() {
return Helpers.tsl() <= stayConnectedTill;
}
public static String getKeepAliveString() {
if (keepAliveActive()) {
return MainApp.instance().getString(R.string.insight_keepalive_format_string,
stayConnectedTime / 1000, Helpers.hourMinuteSecondString(stayConnectedTill));
} else {
return null;
}
}
private static synchronized void delayedDisconnectionThread() {
if (keepAliveActive()) {
if (!disconnect_thread_running) {
disconnect_thread_running = true;
new Thread(new Runnable() {
@Override
public void run() {
final PowerManager.WakeLock wl = Helpers.getWakeLock("insight-disconnection-timer", 600000);
try {
while (disconnect_thread_running && keepAliveActive()) {
if (Helpers.ratelimit("insight-expiry-notice", 5)) {
log("Staying connected thread expires: " + Helpers.dateTimeText(stayConnectedTill));
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
//
}
}
if (disconnect_thread_running) {
log("Sending the real delayed disconnect");
get().getServiceConnector().disconnect();
} else {
log("Disconnect thread already terminating");
}
} finally {
Helpers.releaseWakeLock(wl);
disconnect_thread_running = false;
}
}
}).start();
} else {
log("Disconnect thread already running");
}
}
}
private static long percentage(long t, long total) {
return (long) (Helpers.roundDouble(((double) t * 100) / total, 0));
}
public synchronized void shutdown() {
if (instance != null) {
log("Attempting to shut down connector");
try {
disconnect_thread_running = false;
try {
instance.serviceConnector.setConnectionCallback(null);
} catch (Exception e) {
//
}
try {
instance.serviceConnector.removeStatusCallback(statusCallback);
} catch (Exception e) {
//
}
try {
instance.serviceConnector.disconnect();
} catch (Exception e) {
log("Exception disconnecting: " + e);
}
try {
instance.serviceConnector.disconnectFromService();
} catch (Exception e) {
log("Excpetion disconnecting service: " + e);
}
instance.serviceConnector = null;
instance = null;
} catch (Exception e) {
log("Exception shutting down: " + e);
}
}
}
@SuppressWarnings("AccessStaticViaInstance")
private synchronized void initializeHistoryReceiver() {
if (historyReceiver == null) {
@ -354,4 +498,57 @@ public class Connector {
return true; // TODO evaluate whether current
}
private void updateStatusStatistics(Status last, long since) {
if ((last != null) && (since > 0)) {
Long total = statistics.get(last);
if (total == null) total = 0L;
statistics.put(last, total + Helpers.msSince(since));
log("Updated statistics for: " + last + " total: " + Helpers.niceTimeScalar(statistics.get(last)));
// TODO persist data
}
}
public List<StatusItem> getStatusStatistics() {
final List<StatusItem> l = new ArrayList<>();
long total = 0;
for (Map.Entry entry : statistics.entrySet()) {
total += getEntryTime(entry);
}
for (Map.Entry entry : statistics.entrySet()) {
if ((long) entry.getValue() > 1000) {
l.add(new StatusItem(gs(R.string.statistics) + " " + Helpers.capitalize(entry.getKey().toString()),
new Formatter().format("%4s %12s",
percentage(getEntryTime(entry), total) + "%",
Helpers.niceTimeScalar(getEntryTime(entry))).toString()));
}
}
return l;
}
private long getEntryTime(Map.Entry entry) {
return (long) entry.getValue() + (entry.getKey().equals(lastStatus) ? Helpers.msSince(lastStatusTime) : 0);
}
@Subscribe
public void onStatusEvent(final EventFeatureRunning ev) {
new Thread(new Runnable() {
@Override
public void run() {
if (isConnected()) {
if (SP.getBoolean("insight_preemptive_connect", true)) {
switch (ev.getFeature()) {
case WIZARD:
log("Wizard feature detected, preconnecting to pump");
connectToPump(120 * 1000);
break;
case MAIN:
log("Main feature detected, preconnecting to pump");
connectToPump(30 * 1000);
break;
}
}
}
}
}).start();
}
}

View file

@ -36,7 +36,10 @@ class HistoryIntentAdapter {
final int pump_tbr_duration = intent.getIntExtra(HistoryBroadcast.EXTRA_DURATION, -1);
final int pump_tbr_percent = intent.getIntExtra(HistoryBroadcast.EXTRA_TBR_AMOUNT, -1);
final int pump_record_id = intent.getIntExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
long pump_record_id = intent.getLongExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
if (pump_record_id == -1) {
pump_record_id = intent.getIntExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
}
final long pump_serial_number = Long.parseLong(intent.getStringExtra(HistoryBroadcast.EXTRA_PUMP_SERIAL_NUMBER));
final Date event_time = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME);
final Date start_time = getDateExtra(intent, HistoryBroadcast.EXTRA_START_TIME);
@ -60,8 +63,11 @@ class HistoryIntentAdapter {
void processDeliveredBolusIntent(Intent intent) {
final String bolus_type = intent.getStringExtra(HistoryBroadcast.EXTRA_BOLUS_TYPE);
final int bolus_id = intent.getIntExtra(HistoryBroadcast.EXTRA_BOLUS_ID,-1);
final int pump_record_id = intent.getIntExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
final int bolus_id = intent.getIntExtra(HistoryBroadcast.EXTRA_BOLUS_ID, -1);
long pump_record_id = intent.getLongExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
if (pump_record_id == -1) {
pump_record_id = intent.getIntExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1);
}
final long pump_serial_number = Long.parseLong(intent.getStringExtra(HistoryBroadcast.EXTRA_PUMP_SERIAL_NUMBER));
final Date event_time = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME);
final Date start_time = getDateExtra(intent, HistoryBroadcast.EXTRA_START_TIME);

View file

@ -162,6 +162,31 @@ public class Helpers {
return niceTimeScalar(t).replaceFirst("^1 ", "");
}
public static String niceTimeScalarBrief(long t) {
// TODO i18n wont work for non-latin characterset
return niceTimeScalar(t).replaceFirst("([a-z])[a-z]*", "$1").replace(" ","");
}
public static String hourMinuteString(long timestamp) {
return android.text.format.DateFormat.format("kk:mm", timestamp).toString();
}
public static String hourMinuteSecondString(long timestamp) {
return android.text.format.DateFormat.format("kk:mm:ss", timestamp).toString();
}
public static String dateTimeText(long timestamp) {
return android.text.format.DateFormat.format("yyyy-MM-dd kk:mm:ss", timestamp).toString();
}
public static String dateText(long timestamp) {
return android.text.format.DateFormat.format("yyyy-MM-dd", timestamp).toString();
}
public static String capitalize(String text) {
return text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
}
public static double roundDouble(double value, int places) {
if (places < 0) throw new IllegalArgumentException("Invalid decimal places");
BigDecimal bd = new BigDecimal(value);

View file

@ -10,7 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -22,6 +22,7 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.utils.FabricPrivacy;
public class VirtualPumpFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class);
@ -63,7 +64,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -97,6 +97,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
pumpDescription.basalMinimumRate = 0.01d;
pumpDescription.isRefillingCapable = false;
pumpDescription.storesCarbInfo = false;
}
@Override

View file

@ -10,7 +10,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -23,6 +22,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
/**
* A simple {@link Fragment} subclass.
@ -47,7 +47,7 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -5,7 +5,6 @@ import android.content.pm.ResolveInfo;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -41,6 +40,7 @@ import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse;
@ -276,7 +276,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bg"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Bg"));
break;
case "LOOP":
if (splited.length > 1)
@ -297,7 +297,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
});
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Stop"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Stop"));
break;
case "ENABLE":
case "START":
@ -309,7 +309,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START"));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Start"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Start"));
break;
case "STATUS":
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
@ -325,7 +325,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Status"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Status"));
break;
case "RESUME":
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
@ -334,7 +334,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
NSUpload.uploadOpenAPSOffline(0);
reply = MainApp.sResources.getString(R.string.smscommunicator_loopresumed);
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Resume"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Resume"));
break;
case "SUSPEND":
if (splited.length >= 3)
@ -351,7 +351,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(suspendWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
suspendWaitingForConfirmation.duration = duration;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Suspend"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Suspend"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecommandnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -370,7 +370,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "TERATMENTS REFRESH " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Treatments_Refresh"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Treatments_Refresh"));
break;
}
break;
@ -384,7 +384,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "NSCLIENT RESTART " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Nsclient_Restart"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Nsclient_Restart"));
break;
}
break;
@ -400,7 +400,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
}
receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Danar"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Danar"));
break;
case "BASAL":
if (splited.length > 1) {
@ -411,7 +411,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
receivedSms.processed = true;
resetWaitingMessages();
sendSMS(cancelTempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -426,7 +426,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(tempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
tempBasalWaitingForConfirmation.tempBasal = tempBasal;
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -451,7 +451,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(bolusWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
bolusWaitingForConfirmation.bolusRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bolus"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Bolus"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -468,7 +468,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages();
sendSMS(calibrationWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
calibrationWaitingForConfirmation.calibrationRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Cal"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Cal"));
} else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecalibrationnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));

View file

@ -12,7 +12,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -29,6 +28,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
/**
@ -63,7 +63,7 @@ public class BGSourceFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -8,7 +8,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsExtende
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsProfileSwitchFragment;
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTempTargetFragment;
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTemporaryBasalsFragment;
import info.nightscout.utils.FabricPrivacy;
public class TreatmentsFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class);
@ -60,7 +61,7 @@ public class TreatmentsFragment extends SubscriberFragment implements View.OnCli
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -17,7 +17,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -38,6 +37,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload;
@ -155,7 +155,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
MainApp.getDbHelper().delete(treatment);
}
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -16,7 +16,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -34,6 +33,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals;
@ -155,7 +155,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id);
}
MainApp.getDbHelper().delete(extendedBolus);
Answers.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -16,7 +16,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe;
@ -34,6 +33,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals;
@ -172,7 +172,7 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id);
}
MainApp.getDbHelper().delete(tempBasal);
Answers.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.Wear;
import android.Manifest;
import android.os.HandlerThread;
import android.support.annotation.NonNull;
@ -644,16 +645,20 @@ public class ActionStringHandler {
detailedBolusInfo.insulin = amount;
detailedBolusInfo.carbs = carbs;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {
sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) +
"\n" +
result.comment);
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {
sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) +
"\n" +
result.comment);
}
}
}
});
});
} else {
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
}
}
private synchronized static void sendError(String errormessage) {

View file

@ -258,11 +258,4 @@ public class WearPlugin implements PluginBase {
public static void unRegisterWatchUpdaterService() {
watchUS = null;
}
public void overviewNotification(int id, String message) {
if(SP.getBoolean("wear_overview_notification", false)){
ActionStringHandler.expectNotificationAction(message, id);
}
}
}

View file

@ -6,6 +6,8 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.BatteryManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.util.Log;
@ -87,6 +89,7 @@ public class WatchUpdaterService extends WearableListenerService implements
private static Logger log = LoggerFactory.getLogger(WatchUpdaterService.class);
private Handler handler;
@Override
public void onCreate() {
@ -96,6 +99,11 @@ public class WatchUpdaterService extends WearableListenerService implements
if (wear_integration) {
googleApiConnect();
}
if (handler == null) {
HandlerThread handlerThread = new HandlerThread(this.getClass().getSimpleName() + "Handler");
handlerThread.start();
handler = new Handler(handlerThread.getLooper());
}
}
public void listenForChangeInSettings() {
@ -128,34 +136,33 @@ public class WatchUpdaterService extends WearableListenerService implements
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = null;
if (intent != null) {
action = intent.getAction();
}
String action = intent != null ? intent.getAction() : null;
if (wear_integration) {
if (googleApiClient.isConnected()) {
if (ACTION_RESEND.equals(action)) {
resendData();
} else if (ACTION_OPEN_SETTINGS.equals(action)) {
sendNotification();
} else if (ACTION_SEND_STATUS.equals(action)) {
sendStatus();
} else if (ACTION_SEND_BASALS.equals(action)) {
sendBasals();
} else if (ACTION_SEND_BOLUSPROGRESS.equals(action)) {
sendBolusProgress(intent.getIntExtra("progresspercent", 0), intent.hasExtra("progressstatus") ? intent.getStringExtra("progressstatus") : "");
} else if (ACTION_SEND_ACTIONCONFIRMATIONREQUEST.equals(action)) {
String title = intent.getStringExtra("title");
String message = intent.getStringExtra("message");
String actionstring = intent.getStringExtra("actionstring");
sendActionConfirmationRequest(title, message, actionstring);
handler.post(() -> {
if (googleApiClient.isConnected()) {
if (ACTION_RESEND.equals(action)) {
resendData();
} else if (ACTION_OPEN_SETTINGS.equals(action)) {
sendNotification();
} else if (ACTION_SEND_STATUS.equals(action)) {
sendStatus();
} else if (ACTION_SEND_BASALS.equals(action)) {
sendBasals();
} else if (ACTION_SEND_BOLUSPROGRESS.equals(action)) {
sendBolusProgress(intent.getIntExtra("progresspercent", 0), intent.hasExtra("progressstatus") ? intent.getStringExtra("progressstatus") : "");
} else if (ACTION_SEND_ACTIONCONFIRMATIONREQUEST.equals(action)) {
String title = intent.getStringExtra("title");
String message = intent.getStringExtra("message");
String actionstring = intent.getStringExtra("actionstring");
sendActionConfirmationRequest(title, message, actionstring);
} else {
sendData();
}
} else {
sendData();
googleApiClient.connect();
}
} else {
googleApiClient.connect();
}
});
}
return START_STICKY;

View file

@ -41,7 +41,7 @@ public class QueueThread extends Thread {
this.queue = queue;
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "QueueThread");
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "QueueThread");
}
@Override

View file

@ -0,0 +1,83 @@
package info.nightscout.utils;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
/**
* Created by jamorham on 21/02/2018.
*
* Some users do not wish to be tracked, Fabric Answers and Crashlytics do not provide an easy way
* to disable them and make calls from a potentially invalid singleton reference. This wrapper
* emulates the methods but ignores the request if the instance is null or invalid.
*
*/
public class FabricPrivacy {
private static final String TAG = "FabricPrivacy";
private static volatile FabricPrivacy instance;
public static FabricPrivacy getInstance() {
if (instance == null) {
initSelf();
}
return instance;
}
private static synchronized void initSelf() {
if (instance == null) {
instance = new FabricPrivacy();
}
}
// Crashlytics logException
public static void logException(Throwable throwable) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.logException(throwable);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + throwable);
}
}
// Crashlytics log
public static void log(String msg) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(msg);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
}
}
// Crashlytics log
public static void log(int priority, String tag, String msg) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(priority, tag, msg);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
}
}
public static boolean fabricEnabled() {
return SP.getBoolean("enable_fabric", true);
}
// Answers logCustom
public void logCustom(CustomEvent event) {
try {
final Answers answers = Answers.getInstance();
if (fabricEnabled()) {
answers.logCustom(event);
} else {
android.util.Log.d(TAG, "Ignoring recently opted-out event: " + event.toString());
}
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted-out non-initialized event: " + event.toString());
}
}
}

View file

@ -7,7 +7,6 @@ import android.content.DialogInterface;
import android.content.ClipboardManager;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import java.io.BufferedReader;
import java.io.IOException;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_cp_bolus_carbs" />
<item android:drawable="@drawable/icon_bolus" />
</layer-list>

View file

@ -401,11 +401,41 @@
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_treatment_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_bolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton"
android:text="@string/overview_insulin_label"
android:textColor="@color/colorInsulinButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_bolus_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_carbs_label"
android:textColor="@color/colorCarbsButton"
android:textSize="10sp"
android:visibility="gone" />
@ -439,6 +469,21 @@
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_cgmbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_xdrip"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_cgm"
android:textColor="@color/colorCalibrationButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_quickwizardbutton"
style="?android:attr/buttonStyle"

View file

@ -606,11 +606,40 @@
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_treatment_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_bolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton"
android:text="@string/overview_insulin_label"
android:textColor="@color/colorInsulinButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_bolus_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_carbs_label"
android:textColor="@color/colorCarbsButton"
android:textSize="10sp" />
<info.nightscout.utils.SingleClickButton
@ -643,6 +672,7 @@
android:textSize="10sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View file

@ -704,12 +704,42 @@
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_treatment_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_bolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" />
android:text="@string/overview_insulin_label"
android:textColor="@color/colorInsulinButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_bolus_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_carbs_label"
android:textColor="@color/colorCarbsButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_wizardbutton"
@ -726,21 +756,6 @@
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_calibrationbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_calibration"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_calibration"
android:textColor="@color/colorCalibrationButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_quickwizardbutton"
style="?android:attr/buttonStyle"

View file

@ -118,7 +118,6 @@
android:gravity="top"
android:orientation="vertical">
<TextView
android:id="@+id/overview_timeago"
android:layout_width="match_parent"
@ -390,11 +389,40 @@
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_treatment_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_bolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton"
android:text="@string/overview_insulin_label"
android:textColor="@color/colorInsulinButton"
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_bolus_carbs"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_carbs_label"
android:textColor="@color/colorCarbsButton"
android:textSize="10sp" />
<info.nightscout.utils.SingleClickButton
@ -427,6 +455,20 @@
android:textSize="10sp"
android:visibility="gone" />
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_cgmbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginRight="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_xdrip"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_cgm"
android:textColor="@color/colorCalibrationButton"
android:textSize="10sp"/>
<info.nightscout.utils.SingleClickButton
android:id="@+id/overview_quickwizardbutton"
style="?android:attr/buttonStyle"

View file

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.Overview.Dialogs.NewCarbsDialog">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/carbs"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorCarbsButton" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:src="@drawable/icon_cp_bolus_carbs" />
<CheckBox
android:id="@+id/newcarbs_activity_tt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:text="Start activity TT"/>
<CheckBox
android:id="@+id/newcarbs_suspend_loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:text="Suspend loop for 30 min"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/newcarbs_eventdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="5dp"
android:text="2017/05/05" />
<TextView
android:id="@+id/newcarb_eventtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="5dp"
android:text="08:20pm" />
</LinearLayout>
<EditText
android:id="@+id/newcarb_food"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="180dp"
android:inputType="text|textCapWords"
android:visibility="gone"/>
<info.nightscout.utils.NumberPicker
android:id="@+id/newcarb_carbsamount"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginBottom="5dp">
<Button
android:id="@+id/newcarbs_plus1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+5" />
<Button
android:id="@+id/newcarbs_plus2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+10" />
<Button
android:id="@+id/newcarbs_plus3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+20" />
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</ScrollView>
</FrameLayout>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.Overview.Dialogs.NewInsulinDialog">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/overview_insulin_label"
android:textColor="@color/colorInsulinButton"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:src="@drawable/icon_bolus" />
<CheckBox
android:id="@+id/newinsulin_start_eating_soon_tt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:text="Start eating soon TT" />
<CheckBox
android:id="@+id/newinsulin_record_only"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Don't bolus, record only" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/newinsulin_eventdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:enabled="false"
android:padding="5dp"
android:text="2017/05/05" />
<TextView
android:id="@+id/newinsulin_eventtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:enabled="false"
android:padding="5dp"
android:text="08:20pm" />
</LinearLayout>
<info.nightscout.utils.NumberPicker
android:id="@+id/treatments_newinsulin_amount"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
<Button
android:id="@+id/newinsulin_plus05"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+0.5" />
<Button
android:id="@+id/newinsulin_plus10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+1.0" />
<Button
android:id="@+id/newinsulin_plus20"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+2.0" />
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
</LinearLayout>
</ScrollView>
</FrameLayout>

View file

@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/bolus"
android:text="@string/overview_treatment_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView

View file

@ -111,7 +111,7 @@
<string name="overview_newtempbasal_basalpercent">Стойност на базал [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = текущ)</string>
<string name="setbasalquestion">Приложи нов временен базал:</string>
<string name="overview_bolus_label">Болус</string>
<string name="overview_treatment_label">Болус</string>
<string name="overview_calculator_label">Калкулатор</string>
<string name="constraintapllied">Приложено ограничение!</string>
<string name="confirmation">Потвърждение</string>

View file

@ -116,7 +116,7 @@
<string name="overview_calculator_label">Kalkulačka</string>
<string name="overview_newtempbasal_basalpercent">Hodnota bazálu [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = současný)</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="profileviewer">NS profil</string>
<string name="objectives_pumpstatusavailableinns">Stav pumpy dostupný v NS</string>
<string name="rate">Hodnota</string>

View file

@ -75,7 +75,7 @@
<string name="openapsma_inputparameters_label">Eingabeparameter</string>
<string name="openapsma_iobdata_label">IOB-Daten</string>
<string name="openloop">Open Loop</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="overview_calculator_label">Rechner</string>
<string name="overview_tempbasal_button">TBR</string>
<string name="rate">Rate</string>
@ -720,7 +720,6 @@
<string name="combo_pump_action_bolusing">Bolus (%.1f IE) wird abgegeben</string>
<string name="alert_dialog_storage_permission_text">Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Andernfalls wird AndroidAPS nicht protokolliert (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert)</string>
<string name="pump_tempbasal_label">TBR</string>
<string name="combo_last_bolus">%.1f IE (%s, %s)</string>
<string name="bolus_frequency_exceeded">Ein gleich großer Bolus wurde in der letzten Minute angefordert. Dies ist nicht zulässig, um ungewollte Doppelboli zu verhindern und vor eventuellen Bugs zu schützen.</string>
<string name="combo_activity_reading_pump_history">Historie wird gelesen</string>
<string name="combo_activity_setting_basal_profile">Basalratenprofil wird aktualisiert</string>

View file

@ -113,7 +113,7 @@
<string name="overview_newtempbasal_basalpercent">Αξία Βασικού[%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = τρέχον)</string>
<string name="setbasalquestion">Αποδοχή νέου Προσ.Ρυθμ:</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="overview_calculator_label">Υπολογιστής</string>
<string name="constraintapllied">Εφαρμοσμένοι Περιορισμοί!</string>
<string name="confirmation">Αποδοχή</string>

View file

@ -104,7 +104,7 @@
<string name="overview_newtempbasal_basalpercent">Valor basal [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = actual)</string>
<string name="setbasalquestion">Aceptar nueva basal temporal:</string>
<string name="overview_bolus_label">Bolo</string>
<string name="overview_treatment_label">Bolo</string>
<string name="overview_calculator_label">Calculadora</string>
<string name="constraintapllied">Restricción aplicada!</string>
<string name="confirmation">Confirmación</string>
@ -436,22 +436,14 @@
<string name="advancedsettings_title">Ajustes avancados</string>
<string name="danar_model" formatted="false">Modelo: %02X Protocolo: %02X Codigo: %02X</string>
<string name="profile">Perfiles</string>
<string name="openapsama_max_daily_safety_multiplier" translatable="false">max_daily_safety_multiplier</string>
<string name="openapsama_max_daily_safety_multiplier_summary">"Valor por defecte: 3 Esto es valor de seguridad establecido pos OpenAPS. Limita tu base al máximo de x3 de tu base máxima. No necesitas cambiar esto, pero debes tener en cuenta, que esto se esta discutiento sobre „3 x max diario; 4x actual“ pro razones de seguridad. "</string>
<string name="openapsama_current_basal_safety_multiplier" translatable="false">current_basal_safety_multiplier</string>
<string name="openapsama_current_basal_safety_multiplier_summary">"Ajuste pro defecto: 4 Esto es la otra mitad de los ajustes de seguridad de OpenAPS y la otra mitad de \"3x max diario, 4x actual\". Esto significa, que tu base no puede ser mas alta que el numero que multiplica tu base. Esto es para evitar que las personas se encuentren en situaciones peligrosas por aumentar mucho la base sin entender el algoritmo del sistema. El ajuste por defecto es x4. La mayoría de las personas nunca tendra que cambiar estos ajustes, si no debe modificar otros ajustes en la terapia. "</string>
<string name="openapsama_autosens_max" translatable="false">autosens_max</string>
<string name="openapsama_autosens_max_summary">"Ajuste por defecto: 1.2\nEsto es un multilicador para autosens (y pronto autotune) para poner un 20% limite máximo a la cota de autosens ratio, la que determina cuantos ajustes autosens puede hacer a la base, a cuanto puede ajustar ISF y a cuanto puede bajar el objective de glucosa. "</string>
<string name="openapsama_autosens_min" translatable="false">autosens_min</string>
<string name="openapsama_autosens_min_summary">Ajuste pro defecto: 0.7\nEl otro lade de limitaciones de seguridad de autosens, limitando a cuanto puede bajar la base y a cuanto puede subir ISF y BG objectivos.</string>
<string name="openapsama_autosens_adjusttargets" translatable="false">autosens_adjust_targets</string>
<string name="openapsama_autosens_adjusttargets_summary">Ajuste pro defcto: true\nEsto se usa para permitir autosens a ajustar objectivos BG en addicion a ISF y bases.</string>
<string name="openapsama_bolussnooze_dia_divisor" translatable="false">bolussnooze_dia_divisor</string>
<string name="openapsama_bolussnooze_dia_divisor_summary">Ajuste pro defecto: 2 \nDormir bolo es iniciado después de proveder un bolo para comida, así el loop no interactuará con low temps cuando acabas de comer. El ajuste pro defecto es 2; quiere decir con el DIA de 3 h el bolo será dormido por fases por 1.5 h (3DIA/2).</string>
<string name="openapsama_min_5m_carbimpact" translatable="false">5_min_carb_impact</string>
<string name="openapsama_min_5m_carbimpact_summary">"Ajustes pro defecto: 3.0\nEsto es un ajuste pro defecto para la absorcion de carbohidratos pro 5 minutos. Por defecto se espera 3mg/dl/5min. Esto afecta la velocidad de reduccion de COB y cuanta absorcion se usa para calcular el BG futuro previsto, si la glucosa diminua mas de lo previsto o aumenta mas de lo previsto. "</string>
<string name="openapsama_link_to_preferncejson_doc_txt">"Atención!\nNormalment no tienes que editar los valores a continuacion. Por favor PINCHA AQUI y LEE el texto y PROCURA ENTENDER antes de cambiar alguno de los valores. "</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="smscommunicator_invalidphonennumber">numero de telefonp incorrecto</string>
<string name="copy_to_clipboard">Copiar al Clipboard</string>
<string name="copied_to_clipboard">Copiado al clipboard</string>
@ -627,8 +619,6 @@
<string name="valuesnotstored">Valores no guardados!</string>
<string name="wear_overviewnotifications">Resumen avisos</string>
<string name="wear_overviewnotifications_summary">Mandar resumen de avisos como avisos de confirmacion por reloj.</string>
<string name="combopump" translatable="false">Accu-Chek Combo</string>
<string name="combopump_shortname" translatable="false">COMBO</string>
<string name="ns_localbroadcasts">Activar mensajes a otras aplicaciones (como xDrip).</string>
<string name="ns_localbroadcasts_title">Activar mensajes locales.</string>
<string name="careportal_activity_label">ACTIVITY Y FEEDBACK</string>
@ -739,7 +729,6 @@
<string name="combo_pump_activity_label">Actividad</string>
<string name="combo_no_pump_connection" formatted="false">Ninguna coneccnion por %d min</string>
<string name="combo_tbr_remaining" formatted="false">%d%% (%d min restan)</string>
<string name="combo_last_bolus" formatted="false">%.1f U (%s, %s)</string>
<string name="combo_pump_action_initializing">Iniciando</string>
<string name="combo_pump_state_disconnected">Desconectado</string>
<string name="combo_pump_state_suspended_due_to_error">Apagado por error</string>

View file

@ -108,7 +108,7 @@
<string name="overview_newtempbasal_basalpercent">Valeur Basal [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="setbasalquestion">Acceptez nouveau basal temp</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="overview_calculator_label">Calculateur de Bolus</string>
<string name="constraintapllied">Restriction appliquée!</string>
<string name="confirmation">Confirmation</string>
@ -742,8 +742,6 @@
<string name="combo_pump_state_running">En cours d\'exécution</string>
<string name="openapssmb">OpenAPS SMB</string>
<string name="smb_shortname">SMB</string>
<string name="key_use_smb">utiliser-smb</string>
<string name="key_use_uam">utiliser-uam</string>
<string name="enableuam">Activer UAM</string>
<string name="enablesmb">Activer SMB</string>
<string name="enablesmb_summary">Utiliser les Super Micro Bolus au lieu des débits de base temporaires pour une action rapide</string>

View file

@ -294,7 +294,7 @@
<string name="openapsma_run">Avvia ora</string>
<string name="openloop">Apertura Loop</string>
<string name="othersettings_title">Altro</string>
<string name="overview_bolus_label">Boli</string>
<string name="overview_treatment_label">Boli</string>
<string name="overview_bolusprogress_stop">Stop</string>
<string name="overview_calculator_label">Calcolatore</string>
<string name="overview_calibration">Calibrazione</string>

View file

@ -111,7 +111,7 @@
<string name="overview_newtempbasal_basalpercent">기초주입 값 [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = 현재)</string>
<string name="setbasalquestion">새 임시기초주입 적용:</string>
<string name="overview_bolus_label">식사주입</string>
<string name="overview_treatment_label">식사주입</string>
<string name="overview_calculator_label">계산기</string>
<string name="constraintapllied">제한!</string>
<string name="confirmation">확인</string>
@ -445,7 +445,6 @@
<string name="openapsama_bolussnooze_dia_divisor_summary">기본값: 2\n식사주입 후 Bolus snooze가 수행되게 되고, 따라서 식사주입 직후엔 loop가 low temp에 대응하지 않게 됩니다. 기본값이 2일때 예제는 다음과 같습니다; DIA가 3시간일 경우 bolus snooz는 점차적으로 1.5시간에 걸쳐 단계적으로 사라지게 됩니다.(3DIA/2).</string>
<string name="openapsama_min_5m_carbimpact_summary">기본값: 3\n이것은 5분당 기본 탄수화물 흡수량에 대한 설정입니다. 예상되는 기본값은 3mg/dl/5min입니다. 이는 혈당이 예상보다 빨리 떨어지거나 오를때, 얼마나 빨리 COB가 감쇠하는지와 혈당예측을 위한 계산시 탄수화물 흡수량이 얼마나 될것으로 예상되는지에 영향을 미치게 됩니다.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">주의!\n보통의 경우 아래의 값을 변경하면 안됩니다. 이 값들을 변경하기 전에 반드시 이곳을 클릭하고 글을 정독해서 확실하게 이해를 하여야 합니다.</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="error_only_numeric_digits_allowed">숫자만 입력가능합니다.</string>
<string name="error_only_numeric_digits_range_allowed" formatted="false">이 범위(%1$s - %2$s)안에 해당하는 숫자만 입력가능합니다.</string>
<string name="error_field_must_not_be_empty">필수 입력 항목입니다.</string>

View file

@ -230,7 +230,6 @@
<string name="icmissing">KH ratio ontbreekt in profieel. Standaard waarde toegepast</string>
<string name="import_from">Importeer instellingen van</string>
<string name="initializing">Initialisering</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="danar_history_bolus">Bulossen</string>
<string name="danar_history_carbohydrates">Koolhydraten</string>
<string name="danar_history_errors">Storing</string>
@ -409,7 +408,7 @@
<string name="othersettings_title">Andere</string>
<string name="openapsma_nopump">Geen pomp beschikbaar</string>
<string name="overview">Overzicht</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="overview_bolusprogress_delivered">Toegediend</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Er worden %.2fE toegediend</string>
<string name="overview_bolusprogress_stop">Stop</string>
@ -735,8 +734,7 @@
<string name="combo_refresh">Vernieuw</string>
<string name="combo_pump_state_label">Status</string>
<string name="combo_no_pump_connection">Geen verbinding</string><string name="combo_tbr_remaining">%d%% (%d min resterend)</string>
<string name="combo_last_bolus">%.1f E (%s, %s)</string>
<string name="combo_pump_action_initializing">Initialiseren</string>
<string name="combo_pump_action_initializing">Initialiseren</string>
<string name="combo_pump_state_disconnected">Verbinding verbroken</string>
<string name="combo_error_bolus_recovery_progress">Herstel van verbroken verbindng</string>
<string name="combo_warning">Waarschuwing</string>

View file

@ -469,7 +469,6 @@
<string name="openapsama_bolussnooze_dia_divisor_summary">Valoare implicită: 2\nAmânarea bolusului este aplicată după ce ați făcut un bolus de masă, astfel încât bucla să nu reacționeze cu ținte bazale temporare scăzute atunci când tocmai ați mâncat. Exemplul de față și valoarea implicită sunt 2; astfel o durată de acțiune a insulinei (DIA) de 3 ore duce la o eliminare treptată a întârzierii setării bazalelor temporare după 1.5 ore (3DIA/2).</string>
<string name="openapsama_min_5m_carbimpact_summary">Valoare implicită: 3.0\nAceasta este o setare ce privește impactul carbohidraților pe o durată de 5 minute. Valoarea implicită este de așteptat a fi 3mg/dl/5min. Aceasta afectează cât de mult se scade valoarea COB și cât de mare este presupusă a fi absorbția de carbohidrați în calcularea valorii prezise a glicemiei, atunci când glicemia scade cu mai mult decât s-a estimat sau când nu crește așa cum s-a așteptat.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Atenție!\nÎn mod normal nu este nevoie să modificați valorile de mai jos. Vă rog să APĂSAȚI AICI și să CITIȚI textul și să vă asigurați că l-ați ÎNȚELES înainte de a schimba valorile.</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="error_only_numeric_digits_allowed">Se acceptă numai valori numerice.</string>
<string name="error_only_numeric_digits_range_allowed">Se acceptă numai valori numerice între %1s - %2s.</string>
<string name="error_field_must_not_be_empty">Acest câmp nu trebuie lăsat necompletat</string>

View file

@ -333,7 +333,6 @@
<string name="openapsama_autosens_min_summary">по умолчанию:0.7 Еще один параметр безопасности autosens, определяющий как низко он может опускать базал и как высоко поднимать ISF (чувств к инс) и целевые СК</string>
<string name="openapsama_bolussnooze_dia_divisor_summary">значение по умолчанию :2 bolus snoose активируется после введения болюса на еду чтобы цикл не взаимодействовал с временными низкими СК сразу после еды. так, трехчасовой DIA при величине 2 означает постыпенное затихание bolus snooze после 1.5 часов (3DIA/2)</string>
<string name="openapsama_current_basal_safety_multiplier_summary">значение по умолчанию: 4 . Это вторая половина обеспечения безопасности OpenAPS из дуэта \"максимум 3x ежедневное; 4x текущее\" Означает что ваша база независимо от установок помпы не может быть выше чем это число умноженное на текущее значение базала. Ограничение для того, чтобы предотвратить вторжение в опасную зону из-за высокого уровня установленных значений базы без понимания алгоритма работы приложения. Большинству людей никогда не потребуется изменять это значение, скорее всего нужно поменять другие настройки если вы чувствуете, что вам мешает это ограничение.</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Внимание! Обычно нет необходимости изменять приведенные ниже величины. Нажмите ЗДЕСЬ, ПРОЧТИТЕ и убедитесь что вы ПОНИМАЕТЕ изложенное прежде чем менять какую-либо из этих величин</string>
<string name="openapsama_max_daily_safety_multiplier_summary">значение по умолчанию:3 Это ключевой ограничитель безопасности OpenAPS. Он ограничивает величину вашего базала максимум до 3x максимума. Вам вероятно не понадобится менять эту величину но вам следует понимать, что она входит в формулу дуэта \"максимум 3x ежедневное; 4x текущее\"</string>
<string name="openapsama_min_5m_carbimpact_summary">значение по умолчанию :3 усвоение углеводов за 5 мин. то есть 3 мг/дл/ 5 мин. Влияет на расчет прогнозируемой гликемии, когда СК падает быстрее или не растет так как ожидается.</string>
@ -366,7 +365,7 @@
<string name="openloop_newsuggestion">есть новое предложение</string>
<string name="othersettings_title">другое</string>
<string name="overview">начало</string>
<string name="overview_bolus_label">болюс</string>
<string name="overview_treatment_label">болюс</string>
<string name="overview_bolusprogress_delivered">доставлено</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">будет доставлено %.2fU е инс</string>
<string name="overview_bolusprogress_stop">стоп</string>

View file

@ -470,7 +470,7 @@
<string name="overview_bolusprogress_stop">Stopp</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Kommer tillföra %.2fU</string>
<string name="overview_bolusprogress_delivered">Tillförd</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Bolus</string>
<string name="overview">Översikt</string>
<string name="othersettings_title">Andra</string>
<string name="openloop_newsuggestion">Ny behandlingsrekommendation tillgänglig</string>
@ -560,7 +560,6 @@
<string name="mdi">MDI</string>
<string name="nsclientinternal">NSClient</string>
<string name="nsclientinternal_autoscroll">Autoscroll</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="overview_newtempbasal_basaltype_label">Basal typ</string>
<string name="sensitivity_shortname">SENS</string>
<string name="sensitivity_warning">Genom att slå på Autosens funktionen, kom ihåg att skriva in alla KH. Annars kommer programmet göra fel i beräkningar av känslighet (ISF)!!</string>

View file

@ -24,6 +24,7 @@
<item>@string/ro_lang</item>
<item>@string/ru_lang</item>
<item>@string/sv_lang</item>
<item>@string/zh_lang</item>
</string-array>
<string-array name="languagesValues" translatable="false">
<item>en</item>
@ -39,6 +40,7 @@
<item>ro</item>
<item>ru</item>
<item>sv</item>
<item>zh-rCN</item>
</string-array>
<string-array name="ageArray">
@ -104,5 +106,4 @@
<item>@string/yes</item>
</string-array>
<string name="fr_lang">French</string>
</resources>

View file

@ -41,6 +41,8 @@
<color name="colorAcceptTempButton">#f4d700</color>
<color name="colorTreatmentButton">#67dfe8</color>
<color name="colorInsulinButton">#67dfe8</color>
<color name="colorCarbsButton">#ffae01</color>
<color name="colorCalibrationButton">#e93057</color>
<color name="colorCalculatorButton">#67e86a</color>
<color name="colorQuickWizardButton">#ffae01</color>

View file

@ -117,7 +117,7 @@
<string name="overview_newtempbasal_basalpercent">Basal value [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="setbasalquestion">Accept new temp basal:</string>
<string name="overview_bolus_label">Bolus</string>
<string name="overview_treatment_label">Treatment</string>
<string name="overview_calculator_label">Calculator</string>
<string name="constraintapllied">Constraint applied!</string>
<string name="confirmation">Confirmation</string>
@ -212,6 +212,8 @@
<string name="ro_lang">Romanian</string>
<string name="ru_lang">Russian</string>
<string name="sv_lang">Swedish</string>
<string name="fr_lang">French</string>
<string name="zh_lang">Chinese</string>
<string name="openapsma_maxbasal_title">Max U/hr a Temp Basal can be set to</string>
<string name="openapsma_maxbasal_summary">This value is called max basal in OpenAPS context</string>
<string name="openapsma_maxiob_title">Maximum basal IOB OpenAPS can deliver [U]</string>
@ -681,8 +683,8 @@
<string name="valuesnotstored">Values not stored!</string>
<string name="wear_overviewnotifications">Overview Notifications</string>
<string name="wear_overviewnotifications_summary">Pass the Overview Notifications through as wear confirmation messages.</string>
<string name="combopump" translatable="false">Accu-Chek Combo</string>
<string name="combopump_shortname" translatable="false">COMBO</string>
<string name="combopump">Accu-Chek Combo</string>
<string name="combopump_shortname">COMBO</string>
<string name="ns_localbroadcasts">Enable broadcasts to other apps (like xDrip).</string>
<string name="ns_localbroadcasts_title">Enable local Broadcasts.</string>
<string name="careportal_activity_label">ACTIVITY &amp; FEEDBACK</string>
@ -693,8 +695,8 @@
<string name="careportal_newnstreatment_duration_min_label">Duration [min]</string>
<string name="openapssmb">OpenAPS SMB</string>
<string name="smb_shortname">SMB</string>
<string name="key_use_smb">use_smb</string>
<string name="key_use_uam">use_uam</string>
<string name="key_use_smb" translatable="false">use_smb</string>
<string name="key_use_uam" translatable="false">use_uam</string>
<string name="enableuam">Enable UAM</string>
<string name="enablesmb">Enable SMB</string>
<string name="enablesmb_summary">Use Super Micro Boluses instead of temp basal for faster action</string>
@ -793,7 +795,7 @@
<string name="customapp">Customized APK for download</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
<string name="smbmaxminutes">45 60 75 90 105 120</string>
<string name="smbmaxminutes" translatable="false">45 60 75 90 105 120</string>
<string name="smbmaxminutes_summary">Max minutes of basal to limit SMB to</string>
<string name="key_smbmaxminutes" translatable="false">smbmaxminutes</string>
<string name="unsupportedfirmware">Unsupported pump firmware</string>
@ -911,6 +913,12 @@
<string name="day">day</string>
<string name="week">week</string>
<string name="time_plural">s</string>
<string name="insight_keepalive_format_string">%ds expires %s</string>
<string name="insight_keep_alive_status">Keep-alive status</string>
<string name="statistics">Statistics</string>
<string name="connect_preemptively">Connect preemptively</string>
<string name="automatically_connect_when">Automatically connect when AndroidAPS screens are opened, before any pump command is requested, to reduce connection delay</string>
<string name="not_recommended_due_to_battery_drain">Not recommended due to battery drain</string>
<string name="key_enableSMB_always" translatable="false">enableSMB_always</string>
<string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string>
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>
@ -928,14 +936,39 @@
<string name="enablesmbwithhightemptarget_summary">Enable SMB when there is high temp target active (exercise)</string>
<string name="let_temp_basal_run">Let current temp basal run</string>
<string name="mute">Mute</string>
<string name="overview_insulin_label">Insulin</string>
<string name="overview_carbs_label">Carbs</string>
<string name="overview_buttons_selection">Buttons</string>
<string name="key_show_calibration_button" translatable="false">show_calibration_button</string>
<string name="key_show_cgm_button" translatable="false">show_cgm_button</string>
<string name="key_show_carbs_button" translatable="false">show_carbs_button</string>
<string name="key_show_wizard_button" translatable="false">show_wizard_button</string>
<string name="key_show_insulin_button" translatable="false">show_insulin_button</string>
<string name="key_show_treatment_button" translatable="false">show_treatment_button</string>
<string name="show_calibration_button_summary">Sends a calibration to xDrip+ or open G5 calibration dialog</string>
<string name="show_cgm_button_summary">Opens xDrip+, back buttons returns to AAPS</string>
<string name="key_insulin_button_increment_1" translatable="false">insulin_button_increment_1</string>
<string name="key_insulin_button_increment_2" translatable="false">insulin_button_increment_2</string>
<string name="key_insulin_button_increment_3" translatable="false">insulin_button_increment_3</string>
<string name="key_carbs_button_increment_1" translatable="false">carbs_button_increment_1</string>
<string name="key_carbs_button_increment_2" translatable="false">carbs_button_increment_2</string>
<string name="key_carbs_button_increment_3" translatable="false">carbs_button_increment_3</string>
<string name="carb_increment_button_message">Number of carbs to add when button is pressed</string>
<string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string>
<string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string>
<string name="overview_cgm">CGM</string>
<string name="nav_historybrowser">History browser</string>
<string name="wear_notifysmb_title">Notify on SMB</string>
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
<string name="key_ns_create_announcements_from_errors">ns_create_announcements_from_errors</string>
<string name="key_ns_create_announcements_from_errors" translatable="false">ns_create_announcements_from_errors</string>
<string name="ns_create_announcements_from_errors_title">Create announcements from errors</string>
<string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string>
<string name="dexcomG5_shortname" translatable="false">G5</string>
<string name="wear_predictions_summary">Show the predictions on the watchface.</string>
<string name="wear_predictions_title">Predictions</string>
<string name="data_choices">Data Choices</string>
<string name="fabric_upload">Fabric Upload</string>
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</string>
<string name="g5appnotdetected">Please update your G5 app to supported version</string>
</resources>

View file

@ -63,9 +63,9 @@
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/openapsama_current_basal_safety_multiplier"
validate:maxNumber="10"
validate:minNumber="1"
validate:testType="numericRange" />
validate:floatmaxNumber="10"
validate:floatminNumber="1"
validate:testType="floatNumericRange" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:defaultValue="1.2"
android:dialogMessage="@string/openapsama_autosens_max_summary"
@ -122,6 +122,15 @@
android:summary="@string/btwatchdog_summary"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/data_choices">
<SwitchPreference
android:defaultValue="true"
android:key="enable_fabric"
android:title="@string/fabric_upload"
android:summary="@string/allow_automated_crash_reporting"/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -7,7 +7,13 @@
<SwitchPreference
android:defaultValue="false"
android:key="insight_always_connected"
android:title="@string/insight_stay_always_connected" />
android:title="@string/insight_stay_always_connected"
android:summary="@string/not_recommended_due_to_battery_drain"/>
<SwitchPreference
android:defaultValue="true"
android:key="insight_preemptive_connect"
android:title="@string/connect_preemptively"
android:summary="@string/automatically_connect_when"/>
<SwitchPreference
android:defaultValue="false"
android:key="insight_real_tbr_cancel"

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory android:title="@string/overview">
<PreferenceScreen android:title="@string/overview_buttons_selection">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_show_treatment_button"
android:title="Treatments" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_show_wizard_button"
android:title="@string/overview_calculator_label"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_show_insulin_button"
android:title="Insulin" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_insulin_button"
validate:testType="floatNumericRange"
validate:floatminNumber="0.1"
validate:floatmaxNumber="5.0"
android:defaultValue="0.5"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="First insulin increment"
android:dialogMessage="@string/insulin_increment_button_message"
android:key="@string/key_insulin_button_increment_1" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_insulin_button"
validate:testType="floatNumericRange"
validate:floatminNumber="0.1"
validate:floatmaxNumber="5.0"
android:defaultValue="1.0"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="Second insulin increment"
android:dialogMessage="@string/insulin_increment_button_message"
android:key="@string/key_insulin_button_increment_2" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_insulin_button"
validate:testType="floatNumericRange"
validate:floatminNumber="0.1"
validate:floatmaxNumber="5.0"
android:defaultValue="2.0"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="Third insulin increment"
android:dialogMessage="@string/insulin_increment_button_message"
android:key="@string/key_insulin_button_increment_3"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_show_carbs_button"
android:title="Carbs" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_carbs_button"
validate:testType="numeric"
validate:minNumber="1"
validate:maxNumber="50"
android:defaultValue="5"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="First carbs increment"
android:dialogMessage="@string/carb_increment_button_message"
android:key="@string/key_carbs_button_increment_1" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_carbs_button"
validate:testType="numeric"
validate:minNumber="1"
validate:maxNumber="50"
android:defaultValue="10"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="Second carbs increment"
android:dialogMessage="@string/carb_increment_button_message"
android:key="@string/key_carbs_button_increment_2" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:dependency="@string/key_show_carbs_button"
validate:testType="numeric"
validate:minNumber="1"
validate:maxNumber="50"
android:defaultValue="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:maxLines="20"
android:title="Third carbs increment"
android:dialogMessage="@string/carb_increment_button_message"
android:key="@string/key_carbs_button_increment_3" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_show_cgm_button"
android:title="CGM"
android:summary="@string/show_cgm_button_summary"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_show_calibration_button"
android:title="@string/overview_calibration"
android:summary="@string/show_calibration_button_summary"/>
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -18,6 +18,8 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}