diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index cdd5c59523..9d869cdde6 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -1,20 +1,15 @@ package info.nightscout.androidaps; -import android.Manifest; import android.app.Activity; -import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Rect; -import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.PowerManager; -import android.provider.Settings; import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; @@ -52,24 +47,17 @@ import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.setupwizard.SetupWizardActivity; import info.nightscout.androidaps.tabs.SlidingTabLayout; import info.nightscout.androidaps.tabs.TabPageAdapter; +import info.nightscout.utils.AndroidPermission; import info.nightscout.utils.ImportExportPrefs; import info.nightscout.utils.LocaleHelper; import info.nightscout.utils.LogDialog; import info.nightscout.utils.OKDialog; import info.nightscout.utils.PasswordProtection; import info.nightscout.utils.SP; -import info.nightscout.utils.ToastUtils; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(MainActivity.class); - static final int CASE_STORAGE = 0x1; - static final int CASE_SMS = 0x2; - static final int CASE_LOCATION = 0x3; - - private boolean askForSMS = false; - private boolean askForLocation = true; - ImageButton menuButton; protected PowerManager.WakeLock mWakeLock; @@ -77,32 +65,49 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + if (Config.logFunctionCalls) + log.debug("onCreate"); + Iconify.with(new FontAwesomeModule()); LocaleHelper.onCreate(this, "en"); setContentView(R.layout.activity_main); menuButton = (ImageButton) findViewById(R.id.overview_menuButton); menuButton.setOnClickListener(this); - checkEula(); - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { - askForPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE}, CASE_STORAGE); - } - askForBatteryOptimizationPermission(); + onStatusEvent(new EventSetWakeLock(SP.getBoolean("lockscreen", false))); + doMigrations(); + registerBus(); + setUpTabs(false); + } + + @Override + protected void onResume() { + super.onResume(); + if (!SP.getBoolean(R.string.key_setupwizard_processed, false)) { Intent intent = new Intent(this, SetupWizardActivity.class); startActivity(intent); + } else { + checkEula(); } - if (Config.logFunctionCalls) - log.debug("onCreate"); + AndroidPermission.notifyForStoragePermission(this); + AndroidPermission.notifyForBatteryOptimizationPermission(this); + AndroidPermission.notifyForLocationPermissions(this); + AndroidPermission.notifyForSMSPermissions(this); - onStatusEvent(new EventSetWakeLock(SP.getBoolean("lockscreen", false))); + MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.MAIN)); + } - registerBus(); - setUpTabs(false); + @Override + public void onDestroy() { + if (mWakeLock != null) + if (mWakeLock.isHeld()) + mWakeLock.release(); + super.onDestroy(); } @Subscribe @@ -212,120 +217,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe } } - //check for sms permission if enable in prefernces - @Subscribe - public void onStatusEvent(final EventPreferenceChange ev) { - if (ev.isChanged(R.string.key_smscommunicator_remotecommandsallowed)) { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { - synchronized (this) { - if (SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)) { - setAskForSMS(); - } - } - } - } - } - - private synchronized void setAskForSMS() { - askForSMS = true; - } - - @Override - protected void onResume() { - super.onResume(); - askForSMSPermissions(); - askForLocationPermissions(); - MainApp.bus().post(new EventFeatureRunning(EventFeatureRunning.Feature.MAIN)); - } - - @Override - public void onDestroy() { - if (mWakeLock != null) - if (mWakeLock.isHeld()) - mWakeLock.release(); - super.onDestroy(); - } - - private void askForBatteryOptimizationPermission() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - final String packageName = getPackageName(); - - final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - if (!pm.isIgnoringBatteryOptimizations(packageName)) { - log.debug("Requesting ignore battery optimization"); - - OKDialog.show(this, MainApp.gs(R.string.pleaseallowpermission), String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)), new Runnable() { - - @Override - public void run() { - try { - final Intent intent = new Intent(); - - // ignoring battery optimizations required for constant connection - intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - intent.setData(Uri.parse("package:" + packageName)); - startActivity(intent); - - } catch (ActivityNotFoundException e) { - final String msg = MainApp.gs(R.string.batteryoptimalizationerror); - ToastUtils.showToastInUiThread(getApplicationContext(), msg); - log.error(msg); - } - } - }); - } - } - } - - private synchronized void askForSMSPermissions() { - if (askForSMS) { //only when settings were changed an MainActivity resumes. - askForSMS = false; - if (SP.getBoolean(R.string.smscommunicator_remotecommandsallowed, false)) { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { - askForPermission(new String[]{Manifest.permission.RECEIVE_SMS, - Manifest.permission.SEND_SMS, - Manifest.permission.RECEIVE_MMS}, CASE_SMS); - } - } - } - } - - private synchronized void askForLocationPermissions() { - if (askForLocation) { //only when settings were changed an MainActivity resumes. - askForLocation = false; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - askForPermission(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION}, CASE_LOCATION); - } - } - } - - private void askForPermission(String[] permission, Integer requestCode) { - boolean test = false; - for (int i = 0; i < permission.length; i++) { - test = test || (ContextCompat.checkSelfPermission(this, permission[i]) != PackageManager.PERMISSION_GRANTED); - } - if (test) { - ActivityCompat.requestPermissions(this, permission, requestCode); - } - } - @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (permissions.length != 0) { if (ActivityCompat.checkSelfPermission(this, permissions[0]) == PackageManager.PERMISSION_GRANTED) { switch (requestCode) { - case CASE_STORAGE: + case AndroidPermission.CASE_STORAGE: //show dialog after permission is granted AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setMessage(R.string.alert_dialog_storage_permission_text); alert.setPositiveButton(R.string.ok, null); alert.show(); break; - case CASE_LOCATION: - case CASE_SMS: + case AndroidPermission.CASE_LOCATION: + case AndroidPermission.CASE_SMS: + case AndroidPermission.CASE_BATTERY: break; } } @@ -420,13 +327,13 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe if (MainApp.engineeringMode) message += "\n" + MainApp.gs(R.string.engineering_mode_enabled); message += MainApp.gs(R.string.about_link_urls); - final SpannableString messageSpanned = new SpannableString(message); + final SpannableString messageSpanned = new SpannableString(message); Linkify.addLinks(messageSpanned, Linkify.WEB_URLS); builder.setMessage(messageSpanned); builder.setPositiveButton(MainApp.gs(R.string.ok), null); AlertDialog alertDialog = builder.create(); alertDialog.show(); - ((TextView)alertDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); + ((TextView) alertDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); break; case R.id.nav_exit: log.debug("Exiting"); diff --git a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java index 881f2e3bac..f8437d8d36 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -427,9 +427,7 @@ public class DataService extends IntentService { if (bundles.containsKey("sgv")) { String sgvstring = bundles.getString("sgv"); JSONObject sgvJson = new JSONObject(sgvstring); - NSSgv nsSgv = new NSSgv(sgvJson); - BgReading bgReading = new BgReading(nsSgv); - MainApp.getDbHelper().createIfNotExists(bgReading, "NS"); + storeSgv(sgvJson); } if (bundles.containsKey("sgvs")) { @@ -437,9 +435,7 @@ public class DataService extends IntentService { JSONArray jsonArray = new JSONArray(sgvstring); for (int i = 0; i < jsonArray.length(); i++) { JSONObject sgvJson = jsonArray.getJSONObject(i); - NSSgv nsSgv = new NSSgv(sgvJson); - BgReading bgReading = new BgReading(nsSgv); - MainApp.getDbHelper().createIfNotExists(bgReading, "NS"); + storeSgv(sgvJson); } } } catch (Exception e) { @@ -452,11 +448,7 @@ public class DataService extends IntentService { if (bundles.containsKey("mbg")) { String mbgstring = bundles.getString("mbg"); JSONObject mbgJson = new JSONObject(mbgstring); - NSMbg nsMbg = new NSMbg(mbgJson); - CareportalEvent careportalEvent = new CareportalEvent(nsMbg); - MainApp.getDbHelper().createOrUpdate(careportalEvent); - if (Config.logIncommingData) - log.debug("Adding/Updating new MBG: " + careportalEvent.log()); + storeMbg(mbgJson); } if (bundles.containsKey("mbgs")) { @@ -464,11 +456,7 @@ public class DataService extends IntentService { JSONArray jsonArray = new JSONArray(sgvstring); for (int i = 0; i < jsonArray.length(); i++) { JSONObject mbgJson = jsonArray.getJSONObject(i); - NSMbg nsMbg = new NSMbg(mbgJson); - CareportalEvent careportalEvent = new CareportalEvent(nsMbg); - MainApp.getDbHelper().createOrUpdate(careportalEvent); - if (Config.logIncommingData) - log.debug("Adding/Updating new MBG: " + careportalEvent.log()); + storeMbg(mbgJson); } } } catch (Exception e) { @@ -549,6 +537,20 @@ public class DataService extends IntentService { } } + private void storeMbg(JSONObject mbgJson) { + NSMbg nsMbg = new NSMbg(mbgJson); + CareportalEvent careportalEvent = new CareportalEvent(nsMbg); + MainApp.getDbHelper().createOrUpdate(careportalEvent); + if (Config.logIncommingData) + log.debug("Adding/Updating new MBG: " + careportalEvent.log()); + } + + private void storeSgv(JSONObject sgvJson) { + NSSgv nsSgv = new NSSgv(sgvJson); + BgReading bgReading = new BgReading(nsSgv); + MainApp.getDbHelper().createIfNotExists(bgReading, "NS"); + } + private void handleNewSMS(Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null) return; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java index 4a4210f29e..c5f1886265 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java @@ -218,50 +218,19 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli double iageUrgent = nsSettings.getExtendedWarnValue("iage", "urgent", 96); double iageWarn = nsSettings.getExtendedWarnValue("iage", "warn", 72); + handleAge(iage, CareportalEvent.INSULINCHANGE, iageWarn, iageUrgent); + double cageUrgent = nsSettings.getExtendedWarnValue("cage", "urgent", 72); double cageWarn = nsSettings.getExtendedWarnValue("cage", "warn", 48); + handleAge(sage, CareportalEvent.SITECHANGE, cageWarn, cageUrgent); + double sageUrgent = nsSettings.getExtendedWarnValue("sage", "urgent", 166); double sageWarn = nsSettings.getExtendedWarnValue("sage", "warn", 164); + handleAge(sage, CareportalEvent.SENSORCHANGE, sageWarn, sageUrgent); + double pbageUrgent = nsSettings.getExtendedWarnValue("pgage", "urgent", 360); double pbageWarn = nsSettings.getExtendedWarnValue("pgage", "warn", 240); - - String notavailable = OverviewFragment.shorttextmode ? "-" : MainApp.gs(R.string.notavailable); - if (sage != null) { - careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SENSORCHANGE); - if (careportalEvent != null) { - sage.setTextColor(CareportalFragment.determineTextColor(careportalEvent, sageWarn, sageUrgent)); - sage.setText(careportalEvent.age()); - } else { - sage.setText(notavailable); - } - } - if (iage != null) { - careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.INSULINCHANGE); - if (careportalEvent != null) { - iage.setTextColor(CareportalFragment.determineTextColor(careportalEvent, iageWarn, iageUrgent)); - iage.setText(careportalEvent.age()); - } else { - iage.setText(notavailable); - } - } - if (cage != null) { - careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SITECHANGE); - if (careportalEvent != null) { - cage.setTextColor(CareportalFragment.determineTextColor(careportalEvent, cageWarn, cageUrgent)); - cage.setText(careportalEvent.age()); - } else { - cage.setText(notavailable); - } - } - if (pbage != null) { - careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.PUMPBATTERYCHANGE); - if (careportalEvent != null) { - pbage.setTextColor(CareportalFragment.determineTextColor(careportalEvent, pbageWarn, pbageUrgent)); - pbage.setText(careportalEvent.age()); - } else { - pbage.setText(notavailable); - } - } + handleAge(pbage, CareportalEvent.PUMPBATTERYCHANGE, pbageWarn, pbageUrgent); } ); } @@ -277,5 +246,21 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli } } + + private static TextView handleAge(final TextView age, String eventType, double warnThreshold, double urgentThreshold) { + String notavailable = OverviewFragment.shorttextmode ? "-" : MainApp.gs(R.string.notavailable); + + if (age != null) { + CareportalEvent careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(eventType); + if (careportalEvent != null) { + age.setTextColor(CareportalFragment.determineTextColor(careportalEvent, warnThreshold, urgentThreshold)); + age.setText(careportalEvent.age()); + } else { + age.setText(notavailable); + } + } + + return age; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java index 458351cd62..4f2cfa65e0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java @@ -251,6 +251,7 @@ public class ObjectivesFragment extends SubscriberFragment { ObjectivesPlugin.objectives.get(3).gate = MainApp.gs(R.string.objectives_3_gate); ObjectivesPlugin.objectives.get(4).gate = MainApp.gs(R.string.objectives_4_gate); ObjectivesPlugin.objectives.get(5).gate = MainApp.gs(R.string.objectives_5_gate); + ObjectivesPlugin.objectives.get(7).gate = MainApp.gs(R.string.objectives_7_gate); updateGUI(); @@ -272,4 +273,4 @@ public class ObjectivesFragment extends SubscriberFragment { }); } -} \ No newline at end of file +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index 89d66fd891..2e8e16a226 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -347,13 +347,12 @@ public class IobCobCalculatorPlugin extends PluginBase { return null; } - public BasalData getBasalData(long time) { + public BasalData getBasalData(Profile profile, long time) { long now = System.currentTimeMillis(); time = roundUpTime(time); BasalData retval = basalDataTable.get(time); if (retval == null) { retval = new BasalData(); - Profile profile = MainApp.getConfigBuilder().getProfile(time); TemporaryBasal tb = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(time); retval.basal = profile.getBasal(time); if (tb != null) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java index 4ee2427af8..a2b6e64aec 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java @@ -26,14 +26,24 @@ public class BroadcastStatus { private static Logger log = LoggerFactory.getLogger(BroadcastStatus.class); public static void handleNewStatus(NSSettingsStatus status, Context context, boolean isDelta) { + LocalBroadcastManager.getInstance(MainApp.instance()) + .sendBroadcast(createIntent(status, isDelta)); + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { + context.sendBroadcast(createIntent(status, isDelta)); + } + } + + private static Intent createIntent(NSSettingsStatus status, boolean isDelta) { Bundle bundle = new Bundle(); + try { bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName); bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode); } catch (PackageManager.NameNotFoundException e) { log.error("Unhandled exception", e); } + bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName); bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode); bundle.putString("status", status.getData().toString()); @@ -41,24 +51,7 @@ public class BroadcastStatus { Intent intent = new Intent(Intents.ACTION_NEW_STATUS); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { - bundle = new Bundle(); - try { - bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName); - bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode); - } catch (PackageManager.NameNotFoundException e) { - log.error("Unhandled exception", e); - } - bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName); - bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode); - bundle.putString("status", status.getData().toString()); - bundle.putBoolean("delta", isDelta); - intent = new Intent(Intents.ACTION_NEW_STATUS); - intent.putExtras(bundle); - intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); - } + return intent; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index da96241e61..396338efa4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -250,7 +250,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("min_5m_carbimpact", SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)); } mProfile.put("remainingCarbsCap", SMBDefaults.remainingCarbsCap); - mProfile.put("enableUAM", SP.getBoolean(R.string.key_use_uam, false)&& advancedFiltering); + mProfile.put("enableUAM", SP.getBoolean(R.string.key_use_uam, false)); mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable); mProfile.put("enableSMB_with_COB", SP.getBoolean(R.string.key_enableSMB_with_COB, false)); mProfile.put("enableSMB_with_temptarget", SP.getBoolean(R.string.key_enableSMB_with_temptarget, false)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 7d7c0e7efb..31aa098579 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -981,16 +981,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, if (timeView != null) { //must not exists timeView.setText(DateUtil.timeString(new Date())); } + + updateNotifications(); + + pumpStatusLayout.setVisibility(View.GONE); + loopStatusLayout.setVisibility(View.GONE); + if (!MainApp.getConfigBuilder().isProfileValid("Overview")) { pumpStatusView.setText(R.string.noprofileset); pumpStatusLayout.setVisibility(View.VISIBLE); - loopStatusLayout.setVisibility(View.GONE); return; } - pumpStatusLayout.setVisibility(View.GONE); loopStatusLayout.setVisibility(View.VISIBLE); - updateNotifications(); CareportalFragment.updateAge(getActivity(), sage, iage, cage, pbage); BgReading actualBG = DatabaseHelper.actualBg(); BgReading lastBG = DatabaseHelper.lastBg(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index 1c8b27c113..30e2ad97e4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -136,7 +136,9 @@ public class GraphData { double lastBaseBasal = 0; double lastTempBasal = 0; for (long time = fromTime; time < toTime; time += 60 * 1000L) { - BasalData basalData = IobCobCalculatorPlugin.getPlugin().getBasalData(time); + Profile profile = MainApp.getConfigBuilder().getProfile(time); + if (profile == null) continue; + BasalData basalData = IobCobCalculatorPlugin.getPlugin().getBasalData(profile, time); double baseBasalValue = basalData.basal; double absoluteLineValue = baseBasalValue; double tempBasalValue = 0; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java index d4fc034d10..9a374bf3f3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java @@ -60,6 +60,10 @@ public class Notification { public static final int PROFILE_SWITCH_MISSING = 32; public static final int NOT_ENG_MODE_OR_RELEASE = 33; public static final int WRONG_PUMP_PASSWORD = 34; + public static final int PERMISSION_STORAGE = 35; + public static final int PERMISSION_LOCATION = 36; + public static final int PERMISSION_BATTERY = 37; + public static final int PERMISSION_SMS = 38; public int id; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationRecyclerViewAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationRecyclerViewAdapter.java index 5024c2699a..895b99a43e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationRecyclerViewAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationRecyclerViewAdapter.java @@ -42,9 +42,12 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter screens = new ArrayList<>(); public void setActivity(AppCompatActivity activity) { this.activity = activity; + packageName = activity.getPackageName(); } public AppCompatActivity getActivity() { @@ -99,6 +111,57 @@ public class SWDefinition { return SP.contains(R.string.key_language); }) ) + .add(new SWScreen(R.string.end_user_license_agreement) + .skippable(false) + .add(new SWInfotext() + .label(R.string.end_user_license_agreement_text)) + .add(new SWBreak()) + .add(new SWButton() + .text(R.string.end_user_license_agreement_i_understand) + .visibility(() -> !SP.getBoolean(R.string.key_i_understand, false)) + .action(() -> { + SP.putBoolean(R.string.key_i_understand, true); + MainApp.bus().post(new EventSWUpdate(false)); + })) + .visibility(() -> !SP.getBoolean(R.string.key_i_understand, false)) + .validator(() -> SP.getBoolean(R.string.key_i_understand, false)) + ) + .add(new SWScreen(R.string.permission) + .skippable(false) + .add(new SWInfotext() + .label(String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)))) + .add(new SWBreak()) + .add(new SWButton() + .text(R.string.askforpermission) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) + .action(() -> AndroidPermission.askForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, AndroidPermission.CASE_BATTERY))) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) + .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))) + ) + .add(new SWScreen(R.string.permission) + .skippable(false) + .add(new SWInfotext() + .label(MainApp.gs(R.string.needlocationpermission))) + .add(new SWBreak()) + .add(new SWButton() + .text(R.string.askforpermission) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)) + .action(() -> AndroidPermission.askForPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION, AndroidPermission.CASE_LOCATION))) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)) + .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION))) + ) + .add(new SWScreen(R.string.permission) + .skippable(false) + .add(new SWInfotext() + .label(MainApp.gs(R.string.needstoragepermission))) + .add(new SWBreak()) + .add(new SWButton() + .text(R.string.askforpermission) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) + .action(() -> AndroidPermission.askForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE, AndroidPermission.CASE_STORAGE))) + .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) + .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))) + ) .add(new SWScreen(R.string.nsclientinternal_title) .skippable(true) .add(new SWInfotext() @@ -154,11 +217,11 @@ public class SWDefinition { .add(new SWScreen(R.string.configbuilder_insulin) .skippable(false) .add(new SWInfotext() - .label(MainApp.gs(R.string.fastactinginsulincomment) + " = " + MainApp.gs(R.string.rapid_acting_oref))) + .label(MainApp.gs(R.string.rapid_acting_oref) + ": " + MainApp.gs(R.string.fastactinginsulincomment))) .add(new SWInfotext() - .label(MainApp.gs(R.string.ultrafastactinginsulincomment) + " = " + MainApp.gs(R.string.ultrarapid_oref))) + .label(MainApp.gs(R.string.ultrarapid_oref) + ": " + MainApp.gs(R.string.ultrafastactinginsulincomment))) .add(new SWInfotext() - .label(MainApp.gs(R.string.free_peak_oref_description) + " = " + MainApp.gs(R.string.free_peak_oref))) + .label(MainApp.gs(R.string.free_peak_oref) + ": " + MainApp.gs(R.string.free_peak_oref_description))) .add(new SWBreak()) .add(new SWInfotext() .label(R.string.diawarning)) @@ -166,6 +229,18 @@ public class SWDefinition { .add(new SWPlugin() .option(PluginType.INSULIN) .label(R.string.configbuilder_insulin)) + .add(new SWBreak()) + .add(new SWButton() + .text(R.string.insulinsourcesetup) + .action(() -> { + final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActiveInsulin(); + PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> { + Intent i = new Intent(activity, PreferencesActivity.class); + i.putExtra("id", plugin.getPreferencesId()); + activity.startActivity(i); + }, null); + }) + .visibility(() -> MainApp.getConfigBuilder().getActiveInsulin()!= null && ((PluginBase) MainApp.getConfigBuilder().getActiveInsulin()).getPreferencesId() > 0)) .validator(() -> MainApp.getConfigBuilder().getActiveInsulin() != null) ) .add(new SWScreen(R.string.configbuilder_bgsource) diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java index 68ebcafdad..523970d6df 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java @@ -1,10 +1,14 @@ package info.nightscout.androidaps.setupwizard; import android.content.Intent; +import android.content.pm.PackageManager; import android.os.Bundle; +import android.support.v4.app.ActivityCompat; +import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.LinearLayout; +import android.widget.ScrollView; import android.widget.TextView; import com.squareup.otto.Subscribe; @@ -24,6 +28,7 @@ import info.nightscout.androidaps.plugins.ConstraintsObjectives.events.EventObje import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus; import info.nightscout.androidaps.setupwizard.elements.SWItem; import info.nightscout.androidaps.setupwizard.events.EventSWUpdate; +import info.nightscout.utils.AndroidPermission; import info.nightscout.utils.LocaleHelper; import info.nightscout.utils.OKDialog; import info.nightscout.utils.SP; @@ -32,6 +37,8 @@ public class SetupWizardActivity extends AppCompatActivity { //logging private static Logger log = LoggerFactory.getLogger(SetupWizardActivity.class); + ScrollView scrollView; + private SWDefinition swDefinition = new SWDefinition(); private List screens = swDefinition.getScreens(); private int currentWizardPage = 0; @@ -43,6 +50,8 @@ public class SetupWizardActivity extends AppCompatActivity { LocaleHelper.onCreate(this, "en"); setContentView(R.layout.activity_setupwizard); + scrollView = (ScrollView) findViewById(R.id.sw_scrollview); + Intent intent = getIntent(); currentWizardPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE, 0); if (screens.size() > 0 && currentWizardPage < screens.size()) { @@ -66,6 +75,7 @@ public class SetupWizardActivity extends AppCompatActivity { } public void exitPressed(View view) { + SP.putBoolean(R.string.key_setupwizard_processed, true); OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish); } @@ -121,6 +131,7 @@ public class SetupWizardActivity extends AppCompatActivity { SWItem currentItem = currentScreen.items.get(i); currentItem.generateDialog(this.findViewById(R.id.sw_content_fields), layout); } + scrollView.smoothScrollTo(0,0); } private void updateButtons() { @@ -166,6 +177,7 @@ public class SetupWizardActivity extends AppCompatActivity { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); + finish(); } private int nextPage() { @@ -180,11 +192,35 @@ public class SetupWizardActivity extends AppCompatActivity { private int previousPage() { int page = currentWizardPage - 1; - while (page > 0) { + while (page >= 0) { if (screens.get(page).visibility == null || screens.get(page).visibility.isValid()) return page; page--; } return currentWizardPage; } + + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + if (permissions.length != 0) { + if (ActivityCompat.checkSelfPermission(this, permissions[0]) == PackageManager.PERMISSION_GRANTED) { + switch (requestCode) { + case AndroidPermission.CASE_STORAGE: + //show dialog after permission is granted + AlertDialog.Builder alert = new AlertDialog.Builder(this); + alert.setMessage(R.string.alert_dialog_storage_permission_text); + alert.setPositiveButton(R.string.ok, null); + alert.show(); + break; + case AndroidPermission.CASE_LOCATION: + case AndroidPermission.CASE_SMS: + case AndroidPermission.CASE_BATTERY: + break; + } + } + } + updateButtons(); + } + } diff --git a/app/src/main/java/info/nightscout/utils/AndroidPermission.java b/app/src/main/java/info/nightscout/utils/AndroidPermission.java new file mode 100644 index 0000000000..ca3cac82f1 --- /dev/null +++ b/app/src/main/java/info/nightscout/utils/AndroidPermission.java @@ -0,0 +1,94 @@ +package info.nightscout.utils; + +import android.Manifest; +import android.app.Activity; +import android.content.Context; +import android.content.pm.PackageManager; +import android.os.Build; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; +import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; +import info.nightscout.androidaps.plugins.Overview.notifications.Notification; +import info.nightscout.androidaps.plugins.Overview.notifications.NotificationWithAction; + +public class AndroidPermission { + + public static final int CASE_STORAGE = 0x1; + public static final int CASE_SMS = 0x2; + public static final int CASE_LOCATION = 0x3; + public static final int CASE_BATTERY = 0x4; + + public static void askForPermission(Activity activity, String[] permission, Integer requestCode) { + boolean test = false; + for (int i = 0; i < permission.length; i++) { + test = test || (ContextCompat.checkSelfPermission(activity, permission[i]) != PackageManager.PERMISSION_GRANTED); + } + if (test) { + ActivityCompat.requestPermissions(activity, permission, requestCode); + } + } + + public static void askForPermission(Activity activity, String permission, Integer requestCode) { + String[] permissions = {permission}; + + if (ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) + ActivityCompat.requestPermissions(activity, permissions, requestCode); + } + + public static boolean checkForPermission(Context context, String permission) { + return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; + } + + public static synchronized void notifyForSMSPermissions(Activity activity) { + if (SP.getBoolean(R.string.smscommunicator_remotecommandsallowed, false)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { + if (!checkForPermission(activity, Manifest.permission.RECEIVE_SMS)) { + NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_SMS, MainApp.gs(R.string.smscommunicator_missingsmspermission), Notification.URGENT); + notification.action(MainApp.gs(R.string.request), () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.RECEIVE_SMS, + Manifest.permission.SEND_SMS, + Manifest.permission.RECEIVE_MMS}, AndroidPermission.CASE_SMS)); + MainApp.bus().post(new EventNewNotification(notification)); + } else + MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_SMS)); + } + } + } + + public static synchronized void notifyForBatteryOptimizationPermission(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (!checkForPermission(activity, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) { + NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_BATTERY, String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)), Notification.URGENT); + notification.action(MainApp.gs(R.string.request), () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}, AndroidPermission.CASE_BATTERY)); + MainApp.bus().post(new EventNewNotification(notification)); + } else + MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_BATTERY)); + } + } + + public static synchronized void notifyForStoragePermission(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (!checkForPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { + NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_STORAGE, MainApp.gs(R.string.needstoragepermission), Notification.URGENT); + notification.action(MainApp.gs(R.string.request), () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE}, AndroidPermission.CASE_STORAGE)); + MainApp.bus().post(new EventNewNotification(notification)); + } else + MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_STORAGE)); + } + } + + public static synchronized void notifyForLocationPermissions(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (!checkForPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION)) { + NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_LOCATION, MainApp.gs(R.string.needlocationpermission), Notification.URGENT); + notification.action(MainApp.gs(R.string.request), () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, AndroidPermission.CASE_LOCATION)); + MainApp.bus().post(new EventNewNotification(notification)); + } else + MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_LOCATION)); + } + } +} diff --git a/app/src/main/java/info/nightscout/utils/NSUpload.java b/app/src/main/java/info/nightscout/utils/NSUpload.java index 2e5506f9c6..00d5e39821 100644 --- a/app/src/main/java/info/nightscout/utils/NSUpload.java +++ b/app/src/main/java/info/nightscout/utils/NSUpload.java @@ -289,19 +289,7 @@ public class NSUpload { public static void uploadProfileSwitch(ProfileSwitch profileSwitch) { try { - JSONObject data = new JSONObject(); - data.put("eventType", CareportalEvent.PROFILESWITCH); - data.put("duration", profileSwitch.durationInMinutes); - data.put("profile", profileSwitch.getCustomizedName()); - data.put("profileJson", profileSwitch.profileJson); - data.put("profilePlugin", profileSwitch.profilePlugin); - if (profileSwitch.isCPP) { - data.put("CircadianPercentageProfile", true); - data.put("timeshift", profileSwitch.timeshift); - data.put("percentage", profileSwitch.percentage); - } - data.put("created_at", DateUtil.toISOString(profileSwitch.date)); - data.put("enteredBy", MainApp.gs(R.string.app_name)); + JSONObject data = getJson(profileSwitch); uploadCareportalEntryToNS(data); } catch (JSONException e) { log.error("Unhandled exception", e); @@ -334,19 +322,7 @@ public class NSUpload { public static void updateProfileSwitch(ProfileSwitch profileSwitch) { try { - JSONObject data = new JSONObject(); - data.put("eventType", CareportalEvent.PROFILESWITCH); - data.put("duration", profileSwitch.durationInMinutes); - data.put("profile", profileSwitch.getCustomizedName()); - data.put("profileJson", profileSwitch.profileJson); - data.put("profilePlugin", profileSwitch.profilePlugin); - if (profileSwitch.isCPP) { - data.put("CircadianPercentageProfile", true); - data.put("timeshift", profileSwitch.timeshift); - data.put("percentage", profileSwitch.percentage); - } - data.put("created_at", DateUtil.toISOString(profileSwitch.date)); - data.put("enteredBy", MainApp.gs(R.string.app_name)); + JSONObject data = getJson(profileSwitch); if (profileSwitch._id != null) { Context context = MainApp.instance().getApplicationContext(); Bundle bundle = new Bundle(); @@ -365,6 +341,24 @@ public class NSUpload { } } + private static JSONObject getJson(ProfileSwitch profileSwitch) throws JSONException { + JSONObject data = new JSONObject(); + data.put("eventType", CareportalEvent.PROFILESWITCH); + data.put("duration", profileSwitch.durationInMinutes); + data.put("profile", profileSwitch.getCustomizedName()); + data.put("profileJson", profileSwitch.profileJson); + data.put("profilePlugin", profileSwitch.profilePlugin); + if (profileSwitch.isCPP) { + data.put("CircadianPercentageProfile", true); + data.put("timeshift", profileSwitch.timeshift); + data.put("percentage", profileSwitch.percentage); + } + data.put("created_at", DateUtil.toISOString(profileSwitch.date)); + data.put("enteredBy", MainApp.gs(R.string.app_name)); + + return data; + } + public static void uploadCareportalEntryToNS(JSONObject data) { try { if (data.has("preBolus") && data.has("carbs")) { diff --git a/app/src/main/res/layout/activity_setupwizard.xml b/app/src/main/res/layout/activity_setupwizard.xml index e47762631c..79dd6ed6f7 100644 --- a/app/src/main/res/layout/activity_setupwizard.xml +++ b/app/src/main/res/layout/activity_setupwizard.xml @@ -7,14 +7,32 @@ android:orientation="vertical" tools:context=".setupwizard.SetupWizardActivity"> - + android:orientation="horizontal"> + + + + + @@ -34,7 +53,6 @@ android:id="@+id/sw_content_fields" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:padding="16dp" /> diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 87660858bb..191cbc31ad 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -170,7 +170,7 @@ Opslaan Veiligheid Verzend calibratie %.1f naar xDrip? - Vergeet niet alle gegeten koolhydraten in te geven bij het activeren van de Autosens functie. Anders zullen BG wijzigingen door maaltijden foutief geïnterpreteerd worden!! + Vergeet niet alle opgenomen koolhydraten in te geven. Anders zullen BG wijzigingen door maaltijden foutief geïnterpreteerd worden!! Gevoeligheid AAPS Gevoeligheid Oref0 Accepteer nieuw tijdelijk basaal: @@ -410,7 +410,7 @@ Standaardwaarde: waar Dit wordt gebruikt om autosens de bevoegdheid te geven BG doelen aan te passen alsook ISF en basalen Interval voor autosens [u] Aantal uren in het verleden voor gevoeligheids detectie (koolhy. absorbtie tijd niet meegerekend) - Gebruik de AMA autosens functie + Activeer AMA autosens OpenAPS MA Autosens gegevens Plugin is gedeactiveerd @@ -544,7 +544,7 @@ Vaste maaltijd Vaste maaltijd instellingen Verwijder gegeven: - Verzend alle gegevens opnieuw + Update Wear gegevens Wil je echt de databank wissen? SENS Klein gemiddeld verschil @@ -739,5 +739,211 @@ Creëer een Nightscout melding voor storingen en lokale waarschuwingen (ook zichtbaar inder het Careportal en behandelingen) Datum/tijd van de geleverde bolus op de pomp is niet correct, IOB is waarschijnlijk foutief. Controleer aub de datum/tijd op de pomp. Profiel wissel ontbreekt. Doe aub een profiel wissel of duw op Activeer Profiel in het Lokale profiel. + tijdelijk basaal gezet door pomp + insuline resistente volwassene + SMB + Activeer UAM + Activeer SMB + Verwisseld + Pomp Gestopt + Status vernieuwd + status + Insight pomp + Français + Hypo + OpenAPS SMB + SMB in plaats van tijdelijke basalen voor snellere reactie + Detectie van niet aangekondigde maaltijden + m + u + Insight + Hypo tijdsduur + Initialiseren + Logboek + Storing E13: Taal storing + Storing E10: Terugdraai storing + Storing E7: Elektronische storing + Storing E6: Mechanische storing + Blijf altijd verbonden + Syncroniseren + Rust + Bezig + Gesyncroniseerd + Niet geautoriseerd + incompatibel + seconde + minuut + uur + dag + week + s + Statistieken + Automatische verbinden wanneer AndroidAPS scherm geopend wordt, voordat er een pomp commande wordt uitgevoerd om zo de verbindingsvertraging te omzeilen + Code geweigerd + Niet aangewezen door hoog batterij verbuik + Activeer SMB altijd + SMB altijd onafhangkelijk van bolussen. Enkel mogelijk met een BG bron met goed gefilterde data zoals de G5 + Activeer SMB na koolhydraten + SMB actief gedurende 6u, zelfs met 0 COB. Enkel mogelijk met een BG bron met goed gefilterde data zoals de G5 + Insuline + Koolhydraten + Knoppen + Stuurt een kalibratie naar xDrip+ of opent het G5 calibratie venster + Opent xDrip+, terug knop voor terug naar AAPS te gaan + Aantal koolhydraten toevoegen wanneer de knop wordt ingeduwd + Hoeveelheid insuline dat wordt toegevoegd wanneer er op de knop geduwt word + Kon de CGM applicatie niet starten. Zorg dat deze geïnstalleerd is. + CGM + Historiek venster + Waarschuw bij SMB + Laat tijdelijk basaal lopen + Voorspellingen + Fabric Upload + Categorie + subcategorie + Bolus zal enkel opgeslaan worden + SMB op de pomp ingesteld + Gevoeligheid + Afwijkingen + Geef geen bolus, enkel opslaan in database + Basalen + n/a + Wizard instellingen + Berekeningen inclusief in het resultaat van de wizard + Scherm instellingen + Algemene instellingen + Waarschuwing W31: Patroon bijna leeg + Waarschuwing W38: Bolus geannuleerd + Waarschuwing W36: Tijdelijk basaal geannuleerd + Waarschuwing W32: Batterij niveau laag + Waarschuwing W33: Datum/tijd onjuist + Waarschuwing W34: Einde van garantie periode + Onderhoudsmelding M20: Insuline patroon niet geplaatst + Onderhoudsmelding M21: Insuline patroon leeg + Onderhoudsmelding M22: Batterij leeg + Onderhoudsmelding M23: Automatische uit + Onderhoudsmelding M24: Verstopping + Onderhoudsmelding m25: Huur periode voorbij - einde van werking + Onderhoudsmelding M26: Insuline patroon wissl niet compleet + Onderhoudsmelding M27: Gegevens download mislukt + Onderhoudsmelding M26: Gepauzeerde modus verlopen + Onderhoudsmelding M29: Batterij type niet ingesteld + Onderhoudsmelding M30: Insuline patroon type niet ingesteld + Waarschuwing W39: Huurperiode waarschuwing + WiFi SSID + Gebuik enkel de WiFi verbinding + Toegelaten SSIDs (gescheiden door puntkomma) + Pomp gestopt + Pomp gestart + Pomp gepauzeerd + Maximum maaltijd absorbtie tijd (h) + Tijd + Toon het notities veld in het behandelings dialoog + CGM + Voeding + Reset + Wachttijd voor syncronisatie (%d sec) + Voorbij + met + Actieve TBR + resterende minuten + Opstarten + benodigd + min + Laatst afgewerkte actie + totaal + Activeer SMB met Koolhydraten + SMB actief tijdens actieve koolhydraten + Gebruik SMB met tijdelijke doelen + Gebruik SMB bij een actief tijdelijk basaal (binnenkort eten, inspanningen) + Gebruik SMB met een hoog tijdelijk doel + Gebruik SMB tijdens een verhoogd tijdelijk doel (Inspanningen) + Start inspanning TT + Start binnenkort eten TT + TT + Aantal bolussen + Aantal TBR + Doel %d niet gestart + Toon SMB op horloge zoals gewone bolussen. + Toon de voorspellingen op het horloge + Data Keuzes + Sta automatische crashrapporten en verder gebruik van data toe zodat deze naar de ontwikelaars via fabric.io kan verzonden worden. + Automatische BG aanvullen + Actuele veiliheids verhoger van basaal + Maximale dagelijkse veiligheids vermeningvuldigings factor + Bolus snooze dia deler + Min autosens factor + Max autosens factor + Sta verbinding tijdens roaming toe + Verbindings instellingen + Enkel tijdens opladen + Gevraagd: %.2fU Afgegeven: %.2fU Storings code: %d + Românesc + Chinese + Autosens regelt de BG streefwaarde bij + Hypo streefwaarde + Maximum aantal minuten basaal om de SMB te limiteren tot + Verbind preëntief + Opgenomen Koolhydraten + Opgenomen Insuline + Geen actie geselecteerd, er zal niets uitgevoerd worden + Keep-alive status + Update dexcom G5 app naar de ondersteunde versie + automatische ontbenkende BGs aanvullen van NS + Start Hypo TT + Engineering modus is geactiveerd + Engineering modus is niet geactiveerd en dit is niet de relaese branche + Doel %d niet afgewerkt + Pomp kan geen tijdelijk basaal aanvaarden + Geen plausibel basale snelheid van pomp kunnen lezen + Autosens gedeactiveerd in de voorkeuren + Closed Loop modus gedeactiveerd in de voorkeuren + SMB gedeactiveerd in de voorkeuren + Ongekend + Beperken van basaal tot max %.2f E/U wegens de %s + Pomp limiet + dit moet een positieve waarde zijn + Basaal correct ingesteld + Begrezen van max procentuele wijzigen tot %d%% want de %s + SMB altijd gedeactiveerd doordat de gekozen BG bron geen optimale filtering toepast + SMB niet toegestaan in Open Loop modus + Niet verbonden (%d m) + max limiet (SC) + Onveilig gebruik + Dev cersie actief. Closed loop gedeactiveerd + Anneuleren van een TBR zorgt voor een alarm op de pomp, daarom wordt pomp op 90% gezet voor 1 minuut + Wacht op confirmatie van code + Incompatiebele hulp app, we hebben deze versie nodig + app koppeling + Gebruik echte TBR uischakelingen + Niet verbonden met de hulpapp! + Hulp app lijkt niet geïnstalleerd + Markeer een infuuwissel in NS + Leezen van status mislukt + Markeer een insuline ampull wissel in NS + Automatische Careportal gebeurtenissen + resterende van + op voorhand met + %ds verloopt %s + " http://www.androidaps.org facebook: http://facebook.androidaps.org" + "Eerste insuline increment" + Tweede insuline increment + Derde insuline increment + Eerste koolhydraten increment + Tweede koolhydraten increment + Derde koolhydraten increment + Bolus beperkt tot %.1f E doordat %s + Er is een bolus toegediend gedurende de afgelopen 3 minuten, SMB wordt overgeslagen + Max IOB wordt beperkt tot %1.f E doordat %s + Koolhydraten worden beperkt tot %d gr doordat %s + Maximum waarde in voorkeuren + IOB gelimmiteerd tot %.1f E doordat %s + Automatische Insuline, infusieset wissels, batterij wissels en pomp alarmen naar NS uploaden + Tijdspanne waarbinnen elke maaltijd vollezig is opgenomen. Resterende KH worden niet mee gerekend. + Max totaal IOB dat OpenAPS niet kan overschrijden (E) + Max basaal vermenigvuldiger + Max dagelijks basaal vermenigvuldiger + MAX IOB in OpenAPS context, OpenAPS zal geen extra insuline toedenen als de actuele IOB onderstaande waarde overschreden heeft + "Geen bolus toedienen enkel in behandeleingen zetten"