diff --git a/.gitignore b/.gitignore
index 98b73cb7cb..c7ed9df2f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,10 +6,17 @@
/captures
*.apk
build/
-.idea/
+.idea/*
+!.idea/codeStyles/
app/src/main/jniLibs
full/
debug/
release/
app/com.crashlytics.settings.json
-app/session_analytics.tap
\ No newline at end of file
+app/session_analytics.tap
+.project
+.settings/org.eclipse.buildship.core.prefs
+app/.classpath
+app/.settings/org.eclipse.buildship.core.prefs
+wear/.classpath
+wear/.settings/org.eclipse.buildship.core.prefs
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000000..48bbf82e58
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000000..79ee123c2b
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 783561a599..b5e47ec4ae 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -226,6 +226,8 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
+ implementation 'com.google.firebase:firebase-auth:19.2.0'
+ implementation 'com.google.firebase:firebase-database:19.2.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
@@ -264,7 +266,10 @@ dependencies {
exclude group: "org.json", module: "json"
}
implementation "com.google.code.gson:gson:2.8.6"
- implementation "com.google.guava:guava:24.1-jre"
+ implementation ("com.google.guava:guava:24.1-jre") {
+ exclude group: "com.google.code.findbugs", module: "jsr305"
+ }
+ implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation "net.danlew:android.joda:2.10.3"
@@ -282,6 +287,7 @@ dependencies {
testImplementation "joda-time:joda-time:2.10.5"
testImplementation("com.google.truth:truth:0.39") {
exclude group: "com.google.guava", module: "guava"
+ exclude group: "com.google.code.findbugs", module: "jsr305"
}
testImplementation "org.skyscreamer:jsonassert:1.5.0"
testImplementation "org.hamcrest:hamcrest-all:1.3"
@@ -291,9 +297,6 @@ dependencies {
}
*/
- androidTestImplementation "org.mockito:mockito-core:2.8.47"
- androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
- androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
@@ -305,6 +308,13 @@ dependencies {
implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.2"
implementation "com.squareup.retrofit2:converter-gson:2.6.2"
+ // Phone checker
+ implementation 'com.scottyab:rootbeer-lib:0.0.7'
+
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test:rules:1.3.0-alpha03'
+ androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2'
}
diff --git a/app/google-services.json b/app/google-services.json
index 42db6f4289..507c792c93 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -13,7 +13,12 @@
"package_name": "info.nightscout.aapspumpcontrol"
}
},
- "oauth_client": [],
+ "oauth_client": [
+ {
+ "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
"api_key": [
{
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
@@ -37,7 +42,12 @@
"package_name": "info.nightscout.androidaps"
}
},
- "oauth_client": [],
+ "oauth_client": [
+ {
+ "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
"api_key": [
{
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
@@ -61,7 +71,12 @@
"package_name": "info.nightscout.nsclient"
}
},
- "oauth_client": [],
+ "oauth_client": [
+ {
+ "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
"api_key": [
{
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
@@ -85,7 +100,12 @@
"package_name": "info.nightscout.nsclient2"
}
},
- "oauth_client": [],
+ "oauth_client": [
+ {
+ "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
"api_key": [
{
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
diff --git a/app/src/androidTest/java/info/nightscout/androidaps/ApplicationTest.java b/app/src/androidTest/java/info/nightscout/androidaps/ApplicationTest.java
deleted file mode 100644
index a047e606a9..0000000000
--- a/app/src/androidTest/java/info/nightscout/androidaps/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package info.nightscout.androidaps;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/info/nightscout/androidaps/EspressoHelper.kt b/app/src/androidTest/java/info/nightscout/androidaps/EspressoHelper.kt
new file mode 100644
index 0000000000..b50bb746fb
--- /dev/null
+++ b/app/src/androidTest/java/info/nightscout/androidaps/EspressoHelper.kt
@@ -0,0 +1,27 @@
+package info.nightscout.androidaps
+
+import androidx.test.espresso.ViewAction
+import androidx.test.espresso.ViewInteraction
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers
+
+fun ViewInteraction.isDisplayed(): Boolean {
+ try {
+ check(matches(ViewMatchers.isDisplayed()))
+ return true
+ } catch (e: Throwable) {
+ return false
+ }
+}
+
+fun ViewInteraction.waitAndPerform(viewActions: ViewAction): ViewInteraction? {
+ val startTime = System.currentTimeMillis()
+ while (!isDisplayed()) {
+ Thread.sleep(100)
+ if (System.currentTimeMillis() - startTime >= 5000) {
+ throw AssertionError("View not visible after 5000 milliseconds")
+ }
+ }
+ return perform(viewActions)
+}
+
diff --git a/app/src/androidTest/java/info/nightscout/androidaps/SetupWizardActivityTest.kt b/app/src/androidTest/java/info/nightscout/androidaps/SetupWizardActivityTest.kt
new file mode 100644
index 0000000000..dd1c0b12bc
--- /dev/null
+++ b/app/src/androidTest/java/info/nightscout/androidaps/SetupWizardActivityTest.kt
@@ -0,0 +1,222 @@
+package info.nightscout.androidaps
+
+
+import android.os.SystemClock
+import android.view.View
+import android.view.ViewGroup
+import androidx.test.espresso.Espresso.onData
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.action.ViewActions
+import androidx.test.espresso.action.ViewActions.click
+import androidx.test.espresso.action.ViewActions.scrollTo
+import androidx.test.espresso.matcher.ViewMatchers.*
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.LargeTest
+import androidx.test.rule.ActivityTestRule
+import androidx.test.rule.GrantPermissionRule
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
+import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
+import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
+import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
+import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
+import info.nightscout.androidaps.plugins.source.RandomBgPlugin
+import info.nightscout.androidaps.setupwizard.SetupWizardActivity
+import info.nightscout.androidaps.utils.HardLimits
+import info.nightscout.androidaps.utils.SP
+import info.nightscout.androidaps.utils.isRunningTest
+import org.hamcrest.CoreMatchers.allOf
+import org.hamcrest.Description
+import org.hamcrest.Matcher
+import org.hamcrest.Matchers
+import org.hamcrest.TypeSafeMatcher
+import org.junit.Assert
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+
+@LargeTest
+@RunWith(AndroidJUnit4::class)
+class SetupWizardActivityTest {
+
+ @Rule
+ @JvmField
+ var mActivityTestRule = ActivityTestRule(SetupWizardActivity::class.java)
+
+ @Rule
+ @JvmField
+ var mGrantPermissionRule =
+ GrantPermissionRule.grant(
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ android.Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
+ android.Manifest.permission.WRITE_EXTERNAL_STORAGE
+ )
+
+ @Before
+ fun clear() {
+ SP.clear()
+ }
+/*
+
+To run from command line
+gradlew connectedFullDebugAndroidTest
+
+do not run when your production phone is connected !!!
+
+do this before for running in emulator
+adb shell settings put global window_animation_scale 0 &
+adb shell settings put global transition_animation_scale 0 &
+adb shell settings put global animator_duration_scale 0 &
+ */
+
+
+ @Test
+ fun setupWizardActivityTest() {
+ Assert.assertTrue(isRunningTest())
+ // Welcome page
+ onView(withId(R.id.next_button)).perform(click())
+ // Language selection
+ onView(withText("English")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Agreement page
+ onView(withText("I UNDERSTAND AND AGREE")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Loction permission
+ var askButton = onView(withText("Ask for permission"))
+ if (askButton.isDisplayed()) {
+ askButton.perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ }
+ // Store permission
+ askButton = onView(withText("Ask for permission"))
+ if (askButton.isDisplayed()) {
+ askButton.perform(scrollTo(), click())
+ onView(withText("OK")).perform(click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ }
+ // Units selection
+ onView(withText("mmol/L")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).perform(click())
+ // Display target selection
+ onView(withText("4.2")).perform(scrollTo(), ViewActions.replaceText("5"))
+ onView(withText("10.0")).perform(scrollTo(), ViewActions.replaceText("11"))
+ onView(withId(R.id.next_button)).perform(click())
+ // NSClient
+ onView(withId(R.id.next_button)).perform(click())
+ // Age selection
+ onView(withText("Adult")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Insulin selection
+ onView(withText("Ultra-Rapid Oref")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // BG source selection
+ onView(withText("Random BG")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Profile selection
+ onView(withText("Local Profile")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Local profile - DIA
+ onView(withTagValue(Matchers.`is`("LP_DIA"))).perform(scrollTo(), ViewActions.replaceText("6.0"))
+ // Local profile - IC
+ onView(withId(R.id.ic_tab)).perform(scrollTo(), click())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("IC-1-0")), isDisplayed()))
+ .perform(ViewActions.replaceText("2"), ViewActions.closeSoftKeyboard())
+ // Local profile - ISF
+ onView(withId(R.id.isf_tab)).perform(scrollTo(), click())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("ISF-1-0")), isDisplayed()))
+ .perform(ViewActions.replaceText("3"), ViewActions.closeSoftKeyboard())
+ // Local profile - BAS
+ onView(withId(R.id.basal_tab)).perform(scrollTo(), click())
+ onView(childAtPosition(Matchers.allOf(withId(R.id.localprofile_basal), childAtPosition(withClassName(Matchers.`is`("android.widget.LinearLayout")), 6)), 2))
+ .perform(scrollTo(), click())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("BASAL-1-0")), isDisplayed()))
+ .perform(ViewActions.replaceText("1.1"), ViewActions.closeSoftKeyboard())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("BASAL-1-1")), isDisplayed()))
+ .perform(ViewActions.replaceText("1.2"), ViewActions.closeSoftKeyboard())
+ onView(Matchers.allOf(withId(R.id.timelistedit_time), childAtPosition(childAtPosition(withId(R.id.localprofile_basal), 2), 0)))
+ .perform(scrollTo(), click())
+ onData(Matchers.anything()).inAdapterView(childAtPosition(withClassName(Matchers.`is`("android.widget.PopupWindow\$PopupBackgroundView")), 0)).atPosition(13)
+ .perform(click())
+ // Local profile - TARGET
+ onView(withId(R.id.target_tab)).perform(scrollTo(), click())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("TARGET-1-0")), isDisplayed()))
+ .perform(ViewActions.replaceText("6"), ViewActions.closeSoftKeyboard())
+ onView(Matchers.allOf(withTagValue(Matchers.`is`("TARGET-2-0")), isDisplayed()))
+ .perform(ViewActions.replaceText("6.5"), ViewActions.closeSoftKeyboard())
+ onView(withText("Save")).perform(scrollTo(), click())
+ onView(Matchers.allOf(withId(R.id.localprofile_profileswitch), isDisplayed()))
+ .perform(scrollTo(), click())
+ onView(allOf(withId(R.id.ok), isDisplayed())).perform(click())
+ onView(Matchers.allOf(withText("OK"), isDisplayed())).perform(click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Profile switch
+ askButton = onView(withText("Do Profile Switch"))
+ if (askButton.isDisplayed()) {
+ askButton.perform(scrollTo(), click())
+ onView(allOf(withId(R.id.ok), isDisplayed())).perform(click())
+ onView(Matchers.allOf(withText("OK"), isDisplayed())).perform(click())
+ while (ProfileFunctions.getInstance().profile == null) SystemClock.sleep(100)
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ }
+ // Pump
+ onView(withText("Virtual Pump")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // APS
+ onView(withText("OpenAPS SMB")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Open Closed Loop
+ onView(withText("Closed Loop")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Loop
+ askButton = onView(withText("Enable loop"))
+ if (askButton.isDisplayed()) {
+ askButton.perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ }
+ // Sensitivity
+ onView(withText("Sensitivity Oref1")).perform(scrollTo(), click())
+ onView(withId(R.id.next_button)).waitAndPerform(click())
+ // Objectives
+ onView(allOf(withText("Start"), isDisplayed())).perform(scrollTo(), click())
+ onView(withId(R.id.finish_button)).waitAndPerform(click())
+
+ // Verify settings
+ Assert.assertEquals(Constants.MMOL, ProfileFunctions.getSystemUnits())
+ Assert.assertEquals(17.0, HardLimits.maxBolus(), 0.0001) // Adult
+ Assert.assertTrue(RandomBgPlugin.isEnabled(PluginType.BGSOURCE))
+ Assert.assertTrue(LocalProfilePlugin.isEnabled(PluginType.PROFILE))
+ val p = ProfileFunctions.getInstance().profile
+ Assert.assertNotNull(p)
+ Assert.assertEquals(2.0, p!!.ic, 0.0001)
+ Assert.assertEquals(3.0 * Constants.MMOLL_TO_MGDL, p.isfMgdl, 0.0001)
+ Assert.assertEquals(1.1, p.getBasalTimeFromMidnight(0), 0.0001)
+ Assert.assertEquals(6.0 * Constants.MMOLL_TO_MGDL, p.targetLowMgdl, 0.0001)
+ Assert.assertTrue(VirtualPumpPlugin.getPlugin().isEnabled(PluginType.PUMP))
+ Assert.assertTrue(OpenAPSSMBPlugin.getPlugin().isEnabled(PluginType.APS))
+ Assert.assertTrue(LoopPlugin.getPlugin().isEnabled(PluginType.LOOP))
+ Assert.assertTrue(SensitivityOref1Plugin.getPlugin().isEnabled(PluginType.SENSITIVITY))
+ Assert.assertTrue(ObjectivesPlugin.objectives[0].isStarted)
+ }
+
+ private fun childAtPosition(
+ parentMatcher: Matcher, position: Int): Matcher {
+
+ return object : TypeSafeMatcher() {
+ override fun describeTo(description: Description) {
+ description.appendText("Child at position $position in parent ")
+ parentMatcher.describeTo(description)
+ }
+
+ public override fun matchesSafely(view: View): Boolean {
+ val parent = view.parent
+ return parent is ViewGroup && parentMatcher.matches(parent)
+ && view == parent.getChildAt(position)
+ }
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index aeeb53475d..b571e247c2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -51,12 +51,11 @@
-
@@ -76,6 +75,8 @@
+
+
@@ -122,16 +123,6 @@
-
-
-
-
-
-
-
diff --git a/app/src/main/java/info/nightscout/androidaps/Constants.java b/app/src/main/java/info/nightscout/androidaps/Constants.java
index 21a89d8920..fb322a8239 100644
--- a/app/src/main/java/info/nightscout/androidaps/Constants.java
+++ b/app/src/main/java/info/nightscout/androidaps/Constants.java
@@ -25,8 +25,6 @@ public class Constants {
public static final int hoursToKeepInDatabase = 72;
public static final int daysToKeepHistoryInDatabase = 30;
- public static final long keepAliveMsecs = 5 * 60 * 1000L;
-
// SMS COMMUNICATOR
public static final long remoteBolusMinDistance = 15 * 60 * 1000L;
@@ -78,4 +76,15 @@ public class Constants {
//Storage [MB]
public static final long MINIMUM_FREE_SPACE = 200;
+ // Overview
+ public static final double LOWMARK = 76.0;
+ public static final double HIGHMARK = 180.0;
+
+ // STATISTICS
+ public static final double STATS_TARGET_LOW_MMOL = 3.9;
+ public static final double STATS_TARGET_HIGH_MMOL = 7.8;
+ public static final double STATS_RANGE_LOW_MMOL = 3.9;
+ public static final double STATS_RANGE_HIGH_MMOL = 10.0;
+
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
index c383d039ed..8fa855cd7b 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
@@ -41,6 +41,7 @@ import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.activities.PreferencesActivity;
import info.nightscout.androidaps.activities.SingleFragmentActivity;
+import info.nightscout.androidaps.activities.StatsActivity;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRebuildTabs;
@@ -56,6 +57,7 @@ import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.androidaps.utils.AndroidPermission;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.LocaleHelper;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.PasswordProtection;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -90,8 +92,6 @@ public class MainActivity extends NoSplashAppCompatActivity {
// initialize screen wake lock
processPreferenceChange(new EventPreferenceChange(R.string.key_keep_screen_on));
- doMigrations();
-
final ViewPager viewPager = findViewById(R.id.pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
@@ -137,7 +137,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
.subscribe(this::processPreferenceChange, FabricPrivacy::logException)
);
- if (!SP.getBoolean(R.string.key_setupwizard_processed, false) || !SP.contains(R.string.key_units)) {
+ if (!SP.getBoolean(R.string.key_setupwizard_processed, false)) {
Intent intent = new Intent(this, SetupWizardActivity.class);
startActivity(intent);
}
@@ -231,17 +231,6 @@ public class MainActivity extends NoSplashAppCompatActivity {
}
}
- private void doMigrations() {
-
- // guarantee that the unreachable threshold is at least 30 and of type String
- // Added in 1.57 at 21.01.2018
- int unreachable_threshold = SP.getInt(R.string.key_pump_unreachable_threshold, 30);
- SP.remove(R.string.key_pump_unreachable_threshold);
- if (unreachable_threshold < 30) unreachable_threshold = 30;
- SP.putString(R.string.key_pump_unreachable_threshold, Integer.toString(unreachable_threshold));
- }
-
-
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
@@ -250,10 +239,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
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();
+ OKDialog.show(this, "", MainApp.gs(R.string.alert_dialog_storage_permission_text));
break;
case AndroidPermission.CASE_LOCATION:
case AndroidPermission.CASE_SMS:
@@ -327,9 +313,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
return true;
case R.id.nav_exit:
log.debug("Exiting");
- MainApp.instance().stopKeepAliveService();
RxBus.INSTANCE.send(new EventAppExit());
- MainApp.closeDbHelper();
finish();
System.runFinalization();
System.exit(0);
@@ -343,6 +327,14 @@ public class MainActivity extends NoSplashAppCompatActivity {
startActivity(i);
}, null);
return true;
+/*
+ case R.id.nav_survey:
+ startActivity(new Intent(this, SurveyActivity.class));
+ return true;
+*/
+ case R.id.nav_stats:
+ startActivity(new Intent(this, StatsActivity.class));
+ return true;
}
return actionBarDrawerToggle.onOptionsItemSelected(item);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java
index 11d8351b9b..22df82d212 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java
@@ -1,12 +1,14 @@
package info.nightscout.androidaps;
import android.app.Application;
-import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.SystemClock;
+import androidx.annotation.ColorRes;
import androidx.annotation.PluralsRes;
+import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.crashlytics.android.Crashlytics;
@@ -15,6 +17,7 @@ import com.j256.ormlite.android.apptools.OpenHelperManager;
import net.danlew.android.joda.JodaTimeAndroid;
+import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,6 +25,7 @@ import java.io.File;
import java.util.ArrayList;
import info.nightscout.androidaps.data.ConstraintChecker;
+import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginType;
@@ -32,6 +36,7 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.constraints.dstHelper.DstHelperPlugin;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin;
@@ -46,8 +51,6 @@ import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils;
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin;
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.nsclient.receivers.AckAlarmReceiver;
-import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessReceiver;
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
@@ -72,6 +75,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
+import info.nightscout.androidaps.plugins.source.RandomBgPlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.plugins.source.SourceEversensePlugin;
import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
@@ -86,8 +90,10 @@ import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver;
import info.nightscout.androidaps.services.Intents;
+import info.nightscout.androidaps.utils.ActivityMonitor;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.LocaleHelper;
+import info.nightscout.androidaps.utils.SP;
import io.fabric.sdk.android.Fabric;
import static info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtilsKt.triggerCheckVersion;
@@ -95,7 +101,6 @@ import static info.nightscout.androidaps.plugins.constraints.versionChecker.Vers
public class MainApp extends Application {
private static Logger log = LoggerFactory.getLogger(L.CORE);
- private static KeepAliveReceiver keepAliveReceiver;
private static MainApp sInstance;
public static Resources sResources;
@@ -108,11 +113,7 @@ public class MainApp extends Application {
private static ArrayList pluginsList = null;
private static DataReceiver dataReceiver = new DataReceiver();
- private static NSAlarmReceiver alarmReciever = new NSAlarmReceiver();
- private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver();
- private static DBAccessReceiver dbAccessReciever = new DBAccessReceiver();
- private LocalBroadcastManager lbm;
- BroadcastReceiver btReceiver;
+ private static NSAlarmReceiver alarmReceiver = new NSAlarmReceiver();
TimeDateOrTZChangeReceiver timeDateOrTZChangeReceiver;
public static boolean devBranch;
@@ -145,6 +146,8 @@ public class MainApp extends Application {
log.error("Error with Fabric init! " + e);
}
+ registerActivityLifecycleCallbacks(ActivityMonitor.INSTANCE);
+
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.setAnalyticsCollectionEnabled(!Boolean.getBoolean("disableFirebase"));
@@ -164,7 +167,6 @@ public class MainApp extends Application {
//trigger here to see the new version on app start after an update
triggerCheckVersion();
- //setBTReceiver();
if (pluginsList == null) {
pluginsList = new ArrayList<>();
@@ -188,7 +190,7 @@ public class MainApp extends Application {
if (Config.PUMPDRIVERS) pluginsList.add(MedtronicPumpPlugin.getPlugin());
if (!Config.NSCLIENT) pluginsList.add(MDIPlugin.getPlugin());
pluginsList.add(VirtualPumpPlugin.getPlugin());
- pluginsList.add(CareportalPlugin.getPlugin());
+ if (Config.NSCLIENT) pluginsList.add(CareportalPlugin.getPlugin());
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
if (Config.APS) pluginsList.add(OpenAPSMAPlugin.getPlugin());
if (Config.APS) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
@@ -209,6 +211,7 @@ public class MainApp extends Application {
pluginsList.add(SourcePoctechPlugin.getPlugin());
pluginsList.add(SourceTomatoPlugin.getPlugin());
pluginsList.add(SourceEversensePlugin.getPlugin());
+ pluginsList.add(RandomBgPlugin.INSTANCE);
if (!Config.NSCLIENT) pluginsList.add(SmsCommunicatorPlugin.INSTANCE);
pluginsList.add(FoodPlugin.getPlugin());
@@ -235,13 +238,40 @@ public class MainApp extends Application {
new Thread(() -> {
SystemClock.sleep(5000);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Initialization", null);
- startKeepAliveService();
}).start();
}
+
+ new Thread(() -> KeepAliveReceiver.setAlarm(this)).start();
+ doMigrations();
+ }
+
+ private void doMigrations() {
+
+ // guarantee that the unreachable threshold is at least 30 and of type String
+ // Added in 1.57 at 21.01.2018
+ int unreachable_threshold = SP.getInt(R.string.key_pump_unreachable_threshold, 30);
+ SP.remove(R.string.key_pump_unreachable_threshold);
+ if (unreachable_threshold < 30) unreachable_threshold = 30;
+ SP.putString(R.string.key_pump_unreachable_threshold, Integer.toString(unreachable_threshold));
+
+ // 2.5 -> 2.6
+ if (!SP.contains(R.string.key_units)) {
+ String newUnits = Constants.MGDL;
+ Profile p = ProfileFunctions.getInstance().getProfile();
+ if (p != null && p.getData() != null && p.getData().has("units")) {
+ try {
+ newUnits = p.getData().getString("units");
+ } catch (JSONException e) {
+ log.error("Unhandled exception", e);
+ }
+ }
+ SP.putString(R.string.key_units, newUnits);
+ }
}
+
private void registerLocalBroadcastReceiver() {
- lbm = LocalBroadcastManager.getInstance(this);
+ LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_CHANGED_TREATMENT));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT));
@@ -256,39 +286,21 @@ public class MainApp extends Application {
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL));
//register alarms
- lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM));
- lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
- lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
- lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM));
-
- //register ack alarm
- lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM));
-
- //register dbaccess
- lbm.registerReceiver(dbAccessReciever, new IntentFilter(Intents.ACTION_DATABASE));
+ lbm.registerReceiver(alarmReceiver, new IntentFilter(Intents.ACTION_ALARM));
+ lbm.registerReceiver(alarmReceiver, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
+ lbm.registerReceiver(alarmReceiver, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
+ lbm.registerReceiver(alarmReceiver, new IntentFilter(Intents.ACTION_URGENT_ALARM));
this.timeDateOrTZChangeReceiver = new TimeDateOrTZChangeReceiver();
this.timeDateOrTZChangeReceiver.registerBroadcasts(this);
}
- private void startKeepAliveService() {
- if (keepAliveReceiver == null) {
- keepAliveReceiver = new KeepAliveReceiver();
- keepAliveReceiver.setAlarm(this);
- }
- }
-
- public void stopKeepAliveService() {
- if (keepAliveReceiver != null)
- KeepAliveReceiver.cancelAlarm(this);
- }
-
- public static String gs(int id) {
+ public static String gs(@StringRes int id) {
return sResources.getString(id);
}
- public static String gs(int id, Object... args) {
+ public static String gs(@StringRes int id, Object... args) {
return sResources.getString(id, args);
}
@@ -296,8 +308,8 @@ public class MainApp extends Application {
return sResources.getQuantityString(id, quantity, args);
}
- public static int gc(int id) {
- return sResources.getColor(id);
+ public static int gc(@ColorRes int id) {
+ return ContextCompat.getColor(instance(), id);
}
public static MainApp instance() {
@@ -308,13 +320,6 @@ public class MainApp extends Application {
return sDatabaseHelper;
}
- public static void closeDbHelper() {
- if (sDatabaseHelper != null) {
- sDatabaseHelper.close();
- sDatabaseHelper = null;
- }
- }
-
public static FirebaseAnalytics getFirebaseAnalytics() {
return mFirebaseAnalytics;
}
@@ -417,20 +422,12 @@ public class MainApp extends Application {
public void onTerminate() {
if (L.isEnabled(L.CORE))
log.debug("onTerminate");
- super.onTerminate();
- if (sDatabaseHelper != null) {
- sDatabaseHelper.close();
- sDatabaseHelper = null;
- }
- if (btReceiver != null) {
- unregisterReceiver(btReceiver);
- }
-
- if (timeDateOrTZChangeReceiver != null) {
+ if (timeDateOrTZChangeReceiver != null)
unregisterReceiver(timeDateOrTZChangeReceiver);
- }
-
+ unregisterActivityLifecycleCallbacks(ActivityMonitor.INSTANCE);
+ KeepAliveReceiver.cancelAlarm(this);
+ super.onTerminate();
}
public static int dpToPx(int dp) {
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt
new file mode 100644
index 0000000000..fe55cdcdf2
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt
@@ -0,0 +1,14 @@
+package info.nightscout.androidaps.activities
+
+import android.os.Bundle
+import info.nightscout.androidaps.dialogs.BolusProgressDialog
+
+class BolusProgressHelperActivity : DialogAppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ BolusProgressDialog()
+ .setHelperActivity(this)
+ .setInsulin(intent.getDoubleExtra("insulin", 0.0))
+ .show(supportFragmentManager, "BolusProgress")
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/DialogAppCompatActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/DialogAppCompatActivity.kt
new file mode 100644
index 0000000000..a1c6dd1236
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/DialogAppCompatActivity.kt
@@ -0,0 +1,11 @@
+package info.nightscout.androidaps.activities
+
+import android.content.Context
+import androidx.appcompat.app.AppCompatActivity
+import info.nightscout.androidaps.utils.LocaleHelper
+
+open class DialogAppCompatActivity : AppCompatActivity() {
+ public override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(LocaleHelper.wrap(newBase))
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ErrorHelperActivity.kt
similarity index 80%
rename from app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.kt
rename to app/src/main/java/info/nightscout/androidaps/activities/ErrorHelperActivity.kt
index 15840d3499..1e9ac6c254 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/ErrorHelperActivity.kt
@@ -1,12 +1,12 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs
+package info.nightscout.androidaps.activities
import android.os.Bundle
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
+import info.nightscout.androidaps.dialogs.ErrorDialog
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.utils.SP
-class ErrorHelperActivity : NoSplashAppCompatActivity() {
+class ErrorHelperActivity : DialogAppCompatActivity() {
@Override
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
index c0dbf43527..328f143836 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java
@@ -89,7 +89,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
return;
}
if (key.equals(MainApp.gs(R.string.key_openapsama_useautosens)) && SP.getBoolean(R.string.key_openapsama_useautosens, false)) {
- OKDialog.show(this, MainApp.gs(R.string.configbuilder_sensitivity), MainApp.gs(R.string.sensitivity_warning), null);
+ OKDialog.show(this, MainApp.gs(R.string.configbuilder_sensitivity), MainApp.gs(R.string.sensitivity_warning));
}
updatePrefSummary(myPreferenceFragment.findPreference(key));
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt
index 96a399a299..f50212dadd 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt
@@ -3,7 +3,7 @@ package info.nightscout.androidaps.activities
import android.os.Bundle
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin
-class RequestDexcomPermissionActivity : NoSplashAppCompatActivity() {
+class RequestDexcomPermissionActivity : DialogAppCompatActivity() {
private val requestCode = "AndroidAPS <3".map { it.toInt() }.sum()
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java
deleted file mode 100644
index 688ba82c6a..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package info.nightscout.androidaps.activities;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.fragment.app.Fragment;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.interfaces.PluginBase;
-import info.nightscout.androidaps.utils.PasswordProtection;
-
-public class SingleFragmentActivity extends AppCompatActivity {
-
- private PluginBase plugin;
-
- @Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_single_fragment);
-
- this.plugin = MainApp.getPluginsList().get(getIntent().getIntExtra("plugin", -1));
- setTitle(plugin.getName());
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setDisplayShowHomeEnabled(true);
-
- if (savedInstanceState == null) {
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,
- Fragment.instantiate(this, plugin.pluginDescription.getFragmentClass())).commit();
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == android.R.id.home) {
- finish();
- return true;
- }
- else if (item.getItemId() == R.id.nav_plugin_preferences) {
- PasswordProtection.QueryPassword(this, R.string.settings_password, "settings_password", () -> {
- Intent i = new Intent(this, PreferencesActivity.class);
- i.putExtra("id", plugin.getPreferencesId());
- startActivity(i);
- }, null);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- if (plugin.getPreferencesId() != -1)
- getMenuInflater().inflate(R.menu.menu_single_fragment, menu);
- return super.onCreateOptionsMenu(menu);
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt
new file mode 100644
index 0000000000..3bf329debe
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt
@@ -0,0 +1,53 @@
+package info.nightscout.androidaps.activities
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import android.view.Menu
+import android.view.MenuItem
+import androidx.appcompat.app.AppCompatActivity
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.utils.LocaleHelper
+import info.nightscout.androidaps.utils.PasswordProtection
+
+class SingleFragmentActivity : AppCompatActivity() {
+ private var plugin: PluginBase? = null
+ public override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_single_fragment)
+ plugin = MainApp.getPluginsList()[intent.getIntExtra("plugin", -1)]
+ title = plugin?.name
+ supportActionBar?.setDisplayHomeAsUpEnabled(true)
+ supportActionBar?.setDisplayShowHomeEnabled(true)
+ if (savedInstanceState == null) {
+ supportFragmentManager.beginTransaction().replace(R.id.frame_layout,
+ supportFragmentManager.fragmentFactory.instantiate(ClassLoader.getSystemClassLoader(), plugin?.pluginDescription?.fragmentClass!!)).commit()
+ }
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ if (item.itemId == android.R.id.home) {
+ finish()
+ return true
+ } else if (item.itemId == R.id.nav_plugin_preferences) {
+ PasswordProtection.QueryPassword(this, R.string.settings_password, "settings_password", Runnable {
+ val i = Intent(this, PreferencesActivity::class.java)
+ i.putExtra("id", plugin?.preferencesId)
+ startActivity(i)
+ }, null)
+ return true
+ }
+ return false
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu): Boolean {
+ if (plugin?.preferencesId != -1) menuInflater.inflate(R.menu.menu_single_fragment, menu)
+ return super.onCreateOptionsMenu(menu)
+ }
+
+ public override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(LocaleHelper.wrap(newBase))
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
new file mode 100644
index 0000000000..d0ac8e3f6f
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
@@ -0,0 +1,30 @@
+package info.nightscout.androidaps.activities
+
+import android.os.Bundle
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.utils.ActivityMonitor
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.TddCalculator
+import info.nightscout.androidaps.utils.TirCalculator
+import kotlinx.android.synthetic.main.stats_activity.*
+
+class StatsActivity : NoSplashAppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.stats_activity)
+
+ stats_tdds.text = TddCalculator.stats()
+ stats_tir.text = TirCalculator.stats()
+ stats_activity.text = ActivityMonitor.stats()
+
+ ok.setOnClickListener { finish() }
+ stats_reset.setOnClickListener {
+ OKDialog.showConfirmation(this, MainApp.gs(R.string.doyouwantresetstats), Runnable {
+ ActivityMonitor.reset()
+ recreate()
+ })
+ }
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
new file mode 100644
index 0000000000..bf07eda9af
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
@@ -0,0 +1,110 @@
+package info.nightscout.androidaps.activities
+
+import android.os.Bundle
+import android.widget.ArrayAdapter
+import com.google.firebase.auth.FirebaseAuth
+import com.google.firebase.database.FirebaseDatabase
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.defaultProfile.DefaultProfile
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.dialogs.ProfileViewerDialog
+import info.nightscout.androidaps.utils.*
+import kotlinx.android.synthetic.main.survey_activity.*
+import org.slf4j.LoggerFactory
+
+class SurveyActivity : NoSplashAppCompatActivity() {
+ private val log = LoggerFactory.getLogger(SurveyActivity::class.java)
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.survey_activity)
+
+ survey_id.text = InstanceId.instanceId()
+
+ val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
+ val profileList = profileStore?.getProfileList() ?: return
+ survey_spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, profileList)
+
+ survey_tdds.text = TddCalculator.stats()
+ survey_tir.text = TirCalculator.stats()
+ survey_activity.text = ActivityMonitor.stats()
+
+ survey_profile.setOnClickListener {
+ val age = SafeParse.stringToDouble(survey_age.text.toString())
+ val weight = SafeParse.stringToDouble(survey_weight.text.toString())
+ val tdd = SafeParse.stringToDouble(survey_tdd.text.toString())
+ if (age < 1 || age > 120) {
+ ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ return@setOnClickListener
+ }
+ if ((weight < 5 || weight > 150) && tdd == 0.0) {
+ ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ return@setOnClickListener
+ }
+ if ((tdd < 5 || tdd > 150) && weight == 0.0) {
+ ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ return@setOnClickListener
+ }
+ val profile = DefaultProfile().profile(age, tdd, weight, ProfileFunctions.getSystemUnits())
+ val args = Bundle()
+ args.putLong("time", DateUtil.now())
+ args.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal)
+ args.putString("customProfile", profile.data.toString())
+ args.putString("customProfileUnits", profile.units)
+ args.putString("customProfileName", "Age: $age TDD: $tdd Weight: $weight")
+ val pvd = ProfileViewerDialog()
+ pvd.arguments = args
+ pvd.show(supportFragmentManager, "ProfileViewDialog")
+ }
+
+ survey_submit.setOnClickListener {
+ val r = FirebaseRecord()
+ r.id = InstanceId.instanceId()
+ r.age = SafeParse.stringToInt(survey_age.text.toString())
+ r.weight = SafeParse.stringToInt(survey_weight.text.toString())
+ if (r.age < 1 || r.age > 120) {
+ ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ return@setOnClickListener
+ }
+ if (r.weight < 5 || r.weight > 150) {
+ ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ return@setOnClickListener
+ }
+
+ if (survey_spinner.selectedItem == null)
+ return@setOnClickListener
+ val profileName = survey_spinner.selectedItem.toString()
+ val specificProfile = profileStore.getSpecificProfile(profileName)
+
+ r.profileJson = specificProfile.toString()
+
+ val auth = FirebaseAuth.getInstance()
+ auth.signInAnonymously()
+ .addOnCompleteListener(this) { task ->
+ if (task.isSuccessful) {
+ log.debug("signInAnonymously:success")
+ val user = auth.currentUser // TODO: do we need this, seems unused?
+
+ val database = FirebaseDatabase.getInstance().reference
+ database.child("survey").child(r.id).setValue(r)
+ } else {
+ log.error("signInAnonymously:failure", task.exception)
+ ToastUtils.showToastInUiThread(this, "Authentication failed.")
+ //updateUI(null)
+ }
+
+ // ...
+ }
+ finish()
+ }
+ }
+
+ inner class FirebaseRecord {
+ var id = ""
+ var age: Int = 0
+ var weight: Int = 0
+ var profileJson = "ghfg"
+ }
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/data/Profile.java b/app/src/main/java/info/nightscout/androidaps/data/Profile.java
index 93c95dda51..6ac3517054 100644
--- a/app/src/main/java/info/nightscout/androidaps/data/Profile.java
+++ b/app/src/main/java/info/nightscout/androidaps/data/Profile.java
@@ -397,7 +397,7 @@ public class Profile {
return toMgdl(getIsfTimeFromMidnight(secondsFromMidnight(time)), units);
}
- double getIsfTimeFromMidnight(int timeAsSeconds) {
+ public double getIsfTimeFromMidnight(int timeAsSeconds) {
if (isf_v == null)
isf_v = convertToSparseArray(isf);
return getValueToTime(isf_v, timeAsSeconds);
@@ -589,7 +589,7 @@ public class Profile {
public double getMaxDailyBasal() {
double max = 0d;
for (int hour = 0; hour < 24; hour++) {
- double value = getBasalTimeFromMidnight((Integer) (hour * 60 * 60));
+ double value = getBasalTimeFromMidnight(hour * 60 * 60);
if (value > max) max = value;
}
return max;
diff --git a/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.kt b/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.kt
index 0fa0bf277f..9415a25f2c 100644
--- a/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.kt
+++ b/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.data
import androidx.collection.ArrayMap
+import info.nightscout.androidaps.utils.JsonHelper
import org.json.JSONException
import org.json.JSONObject
import org.slf4j.LoggerFactory
@@ -40,21 +41,19 @@ class ProfileStore(val data: JSONObject) {
fun getSpecificProfile(profileName: String): Profile? {
var profile: Profile? = null
- try {
- getStore()?.let { store ->
- if (store.has(profileName)) {
- profile = cachedObjects[profileName]
- if (profile == null) {
- val profileObject = store.getJSONObject(profileName)
- if (profileObject != null && profileObject.has("units")) {
- profile = Profile(profileObject, profileObject.getString("units"))
+ getStore()?.let { store ->
+ if (store.has(profileName)) {
+ profile = cachedObjects[profileName]
+ if (profile == null) {
+ JsonHelper.safeGetJSONObject(store, profileName, null)?.let { profileObject ->
+ // take units from profile and if N/A from store
+ JsonHelper.safeGetStringAllowNull(profileObject, "units", JsonHelper.safeGetString(data, "units"))?.let { units ->
+ profile = Profile(profileObject, units)
cachedObjects[profileName] = profile
}
}
}
}
- } catch (e: JSONException) {
- log.error("Unhandled exception", e)
}
return profile
}
diff --git a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
index af8451477d..66123e1ce9 100644
--- a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
+++ b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
@@ -125,7 +125,8 @@ public class QuickWizardEntry {
trend = true;
}
- return new BolusWizard(profile, profileName, tempTarget, carbs(), cob, bg, 0d, 100, true, useCOB() == YES, bolusIOB, basalIOB, superBolus, useTempTarget() == YES, trend, "QuickWizard");
+ double percentage = SP.getDouble(R.string.key_boluswizard_percentage, 100.0);
+ return new BolusWizard(profile, profileName, tempTarget, carbs(), cob, bg, 0d, percentage, true, useCOB() == YES, bolusIOB, basalIOB, superBolus, useTempTarget() == YES, trend, "QuickWizard");
}
public String buttonText() {
diff --git a/app/src/main/java/info/nightscout/androidaps/data/defaultProfile/DefaultProfile.kt b/app/src/main/java/info/nightscout/androidaps/data/defaultProfile/DefaultProfile.kt
new file mode 100644
index 0000000000..b121dbee02
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/data/defaultProfile/DefaultProfile.kt
@@ -0,0 +1,145 @@
+package info.nightscout.androidaps.data.defaultProfile
+
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.utils.Round
+import org.json.JSONArray
+import org.json.JSONObject
+import java.util.*
+
+
+class DefaultProfile {
+ var oneToFive: TreeMap> = TreeMap()
+ var sixToEleven: TreeMap> = TreeMap()
+ var twelveToSeventeen: TreeMap> = TreeMap()
+ var eighteenToTwentyfor: TreeMap> = TreeMap()
+
+ fun profile(age: Double, tdd: Double, weight: Double, units: String): Profile {
+ val profile = JSONObject()
+ if (age >= 1 && age < 6) {
+ val _tdd = if (tdd == 0.0) 0.6 * weight else tdd
+ closest(oneToFive, _tdd * 0.3)?.let { array -> profile.put("basal", arrayToJson(array)) }
+ val ic = Round.roundTo(250.0 / _tdd, 1.0)
+ profile.put("carbratio", singleValueArray(ic, arrayOf( 0.0, -4.0, -1.0, -2.0, -4.0, 0.0, -4.0)))
+ val isf = Round.roundTo(200.0 / _tdd, 0.1)
+ profile.put("sens", singleValueArray(isf, arrayOf( 0.0, -2.0, -0.0, -0.0, -2.0, 0.0, -2.0)))
+ } else if (age >= 6 && age < 12) {
+ val _tdd = if (tdd == 0.0) 0.8 * weight else tdd
+ closest(sixToEleven, _tdd * 0.4)?.let { array -> profile.put("basal", arrayToJson(array)) }
+ val ic = Round.roundTo(375.0 / _tdd, 1.0)
+ profile.put("carbratio", singleValueArray(ic, arrayOf( 0.0, -3.0, 0.0, -1.0, -3.0, 0.0, -2.0)))
+ val isf = Round.roundTo(170.0 / _tdd, 0.1)
+ profile.put("sens", singleValueArray(isf, arrayOf( 0.0, -1.0, -0.0, -0.0, -1.0, 0.0, -1.0)))
+ } else if (age >= 12 && age < 17) {
+ val _tdd = if (tdd == 0.0) 1.0 * weight else tdd
+ closest(twelveToSeventeen, _tdd * 0.5)?.let { array -> profile.put("basal", arrayToJson(array)) }
+ val ic = Round.roundTo(500.0 / _tdd, 1.0)
+ profile.put("carbratio", singleValueArray(ic, arrayOf( 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, -1.0)))
+ val isf = Round.roundTo(100.0 / _tdd, 0.1)
+ profile.put("sens", singleValueArray(isf, arrayOf( 0.2, 0.0, 0.2, 0.2, 0.0, 0.2, 0.2)))
+ } else if (age >= 18) {
+
+ }
+ profile.put("dia", 5.0)
+ profile.put("carbs_hr", 20) // not used
+ profile.put("delay", 5.0) // not used
+ profile.put("timezone", TimeZone.getDefault().getID())
+ profile.put("target_high", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
+ profile.put("target_low", JSONArray().put(JSONObject().put("time", "00:00").put("value", Profile.fromMgdlToUnits(108.0, units))))
+ return Profile(profile, units)
+ }
+
+ init {
+ oneToFive[1.00] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050)
+ oneToFive[1.13] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050)
+ oneToFive[1.25] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.050, 0.050)
+ oneToFive[1.38] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.050, 0.050)
+ oneToFive[1.50] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.075, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.050, 0.050, 0.050, 0.075, 0.100, 0.100, 0.050, 0.050)
+ oneToFive[1.75] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.050, 0.050, 0.050, 0.060, 0.060, 0.075, 0.075, 0.050, 0.050, 0.050, 0.100, 0.125, 0.100, 0.050, 0.050)
+ oneToFive[2.00] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.075, 0.050, 0.050, 0.065, 0.065, 0.075, 0.075, 0.050, 0.050, 0.050, 0.100, 0.125, 0.100, 0.050, 0.050)
+ oneToFive[2.25] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.100, 0.100, 0.075, 0.060, 0.060, 0.070, 0.070, 0.100, 0.100, 0.050, 0.050, 0.050, 0.125, 0.150, 0.125, 0.065, 0.050)
+ oneToFive[2.50] = arrayOf(0.050, 0.050, 0.050, 0.050, 0.075, 0.075, 0.100, 0.125, 0.125, 0.100, 0.065, 0.065, 0.075, 0.075, 0.125, 0.125, 0.060, 0.060, 0.060, 0.150, 0.150, 0.150, 0.070, 0.060)
+ oneToFive[2.75] = arrayOf(0.075, 0.075, 0.075, 0.100, 0.100, 0.100, 0.125, 0.150, 0.125, 0.100, 0.070, 0.070, 0.080, 0.080, 0.150, 0.150, 0.070, 0.070, 0.070, 0.175, 0.175, 0.175, 0.080, 0.070)
+ oneToFive[3.25] = arrayOf(0.100, 0.100, 0.100, 0.125, 0.125, 0.125, 0.150, 0.150, 0.150, 0.100, 0.080, 0.080, 0.100, 0.100, 0.175, 0.175, 0.075, 0.075, 0.075, 0.200, 0.200, 0.200, 0.090, 0.080)
+ oneToFive[3.75] = arrayOf(0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.175, 0.175, 0.175, 0.100, 0.085, 0.085, 0.110, 0.110, 0.185, 0.185, 0.080, 0.080, 0.080, 0.225, 0.225, 0.225, 0.100, 0.090)
+ oneToFive[4.25] = arrayOf(0.125, 0.125, 0.130, 0.140, 0.140, 0.140, 0.200, 0.200, 0.200, 0.125, 0.090, 0.090, 0.120, 0.120, 0.200, 0.200, 0.100, 0.100, 0.100, 0.250, 0.250, 0.250, 0.125, 0.100)
+ oneToFive[4.75] = arrayOf(0.125, 0.130, 0.135, 0.150, 0.150, 0.150, 0.200, 0.225, 0.200, 0.125, 0.100, 0.100, 0.125, 0.125, 0.250, 0.200, 0.110, 0.125, 0.125, 0.275, 0.275, 0.275, 0.130, 0.125)
+ oneToFive[5.25] = arrayOf(0.150, 0.150, 0.150, 0.170, 0.170, 0.170, 0.225, 0.225, 0.225, 0.130, 0.125, 0.125, 0.140, 0.140, 0.250, 0.250, 0.150, 0.150, 0.150, 0.300, 0.300, 0.300, 0.150, 0.150)
+ oneToFive[6.00] = arrayOf(0.170, 0.170, 0.175, 0.200, 0.200, 0.200, 0.250, 0.250, 0.250, 0.150, 0.125, 0.125, 0.150, 0.150, 0.275, 0.275, 0.170, 0.150, 0.150, 0.350, 0.350, 0.350, 0.175, 0.150)
+ oneToFive[6.75] = arrayOf(0.200, 0.200, 0.200, 0.225, 0.225, 0.225, 0.275, 0.275, 0.275, 0.200, 0.130, 0.130, 0.175, 0.175, 0.300, 0.300, 0.170, 0.175, 0.175, 0.375, 0.375, 0.375, 0.200, 0.175)
+ oneToFive[7.50] = arrayOf(0.225, 0.230, 0.235, 0.250, 0.250, 0.250, 0.300, 0.300, 0.300, 0.250, 0.150, 0.150, 0.200, 0.200, 0.325, 0.325, 0.200, 0.200, 0.200, 0.400, 0.450, 0.400, 0.350, 0.200)
+
+ sixToEleven[5.26] = arrayOf(0.18, 0.18, 0.18, 0.20, 0.20, 0.23, 0.25, 0.25, 0.25, 0.18, 0.15, 0.13, 0.15, 0.15, 0.25, 0.25, 0.20, 0.15, 0.18, 0.25, 0.25, 0.25, 0.23, 0.20)
+ sixToEleven[5.61] = arrayOf(0.18, 0.20, 0.20, 0.23, 0.23, 0.25, 0.28, 0.28, 0.25, 0.20, 0.15, 0.13, 0.15, 0.18, 0.25, 0.25, 0.20, 0.15, 0.18, 0.28, 0.25, 0.25, 0.23, 0.20)
+ sixToEleven[5.93] = arrayOf(0.20, 0.20, 0.23, 0.25, 0.25, 0.25, 0.30, 0.30, 0.30, 0.25, 0.15, 0.15, 0.18, 0.18, 0.28, 0.28, 0.20, 0.20, 0.20, 0.28, 0.28, 0.28, 0.25, 0.23)
+ sixToEleven[6.26] = arrayOf(0.20, 0.23, 0.23, 0.25, 0.25, 0.28, 0.33, 0.30, 0.30, 0.25, 0.18, 0.15, 0.18, 0.18, 0.28, 0.28, 0.23, 0.20, 0.20, 0.28, 0.30, 0.28, 0.25, 0.23)
+ sixToEleven[6.60] = arrayOf(0.23, 0.23, 0.25, 0.25, 0.25, 0.28, 0.33, 0.33, 0.33, 0.28, 0.18, 0.15, 0.18, 0.18, 0.30, 0.28, 0.23, 0.23, 0.20, 0.30, 0.30, 0.30, 0.25, 0.25)
+ sixToEleven[7.26] = arrayOf(0.23, 0.25, 0.28, 0.28, 0.30, 0.33, 0.38, 0.35, 0.35, 0.30, 0.18, 0.18, 0.18, 0.19, 0.33, 0.30, 0.25, 0.23, 0.23, 0.33, 0.33, 0.33, 0.30, 0.25)
+ sixToEleven[7.92] = arrayOf(0.25, 0.25, 0.28, 0.30, 0.33, 0.35, 0.38, 0.38, 0.38, 0.35, 0.20, 0.20, 0.23, 0.25, 0.35, 0.33, 0.30, 0.25, 0.25, 0.35, 0.35, 0.35, 0.33, 0.28)
+ sixToEleven[8.57] = arrayOf(0.28, 0.28, 0.30, 0.30, 0.33, 0.38, 0.40, 0.43, 0.40, 0.38, 0.25, 0.25, 0.25, 0.28, 0.38, 0.38, 0.33, 0.28, 0.28, 0.38, 0.40, 0.38, 0.35, 0.30)
+ sixToEleven[9.24] = arrayOf(0.30, 0.33, 0.35, 0.38, 0.40, 0.40, 0.43, 0.45, 0.43, 0.40, 0.30, 0.25, 0.28, 0.28, 0.38, 0.40, 0.33, 0.30, 0.30, 0.40, 0.43, 0.40, 0.38, 0.35)
+ sixToEleven[9.89] = arrayOf(0.35, 0.35, 0.38, 0.40, 0.40, 0.43, 0.45, 0.48, 0.45, 0.40, 0.30, 0.25, 0.28, 0.30, 0.40, 0.43, 0.35, 0.33, 0.33, 0.43, 0.45, 0.43, 0.40, 0.38)
+ sixToEleven[10.56] = arrayOf(0.38, 0.38, 0.40, 0.43, 0.45, 0.45, 0.48, 0.50, 0.48, 0.40, 0.35, 0.25, 0.30, 0.33, 0.43, 0.45, 0.35, 0.35, 0.35, 0.45, 0.48, 0.45, 0.43, 0.40)
+ sixToEleven[11.21] = arrayOf(0.40, 0.43, 0.43, 0.45, 0.48, 0.50, 0.53, 0.55, 0.50, 0.40, 0.35, 0.30, 0.33, 0.33, 0.45, 0.48, 0.38, 0.35, 0.37, 0.50, 0.50, 0.48, 0.45, 0.43)
+ sixToEleven[11.88] = arrayOf(0.43, 0.43, 0.45, 0.45, 0.48, 0.50, 0.55, 0.58, 0.50, 0.40, 0.35, 0.33, 0.33, 0.33, 0.48, 0.50, 0.40, 0.38, 0.38, 0.53, 0.53, 0.50, 0.48, 0.45)
+ sixToEleven[12.53] = arrayOf(0.45, 0.45, 0.48, 0.50, 0.53, 0.55, 0.60, 0.60, 0.60, 0.45, 0.40, 0.35, 0.35, 0.38, 0.50, 0.53, 0.40, 0.38, 0.38, 0.55, 0.58, 0.55, 0.50, 0.48)
+ sixToEleven[13.19] = arrayOf(0.48, 0.48, 0.50, 0.55, 0.58, 0.60, 0.65, 0.65, 0.65, 0.50, 0.45, 0.36, 0.38, 0.40, 0.55, 0.55, 0.45, 0.40, 0.40, 0.60, 0.60, 0.58, 0.55, 0.50)
+ sixToEleven[14.18] = arrayOf(0.53, 0.53, 0.55, 0.60, 0.65, 0.68, 0.70, 0.70, 0.68, 0.60, 0.55, 0.40, 0.40, 0.45, 0.60, 0.60, 0.50, 0.45, 0.45, 0.63, 0.65, 0.63, 0.60, 0.60)
+ sixToEleven[15.17] = arrayOf(0.55, 0.58, 0.60, 0.65, 0.70, 0.70, 0.75, 0.75, 0.70, 0.65, 0.60, 0.42, 0.42, 0.45, 0.65, 0.65, 0.60, 0.50, 0.50, 0.68, 0.68, 0.65, 0.63, 0.63)
+ sixToEleven[16.50] = arrayOf(0.60, 0.63, 0.65, 0.70, 0.70, 0.70, 0.80, 0.80, 0.80, 0.70, 0.60, 0.45, 0.45, 0.50, 0.65, 0.70, 0.60, 0.55, 0.55, 0.75, 0.75, 0.70, 0.65, 0.65)
+
+ twelveToSeventeen[10.70] = arrayOf(0.30, 0.30, 0.30, 0.30, 0.40, 0.40, 0.60, 0.60, 0.60, 0.40, 0.35, 0.30, 0.30, 0.35, 0.45, 0.50, 0.40, 0.30, 0.30, 0.40, 0.50, 0.40, 0.40, 0.30)
+ twelveToSeventeen[11.10] = arrayOf(0.30, 0.30, 0.30, 0.35, 0.40, 0.45, 0.60, 0.60, 0.60, 0.40, 0.40, 0.30, 0.35, 0.40, 0.50, 0.50, 0.30, 0.30, 0.30, 0.50, 0.50, 0.50, 0.30, 0.30)
+ twelveToSeventeen[11.60] = arrayOf(0.30, 0.30, 0.35, 0.45, 0.45, 0.50, 0.65, 0.65, 0.65, 0.45, 0.40, 0.40, 0.40, 0.40, 0.50, 0.55, 0.55, 0.45, 0.45, 0.50, 0.50, 0.50, 0.40, 0.40)
+ twelveToSeventeen[13.00] = arrayOf(0.40, 0.40, 0.40, 0.50, 0.55, 0.60, 0.70, 0.70, 0.70, 0.60, 0.50, 0.40, 0.40, 0.40, 0.50, 0.60, 0.60, 0.50, 0.50, 0.60, 0.60, 0.60, 0.40, 0.30)
+ twelveToSeventeen[15.60] = arrayOf(0.45, 0.50, 0.50, 0.60, 0.65, 0.70, 0.80, 0.80, 0.80, 0.70, 0.60, 0.60, 0.50, 0.50, 0.60, 0.70, 0.70, 0.60, 0.60, 0.60, 0.70, 0.70, 0.50, 0.50)
+ twelveToSeventeen[17.00] = arrayOf(0.50, 0.55, 0.60, 0.70, 0.75, 0.80, 1.00, 1.00, 1.00, 0.80, 0.70, 0.60, 0.60, 0.60, 0.70, 0.80, 0.80, 0.65, 0.65, 0.65, 0.70, 0.70, 0.60, 0.60)
+ twelveToSeventeen[18.00] = arrayOf(0.60, 0.65, 0.70, 0.80, 0.85, 0.90, 1.10, 1.10, 1.10, 0.90, 0.80, 0.60, 0.60, 0.60, 0.70, 0.80, 0.80, 0.70, 0.65, 0.70, 0.75, 0.70, 0.60, 0.60)
+ twelveToSeventeen[20.20] = arrayOf(0.70, 0.75, 0.80, 0.90, 0.95, 1.00, 1.10, 1.10, 1.10, 0.90, 0.80, 0.70, 0.70, 0.70, 0.80, 0.90, 0.90, 0.75, 0.75, 0.75, 0.80, 0.80, 0.70, 0.70)
+ twelveToSeventeen[21.60] = arrayOf(0.75, 0.80, 0.90, 0.90, 1.00, 1.00, 1.20, 1.20, 1.20, 0.90, 0.80, 0.70, 0.70, 0.70, 0.90, 1.00, 1.00, 0.80, 0.80, 0.80, 0.80, 0.80, 0.70, 0.70)
+ twelveToSeventeen[23.80] = arrayOf(0.75, 0.80, 0.90, 1.00, 1.10, 1.10, 1.20, 1.20, 1.20, 1.00, 0.90, 0.80, 0.80, 0.80, 0.90, 1.10, 1.10, 0.90, 0.90, 0.90, 1.00, 1.00, 0.80, 0.80)
+ twelveToSeventeen[26.10] = arrayOf(0.80, 0.80, 0.90, 1.00, 1.20, 1.20, 1.30, 1.30, 1.30, 1.10, 1.00, 0.90, 0.90, 0.90, 1.00, 1.20, 1.10, 0.90, 0.90, 1.00, 1.00, 1.00, 0.90, 0.90)
+ twelveToSeventeen[28.00] = arrayOf(0.90, 0.90, 1.00, 1.10, 1.10, 1.20, 1.30, 1.30, 1.30, 1.20, 1.00, 1.00, 1.00, 1.00, 1.20, 1.20, 1.20, 1.00, 1.00, 1.10, 1.10, 1.10, 0.90, 0.90)
+ twelveToSeventeen[30.10] = arrayOf(1.00, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.50, 1.50, 1.30, 1.20, 1.00, 1.00, 1.00, 1.30, 1.40, 1.40, 1.00, 1.00, 1.15, 1.15, 1.10, 1.00, 1.00)
+ twelveToSeventeen[32.60] = arrayOf(1.10, 1.10, 1.20, 1.20, 1.40, 1.50, 1.50, 1.50, 1.50, 1.30, 1.20, 1.10, 1.10, 1.10, 1.40, 1.50, 1.40, 1.10, 1.10, 1.20, 1.20, 1.20, 1.10, 1.10)
+ twelveToSeventeen[35.20] = arrayOf(1.20, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.70, 1.50, 1.40, 1.20, 1.10, 1.10, 1.10, 1.40, 1.50, 1.60, 1.40, 1.20, 1.20, 1.30, 1.30, 1.20, 1.20)
+ twelveToSeventeen[39.00] = arrayOf(1.30, 1.30, 1.40, 1.60, 1.60, 1.60, 1.90, 1.90, 1.90, 1.50, 1.30, 1.20, 1.20, 1.30, 1.50, 1.60, 1.70, 1.80, 1.50, 1.50, 1.60, 1.60, 1.30, 1.30)
+ twelveToSeventeen[42.80] = arrayOf(1.40, 1.40, 1.50, 1.70, 1.80, 1.80, 2.00, 2.00, 2.00, 1.80, 1.80, 1.50, 1.50, 1.50, 1.60, 1.70, 1.80, 1.90, 1.60, 1.60, 1.70, 1.70, 1.50, 1.50)
+ twelveToSeventeen[47.30] = arrayOf(1.50, 1.50, 1.70, 1.70, 2.00, 2.00, 2.20, 2.30, 2.20, 2.00, 1.80, 1.60, 1.60, 1.60, 1.80, 2.00, 2.10, 1.90, 1.80, 1.80, 2.00, 2.00, 1.60, 1.60)
+ }
+
+ private fun closest(map: TreeMap>, key: Double): Array? {
+ val low = map.floorEntry(key)
+ val high = map.ceilingEntry(key)
+ var res: Array? = null
+ if (low != null && high != null) {
+ res = if (Math.abs(key - low.key) < Math.abs(key - high.key))
+ low.value
+ else
+ high.value
+ } else if (low != null || high != null) {
+ res = if (low != null) low.value else high.value
+ }
+ return res
+ }
+
+ fun arrayToJson(b: Array): JSONArray {
+ val basals = JSONArray()
+ for (i in 0..23) {
+ val time = String.format(Locale.ENGLISH, "%02d:00", i)
+ basals.put(JSONObject().put("time", time).put("value", b[i].toString()))
+ }
+ return basals
+ }
+
+ fun singleValueArray(value: Double, sample: Array): JSONArray {
+ val array = JSONArray()
+ array.put(JSONObject().put("time", "00:00").put("value", value + sample[0]))
+ array.put(JSONObject().put("time", "06:00").put("value", value + sample[1]))
+ array.put(JSONObject().put("time", "09:00").put("value", value + sample[2]))
+ array.put(JSONObject().put("time", "11:00").put("value", value + sample[3]))
+ array.put(JSONObject().put("time", "14:00").put("value", value + sample[4]))
+ array.put(JSONObject().put("time", "16:00").put("value", value + sample[5]))
+ array.put(JSONObject().put("time", "19:00").put("value", value + sample[6]))
+ return array
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
index d8926fc4c1..073f21e708 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
@@ -3,6 +3,7 @@ package info.nightscout.androidaps.db;
import android.content.Context;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
+
import androidx.annotation.Nullable;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
@@ -32,7 +33,7 @@ import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.data.OverlappingIntervals;
+import info.nightscout.androidaps.data.NonOverlappingIntervals;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.events.EventCareportalEventChange;
@@ -193,15 +194,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return newVersion;
}
- /**
- * Close the database connections and clear any cached DAOs.
- */
- @Override
- public void close() {
- super.close();
- }
-
-
public long size(String database) {
return DatabaseUtils.queryNumEntries(getReadableDatabase(), database);
}
@@ -558,12 +550,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// ------------- DbRequests handling -------------------
- public void create(DbRequest dbr) {
- try {
+ public void create(DbRequest dbr) throws SQLException {
getDaoDbRequest().create(dbr);
- } catch (SQLException e) {
- log.error("Unhandled exception", e);
- }
}
public int delete(DbRequest dbr) {
@@ -772,8 +760,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TempTarget tempTarget = new TempTarget()
.date(trJson.getLong("mills"))
.duration(JsonHelper.safeGetInt(trJson, "duration"))
- .low(Profile.toMgdl(trJson.getDouble("targetBottom"), units))
- .high(Profile.toMgdl(trJson.getDouble("targetTop"), units))
+ .low(Profile.toMgdl(JsonHelper.safeGetDouble(trJson, "targetBottom"), units))
+ .high(Profile.toMgdl(JsonHelper.safeGetDouble(trJson, "targetTop"), units))
.reason(JsonHelper.safeGetString(trJson, "reason", ""))
._id(trJson.getString("_id"))
.source(Source.NIGHTSCOUT);
@@ -1425,7 +1413,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
QueryBuilder queryBuilder = getDaoCareportalEvents().queryBuilder();
queryBuilder.orderBy("date", false);
Where where = queryBuilder.where();
- where.eq("eventType", event);
+ where.eq("eventType", event).and().isNotNull("json");
queryBuilder.limit(1L);
PreparedQuery preparedQuery = queryBuilder.prepare();
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
@@ -1445,10 +1433,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
QueryBuilder queryBuilder = getDaoCareportalEvents().queryBuilder();
queryBuilder.orderBy("date", ascending);
Where where = queryBuilder.where();
- where.ge("date", mills);
+ where.ge("date", mills).and().isNotNull("json").and().isNotNull("eventType");
PreparedQuery preparedQuery = queryBuilder.prepare();
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
- preprocessOpenAPSOfflineEvents(careportalEvents);
+ careportalEvents = preprocessOpenAPSOfflineEvents(careportalEvents);
return careportalEvents;
} catch (SQLException e) {
log.error("Unhandled exception", e);
@@ -1462,10 +1450,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
QueryBuilder queryBuilder = getDaoCareportalEvents().queryBuilder();
queryBuilder.orderBy("date", ascending);
Where where = queryBuilder.where();
- where.between("date", start, end);
+ where.between("date", start, end).and().isNotNull("json").and().isNotNull("eventType");
PreparedQuery preparedQuery = queryBuilder.prepare();
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
- preprocessOpenAPSOfflineEvents(careportalEvents);
+ careportalEvents = preprocessOpenAPSOfflineEvents(careportalEvents);
return careportalEvents;
} catch (SQLException e) {
log.error("Unhandled exception", e);
@@ -1473,14 +1461,16 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<>();
}
- public void preprocessOpenAPSOfflineEvents(List list) {
- OverlappingIntervals offlineEvents = new OverlappingIntervals();
+ public List preprocessOpenAPSOfflineEvents(List list) {
+ NonOverlappingIntervals offlineEvents = new NonOverlappingIntervals();
+ List other = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
CareportalEvent event = list.get(i);
- if (!event.eventType.equals(CareportalEvent.OPENAPSOFFLINE)) continue;
- offlineEvents.add(event);
+ if (event.eventType.equals(CareportalEvent.OPENAPSOFFLINE)) offlineEvents.add(event);
+ else other.add(event);
}
-
+ other.addAll(offlineEvents.getList());
+ return other;
}
public List getCareportalEventsFromTime(long mills, String type, boolean ascending) {
@@ -1489,10 +1479,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
QueryBuilder queryBuilder = getDaoCareportalEvents().queryBuilder();
queryBuilder.orderBy("date", ascending);
Where where = queryBuilder.where();
- where.ge("date", mills).and().eq("eventType", type);
+ where.ge("date", mills).and().eq("eventType", type).and().isNotNull("json");
PreparedQuery preparedQuery = queryBuilder.prepare();
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
- preprocessOpenAPSOfflineEvents(careportalEvents);
+ careportalEvents = preprocessOpenAPSOfflineEvents(careportalEvents);
return careportalEvents;
} catch (SQLException e) {
log.error("Unhandled exception", e);
@@ -1505,9 +1495,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
List careportalEvents;
QueryBuilder queryBuilder = getDaoCareportalEvents().queryBuilder();
queryBuilder.orderBy("date", ascending);
+ Where where = queryBuilder.where();
+ where.isNotNull("json").and().isNotNull("eventType");
PreparedQuery preparedQuery = queryBuilder.prepare();
careportalEvents = getDaoCareportalEvents().query(preparedQuery);
- preprocessOpenAPSOfflineEvents(careportalEvents);
+ careportalEvents = preprocessOpenAPSOfflineEvents(careportalEvents);
return careportalEvents;
} catch (SQLException e) {
log.error("Unhandled exception", e);
@@ -1592,15 +1584,23 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// ---------------- ProfileSwitch handling ---------------
- public List getProfileSwitchData(boolean ascending) {
+ public List getProfileSwitchData(long from, boolean ascending) {
try {
Dao daoProfileSwitch = getDaoProfileSwitch();
List profileSwitches;
QueryBuilder queryBuilder = daoProfileSwitch.queryBuilder();
queryBuilder.orderBy("date", ascending);
queryBuilder.limit(100L);
+ Where where = queryBuilder.where();
+ where.ge("date", from);
PreparedQuery preparedQuery = queryBuilder.prepare();
profileSwitches = daoProfileSwitch.query(preparedQuery);
+ //add last one without duration
+ ProfileSwitch last = getLastProfileSwitchWithoutDuration();
+ if (last != null) {
+ if (!profileSwitches.contains(last))
+ profileSwitches.add(last);
+ }
return profileSwitches;
} catch (SQLException e) {
log.error("Unhandled exception", e);
@@ -1608,6 +1608,28 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<>();
}
+ @Nullable
+ private ProfileSwitch getLastProfileSwitchWithoutDuration() {
+ try {
+ Dao daoProfileSwitch = getDaoProfileSwitch();
+ List profileSwitches;
+ QueryBuilder queryBuilder = daoProfileSwitch.queryBuilder();
+ queryBuilder.orderBy("date", false);
+ queryBuilder.limit(1L);
+ Where where = queryBuilder.where();
+ where.eq("durationInMinutes", 0);
+ PreparedQuery preparedQuery = queryBuilder.prepare();
+ profileSwitches = daoProfileSwitch.query(preparedQuery);
+ if (profileSwitches.size() > 0)
+ return profileSwitches.get(0);
+ else
+ return null;
+ } catch (SQLException e) {
+ log.error("Unhandled exception", e);
+ }
+ return null;
+ }
+
public List getProfileSwitchEventsFromTime(long mills, boolean ascending) {
try {
Dao daoProfileSwitch = getDaoProfileSwitch();
diff --git a/app/src/main/java/info/nightscout/androidaps/db/DbRequest.java b/app/src/main/java/info/nightscout/androidaps/db/DbRequest.java
index f287e169ce..bec190a353 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DbRequest.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DbRequest.java
@@ -11,6 +11,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.L;
+import info.nightscout.androidaps.utils.DateUtil;
/**
* Created by mike on 27.02.2016.
@@ -40,36 +41,49 @@ public class DbRequest {
}
// dbAdd
- public DbRequest(String action, String collection, String nsClientID, JSONObject data) {
+ public DbRequest(String action, String collection, JSONObject data) {
this.action = action;
this.collection = collection;
+ this.nsClientID = "" + DateUtil.now();
+ try {
+ data.put("NSCLIENT_ID", nsClientID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
this.data = data.toString();
- this.nsClientID = nsClientID;
this._id = "";
}
// dbUpdate, dbUpdateUnset
- public DbRequest(String action, String collection, String nsClientID, String _id, JSONObject data) {
+ public DbRequest(String action, String collection, String _id, JSONObject data) {
this.action = action;
this.collection = collection;
+ this.nsClientID = "" + DateUtil.now();
+ try {
+ data.put("NSCLIENT_ID", nsClientID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
this.data = data.toString();
- this.nsClientID = nsClientID;
this._id = _id;
}
// dbRemove
- public DbRequest(String action, String collection, String nsClientID, String _id) {
+ public DbRequest(String action, String collection,
+ String _id) {
+ JSONObject data = new JSONObject();
this.action = action;
this.collection = collection;
- this.data = new JSONObject().toString();
- this.nsClientID = nsClientID;
+ this.nsClientID = "" + DateUtil.now();
+ try {
+ data.put("NSCLIENT_ID", nsClientID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ this.data = data.toString();
this._id = _id;
}
- public String hash() {
- return Hashing.sha1().hashString(action + collection + _id + data.toString(), Charsets.UTF_8).toString();
- }
-
public JSONObject toJSON() {
JSONObject object = new JSONObject();
try {
diff --git a/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java b/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java
index 5c865a331c..1632751d55 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java
@@ -325,8 +325,8 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
}
public String toStringMedium() {
- return "E " + DecimalFormatter.to2Decimal(absoluteRate()) + "U/h ("
- + getRealDuration() + "/" + durationInMinutes + ") ";
+ return DecimalFormatter.to2Decimal(absoluteRate()) + "U/h "
+ + getRealDuration() + "/" + durationInMinutes + "'";
}
public String toStringTotal() {
diff --git a/app/src/main/java/info/nightscout/androidaps/db/TDD.java b/app/src/main/java/info/nightscout/androidaps/db/TDD.java
index 93a228316c..be81e36ba3 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/TDD.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/TDD.java
@@ -6,8 +6,11 @@ import com.j256.ormlite.table.DatabaseTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
+import info.nightscout.androidaps.utils.DateUtil;
/**
* Created by mike on 20.09.2017.
@@ -56,4 +59,12 @@ public class TDD {
", total=" + total +
']';
}
+
+ public String toText() {
+ return MainApp.gs(R.string.tddformat, DateUtil.dateStringShort(date), total, bolus, basal);
+ }
+
+ public String toText(int days) {
+ return MainApp.gs(R.string.tddformat, String.format("%d ", days) + MainApp.gs(R.string.days), total, bolus, basal);
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
new file mode 100644
index 0000000000..3f629add06
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
@@ -0,0 +1,159 @@
+package info.nightscout.androidaps.dialogs
+
+import android.app.Activity
+import android.os.Bundle
+import android.os.SystemClock
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
+import androidx.fragment.app.DialogFragment
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.BolusProgressHelperActivity
+import info.nightscout.androidaps.events.EventPumpStatusChanged
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.bus.RxBus.toObservable
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
+import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
+import info.nightscout.androidaps.utils.FabricPrivacy
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.disposables.CompositeDisposable
+import kotlinx.android.synthetic.main.dialog_bolusprogress.*
+import org.slf4j.LoggerFactory
+
+class BolusProgressDialog : DialogFragment() {
+ private val log = LoggerFactory.getLogger(L.UI)
+ private val disposable = CompositeDisposable()
+
+ companion object {
+ private val DEFAULT_STATE = MainApp.gs(R.string.waitingforpump)
+ @JvmField
+ var bolusEnded = false
+ @JvmField
+ var stopPressed = false
+ }
+
+ private var running = true
+ private var amount = 0.0
+ private var state: String? = null
+ private var helpActivity: BolusProgressHelperActivity? = null
+
+ fun setInsulin(amount: Double): BolusProgressDialog {
+ this.amount = amount
+ bolusEnded = false
+ return this
+ }
+
+ fun setHelperActivity(activity: BolusProgressHelperActivity): BolusProgressDialog {
+ helpActivity = activity
+ return this
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
+ dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
+ isCancelable = false
+ dialog?.setCanceledOnTouchOutside(false)
+ return inflater.inflate(R.layout.dialog_bolusprogress, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ overview_bolusprogress_title.text = String.format(MainApp.gs(R.string.overview_bolusprogress_goingtodeliver), amount)
+ overview_bolusprogress_stop.setOnClickListener {
+ if (L.isEnabled(L.UI)) log.debug("Stop bolus delivery button pressed")
+ stopPressed = true
+ overview_bolusprogress_stoppressed.visibility = View.VISIBLE
+ overview_bolusprogress_stop.visibility = View.INVISIBLE
+ ConfigBuilderPlugin.getPlugin().commandQueue.cancelAllBoluses()
+ }
+ overview_bolusprogress_progressbar.max = 100
+ state = savedInstanceState?.getString("state", DEFAULT_STATE) ?: DEFAULT_STATE
+ overview_bolusprogress_status.text = state
+ stopPressed = false
+ }
+
+ override fun onStart() {
+ super.onStart()
+ dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ }
+
+ override fun onResume() {
+ super.onResume()
+ if (L.isEnabled(L.UI)) log.debug("onResume")
+ if (!ConfigBuilderPlugin.getPlugin().commandQueue.bolusInQueue())
+ bolusEnded = true
+
+ if (bolusEnded) dismiss()
+ else running = true
+
+ disposable.add(toObservable(EventPumpStatusChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ overview_bolusprogress_status.text = it.getStatus() }) { FabricPrivacy.logException(it) }
+ )
+ disposable.add(toObservable(EventDismissBolusProgressIfRunning::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ if (running) dismiss() }) { FabricPrivacy.logException(it) }
+ )
+ disposable.add(toObservable(EventOverviewBolusProgress::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ if (L.isEnabled(L.UI)) log.debug("Status: " + it.status + " Percent: " + it.percent)
+ overview_bolusprogress_status.text = it.status
+ overview_bolusprogress_progressbar.progress = it.percent
+ if (it.percent == 100) {
+ overview_bolusprogress_stop.visibility = View.INVISIBLE
+ scheduleDismiss()
+ }
+ state = it.status
+ }) { FabricPrivacy.logException(it) }
+ )
+ }
+
+ override fun dismiss() {
+ if (L.isEnabled(L.UI)) log.debug("dismiss")
+ try {
+ super.dismiss()
+ } catch (e: IllegalStateException) {
+ // dialog not running yet. onResume will try again. Set bolusEnded to make extra
+ // sure onResume will catch this
+ bolusEnded = true
+ log.error("Unhandled exception", e)
+ }
+ helpActivity?.finish()
+ }
+
+ override fun onPause() {
+ super.onPause()
+ if (L.isEnabled(L.UI)) log.debug("onPause")
+ running = false
+ disposable.clear()
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ outState.putString("state", state)
+ }
+
+ private fun scheduleDismiss() {
+ if (L.isEnabled(L.UI)) log.debug("scheduleDismiss")
+ Thread(Runnable {
+ SystemClock.sleep(5000)
+ bolusEnded = true
+ val activity: Activity? = activity
+ activity?.runOnUiThread {
+ if (running) {
+ if (L.isEnabled(L.UI)) log.debug("executing")
+ try {
+ dismiss()
+ } catch (e: Exception) {
+ log.error("Unhandled exception", e)
+ }
+ }
+ }
+ }).start()
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
new file mode 100644
index 0000000000..949e4e5fef
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
@@ -0,0 +1,68 @@
+package info.nightscout.androidaps.dialogs
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.XdripCalibrations
+import kotlinx.android.synthetic.main.dialog_calibration.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+
+class CalibrationDialog : DialogFragmentWithDate() {
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_calibration_bg", overview_calibration_bg.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_calibration, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ val units = ProfileFunctions.getSystemUnits()
+ val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
+ ?: 0.0, units)
+ if (units == Constants.MMOL)
+ overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
+ ?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok)
+ else
+ overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
+ ?: bg, 36.0, 500.0, 1.0, DecimalFormat("0"), false, ok)
+ overview_calibration_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
+ }
+
+ override fun submit() :Boolean {
+ val units = ProfileFunctions.getSystemUnits()
+ val unitLabel = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
+ val actions: LinkedList = LinkedList()
+ val bg = overview_calibration_bg.value
+ actions.add(MainApp.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(bg) + " " + unitLabel)
+ if (bg > 0) {
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ XdripCalibrations.confirmAndSendCalibration(bg, context)
+ })
+ }
+ } else
+ activity?.let { activity ->
+ OKDialog.show(activity, MainApp.gs(R.string.overview_calibration), MainApp.gs(R.string.no_action_selected))
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
new file mode 100644
index 0000000000..de457068c5
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
@@ -0,0 +1,223 @@
+package info.nightscout.androidaps.dialogs
+
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+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.interfaces.Constraint
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
+import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import info.nightscout.androidaps.utils.*
+import kotlinx.android.synthetic.main.dialog_carbs.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+import kotlin.math.max
+
+class CarbsDialog : DialogFragmentWithDate() {
+
+ companion object {
+ private const val FAV1_DEFAULT = 5
+ private const val FAV2_DEFAULT = 10
+ private const val FAV3_DEFAULT = 20
+ }
+
+ private val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value().toDouble()
+
+ private val textWatcher: TextWatcher = object : TextWatcher {
+ override fun afterTextChanged(s: Editable) {
+ validateInputs()
+ }
+
+ override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
+ }
+
+ private fun validateInputs() {
+ val time = overview_carbs_time.value.toInt()
+ if (time > 12 * 60 || time < -12 * 60) {
+ overview_carbs_time.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.constraintapllied))
+ }
+ if (overview_carbs_duration.value > 10) {
+ overview_carbs_duration.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.constraintapllied))
+ }
+ if (overview_carbs_carbs.value.toInt() > maxCarbs) {
+ overview_carbs_carbs.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.carbsconstraintapplied))
+ }
+ }
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_carbs_time", overview_carbs_time.value)
+ savedInstanceState.putDouble("overview_carbs_duration", overview_carbs_duration.value)
+ savedInstanceState.putDouble("overview_carbs_carbs", overview_carbs_carbs.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_carbs, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ overview_carbs_time.setParams(savedInstanceState?.getDouble("overview_carbs_time")
+ ?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
+
+ overview_carbs_duration.setParams(savedInstanceState?.getDouble("overview_carbs_duration")
+ ?: 0.0, 0.0, 10.0, 1.0, DecimalFormat("0"), false, ok, textWatcher)
+
+ overview_carbs_carbs.setParams(savedInstanceState?.getDouble("overview_carbs_carbs")
+ ?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
+
+ overview_carbs_plus1.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
+ overview_carbs_plus1.setOnClickListener {
+ overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
+ + SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
+ validateInputs()
+ }
+
+ overview_carbs_plus2.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
+ overview_carbs_plus2.setOnClickListener {
+ overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
+ + SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
+ validateInputs()
+ }
+
+ overview_carbs_plus3.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
+ overview_carbs_plus3.setOnClickListener {
+ overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
+ + SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
+ validateInputs()
+ }
+
+ DatabaseHelper.actualBg()?.let { bgReading ->
+ if (bgReading.value < 72)
+ overview_carbs_hypo_tt.setChecked(true)
+ }
+ overview_carbs_hypo_tt.setOnClickListener {
+ overview_carbs_activity_tt.isChecked = false
+ overview_carbs_eating_soon_tt.isChecked = false
+ }
+ overview_carbs_activity_tt.setOnClickListener {
+ overview_carbs_hypo_tt.isChecked = false
+ overview_carbs_eating_soon_tt.isChecked = false
+ }
+ overview_carbs_eating_soon_tt.setOnClickListener {
+ overview_carbs_hypo_tt.isChecked = false
+ overview_carbs_activity_tt.isChecked = false
+ }
+ }
+
+ private fun toSignedString(value: Int): String {
+ return if (value > 0) "+$value" else value.toString()
+ }
+
+ override fun submit(): Boolean {
+ val carbs = overview_carbs_carbs.value.toInt()
+ val carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(Constraint(carbs)).value()
+ val units = ProfileFunctions.getSystemUnits()
+ val activityTTDuration = DefaultValueHelper.determineActivityTTDuration()
+ val activityTT = DefaultValueHelper.determineActivityTT()
+ val eatingSoonTTDuration = DefaultValueHelper.determineEatingSoonTTDuration()
+ val eatingSoonTT = DefaultValueHelper.determineEatingSoonTT()
+ val hypoTTDuration = DefaultValueHelper.determineHypoTTDuration()
+ val hypoTT = DefaultValueHelper.determineHypoTT()
+ val actions: LinkedList = LinkedList()
+ val unitLabel = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
+
+ val activitySelected = overview_carbs_activity_tt.isChecked
+ if (activitySelected)
+ actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + activityTTDuration + " " + MainApp.gs(R.string.unit_minute_short) + ")")
+ val eatingSoonSelected = overview_carbs_eating_soon_tt.isChecked
+ if (eatingSoonSelected)
+ actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + eatingSoonTTDuration + " " + MainApp.gs(R.string.unit_minute_short) + ")")
+ val hypoSelected = overview_carbs_hypo_tt.isChecked
+ if (hypoSelected)
+ actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + hypoTTDuration + " " + MainApp.gs(R.string.unit_minute_short) + ")")
+
+ val timeOffset = overview_carbs_time.value.toInt()
+ val time = eventTime + timeOffset * 1000 * 60
+ if (timeOffset != 0)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time))
+ val duration = overview_carbs_duration.value.toInt()
+ if (duration > 0)
+ actions.add(MainApp.gs(R.string.duration) + ": " + duration + MainApp.gs(R.string.shorthour))
+ if (carbsAfterConstraints > 0) {
+ actions.add(MainApp.gs(R.string.carbs) + ": " + "" + MainApp.gs(R.string.format_carbs, carbsAfterConstraints) + "")
+ if (carbsAfterConstraints != carbs)
+ actions.add("" + MainApp.gs(R.string.carbsconstraintapplied) + "")
+ }
+ val notes = notes.text.toString()
+ if (notes.isNotEmpty())
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
+
+ if (eventTimeChanged)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
+
+ if (carbsAfterConstraints > 0 || activitySelected || eatingSoonSelected || hypoSelected) {
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.carbs), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ if (activitySelected) {
+ val tempTarget = TempTarget()
+ .date(eventTime)
+ .duration(activityTTDuration)
+ .reason(MainApp.gs(R.string.activity))
+ .source(Source.USER)
+ .low(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
+ .high(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ } else if (eatingSoonSelected) {
+ val tempTarget = TempTarget()
+ .date(eventTime)
+ .duration(eatingSoonTTDuration)
+ .reason(MainApp.gs(R.string.eatingsoon))
+ .source(Source.USER)
+ .low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
+ .high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ } else if (hypoSelected) {
+ val tempTarget = TempTarget()
+ .date(eventTime)
+ .duration(hypoTTDuration)
+ .reason(MainApp.gs(R.string.hypo))
+ .source(Source.USER)
+ .low(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
+ .high(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ }
+ if (carbsAfterConstraints > 0) {
+ if (duration == 0) {
+ CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes)
+ } else {
+ CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes)
+ NSUpload.uploadEvent(CareportalEvent.NOTE, time - 2000, MainApp.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset))
+ }
+ }
+ }, null)
+ }
+ } else
+ activity?.let { activity ->
+ OKDialog.show(activity, MainApp.gs(R.string.carbs), MainApp.gs(R.string.no_action_selected))
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
new file mode 100644
index 0000000000..0e47049cf1
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
@@ -0,0 +1,189 @@
+package info.nightscout.androidaps.dialogs
+
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Button
+import androidx.annotation.StringRes
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.db.CareportalEvent
+import info.nightscout.androidaps.db.Source
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.SP
+import info.nightscout.androidaps.utils.Translator
+import kotlinx.android.synthetic.main.dialog_care.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import org.json.JSONObject
+import java.text.DecimalFormat
+import java.util.*
+
+class CareDialog : DialogFragmentWithDate() {
+
+ enum class EventType {
+ BGCHECK,
+ SENSOR_INSERT,
+ BATTERY_CHANGE,
+ NOTE,
+ EXERCISE
+ }
+
+ private var options: EventType = EventType.BGCHECK
+ @StringRes
+ private var event: Int = R.string.none
+
+ fun setOptions(options: EventType, @StringRes event: Int): CareDialog {
+ this.options = options
+ this.event = event
+ return this
+ }
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("actions_care_bg", actions_care_bg.value)
+ savedInstanceState.putDouble("actions_care_duration", actions_care_duration.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_care, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ actions_care_icon.setImageResource(when (options) {
+ EventType.BGCHECK -> R.drawable.icon_cp_bgcheck
+ EventType.SENSOR_INSERT -> R.drawable.icon_cp_cgm_insert
+ EventType.BATTERY_CHANGE -> R.drawable.icon_cp_pump_battery
+ EventType.NOTE -> R.drawable.icon_cp_note
+ EventType.EXERCISE -> R.drawable.icon_cp_exercise
+ })
+ actions_care_title.text = MainApp.gs(when (options) {
+ EventType.BGCHECK -> R.string.careportal_bgcheck
+ EventType.SENSOR_INSERT -> R.string.careportal_cgmsensorinsert
+ EventType.BATTERY_CHANGE -> R.string.careportal_pumpbatterychange
+ EventType.NOTE -> R.string.careportal_note
+ EventType.EXERCISE -> R.string.careportal_exercise
+ })
+
+ when (options) {
+ EventType.BGCHECK -> {
+ action_care_duration_layout.visibility = View.GONE
+ }
+ EventType.SENSOR_INSERT,
+ EventType.BATTERY_CHANGE -> {
+ action_care_bg_layout.visibility = View.GONE
+ actions_care_bgsource.visibility = View.GONE
+ action_care_duration_layout.visibility = View.GONE
+ }
+ EventType.NOTE,
+ EventType.EXERCISE -> {
+ action_care_bg_layout.visibility = View.GONE
+ actions_care_bgsource.visibility = View.GONE
+ }
+ }
+
+ val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
+ ?: 0.0, ProfileFunctions.getSystemUnits())
+ val bgTextWatcher: TextWatcher = object : TextWatcher {
+ override fun afterTextChanged(s: Editable) {}
+ override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
+ if (actions_care_sensor.isChecked) actions_care_meter.isChecked = true
+ }
+ }
+
+ if (ProfileFunctions.getSystemUnits() == Constants.MMOL) {
+ actions_care_bgunits.text = MainApp.gs(R.string.mmol)
+ actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
+ ?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok, bgTextWatcher)
+ } else {
+ actions_care_bgunits.text = MainApp.gs(R.string.mgdl)
+ actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
+ ?: bg, 36.0, 500.0, 1.0, DecimalFormat("0"), false, ok, bgTextWatcher)
+ }
+ actions_care_duration.setParams(savedInstanceState?.getDouble("actions_care_duration")
+ ?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
+ if (options == EventType.NOTE)
+ notes_layout?.visibility = View.VISIBLE // independent to preferences
+ }
+
+ override fun submit(): Boolean {
+ val enteredBy = SP.getString("careportal_enteredby", "")
+ val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
+
+ val json = JSONObject()
+ val actions: LinkedList = LinkedList()
+ if (options == EventType.BGCHECK) {
+ val type =
+ when {
+ actions_care_meter.isChecked -> "Finger"
+ actions_care_sensor.isChecked -> "Sensor"
+ else -> "Manual"
+ }
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + Translator.translate(type))
+ actions.add(MainApp.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(actions_care_bg.value) + " " + MainApp.gs(unitResId))
+ json.put("glucose", actions_care_bg.value)
+ json.put("glucoseType", type)
+ }
+ if (options == EventType.NOTE || options == EventType.EXERCISE) {
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_duration_label) + ": " + MainApp.gs(R.string.format_mins, actions_care_duration.value.toInt()))
+ json.put("duration", actions_care_duration.value.toInt())
+ }
+ val notes = notes.text.toString()
+ if (notes.isNotEmpty()) {
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
+ json.put("notes", notes)
+ }
+ eventTime -= eventTime % 1000
+
+ if (eventTimeChanged)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
+
+ json.put("created_at", DateUtil.toISOString(eventTime))
+ json.put("mills", eventTime)
+ json.put("eventType", when (options) {
+ EventType.BGCHECK -> CareportalEvent.BGCHECK
+ EventType.SENSOR_INSERT -> CareportalEvent.SENSORCHANGE
+ EventType.BATTERY_CHANGE -> CareportalEvent.PUMPBATTERYCHANGE
+ EventType.NOTE -> CareportalEvent.NOTE
+ EventType.EXERCISE -> CareportalEvent.EXERCISE
+ })
+ json.put("units", ProfileFunctions.getSystemUnits())
+ if (enteredBy.isNotEmpty())
+ json.put("enteredBy", enteredBy)
+
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(event), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ val careportalEvent = CareportalEvent()
+ careportalEvent.date = eventTime
+ careportalEvent.source = Source.USER
+ careportalEvent.eventType = when (options) {
+ EventType.BGCHECK -> CareportalEvent.BGCHECK
+ EventType.SENSOR_INSERT -> CareportalEvent.SENSORCHANGE
+ EventType.BATTERY_CHANGE -> CareportalEvent.PUMPBATTERYCHANGE
+ EventType.NOTE -> CareportalEvent.NOTE
+ EventType.EXERCISE -> CareportalEvent.EXERCISE
+ }
+ careportalEvent.json = json.toString()
+ MainApp.getDbHelper().createOrUpdate(careportalEvent)
+ NSUpload.uploadCareportalEntryToNS(json)
+ }, null)
+ }
+ return true
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt
new file mode 100644
index 0000000000..da45e77990
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt
@@ -0,0 +1,124 @@
+package info.nightscout.androidaps.dialogs
+
+import android.app.DatePickerDialog
+import android.app.TimePickerDialog
+import android.os.Bundle
+import android.text.format.DateFormat
+import android.view.View
+import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
+import androidx.fragment.app.DialogFragment
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.SP
+import info.nightscout.androidaps.utils.toVisibility
+import kotlinx.android.synthetic.main.datetime.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import org.slf4j.LoggerFactory
+import java.util.*
+
+abstract class DialogFragmentWithDate : DialogFragment() {
+ private val log = LoggerFactory.getLogger(DialogFragmentWithDate::class.java)
+
+ var eventTime = DateUtil.now()
+ var eventTimeChanged = false
+
+ //one shot guards
+ private var okClicked: Boolean = false
+
+ companion object {
+ private var seconds: Int = (Math.random() * 59.0).toInt()
+ }
+
+ override fun onStart() {
+ super.onStart()
+ dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ }
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putLong("eventTime", eventTime)
+ savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
+ }
+
+ fun onCreateViewGeneral() {
+ dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
+ dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
+ isCancelable = true
+ dialog?.setCanceledOnTouchOutside(false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ eventTime = savedInstanceState?.getLong("eventTime") ?: DateUtil.now()
+ eventTimeChanged = savedInstanceState?.getBoolean("eventTimeChanged") ?: false
+ overview_eventdate?.text = DateUtil.dateString(eventTime)
+ overview_eventtime?.text = DateUtil.timeString(eventTime)
+
+ // create an OnDateSetListener
+ val dateSetListener = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
+ val cal = Calendar.getInstance()
+ cal.timeInMillis = eventTime
+ cal.set(Calendar.YEAR, year)
+ cal.set(Calendar.MONTH, monthOfYear)
+ cal.set(Calendar.DAY_OF_MONTH, dayOfMonth)
+ eventTime = cal.timeInMillis
+ eventTimeChanged = true
+ overview_eventdate?.text = DateUtil.dateString(eventTime)
+ }
+
+ overview_eventdate?.setOnClickListener {
+ context?.let {
+ val cal = Calendar.getInstance()
+ cal.timeInMillis = eventTime
+ DatePickerDialog(it, dateSetListener,
+ cal.get(Calendar.YEAR),
+ cal.get(Calendar.MONTH),
+ cal.get(Calendar.DAY_OF_MONTH)
+ ).show()
+ }
+ }
+
+ // create an OnTimeSetListener
+ val timeSetListener = TimePickerDialog.OnTimeSetListener { _, hour, minute ->
+ val cal = Calendar.getInstance()
+ cal.timeInMillis = eventTime
+ cal.set(Calendar.HOUR_OF_DAY, hour)
+ cal.set(Calendar.MINUTE, minute)
+ cal.set(Calendar.SECOND, seconds++) // randomize seconds to prevent creating record of the same time, if user choose time manually
+ eventTime = cal.timeInMillis
+ eventTimeChanged = true
+ overview_eventtime?.text = DateUtil.timeString(eventTime)
+ }
+
+ overview_eventtime?.setOnClickListener {
+ context?.let {
+ val cal = Calendar.getInstance()
+ cal.timeInMillis = eventTime
+ TimePickerDialog(it, timeSetListener,
+ cal.get(Calendar.HOUR_OF_DAY),
+ cal.get(Calendar.MINUTE),
+ DateFormat.is24HourFormat(context)
+ ).show()
+ }
+ }
+
+ notes_layout?.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
+
+ ok.setOnClickListener {
+ synchronized(okClicked) {
+ if (okClicked) {
+ log.debug("guarding: ok already clicked")
+ } else {
+ okClicked = true
+ if (submit()) dismiss()
+ else okClicked = false
+ }
+ }
+ }
+ cancel.setOnClickListener { dismiss() }
+ }
+
+ abstract fun submit(): Boolean
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
similarity index 77%
rename from app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.kt
rename to app/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
index 8ea499d4ef..538a2ca483 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
@@ -1,5 +1,4 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs
-
+package info.nightscout.androidaps.dialogs
import android.content.Intent
import android.os.Build
@@ -7,11 +6,14 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.services.AlarmSoundService
-import kotlinx.android.synthetic.main.overview_error_dialog.*
+import kotlinx.android.synthetic.main.dialog_error.*
import org.slf4j.LoggerFactory
class ErrorDialog : DialogFragment() {
@@ -24,20 +26,23 @@ class ErrorDialog : DialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
- dialog?.setTitle(title)
- isCancelable = false
+ dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
+ dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
+ isCancelable = true
+ dialog?.setCanceledOnTouchOutside(false)
savedInstanceState?.let { bundle ->
bundle.getString("status")?.let { status = it }
bundle.getString("title")?.let { title = it }
sound = bundle.getInt("sound", R.raw.error)
}
- return inflater.inflate(R.layout.overview_error_dialog, container, false)
+ return inflater.inflate(R.layout.dialog_error, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
+ error_title.text = title
overview_error_ok.setOnClickListener {
log.debug("Error dialog ok button pressed")
dismiss()
@@ -56,9 +61,13 @@ class ErrorDialog : DialogFragment() {
bundle.putInt("sound", sound)
}
+ override fun onStart() {
+ super.onStart()
+ dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ }
+
override fun onResume() {
super.onResume()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
overview_error_status.text = status
}
@@ -81,5 +90,5 @@ class ErrorDialog : DialogFragment() {
}
private fun stopAlarm() =
- MainApp.instance().stopService(Intent(MainApp.instance().applicationContext, AlarmSoundService::class.java))
+ MainApp.instance().stopService(Intent(MainApp.instance().applicationContext, AlarmSoundService::class.java))
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
new file mode 100644
index 0000000000..a717e79b49
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
@@ -0,0 +1,82 @@
+package info.nightscout.androidaps.dialogs
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.SafeParse
+import kotlinx.android.synthetic.main.dialog_extendedbolus.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+import kotlin.math.abs
+
+class ExtendedBolusDialog : DialogFragmentWithDate() {
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("actions_extendedbolus_insulin", actions_extendedbolus_insulin.value)
+ savedInstanceState.putDouble("actions_extendedbolus_duration", actions_extendedbolus_duration.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_extendedbolus, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
+
+ val maxInsulin = MainApp.getConstraintChecker().maxExtendedBolusAllowed.value()
+ val extendedStep = pumpDescription.extendedBolusStep
+ actions_extendedbolus_insulin.setParams(savedInstanceState?.getDouble("actions_extendedbolus_insulin")
+ ?: extendedStep, extendedStep, maxInsulin, extendedStep, DecimalFormat("0.00"), false, ok)
+
+ val extendedDurationStep = pumpDescription.extendedBolusDurationStep
+ val extendedMaxDuration = pumpDescription.extendedBolusMaxDuration
+ actions_extendedbolus_duration.setParams(savedInstanceState?.getDouble("actions_extendedbolus_duration")
+ ?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, ok)
+ }
+
+ override fun submit(): Boolean {
+ val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin.text)
+ val durationInMinutes = SafeParse.stringToInt(actions_extendedbolus_duration.text)
+ val actions: LinkedList = LinkedList()
+ val insulinAfterConstraint = MainApp.getConstraintChecker().applyExtendedBolusConstraints(Constraint(insulin)).value()
+ actions.add(MainApp.gs(R.string.formatinsulinunits, insulinAfterConstraint))
+ actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_mins, durationInMinutes))
+ if (abs(insulinAfterConstraint - insulin) > 0.01)
+ actions.add("" + MainApp.gs(R.string.constraintapllied) + "")
+
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ ConfigBuilderPlugin.getPlugin().commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ }, null)
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
new file mode 100644
index 0000000000..273d0b800d
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -0,0 +1,169 @@
+package info.nightscout.androidaps.dialogs
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.data.DetailedBolusInfo
+import info.nightscout.androidaps.db.CareportalEvent
+import info.nightscout.androidaps.db.Source
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.*
+import kotlinx.android.synthetic.main.dialog_fill.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import org.json.JSONException
+import org.json.JSONObject
+import java.util.*
+import kotlin.math.abs
+
+class FillDialog : DialogFragmentWithDate() {
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("fill_insulinamount", fill_insulinamount.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_fill, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ val maxInsulin = MainApp.getConstraintChecker().maxBolusAllowed.value()
+ val bolusStep = ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep
+ fill_insulinamount.setParams(savedInstanceState?.getDouble("fill_insulinamount")
+ ?: 0.0, 0.0, maxInsulin, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), true, ok)
+ val amount1 = SP.getDouble("fill_button1", 0.3)
+ if (amount1 > 0) {
+ fill_preset_button1.visibility = View.VISIBLE
+ fill_preset_button1.text = DecimalFormatter.toPumpSupportedBolus(amount1) // + "U");
+ fill_preset_button1.setOnClickListener { fill_insulinamount.value = amount1 }
+ } else {
+ fill_preset_button1.visibility = View.GONE
+ }
+ val amount2 = SP.getDouble("fill_button2", 0.0)
+ if (amount2 > 0) {
+ fill_preset_button2.visibility = View.VISIBLE
+ fill_preset_button2.text = DecimalFormatter.toPumpSupportedBolus(amount2) // + "U");
+ fill_preset_button2.setOnClickListener { fill_insulinamount.value = amount2 }
+ } else {
+ fill_preset_button2.visibility = View.GONE
+ }
+ val amount3 = SP.getDouble("fill_button3", 0.0)
+ if (amount3 > 0) {
+ fill_preset_button3.visibility = View.VISIBLE
+ fill_preset_button3.text = DecimalFormatter.toPumpSupportedBolus(amount3) // + "U");
+ fill_preset_button3.setOnClickListener { fill_insulinamount.value = amount3 }
+ } else {
+ fill_preset_button3.visibility = View.GONE
+ }
+
+ }
+
+ override fun submit(): Boolean {
+ val insulin = SafeParse.stringToDouble(fill_insulinamount.text)
+ val actions: LinkedList = LinkedList()
+
+ val insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(insulin)).value()
+ if (insulinAfterConstraints > 0) {
+ actions.add(MainApp.gs(R.string.fillwarning))
+ actions.add("")
+ actions.add(MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + MainApp.gs(R.string.insulin_unit_shortname) + "")
+ if (abs(insulinAfterConstraints - insulin) > 0.01)
+ actions.add(MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints))
+ }
+ val siteChange = fill_catheter_change.isChecked
+ if (siteChange)
+ actions.add("" + "" + MainApp.gs(R.string.record_pump_site_change) + "")
+ val insulinChange = fill_cartridge_change.isChecked
+ if (insulinChange)
+ actions.add("" + "" + MainApp.gs(R.string.record_insulin_cartridge_change) + "")
+ val notes = notes.text.toString()
+ if (notes.isNotEmpty())
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
+ eventTime -= eventTime % 1000
+
+ if (eventTimeChanged)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
+
+ if (insulinAfterConstraints > 0 || fill_catheter_change.isChecked || fill_cartridge_change.isChecked) {
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ if (insulinAfterConstraints > 0) {
+ requestPrimeBolus(insulinAfterConstraints, notes)
+ }
+ if (siteChange) {
+ generateCareportalEvent(CareportalEvent.SITECHANGE, eventTime, notes)
+ }
+ if (insulinChange) {
+ // add a second for case of both checked
+ generateCareportalEvent(CareportalEvent.INSULINCHANGE, eventTime + 1000, notes)
+ }
+ }, null)
+ }
+ } else {
+ activity?.let { activity ->
+ OKDialog.show(activity, MainApp.gs(R.string.primefill), MainApp.gs(R.string.no_action_selected))
+ }
+ }
+ dismiss()
+ return true
+ }
+
+ private fun requestPrimeBolus(insulin: Double, notes: String) {
+ val detailedBolusInfo = DetailedBolusInfo()
+ detailedBolusInfo.insulin = insulin
+ detailedBolusInfo.context = context
+ detailedBolusInfo.source = Source.USER
+ detailedBolusInfo.isValid = false // do not count it in IOB (for pump history)
+ detailedBolusInfo.notes = notes
+ ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ }
+
+ private fun generateCareportalEvent(eventType: String, time: Long, notes: String) {
+ val careportalEvent = CareportalEvent()
+ careportalEvent.source = Source.USER
+ careportalEvent.date = time
+ careportalEvent.json = generateJson(eventType, time, notes).toString()
+ careportalEvent.eventType = eventType
+ MainApp.getDbHelper().createOrUpdate(careportalEvent)
+ NSUpload.uploadEvent(eventType, time, notes)
+ }
+
+ private fun generateJson(careportalEvent: String, time: Long, notes: String): JSONObject {
+ val data = JSONObject()
+ try {
+ data.put("eventType", careportalEvent)
+ data.put("created_at", DateUtil.toISOString(time))
+ data.put("mills", time)
+ data.put("enteredBy", SP.getString("careportal_enteredby", MainApp.gs(R.string.app_name)))
+ if (notes.isNotEmpty()) data.put("notes", notes)
+ } catch (ignored: JSONException) {
+ }
+ return data
+ }
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
new file mode 100644
index 0000000000..d6f64d87f1
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -0,0 +1,193 @@
+package info.nightscout.androidaps.dialogs
+
+import android.content.Intent
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+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.interfaces.Constraint
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.*
+import kotlinx.android.synthetic.main.dialog_insulin.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+import kotlin.math.abs
+import kotlin.math.max
+
+class InsulinDialog : DialogFragmentWithDate() {
+
+ companion object {
+ private const val PLUS1_DEFAULT = 0.5
+ private const val PLUS2_DEFAULT = 1.0
+ private const val PLUS3_DEFAULT = 2.0
+ }
+
+ private val maxInsulin = MainApp.getConstraintChecker().maxBolusAllowed.value()
+
+ private val textWatcher: TextWatcher = object : TextWatcher {
+ override fun afterTextChanged(s: Editable) {
+ validateInputs()
+ }
+
+ override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
+ }
+
+ private fun validateInputs() {
+ if (abs(overview_insulin_time.value.toInt()) > 12 * 60) {
+ overview_insulin_time.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.constraintapllied))
+ }
+ if (overview_insulin_amount.value > maxInsulin) {
+ overview_insulin_amount.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.bolusconstraintapplied))
+ }
+ }
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_insulin_time", overview_insulin_time.value)
+ savedInstanceState.putDouble("overview_insulin_amount", overview_insulin_amount.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_insulin, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ overview_insulin_time.setParams(savedInstanceState?.getDouble("overview_insulin_time")
+ ?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
+ overview_insulin_amount.setParams(savedInstanceState?.getDouble("overview_insulin_amount")
+ ?: 0.0, 0.0, maxInsulin, ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
+
+ overview_insulin_plus05.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
+ overview_insulin_plus05.setOnClickListener {
+ overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
+ + SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
+ validateInputs()
+ }
+ overview_insulin_plus10.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
+ overview_insulin_plus10.setOnClickListener {
+ overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
+ + SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
+ validateInputs()
+ }
+ overview_insulin_plus20.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
+ overview_insulin_plus20.setOnClickListener {
+ overview_insulin_amount.value = Math.max(0.0, overview_insulin_amount.value
+ + SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
+ validateInputs()
+ }
+
+ overview_insulin_time_layout.visibility = View.GONE
+ overview_insulin_record_only.setOnCheckedChangeListener { _, isChecked: Boolean ->
+ overview_insulin_time_layout.visibility = isChecked.toVisibility()
+ }
+ }
+
+ private fun toSignedString(value: Double): String {
+ val formatted = DecimalFormatter.toPumpSupportedBolus(value)
+ return if (value > 0) "+$formatted" else formatted
+ }
+
+ override fun submit(): Boolean {
+ val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription
+ ?: return false
+ val insulin = SafeParse.stringToDouble(overview_insulin_amount.text)
+ val insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(insulin)).value()
+ val actions: LinkedList = LinkedList()
+ val units = ProfileFunctions.getSystemUnits()
+ val unitLabel = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
+ val recordOnlyChecked = overview_insulin_record_only.isChecked
+ val eatingSoonChecked = overview_insulin_start_eating_soon_tt.isChecked
+
+ if (insulinAfterConstraints > 0) {
+ actions.add(MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + MainApp.gs(R.string.insulin_unit_shortname) + "")
+ if (recordOnlyChecked)
+ actions.add("" + MainApp.gs(R.string.bolusrecordedonly) + "")
+ if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
+ actions.add(MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints))
+ }
+ val eatingSoonTTDuration = DefaultValueHelper.determineEatingSoonTTDuration()
+ val eatingSoonTT = DefaultValueHelper.determineEatingSoonTT()
+ if (eatingSoonChecked)
+ actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + eatingSoonTTDuration + " " + MainApp.gs(R.string.unit_minute_short) + ")")
+
+ val timeOffset = overview_insulin_time.value.toInt()
+ val time = DateUtil.now() + T.mins(timeOffset.toLong()).msecs()
+ if (timeOffset != 0)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time))
+
+ val notes = notes.text.toString()
+ if (notes.isNotEmpty())
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
+
+ if (insulinAfterConstraints > 0 || eatingSoonChecked) {
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ if (eatingSoonChecked) {
+ val tempTarget = TempTarget()
+ .date(System.currentTimeMillis())
+ .duration(eatingSoonTTDuration)
+ .reason(MainApp.gs(R.string.eatingsoon))
+ .source(Source.USER)
+ .low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
+ .high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ }
+ if (insulinAfterConstraints > 0) {
+ val detailedBolusInfo = DetailedBolusInfo()
+ detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS
+ detailedBolusInfo.insulin = insulinAfterConstraints
+ detailedBolusInfo.context = context
+ detailedBolusInfo.source = Source.USER
+ detailedBolusInfo.notes = notes
+ if (recordOnlyChecked) {
+ detailedBolusInfo.date = time
+ TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false)
+ } else {
+ detailedBolusInfo.date = DateUtil.now()
+ ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ }
+ }
+ })
+ }
+ } else
+ activity?.let { activity ->
+ OKDialog.show(activity, MainApp.gs(R.string.bolus), MainApp.gs(R.string.no_action_selected))
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
new file mode 100644
index 0000000000..5df248593c
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
@@ -0,0 +1,105 @@
+package info.nightscout.androidaps.dialogs
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ArrayAdapter
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import kotlinx.android.synthetic.main.dialog_profileswitch.*
+import kotlinx.android.synthetic.main.notes.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+
+class ProfileSwitchDialog : DialogFragmentWithDate() {
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_profileswitch_duration", overview_profileswitch_duration.value)
+ savedInstanceState.putDouble("overview_profileswitch_percentage", overview_profileswitch_percentage.value)
+ savedInstanceState.putDouble("overview_profileswitch_timeshift", overview_profileswitch_timeshift.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_profileswitch, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ overview_profileswitch_duration.setParams(savedInstanceState?.getDouble("overview_profileswitch_duration")
+ ?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
+ overview_profileswitch_percentage.setParams(savedInstanceState?.getDouble("overview_profileswitch_percentage")
+ ?: 100.0, Constants.CPP_MIN_PERCENTAGE.toDouble(), Constants.CPP_MAX_PERCENTAGE.toDouble(), 1.0, DecimalFormat("0"), false, ok)
+ overview_profileswitch_timeshift.setParams(savedInstanceState?.getDouble("overview_profileswitch_timeshift")
+ ?: 0.0, Constants.CPP_MIN_TIMESHIFT.toDouble(), Constants.CPP_MAX_TIMESHIFT.toDouble(), 1.0, DecimalFormat("0"), false, ok)
+
+ // profile
+ context?.let { context ->
+ val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
+ ?: return
+ val profileList = profileStore.getProfileList()
+ val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
+ overview_profileswitch_profile.adapter = adapter
+ // set selected to actual profile
+ for (p in profileList.indices)
+ if (profileList[p] == ProfileFunctions.getInstance().getProfileName(false))
+ overview_profileswitch_profile.setSelection(p)
+ } ?: return
+
+ TreatmentsPlugin.getPlugin().getProfileSwitchFromHistory(DateUtil.now())?.let { ps ->
+ if (ps.isCPP) {
+ overview_profileswitch_reuselayout.visibility = View.VISIBLE
+ overview_profileswitch_reusebutton.text = MainApp.gs(R.string.reuse) + " " + ps.percentage + "% " + ps.timeshift + "h"
+ overview_profileswitch_reusebutton.setOnClickListener {
+ overview_profileswitch_percentage.value = ps.percentage.toDouble()
+ overview_profileswitch_timeshift.value = ps.timeshift.toDouble()
+ }
+ } else {
+ overview_profileswitch_reuselayout.visibility = View.GONE
+ }
+ }
+ }
+
+ override fun submit(): Boolean {
+ val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
+ ?: return false
+
+ val actions: LinkedList = LinkedList()
+ val duration = overview_profileswitch_duration.value
+ if (duration > 0)
+ actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_hours, duration))
+ val profile = overview_profileswitch_profile.selectedItem.toString()
+ actions.add(MainApp.gs(R.string.profile) + ": " + profile)
+ val percent = overview_profileswitch_percentage.value.toInt()
+ if (percent != 100)
+ actions.add(MainApp.gs(R.string.percent) + ": " + percent + "%")
+ val timeShift = overview_profileswitch_timeshift.value.toInt()
+ if (timeShift != 0)
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_timeshift_label) + ": " + MainApp.gs(R.string.format_hours, timeShift.toDouble()))
+ val notes = notes.text.toString()
+ if (notes.isNotEmpty())
+ actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
+ if (eventTimeChanged)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
+
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime)
+ })
+ }
+ return true
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
similarity index 66%
rename from app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.kt
rename to app/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
index be9adece61..ef3b19d4d8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
@@ -1,29 +1,34 @@
-package info.nightscout.androidaps.plugins.treatments.fragments
+package info.nightscout.androidaps.dialogs
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
import androidx.fragment.app.DialogFragment
+import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
-import info.nightscout.androidaps.interfaces.ProfileInterface
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DateUtil
import kotlinx.android.synthetic.main.close.*
-import kotlinx.android.synthetic.main.profileviewer_fragment.*
+import kotlinx.android.synthetic.main.dialog_profileviewer.*
+import org.json.JSONObject
class ProfileViewerDialog : DialogFragment() {
private var time: Long = 0
enum class Mode(val i: Int) {
RUNNING_PROFILE(1),
- PUMP_PROFILE(2)
+ CUSTOM_PROFILE(2)
}
- private var mode: Mode = Mode.RUNNING_PROFILE;
+ private var mode: Mode = Mode.RUNNING_PROFILE
+ private var customProfileJson: String = ""
+ private var customProfileName: String = ""
+ private var customProfileUnits: String = Constants.MGDL
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
@@ -31,19 +36,23 @@ class ProfileViewerDialog : DialogFragment() {
(savedInstanceState ?: arguments)?.let { bundle ->
time = bundle.getLong("time", 0)
mode = Mode.values()[bundle.getInt("mode", Mode.RUNNING_PROFILE.ordinal)]
+ customProfileJson = bundle.getString("customProfile", "")
+ customProfileUnits = bundle.getString("customProfileUnits", Constants.MGDL)
+ customProfileName = bundle.getString("customProfileName", "")
}
- return inflater.inflate(R.layout.profileviewer_fragment, container, false)
+ dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
+ dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
+ isCancelable = true
+ dialog?.setCanceledOnTouchOutside(false)
+
+ return inflater.inflate(R.layout.dialog_profileviewer, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
close.setOnClickListener { dismiss() }
- profileview_reload.setOnClickListener {
- ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("ProfileViewDialog", null)
- dismiss()
- }
val profile: Profile?
val profileName: String?
@@ -53,15 +62,14 @@ class ProfileViewerDialog : DialogFragment() {
profile = TreatmentsPlugin.getPlugin().getProfileSwitchFromHistory(time)?.profileObject
profileName = TreatmentsPlugin.getPlugin().getProfileSwitchFromHistory(time)?.customizedName
date = DateUtil.dateAndTimeString(TreatmentsPlugin.getPlugin().getProfileSwitchFromHistory(time)?.date
- ?: 0)
- profileview_reload.visibility = View.GONE
+ ?: 0)
profileview_datelayout.visibility = View.VISIBLE
}
- Mode.PUMP_PROFILE -> {
- profile = (ConfigBuilderPlugin.getPlugin().activePump as ProfileInterface?)?.profile?.getDefaultProfile()
- profileName = (ConfigBuilderPlugin.getPlugin().activePump as ProfileInterface?)?.profileName
+
+ Mode.CUSTOM_PROFILE -> {
+ profile = Profile(JSONObject(customProfileJson), customProfileUnits)
+ profileName = customProfileName
date = ""
- profileview_reload.visibility = View.VISIBLE
profileview_datelayout.visibility = View.GONE
}
}
@@ -83,15 +91,18 @@ class ProfileViewerDialog : DialogFragment() {
}
}
- override fun onResume() {
+ override fun onStart() {
+ super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
- super.onResume()
}
override fun onSaveInstanceState(bundle: Bundle) {
super.onSaveInstanceState(bundle)
bundle.putLong("time", time)
bundle.putInt("mode", mode.ordinal)
+ bundle.putString("customProfile", customProfileJson)
+ bundle.putString("customProfileName", customProfileName)
+ bundle.putString("customProfileUnits", customProfileUnits)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
new file mode 100644
index 0000000000..dc31349650
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -0,0 +1,115 @@
+package info.nightscout.androidaps.dialogs
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.interfaces.PumpDescription
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.SafeParse
+import kotlinx.android.synthetic.main.dialog_tempbasal.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+import kotlin.math.abs
+
+class TempBasalDialog : DialogFragmentWithDate() {
+ private var isPercentPump = true
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("actions_tempbasal_duration", actions_tempbasal_duration.value)
+ savedInstanceState.putDouble("actions_tempbasal_basalpercentinput", actions_tempbasal_basalpercentinput.value)
+ savedInstanceState.putDouble("actions_tempbasal_basalabsoluteinput", actions_tempbasal_basalabsoluteinput.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_tempbasal, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
+ val profile = ProfileFunctions.getInstance().profile ?: return
+
+ val maxTempPercent = pumpDescription.maxTempPercent.toDouble()
+ val tempPercentStep = pumpDescription.tempPercentStep.toDouble()
+
+ actions_tempbasal_basalpercentinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalpercentinput")
+ ?: 100.0, 0.0, maxTempPercent, tempPercentStep, DecimalFormat("0"), true, ok)
+
+ actions_tempbasal_basalabsoluteinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalabsoluteinput")
+ ?: profile.basal, 0.0, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, DecimalFormat("0.00"), true, ok)
+
+ val tempDurationStep = pumpDescription.tempDurationStep.toDouble()
+ val tempMaxDuration = pumpDescription.tempMaxDuration.toDouble()
+ actions_tempbasal_duration.setParams(savedInstanceState?.getDouble("actions_tempbasal_duration")
+ ?: tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, DecimalFormat("0"), false, ok)
+
+ isPercentPump = pumpDescription.tempBasalStyle and PumpDescription.PERCENT == PumpDescription.PERCENT
+ if (isPercentPump) {
+ actions_tempbasal_percent_layout.visibility = View.VISIBLE
+ actions_tempbasal_absolute_layout.visibility = View.GONE
+ } else {
+ actions_tempbasal_percent_layout.visibility = View.GONE
+ actions_tempbasal_absolute_layout.visibility = View.VISIBLE
+ }
+ }
+
+ override fun submit(): Boolean {
+ var percent = 0
+ var absolute = 0.0
+ val durationInMinutes = SafeParse.stringToInt(actions_tempbasal_duration.text)
+ val profile = ProfileFunctions.getInstance().profile ?: return false
+ val actions: LinkedList = LinkedList()
+ if (isPercentPump) {
+ val basalPercentInput = SafeParse.stringToInt(actions_tempbasal_basalpercentinput.text)
+ percent = MainApp.getConstraintChecker().applyBasalPercentConstraints(Constraint(basalPercentInput), profile).value()
+ actions.add(MainApp.gs(R.string.pump_tempbasal_label)+ ": $percent%")
+ actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_mins, durationInMinutes))
+ if (percent != basalPercentInput) actions.add(MainApp.gs(R.string.constraintapllied))
+ } else {
+ val basalAbsoluteInput = SafeParse.stringToDouble(actions_tempbasal_basalabsoluteinput.text)
+ absolute = MainApp.getConstraintChecker().applyBasalConstraints(Constraint(basalAbsoluteInput), profile).value()
+ actions.add(MainApp.gs(R.string.pump_tempbasal_label)+ ": " + MainApp.gs(R.string.pump_basebasalrate, absolute))
+ actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_mins, durationInMinutes))
+ if (abs(absolute - basalAbsoluteInput) > 0.01)
+ actions.add("" + MainApp.gs(R.string.constraintapllied) + "")
+ }
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.pump_tempbasal_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ val callback: Callback = object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ }
+ if (isPercentPump) {
+ ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
+ } else {
+ ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
+ }
+ })
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
new file mode 100644
index 0000000000..5408105a71
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
@@ -0,0 +1,152 @@
+package info.nightscout.androidaps.dialogs
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import com.google.common.base.Joiner
+import com.google.common.collect.Lists
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.db.Source
+import info.nightscout.androidaps.db.TempTarget
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.DefaultValueHelper
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.SP
+import kotlinx.android.synthetic.main.dialog_temptarget.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+
+class TempTargetDialog : DialogFragmentWithDate() {
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_temptarget_duration", overview_temptarget_duration.value)
+ savedInstanceState.putDouble("overview_temptarget_temptarget", overview_temptarget_temptarget.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_temptarget, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ overview_temptarget_duration.setParams(savedInstanceState?.getDouble("overview_temptarget_duration")
+ ?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
+
+ if (ProfileFunctions.getSystemUnits() == Constants.MMOL)
+ overview_temptarget_temptarget.setParams(
+ savedInstanceState?.getDouble("overview_temptarget_temptarget")
+ ?: Constants.MIN_TT_MMOL,
+ Constants.MIN_TT_MMOL, Constants.MAX_TT_MMOL, 0.1, DecimalFormat("0.0"), false, ok)
+ else
+ overview_temptarget_temptarget.setParams(
+ savedInstanceState?.getDouble("overview_temptarget_temptarget")
+ ?: Constants.MIN_TT_MGDL,
+ Constants.MIN_TT_MGDL, Constants.MAX_TT_MGDL, 1.0, DecimalFormat("0"), false, ok)
+
+ val units = ProfileFunctions.getSystemUnits()
+ overview_temptarget_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
+ // temp target
+ context?.let { context ->
+ val reasonList: List = Lists.newArrayList(
+ MainApp.gs(R.string.manual),
+ MainApp.gs(R.string.cancel),
+ MainApp.gs(R.string.eatingsoon),
+ MainApp.gs(R.string.activity),
+ MainApp.gs(R.string.hypo)
+ )
+ val adapterReason = ArrayAdapter(context, R.layout.spinner_centered, reasonList)
+ overview_temptarget_reason.adapter = adapterReason
+ overview_temptarget_reason.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
+ val defaultDuration: Double
+ val defaultTarget: Double
+ when (reasonList[position]) {
+ MainApp.gs(R.string.eatingsoon) -> {
+ defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration().toDouble()
+ defaultTarget = DefaultValueHelper.determineEatingSoonTT()
+ }
+
+ MainApp.gs(R.string.activity) -> {
+ defaultDuration = DefaultValueHelper.determineActivityTTDuration().toDouble()
+ defaultTarget = DefaultValueHelper.determineActivityTT()
+ }
+
+ MainApp.gs(R.string.hypo) -> {
+ defaultDuration = DefaultValueHelper.determineHypoTTDuration().toDouble()
+ defaultTarget = DefaultValueHelper.determineHypoTT()
+ }
+
+ MainApp.gs(R.string.cancel) -> {
+ defaultDuration = 0.0
+ defaultTarget = 0.0
+ }
+
+ else -> {
+ defaultDuration = overview_temptarget_duration.value
+ defaultTarget = overview_temptarget_temptarget.value
+ }
+ }
+ overview_temptarget_temptarget.value = defaultTarget
+ overview_temptarget_duration.value = defaultDuration
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {}
+ }
+ }
+ }
+
+ override fun submit(): Boolean {
+ val actions: LinkedList = LinkedList()
+ val reason = overview_temptarget_reason.selectedItem.toString()
+ val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
+ val target = overview_temptarget_temptarget.value
+ val duration = overview_temptarget_duration.value
+ if (target != 0.0 && duration != 0.0) {
+ actions.add(MainApp.gs(R.string.reason) + ": " + reason)
+ actions.add(MainApp.gs(R.string.nsprofileview_target_label) + ": " + Profile.toCurrentUnitsString(target) + " " + MainApp.gs(unitResId))
+ actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_hours, duration))
+ } else {
+ actions.add(MainApp.gs(R.string.stoptemptarget))
+ }
+ if (eventTimeChanged)
+ actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
+
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ if (target == 0.0 || duration == 0.0) {
+ val tempTarget = TempTarget()
+ .date(eventTime)
+ .duration(0)
+ .low(0.0).high(0.0)
+ .source(Source.USER)
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ } else {
+ val tempTarget = TempTarget()
+ .date(eventTime)
+ .duration(duration.toInt())
+ .reason(reason)
+ .source(Source.USER)
+ .low(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
+ .high(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
+ TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
+ }
+ if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
+ })
+ }
+ return true
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
new file mode 100644
index 0000000000..8667befaf2
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -0,0 +1,132 @@
+package info.nightscout.androidaps.dialogs
+
+import android.content.Intent
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.common.base.Joiner
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.data.DetailedBolusInfo
+import info.nightscout.androidaps.db.CareportalEvent
+import info.nightscout.androidaps.db.Source
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.OKDialog
+import info.nightscout.androidaps.utils.SafeParse
+import info.nightscout.androidaps.utils.ToastUtils
+import kotlinx.android.synthetic.main.dialog_treatment.*
+import kotlinx.android.synthetic.main.okcancel.*
+import java.text.DecimalFormat
+import java.util.*
+import kotlin.math.abs
+
+class TreatmentDialog : DialogFragmentWithDate() {
+ private var maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value().toDouble()
+ private var maxInsulin = MainApp.getConstraintChecker().maxBolusAllowed.value()
+
+ private val textWatcher: TextWatcher = object : TextWatcher {
+ override fun afterTextChanged(s: Editable) {}
+ override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
+ validateInputs()
+ }
+ }
+
+ private fun validateInputs() {
+ if (SafeParse.stringToInt(overview_treatment_carbs.text) > maxCarbs) {
+ overview_treatment_carbs.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.carbsconstraintapplied))
+ }
+ if (SafeParse.stringToDouble(overview_treatment_insulin.text) > maxInsulin) {
+ overview_treatment_insulin.value = 0.0
+ ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.bolusconstraintapplied))
+ }
+ }
+
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putDouble("overview_treatment_carbs", overview_treatment_carbs.value)
+ savedInstanceState.putDouble("overview_treatment_insulin", overview_treatment_insulin.value)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?): View? {
+ onCreateViewGeneral()
+ return inflater.inflate(R.layout.dialog_treatment, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
+ overview_treatment_carbs.setParams(savedInstanceState?.getDouble("overview_treatment_carbs")
+ ?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
+ overview_treatment_insulin.setParams(savedInstanceState?.getDouble("overview_treatment_insulin")
+ ?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
+ }
+
+ override fun submit(): Boolean {
+ val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription
+ ?: return false
+ val insulin = SafeParse.stringToDouble(overview_treatment_insulin.text)
+ val carbs = SafeParse.stringToInt(overview_treatment_carbs.text)
+ val recordOnlyChecked = overview_treatment_record_only.isChecked
+ val actions: LinkedList = LinkedList()
+ val insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(insulin)).value()
+ val carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(Constraint(carbs)).value()
+
+ if (insulinAfterConstraints > 0) {
+ actions.add(MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + MainApp.gs(R.string.insulin_unit_shortname) + "")
+ if (recordOnlyChecked)
+ actions.add("" + MainApp.gs(R.string.bolusrecordedonly) + "")
+ if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
+ actions.add(MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints))
+ }
+ if (carbsAfterConstraints > 0) {
+ actions.add(MainApp.gs(R.string.carbs) + ": " + "" + MainApp.gs(R.string.format_carbs, carbsAfterConstraints) + "")
+ if (carbsAfterConstraints != carbs)
+ actions.add("" + MainApp.gs(R.string.carbsconstraintapplied) + "")
+ }
+ if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable {
+ val detailedBolusInfo = DetailedBolusInfo()
+ if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION
+ if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS
+ detailedBolusInfo.insulin = insulinAfterConstraints
+ detailedBolusInfo.carbs = carbsAfterConstraints.toDouble()
+ detailedBolusInfo.context = context
+ detailedBolusInfo.source = Source.USER
+ if (!(recordOnlyChecked && (detailedBolusInfo.insulin > 0 || pumpDescription.storesCarbInfo))) {
+ ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ } else
+ TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false)
+ })
+ }
+ } else
+ activity?.let { activity ->
+ OKDialog.show(activity, MainApp.gs(R.string.overview_treatment_label), MainApp.gs(R.string.no_action_selected))
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
similarity index 79%
rename from app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.kt
rename to app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
index 46462b0dfc..c84bd4a0b6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
@@ -1,10 +1,13 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs
+package info.nightscout.androidaps.dialogs
-import android.content.Context
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
-import android.view.*
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
import android.widget.AdapterView
import android.widget.AdapterView.OnItemSelectedListener
import android.widget.ArrayAdapter
@@ -26,7 +29,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.*
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
-import kotlinx.android.synthetic.main.overview_wizard_dialog.*
+import kotlinx.android.synthetic.main.dialog_wizard.*
import org.slf4j.LoggerFactory
import java.text.DecimalFormat
import java.util.*
@@ -36,16 +39,13 @@ class WizardDialog : DialogFragment() {
private val log = LoggerFactory.getLogger(WizardDialog::class.java)
private var wizard: BolusWizard? = null
- private var parentContext: Context? = null
//one shot guards
private var okClicked: Boolean = false
private val textWatcher = object : TextWatcher {
override fun afterTextChanged(s: Editable) {}
-
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
-
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
calculateInsulin()
}
@@ -53,21 +53,11 @@ class WizardDialog : DialogFragment() {
private var disposable: CompositeDisposable = CompositeDisposable()
- override fun onAttach(context: Context) {
- super.onAttach(context)
- this.parentContext = context
- }
-
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
- override fun onDetach() {
- super.onDetach()
- this.parentContext = null
- }
-
override fun onSaveInstanceState(savedInstanceState: Bundle) {
super.onSaveInstanceState(savedInstanceState)
savedInstanceState.putDouble("treatments_wizard_bg_input", treatments_wizard_bg_input.value)
@@ -83,28 +73,28 @@ class WizardDialog : DialogFragment() {
isCancelable = true
dialog?.setCanceledOnTouchOutside(false)
- return inflater.inflate(R.layout.overview_wizard_dialog, container, false)
+ return inflater.inflate(R.layout.dialog_wizard, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
loadCheckedStates()
processCobCheckBox()
- treatments_wizard_sbcheckbox.visibility = if (SP.getBoolean(R.string.key_usesuperbolus, false)) View.VISIBLE else View.GONE
- treatments_wizard_notes_layout.visibility = if (SP.getBoolean(R.string.key_show_notes_entry_dialogs, false)) View.VISIBLE else View.GONE
+ treatments_wizard_sbcheckbox.visibility = SP.getBoolean(R.string.key_usesuperbolus, false).toVisibility()
+ treatments_wizard_notes_layout.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value()
val maxCorrection = MainApp.getConstraintChecker().maxBolusAllowed.value()
treatments_wizard_bg_input.setParams(savedInstanceState?.getDouble("treatments_wizard_bg_input")
- ?: 0.0, 0.0, 500.0, 0.1, DecimalFormat("0.0"), false, ok, textWatcher)
+ ?: 0.0, 0.0, 500.0, 0.1, DecimalFormat("0.0"), false, ok, textWatcher)
treatments_wizard_carbs_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carbs_input")
- ?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, ok, textWatcher)
+ ?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, ok, textWatcher)
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep
- ?: 0.1
+ ?: 0.1
treatments_wizard_correction_input.setParams(savedInstanceState?.getDouble("treatments_wizard_correction_input")
- ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
+ ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
treatments_wizard_carb_time_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carb_time_input")
- ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
+ ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
initDialog()
treatments_wizard_percent_used.text = MainApp.gs(R.string.format_percent, SP.getInt(R.string.key_boluswizard_percentage, 100))
@@ -115,7 +105,7 @@ class WizardDialog : DialogFragment() {
} else {
okClicked = true
calculateInsulin()
- parentContext?.let { context ->
+ context?.let { context ->
wizard?.confirmAndExecute(context)
}
}
@@ -124,23 +114,23 @@ class WizardDialog : DialogFragment() {
// cancel button
cancel.setOnClickListener { dismiss() }
// checkboxes
- treatments_wizard_bgcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_ttcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_cobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
- treatments_wizard_sbcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
+ treatments_wizard_bgcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_ttcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_cobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
+ treatments_wizard_sbcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
val showCalc = SP.getBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), false)
- treatments_wizard_delimiter.visibility = if (showCalc) View.VISIBLE else View.GONE
- treatments_wizard_resulttable.visibility = if (showCalc) View.VISIBLE else View.GONE
+ treatments_wizard_delimiter.visibility = showCalc.toVisibility()
+ treatments_wizard_resulttable.visibility = showCalc.toVisibility()
treatments_wizard_calculationcheckbox.isChecked = showCalc
treatments_wizard_calculationcheckbox.setOnCheckedChangeListener { _, isChecked ->
run {
SP.putBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), isChecked)
- treatments_wizard_delimiter.visibility = if (isChecked) View.VISIBLE else View.GONE
- treatments_wizard_resulttable.visibility = if (isChecked) View.VISIBLE else View.GONE
+ treatments_wizard_delimiter.visibility = isChecked.toVisibility()
+ treatments_wizard_resulttable.visibility = isChecked.toVisibility()
}
}
// profile spinner
@@ -157,13 +147,13 @@ class WizardDialog : DialogFragment() {
}
// bus
disposable.add(RxBus
- .toObservable(EventAutosensCalculationFinished::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- activity?.runOnUiThread { calculateInsulin() }
- }, {
- FabricPrivacy.logException(it)
- })
+ .toObservable(EventAutosensCalculationFinished::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ activity?.runOnUiThread { calculateInsulin() }
+ }, {
+ FabricPrivacy.logException(it)
+ })
)
}
@@ -173,7 +163,7 @@ class WizardDialog : DialogFragment() {
disposable.clear()
}
- private fun onCheckedChanged(buttonView: CompoundButton) {
+ private fun onCheckedChanged(buttonView: CompoundButton, @Suppress("UNUSED_PARAMETER") state: Boolean) {
saveCheckedStates()
treatments_wizard_ttcheckbox.isEnabled = treatments_wizard_bgcheckbox.isChecked && TreatmentsPlugin.getPlugin().tempTargetFromHistory != null
if (buttonView.id == treatments_wizard_cobcheckbox.id)
@@ -221,7 +211,6 @@ class WizardDialog : DialogFragment() {
treatments_wizard_profile.adapter = adapter
} ?: return
-
val units = ProfileFunctions.getSystemUnits()
treatments_wizard_bgunits.text = units
if (units == Constants.MGDL)
@@ -250,7 +239,7 @@ class WizardDialog : DialogFragment() {
calculateInsulin()
- treatments_wizard_percent_used.visibility = if (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100) View.VISIBLE else View.GONE
+ treatments_wizard_percent_used.visibility = (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100).toVisibility()
}
private fun calculateInsulin() {
@@ -291,15 +280,15 @@ class WizardDialog : DialogFragment() {
val carbTime = SafeParse.stringToInt(treatments_wizard_carb_time_input.text)
wizard = BolusWizard(specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction,
- SP.getInt(R.string.key_boluswizard_percentage, 100).toDouble(),
- treatments_wizard_bgcheckbox.isChecked,
- treatments_wizard_cobcheckbox.isChecked,
- treatments_wizard_bolusiobcheckbox.isChecked,
- treatments_wizard_basaliobcheckbox.isChecked,
- treatments_wizard_sbcheckbox.isChecked,
- treatments_wizard_ttcheckbox.isChecked,
- treatments_wizard_bgtrendcheckbox.isChecked,
- treatment_wizard_notes.text.toString(), carbTime)
+ SP.getInt(R.string.key_boluswizard_percentage, 100).toDouble(),
+ treatments_wizard_bgcheckbox.isChecked,
+ treatments_wizard_cobcheckbox.isChecked,
+ treatments_wizard_bolusiobcheckbox.isChecked,
+ treatments_wizard_basaliobcheckbox.isChecked,
+ treatments_wizard_sbcheckbox.isChecked,
+ treatments_wizard_ttcheckbox.isChecked,
+ treatments_wizard_bgtrendcheckbox.isChecked,
+ treatment_wizard_notes.text.toString(), carbTime)
wizard?.let { wizard ->
treatments_wizard_bg.text = String.format(MainApp.gs(R.string.format_bg_isf), BgReading().value(Profile.toMgdl(bg, ProfileFunctions.getSystemUnits())).valueToUnitsToString(ProfileFunctions.getSystemUnits()), wizard.sens)
@@ -320,8 +309,8 @@ class WizardDialog : DialogFragment() {
// Trend
if (treatments_wizard_bgtrendcheckbox.isChecked && wizard.glucoseStatus != null) {
treatments_wizard_bgtrend.text = ((if (wizard.trend > 0) "+" else "")
- + Profile.toUnitsString(wizard.trend * 3, wizard.trend * 3 / Constants.MMOLL_TO_MGDL, ProfileFunctions.getSystemUnits())
- + " " + ProfileFunctions.getSystemUnits())
+ + Profile.toUnitsString(wizard.trend * 3, wizard.trend * 3 / Constants.MMOLL_TO_MGDL, ProfileFunctions.getSystemUnits())
+ + " " + ProfileFunctions.getSystemUnits())
} else {
treatments_wizard_bgtrend.text = ""
}
diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java
index 8de88e1e0e..e236125255 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java
@@ -4,7 +4,6 @@ import android.os.SystemClock;
import android.preference.Preference;
import android.preference.PreferenceFragment;
-import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
import org.jetbrains.annotations.NotNull;
@@ -20,6 +19,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.EventConfigBuilderUpdateGui;
import info.nightscout.androidaps.queue.CommandQueue;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
/**
@@ -58,20 +58,16 @@ public abstract class PluginBase {
if (allowHardwarePump || activity == null) {
performPluginSwitch(newState, type);
} else {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setMessage(R.string.allow_hardware_pump_text)
- .setPositiveButton(R.string.yes, (dialog, id) -> {
- performPluginSwitch(newState, type);
- SP.putBoolean("allow_hardware_pump", true);
- if (L.isEnabled(L.PUMP))
- log.debug("First time HW pump allowed!");
- })
- .setNegativeButton(R.string.cancel, (dialog, id) -> {
- RxBus.INSTANCE.send(new EventConfigBuilderUpdateGui());
- if (L.isEnabled(L.PUMP))
- log.debug("User does not allow switching to HW pump!");
- });
- builder.create().show();
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.allow_hardware_pump_text), () -> {
+ performPluginSwitch(newState, type);
+ SP.putBoolean("allow_hardware_pump", true);
+ if (L.isEnabled(L.PUMP))
+ log.debug("First time HW pump allowed!");
+ }, () -> {
+ RxBus.INSTANCE.send(new EventConfigBuilderUpdateGui());
+ if (L.isEnabled(L.PUMP))
+ log.debug("User does not allow switching to HW pump!");
+ });
}
} else {
performPluginSwitch(newState, type);
diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java
index 5882c5870c..2929d3f21b 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java
@@ -29,8 +29,8 @@ public class PluginDescription {
return this;
}
- public PluginDescription alwaysVisible(boolean alwayVisible) {
- this.alwaysVisible = alwayVisible;
+ public PluginDescription alwaysVisible(boolean alwaysVisible) {
+ this.alwaysVisible = alwaysVisible;
return this;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
index 43661b117a..cbdd5d696a 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
@@ -31,7 +31,7 @@ public interface TreatmentsInterface {
MealData getMealData();
List getTreatmentsFromHistory();
- List getTreatments5MinBackFromHistory(long time);
+ List getCarbTreatments5MinBackFromHistory(long time);
List getTreatmentsFromHistoryAfterTimestamp(long timestamp);
long getLastBolusTime();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java
index 69afe3d8e7..26d7359efe 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java
@@ -381,13 +381,11 @@ public class DeviceStatus {
try {
if (device != null) record.put("device", device);
if (pump != null) record.put("pump", pump);
- if (suggested != null) {
- JSONObject openaps = new JSONObject();
- if (enacted != null) openaps.put("enacted", enacted);
- if (suggested != null) openaps.put("suggested", suggested);
- if (iob != null) openaps.put("iob", iob);
- record.put("openaps", openaps);
- }
+ JSONObject openaps = new JSONObject();
+ if (enacted != null) openaps.put("enacted", enacted);
+ if (suggested != null) openaps.put("suggested", suggested);
+ if (iob != null) openaps.put("iob", iob);
+ record.put("openaps", openaps);
if (uploaderBattery != 0) record.put("uploaderBattery", uploaderBattery);
if (created_at != null) record.put("created_at", created_at);
} catch (JSONException e) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
index b7549fcfed..e7dbacb891 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.aps.loop
-
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@@ -12,7 +11,11 @@ import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.androidaps.utils.*
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.HtmlHelper
+import info.nightscout.androidaps.utils.SP
+import info.nightscout.androidaps.utils.plusAssign
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.loop_fragment.*
@@ -39,23 +42,21 @@ class LoopFragment : Fragment() {
override fun onResume() {
super.onResume()
disposable += RxBus
- .toObservable(EventLoopUpdateGui::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGUI()
- }, {
- FabricPrivacy.logException(it)
- })
+ .toObservable(EventLoopUpdateGui::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ updateGUI()
+ }, {
+ FabricPrivacy.logException(it)
+ })
disposable += RxBus
- .toObservable(EventLoopSetLastRunGui::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- clearGUI()
- loop_lastrun.text = it.text
- }, {
- FabricPrivacy.logException(it)
- })
+ .toObservable(EventLoopSetLastRunGui::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ clearGUI()
+ loop_lastrun?.text = it.text
+ }, { FabricPrivacy.logException(it) })
updateGUI()
SP.putBoolean(R.string.key_objectiveuseloop, true)
@@ -71,39 +72,38 @@ class LoopFragment : Fragment() {
fun updateGUI() {
if (loop_request == null) return
LoopPlugin.lastRun?.let {
- loop_request.text = it.request?.toSpanned() ?: ""
- loop_constraintsprocessed.text = it.constraintsProcessed?.toSpanned() ?: ""
- loop_source.text = it.source ?: ""
- loop_lastrun.text = it.lastAPSRun?.let { lastRun -> DateUtil.dateAndTimeString(lastRun.time) }
- ?: ""
- loop_lastenact.text = it.lastAPSRun?.let { lastEnact -> DateUtil.dateAndTimeString(lastEnact.time) }
- ?: ""
- loop_tbrsetbypump.text = it.tbrSetByPump?.let { tbrSetByPump -> HtmlHelper.fromHtml(tbrSetByPump.toHtml()) }
- ?: ""
- loop_smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
- ?: ""
+ loop_request?.text = it.request?.toSpanned() ?: ""
+ loop_constraintsprocessed?.text = it.constraintsProcessed?.toSpanned() ?: ""
+ loop_source?.text = it.source ?: ""
+ loop_lastrun?.text = it.lastAPSRun?.let { lastRun -> DateUtil.dateAndTimeString(lastRun.time) }
+ ?: ""
+ loop_lastenact?.text = it.lastAPSRun?.let { lastEnact -> DateUtil.dateAndTimeString(lastEnact.time) }
+ ?: ""
+ loop_tbrsetbypump?.text = it.tbrSetByPump?.let { tbrSetByPump -> HtmlHelper.fromHtml(tbrSetByPump.toHtml()) }
+ ?: ""
+ loop_smbsetbypump?.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
+ ?: ""
val constraints =
- it.constraintsProcessed?.let { constraintsProcessed ->
- val allConstraints = Constraint(0.0)
- constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) }
- constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) }
- allConstraints.mostLimitedReasons
- } ?: ""
- loop_constraints.text = constraints
+ it.constraintsProcessed?.let { constraintsProcessed ->
+ val allConstraints = Constraint(0.0)
+ constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) }
+ constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) }
+ allConstraints.mostLimitedReasons
+ } ?: ""
+ loop_constraints?.text = constraints
}
}
@Synchronized
private fun clearGUI() {
- if (loop_request == null) return
- loop_request.text = ""
- loop_constraints.text = ""
- loop_constraintsprocessed.text = ""
- loop_source.text = ""
- loop_lastrun.text = ""
- loop_lastenact.text = ""
- loop_tbrsetbypump.text = ""
- loop_smbsetbypump.text = ""
+ loop_request?.text = ""
+ loop_constraints?.text = ""
+ loop_constraintsprocessed?.text = ""
+ loop_source?.text = ""
+ loop_lastrun?.text = ""
+ loop_lastenact?.text = ""
+ loop_tbrsetbypump?.text = ""
+ loop_smbsetbypump?.text = ""
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java
index f339bd3771..7492dc64dd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java
@@ -50,7 +50,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
@@ -60,7 +60,6 @@ import info.nightscout.androidaps.queue.commands.Command;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
-import info.nightscout.androidaps.utils.ToastUtils;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginViewHolder.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginViewHolder.kt
index 86e0f39437..2670e78633 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginViewHolder.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginViewHolder.kt
@@ -2,7 +2,11 @@ package info.nightscout.androidaps.plugins.configBuilder
import android.content.Intent
import android.view.View
-import android.widget.*
+import android.widget.CheckBox
+import android.widget.ImageButton
+import android.widget.LinearLayout
+import android.widget.RadioButton
+import android.widget.TextView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.events.EventRebuildTabs
@@ -10,6 +14,7 @@ import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.PasswordProtection
+import info.nightscout.androidaps.utils.toVisibility
class PluginViewHolder internal constructor(private val fragment: ConfigBuilderFragment,
private val pluginType: PluginType,
@@ -56,8 +61,8 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
}
fun update() {
- enabledExclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.GONE else View.VISIBLE
- enabledInclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.VISIBLE else View.GONE
+ enabledExclusive.visibility = areMultipleSelectionsAllowed(pluginType).not().toVisibility()
+ enabledInclusive.visibility = areMultipleSelectionsAllowed(pluginType).toVisibility()
enabledExclusive.isChecked = plugin.isEnabled(pluginType)
enabledInclusive.isChecked = plugin.isEnabled(pluginType)
enabledInclusive.isEnabled = !plugin.pluginDescription.alwaysEnabled
@@ -70,7 +75,7 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
pluginDescription.text = plugin.description
}
pluginPreferences.visibility = if (plugin.preferencesId == -1 || !plugin.isEnabled(pluginType)) View.INVISIBLE else View.VISIBLE
- pluginVisibility.visibility = if (plugin.hasFragment()) View.VISIBLE else View.INVISIBLE
+ pluginVisibility.visibility = plugin.hasFragment().toVisibility()
pluginVisibility.isEnabled = !(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType)
pluginVisibility.isChecked = plugin.isFragmentVisible
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
index 63da02e2bd..bdde6606bb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
@@ -24,7 +24,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DateUtil;
@@ -170,8 +170,8 @@ public class ProfileFunctions {
return profileSwitch;
}
- public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) {
- ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis());
+ public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift, final long date) {
+ ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, date);
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
if (percentage == 90 && duration == 10)
SP.putBoolean(R.string.key_objectiveuseprofileswitch, true);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
index 34aadf84c6..7f004b7f02 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
@@ -28,6 +28,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.events.EventNtp
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective.ExamTask
import info.nightscout.androidaps.receivers.NetworkChangeReceiver
+import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
import info.nightscout.androidaps.utils.*
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
@@ -71,13 +72,13 @@ class ObjectivesFragment : Fragment() {
override fun onResume() {
super.onResume()
disposable.add(RxBus
- .toObservable(EventObjectivesUpdateGui::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- objectives_recyclerview.adapter?.notifyDataSetChanged()
- }, {
- FabricPrivacy.logException(it)
- })
+ .toObservable(EventObjectivesUpdateGui::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ objectives_recyclerview.adapter?.notifyDataSetChanged()
+ }, {
+ FabricPrivacy.logException(it)
+ })
)
}
@@ -217,6 +218,7 @@ class ObjectivesFragment : Fragment() {
scrollToCurrentObjective()
startUpdateTimer()
RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
} else {
// move out of UI thread
Thread {
@@ -234,6 +236,7 @@ class ObjectivesFragment : Fragment() {
RxBus.send(EventNtpStatus(MainApp.gs(R.string.success), 100))
SystemClock.sleep(1000)
RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
SystemClock.sleep(100)
scrollToCurrentObjective()
} else {
@@ -254,6 +257,7 @@ class ObjectivesFragment : Fragment() {
scrollToCurrentObjective()
startUpdateTimer()
RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
} else
// move out of UI thread
Thread {
@@ -270,6 +274,7 @@ class ObjectivesFragment : Fragment() {
RxBus.send(EventNtpStatus(MainApp.gs(R.string.success), 100))
SystemClock.sleep(1000)
RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
SystemClock.sleep(100)
scrollToCurrentObjective()
} else {
@@ -280,16 +285,20 @@ class ObjectivesFragment : Fragment() {
}.start()
}
holder.unStart.setOnClickListener {
- OKDialog.showConfirmation(activity, MainApp.gs(R.string.doyouwantresetstart)) {
- objective.startedOn = 0
- scrollToCurrentObjective()
- RxBus.send(EventObjectivesUpdateGui())
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.objectives), MainApp.gs(R.string.doyouwantresetstart), Runnable {
+ objective.startedOn = 0
+ scrollToCurrentObjective()
+ RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
+ })
}
}
holder.unFinish.setOnClickListener {
objective.accomplishedOn = 0
scrollToCurrentObjective()
RxBus.send(EventObjectivesUpdateGui())
+ RxBus.send(EventSWUpdate(false))
}
if (objective.hasSpecialInput && !objective.isAccomplished && objective.isStarted && objective.specialActionEnabled()) {
// generate random request code if none exists
@@ -313,7 +322,6 @@ class ObjectivesFragment : Fragment() {
}
}
-
override fun getItemCount(): Int {
return ObjectivesPlugin.objectives.size
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
index f8b0ca26ec..ebae80150c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt
@@ -122,9 +122,9 @@ object ObjectivesPlugin : PluginBase(PluginDescription()
SP.putLong("Objectives_" + "smb" + "_started", DateUtil.now())
SP.putLong("Objectives_" + "smb" + "_accomplished", DateUtil.now())
setupObjectives()
- OKDialog.show(activity, "", MainApp.gs(R.string.codeaccepted), null)
+ OKDialog.show(activity, MainApp.gs(R.string.objectives), MainApp.gs(R.string.codeaccepted))
} else {
- OKDialog.show(activity, "", MainApp.gs(R.string.codeinvalid), null)
+ OKDialog.show(activity, MainApp.gs(R.string.objectives), MainApp.gs(R.string.codeinvalid))
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
index cef9bc232a..77e6f22b43 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
@@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.events.EventNtp
import info.nightscout.androidaps.utils.FabricPrivacy
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
-import kotlinx.android.synthetic.main.overview_bolusprogress_dialog.*
+import kotlinx.android.synthetic.main.dialog_bolusprogress.*
import org.slf4j.LoggerFactory
class NtpProgressDialog : DialogFragment() {
@@ -33,16 +33,17 @@ class NtpProgressDialog : DialogFragment() {
state = savedInstanceState?.getString("state", DEFAULT_STATE) ?: DEFAULT_STATE
percent = savedInstanceState?.getInt("percent", 0) ?: 0
- return inflater.inflate(R.layout.overview_bolusprogress_dialog, container, false)
+ return inflater.inflate(R.layout.dialog_bolusprogress, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
overview_bolusprogress_stop.setOnClickListener { dismiss() }
- overview_bolusprogress_status.setText(state)
- overview_bolusprogress_progressbar.setMax(100)
- overview_bolusprogress_progressbar.setProgress(percent)
+ overview_bolusprogress_status.text = state
+ overview_bolusprogress_progressbar.max = 100
+ overview_bolusprogress_progressbar.progress = percent
overview_bolusprogress_stop.text = MainApp.gs(R.string.close)
+ overview_bolusprogress_title.text = MainApp.gs(R.string.please_wait)
}
override fun onResume() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt
new file mode 100644
index 0000000000..7dbb642f45
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/phoneChecker/PhoneCheckerPlugin.kt
@@ -0,0 +1,35 @@
+package info.nightscout.androidaps.plugins.constraints.phoneChecker
+
+import android.os.Build
+import com.scottyab.rootbeer.RootBeer
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.interfaces.ConstraintsInterface
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+
+object PhoneCheckerPlugin : PluginBase(PluginDescription()
+ .mainType(PluginType.CONSTRAINTS)
+ .neverVisible(true)
+ .alwaysEnabled(true)
+ .showInList(false)
+ .pluginName(R.string.phonechecker)
+), ConstraintsInterface {
+
+ var phoneRooted: Boolean = false
+ var devMode: Boolean = false
+ val phoneModel: String = Build.MODEL
+ val manufacturer: String = Build.MANUFACTURER
+
+ private fun isDevModeEnabled(): Boolean {
+ return android.provider.Settings.Secure.getInt(MainApp.instance().contentResolver,
+ android.provider.Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+ }
+
+ override fun onStart() {
+ super.onStart()
+ phoneRooted = RootBeer(MainApp.instance()).isRootedWithoutBusyBoxCheck()
+ devMode = isDevModeEnabled()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java
index 4d66f36194..5e7393d359 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java
@@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.HardLimits;
import info.nightscout.androidaps.utils.Round;
@@ -73,7 +74,10 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
}
value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this);
}
-
+ PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
+ if (pump != null && !pump.isFakingTempsByExtendedBoluses() && TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
+ value.set(false, MainApp.gs(R.string.closed_loop_disabled_with_eb), this);
+ }
return value;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt
index ee267c689e..9d88740d4b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerPlugin.kt
@@ -1,13 +1,19 @@
package info.nightscout.androidaps.plugins.constraints.versionChecker
+import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.interfaces.*
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.interfaces.ConstraintsInterface
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.utils.SP
import java.util.concurrent.TimeUnit
+import kotlin.math.roundToInt
/**
* Usually we would have a class here.
@@ -16,16 +22,23 @@ import java.util.concurrent.TimeUnit
* */
object VersionCheckerPlugin : PluginBase(PluginDescription()
- .mainType(PluginType.CONSTRAINTS)
- .neverVisible(true)
- .alwaysEnabled(true)
- .showInList(false)
- .pluginName(R.string.versionChecker)), ConstraintsInterface {
+ .mainType(PluginType.CONSTRAINTS)
+ .neverVisible(true)
+ .alwaysEnabled(true)
+ .showInList(false)
+ .pluginName(R.string.versionChecker)), ConstraintsInterface {
+
+ private val gracePeriod: GracePeriod
+ get() = if ((BuildConfig.VERSION_NAME.contains("RC", ignoreCase = true))) {
+ GracePeriod.RC
+ } else {
+ GracePeriod.RELEASE
+ }
override fun isClosedLoopAllowed(value: Constraint): Constraint {
checkWarning()
triggerCheckVersion()
- return if (isOldVersion(GRACE_PERIOD_VERY_OLD))
+ return if (isOldVersion(gracePeriod.veryOld.daysToMillis()))
value.set(false, MainApp.gs(R.string.very_old_version), this)
else
value
@@ -33,41 +46,49 @@ object VersionCheckerPlugin : PluginBase(PluginDescription()
private fun checkWarning() {
val now = System.currentTimeMillis()
-
+
if (!SP.contains(R.string.key_last_versionchecker_plugin_warning)) {
SP.putLong(R.string.key_last_versionchecker_plugin_warning, now)
return
}
- if (isOldVersion(GRACE_PERIOD_WARNING) && shouldWarnAgain(now)) {
+ if (isOldVersion(gracePeriod.warning.daysToMillis()) && shouldWarnAgain(now)) {
// store last notification time
SP.putLong(R.string.key_last_versionchecker_plugin_warning, now)
//notify
- val message = MainApp.gs(R.string.new_version_warning, Math.round((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / TimeUnit.DAYS.toMillis(1).toDouble()))
+ val message = MainApp.gs(R.string.new_version_warning,
+ ((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / 1L.daysToMillis().toDouble()).roundToInt(),
+ gracePeriod.old,
+ gracePeriod.veryOld
+ )
val notification = Notification(Notification.OLDVERSION, message, Notification.NORMAL)
RxBus.send(EventNewNotification(notification))
}
}
private fun shouldWarnAgain(now: Long) =
- now > SP.getLong(R.string.key_last_versionchecker_plugin_warning, 0) + WARN_EVERY
+ now > SP.getLong(R.string.key_last_versionchecker_plugin_warning, 0) + WARN_EVERY
override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint =
- if (isOldVersion(GRACE_PERIOD_OLD))
- maxIob.set(0.toDouble(), MainApp.gs(R.string.old_version), this)
- else
- maxIob
+ if (isOldVersion(gracePeriod.old.daysToMillis()))
+ maxIob.set(0.toDouble(), MainApp.gs(R.string.old_version), this)
+ else
+ maxIob
private fun isOldVersion(gracePeriod: Long): Boolean {
val now = System.currentTimeMillis()
- return now > SP.getLong(R.string.key_last_time_this_version_detected, 0) + gracePeriod
+ return now > SP.getLong(R.string.key_last_time_this_version_detected, 0) + gracePeriod
}
- val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
- val GRACE_PERIOD_WARNING = TimeUnit.DAYS.toMillis(30)
- val GRACE_PERIOD_OLD = TimeUnit.DAYS.toMillis(60)
- val GRACE_PERIOD_VERY_OLD = TimeUnit.DAYS.toMillis(90)
+ private val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
}
+
+enum class GracePeriod(val warning: Long, val old: Long, val veryOld: Long) {
+ RELEASE(30, 60, 90),
+ RC(1, 7, 14)
+}
+
+private fun Long.daysToMillis() = TimeUnit.DAYS.toMillis(this)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
index dfc06e6156..4977cd6f9f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
@@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
+import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.MainApp
@@ -18,17 +19,21 @@ import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
-import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog
-import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog
-import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog
+import info.nightscout.androidaps.dialogs.CareDialog
+import info.nightscout.androidaps.dialogs.ExtendedBolusDialog
+import info.nightscout.androidaps.dialogs.FillDialog
+import info.nightscout.androidaps.dialogs.TempBasalDialog
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment
-import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
+import info.nightscout.androidaps.dialogs.TempTargetDialog
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.*
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.actions_fragment.*
+import kotlinx.android.synthetic.main.careportal_stats_fragment.*
import java.util.*
class ActionsFragment : Fragment() {
@@ -47,39 +52,50 @@ class ActionsFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
actions_profileswitch.setOnClickListener {
- val newDialog = NewNSTreatmentDialog()
- val profileSwitch = CareportalFragment.PROFILESWITCH
- profileSwitch.executeProfileSwitch = true
- newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch)
- fragmentManager?.let { newDialog.show(it, "NewNSTreatmentDialog") }
+ fragmentManager?.let { ProfileSwitchDialog().show(it, "Actions") }
}
actions_temptarget.setOnClickListener {
- val newTTDialog = NewNSTreatmentDialog()
- val temptarget = CareportalFragment.TEMPTARGET
- temptarget.executeTempTarget = true
- newTTDialog.setOptions(temptarget, R.string.careportal_temporarytarget)
- fragmentManager?.let { newTTDialog.show(it, "NewNSTreatmentDialog") }
+ fragmentManager?.let { TempTargetDialog().show(it, "Actions") }
}
actions_extendedbolus.setOnClickListener {
- fragmentManager?.let { NewExtendedBolusDialog().show(it, "NewExtendedDialog") }
+ context?.let { context ->
+ OKDialog.showConfirmation(context, MainApp.gs(R.string.extended_bolus), MainApp.gs(R.string.ebstopsloop),
+ Runnable {
+ fragmentManager?.let { ExtendedBolusDialog().show(it, "Actions") }
+ }, null)
+ }
}
actions_extendedbolus_cancel.setOnClickListener {
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress) {
ConfigBuilderPlugin.getPlugin().commandQueue.cancelExtended(object : Callback() {
override fun run() {
- if (!result.success)
- ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.extendedbolusdeliveryerror))
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.extendedbolusdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
}
})
}
}
- actions_settempbasal.setOnClickListener { fragmentManager?.let { NewTempBasalDialog().show(it, "NewTempDialog") } }
+ actions_settempbasal.setOnClickListener {
+ fragmentManager?.let { TempBasalDialog().show(it, "Actions") }
+ }
actions_canceltempbasal.setOnClickListener {
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress) {
ConfigBuilderPlugin.getPlugin().commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
- if (!result.success)
- ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, MainApp.gs(R.string.tempbasaldeliveryerror))
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
}
})
}
@@ -87,6 +103,21 @@ class ActionsFragment : Fragment() {
actions_fill.setOnClickListener { fragmentManager?.let { FillDialog().show(it, "FillDialog") } }
actions_historybrowser.setOnClickListener { startActivity(Intent(context, HistoryBrowseActivity::class.java)) }
actions_tddstats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
+ actions_bgcheck.setOnClickListener {
+ fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.BGCHECK, R.string.careportal_bgcheck).show(it, "Actions") }
+ }
+ actions_cgmsensorinsert.setOnClickListener {
+ fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.SENSOR_INSERT, R.string.careportal_cgmsensorinsert).show(it, "Actions") }
+ }
+ actions_pumpbatterychange.setOnClickListener {
+ fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.BATTERY_CHANGE, R.string.careportal_pumpbatterychange).show(it, "Actions") }
+ }
+ actions_note.setOnClickListener {
+ fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.NOTE, R.string.careportal_note).show(it, "Actions") }
+ }
+ actions_exercise.setOnClickListener {
+ fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.EXERCISE, R.string.careportal_exercise).show(it, "Actions") }
+ }
SP.putBoolean(R.string.key_objectiveuseactions, true)
}
@@ -97,43 +128,27 @@ class ActionsFragment : Fragment() {
disposable += RxBus
.toObservable(EventInitializationChanged::class.java)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGui()
- }, {
- FabricPrivacy.logException(it)
- })
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
disposable += RxBus
.toObservable(EventRefreshOverview::class.java)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGui()
- }, {
- FabricPrivacy.logException(it)
- })
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
disposable += RxBus
.toObservable(EventExtendedBolusChange::class.java)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGui()
- }, {
- FabricPrivacy.logException(it)
- })
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
disposable += RxBus
.toObservable(EventTempBasalChange::class.java)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGui()
- }, {
- FabricPrivacy.logException(it)
- })
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
disposable += RxBus
.toObservable(EventCustomActionsChanged::class.java)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGui()
- }, {
- FabricPrivacy.logException(it)
- })
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
+ disposable += RxBus
+ .toObservable(EventCareportalEventChange::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGui() }, { FabricPrivacy.logException(it) })
updateGui()
}
@@ -164,7 +179,7 @@ class ActionsFragment : Fragment() {
actions_profileswitch?.visibility = if (!basalProfileEnabled || !pump.isInitialized || pump.isSuspended) View.GONE else View.VISIBLE
- if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses || Config.APS) {
+ if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses) {
actions_extendedbolus?.visibility = View.GONE
actions_extendedbolus_cancel?.visibility = View.GONE
} else {
@@ -172,7 +187,7 @@ class ActionsFragment : Fragment() {
if (activeExtendedBolus != null) {
actions_extendedbolus?.visibility = View.GONE
actions_extendedbolus_cancel?.visibility = View.VISIBLE
- actions_extendedbolus_cancel?.text = MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString()
+ actions_extendedbolus_cancel?.text = MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toStringMedium()
} else {
actions_extendedbolus?.visibility = View.VISIBLE
actions_extendedbolus_cancel?.visibility = View.GONE
@@ -198,8 +213,11 @@ class ActionsFragment : Fragment() {
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
else View.VISIBLE
- actions_temptarget?.visibility = if (!Config.APS) View.GONE else View.VISIBLE
- actions_tddstats?.visibility = if (!pump.pumpDescription.supportsTDDs) View.GONE else View.VISIBLE
+ actions_temptarget?.visibility = Config.APS.toVisibility()
+ actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
+ activity?.let { activity ->
+ CareportalFragment.updateAge(activity, careportal_sensorage, careportal_insulinage, careportal_canulaage, careportal_pbage)
+ }
checkPumpCustomActions()
}
@@ -224,8 +242,7 @@ class ActionsFragment : Fragment() {
val action = this.pumpCustomActions[b.text.toString()]
ConfigBuilderPlugin.getPlugin().activePump!!.executeCustomAction(action!!.customActionType)
}
-
- val top = resources.getDrawable(customAction.iconResourceId)
+ val top = activity?.let { ContextCompat.getDrawable(it, customAction.iconResourceId) }
btn.setCompoundDrawablesWithIntrinsicBounds(null, top, null, null)
action_buttons_layout?.addView(btn)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsPlugin.kt
index 04afb826a2..e534fefa26 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsPlugin.kt
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.actions
+import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginDescription
@@ -8,6 +9,8 @@ import info.nightscout.androidaps.interfaces.PluginType
object ActionsPlugin : PluginBase(PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(ActionsFragment::class.qualifiedName)
+ .enableByDefault(Config.APS || Config.PUMPCONTROL)
+ .visibleByDefault(Config.APS || Config.PUMPCONTROL)
.pluginName(R.string.actions)
.shortName(R.string.actions_shortname)
.description(R.string.description_actions))
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.java
deleted file mode 100644
index 5e5f707928..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package info.nightscout.androidaps.plugins.general.actions.defs;
-
-import info.nightscout.androidaps.R;
-
-/**
- * Created by andy on 9/20/18.
- */
-
-public class CustomAction {
-
- private int name;
- private String iconName;
- private CustomActionType customActionType;
- private int iconResourceId;
- private boolean enabled = true;
-
-
- public CustomAction(int nameResourceId, CustomActionType actionType) {
- this(nameResourceId, actionType, R.drawable.icon_actions_profileswitch, true);
- }
-
-
- public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId) {
- this(nameResourceId, actionType, iconResourceId, true);
- }
-
- public CustomAction(int nameResourceId, CustomActionType actionType, boolean enabled) {
- this(nameResourceId, actionType, R.drawable.icon_actions_profileswitch, enabled);
- }
-
- public CustomAction(int nameResourceId, CustomActionType actionType, int iconResourceId, boolean enabled) {
- this.name = nameResourceId;
- this.customActionType = actionType;
- this.iconResourceId = iconResourceId;
- this.enabled = enabled;
- }
-
-
- public int getName() {
- return name;
- }
-
-
- public CustomActionType getCustomActionType() {
- return customActionType;
- }
-
-
- public int getIconResourceId() {
- return iconResourceId;
- }
-
-
- public boolean isEnabled() {
- return enabled;
- }
-
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.kt
new file mode 100644
index 0000000000..fe9af4a03e
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomAction.kt
@@ -0,0 +1,10 @@
+package info.nightscout.androidaps.plugins.general.actions.defs
+
+import info.nightscout.androidaps.R
+
+class CustomAction @JvmOverloads constructor(val name: Int, val customActionType: CustomActionType?, val iconResourceId: Int = R.drawable.icon_actions_profileswitch, var isEnabled: Boolean = true) {
+
+ constructor(nameResourceId: Int, actionType: CustomActionType?, enabled: Boolean) :
+ this(nameResourceId, actionType, R.drawable.icon_actions_profileswitch, enabled)
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.java
deleted file mode 100644
index 74ecf3c0e3..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package info.nightscout.androidaps.plugins.general.actions.defs;
-
-/**
- * Created by andy on 9/20/18.
- */
-
-public interface CustomActionType {
-
- String getKey();
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt
new file mode 100644
index 0000000000..fb472d5592
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt
@@ -0,0 +1,5 @@
+package info.nightscout.androidaps.plugins.general.actions.defs
+
+interface CustomActionType {
+ val key: String?
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java
deleted file mode 100644
index 77e4f85ea0..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package info.nightscout.androidaps.plugins.general.actions.dialogs;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextWatcher;
-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.LinearLayout;
-
-import com.google.common.base.Joiner;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.LinkedList;
-import java.util.List;
-
-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.interfaces.Constraint;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SP;
-import info.nightscout.androidaps.utils.SafeParse;
-import info.nightscout.androidaps.utils.ToastUtils;
-
-import static info.nightscout.androidaps.utils.DateUtil.now;
-
-public class FillDialog extends DialogFragment implements OnClickListener {
- private static Logger log = LoggerFactory.getLogger(FillDialog.class);
-
- private CheckBox pumpSiteChangeCheckbox;
- private CheckBox insulinCartridgeChangeCheckbox;
-
- private NumberPicker editInsulin;
-
- double amount1 = 0d;
- double amount2 = 0d;
- double amount3 = 0d;
-
- private EditText notesEdit;
-
- //one shot guards
- private boolean accepted;
- private boolean okClicked;
-
- final private TextWatcher textWatcher = new TextWatcher() {
- @Override
- public void afterTextChanged(Editable s) {
- validateInputs();
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- };
-
- private void validateInputs() {
- int time = editInsulin.getValue().intValue();
- if (Math.abs(time) > 12 * 60) {
- editInsulin.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.constraintapllied));
- }
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.actions_fill_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);
-
- pumpSiteChangeCheckbox = view.findViewById(R.id.fill_catheter_change);
- insulinCartridgeChangeCheckbox = view.findViewById(R.id.fill_cartridge_change);
-
- Double maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
- double bolusstep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep;
- editInsulin = view.findViewById(R.id.fill_insulinamount);
- editInsulin.setParams(0d, 0d, maxInsulin, bolusstep, DecimalFormatter.pumpSupportedBolusFormat(), false, view.findViewById(R.id.ok), textWatcher);
-
-
- Button preset1Button = view.findViewById(R.id.fill_preset_button1);
- amount1 = SP.getDouble("fill_button1", 0.3);
- if (amount1 > 0) {
- preset1Button.setVisibility(View.VISIBLE);
- preset1Button.setText(DecimalFormatter.toPumpSupportedBolus(amount1)); // + "U");
- preset1Button.setOnClickListener(this);
- } else {
- preset1Button.setVisibility(View.GONE);
- }
- Button preset2Button = view.findViewById(R.id.fill_preset_button2);
- amount2 = SP.getDouble("fill_button2", 0d);
- if (amount2 > 0) {
- preset2Button.setVisibility(View.VISIBLE);
- preset2Button.setText(DecimalFormatter.toPumpSupportedBolus(amount2)); // + "U");
- preset2Button.setOnClickListener(this);
- } else {
- preset2Button.setVisibility(View.GONE);
- }
- Button preset3Button = view.findViewById(R.id.fill_preset_button3);
- amount3 = SP.getDouble("fill_button3", 0d);
- if (amount3 > 0) {
- preset3Button.setVisibility(View.VISIBLE);
- preset3Button.setText(DecimalFormatter.toPumpSupportedBolus(amount3)); // + "U");
- preset3Button.setOnClickListener(this);
- } else {
- preset3Button.setVisibility(View.GONE);
- }
-
- LinearLayout notesLayout = view.findViewById(R.id.fill_notes_layout);
- notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
- notesEdit = view.findViewById(R.id.fill_notes);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- return view;
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- confirmAndDeliver();
- break;
- case R.id.cancel:
- dismiss();
- break;
- case R.id.fill_preset_button1:
- editInsulin.setValue(amount1);
- break;
- case R.id.fill_preset_button2:
- editInsulin.setValue(amount2);
- break;
- case R.id.fill_preset_button3:
- editInsulin.setValue(amount3);
- break;
- }
-
- }
-
- private synchronized void confirmAndDeliver() {
- if (okClicked) {
- log.debug("guarding: ok already clicked");
- dismiss();
- return;
- }
- okClicked = true;
-
- try {
- Double insulin = SafeParse.stringToDouble(editInsulin.getText());
-
- List confirmMessage = new LinkedList<>();
-
- Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value();
- if (insulinAfterConstraints > 0) {
- confirmMessage.add(MainApp.gs(R.string.fillwarning));
- confirmMessage.add("");
- confirmMessage.add(MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + "U" + "");
- if (Math.abs(insulinAfterConstraints - insulin) > 0.01d)
- confirmMessage.add(MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints));
- }
-
- if (pumpSiteChangeCheckbox.isChecked())
- confirmMessage.add("" + "" + MainApp.gs(R.string.record_pump_site_change) + "");
-
- if (insulinCartridgeChangeCheckbox.isChecked())
- confirmMessage.add("" + "" + MainApp.gs(R.string.record_insulin_cartridge_change) + "");
-
- final String notes = notesEdit.getText().toString();
- if (!notes.isEmpty()) {
- confirmMessage.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes);
- }
-
- final Double finalInsulinAfterConstraints = insulinAfterConstraints;
-
- final Context context = getContext();
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
-
- builder.setTitle(MainApp.gs(R.string.confirmation));
- if (insulinAfterConstraints > 0 || pumpSiteChangeCheckbox.isChecked() || insulinCartridgeChangeCheckbox.isChecked()) {
- builder.setMessage(Html.fromHtml(Joiner.on("
").join(confirmMessage)));
- builder.setPositiveButton(MainApp.gs(R.string.primefill), (dialog, id) -> {
- synchronized (builder) {
- if (accepted) {
- log.debug("guarding: already accepted");
- return;
- }
- accepted = true;
-
- if (finalInsulinAfterConstraints > 0) {
- DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
- detailedBolusInfo.insulin = finalInsulinAfterConstraints;
- detailedBolusInfo.context = context;
- detailedBolusInfo.source = Source.USER;
- detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
- detailedBolusInfo.notes = notes;
- ConfigBuilderPlugin.getPlugin().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.gs(R.string.treatmentdeliveryerror));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
- }
- }
- });
- }
- if (pumpSiteChangeCheckbox.isChecked())
- NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes);
- if (insulinCartridgeChangeCheckbox.isChecked())
- NSUpload.uploadEvent(CareportalEvent.INSULINCHANGE, now() + 1000, notes);
- }
- });
- } else {
- builder.setMessage(MainApp.gs(R.string.no_action_selected));
- }
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- dismiss();
- } catch (RuntimeException e) {
- log.error("Unhandled exception", e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java
deleted file mode 100644
index 99e877efcc..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package info.nightscout.androidaps.plugins.general.actions.dialogs;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.interfaces.Constraint;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SafeParse;
-
-public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
- private static Logger log = LoggerFactory.getLogger(NewExtendedBolusDialog.class);
-
- NumberPicker editInsulin;
- NumberPicker editDuration;
-
- public NewExtendedBolusDialog() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- getDialog().setTitle(MainApp.gs(R.string.overview_extendedbolus_button));
-
- View view = inflater.inflate(R.layout.overview_newextendedbolus_dialog, container, false);
-
- Double maxInsulin = MainApp.getConstraintChecker().getMaxExtendedBolusAllowed().value();
- editInsulin = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_insulin);
- editInsulin.setParams(0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false, view.findViewById(R.id.ok));
-
- double extendedDurationStep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().extendedBolusDurationStep;
- double extendedMaxDuration = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().extendedBolusMaxDuration;
- editDuration = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_duration);
- editDuration.setParams(extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false, view.findViewById(R.id.ok));
-
- view.findViewById(R.id.ok).setOnClickListener(this);
- view.findViewById(R.id.cancel).setOnClickListener(this);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- return view;
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- try {
- Double insulin = SafeParse.stringToDouble(editInsulin.getText());
- int durationInMinutes = SafeParse.stringToInt(editDuration.getText());
-
- String confirmMessage = MainApp.gs(R.string.setextendedbolusquestion);
-
- Double insulinAfterConstraint = MainApp.getConstraintChecker().applyExtendedBolusConstraints(new Constraint<>(insulin)).value();
- confirmMessage += " " + insulinAfterConstraint + " U ";
- confirmMessage += MainApp.gs(R.string.duration) + " " + durationInMinutes + "min ?";
- if (Math.abs(insulinAfterConstraint - insulin) > 0.01d)
- confirmMessage += "\n" + MainApp.gs(R.string.constraintapllied);
- insulin = insulinAfterConstraint;
-
- final Double finalInsulin = insulin;
- final int finalDurationInMinutes = durationInMinutes;
-
- final Context context = getContext();
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(confirmMessage);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- ConfigBuilderPlugin.getPlugin().getCommandQueue().extendedBolus(finalInsulin, finalDurationInMinutes, 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.gs(R.string.treatmentdeliveryerror));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
- }
- }
- });
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- dismiss();
-
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- break;
- case R.id.cancel:
- dismiss();
- break;
- }
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java
deleted file mode 100644
index cad2e22f85..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package info.nightscout.androidaps.plugins.general.actions.dialogs;
-
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.interfaces.Constraint;
-import info.nightscout.androidaps.interfaces.PumpDescription;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SafeParse;
-
-public class NewTempBasalDialog extends DialogFragment implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
- private static Logger log = LoggerFactory.getLogger(NewTempBasalDialog.class);
-
- RadioButton percentRadio;
- RadioButton absoluteRadio;
- RadioGroup basalTypeRadioGroup;
- LinearLayout typeSelectorLayout;
-
- LinearLayout percentLayout;
- LinearLayout absoluteLayout;
-
- NumberPicker basalPercent;
- NumberPicker basalAbsolute;
- NumberPicker duration;
-
- public NewTempBasalDialog() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- getDialog().setTitle(MainApp.gs(R.string.overview_tempbasal_button));
-
- View view = inflater.inflate(R.layout.overview_newtempbasal_dialog, container, false);
-
- percentLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_percent_layout);
- absoluteLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_absolute_layout);
- percentRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_percent_radio);
- basalTypeRadioGroup = (RadioGroup) view.findViewById(R.id.overview_newtempbasal_radiogroup);
- absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
- typeSelectorLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
-
- PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
-
- basalPercent = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
- double maxTempPercent = pumpDescription.maxTempPercent;
- double tempPercentStep = pumpDescription.tempPercentStep;
- basalPercent.setParams(100d, 0d, maxTempPercent, tempPercentStep, new DecimalFormat("0"), true, view.findViewById(R.id.ok));
-
- Profile profile = ProfileFunctions.getInstance().getProfile();
- Double currentBasal = profile != null ? profile.getBasal() : 0d;
- basalAbsolute = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalabsoluteinput);
- basalAbsolute.setParams(currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true, view.findViewById(R.id.ok));
-
- double tempDurationStep = pumpDescription.tempDurationStep;
- double tempMaxDuration = pumpDescription.tempMaxDuration;
- duration = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_duration);
- duration.setParams(tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false, view.findViewById(R.id.ok));
-
- if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT && (pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
- // Both allowed
- typeSelectorLayout.setVisibility(View.VISIBLE);
- } else {
- typeSelectorLayout.setVisibility(View.GONE);
- }
-
- if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT) {
- percentRadio.setChecked(true);
- absoluteRadio.setChecked(false);
- percentLayout.setVisibility(View.VISIBLE);
- absoluteLayout.setVisibility(View.GONE);
- } else if ((pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
- percentRadio.setChecked(false);
- absoluteRadio.setChecked(true);
- percentLayout.setVisibility(View.GONE);
- absoluteLayout.setVisibility(View.VISIBLE);
- }
-
- view.findViewById(R.id.ok).setOnClickListener(this);
- view.findViewById(R.id.cancel).setOnClickListener(this);
- basalTypeRadioGroup.setOnCheckedChangeListener(this);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- return view;
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- try {
- int percent = 0;
- Double absolute = 0d;
- final boolean setAsPercent = percentRadio.isChecked();
- int durationInMinutes = SafeParse.stringToInt(duration.getText());
-
- Profile profile = ProfileFunctions.getInstance().getProfile();
- if (profile == null)
- return;
-
- String confirmMessage = MainApp.gs(R.string.setbasalquestion);
- if (setAsPercent) {
- int basalPercentInput = SafeParse.stringToInt(basalPercent.getText());
- percent = MainApp.getConstraintChecker().applyBasalPercentConstraints(new Constraint<>(basalPercentInput), profile).value();
- confirmMessage += "\n" + percent + "% ";
- confirmMessage += "\n" + MainApp.gs(R.string.duration) + " " + durationInMinutes + "min ?";
- if (percent != basalPercentInput)
- confirmMessage += "\n" + MainApp.gs(R.string.constraintapllied);
- } else {
- Double basalAbsoluteInput = SafeParse.stringToDouble(basalAbsolute.getText());
- absolute = MainApp.getConstraintChecker().applyBasalConstraints(new Constraint<>(basalAbsoluteInput), profile).value();
- confirmMessage += "\n" + absolute + " U/h ";
- confirmMessage += "\n" + MainApp.gs(R.string.duration) + " " + durationInMinutes + "min ?";
- if (Math.abs(absolute - basalAbsoluteInput) > 0.01d)
- confirmMessage += "\n" + MainApp.gs(R.string.constraintapllied);
- }
-
- final int finalBasalPercent = percent;
- final Double finalBasal = absolute;
- final int finalDurationInMinutes = durationInMinutes;
-
- AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(confirmMessage);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- Callback callback = 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.gs(R.string.tempbasaldeliveryerror));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
- }
- }
- };
- if (setAsPercent) {
- ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, true, profile, callback);
- } else {
- ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
- }
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- dismiss();
-
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- break;
- case R.id.cancel:
- dismiss();
- break;
- }
- }
-
- @Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- switch (checkedId) {
- case R.id.overview_newtempbasal_percent_radio:
- percentLayout.setVisibility(View.VISIBLE);
- absoluteLayout.setVisibility(View.GONE);
- break;
- case R.id.overview_newtempbasal_absolute_radio:
- percentLayout.setVisibility(View.GONE);
- absoluteLayout.setVisibility(View.VISIBLE);
- break;
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
index 5266c0781c..1db87f6472 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.general.automation
import android.os.Bundle
+import android.text.method.ScrollingMovementMethod
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -16,12 +17,12 @@ import info.nightscout.androidaps.plugins.general.automation.dragHelpers.SimpleI
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.plusAssign
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.automation_fragment.*
-
class AutomationFragment : Fragment(), OnStartDragListener {
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -40,6 +41,8 @@ class AutomationFragment : Fragment(), OnStartDragListener {
automation_eventListView.layoutManager = LinearLayoutManager(context)
automation_eventListView.adapter = eventListAdapter
+ automation_logView.setMovementMethod(ScrollingMovementMethod())
+
automation_fabAddEvent.setOnClickListener {
val dialog = EditEventDialog()
val args = Bundle()
@@ -88,8 +91,8 @@ class AutomationFragment : Fragment(), OnStartDragListener {
eventListAdapter?.notifyDataSetChanged()
val sb = StringBuilder()
for (l in AutomationPlugin.executionLog.reversed())
- sb.append(l).append("\n")
- automation_logView?.text = sb.toString()
+ sb.append(l).append("
")
+ automation_logView?.text = HtmlHelper.fromHtml(sb.toString())
}
override fun onStartDrag(viewHolder: RecyclerView.ViewHolder) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt
index b559311f9d..0d220c2dd4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt
@@ -178,10 +178,10 @@ object AutomationPlugin : PluginBase(PluginDescription()
val sb = StringBuilder()
sb.append(DateUtil.timeString(DateUtil.now()))
sb.append(" ")
- sb.append(if (result.success) "☺" else "X")
- sb.append(" ")
+ sb.append(if (result.success) "☺" else "▼")
+ sb.append(" ")
sb.append(event.title)
- sb.append(": ")
+ sb.append(": ")
sb.append(action.shortDescription())
sb.append(": ")
sb.append(result.comment)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.java
index 8a4762bd08..63c923fdcf 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.java
@@ -21,17 +21,29 @@ import info.nightscout.androidaps.plugins.general.automation.elements.InputProfi
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement;
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder;
import info.nightscout.androidaps.queue.Callback;
+import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.JsonHelper;
public class ActionProfileSwitch extends Action {
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
- public InputProfileName inputProfileName = new InputProfileName(ProfileFunctions.getInstance().getProfileName());
+ InputProfileName inputProfileName;
String profileName = "";
public ActionProfileSwitch() {
// Prevent action if active profile is already active
// but we don't have a trigger IS_NOT_EQUAL
// so check is in the doRun()
+ ProfileInterface profileInterface = ConfigBuilderPlugin.getPlugin().getActiveProfileInterface();
+ if (profileInterface != null) {
+ ProfileStore profileStore = profileInterface.getProfile();
+ if (profileStore != null) {
+ String name = profileStore.getDefaultProfileName();
+ if (name != null) {
+ profileName = name;
+ }
+ }
+ }
+ inputProfileName = new InputProfileName(profileName);
}
@Override
@@ -50,23 +62,43 @@ public class ActionProfileSwitch extends Action {
String activeProfileName = ProfileFunctions.getInstance().getProfileName();
//Check for uninitialized profileName
- if ( profileName.equals("")){ profileName = activeProfileName; }
-
+ if ( profileName.equals("")){
+ log.error("Selected profile not initialized");
+ if (callback != null)
+ callback.result(new PumpEnactResult().success(false).comment(R.string.error_field_must_not_be_empty)).run();
+ return;
+ }
+ if ( ProfileFunctions.getInstance().getProfile() == null){
+ log.error("ProfileFunctions not initialized");
+ if (callback != null)
+ callback.result(new PumpEnactResult().success(false).comment(R.string.noprofile)).run();
+ return;
+ }
if (profileName.equals(activeProfileName)) {
- // Profile is already switched
+ if (L.isEnabled(L.AUTOMATION))
+ log.debug("Profile is already switched");
+ if (callback != null)
+ callback.result(new PumpEnactResult().success(true).comment(R.string.alreadyset)).run();
return;
}
ProfileInterface activeProfile = ConfigBuilderPlugin.getPlugin().getActiveProfileInterface();
- if (activeProfile == null) return;
+ if (activeProfile == null) {
+ log.error("ProfileInterface not initialized");
+ if (callback != null)
+ callback.result(new PumpEnactResult().success(false).comment(R.string.noprofile)).run();
+ return;
+ }
ProfileStore profileStore = activeProfile.getProfile();
if (profileStore == null) return;
if(profileStore.getSpecificProfile(profileName) == null) {
if (L.isEnabled(L.AUTOMATION))
log.error("Selected profile does not exist! - "+ profileName);
+ if (callback != null)
+ callback.result(new PumpEnactResult().success(false).comment(R.string.notexists)).run();
return;
}
- ProfileFunctions.doProfileSwitch(profileStore, profileName, 0, 100, 0);
+ ProfileFunctions.doProfileSwitch(profileStore, profileName, 0, 100, 0, DateUtil.now());
if (callback != null)
callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java
index b0ef645069..1d7ab8db48 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java
@@ -75,7 +75,7 @@ public class ActionStartTempTarget extends Action {
int unitResId = value.getUnits().equals(Constants.MGDL) ? R.string.mgdl : R.string.mmol;
new LayoutBuilder()
- .add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget) + " [" + MainApp.gs(unitResId) + "]", "", value))
+ .add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget) + "\n[" + MainApp.gs(unitResId) + "]", "", value))
.add(new LabelWithElement(MainApp.gs(R.string.careportal_newnstreatment_duration_min_label), "", duration))
.build(root);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ActionListAdapter.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ActionListAdapter.kt
index 8c9efedd20..d3a8eb20c0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ActionListAdapter.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ActionListAdapter.kt
@@ -32,7 +32,7 @@ class ActionListAdapter(private val fragmentManager: FragmentManager, private va
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
- fun bind(action: Action, fragmentManager: FragmentManager, recyclerView: RecyclerView.Adapter, position : Int, actionList: MutableList) {
+ fun bind(action: Action, fragmentManager: FragmentManager, recyclerView: RecyclerView.Adapter, position: Int, actionList: MutableList) {
view.findViewById(R.id.automation_layoutText).setOnClickListener {
if (action.hasDialog()) {
val args = Bundle()
@@ -48,6 +48,7 @@ class ActionListAdapter(private val fragmentManager: FragmentManager, private va
recyclerView.notifyDataSetChanged()
RxBus.send(EventAutomationUpdateGui())
}
+ if (action.icon().isPresent) view.findViewById(R.id.automation_action_image).setImageResource(action.icon().get())
view.findViewById(R.id.automation_viewActionTitle).text = action.shortDescription()
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseActionDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseActionDialog.kt
index 2096d5a541..c6097a1e88 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseActionDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseActionDialog.kt
@@ -5,19 +5,18 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RadioButton
-import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
import info.nightscout.androidaps.plugins.general.automation.actions.Action
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationAddAction
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
import kotlinx.android.synthetic.main.automation_dialog_choose_action.*
-import kotlinx.android.synthetic.main.okcancel.*
-class ChooseActionDialog : DialogFragment() {
+class ChooseActionDialog : DialogFragmentWithDate() {
- var checkedIndex = -1
+ private var checkedIndex = -1
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
@@ -26,7 +25,7 @@ class ChooseActionDialog : DialogFragment() {
checkedIndex = bundle.getInt("checkedIndex")
}
- dialog?.setCanceledOnTouchOutside(false)
+ onCreateViewGeneral()
return inflater.inflate(R.layout.automation_dialog_choose_action, container, false)
}
@@ -42,27 +41,19 @@ class ChooseActionDialog : DialogFragment() {
if (checkedIndex != -1)
(automation_radioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
+ }
- // OK button
- ok.setOnClickListener {
- dismiss()
- instantiateAction()?.let {
- RxBus.send(EventAutomationAddAction(it))
- RxBus.send(EventAutomationUpdateGui())
- }
+ override fun submit(): Boolean {
+ instantiateAction()?.let {
+ RxBus.send(EventAutomationAddAction(it))
+ RxBus.send(EventAutomationUpdateGui())
}
-
- // Cancel button
- cancel.setOnClickListener { dismiss() }
+ return true
}
- override fun onStart() {
- super.onStart()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- }
-
- override fun onSaveInstanceState(bundle: Bundle) {
- bundle.putInt("checkedIndex", determineCheckedIndex())
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putInt("checkedIndex", determineCheckedIndex())
}
private fun instantiateAction(): Action? {
@@ -86,5 +77,4 @@ class ChooseActionDialog : DialogFragment() {
}
return -1
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseTriggerDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseTriggerDialog.kt
index b2317fc6a2..eef3a7057e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseTriggerDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/ChooseTriggerDialog.kt
@@ -5,17 +5,15 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RadioButton
-import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
import kotlinx.android.synthetic.main.automation_dialog_choose_trigger.*
-import kotlinx.android.synthetic.main.okcancel.*
-class ChooseTriggerDialog : DialogFragment() {
+class ChooseTriggerDialog : DialogFragmentWithDate() {
private var checkedIndex = -1
-
private var clickListener: OnClickListener? = null
interface OnClickListener {
@@ -29,7 +27,7 @@ class ChooseTriggerDialog : DialogFragment() {
checkedIndex = bundle.getInt("checkedIndex")
}
- dialog?.setCanceledOnTouchOutside(false)
+ onCreateViewGeneral()
return inflater.inflate(R.layout.automation_dialog_choose_trigger, container, false)
}
@@ -45,30 +43,22 @@ class ChooseTriggerDialog : DialogFragment() {
if (checkedIndex != -1)
(automation_chooseTriggerRadioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
-
- // OK button
- ok.setOnClickListener {
- dismiss()
- instantiateTrigger()?.let {
- clickListener?.onClick(it)
- }
- }
-
- // Cancel button
- cancel.setOnClickListener { dismiss() }
}
- override fun onStart() {
- super.onStart()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ override fun submit(): Boolean {
+ instantiateTrigger()?.let {
+ clickListener?.onClick(it)
+ }
+ return true
}
fun setOnClickListener(clickListener: OnClickListener) {
this.clickListener = clickListener
}
- override fun onSaveInstanceState(bundle: Bundle) {
- bundle.putInt("checkedIndex", determineCheckedIndex())
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putInt("checkedIndex", determineCheckedIndex())
}
private fun instantiateTrigger(): Trigger? {
@@ -92,5 +82,4 @@ class ChooseTriggerDialog : DialogFragment() {
}
return -1
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditActionDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditActionDialog.kt
index 2c49f81bba..e738b7f94c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditActionDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditActionDialog.kt
@@ -4,16 +4,15 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.automation.actions.Action
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateAction
import kotlinx.android.synthetic.main.automation_dialog_action.*
-import kotlinx.android.synthetic.main.okcancel.*
import org.json.JSONObject
-class EditActionDialog : DialogFragment() {
+class EditActionDialog : DialogFragmentWithDate() {
private var action: Action? = null
private var actionPosition: Int = -1
@@ -24,8 +23,7 @@ class EditActionDialog : DialogFragment() {
actionPosition = bundle.getInt("actionPosition", -1)
bundle.getString("action")?.let { action = Action.instantiate(JSONObject(it)) }
}
-
- dialog?.setCanceledOnTouchOutside(false)
+ onCreateViewGeneral()
return inflater.inflate(R.layout.automation_dialog_action, container, false)
}
@@ -37,22 +35,13 @@ class EditActionDialog : DialogFragment() {
automation_editActionLayout.removeAllViews()
it.generateDialog(automation_editActionLayout)
}
-
- // OK button
- ok.setOnClickListener {
- dismiss()
- action?.let {
- RxBus.send(EventAutomationUpdateAction(it, actionPosition))
- }
- }
-
- // Cancel button
- cancel.setOnClickListener { dismiss() }
}
- override fun onStart() {
- super.onStart()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ override fun submit(): Boolean {
+ action?.let {
+ RxBus.send(EventAutomationUpdateAction(it, actionPosition))
+ }
+ return true
}
override fun onSaveInstanceState(bundle: Bundle) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
index 85aab0f538..0bcb183e11 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
@@ -4,9 +4,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
@@ -17,9 +17,8 @@ import info.nightscout.androidaps.utils.ToastUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.automation_dialog_event.*
-import kotlinx.android.synthetic.main.okcancel.*
-class EditEventDialog : DialogFragment() {
+class EditEventDialog : DialogFragmentWithDate() {
private var actionListAdapter: ActionListAdapter? = null
private var event: AutomationEvent = AutomationEvent()
@@ -35,7 +34,7 @@ class EditEventDialog : DialogFragment() {
bundle.getString("event")?.let { event = AutomationEvent().fromJSON(it) }
}
- dialog?.setCanceledOnTouchOutside(false)
+ onCreateViewGeneral()
return inflater.inflate(R.layout.automation_dialog_event, container, false)
}
@@ -60,39 +59,6 @@ class EditEventDialog : DialogFragment() {
automation_addAction.setOnClickListener { fragmentManager?.let { ChooseActionDialog().show(it, "ChooseActionDialog") } }
- // OK button
- ok.setOnClickListener {
- // check for title
- val title = automation_inputEventTitle.text.toString()
- if (title.isEmpty()) {
- ToastUtils.showToastInUiThread(context, R.string.automation_missing_task_name)
- return@setOnClickListener
- }
- event.title = title
- // check for at least one trigger
- val con = event.trigger as TriggerConnector
- if (con.size() == 0) {
- ToastUtils.showToastInUiThread(context, R.string.automation_missing_trigger)
- return@setOnClickListener
- }
- // check for at least one action
- if (event.actions.isEmpty()) {
- ToastUtils.showToastInUiThread(context, R.string.automation_missing_action)
- return@setOnClickListener
- }
- // store
- if (position == -1)
- AutomationPlugin.automationEvents.add(event)
- else
- AutomationPlugin.automationEvents[position] = event
-
- dismiss()
- RxBus.send(EventAutomationDataChanged())
- }
-
- // Cancel button
- cancel.setOnClickListener { dismiss() }
-
showPreconditions()
disposable.add(RxBus
@@ -137,9 +103,33 @@ class EditEventDialog : DialogFragment() {
)
}
- override fun onStart() {
- super.onStart()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ override fun submit() : Boolean{
+ // check for title
+ val title = automation_inputEventTitle.text.toString()
+ if (title.isEmpty()) {
+ ToastUtils.showToastInUiThread(context, R.string.automation_missing_task_name)
+ return false
+ }
+ event.title = title
+ // check for at least one trigger
+ val con = event.trigger as TriggerConnector
+ if (con.size() == 0) {
+ ToastUtils.showToastInUiThread(context, R.string.automation_missing_trigger)
+ return false
+ }
+ // check for at least one action
+ if (event.actions.isEmpty()) {
+ ToastUtils.showToastInUiThread(context, R.string.automation_missing_action)
+ return false
+ }
+ // store
+ if (position == -1)
+ AutomationPlugin.automationEvents.add(event)
+ else
+ AutomationPlugin.automationEvents[position] = event
+
+ RxBus.send(EventAutomationDataChanged())
+ return true
}
override fun onDestroyView() {
@@ -147,10 +137,10 @@ class EditEventDialog : DialogFragment() {
disposable.clear()
}
- override fun onSaveInstanceState(bundle: Bundle) {
- super.onSaveInstanceState(bundle)
- bundle.putString("event", event.toJSON())
- bundle.putInt("position", position)
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ savedInstanceState.putString("event", event.toJSON())
+ savedInstanceState.putInt("position", position)
}
private fun showPreconditions() {
@@ -164,5 +154,4 @@ class EditEventDialog : DialogFragment() {
automation_forcedTriggerDescriptionLabel.visibility = View.GONE
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditTriggerDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditTriggerDialog.kt
index eda9c6177f..b30a724ec5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditTriggerDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditTriggerDialog.kt
@@ -4,15 +4,14 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateTrigger
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
import kotlinx.android.synthetic.main.automation_dialog_edit_trigger.*
-import kotlinx.android.synthetic.main.okcancel.*
-class EditTriggerDialog : DialogFragment() {
+class EditTriggerDialog : DialogFragmentWithDate() {
private var trigger: Trigger? = null
@@ -23,7 +22,7 @@ class EditTriggerDialog : DialogFragment() {
bundle.getString("trigger")?.let { trigger = Trigger.instantiate(it) }
}
- dialog?.setCanceledOnTouchOutside(false)
+ onCreateViewGeneral()
return inflater.inflate(R.layout.automation_dialog_edit_trigger, container, false)
}
@@ -32,24 +31,15 @@ class EditTriggerDialog : DialogFragment() {
// display root trigger
trigger?.generateDialog(automation_layoutTrigger, fragmentManager)
-
- // OK button
- ok.setOnClickListener {
- dismiss()
- trigger?.let { trigger -> RxBus.send(EventAutomationUpdateTrigger(trigger)) }
- }
-
- // Cancel button
- cancel.setOnClickListener { dismiss() }
}
- override fun onStart() {
- super.onStart()
- dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+ override fun submit():Boolean {
+ trigger?.let { trigger -> RxBus.send(EventAutomationUpdateTrigger(trigger)) }
+ return true
}
- override fun onSaveInstanceState(bundle: Bundle) {
- super.onSaveInstanceState(bundle)
- trigger?.let { bundle.putString("trigger", it.toJSON()) }
+ override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ super.onSaveInstanceState(savedInstanceState)
+ trigger?.let { savedInstanceState.putString("trigger", it.toJSON()) }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/TriggerListAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/TriggerListAdapter.java
index 98d225d84e..3daa0fbd17 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/TriggerListAdapter.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/TriggerListAdapter.java
@@ -75,7 +75,7 @@ public class TriggerListAdapter {
private Spinner createSpinner() {
Spinner spinner = new Spinner(mContext);
- ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(mContext, android.R.layout.simple_spinner_item, TriggerConnector.Type.labels());
+ ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(mContext, R.layout.spinner_centered, TriggerConnector.Type.labels());
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);
return spinner;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/Comparator.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/Comparator.java
index 334adfcc01..c0e23d979c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/Comparator.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/Comparator.java
@@ -87,7 +87,7 @@ public class Comparator extends Element {
@Override
public void addToLayout(LinearLayout root) {
Spinner spinner = new Spinner(root.getContext());
- ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), android.R.layout.simple_spinner_item, Compare.labels());
+ ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), R.layout.spinner_centered, Compare.labels());
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);
LinearLayout.LayoutParams spinnerParams = new LinearLayout.LayoutParams(
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExists.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExists.java
index 2bde0cb842..4bc0082afa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExists.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExists.java
@@ -54,7 +54,7 @@ public class ComparatorExists extends Element {
@Override
public void addToLayout(LinearLayout root) {
Spinner spinner = new Spinner(root.getContext());
- ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), android.R.layout.simple_spinner_item, Compare.labels());
+ ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), R.layout.spinner_centered, Compare.labels());
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);
LinearLayout.LayoutParams spinnerParams = new LinearLayout.LayoutParams(
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.java
index ad0e84bec4..4dc9358f6c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.java
@@ -87,7 +87,7 @@ public class InputDelta extends Element {
@Override
public void addToLayout(LinearLayout root) {
Spinner spinner = new Spinner(root.getContext());
- ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), android.R.layout.simple_spinner_item, DeltaType.labels());
+ ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<>(root.getContext(), R.layout.spinner_centered, DeltaType.labels());
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);
LinearLayout.LayoutParams spinnerParams = new LinearLayout.LayoutParams(
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputLocationMode.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputLocationMode.java
new file mode 100644
index 0000000000..3fea8b7c33
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputLocationMode.java
@@ -0,0 +1,107 @@
+package info.nightscout.androidaps.plugins.general.automation.elements;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+
+import androidx.annotation.StringRes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.R;
+
+public class InputLocationMode extends Element {
+
+ public enum Mode {
+ INSIDE,
+ OUTSIDE,
+ GOING_IN,
+ GOING_OUT;
+
+ public @StringRes
+ int getStringRes() {
+ switch (this) {
+ case INSIDE:
+ return R.string.location_inside;
+ case OUTSIDE:
+ return R.string.location_outside;
+ case GOING_IN:
+ return R.string.location_going_in;
+ case GOING_OUT:
+ return R.string.location_going_out;
+ default:
+ return R.string.unknown;
+ }
+ }
+
+ public static List labels() {
+ List list = new ArrayList<>();
+ for (Mode c : Mode.values()) {
+ list.add(MainApp.gs(c.getStringRes()));
+ }
+ return list;
+ }
+
+ public Mode fromString(String wanted){
+ for (Mode c : Mode.values()) {
+ if(c.toString() == wanted)
+ return c;
+ }
+ return null;
+ }
+ }
+
+ private Mode mode;
+
+ public InputLocationMode() {
+ super();
+ mode = Mode.INSIDE;
+ }
+
+ public InputLocationMode(InputLocationMode another) {
+ super();
+ this.mode = another.mode;
+ }
+
+ @Override
+ public void addToLayout(LinearLayout root) {
+ ArrayAdapter adapter = new ArrayAdapter<>(root.getContext(),
+ R.layout.spinner_centered, Mode.labels());
+ Spinner spinner = new Spinner(root.getContext());
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ spinner.setAdapter(adapter);
+ LinearLayout.LayoutParams spinnerParams = new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT
+ );
+ spinnerParams.setMargins(0, MainApp.dpToPx(4), 0, MainApp.dpToPx(4));
+ spinner.setLayoutParams(spinnerParams);
+ spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+ setValue(Mode.values()[position]);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+ }
+ });
+ spinner.setSelection(this.getValue().ordinal());
+ root.addView(spinner);
+
+ }
+
+ public Mode getValue() {
+ return mode;
+ }
+
+ public InputLocationMode setValue(Mode mode) {
+ this.mode = mode;
+ return this;
+ }
+
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocation.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocation.java
index 19965cfc9a..8070e074be 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocation.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocation.java
@@ -19,6 +19,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.automation.elements.InputButton;
import info.nightscout.androidaps.plugins.general.automation.elements.InputDouble;
+import info.nightscout.androidaps.plugins.general.automation.elements.InputLocationMode;
import info.nightscout.androidaps.plugins.general.automation.elements.InputString;
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement;
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder;
@@ -28,12 +29,17 @@ import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.T;
+import static info.nightscout.androidaps.plugins.general.automation.elements.InputLocationMode.Mode.*;
+
public class TriggerLocation extends Trigger {
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
InputDouble latitude = new InputDouble(0d, -90d, +90d, 0.000001d, new DecimalFormat("0.000000"));
InputDouble longitude = new InputDouble(0d, -180d, +180d, 0.000001d, new DecimalFormat("0.000000"));
InputDouble distance = new InputDouble(200d, 0, 100000, 10d, new DecimalFormat("0"));
+ InputLocationMode modeSelected = new InputLocationMode();
+ InputLocationMode.Mode lastMode = INSIDE;
+
InputString name = new InputString();
private Runnable buttonAction = () -> {
@@ -54,13 +60,16 @@ public class TriggerLocation extends Trigger {
latitude = new InputDouble(triggerLocation.latitude);
longitude = new InputDouble(triggerLocation.longitude);
distance = new InputDouble(triggerLocation.distance);
+ modeSelected = new InputLocationMode(triggerLocation.modeSelected);
+ if (modeSelected.getValue() == GOING_OUT)
+ lastMode = OUTSIDE;
lastRun = triggerLocation.lastRun;
name = triggerLocation.name;
}
@Override
public synchronized boolean shouldRun() {
- Location location = LocationService.getLastLocation();
+ Location location = this.getCurrentLocation();
if (location == null)
return false;
@@ -72,11 +81,20 @@ public class TriggerLocation extends Trigger {
a.setLongitude(longitude.getValue());
double calculatedDistance = location.distanceTo(a);
- if (calculatedDistance < distance.getValue()) {
+// log.debug("Moded(current/last/wanted): "+(currentMode(calculatedDistance))+"/"+lastMode+"/"+modeSelected.getValue());
+// log.debug("Distance: "+calculatedDistance + "("+distance.getValue()+")");
+
+ if ((modeSelected.getValue() == INSIDE) && (calculatedDistance <= distance.getValue()) ||
+ ((modeSelected.getValue() == OUTSIDE) && (calculatedDistance > distance.getValue())) ||
+ ((modeSelected.getValue() == GOING_IN) && (calculatedDistance <= distance.getValue()) && (lastMode == OUTSIDE)) ||
+ ((modeSelected.getValue() == GOING_OUT) && (calculatedDistance > distance.getValue()) && (lastMode == INSIDE))
+ ) {
if (L.isEnabled(L.AUTOMATION))
log.debug("Ready for execution: " + friendlyDescription());
+ lastMode = currentMode(calculatedDistance);
return true;
}
+ lastMode = currentMode(calculatedDistance); // current mode will be last mode for the next check
return false;
}
@@ -90,6 +108,7 @@ public class TriggerLocation extends Trigger {
data.put("longitude", longitude.getValue());
data.put("distance", distance.getValue());
data.put("name", name.getValue());
+ data.put("mode", modeSelected.getValue());
data.put("lastRun", lastRun);
o.put("data", data);
} catch (JSONException e) {
@@ -106,7 +125,10 @@ public class TriggerLocation extends Trigger {
longitude.setValue(JsonHelper.safeGetDouble(d, "longitude"));
distance.setValue(JsonHelper.safeGetDouble(d, "distance"));
name.setValue(JsonHelper.safeGetString(d, "name"));
- lastRun = JsonHelper.safeGetLong(d, "lastRun");
+ modeSelected.setValue(InputLocationMode.Mode.valueOf(JsonHelper.safeGetString(d, "mode")));
+ if (modeSelected.getValue() == GOING_OUT)
+ lastMode = OUTSIDE;
+ lastRun = DateUtil.now(); // set lastRun to now to give the service 5 mins to get the location properly
} catch (Exception e) {
log.error("Unhandled exception", e);
}
@@ -120,7 +142,7 @@ public class TriggerLocation extends Trigger {
@Override
public String friendlyDescription() {
- return MainApp.gs(R.string.locationis, name.getValue());
+ return MainApp.gs(R.string.locationis, MainApp.gs(modeSelected.getValue().getStringRes()), " " + name.getValue());
}
@Override
@@ -154,6 +176,11 @@ public class TriggerLocation extends Trigger {
return this;
}
+ TriggerLocation setMode(InputLocationMode.Mode value) {
+ modeSelected.setValue(value);
+ return this;
+ }
+
@Override
public void generateDialog(LinearLayout root, FragmentManager fragmentManager) {
new LayoutBuilder()
@@ -162,7 +189,21 @@ public class TriggerLocation extends Trigger {
.add(new LabelWithElement(MainApp.gs(R.string.latitude_short), "", latitude))
.add(new LabelWithElement(MainApp.gs(R.string.longitude_short), "", longitude))
.add(new LabelWithElement(MainApp.gs(R.string.distance_short), "", distance))
+ .add(new LabelWithElement(MainApp.gs(R.string.location_mode), "", modeSelected))
.add(new InputButton(MainApp.gs(R.string.currentlocation), buttonAction), LocationService.getLastLocation() != null)
.build(root);
}
+
+ // Method to return the actual mode based on the current distance
+ InputLocationMode.Mode currentMode(double currentDistance){
+ if ( currentDistance <= this.distance.getValue() )
+ return INSIDE;
+ else
+ return OUTSIDE;
+ }
+
+ static Location getCurrentLocation(){
+ return LocationService.getLastLocation();
+ }
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTarget.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTarget.java
index f45efdf4a4..a5fc6ba092 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTarget.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTarget.java
@@ -93,7 +93,7 @@ public class TriggerTempTarget extends Trigger {
@Override
public int friendlyName() {
- return R.string.temptarget;
+ return R.string.careportal_temporarytarget;
}
@Override
@@ -124,7 +124,7 @@ public class TriggerTempTarget extends Trigger {
@Override
public void generateDialog(LinearLayout root, FragmentManager fragmentManager) {
new LayoutBuilder()
- .add(new StaticLabel(R.string.temptarget))
+ .add(new StaticLabel(R.string.careportal_temporarytarget))
.add(comparator)
.build(root);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRange.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRange.java
index 082c5af75c..adcd85bc71 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRange.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRange.java
@@ -149,7 +149,7 @@ public class TriggerTimeRange extends Trigger {
public int getMinSinceMidnight(long time) {
// if passed argument is smaller than 1440 ( 24 h * 60 min ) that value is already converted
- if (0 < time && time < 1441)
+ if (0 <= time && time < 1441)
return (int) time;
Calendar calendar = DateUtil.gregorianCalendar();
calendar.setTimeInMillis(time);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java
index 42ae7fd6fc..5dd9292343 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java
@@ -63,7 +63,6 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
public static final OptionsToShow TEMPBASALSTART = new OptionsToShow(R.id.careportal_tempbasalstart, R.string.careportal_tempbasalstart).date().bg().duration().percent().absolute();
public static final OptionsToShow TEMPBASALEND = new OptionsToShow(R.id.careportal_tempbasalend, R.string.careportal_tempbasalend).date().bg();
public static final OptionsToShow PROFILESWITCH = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch).date().duration().profile();
- public static final OptionsToShow PROFILESWITCHDIRECT = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch).duration().profile();
public static final OptionsToShow OPENAPSOFFLINE = new OptionsToShow(R.id.careportal_openapsoffline, R.string.careportal_openapsoffline).date().duration();
public static final OptionsToShow TEMPTARGET = new OptionsToShow(R.id.careportal_temporarytarget, R.string.careportal_temporarytarget).date().duration().tempTarget();
@@ -180,7 +179,6 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
newDialog.setOptions(NOTE, R.string.careportal_note);
break;
case R.id.careportal_profileswitch:
- PROFILESWITCH.executeProfileSwitch = false;
newDialog.setOptions(PROFILESWITCH, R.string.careportal_profileswitch);
break;
case R.id.careportal_pumpsitechange:
@@ -202,7 +200,6 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
newDialog.setOptions(OPENAPSOFFLINE, R.string.careportal_openapsoffline);
break;
case R.id.careportal_temporarytarget:
- TEMPTARGET.executeTempTarget = false;
newDialog.setOptions(TEMPTARGET, R.string.careportal_temporarytarget);
break;
default:
@@ -222,7 +219,7 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
activity.runOnUiThread(
() -> {
CareportalEvent careportalEvent;
- NSSettingsStatus nsSettings = new NSSettingsStatus().getInstance();
+ NSSettingsStatus nsSettings = NSSettingsStatus.getInstance();
double iageUrgent = nsSettings.getExtendedWarnValue("iage", "urgent", 96);
double iageWarn = nsSettings.getExtendedWarnValue("iage", "warn", 72);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalPlugin.java
index fa8f87ef46..fc28d23188 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalPlugin.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.careportal;
+import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
@@ -22,10 +23,14 @@ public class CareportalPlugin extends PluginBase {
.fragmentClass(CareportalFragment.class.getName())
.pluginName(R.string.careportal)
.shortName(R.string.careportal_shortname)
- .visibleByDefault(true)
- .enableByDefault(true)
+ .visibleByDefault(Config.NSCLIENT)
+ .enableByDefault(Config.NSCLIENT)
.description(R.string.description_careportal)
);
}
+ @Override
+ public boolean specialEnableCondition() {
+ return Config.NSCLIENT;
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
index 64b7b05987..38ad5bb879 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.general.careportal.Dialogs;
-import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -9,6 +8,8 @@ import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@@ -18,7 +19,6 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.fragment.app.DialogFragment;
@@ -45,8 +45,6 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.ProfileSwitch;
-import info.nightscout.androidaps.db.Source;
-import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
@@ -58,6 +56,7 @@ import info.nightscout.androidaps.utils.DefaultValueHelper;
import info.nightscout.androidaps.utils.HardLimits;
import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.NumberPicker;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse;
import info.nightscout.androidaps.utils.Translator;
@@ -68,7 +67,7 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
private static OptionsToShow options;
private static String event;
- Profile profile;
+ private Profile profile;
public ProfileStore profileStore;
TextView eventTypeText;
@@ -105,9 +104,10 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
private static Integer seconds = null;
- public void setOptions(OptionsToShow options, int event) {
+ public NewNSTreatmentDialog setOptions(OptionsToShow options, int event) {
this.options = options;
this.event = MainApp.gs(event);
+ return this;
}
public NewNSTreatmentDialog() {
@@ -122,7 +122,10 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (options == null) return null;
- getDialog().setTitle(MainApp.gs(options.eventName));
+ getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
+ setCancelable(true);
+ getDialog().setCanceledOnTouchOutside(false);
setStyle(DialogFragment.STYLE_NORMAL, getTheme());
View view = inflater.inflate(R.layout.careportal_newnstreatment_dialog, container, false);
@@ -200,16 +203,15 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
boolean erase = false;
String units = ProfileFunctions.getSystemUnits();
- DefaultValueHelper helper = new DefaultValueHelper();
if (MainApp.gs(R.string.eatingsoon).equals(reasonList.get(position))) {
- defaultDuration = helper.determineEatingSoonTTDuration();
- defaultTarget = helper.determineEatingSoonTT();
+ defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration();
+ defaultTarget = DefaultValueHelper.determineEatingSoonTT();
} else if (MainApp.gs(R.string.activity).equals(reasonList.get(position))) {
- defaultDuration = helper.determineActivityTTDuration();
- defaultTarget = helper.determineActivityTT();
+ defaultDuration = DefaultValueHelper.determineActivityTTDuration();
+ defaultTarget = DefaultValueHelper.determineActivityTT();
} else if (MainApp.gs(R.string.hypo).equals(reasonList.get(position))) {
- defaultDuration = helper.determineHypoTTDuration();
- defaultTarget = helper.determineHypoTT();
+ defaultDuration = DefaultValueHelper.determineHypoTTDuration();
+ defaultTarget = DefaultValueHelper.determineHypoTT();
} else if (editDuration.getValue() != 0) {
defaultDuration = editDuration.getValue();
} else {
@@ -394,6 +396,13 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
return view;
}
+ @Override
+ public void onResume() {
+ super.onResume();
+ getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+
+ }
+
@Override
public void onClick(View view) {
Calendar calendar = Calendar.getInstance();
@@ -585,12 +594,12 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
String buildConfirmText(JSONObject data) {
String ret = "";
- if (data.has("eventType")) {
- ret += MainApp.gs(R.string.careportal_newnstreatment_eventtype);
- ret += ": ";
- ret += Translator.translate(JsonHelper.safeGetString(data, "eventType", ""));
- ret += "\n";
- }
+// if (data.has("eventType")) {
+// ret += MainApp.gs(R.string.careportal_newnstreatment_eventtype);
+// ret += ": ";
+// ret += Translator.translate(JsonHelper.safeGetString(data, "eventType", ""));
+// ret += "\n";
+// }
if (data.has("glucose")) {
ret += MainApp.gs(R.string.treatments_wizard_bg_label);
ret += ": ";
@@ -672,7 +681,7 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
ret += "\n";
}
if (data.has("created_at")) {
- ret += MainApp.gs(R.string.careportal_newnstreatment_eventtime_label);
+ ret += MainApp.gs(R.string.event_time_label);
ret += ": ";
ret += eventTime.toLocaleString();
ret += "\n";
@@ -687,61 +696,25 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
return ret;
}
- void confirmNSTreatmentCreation() {
- Context context = getContext();
- if (context != null) {
- final JSONObject data = gatherData();
- final String confirmText = buildConfirmText(data);
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(confirmText);
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> createNSTreatment(data));
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- }
+ private void confirmNSTreatmentCreation() {
+ final JSONObject data = gatherData();
+ OKDialog.showConfirmation(getContext(), Translator.translate(JsonHelper.safeGetString(data, "eventType", MainApp.gs(R.string.overview_treatment_label))), buildConfirmText(data), () -> createNSTreatment(data));
}
void createNSTreatment(JSONObject data) {
- if (options.executeProfileSwitch) {
- if (data.has("profile")) {
- ProfileFunctions.doProfileSwitch(profileStore, JsonHelper.safeGetString(data, "profile"), JsonHelper.safeGetInt(data, "duration"), JsonHelper.safeGetInt(data, "percentage"), JsonHelper.safeGetInt(data, "timeshift"));
- }
- } else if (options.executeTempTarget) {
- final int duration = JsonHelper.safeGetInt(data, "duration");
- final double targetBottom = JsonHelper.safeGetDouble(data, "targetBottom");
- final double targetTop = JsonHelper.safeGetDouble(data, "targetTop");
- final String reason = JsonHelper.safeGetString(data, "reason", "");
- if ((targetBottom != 0d && targetTop != 0d) || duration == 0) {
- TempTarget tempTarget = new TempTarget()
- .date(eventTime.getTime())
- .duration(duration)
- .reason(reason)
- .source(Source.USER);
- if (tempTarget.durationInMinutes != 0) {
- tempTarget.low(Profile.toMgdl(targetBottom, ProfileFunctions.getSystemUnits()))
- .high(Profile.toMgdl(targetTop, ProfileFunctions.getSystemUnits()));
- } else {
- tempTarget.low(0).high(0);
- }
- TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
- }
- if (duration == 10)
- SP.putBoolean(R.string.key_objectiveusetemptarget, true);
+ if (JsonHelper.safeGetString(data, "eventType", "").equals(CareportalEvent.PROFILESWITCH)) {
+ ProfileSwitch profileSwitch = ProfileFunctions.prepareProfileSwitch(
+ profileStore,
+ JsonHelper.safeGetString(data, "profile"),
+ JsonHelper.safeGetInt(data, "duration"),
+ JsonHelper.safeGetInt(data, "percentage"),
+ JsonHelper.safeGetInt(data, "timeshift"),
+ eventTime.getTime()
+ );
+ NSUpload.uploadProfileSwitch(profileSwitch);
} else {
- if (JsonHelper.safeGetString(data, "eventType").equals(CareportalEvent.PROFILESWITCH)) {
- ProfileSwitch profileSwitch = ProfileFunctions.prepareProfileSwitch(
- profileStore,
- JsonHelper.safeGetString(data, "profile"),
- JsonHelper.safeGetInt(data, "duration"),
- JsonHelper.safeGetInt(data, "percentage"),
- JsonHelper.safeGetInt(data, "timeshift"),
- eventTime.getTime()
- );
- NSUpload.uploadProfileSwitch(profileSwitch);
- } else {
- NSUpload.uploadCareportalEntryToNS(data);
- }
+ NSUpload.uploadCareportalEntryToNS(data);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/OptionsToShow.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/OptionsToShow.java
index 08f65a967f..e1effcd561 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/OptionsToShow.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/OptionsToShow.java
@@ -19,10 +19,6 @@ public class OptionsToShow {
public boolean split;
public boolean tempTarget;
- // perform direct actions
- public boolean executeProfileSwitch = false;
- public boolean executeTempTarget = false;
-
public OptionsToShow(int eventType, int eventName) {
this.eventType = eventType;
this.eventName = eventName;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java
index 997c6b0ba9..074310a8dd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.general.food;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.Editable;
@@ -14,14 +13,11 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
+import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -33,6 +29,7 @@ import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SpinnerHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -42,43 +39,36 @@ import io.reactivex.disposables.CompositeDisposable;
*/
public class FoodFragment extends Fragment {
- private static Logger log = LoggerFactory.getLogger(FoodFragment.class);
private CompositeDisposable disposable = new CompositeDisposable();
- EditText filter;
- ImageView clearFilter;
- SpinnerHelper category;
- SpinnerHelper subcategory;
- RecyclerView recyclerView;
+ private EditText filter;
+ private SpinnerHelper category;
+ private SpinnerHelper subcategory;
+ private RecyclerView recyclerView;
- List unfiltered;
- List filtered;
- ArrayList categories;
- ArrayList subcategories;
+ private List unfiltered;
+ private List filtered;
- final String EMPTY = MainApp.gs(R.string.none);
+ private final String EMPTY = MainApp.gs(R.string.none);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.food_fragment, container, false);
- filter = (EditText) view.findViewById(R.id.food_filter);
- clearFilter = (ImageView) view.findViewById(R.id.food_clearfilter);
+ filter = view.findViewById(R.id.food_filter);
+ ImageView clearFilter = view.findViewById(R.id.food_clearfilter);
category = new SpinnerHelper(view.findViewById(R.id.food_category));
subcategory = new SpinnerHelper(view.findViewById(R.id.food_subcategory));
- recyclerView = (RecyclerView) view.findViewById(R.id.food_recyclerview);
+ recyclerView = view.findViewById(R.id.food_recyclerview);
recyclerView.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
- clearFilter.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- filter.setText("");
- category.setSelection(0);
- subcategory.setSelection(0);
- filterData();
- }
+ clearFilter.setOnClickListener(v -> {
+ filter.setText("");
+ category.setSelection(0);
+ subcategory.setSelection(0);
+ filterData();
});
category.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@@ -149,11 +139,11 @@ public class FoodFragment extends Fragment {
disposable.clear();
}
- void loadData() {
+ private void loadData() {
unfiltered = FoodPlugin.getPlugin().getService().getFoodData();
}
- void fillCategories() {
+ private void fillCategories() {
Set catSet = new HashSet<>();
for (Food f : unfiltered) {
@@ -162,7 +152,7 @@ public class FoodFragment extends Fragment {
}
// make it unique
- categories = new ArrayList<>(catSet);
+ ArrayList categories = new ArrayList<>(catSet);
categories.add(0, MainApp.gs(R.string.none));
ArrayAdapter adapterCategories = new ArrayAdapter<>(getContext(),
@@ -170,7 +160,7 @@ public class FoodFragment extends Fragment {
category.setAdapter(adapterCategories);
}
- void fillSubcategories() {
+ private void fillSubcategories() {
String categoryFilter = category.getSelectedItem().toString();
Set subCatSet = new HashSet<>();
@@ -184,7 +174,7 @@ public class FoodFragment extends Fragment {
}
// make it unique
- subcategories = new ArrayList<>(subCatSet);
+ ArrayList subcategories = new ArrayList<>(subCatSet);
subcategories.add(0, MainApp.gs(R.string.none));
ArrayAdapter adapterSubcategories = new ArrayAdapter<>(getContext(),
@@ -192,7 +182,7 @@ public class FoodFragment extends Fragment {
subcategory.setAdapter(adapterSubcategories);
}
- void filterData() {
+ private void filterData() {
String textFilter = filter.getText().toString();
String categoryFilter = category.getSelectedItem().toString();
String subcategoryFilter = subcategory.getSelectedItem().toString();
@@ -227,6 +217,7 @@ public class FoodFragment extends Fragment {
this.foodList = foodList;
}
+ @NonNull
@Override
public FoodsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.food_item, viewGroup, false);
@@ -257,7 +248,7 @@ public class FoodFragment extends Fragment {
return foodList.size();
}
- class FoodsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class FoodsViewHolder extends RecyclerView.ViewHolder {
TextView name;
TextView portion;
TextView carbs;
@@ -269,43 +260,26 @@ public class FoodFragment extends Fragment {
FoodsViewHolder(View itemView) {
super(itemView);
- name = (TextView) itemView.findViewById(R.id.food_name);
- portion = (TextView) itemView.findViewById(R.id.food_portion);
- carbs = (TextView) itemView.findViewById(R.id.food_carbs);
- fat = (TextView) itemView.findViewById(R.id.food_fat);
- protein = (TextView) itemView.findViewById(R.id.food_protein);
- energy = (TextView) itemView.findViewById(R.id.food_energy);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.food_remove);
- remove.setOnClickListener(this);
+ name = itemView.findViewById(R.id.food_name);
+ portion = itemView.findViewById(R.id.food_portion);
+ carbs = itemView.findViewById(R.id.food_carbs);
+ fat = itemView.findViewById(R.id.food_fat);
+ protein = itemView.findViewById(R.id.food_protein);
+ energy = itemView.findViewById(R.id.food_energy);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.food_remove);
+ remove.setOnClickListener(v -> {
+ final Food food = (Food) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.confirmation), MainApp.gs(R.string.removerecord) + "\n" + food.name, (dialog, id) -> {
+ final String _id = food._id;
+ if (_id != null && !_id.equals("")) {
+ NSUpload.removeFoodFromNS(_id);
+ }
+ FoodPlugin.getPlugin().getService().delete(food);
+ }, null);
+ });
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
-
- @Override
- public void onClick(View v) {
- final Food food = (Food) v.getTag();
- switch (v.getId()) {
-
- case R.id.food_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + food.name);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- final String _id = food._id;
- if (_id != null && !_id.equals("")) {
- NSUpload.removeFoodFromNS(_id);
- }
- FoodPlugin.getPlugin().getService().delete(food);
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
-
- }
- }
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java
index ae9867b0a2..3a776ab541 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java
@@ -2,15 +2,14 @@ package info.nightscout.androidaps.plugins.general.maintenance;
import android.Manifest;
import android.app.Activity;
-import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.preference.PreferenceManager;
-import androidx.core.app.ActivityCompat;
-import androidx.fragment.app.Fragment;
+
import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +38,7 @@ import info.nightscout.androidaps.utils.ToastUtils;
public class ImportExportPrefs {
private static Logger log = LoggerFactory.getLogger(L.CORE);
- static File path = new File(Environment.getExternalStorageDirectory().toString());
+ private static File path = new File(Environment.getExternalStorageDirectory().toString());
static public final File file = new File(path, MainApp.gs(R.string.app_name) + "Preferences");
private static final int REQUEST_EXTERNAL_STORAGE = 1;
@@ -48,21 +47,7 @@ public class ImportExportPrefs {
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
- public static void verifyStoragePermissions(Activity activity) {
- // Check if we have write permission
- int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
-
- if (permission != PackageManager.PERMISSION_GRANTED) {
- // We don't have permission so prompt the user
- ActivityCompat.requestPermissions(
- activity,
- PERMISSIONS_STORAGE,
- REQUEST_EXTERNAL_STORAGE
- );
- }
- }
-
- public static void verifyStoragePermissions(Fragment fragment) {
+ static void verifyStoragePermissions(Fragment fragment) {
int permission = ContextCompat.checkSelfPermission(fragment.getContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@@ -73,85 +58,71 @@ public class ImportExportPrefs {
}
- public static void exportSharedPreferences(final Fragment f) {
+ static void exportSharedPreferences(final Fragment f) {
exportSharedPreferences(f.getContext());
}
- public static void exportSharedPreferences(final Context c) {
-
- new AlertDialog.Builder(c)
- .setMessage(MainApp.gs(R.string.export_to) + " " + file + " ?")
- .setPositiveButton(android.R.string.yes, (dialog, which) -> {
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
- try {
- FileWriter fw = new FileWriter(file);
- PrintWriter pw = new PrintWriter(fw);
- Map prefsMap = prefs.getAll();
- for (Map.Entry entry : prefsMap.entrySet()) {
- pw.println(entry.getKey() + "::" + entry.getValue().toString());
- }
- pw.close();
- fw.close();
- ToastUtils.showToastInUiThread(c, MainApp.gs(R.string.exported));
- } catch (FileNotFoundException e) {
- ToastUtils.showToastInUiThread(c, MainApp.gs(R.string.filenotfound) + " " + file);
- log.error("Unhandled exception", e);
- } catch (IOException e) {
- log.error("Unhandled exception", e);
- }
- })
- .setNegativeButton(android.R.string.cancel, null)
- .show();
+ private static void exportSharedPreferences(final Context context) {
+ OKDialog.showConfirmation(context, MainApp.gs(R.string.maintenance), MainApp.gs(R.string.export_to) + " " + file + " ?", () -> {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ try {
+ FileWriter fw = new FileWriter(file);
+ PrintWriter pw = new PrintWriter(fw);
+ Map prefsMap = prefs.getAll();
+ for (Map.Entry entry : prefsMap.entrySet()) {
+ pw.println(entry.getKey() + "::" + entry.getValue().toString());
+ }
+ pw.close();
+ fw.close();
+ ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.exported));
+ } catch (FileNotFoundException e) {
+ ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.filenotfound) + " " + file);
+ log.error("Unhandled exception", e);
+ } catch (IOException e) {
+ log.error("Unhandled exception", e);
+ }
+ });
}
- public static void importSharedPreferences(final Fragment fragment) {
+ static void importSharedPreferences(final Fragment fragment) {
importSharedPreferences(fragment.getContext());
}
public static void importSharedPreferences(final Context context) {
- new AlertDialog.Builder(context)
- .setMessage(MainApp.gs(R.string.import_from) + " " + file + " ?")
- .setPositiveButton(android.R.string.yes, (dialog, which) -> {
+ OKDialog.showConfirmation(context, MainApp.gs(R.string.maintenance), MainApp.gs(R.string.import_from) + " " + file + " ?", () -> {
+ String line;
+ String[] lineParts;
+ try {
+ SP.clear();
- String line;
- String[] lineParts;
- try {
- SP.clear();
-
- BufferedReader reader = new BufferedReader(new FileReader(file));
- while ((line = reader.readLine()) != null) {
- lineParts = line.split("::");
- if (lineParts.length == 2) {
- if (lineParts[1].equals("true") || lineParts[1].equals("false")) {
- SP.putBoolean(lineParts[0], Boolean.parseBoolean(lineParts[1]));
- } else {
- SP.putString(lineParts[0], lineParts[1]);
- }
- }
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ while ((line = reader.readLine()) != null) {
+ lineParts = line.split("::");
+ if (lineParts.length == 2) {
+ if (lineParts[1].equals("true") || lineParts[1].equals("false")) {
+ SP.putBoolean(lineParts[0], Boolean.parseBoolean(lineParts[1]));
+ } else {
+ SP.putString(lineParts[0], lineParts[1]);
}
- reader.close();
- SP.putBoolean(R.string.key_setupwizard_processed, true);
- OKDialog.show(context, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), () -> {
- log.debug("Exiting");
- MainApp.instance().stopKeepAliveService();
- RxBus.INSTANCE.send(new EventAppExit());
- MainApp.closeDbHelper();
- if (context instanceof Activity) {
- ((Activity)context).finish();
- }
- System.runFinalization();
- System.exit(0);
- });
- } catch (FileNotFoundException e) {
- ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.filenotfound) + " " + file);
- log.error("Unhandled exception", e);
- } catch (IOException e) {
- log.error("Unhandled exception", e);
}
- })
- .setNegativeButton(android.R.string.cancel, null)
- .show();
+ }
+ reader.close();
+ SP.putBoolean(R.string.key_setupwizard_processed, true);
+ OKDialog.show(context, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), () -> {
+ log.debug("Exiting");
+ RxBus.INSTANCE.send(new EventAppExit());
+ if (context instanceof Activity) {
+ ((Activity) context).finish();
+ }
+ System.runFinalization();
+ System.exit(0);
+ });
+ } catch (FileNotFoundException e) {
+ ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.filenotfound) + " " + file);
+ log.error("Unhandled exception", e);
+ } catch (IOException e) {
+ log.error("Unhandled exception", e);
+ }
+ });
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java
index 6b8863242a..ae1262b651 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java
@@ -2,81 +2,58 @@ package info.nightscout.androidaps.plugins.general.maintenance;
import android.content.Intent;
import android.os.Bundle;
-import androidx.fragment.app.Fragment;
-import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.general.food.FoodPlugin;
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
+import info.nightscout.androidaps.utils.OKDialog;
/**
*
*/
public class MaintenanceFragment extends Fragment {
- private Fragment f;
-
- @Override
- public void onResume() {
- super.onResume();
-
- this.f = this;
- }
-
- @Override
- public void onPause() {
- super.onPause();
-
- this.f = null;
- }
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.maintenance_fragment, container, false);
- final Fragment f = this;
-
view.findViewById(R.id.log_send).setOnClickListener(view1 -> MaintenancePlugin.getPlugin().sendLogs());
view.findViewById(R.id.log_delete).setOnClickListener(view1 -> MaintenancePlugin.getPlugin().deleteLogs());
- view.findViewById(R.id.nav_resetdb).setOnClickListener(view1 -> new AlertDialog.Builder(f.getContext())
- .setTitle(R.string.nav_resetdb)
- .setMessage(R.string.reset_db_confirm)
- .setNegativeButton(android.R.string.cancel, null)
- .setPositiveButton(android.R.string.ok, (dialog, which) -> {
+ view.findViewById(R.id.nav_resetdb).setOnClickListener(view1 ->
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.maintenance), MainApp.gs(R.string.reset_db_confirm), () -> {
MainApp.getDbHelper().resetDatabases();
// should be handled by Plugin-Interface and
// additional service interface and plugin registry
FoodPlugin.getPlugin().getService().resetFood();
TreatmentsPlugin.getPlugin().getService().resetTreatments();
})
- .create()
- .show());
-
+ );
view.findViewById(R.id.nav_export).setOnClickListener(view1 -> {
// start activity for checking permissions...
- ImportExportPrefs.verifyStoragePermissions(f);
- ImportExportPrefs.exportSharedPreferences(f);
+ ImportExportPrefs.verifyStoragePermissions(this);
+ ImportExportPrefs.exportSharedPreferences(this);
});
view.findViewById(R.id.nav_import).setOnClickListener(view1 -> {
// start activity for checking permissions...
- ImportExportPrefs.verifyStoragePermissions(f);
- ImportExportPrefs.importSharedPreferences(f);
+ ImportExportPrefs.verifyStoragePermissions(this);
+ ImportExportPrefs.importSharedPreferences(this);
});
view.findViewById(R.id.nav_logsettings).setOnClickListener(view1 -> {
startActivity(new Intent(getActivity(), LogSettingActivity.class));
});
-
return view;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
index 112eb9c951..ea3ee3f9a7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.java
@@ -1,9 +1,6 @@
package info.nightscout.androidaps.plugins.general.nsclient;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.Html;
@@ -25,6 +22,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientN
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -113,20 +111,11 @@ public class NSClientFragment extends Fragment implements View.OnClickListener,
NSClientPlugin.getPlugin().clearLog();
break;
case R.id.nsclientinternal_clearqueue:
- final Context context = getContext();
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
-
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage("Clear queue? All data in queue will be lost!");
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- UploadQueue.clearQueue();
- updateGui();
- FabricPrivacy.getInstance().logCustom("NSClientClearQueue");
- }
+ OKDialog.showConfirmation(getContext(),MainApp.gs(R.string.nsclientinternal), MainApp.gs(R.string.clearqueueconfirm), () -> {
+ UploadQueue.clearQueue();
+ updateGui();
+ FabricPrivacy.getInstance().logCustom("NSClientClearQueue");
});
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
break;
case R.id.nsclientinternal_showqueue:
RxBus.INSTANCE.send(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList()));
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
index 037f91b3f0..957d69a935 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java
@@ -32,6 +32,8 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
+import info.nightscout.androidaps.plugins.general.nsclient.data.AlarmAck;
+import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI;
@@ -250,4 +252,25 @@ public class NSClientPlugin extends PluginBase {
public boolean hasWritePermission() {
return nsClientService.hasWriteAuth;
}
+
+ public void handleClearAlarm(NSAlarm originalAlarm, long silenceTimeInMsec) {
+
+ if (!isEnabled(PluginType.GENERAL)) {
+ return;
+ }
+ if (SP.getBoolean(R.string.key_ns_noupload, false)) {
+ if (L.isEnabled(L.NSCLIENT))
+ log.debug("Upload disabled. Message dropped");
+ return;
+ }
+
+ AlarmAck ack = new AlarmAck();
+ ack.level = originalAlarm.getLevel();
+ ack.group = originalAlarm.getGroup();
+ ack.silenceTime = silenceTimeInMsec;
+
+ if (nsClientService != null)
+ nsClientService.sendAlarmAck(ack);
+ }
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java
index 582eedb0e7..b735a153fb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.general.nsclient;
-import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
+
import androidx.annotation.Nullable;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@@ -24,22 +23,23 @@ import java.util.Locale;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.services.Intents;
import info.nightscout.androidaps.data.DetailedBolusInfo;
+import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.CareportalEvent;
+import info.nightscout.androidaps.db.DbRequest;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.TemporaryBasal;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
+import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
import info.nightscout.androidaps.plugins.aps.loop.DeviceStatus;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
-import info.nightscout.androidaps.plugins.general.nsclient.data.DbLogger;
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.utils.BatteryLevel;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.SP;
@@ -53,7 +53,6 @@ public class NSUpload {
public static void uploadTempBasalStartAbsolute(TemporaryBasal temporaryBasal, Double originalExtendedAmount) {
try {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.TEMPBASAL);
data.put("duration", temporaryBasal.durationInMinutes);
@@ -65,15 +64,7 @@ public class NSUpload {
data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
if (originalExtendedAmount != null)
data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -96,7 +87,6 @@ public class NSUpload {
uploadTempBasalStartAbsolute(t, null);
}
} else {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.TEMPBASAL);
data.put("duration", temporaryBasal.durationInMinutes);
@@ -107,15 +97,7 @@ public class NSUpload {
data.put("pumpId", temporaryBasal.pumpId);
data.put("created_at", DateUtil.toISOString(temporaryBasal.date));
data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
}
} catch (JSONException e) {
log.error("Unhandled exception", e);
@@ -124,7 +106,6 @@ public class NSUpload {
public static void uploadTempBasalEnd(long time, boolean isFakedTempBasal, long pumpId) {
try {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.TEMPBASAL);
data.put("created_at", DateUtil.toISOString(time));
@@ -133,15 +114,7 @@ public class NSUpload {
data.put("isFakedTempBasal", isFakedTempBasal);
if (pumpId != 0)
data.put("pumpId", pumpId);
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -149,7 +122,6 @@ public class NSUpload {
public static void uploadExtendedBolus(ExtendedBolus extendedBolus) {
try {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.COMBOBOLUS);
data.put("duration", extendedBolus.durationInMinutes);
@@ -161,15 +133,7 @@ public class NSUpload {
data.put("pumpId", extendedBolus.pumpId);
data.put("created_at", DateUtil.toISOString(extendedBolus.date));
data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -177,7 +141,6 @@ public class NSUpload {
public static void uploadExtendedBolusEnd(long time, long pumpId) {
try {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.COMBOBOLUS);
data.put("duration", 0);
@@ -189,15 +152,7 @@ public class NSUpload {
data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
if (pumpId != 0)
data.put("pumpId", pumpId);
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -246,7 +201,12 @@ public class NSUpload {
}
} else {
if (L.isEnabled(L.NSCLIENT))
- log.debug("OpenAPS data too old to upload");
+ log.debug("OpenAPS data too old to upload, sending iob only");
+ IobTotal[] iob = IobCobCalculatorPlugin.getPlugin().calculateIobArrayInDia(profile);
+ if (iob.length > 0) {
+ deviceStatus.iob = iob[0].json();
+ deviceStatus.iob.put("time", DateUtil.toISOString(DateUtil.now()));
+ }
}
deviceStatus.device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL;
JSONObject pumpstatus = ConfigBuilderPlugin.getPlugin().getActivePump().getJSONStatus(profile, profileName);
@@ -258,16 +218,7 @@ public class NSUpload {
deviceStatus.uploaderBattery = batteryLevel;
deviceStatus.created_at = DateUtil.toISOString(new Date());
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "devicestatus");
- bundle.putString("data", deviceStatus.mongoRecord().toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, deviceStatus.mongoRecord().toString());
+ UploadQueue.add(new DbRequest("dbAdd", "devicestatus", deviceStatus.mongoRecord()));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -315,11 +266,13 @@ public class NSUpload {
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.TEMPORARYTARGET);
data.put("duration", tempTarget.durationInMinutes);
- data.put("reason", tempTarget.reason);
- data.put("targetBottom", Profile.fromMgdlToUnits(tempTarget.low, ProfileFunctions.getSystemUnits()));
- data.put("targetTop", Profile.fromMgdlToUnits(tempTarget.high, ProfileFunctions.getSystemUnits()));
+ if (tempTarget.low > 0) {
+ data.put("reason", tempTarget.reason);
+ data.put("targetBottom", Profile.fromMgdlToUnits(tempTarget.low, ProfileFunctions.getSystemUnits()));
+ data.put("targetTop", Profile.fromMgdlToUnits(tempTarget.high, ProfileFunctions.getSystemUnits()));
+ data.put("units", ProfileFunctions.getSystemUnits());
+ }
data.put("created_at", DateUtil.toISOString(tempTarget.date));
- data.put("units", ProfileFunctions.getSystemUnits());
data.put("enteredBy", MainApp.gs(R.string.app_name));
uploadCareportalEntryToNS(data);
} catch (JSONException e) {
@@ -331,17 +284,7 @@ public class NSUpload {
try {
JSONObject data = getJson(profileSwitch);
if (profileSwitch._id != null) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbUpdate");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- bundle.putString("_id", profileSwitch._id);
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbUpdate", "treatments", profileSwitch._id, data));
}
} catch (JSONException e) {
log.error("Unhandled exception", e);
@@ -380,16 +323,7 @@ public class NSUpload {
prebolus.put("created_at", DateUtil.toISOString(preBolusDate));
uploadCareportalEntryToNS(prebolus);
}
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (Exception e) {
log.error("Unhandled exception", e);
}
@@ -397,40 +331,17 @@ public class NSUpload {
}
public static void removeCareportalEntryFromNS(String _id) {
- try {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbRemove");
- bundle.putString("collection", "treatments");
- bundle.putString("_id", _id);
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbRemove(intent, _id);
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
-
+ UploadQueue.add(new DbRequest("dbRemove", "treatments", _id));
}
public static void uploadOpenAPSOffline(double durationInMinutes) {
try {
- Context context = MainApp.instance().getApplicationContext();
JSONObject data = new JSONObject();
data.put("eventType", "OpenAPS Offline");
data.put("duration", durationInMinutes);
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
@@ -441,10 +352,6 @@ public class NSUpload {
}
public static void uploadError(String error, Date date) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Announcement");
@@ -455,19 +362,10 @@ public class NSUpload {
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
}
public static void uploadBg(BgReading reading, String source) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "entries");
JSONObject data = new JSONObject();
try {
data.put("device", source);
@@ -479,20 +377,11 @@ public class NSUpload {
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "entries", data));
}
public static void uploadAppStart() {
if (SP.getBoolean(R.string.key_ns_logappstartedevent, true)) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Note");
@@ -501,35 +390,17 @@ public class NSUpload {
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
}
}
public static void uploadProfileStore(JSONObject profileStore) {
if (SP.getBoolean(R.string.key_ns_uploadlocalprofile, false)) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "profile");
- bundle.putString("data", String.valueOf(profileStore));
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, String.valueOf(profileStore));
+ UploadQueue.add(new DbRequest("dbAdd", "profile", String.valueOf(profileStore)));
}
}
public static void uploadEvent(String careportalEvent, long time, @Nullable String notes) {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbAdd");
- bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", careportalEvent);
@@ -541,26 +412,12 @@ public class NSUpload {
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
- bundle.putString("data", data.toString());
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbAdd(intent, data.toString());
+ UploadQueue.add(new DbRequest("dbAdd", "treatments", data));
}
public static void removeFoodFromNS(String _id) {
try {
- Context context = MainApp.instance().getApplicationContext();
- Bundle bundle = new Bundle();
- bundle.putString("action", "dbRemove");
- bundle.putString("collection", "food");
- bundle.putString("_id", _id);
- Intent intent = new Intent(Intents.ACTION_DATABASE);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
- DbLogger.dbRemove(intent, _id);
+ UploadQueue.add(new DbRequest("dbRemove", "food", _id));
} catch (Exception e) {
log.error("Unhandled exception", e);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/UploadQueue.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/UploadQueue.java
index c2bb0d21ab..f513f12756 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/UploadQueue.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/UploadQueue.java
@@ -47,7 +47,17 @@ public class UploadQueue {
NSClientService.handler.post(() -> {
if (L.isEnabled(L.NSCLIENT))
log.debug("Adding to queue: " + dbr.data);
- MainApp.getDbHelper().create(dbr);
+ try {
+ MainApp.getDbHelper().create(dbr);
+ } catch (Exception e) {
+ log.error("Unhandled exception", e);
+ dbr.nsClientID += "1";
+ try {
+ MainApp.getDbHelper().create(dbr);
+ } catch (Exception e1) {
+ log.error("Unhandled exception", e1);
+ }
+ }
NSClientPlugin plugin = NSClientPlugin.getPlugin();
if (plugin != null) {
plugin.resend("newdata");
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java
deleted file mode 100644
index 7179231068..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.services.Intents;
-import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm;
-import info.nightscout.androidaps.utils.SP;
-
-/**
- * Created by mike on 11.06.2017.
- */
-
-public class BroadcastAckAlarm {
-
- public static void handleClearAlarm(NSAlarm originalAlarm, Context context, long silenceTimeInMsec) {
-
- Bundle bundle = new Bundle();
- bundle.putInt("level", originalAlarm.getLevel());
- bundle.putString("group", originalAlarm.getGroup());
- bundle.putLong("silenceTime", silenceTimeInMsec);
- Intent intent = new Intent(Intents.ACTION_ACK_ALARM);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
-
- if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, false)) {
- bundle = new Bundle();
- bundle.putInt("level", originalAlarm.getLevel());
- bundle.putString("group", originalAlarm.getGroup());
- bundle.putLong("silenceTime", silenceTimeInMsec);
- intent = new Intent(Intents.ACTION_ACK_ALARM);
- intent.putExtras(bundle);
- intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
- context.sendBroadcast(intent);
- }
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java
index a364d0d4ae..7b722f562d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java
@@ -25,12 +25,11 @@ import info.nightscout.androidaps.utils.SP;
public class BroadcastTreatment {
private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
- public static void handleNewTreatment(JSONObject treatment, boolean isDelta, boolean isLocalBypass) {
+ public static void handleNewTreatment(JSONObject treatment, boolean isDelta) {
Bundle bundle = new Bundle();
bundle.putString("treatment", treatment.toString());
bundle.putBoolean("delta", isDelta);
- bundle.putBoolean("islocal", isLocalBypass);
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/DbLogger.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/DbLogger.java
deleted file mode 100644
index 3aaf4ccac4..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/DbLogger.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package info.nightscout.androidaps.plugins.general.nsclient.data;
-
-import android.content.Intent;
-import android.content.pm.ResolveInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.utils.ToastUtils;
-
-/**
- * Created by mike on 02.07.2016.
- */
-public class DbLogger {
- private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
-
- public static void dbAdd(Intent intent, String data) {
- List q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
- if (q.size() < 1) {
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
- log.error("DBADD No receivers");
- } else if (L.isEnabled(L.NSCLIENT)) {
- if (L.isEnabled(L.NSCLIENT))
- log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
- }
- }
-
- public static void dbRemove(Intent intent, String data) {
- List q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
- if (q.size() < 1) {
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nsclientnotinstalled));
- log.error("DBREMOVE No receivers");
- } else if (L.isEnabled(L.NSCLIENT)) {
- if (L.isEnabled(L.NSCLIENT))
- log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.java
index ea7a8c34bd..89f95608b5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.java
@@ -407,7 +407,7 @@ public class NSDeviceStatus {
}
Uploader uploader = uploaders.get(device);
// check if this is new data
- if (clock != 0 && (uploader != null && clock > uploader.clock || uploader == null)) {
+ if (clock != 0 && battery != null && (uploader != null && clock > uploader.clock || uploader == null)) {
if (uploader == null)
uploader = new Uploader();
uploader.battery = battery;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AckAlarmReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AckAlarmReceiver.java
deleted file mode 100644
index 1c46716d69..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AckAlarmReceiver.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package info.nightscout.androidaps.plugins.general.nsclient.receivers;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.PowerManager;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
-import info.nightscout.androidaps.plugins.general.nsclient.data.AlarmAck;
-import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
-import info.nightscout.androidaps.utils.SP;
-
-public class AckAlarmReceiver extends BroadcastReceiver {
- private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
-
-
- @Override
- public void onReceive(Context context, Intent intent) {
- PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
- AckAlarmReceiver.class.getSimpleName());
- NSClientPlugin nsClientPlugin = NSClientPlugin.getPlugin();
- if (!nsClientPlugin.isEnabled(PluginType.GENERAL)) {
- return;
- }
- if (SP.getBoolean(R.string.key_ns_noupload, false)) {
- if (L.isEnabled(L.NSCLIENT))
- log.debug("Upload disabled. Message dropped");
- return;
- }
- wakeLock.acquire();
- try {
- Bundle bundles = intent.getExtras();
- if (bundles == null) return;
- if (!bundles.containsKey("level")) return;
- if (!bundles.containsKey("group")) return;
- if (!bundles.containsKey("silenceTime")) return;
-
- AlarmAck ack = new AlarmAck();
- ack.level = bundles.getInt("level");
- ack.group = bundles.getString("group");
- ack.silenceTime = bundles.getLong("silenceTime");
-
- NSClientService nsClientService = nsClientPlugin.nsClientService;
- if (nsClientService != null)
- nsClientService.sendAlarmAck(ack);
-
- } finally {
- wakeLock.release();
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/DBAccessReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/DBAccessReceiver.java
deleted file mode 100644
index 4838c178ef..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/DBAccessReceiver.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package info.nightscout.androidaps.plugins.general.nsclient.receivers;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.PowerManager;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.db.DbRequest;
-import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.logging.BundleLogger;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
-import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
-import info.nightscout.androidaps.plugins.general.nsclient.broadcasts.BroadcastTreatment;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.SP;
-
-public class DBAccessReceiver extends BroadcastReceiver {
- private static Logger log = LoggerFactory.getLogger(L.NSCLIENT);
-
-
- @Override
- public void onReceive(Context context, Intent intent) {
- PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
- DBAccessReceiver.class.getSimpleName());
- wakeLock.acquire();
- try {
- Bundle bundles = intent.getExtras();
- if (bundles == null) return;
- if (!bundles.containsKey("action")) return;
-
- if (L.isEnabled(L.NSCLIENT))
- log.debug(BundleLogger.log(bundles));
-
- String collection = null;
- String _id = null;
- JSONObject data = null;
- String action = bundles.getString("action");
- try {
- collection = bundles.getString("collection");
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- return;
- }
- try {
- if (!action.equals("dbAdd"))
- _id = bundles.getString("_id");
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- return;
- }
- try {
- if (!action.equals("dbRemove"))
- data = new JSONObject(bundles.getString("data"));
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- return;
- }
-
- if (data == null && !action.equals("dbRemove") || _id == null && action.equals("dbRemove")) {
- log.error("DBACCESS no data inside record");
- return;
- }
-
- if (action.equals("dbRemove")) {
- data = new JSONObject();
- }
- // mark by id
- Long nsclientid = System.currentTimeMillis();
- try {
- data.put("NSCLIENT_ID", nsclientid);
- } catch (JSONException e) {
- log.error("Unhandled exception", e);
- }
-
- if (!isAllowedCollection(collection)) {
- log.error("DBACCESS wrong collection specified");
- return;
- }
-
- if (action.equals("dbRemove")) {
- if (shouldUpload()) {
- DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id);
- UploadQueue.add(dbr);
- }
- } else if (action.equals("dbUpdate")) {
- if (shouldUpload()) {
- DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id, data);
- UploadQueue.add(dbr);
- }
- } else {
- DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), data);
- // this is not used as mongo _id but only for searching in UploadQueue database
- // if record has to be removed from queue before upload
- dbr._id = nsclientid.toString();
-
- if (shouldUpload()) {
- UploadQueue.add(dbr);
- }
- if (collection.equals("treatments")) {
- generateTreatmentOfflineBroadcast(dbr);
- }
- }
-
- } finally {
- wakeLock.release();
- }
-
- }
-
- public boolean shouldUpload() {
- NSClientPlugin nsClientPlugin = NSClientPlugin.getPlugin();
- return nsClientPlugin.isEnabled(PluginType.GENERAL) && !SP.getBoolean(R.string.key_ns_noupload, false);
- }
-
- public void generateTreatmentOfflineBroadcast(DbRequest request) {
- if (request.action.equals("dbAdd")) {
- try {
- JSONObject data = new JSONObject(request.data);
- data.put("mills", DateUtil.fromISODateString(data.getString("created_at")).getTime());
- data.put("_id", data.get("NSCLIENT_ID")); // this is only fake id
- BroadcastTreatment.handleNewTreatment(data, false, true);
- } catch (Exception e) {
- log.error("Unhadled exception", e);
- }
- }
- }
-
- private boolean isAllowedCollection(String collection) {
- // "treatments" || "entries" || "devicestatus" || "profile" || "food"
- if (collection.equals("treatments")) return true;
- if (collection.equals("entries")) return true;
- if (collection.equals("devicestatus")) return true;
- if (collection.equals("profile")) return true;
- if (collection.equals("food")) return true;
- return false;
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
index f3b718743e..dcce040759 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
@@ -7,7 +7,6 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
@@ -25,8 +24,8 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
@@ -61,6 +60,14 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.TemporaryBasal;
+import info.nightscout.androidaps.dialogs.CalibrationDialog;
+import info.nightscout.androidaps.dialogs.CarbsDialog;
+import info.nightscout.androidaps.dialogs.InsulinDialog;
+import info.nightscout.androidaps.dialogs.ProfileSwitchDialog;
+import info.nightscout.androidaps.dialogs.ProfileViewerDialog;
+import info.nightscout.androidaps.dialogs.TempTargetDialog;
+import info.nightscout.androidaps.dialogs.TreatmentDialog;
+import info.nightscout.androidaps.dialogs.WizardDialog;
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange;
import info.nightscout.androidaps.events.EventCareportalEventChange;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
@@ -84,16 +91,9 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
-import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
-import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.CalibrationDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.NewCarbsDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.NewInsulinDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.NewTreatmentDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.WizardDialog;
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
@@ -105,7 +105,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
-import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.BolusWizard;
import info.nightscout.androidaps.utils.DateUtil;
@@ -120,6 +119,7 @@ import info.nightscout.androidaps.utils.T;
import info.nightscout.androidaps.utils.ToastUtils;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.schedulers.Schedulers;
import static info.nightscout.androidaps.utils.DateUtil.now;
@@ -149,7 +149,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TextView openapsDeviceStatusView;
TextView uploaderDeviceStatusView;
TextView iobCalculationProgressView;
- LinearLayout loopStatusLayout;
+ ConstraintLayout loopStatusLayout;
LinearLayout pumpStatusLayout;
GraphView bgGraph;
GraphView iobGraph;
@@ -170,7 +170,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
RecyclerView notificationsView;
LinearLayoutManager llm;
- LinearLayout acceptTempLayout;
SingleClickButton acceptTempButton;
SingleClickButton treatmentButton;
@@ -222,8 +221,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else if (Config.NSCLIENT) {
view = inflater.inflate(R.layout.overview_fragment_nsclient, container, false);
shorttextmode = true;
- } else if (smallHeight || landscape) {
- view = inflater.inflate(R.layout.overview_fragment_smallheight, container, false);
+ } else if (smallHeight || landscape) { // now testing the same layout for small displays as well
+ view = inflater.inflate(R.layout.overview_fragment, container, false);
} else {
view = inflater.inflate(R.layout.overview_fragment, container, false);
}
@@ -248,7 +247,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
openapsDeviceStatusView = (TextView) view.findViewById(R.id.overview_openaps);
uploaderDeviceStatusView = (TextView) view.findViewById(R.id.overview_uploader);
iobCalculationProgressView = (TextView) view.findViewById(R.id.overview_iobcalculationprogess);
- loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout);
+ loopStatusLayout = view.findViewById(R.id.overview_looplayout);
pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout);
pumpStatusView.setBackgroundColor(MainApp.gc(R.color.colorInitializingBorder));
@@ -296,8 +295,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (cgmButton != null)
cgmButton.setOnClickListener(this);
- acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
-
notificationsView = (RecyclerView) view.findViewById(R.id.overview_notifications);
notificationsView.setHasFixedSize(false);
llm = new LinearLayoutManager(view.getContext());
@@ -358,80 +355,80 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
super.onResume();
disposable.add(RxBus.INSTANCE
.toObservable(EventRefreshOverview.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(eventOpenAPSUpdateGui -> scheduleUpdateGUI(eventOpenAPSUpdateGui.getFrom()),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventExtendedBolusChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventExtendedBolusChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventTempBasalChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventTempBasalChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventTreatmentChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventTreatmentChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventTempTargetChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventTempTargetChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventAcceptOpenLoopChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventAcceptOpenLoopChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventCareportalEventChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventCareportalEventChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventInitializationChanged.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventInitializationChanged"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventAutosensCalculationFinished.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventAutosensCalculationFinished"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventProfileNeedsUpdate.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventProfileNeedsUpdate"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventPreferenceChange.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventPreferenceChange"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventNewOpenLoopNotification.class)
- .observeOn(AndroidSchedulers.mainThread())
+ .observeOn(Schedulers.io())
.subscribe(event -> scheduleUpdateGUI("EventNewOpenLoopNotification"),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventPumpStatusChanged.class)
.observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> updatePumpStatus(event.getStatus()),
+ .subscribe(event -> updatePumpStatus(event),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
@@ -744,11 +741,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
updateGUI("suspendmenu");
return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.careportal_profileswitch))) {
- NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
- final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
- profileswitch.executeProfileSwitch = true;
- newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
- newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
+ FragmentManager manager = getFragmentManager();
+ if (manager != null)
+ new ProfileSwitchDialog().show(manager, "Overview");
} else if (item.getTitle().equals(MainApp.gs(R.string.danar_viewprofile))) {
Bundle args = new Bundle();
args.putLong("time", DateUtil.now());
@@ -759,44 +754,39 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (manager != null)
pvd.show(manager, "ProfileViewDialog");
} else if (item.getTitle().equals(MainApp.gs(R.string.eatingsoon))) {
- DefaultValueHelper defHelper = new DefaultValueHelper();
- double target = Profile.toMgdl(defHelper.determineEatingSoonTT(), ProfileFunctions.getSystemUnits());
+ double target = Profile.toMgdl(DefaultValueHelper.determineEatingSoonTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis())
- .duration(defHelper.determineEatingSoonTTDuration())
+ .duration(DefaultValueHelper.determineEatingSoonTTDuration())
.reason(MainApp.gs(R.string.eatingsoon))
.source(Source.USER)
.low(target)
.high(target);
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.activity))) {
- DefaultValueHelper defHelper = new DefaultValueHelper();
- double target = Profile.toMgdl(defHelper.determineActivityTT(), ProfileFunctions.getSystemUnits());
+ double target = Profile.toMgdl(DefaultValueHelper.determineActivityTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget()
.date(now())
- .duration(defHelper.determineActivityTTDuration())
+ .duration(DefaultValueHelper.determineActivityTTDuration())
.reason(MainApp.gs(R.string.activity))
.source(Source.USER)
.low(target)
.high(target);
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) {
- DefaultValueHelper defHelper = new DefaultValueHelper();
- double target = Profile.toMgdl(defHelper.determineHypoTT(), ProfileFunctions.getSystemUnits());
+ double target = Profile.toMgdl(DefaultValueHelper.determineHypoTT(), ProfileFunctions.getSystemUnits());
TempTarget tempTarget = new TempTarget()
.date(now())
- .duration(defHelper.determineHypoTTDuration())
+ .duration(DefaultValueHelper.determineHypoTTDuration())
.reason(MainApp.gs(R.string.hypo))
.source(Source.USER)
.low(target)
.high(target);
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.custom))) {
- NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();
- final OptionsToShow temptarget = CareportalFragment.TEMPTARGET;
- temptarget.executeTempTarget = true;
- newTTDialog.setOptions(temptarget, R.string.careportal_temporarytarget);
- newTTDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
+ FragmentManager manager = getFragmentManager();
+ if (manager != null)
+ new TempTargetDialog().show(manager, "Overview");
} else if (item.getTitle().equals(MainApp.gs(R.string.cancel))) {
TempTarget tempTarget = new TempTarget()
.source(Source.USER)
@@ -818,7 +808,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
FragmentManager manager = getFragmentManager();
// try to fix https://fabric.io/nightscout3/android/apps/info.nightscout.androidaps/issues/5aca7a1536c7b23527eb4be7?time=last-seven-days
// https://stackoverflow.com/questions/14860239/checking-if-state-is-saved-before-committing-a-fragmenttransaction
- if (manager.isStateSaved())
+ if (manager == null || manager.isStateSaved())
return;
switch (v.getId()) {
case R.id.overview_accepttempbutton:
@@ -863,14 +853,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
break;
case R.id.overview_treatmentbutton:
- NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog();
- treatmentDialogFragment.show(manager, "TreatmentDialog");
+ new TreatmentDialog().show(manager, "Overview");
break;
case R.id.overview_insulinbutton:
- new NewInsulinDialog().show(manager, "InsulinDialog");
+ new InsulinDialog().show(manager, "Overview");
break;
case R.id.overview_carbsbutton:
- new NewCarbsDialog().show(manager, "CarbsDialog");
+ new CarbsDialog().show(manager, "Overview");
break;
case R.id.overview_pumpstatus:
if (ConfigBuilderPlugin.getPlugin().getActivePump().isSuspended() || !ConfigBuilderPlugin.getPlugin().getActivePump().isInitialized())
@@ -891,10 +880,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
getContext().startActivity(intent);
return true;
} catch (ActivityNotFoundException e) {
- new AlertDialog.Builder(getContext())
- .setMessage(R.string.error_starting_cgm)
- .setPositiveButton("OK", null)
- .show();
+ OKDialog.show(getContext(), "", MainApp.gs(R.string.error_starting_cgm));
return false;
}
}
@@ -920,16 +906,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
LoopPlugin.getPlugin().invoke("Accept temp button", false);
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.isChangeRequested()) {
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
+ OKDialog.showConfirmation(context, MainApp.gs(R.string.pump_tempbasal_label), finalLastRun.constraintsProcessed.toSpanned(), () -> {
hideTempRecommendation();
clearNotification();
LoopPlugin.getPlugin().acceptChangeRequest();
});
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
}
}
}
@@ -949,7 +930,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(quickWizardEntry.carbs())).value();
if (Math.abs(wizard.getInsulinAfterConstraints() - wizard.getCalculatedTotalInsulin()) >= pump.getPumpDescription().pumpType.determineCorrectBolusStepSize(wizard.getInsulinAfterConstraints()) || !carbsAfterConstraints.equals(quickWizardEntry.carbs())) {
- OKDialog.show(getContext(), MainApp.gs(R.string.treatmentdeliveryerror), MainApp.gs(R.string.constraints_violation) + "\n" + MainApp.gs(R.string.changeyourinput), null);
+ OKDialog.show(getContext(), MainApp.gs(R.string.treatmentdeliveryerror), MainApp.gs(R.string.constraints_violation) + "\n" + MainApp.gs(R.string.changeyourinput));
return;
}
@@ -962,8 +943,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(() -> {
- if (acceptTempLayout != null)
- acceptTempLayout.setVisibility(View.GONE);
+ if (acceptTempButton != null)
+ acceptTempButton.setVisibility(View.GONE);
});
}
@@ -975,7 +956,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
ActionStringHandler.handleInitiate("cancelChangeRequest");
}
- private void updatePumpStatus(String status) {
+ private void updatePumpStatus(EventPumpStatusChanged event) {
+ String status = event.getStatus();
if (!status.equals("")) {
pumpStatusView.setText(status);
pumpStatusLayout.setVisibility(View.VISIBLE);
@@ -1063,8 +1045,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (deltaShortView != null)
deltaShortView.setText(Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units));
if (avgdeltaView != null)
- avgdeltaView.setText("øΔ15m: " + Profile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
- " øΔ40m: " + Profile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
+ avgdeltaView.setText("øΔ15m: " + Profile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) + "\n" +
+ "øΔ40m: " + Profile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
} else {
if (deltaView != null)
deltaView.setText("Δ " + MainApp.gs(R.string.notavailable));
@@ -1120,27 +1102,25 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (tempTarget != null) {
tempTargetView.setTextColor(MainApp.gc(R.color.ribbonTextWarning));
tempTargetView.setBackgroundColor(MainApp.gc(R.color.ribbonWarning));
- tempTargetView.setVisibility(View.VISIBLE);
tempTargetView.setText(Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units) + " " + DateUtil.untilString(tempTarget.end()));
} else {
tempTargetView.setTextColor(MainApp.gc(R.color.ribbonTextDefault));
tempTargetView.setBackgroundColor(MainApp.gc(R.color.ribbonDefault));
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), Constants.MGDL, units));
- tempTargetView.setVisibility(View.VISIBLE);
}
// **** Temp button ****
- if (acceptTempLayout != null) {
+ if (acceptTempButton != null) {
boolean showAcceptButton = !closedLoopEnabled.value(); // Open mode needed
showAcceptButton = showAcceptButton && finalLastRun != null && finalLastRun.lastAPSRun != null; // aps result must exist
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.isChangeRequested(); // change is requested
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) {
- acceptTempLayout.setVisibility(View.VISIBLE);
+ acceptTempButton.setVisibility(View.VISIBLE);
acceptTempButton.setText(MainApp.gs(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
} else {
- acceptTempLayout.setVisibility(View.GONE);
+ acceptTempButton.setVisibility(View.GONE);
}
}
@@ -1171,55 +1151,41 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (activeTemp != null) {
basalText = "T: " + activeTemp.toStringVeryShort();
} else {
- basalText = DecimalFormatter.to2Decimal(profile.getBasal()) + "U/h";
+ basalText = MainApp.gs(R.string.pump_basebasalrate, profile.getBasal());
}
- baseBasalView.setOnClickListener(v -> {
- String fullText = MainApp.gs(R.string.pump_basebasalrate_label) + ": " + DecimalFormatter.to2Decimal(profile.getBasal()) + "U/h\n";
- if (activeTemp != null) {
- fullText += MainApp.gs(R.string.pump_tempbasal_label) + ": " + activeTemp.toStringFull();
- }
- OKDialog.show(getActivity(), MainApp.gs(R.string.basal), fullText, null);
- });
-
} else {
if (activeTemp != null) {
- basalText = activeTemp.toStringFull() + " ";
- }
- if (Config.NSCLIENT)
- basalText += "(" + DecimalFormatter.to2Decimal(profile.getBasal()) + " U/h)";
- else if (pump.getPumpDescription().isTempBasalCapable) {
- basalText += "(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + "U/h)";
+ basalText = activeTemp.toStringFull();
+ } else {
+ basalText = MainApp.gs(R.string.pump_basebasalrate, profile.getBasal());
}
}
+ baseBasalView.setText(basalText);
+ baseBasalView.setOnClickListener(v -> {
+ String fullText = MainApp.gs(R.string.pump_basebasalrate_label) + ": " + MainApp.gs(R.string.pump_basebasalrate, profile.getBasal()) + "\n";
+ if (activeTemp != null) {
+ fullText += MainApp.gs(R.string.pump_tempbasal_label) + ": " + activeTemp.toStringFull();
+ }
+ OKDialog.show(getActivity(), MainApp.gs(R.string.basal), fullText);
+ });
+
if (activeTemp != null) {
baseBasalView.setTextColor(MainApp.gc(R.color.basal));
} else {
- baseBasalView.setTextColor(Color.WHITE);
-
+ baseBasalView.setTextColor(MainApp.gc(R.color.defaulttextcolor));
}
- baseBasalView.setText(basalText);
final ExtendedBolus extendedBolus = TreatmentsPlugin.getPlugin().getExtendedBolusFromHistory(System.currentTimeMillis());
String extendedBolusText = "";
if (extendedBolusView != null) { // must not exists in all layouts
- if (shorttextmode) {
- if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) {
- extendedBolusText = DecimalFormatter.to2Decimal(extendedBolus.absoluteRate()) + "U/h";
- }
- } else {
- if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) {
- extendedBolusText = extendedBolus.toString();
- }
- }
+ if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses())
+ extendedBolusText = shorttextmode ? DecimalFormatter.to2Decimal(extendedBolus.absoluteRate()) + "U/h" : extendedBolus.toStringMedium();
extendedBolusView.setText(extendedBolusText);
- if (Config.NSCLIENT) {
- extendedBolusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.extendedbolus), extendedBolus.toString(), null));
- }
- if (extendedBolusText.equals(""))
- extendedBolusView.setVisibility(Config.NSCLIENT ? View.INVISIBLE : View.GONE);
- else
- extendedBolusView.setVisibility(View.VISIBLE);
+ extendedBolusView.setOnClickListener(v -> {
+ if (extendedBolus != null)
+ OKDialog.show(getActivity(), MainApp.gs(R.string.extended_bolus), extendedBolus.toString());
+ });
}
activeProfileView.setText(ProfileFunctions.getInstance().getProfileNameWithDuration());
@@ -1308,7 +1274,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
String iobtext1 = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U\n"
+ MainApp.gs(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + "U\n"
+ MainApp.gs(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + "U\n";
- OKDialog.show(getActivity(), MainApp.gs(R.string.iob), iobtext1, null);
+ OKDialog.show(getActivity(), MainApp.gs(R.string.iob), iobtext1);
});
} else if (MainApp.sResources.getBoolean(R.bool.isTablet)) {
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U ("
@@ -1360,19 +1326,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// pump status from ns
if (pumpDeviceStatusView != null) {
pumpDeviceStatusView.setText(NSDeviceStatus.getInstance().getPumpStatus());
- pumpDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.pump), NSDeviceStatus.getInstance().getExtendedPumpStatus(), null));
+ pumpDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.pump), NSDeviceStatus.getInstance().getExtendedPumpStatus()));
}
// OpenAPS status from ns
if (openapsDeviceStatusView != null) {
openapsDeviceStatusView.setText(NSDeviceStatus.getInstance().getOpenApsStatus());
- openapsDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.openaps), NSDeviceStatus.getInstance().getExtendedOpenApsStatus(), null));
+ openapsDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.openaps), NSDeviceStatus.getInstance().getExtendedOpenApsStatus()));
}
// Uploader status from ns
if (uploaderDeviceStatusView != null) {
uploaderDeviceStatusView.setText(NSDeviceStatus.getInstance().getUploaderStatusSpanned());
- uploaderDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.uploader), NSDeviceStatus.getInstance().getExtendedUploaderStatus(), null));
+ uploaderDeviceStatusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.uploader), NSDeviceStatus.getInstance().getExtendedUploaderStatus()));
}
// Sensitivity
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt
index 96d6396f87..8e4a9581b8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.overview
+import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.events.EventRefreshOverview
@@ -65,14 +66,14 @@ object OverviewPlugin : PluginBase(PluginDescription()
fun determineHighLine(): Double {
var highLineSetting = SP.getDouble(R.string.key_high_mark, bgTargetHigh)
- if (highLineSetting < 1) highLineSetting = 180.0
+ if (highLineSetting < 1) highLineSetting = Constants.HIGHMARK
highLineSetting = Profile.toCurrentUnits(highLineSetting)
return highLineSetting
}
fun determineLowLine(): Double {
var lowLineSetting = SP.getDouble(R.string.key_low_mark, bgTargetLow)
- if (lowLineSetting < 1) lowLineSetting = 76.0
+ if (lowLineSetting < 1) lowLineSetting = Constants.LOWMARK
lowLineSetting = Profile.toCurrentUnits(lowLineSetting)
return lowLineSetting
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatuslightHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatuslightHandler.java
index 15d9f11a2b..557ffd8d73 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatuslightHandler.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatuslightHandler.java
@@ -41,7 +41,7 @@ class StatuslightHandler {
R.string.key_statuslights_bat_warning, 22.0,
batteryView, "BAT", batteryLevel);
} else {
- applyStatuslight("bage", CareportalEvent.PUMPBATTERYCHANGE, batteryView, "BAT", 504, 240);
+ applyStatuslight("bage", CareportalEvent.PUMPBATTERYCHANGE, batteryView, "BAT", 224, 336);
}
}
@@ -116,12 +116,12 @@ class StatuslightHandler {
batteryView, "BAT ", pump.getBatteryLevel());
} else {
handleAge("bage", CareportalEvent.PUMPBATTERYCHANGE, batteryView, "BAT ",
- 336, 240);
+ 224, 336);
}
}
void handleAge(String nsSettingPlugin, String eventName, TextView view, String text,
- int defaultUrgentThreshold, int defaultWarnThreshold) {
+ int defaultWarnThreshold, int defaultUrgentThreshold) {
NSSettingsStatus nsSettings = new NSSettingsStatus().getInstance();
if (view != null) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java
deleted file mode 100644
index 645f6d2b19..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.DialogFragment;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.events.EventPumpStatusChanged;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
-import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-
-public class BolusProgressDialog extends DialogFragment implements View.OnClickListener {
- private static Logger log = LoggerFactory.getLogger(L.UI);
- private CompositeDisposable disposable = new CompositeDisposable();
-
- Button stopButton;
- TextView statusView;
- TextView stopPressedView;
- ProgressBar progressBar;
- BolusProgressHelperActivity helperActivity;
-
- static double amount;
- public static boolean bolusEnded = false;
- public static boolean running = true;
- public static boolean stopPressed = false;
-
- private String state;
- private final static String DEFAULT_STATE = MainApp.gs(R.string.waitingforpump);
-
- public BolusProgressDialog() {
- super();
- }
-
- public void setInsulin(double amount) {
- BolusProgressDialog.amount = amount;
- bolusEnded = false;
- }
-
- public void setHelperActivity(BolusProgressHelperActivity activity) {
- this.helperActivity = activity;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- getDialog().setTitle(String.format(MainApp.gs(R.string.overview_bolusprogress_goingtodeliver), amount));
- View view = inflater.inflate(R.layout.overview_bolusprogress_dialog, container, false);
- stopButton = view.findViewById(R.id.overview_bolusprogress_stop);
- statusView = view.findViewById(R.id.overview_bolusprogress_status);
- stopPressedView = view.findViewById(R.id.overview_bolusprogress_stoppressed);
- progressBar = view.findViewById(R.id.overview_bolusprogress_progressbar);
- stopButton.setOnClickListener(this);
- progressBar.setMax(100);
- state = savedInstanceState != null ? savedInstanceState.getString("state", DEFAULT_STATE) : DEFAULT_STATE;
- statusView.setText(state);
- setCancelable(false);
- stopPressed = false;
- return view;
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (L.isEnabled(L.UI))
- log.debug("onResume");
- if (!ConfigBuilderPlugin.getPlugin().getCommandQueue().bolusInQueue()) {
- bolusEnded = true;
- }
- if (bolusEnded) {
- dismiss();
- } else {
- if (getDialog() != null)
- getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- running = true;
- if (L.isEnabled(L.UI))
- log.debug("onResume running");
- }
- disposable.add(RxBus.INSTANCE
- .toObservable(EventPumpStatusChanged.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> statusView.setText(event.getStatus()), FabricPrivacy::logException)
- );
- disposable.add(RxBus.INSTANCE
- .toObservable(EventDismissBolusProgressIfRunning.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> {
- if (L.isEnabled(L.UI)) log.debug("EventDismissBolusProgressIfRunning");
- if (BolusProgressDialog.running) dismiss();
- }, FabricPrivacy::logException)
- );
- disposable.add(RxBus.INSTANCE
- .toObservable(EventOverviewBolusProgress.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> {
- if (L.isEnabled(L.UI))
- log.debug("Status: " + event.getStatus() + " Percent: " + event.getPercent());
- statusView.setText(event.getStatus());
- progressBar.setProgress(event.getPercent());
- if (event.getPercent() == 100) {
- stopButton.setVisibility(View.INVISIBLE);
- scheduleDismiss();
- }
- state = event.getStatus();
- }, FabricPrivacy::logException)
- );
- }
-
- @Override
- public void dismiss() {
- if (L.isEnabled(L.UI))
- log.debug("dismiss");
- try {
- super.dismiss();
- } catch (IllegalStateException e) {
- // dialog not running yet. onResume will try again. Set bolusEnded to make extra
- // sure onResume will catch this
- bolusEnded = true;
- log.error("Unhandled exception", e);
- }
- if (helperActivity != null) {
- helperActivity.finish();
- }
- }
-
- @Override
- public void onPause() {
- if (L.isEnabled(L.UI))
- log.debug("onPause");
- running = false;
- super.onPause();
- disposable.clear();
- }
-
- @Override
- public void onSaveInstanceState(@NonNull Bundle outState) {
- outState.putString("state", state);
- log.debug("storing state: " + state);
- super.onSaveInstanceState(outState);
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.overview_bolusprogress_stop:
- if (L.isEnabled(L.UI))
- log.debug("Stop bolus delivery button pressed");
- stopPressed = true;
- stopPressedView.setVisibility(View.VISIBLE);
- stopButton.setVisibility(View.INVISIBLE);
- ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelAllBoluses();
- break;
- }
- }
-
- private void scheduleDismiss() {
- if (L.isEnabled(L.UI))
- log.debug("scheduleDismiss");
- Thread t = new Thread(() -> {
- SystemClock.sleep(5000);
- BolusProgressDialog.bolusEnded = true;
- Activity activity = getActivity();
- if (activity != null) {
- activity.runOnUiThread(() -> {
- try {
- if (running) {
- if (L.isEnabled(L.UI))
- log.debug("executing");
- dismiss();
- }
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- });
- }
- });
- t.start();
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java
deleted file mode 100644
index 54f6aa7688..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import android.os.Bundle;
-
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
-
-public class BolusProgressHelperActivity extends NoSplashAppCompatActivity {
- public BolusProgressHelperActivity() {
- super();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
- bolusProgressDialog.setHelperActivity(this);
- bolusProgressDialog.setInsulin(getIntent().getDoubleExtra("insulin", 0d));
- bolusProgressDialog.show(getSupportFragmentManager(), "BolusProgress");
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java
deleted file mode 100644
index 4c5d5b5d80..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-
-import android.content.Context;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.TextView;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SafeParse;
-import info.nightscout.androidaps.utils.XdripCalibrations;
-
-public class CalibrationDialog extends DialogFragment implements View.OnClickListener {
- private static Logger log = LoggerFactory.getLogger(CalibrationDialog.class);
-
- NumberPicker bgNumber;
- TextView unitsView;
-
- Context context;
-
- public CalibrationDialog() {
- // Required empty public constructor
- }
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- this.context = context;
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- this.context = null;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.overview_calibration_dialog, container, false);
-
- getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
- getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
-
- view.findViewById(R.id.ok).setOnClickListener(this);
- view.findViewById(R.id.cancel).setOnClickListener(this);
-
- String units = ProfileFunctions.getSystemUnits();
- Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units);
-
- bgNumber = (NumberPicker) view.findViewById(R.id.overview_calibration_bg);
-
- if (units.equals(Constants.MMOL))
- bgNumber.setParams(bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false, view.findViewById(R.id.ok));
- else
- bgNumber.setParams(bg, 0d, 500d, 1d, new DecimalFormat("0"), false, view.findViewById(R.id.ok));
-
- unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
- unitsView.setText(units);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- return view;
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- final Double bg = SafeParse.stringToDouble(bgNumber.getText());
- XdripCalibrations.confirmAndSendCalibration(bg, context);
- dismiss();
- break;
- case R.id.cancel:
- dismiss();
- break;
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java
deleted file mode 100644
index 36cfd07be9..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java
+++ /dev/null
@@ -1,443 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextWatcher;
-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.CompoundButton;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.RadioButton;
-
-import com.google.common.base.Joiner;
-
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-import java.util.LinkedList;
-import java.util.List;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.db.BgReading;
-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.interfaces.Constraint;
-import info.nightscout.androidaps.plugins.treatments.CarbsGenerator;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.DefaultValueHelper;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SP;
-import info.nightscout.androidaps.utils.ToastUtils;
-
-import static info.nightscout.androidaps.utils.DateUtil.now;
-
-public class NewCarbsDialog extends DialogFragment implements OnClickListener, CompoundButton.OnCheckedChangeListener {
- private static Logger log = LoggerFactory.getLogger(NewCarbsDialog.class);
-
- private static final int FAV1_DEFAULT = 5;
- private static final int FAV2_DEFAULT = 10;
- private static final int FAV3_DEFAULT = 20;
-
- private RadioButton startActivityTTCheckbox;
- private RadioButton startEatingSoonTTCheckbox;
- private RadioButton startHypoTTCheckbox;
- private boolean togglingTT;
-
- private NumberPicker editTime;
- private NumberPicker editDuration;
- private NumberPicker editCarbs;
- private Integer maxCarbs;
-
- private EditText notesEdit;
-
- //one shot guards
- private boolean accepted;
- private boolean okClicked;
-
- public NewCarbsDialog() {
- }
-
- final private TextWatcher textWatcher = new TextWatcher() {
- @Override
- public void afterTextChanged(Editable s) {
- validateInputs();
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- };
-
- private void validateInputs() {
- int time = editTime.getValue().intValue();
- if (time > 12 * 60 || time < -12 * 60) {
- editTime.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.constraintapllied));
- }
- Double duration = editDuration.getValue();
- if (duration > 10) {
- editDuration.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.constraintapllied));
- }
- int carbs = editCarbs.getValue().intValue();
- if (carbs > maxCarbs) {
- editCarbs.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(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);
-
- startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt);
- startActivityTTCheckbox.setOnCheckedChangeListener(this);
- startEatingSoonTTCheckbox = view.findViewById(R.id.newcarbs_eating_soon_tt);
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(this);
- startHypoTTCheckbox = view.findViewById(R.id.newcarbs_hypo_tt);
-
- editTime = view.findViewById(R.id.newcarbs_time);
- editTime.setParams(0d, -12 * 60d, 12 * 60d, 5d, new DecimalFormat("0"), false, view.findViewById(R.id.ok), textWatcher);
-
- editDuration = view.findViewById(R.id.new_carbs_duration);
- editDuration.setParams(0d, 0d, 10d, 1d, new DecimalFormat("0"), false, view.findViewById(R.id.ok), textWatcher);
-
- maxCarbs = MainApp.getConstraintChecker().getMaxCarbsAllowed().value();
-
- editCarbs = view.findViewById(R.id.newcarb_carbsamount);
- editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, view.findViewById(R.id.ok), textWatcher);
-
- Button fav1Button = view.findViewById(R.id.newcarbs_plus1);
- fav1Button.setOnClickListener(this);
- fav1Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)));
-
- Button fav2Button = view.findViewById(R.id.newcarbs_plus2);
- fav2Button.setOnClickListener(this);
- fav2Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)));
-
- Button fav3Button = view.findViewById(R.id.newcarbs_plus3);
- fav3Button.setOnClickListener(this);
- fav3Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)));
-
- LinearLayout notesLayout = view.findViewById(R.id.newcarbs_notes_layout);
- notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
- notesEdit = view.findViewById(R.id.newcarbs_notes);
-
- BgReading bgReading = DatabaseHelper.actualBg();
- if (bgReading != null && bgReading.value < 72) {
- startHypoTTCheckbox.setChecked(true);
- // see #onCheckedChanged why listeners are registered like this
- startHypoTTCheckbox.setOnClickListener(this);
- } else {
- startHypoTTCheckbox.setOnCheckedChangeListener(this);
- }
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
-
- //recovering state if there is something
- if (savedInstanceState != null) {
- editCarbs.setValue(savedInstanceState.getDouble("editCarbs"));
- editTime.setValue(savedInstanceState.getDouble("editTime"));
- editDuration.setValue(savedInstanceState.getDouble("editDuration"));
- }
- return view;
- }
-
- private String toSignedString(int value) {
- return value > 0 ? "+" + value : String.valueOf(value);
- }
-
-
- @Override
- public void onSaveInstanceState(Bundle carbsDialogState) {
- carbsDialogState.putBoolean("startActivityTTCheckbox",startActivityTTCheckbox.isChecked());
- carbsDialogState.putBoolean("startEatingSoonTTCheckbox", startEatingSoonTTCheckbox.isChecked());
- carbsDialogState.putBoolean("startHypoTTCheckbox", startHypoTTCheckbox.isChecked());
- carbsDialogState.putDouble("editTime", editTime.getValue());
- carbsDialogState.putDouble("editDuration", editDuration.getValue());
- carbsDialogState.putDouble("editCarbs", editCarbs.getValue());
- super.onSaveInstanceState(carbsDialogState);
- }
-
-
- @Override
- public synchronized void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- submit();
- break;
- case R.id.cancel:
- dismiss();
- break;
- case R.id.newcarbs_plus1:
- editCarbs.setValue(Math.max(0, editCarbs.getValue()
- + SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)));
- validateInputs();
- break;
- case R.id.newcarbs_plus2:
- editCarbs.setValue(Math.max(0, editCarbs.getValue()
- + SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)));
- validateInputs();
- break;
- case R.id.newcarbs_plus3:
- editCarbs.setValue(Math.max(0, editCarbs.getValue()
- + SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)));
- validateInputs();
- break;
- case R.id.newcarbs_activity_tt:
- if (togglingTT) {
- togglingTT = false;
- break;
- }
- startActivityTTCheckbox.setOnClickListener(null);
- startActivityTTCheckbox.setOnCheckedChangeListener(null);
- startActivityTTCheckbox.setChecked(false);
- startActivityTTCheckbox.setOnCheckedChangeListener(this);
- break;
- case R.id.newcarbs_eating_soon_tt:
- if (togglingTT) {
- togglingTT = false;
- break;
- }
- startEatingSoonTTCheckbox.setOnClickListener(null);
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(null);
- startEatingSoonTTCheckbox.setChecked(false);
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(this);
- break;
- case R.id.newcarbs_hypo_tt:
- if (togglingTT) {
- togglingTT = false;
- break;
- }
- startHypoTTCheckbox.setOnClickListener(null);
- startHypoTTCheckbox.setOnCheckedChangeListener(null);
- startHypoTTCheckbox.setChecked(false);
- startHypoTTCheckbox.setOnCheckedChangeListener(this);
- break;
- }
- }
-
-
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- // Logic to disable a selected radio when pressed: when a checked radio
- // is pressed, no CheckChanged event is triggered, so register a Click event
- // when checking a radio. Since Click events come after CheckChanged events,
- // the Click event is triggered immediately after this. Thus, set togglingTT
- // var to true, so that the first Click event fired after this is ignored.
- // Radios remove themselves from Click events once unchecked.
- // Since radios are not in a group, their state is manually updated here.
- switch (buttonView.getId()) {
- case R.id.newcarbs_activity_tt:
- togglingTT = true;
- startActivityTTCheckbox.setOnClickListener(this);
-
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(null);
- startEatingSoonTTCheckbox.setChecked(false);
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(this);
-
- startHypoTTCheckbox.setOnCheckedChangeListener(null);
- startHypoTTCheckbox.setChecked(false);
- startHypoTTCheckbox.setOnCheckedChangeListener(this);
- break;
- case R.id.newcarbs_eating_soon_tt:
- togglingTT = true;
- startEatingSoonTTCheckbox.setOnClickListener(this);
-
- startActivityTTCheckbox.setOnCheckedChangeListener(null);
- startActivityTTCheckbox.setChecked(false);
- startActivityTTCheckbox.setOnCheckedChangeListener(this);
-
- startHypoTTCheckbox.setOnCheckedChangeListener(null);
- startHypoTTCheckbox.setChecked(false);
- startHypoTTCheckbox.setOnCheckedChangeListener(this);
- break;
- case R.id.newcarbs_hypo_tt:
- togglingTT = true;
- startHypoTTCheckbox.setOnClickListener(this);
-
- startActivityTTCheckbox.setOnCheckedChangeListener(null);
- startActivityTTCheckbox.setChecked(false);
- startActivityTTCheckbox.setOnCheckedChangeListener(this);
-
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(null);
- startEatingSoonTTCheckbox.setChecked(false);
- startEatingSoonTTCheckbox.setOnCheckedChangeListener(this);
- break;
- }
- }
-
- private void submit() {
- if (okClicked) {
- log.debug("guarding: ok already clicked");
- dismiss();
- return;
- }
- okClicked = true;
- try {
- final Profile currentProfile = ProfileFunctions.getInstance().getProfile();
- if (currentProfile == null) {
- return;
- }
-
- int carbs = editCarbs.getValue().intValue();
- Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value();
-
- final String units = ProfileFunctions.getSystemUnits();
- DefaultValueHelper helper = new DefaultValueHelper();
-
- int activityTTDuration = helper.determineActivityTTDuration();
- double activityTT = helper.determineActivityTT();
-
- int eatingSoonTTDuration = helper.determineEatingSoonTTDuration();
- double eatingSoonTT = helper.determineEatingSoonTT();
-
- int hypoTTDuration = helper.determineHypoTTDuration();
- double hypoTT = helper.determineHypoTT();
-
- List actions = new LinkedList<>();
-
- if (startActivityTTCheckbox.isChecked()) {
- String unitLabel = "mg/dl";
- if (units.equals(Constants.MMOL)) {
- unitLabel = "mmol/l";
- }
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + activityTTDuration + " min)");
- }
- if (startEatingSoonTTCheckbox.isChecked()) {
- if (units.equals(Constants.MMOL)) {
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)");
- } else {
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)");
- }
- }
- if (startHypoTTCheckbox.isChecked()) {
- if (units.equals(Constants.MMOL)) {
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(hypoTT) + " mmol/l (" + hypoTTDuration + " min)");
- } else {
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to0Decimal(hypoTT) + " mg/dl (" + hypoTTDuration + " min)");
- }
- }
-
- int timeOffset = editTime.getValue().intValue();
- final long time = now() + timeOffset * 1000 * 60;
- if (timeOffset != 0) {
- actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time));
- }
- int duration = editDuration.getValue().intValue();
- if (duration > 0) {
- actions.add(MainApp.gs(R.string.duration) + ": " + duration + MainApp.gs(R.string.shorthour));
- }
- if (carbs > 0) {
- actions.add(MainApp.gs(R.string.carbs) + ": " + "" + carbsAfterConstraints + "g" + "");
- }
- if (!carbsAfterConstraints.equals(carbs)) {
- actions.add("" + MainApp.gs(R.string.carbsconstraintapplied) + "");
- }
- final String notes = notesEdit.getText().toString();
- if (!notes.isEmpty()) {
- actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes);
- }
-
- final double finalActivityTT = activityTT;
- final int finalActivityTTDuration = activityTTDuration;
- final double finalEatigSoonTT = eatingSoonTT;
- final int finalEatingSoonTTDuration = eatingSoonTTDuration;
- final double finalHypoTT = hypoTT;
- final int finalHypoTTDuration = hypoTTDuration;
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- if (carbsAfterConstraints > 0 || startActivityTTCheckbox.isChecked()
- || startEatingSoonTTCheckbox.isChecked() || startHypoTTCheckbox.isChecked()) {
- builder.setMessage(Html.fromHtml(Joiner.on("
").join(actions)));
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- synchronized (builder) {
- if (accepted) {
- log.debug("guarding: already accepted");
- return;
- }
- accepted = true;
-
- if (startActivityTTCheckbox.isChecked()) {
- TempTarget tempTarget = new TempTarget()
- .date(System.currentTimeMillis())
- .duration(finalActivityTTDuration)
- .reason(MainApp.gs(R.string.activity))
- .source(Source.USER)
- .low(Profile.toMgdl(finalActivityTT, ProfileFunctions.getSystemUnits()))
- .high(Profile.toMgdl(finalActivityTT, ProfileFunctions.getSystemUnits()));
- TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
- } else if (startEatingSoonTTCheckbox.isChecked()) {
- TempTarget tempTarget = new TempTarget()
- .date(System.currentTimeMillis())
- .duration(finalEatingSoonTTDuration)
- .reason(MainApp.gs(R.string.eatingsoon))
- .source(Source.USER)
- .low(Profile.toMgdl(finalEatigSoonTT, ProfileFunctions.getSystemUnits()))
- .high(Profile.toMgdl(finalEatigSoonTT, ProfileFunctions.getSystemUnits()));
- TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
- } else if (startHypoTTCheckbox.isChecked()) {
- TempTarget tempTarget = new TempTarget()
- .date(System.currentTimeMillis())
- .duration(finalHypoTTDuration)
- .reason(MainApp.gs(R.string.hypo))
- .source(Source.USER)
- .low(Profile.toMgdl(finalHypoTT, ProfileFunctions.getSystemUnits()))
- .high(Profile.toMgdl(finalHypoTT, ProfileFunctions.getSystemUnits()));
- TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
- }
-
- if (carbsAfterConstraints > 0) {
- if (duration == 0) {
- CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes);
- } else {
- CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes);
- NSUpload.uploadEvent(CareportalEvent.NOTE, now() - 2000, MainApp.gs(R.string.generated_ecarbs_note, carbsAfterConstraints, duration, timeOffset));
- }
- }
- }
- });
- } else {
- builder.setMessage(MainApp.gs(R.string.no_action_selected));
- }
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- dismiss();
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java
deleted file mode 100644
index b708296776..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java
+++ /dev/null
@@ -1,317 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextWatcher;
-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.LinearLayout;
-
-import com.google.common.base.Joiner;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-import java.util.LinkedList;
-import java.util.List;
-
-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.interfaces.Constraint;
-import info.nightscout.androidaps.interfaces.PumpInterface;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SP;
-import info.nightscout.androidaps.utils.SafeParse;
-import info.nightscout.androidaps.utils.T;
-import info.nightscout.androidaps.utils.ToastUtils;
-
-import static info.nightscout.androidaps.utils.DateUtil.now;
-
-public class NewInsulinDialog extends DialogFragment implements OnClickListener {
- private static Logger log = LoggerFactory.getLogger(NewInsulinDialog.class);
-
- private static final double PLUS1_DEFAULT = 0.5d;
- private static final double PLUS2_DEFAULT = 1d;
- private static final double PLUS3_DEFAULT = 2d;
-
- private CheckBox startEatingSoonTTCheckbox;
- private CheckBox recordOnlyCheckbox;
-
- private LinearLayout editLayout;
- private NumberPicker editTime;
- private NumberPicker editInsulin;
- private Double maxInsulin;
-
- private EditText notesEdit;
-
- //one shot guards
- private boolean accepted;
- private boolean okClicked;
-
- public NewInsulinDialog() {
- }
-
- final private TextWatcher textWatcher = new TextWatcher() {
- @Override
- public void afterTextChanged(Editable s) {
- validateInputs();
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- };
-
- private void validateInputs() {
- int time = editTime.getValue().intValue();
- if (Math.abs(time) > 12 * 60) {
- editTime.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.constraintapllied));
- }
- Double insulin = editInsulin.getValue();
- if (insulin > maxInsulin) {
- editInsulin.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(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);
-
- startEatingSoonTTCheckbox = view.findViewById(R.id.newinsulin_start_eating_soon_tt);
-
- recordOnlyCheckbox = view.findViewById(R.id.newinsulin_record_only);
- recordOnlyCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> editLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE));
-
- editLayout = view.findViewById(R.id.newinsulin_time_layout);
- editLayout.setVisibility(View.GONE);
- editTime = view.findViewById(R.id.newinsulin_time);
- editTime.setParams(0d, -12 * 60d, 12 * 60d, 5d, new DecimalFormat("0"), false, view.findViewById(R.id.ok), textWatcher);
-
- maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
-
- editInsulin = view.findViewById(R.id.newinsulin_amount);
- editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, view.findViewById(R.id.ok), textWatcher);
-
- Button plus1Button = view.findViewById(R.id.newinsulin_plus05);
- plus1Button.setOnClickListener(this);
- plus1Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)));
- Button plus2Button = view.findViewById(R.id.newinsulin_plus10);
- plus2Button.setOnClickListener(this);
- plus2Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)));
- Button plus3Button = view.findViewById(R.id.newinsulin_plus20);
- plus3Button.setOnClickListener(this);
- plus3Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT)));
-
- LinearLayout notesLayout = view.findViewById(R.id.newinsulin_notes_layout);
- notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
- notesEdit = view.findViewById(R.id.newinsulin_notes);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- if (savedInstanceState != null) {
-// log.debug("savedInstanceState in onCreate is:" + savedInstanceState.toString());
- editInsulin.setValue(savedInstanceState.getDouble("editInsulin"));
- editTime.setValue(savedInstanceState.getDouble("editTime"));
- }
- return view;
- }
-
- private String toSignedString(double value) {
- String formatted = DecimalFormatter.toPumpSupportedBolus(value);
- return value > 0 ? "+" + formatted : formatted;
- }
-
- @Override
- public void onSaveInstanceState(Bundle insulinDialogState) {
- insulinDialogState.putBoolean("startEatingSoonTTCheckbox", startEatingSoonTTCheckbox.isChecked());
- insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked());
- insulinDialogState.putDouble("editTime", editTime.getValue());
- insulinDialogState.putDouble("editInsulin", editInsulin.getValue());
- insulinDialogState.putString("notesEdit", notesEdit.getText().toString());
- log.debug("Instance state saved:" + insulinDialogState.toString());
- super.onSaveInstanceState(insulinDialogState);
- }
-
- @Override
- public synchronized void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- submit();
- break;
- case R.id.cancel:
- dismiss();
- break;
- case R.id.newinsulin_plus05:
- editInsulin.setValue(Math.max(0, editInsulin.getValue()
- + SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)));
- validateInputs();
- break;
- case R.id.newinsulin_plus10:
- editInsulin.setValue(Math.max(0, editInsulin.getValue()
- + SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)));
- validateInputs();
- break;
- case R.id.newinsulin_plus20:
- editInsulin.setValue(Math.max(0, 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 {
- final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
- if (pump == null)
- return;
-
- Double insulin = SafeParse.stringToDouble(editInsulin.getText());
- Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value();
-
- List actions = new LinkedList<>();
- if (insulin > 0) {
- actions.add(MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + "U" + "");
- if (recordOnlyCheckbox.isChecked()) {
- actions.add("" + MainApp.gs(R.string.bolusrecordedonly) + "");
- }
- }
-
- if (Math.abs(insulinAfterConstraints - insulin) > pump.getPumpDescription().pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
- actions.add(MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints));
-
- int eatingSoonTTDuration = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration);
- eatingSoonTTDuration = eatingSoonTTDuration > 0 ? eatingSoonTTDuration : Constants.defaultEatingSoonTTDuration;
- double eatingSoonTT = SP.getDouble(R.string.key_eatingsoon_target, ProfileFunctions.getSystemUnits().equals(Constants.MMOL) ? Constants.defaultEatingSoonTTmmol : Constants.defaultEatingSoonTTmgdl);
- eatingSoonTT = eatingSoonTT > 0 ? eatingSoonTT : ProfileFunctions.getSystemUnits().equals(Constants.MMOL) ? Constants.defaultEatingSoonTTmmol : Constants.defaultEatingSoonTTmgdl;
-
- if (startEatingSoonTTCheckbox.isChecked()) {
- if (ProfileFunctions.getSystemUnits().equals(Constants.MMOL)) {
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)");
- } else
- actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)");
- }
-
- int timeOffset = editTime.getValue().intValue();
- final long time = now() + T.mins(timeOffset).msecs();
- if (timeOffset != 0) {
- actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time));
- }
- final String notes = notesEdit.getText().toString();
- if (!notes.isEmpty()) {
- actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes);
- }
-
- final double finalInsulinAfterConstraints = insulinAfterConstraints;
- final double finalEatigSoonTT = eatingSoonTT;
- final int finalEatingSoonTTDuration = eatingSoonTTDuration;
-
- final Context context = getContext();
- final AlertDialog.Builder builder = new AlertDialog.Builder(context);
-
- builder.setTitle(MainApp.gs(R.string.confirmation));
- if (finalInsulinAfterConstraints > 0 || startEatingSoonTTCheckbox.isChecked()) {
- builder.setMessage(Html.fromHtml(Joiner.on("
").join(actions)));
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- synchronized (builder) {
- if (accepted) {
- log.debug("guarding: already accepted");
- return;
- }
- accepted = true;
-
- if (startEatingSoonTTCheckbox.isChecked()) {
- TempTarget tempTarget = new TempTarget()
- .date(System.currentTimeMillis())
- .duration(finalEatingSoonTTDuration)
- .reason(MainApp.gs(R.string.eatingsoon))
- .source(Source.USER)
- .low(Profile.toMgdl(finalEatigSoonTT, ProfileFunctions.getSystemUnits()))
- .high(Profile.toMgdl(finalEatigSoonTT, ProfileFunctions.getSystemUnits()));
- TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
- }
-
- if (finalInsulinAfterConstraints > 0) {
- DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
- detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
- detailedBolusInfo.insulin = finalInsulinAfterConstraints;
- detailedBolusInfo.context = context;
- detailedBolusInfo.source = Source.USER;
- detailedBolusInfo.notes = notes;
- if (recordOnlyCheckbox.isChecked()) {
- detailedBolusInfo.date = time;
- TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
- } else {
- detailedBolusInfo.date = now();
- ConfigBuilderPlugin.getPlugin().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.gs(R.string.treatmentdeliveryerror));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
- }
- }
- });
- }
- }
- }
- });
- } else {
- builder.setMessage(MainApp.gs(R.string.no_action_selected));
- }
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- dismiss();
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java
deleted file mode 100644
index 9f2f42b2d9..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.dialogs;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextWatcher;
-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.CheckBox;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-import java.util.Objects;
-
-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.interfaces.Constraint;
-import info.nightscout.androidaps.interfaces.PumpInterface;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.NumberPicker;
-import info.nightscout.androidaps.utils.SafeParse;
-import info.nightscout.androidaps.utils.ToastUtils;
-
-public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
- private static Logger log = LoggerFactory.getLogger(NewTreatmentDialog.class);
-
- private NumberPicker editCarbs;
- private NumberPicker editInsulin;
-
- private Integer maxCarbs;
- private Double maxInsulin;
-
- //one shot guards
- private boolean accepted;
- private boolean okClicked;
-
- private CheckBox recordOnlyCheckbox;
-
- public NewTreatmentDialog() {
- }
-
- 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(), MainApp.gs(R.string.carbsconstraintapplied));
- }
- Double insulin = SafeParse.stringToDouble(editInsulin.getText());
- if (insulin > maxInsulin) {
- editInsulin.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.bolusconstraintapplied));
- }
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.overview_newtreatment_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.getConstraintChecker().getMaxCarbsAllowed().value();
- maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
-
- editCarbs = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_carbsamount);
- editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
-
- editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, view.findViewById(R.id.ok), textWatcher);
- editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, view.findViewById(R.id.ok), textWatcher);
-
- recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only);
-
- setCancelable(true);
- getDialog().setCanceledOnTouchOutside(false);
- return view;
- }
-
- @Override
- public synchronized void onClick(View view) {
- switch (view.getId()) {
- case R.id.ok:
- if (okClicked) {
- log.debug("guarding: ok already clicked");
- dismiss();
- return;
- }
- okClicked = true;
-
- try {
- final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
-
- if (pump == null)
- return;
-
- Double insulin = SafeParse.stringToDouble(editInsulin.getText());
- final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
-
- String confirmMessage = MainApp.gs(R.string.entertreatmentquestion) + "
";
-
- Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value();
- Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value();
-
- if (insulin > 0) {
- confirmMessage += MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + "U" + "";
- if (recordOnlyCheckbox.isChecked()) {
- confirmMessage += "
" + MainApp.gs(R.string.bolusrecordedonly) + "";
- }
- if (Math.abs(insulinAfterConstraints - insulin) > pump.getPumpDescription().pumpType.determineCorrectBolusStepSize(insulinAfterConstraints) || !Objects.equals(carbsAfterConstraints, carbs))
- confirmMessage += "
" + MainApp.gs(R.string.bolusconstraintappliedwarning, MainApp.gc(R.color.warning), insulin, insulinAfterConstraints);
- }
- if (carbsAfterConstraints > 0)
- confirmMessage += "
" + MainApp.gs(R.string.carbs) + ": " + "" + carbsAfterConstraints + "g" + "";
-
-
- final double finalInsulinAfterConstraints = insulinAfterConstraints;
- final int finalCarbsAfterConstraints = carbsAfterConstraints;
-
- final Context context = getContext();
- final AlertDialog.Builder builder = new AlertDialog.Builder(context);
-
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(Html.fromHtml(confirmMessage));
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- synchronized (builder) {
- if (accepted) {
- log.debug("guarding: already accepted");
- return;
- }
- accepted = true;
- if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
- DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
- if (finalInsulinAfterConstraints == 0)
- detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
- if (finalCarbsAfterConstraints == 0)
- detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
- detailedBolusInfo.insulin = finalInsulinAfterConstraints;
- detailedBolusInfo.carbs = finalCarbsAfterConstraints;
- detailedBolusInfo.context = context;
- detailedBolusInfo.source = Source.USER;
- if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo))) {
- ConfigBuilderPlugin.getPlugin().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.gs(R.string.treatmentdeliveryerror));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
- }
- }
- });
- } else {
- TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
- }
- }
- }
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
-
- dismiss();
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- break;
- case R.id.cancel:
- dismiss();
- break;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.java
index a3dc3c4212..dec943365c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.java
@@ -371,7 +371,8 @@ public class GraphData {
actArrayHist.add(new ScaledDataPoint(time, act, actScale));
else
actArrayPred.add(new ScaledDataPoint(time, act, actScale));
- if (act > maxIAValue) maxIAValue = act;
+
+ maxIAValue = Math.max(maxIAValue, Math.abs(act));
}
ScaledDataPoint[] actData = new ScaledDataPoint[actArrayHist.size()];
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java
index 1e96b02be1..8d1664c7e4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java
@@ -21,7 +21,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.general.nsclient.broadcasts.BroadcastAckAlarm;
+import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.utils.DateUtil;
@@ -93,7 +93,7 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter
@@ -222,7 +229,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
else sendSMS(Sms(receivedSms.phoneNumber, R.string.wrongformat))
"BOLUS" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, R.string.smscommunicator_remotecommandnotallowed))
- else if (splitted.size == 2 && DateUtil.now() - lastRemoteBolusTime < Constants.remoteBolusMinDistance) sendSMS(Sms(receivedSms.phoneNumber, R.string.smscommunicator_remotebolusnotallowed))
+ else if (splitted.size == 2 && DateUtil.now() - lastRemoteBolusTime < minDistance) sendSMS(Sms(receivedSms.phoneNumber, R.string.smscommunicator_remotebolusnotallowed))
else if (splitted.size == 2 && pump.isSuspended) sendSMS(Sms(receivedSms.phoneNumber, R.string.pumpsuspended))
else if (splitted.size == 2 || splitted.size == 3) processBOLUS(splitted, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, R.string.wrongformat))
@@ -459,7 +466,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
val finalPercentage = percentage
messageToConfirm = AuthRequest(this, receivedSms, reply, passCode, object : SmsAction(list[pindex - 1] as String, finalPercentage) {
override fun run() {
- ProfileFunctions.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0)
+ ProfileFunctions.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
sendSMS(Sms(receivedSms.phoneNumber, R.string.profileswitchcreated))
}
})
@@ -597,6 +604,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
override fun run() {
if (result.success) {
var replyText = String.format(MainApp.gs(R.string.smscommunicator_extendedset), aDouble, duration)
+ if (Config.APS) replyText += "\n" + MainApp.gs(R.string.loopsuspended)
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
} else {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
index 7ab263b8d7..5a65206f83 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/TidepoolUploader.kt
@@ -116,13 +116,13 @@ object TidepoolUploader {
val call = session.service?.getLogin(it)
call?.enqueue(TidepoolCallback(session, "Login", {
- OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Successfully logged into Tidepool.", null)
+ OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Successfully logged into Tidepool.")
}, {
- OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Failed to log into Tidepool.\nCheck that your user name and password are correct.", null)
+ OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Failed to log into Tidepool.\nCheck that your user name and password are correct.")
}))
}
- ?: OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Cannot do login as user credentials have not been set correctly", null)
+ ?: OKDialog.show(rootContext, MainApp.gs(R.string.tidepool), "Cannot do login as user credentials have not been set correctly")
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
index 57a1bba9ed..9fe87856b7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
@@ -237,11 +237,11 @@ public class IobCobOref1Thread extends Thread {
}
}
- List recentTreatments = TreatmentsPlugin.getPlugin().getTreatments5MinBackFromHistory(bgTime);
- for (int ir = 0; ir < recentTreatments.size(); ir++) {
- autosensData.carbsFromBolus += recentTreatments.get(ir).carbs;
- autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentTreatments.get(ir)));
- autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentTreatments.get(ir).carbs) + "g]";
+ List recentCarbTreatments = TreatmentsPlugin.getPlugin().getCarbTreatments5MinBackFromHistory(bgTime);
+ for (Treatment recentCarbTreatment : recentCarbTreatments) {
+ autosensData.carbsFromBolus += recentCarbTreatment.carbs;
+ autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentCarbTreatment));
+ autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.carbs) + "g]";
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
index fba1555d4c..7389e39b8d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
@@ -236,11 +236,11 @@ public class IobCobThread extends Thread {
}
}
- List recentTreatments = TreatmentsPlugin.getPlugin().getTreatments5MinBackFromHistory(bgTime);
- for (int ir = 0; ir < recentTreatments.size(); ir++) {
- autosensData.carbsFromBolus += recentTreatments.get(ir).carbs;
- autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentTreatments.get(ir)));
- autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentTreatments.get(ir).carbs) + "g]";
+ List recentCarbTreatments = TreatmentsPlugin.getPlugin().getCarbTreatments5MinBackFromHistory(bgTime);
+ for (Treatment recentCarbTreatment : recentCarbTreatments) {
+ autosensData.carbsFromBolus += recentCarbTreatment.carbs;
+ autosensData.activeCarbsList.add(new AutosensData.CarbsInPast(recentCarbTreatment));
+ autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.carbs) + "g]";
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
index 3b6dbe7315..4478c025d4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.profile.local
-
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
@@ -14,10 +13,9 @@ import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment
-import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.MIN_DIA
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.*
@@ -94,20 +92,21 @@ class LocalProfileFragment : Fragment() {
localprofile_name.setText(LocalProfilePlugin.currentProfile().name)
localprofile_name.addTextChangedListener(textWatch)
localprofile_dia.setParams(LocalProfilePlugin.currentProfile().dia, HardLimits.MINDIA, HardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
- TimeListEdit(context, view, R.id.localprofile_ic, MainApp.gs(R.string.nsprofileview_ic_label), LocalProfilePlugin.currentProfile().ic, null, HardLimits.MINIC, HardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
- basalView = TimeListEdit(context, view, R.id.localprofile_basal, MainApp.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), LocalProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
+ localprofile_dia.setTag("LP_DIA")
+ TimeListEdit(context, view, R.id.localprofile_ic, "IC", MainApp.gs(R.string.nsprofileview_ic_label), LocalProfilePlugin.currentProfile().ic, null, HardLimits.MINIC, HardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
+ basalView = TimeListEdit(context, view, R.id.localprofile_basal, "BASAL", MainApp.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), LocalProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) {
- TimeListEdit(context, view, R.id.localprofile_isf, MainApp.gs(R.string.nsprofileview_isf_label), LocalProfilePlugin.currentProfile().isf, null, HardLimits.MINISF, HardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
- TimeListEdit(context, view, R.id.localprofile_target, MainApp.gs(R.string.nsprofileview_target_label), LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
+ TimeListEdit(context, view, R.id.localprofile_isf, "ISF", MainApp.gs(R.string.nsprofileview_isf_label), LocalProfilePlugin.currentProfile().isf, null, HardLimits.MINISF, HardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
+ TimeListEdit(context, view, R.id.localprofile_target, "TARGET", MainApp.gs(R.string.nsprofileview_target_label), LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
} else {
- TimeListEdit(context, view, R.id.localprofile_isf, MainApp.gs(R.string.nsprofileview_isf_label), LocalProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(HardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
- TimeListEdit(context, view, R.id.localprofile_target, MainApp.gs(R.string.nsprofileview_target_label), LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
+ TimeListEdit(context, view, R.id.localprofile_isf, "ISF", MainApp.gs(R.string.nsprofileview_isf_label), LocalProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(HardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
+ TimeListEdit(context, view, R.id.localprofile_target, "TARGET", MainApp.gs(R.string.nsprofileview_target_label), LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
}
// Spinner
spinner = SpinnerHelper(view?.findViewById(R.id.localprofile_spinner))
val profileList: ArrayList = LocalProfilePlugin.profile?.getProfileList()
- ?: ArrayList()
+ ?: ArrayList()
context?.let { context ->
val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
spinner?.adapter = adapter
@@ -120,10 +119,10 @@ class LocalProfileFragment : Fragment() {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (LocalProfilePlugin.isEdited) {
activity?.let { activity ->
- OKDialog.showConfirmation(activity, MainApp.gs(R.string.doyouwantswitchprofile), {
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.doyouwantswitchprofile), Runnable {
LocalProfilePlugin.currentProfileIndex = position
build()
- }, {
+ }, Runnable {
spinner?.setSelection(LocalProfilePlugin.currentProfileIndex)
})
}
@@ -136,7 +135,7 @@ class LocalProfileFragment : Fragment() {
localprofile_profile_add.setOnClickListener {
if (LocalProfilePlugin.isEdited) {
- activity?.let { OKDialog.show(it, "", MainApp.gs(R.string.saveorresetchangesfirst), null) }
+ activity?.let { OKDialog.show(it, "", MainApp.gs(R.string.saveorresetchangesfirst)) }
} else {
LocalProfilePlugin.addNewProfile()
build()
@@ -145,7 +144,7 @@ class LocalProfileFragment : Fragment() {
localprofile_profile_clone.setOnClickListener {
if (LocalProfilePlugin.isEdited) {
- activity?.let { OKDialog.show(it, "", MainApp.gs(R.string.saveorresetchangesfirst), null) }
+ activity?.let { OKDialog.show(it, "", MainApp.gs(R.string.saveorresetchangesfirst)) }
} else {
LocalProfilePlugin.cloneProfile()
build()
@@ -154,7 +153,7 @@ class LocalProfileFragment : Fragment() {
localprofile_profile_remove.setOnClickListener {
activity?.let { activity ->
- OKDialog.showConfirmation(activity, MainApp.gs(R.string.deletecurrentprofile), {
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.deletecurrentprofile), Runnable {
LocalProfilePlugin.removeCurrentProfile()
build()
}, null)
@@ -169,11 +168,7 @@ class LocalProfileFragment : Fragment() {
localprofile_profileswitch.setOnClickListener {
// TODO: select in dialog LocalProfilePlugin.currentProfileIndex
- val newDialog = NewNSTreatmentDialog()
- val profileSwitch = CareportalFragment.PROFILESWITCHDIRECT
- profileSwitch.executeProfileSwitch = true
- newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch)
- fragmentManager?.let { newDialog.show(it, "NewNSTreatmentDialog") }
+ fragmentManager?.let { ProfileSwitchDialog().show(it, "NewNSTreatmentDialog") }
}
localprofile_reset.setOnClickListener {
@@ -181,10 +176,11 @@ class LocalProfileFragment : Fragment() {
@Suppress("SETTEXTL18N")
localprofile_units.text = MainApp.gs(R.string.units_colon) + " " + (if (LocalProfilePlugin.currentProfile().mgdl) MainApp.gs(R.string.mgdl) else MainApp.gs(R.string.mmol))
localprofile_dia.setParams(LocalProfilePlugin.currentProfile().dia, MIN_DIA, 12.0, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
- TimeListEdit(context, view, R.id.localprofile_ic, MainApp.gs(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save)
- TimeListEdit(context, view, R.id.localprofile_isf, MainApp.gs(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save)
- basalView = TimeListEdit(context, view, R.id.localprofile_basal, MainApp.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), LocalProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
- TimeListEdit(context, view, R.id.localprofile_target, MainApp.gs(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save)
+ localprofile_dia.setTag("LP_DIA")
+ TimeListEdit(context, view, R.id.localprofile_ic, "IC", MainApp.gs(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save)
+ TimeListEdit(context, view, R.id.localprofile_isf, "ISF", MainApp.gs(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save)
+ basalView = TimeListEdit(context, view, R.id.localprofile_basal, "BASAL", MainApp.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), LocalProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
+ TimeListEdit(context, view, R.id.localprofile_target, "TARGET", MainApp.gs(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.currentProfile().targetLow, LocalProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save)
updateGUI()
}
@@ -202,9 +198,9 @@ class LocalProfileFragment : Fragment() {
override fun onResume() {
super.onResume()
disposable.add(RxBus
- .toObservable(EventLocalProfileChanged::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ build() }, { FabricPrivacy.logException(it) })
+ .toObservable(EventLocalProfileChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ build() }, { FabricPrivacy.logException(it) })
)
build()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
index e2c8d051ac..a3e3819b51 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt
@@ -27,11 +27,11 @@ import java.util.*
import kotlin.collections.ArrayList
object LocalProfilePlugin : PluginBase(PluginDescription()
- .mainType(PluginType.PROFILE)
- .fragmentClass(LocalProfileFragment::class.java.name)
- .pluginName(R.string.localprofile)
- .shortName(R.string.localprofile_shortname)
- .description(R.string.description_profile_local)), ProfileInterface {
+ .mainType(PluginType.PROFILE)
+ .fragmentClass(LocalProfileFragment::class.java.name)
+ .pluginName(R.string.localprofile)
+ .shortName(R.string.localprofile_shortname)
+ .description(R.string.description_profile_local)), ProfileInterface {
override fun onStart() {
super.onStart()
@@ -98,7 +98,7 @@ object LocalProfilePlugin : PluginBase(PluginDescription()
@Synchronized
fun isValidEditState(): Boolean {
return createProfileStore().getDefaultProfile()?.isValid(MainApp.gs(R.string.localprofile), false)
- ?: false
+ ?: false
}
@Synchronized
@@ -132,7 +132,7 @@ object LocalProfilePlugin : PluginBase(PluginDescription()
rawProfile?.let { NSUpload.uploadProfileStore(it.data) }
else
activity?.let {
- OKDialog.show(it,"", MainApp.gs(R.string.profilenamecontainsdot), null)
+ OKDialog.show(it, "", MainApp.gs(R.string.profilenamecontainsdot))
}
}
@@ -423,7 +423,7 @@ object LocalProfilePlugin : PluginBase(PluginDescription()
override fun getProfileName(): String {
return DecimalFormatter.to2Decimal(rawProfile?.getDefaultProfile()?.percentageBasalSum()
- ?: 0.0) + "U "
+ ?: 0.0) + "U "
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
index 7b377c9078..6c111faf3f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
@@ -12,6 +12,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
import info.nightscout.androidaps.plugins.profile.ns.events.EventNSProfileUpdateGUI
+import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.OKDialog
@@ -21,7 +22,6 @@ import kotlinx.android.synthetic.main.close.*
import kotlinx.android.synthetic.main.nsprofile_fragment.*
import kotlinx.android.synthetic.main.profileviewer_fragment.*
-
class NSProfileFragment : Fragment() {
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -39,10 +39,11 @@ class NSProfileFragment : Fragment() {
val name = nsprofile_spinner.selectedItem?.toString() ?: ""
NSProfilePlugin.getPlugin().profile?.let { store ->
store.getSpecificProfile(name)?.let {
- OKDialog.showConfirmation(activity,
- MainApp.gs(R.string.activate_profile) + ": " + name + " ?"
- ) {
- ProfileFunctions.doProfileSwitch(store, name, 0, 100, 0)
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.nsprofile),
+ MainApp.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
+ ProfileFunctions.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
+ })
}
}
}
@@ -96,13 +97,9 @@ class NSProfileFragment : Fragment() {
override fun onResume() {
super.onResume()
disposable.add(RxBus
- .toObservable(EventNSProfileUpdateGUI::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- updateGUI()
- }, {
- FabricPrivacy.logException(it)
- })
+ .toObservable(EventNSProfileUpdateGUI::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
)
updateGUI()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java
index 98682679a7..065f0ec4d6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.common.utils;
import android.app.Activity;
-import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.location.LocationManager;
-import android.os.Build;
+import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.utils.OKDialog;
/**
* Helper for checking if location services are enabled on the device.
@@ -45,18 +44,9 @@ public class LocationHelper {
}
// Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533
-
- AlertDialog.Builder builder = new AlertDialog.Builder(parent);
- builder.setTitle(R.string.location_not_found_title);
- builder.setMessage(R.string.location_not_found_message);
- builder.setPositiveButton(R.string.location_yes, new DialogInterface.OnClickListener() {
-
- public void onClick(DialogInterface dialogInterface, int i) {
- parent.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
- }
+ OKDialog.showConfirmation(parent, MainApp.gs(R.string.location_not_found_title), MainApp.gs(R.string.location_not_found_message), () -> {
+ parent.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
});
- builder.setNegativeButton(R.string.location_no, null);
- builder.create().show();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java
index d8b2873a50..57dadbdc55 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.danaR;
-import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import org.json.JSONException;
@@ -15,7 +14,6 @@ import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
@@ -25,7 +23,6 @@ import info.nightscout.androidaps.interfaces.DanaRInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -49,7 +46,7 @@ import info.nightscout.androidaps.utils.SP;
* Created by mike on 28.01.2018.
*/
-public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface, ProfileInterface {
+public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface {
protected Logger log = LoggerFactory.getLogger(L.PUMP);
protected AbstractDanaRExecutionService sExecutionService;
@@ -143,7 +140,6 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
for (int h = 0; h < basalValues; h++) {
Double pumpValue = pump.pumpProfiles[pump.activeProfile][h];
Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement);
- if (profileValue == null) return true;
if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) {
if (L.isEnabled(L.PUMP))
log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);
@@ -436,19 +432,6 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
return applyBolusConstraints(insulin);
}
- @Nullable
- @Override
- public ProfileStore getProfile() {
- if (DanaRPump.getInstance().lastSettingsRead == 0)
- return null; // no info now
- return DanaRPump.getInstance().createConvertedProfile();
- }
-
- @Override
- public String getProfileName() {
- return DanaRPump.getInstance().createConvertedProfileName();
- }
-
@Override
public PumpEnactResult loadTDDs() {
return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.kt
index 3f58acf4d2..af1e80602e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.danaR
-
import android.content.Intent
import android.os.Bundle
import android.os.Handler
@@ -11,6 +10,7 @@ import androidx.fragment.app.Fragment
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.TDDStatsActivity
+import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventExtendedBolusChange
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.events.EventTempBasalChange
@@ -24,9 +24,12 @@ import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRUserOptions
import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRNewStatus
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
-import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog
import info.nightscout.androidaps.queue.events.EventQueueChanged
-import info.nightscout.androidaps.utils.*
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.SetWarnColor
+import info.nightscout.androidaps.utils.T
+import info.nightscout.androidaps.utils.plusAssign
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.danar_fragment.*
@@ -59,9 +62,16 @@ class DanaRFragment : Fragment() {
danar_history.setOnClickListener { startActivity(Intent(context, DanaRHistoryActivity::class.java)) }
danar_viewprofile.setOnClickListener {
fragmentManager?.let { fragmentManager ->
+ val profile = DanaRPump.getInstance().createConvertedProfile()?.getDefaultProfile()
+ ?: return@let
+ val profileName = DanaRPump.getInstance().createConvertedProfile()?.getDefaultProfileName()
+ ?: return@let
val args = Bundle()
args.putLong("time", DateUtil.now())
- args.putInt("mode", ProfileViewerDialog.Mode.PUMP_PROFILE.ordinal)
+ args.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal)
+ args.putString("customProfile", profile.data.toString())
+ args.putString("customProfileUnits", profile.units)
+ args.putString("customProfileName", profileName)
val pvd = ProfileViewerDialog()
pvd.arguments = args
pvd.show(fragmentManager, "ProfileViewDialog")
@@ -82,37 +92,37 @@ class DanaRFragment : Fragment() {
super.onResume()
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
disposable += RxBus
- .toObservable(EventDanaRNewStatus::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
+ .toObservable(EventDanaRNewStatus::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
disposable += RxBus
- .toObservable(EventExtendedBolusChange::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
+ .toObservable(EventExtendedBolusChange::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
disposable += RxBus
- .toObservable(EventTempBasalChange::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
+ .toObservable(EventTempBasalChange::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
disposable += RxBus
- .toObservable(EventQueueChanged::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
+ .toObservable(EventQueueChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
disposable += RxBus
- .toObservable(EventPumpStatusChanged::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({
- when {
- it.sStatus == EventPumpStatusChanged.Status.CONNECTING -> danar_btconnection?.text = "{fa-bluetooth-b spin} " + it.sSecondsElapsed + "s"
- it.sStatus == EventPumpStatusChanged.Status.CONNECTED -> danar_btconnection?.text = "{fa-bluetooth}"
- it.sStatus == EventPumpStatusChanged.Status.DISCONNECTED -> danar_btconnection?.text = "{fa-bluetooth-b}"
- }
- if (it.getStatus() != "") {
- dana_pumpstatus?.text = it.getStatus()
- dana_pumpstatuslayout?.visibility = View.VISIBLE
- } else {
- dana_pumpstatuslayout?.visibility = View.GONE
- }
- }, { FabricPrivacy.logException(it) })
+ .toObservable(EventPumpStatusChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ when {
+ it.sStatus == EventPumpStatusChanged.Status.CONNECTING -> danar_btconnection?.text = "{fa-bluetooth-b spin} " + it.sSecondsElapsed + "s"
+ it.sStatus == EventPumpStatusChanged.Status.CONNECTED -> danar_btconnection?.text = "{fa-bluetooth}"
+ it.sStatus == EventPumpStatusChanged.Status.DISCONNECTED -> danar_btconnection?.text = "{fa-bluetooth-b}"
+ }
+ if (it.getStatus() != "") {
+ dana_pumpstatus?.text = it.getStatus()
+ dana_pumpstatuslayout?.visibility = View.VISIBLE
+ } else {
+ dana_pumpstatuslayout?.visibility = View.GONE
+ }
+ }, { FabricPrivacy.logException(it) })
updateGUI()
}
@@ -151,14 +161,14 @@ class DanaRFragment : Fragment() {
// DanaRPlugin, DanaRKoreanPlugin
if (ConfigBuilderPlugin.getPlugin().activePump!!.isFakingTempsByExtendedBoluses) {
danar_tempbasal.text = TreatmentsPlugin.getPlugin()
- .getRealTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
+ .getRealTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
} else {
// v2 plugin
danar_tempbasal.text = TreatmentsPlugin.getPlugin()
- .getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
+ .getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
}
danar_extendedbolus.text = TreatmentsPlugin.getPlugin()
- .getExtendedBolusFromHistory(System.currentTimeMillis())?.toString() ?: ""
+ .getExtendedBolusFromHistory(System.currentTimeMillis())?.toString() ?: ""
danar_reservoir.text = MainApp.gs(R.string.reservoirvalue, pump.reservoirRemainingUnits, 300)
SetWarnColor.setColorInverse(danar_reservoir, pump.reservoirRemainingUnits, 50.0, 20.0)
danar_battery.text = "{fa-battery-" + pump.batteryRemaining / 25 + "}"
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java
deleted file mode 100644
index 97f029bd8c..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java
+++ /dev/null
@@ -1,327 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.activities;
-
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.cardview.widget.CardView;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.db.DanaRHistoryRecord;
-import info.nightscout.androidaps.events.EventPumpStatusChanged;
-import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
-import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRSyncStatus;
-import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
-import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-
-public class DanaRHistoryActivity extends NoSplashAppCompatActivity {
- private static Logger log = LoggerFactory.getLogger(L.PUMP);
- private CompositeDisposable disposable = new CompositeDisposable();
-
- Spinner historyTypeSpinner;
- TextView statusView;
- Button reloadButton;
- RecyclerView recyclerView;
- LinearLayoutManager llm;
-
- static byte showingType = RecordTypes.RECORD_TYPE_ALARM;
- List historyList = new ArrayList<>();
-
- public static class TypeList {
- public byte type;
- String name;
-
- TypeList(byte type, String name) {
- this.type = type;
- this.name = name;
- }
-
- @NonNull
- @Override
- public String toString() {
- return name;
- }
- }
-
- public DanaRHistoryActivity() {
- super();
- }
-
-
- @Override
- protected void onResume() {
- super.onResume();
- disposable.add(RxBus.INSTANCE
- .toObservable(EventPumpStatusChanged.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> statusView.setText(event.getStatus()), FabricPrivacy::logException)
- );
- disposable.add(RxBus.INSTANCE
- .toObservable(EventDanaRSyncStatus.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> {
- if (L.isEnabled(L.PUMP))
- log.debug("EventDanaRSyncStatus: " + event.getMessage());
- statusView.setText(event.getMessage());
- }, FabricPrivacy::logException)
- );
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- disposable.clear();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.danar_historyactivity);
-
- historyTypeSpinner = findViewById(R.id.danar_historytype);
- statusView = findViewById(R.id.danar_historystatus);
- reloadButton = findViewById(R.id.danar_historyreload);
- recyclerView = findViewById(R.id.danar_history_recyclerview);
-
- recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(this);
- recyclerView.setLayoutManager(llm);
-
- RecyclerViewAdapter adapter = new RecyclerViewAdapter(historyList);
- recyclerView.setAdapter(adapter);
-
- statusView.setVisibility(View.GONE);
-
- boolean isKorean = DanaRKoreanPlugin.getPlugin().isEnabled(PluginType.PUMP);
- boolean isRS = DanaRSPlugin.getPlugin().isEnabled(PluginType.PUMP);
-
- // Types
-
- ArrayList typeList = new ArrayList<>();
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ALARM, MainApp.gs(R.string.danar_history_alarm)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, MainApp.gs(R.string.danar_history_basalhours)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_BOLUS, MainApp.gs(R.string.danar_history_bolus)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_CARBO, MainApp.gs(R.string.danar_history_carbohydrates)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_DAILY, MainApp.gs(R.string.danar_history_dailyinsulin)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, MainApp.gs(R.string.danar_history_glucose)));
- if (!isKorean && !isRS) {
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_ERROR, MainApp.gs(R.string.danar_history_errors)));
- }
- if (isRS)
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_PRIME, MainApp.gs(R.string.danar_history_prime)));
- if (!isKorean) {
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_REFILL, MainApp.gs(R.string.danar_history_refill)));
- typeList.add(new TypeList(RecordTypes.RECORD_TYPE_SUSPEND, MainApp.gs(R.string.danar_history_syspend)));
- }
- ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this,
- R.layout.spinner_centered, typeList);
- historyTypeSpinner.setAdapter(spinnerAdapter);
-
- reloadButton.setOnClickListener(v -> {
- final TypeList selected = (TypeList) historyTypeSpinner.getSelectedItem();
- runOnUiThread(() -> {
- reloadButton.setVisibility(View.GONE);
- statusView.setVisibility(View.VISIBLE);
- });
- clearCardView();
- ConfigBuilderPlugin.getPlugin().getCommandQueue().loadHistory(selected.type, new Callback() {
- @Override
- public void run() {
- loadDataFromDB(selected.type);
- runOnUiThread(() -> {
- reloadButton.setVisibility(View.VISIBLE);
- statusView.setVisibility(View.GONE);
- });
- }
- });
- });
-
- historyTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- TypeList selected = (TypeList) historyTypeSpinner.getSelectedItem();
- loadDataFromDB(selected.type);
- showingType = selected.type;
- }
-
- @Override
- public void onNothingSelected(AdapterView> parent) {
- clearCardView();
- }
- });
- }
-
- public static class RecyclerViewAdapter extends RecyclerView.Adapter {
-
- List historyList;
-
- RecyclerViewAdapter(List historyList) {
- this.historyList = historyList;
- }
-
- @NonNull
- @Override
- public HistoryViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
- View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.danar_history_item, viewGroup, false);
- return new HistoryViewHolder(v);
- }
-
- @Override
- public void onBindViewHolder(@NonNull HistoryViewHolder holder, int position) {
- DanaRHistoryRecord record = historyList.get(position);
- holder.time.setText(DateUtil.dateAndTimeString(record.recordDate));
- holder.value.setText(DecimalFormatter.to2Decimal(record.recordValue));
- holder.stringvalue.setText(record.stringRecordValue);
- holder.bolustype.setText(record.bolusType);
- holder.duration.setText(DecimalFormatter.to0Decimal(record.recordDuration));
- holder.alarm.setText(record.recordAlarm);
- switch (showingType) {
- case RecordTypes.RECORD_TYPE_ALARM:
- holder.time.setVisibility(View.VISIBLE);
- holder.value.setVisibility(View.VISIBLE);
- holder.stringvalue.setVisibility(View.GONE);
- holder.bolustype.setVisibility(View.GONE);
- holder.duration.setVisibility(View.GONE);
- holder.dailybasal.setVisibility(View.GONE);
- holder.dailybolus.setVisibility(View.GONE);
- holder.dailytotal.setVisibility(View.GONE);
- holder.alarm.setVisibility(View.VISIBLE);
- break;
- case RecordTypes.RECORD_TYPE_BOLUS:
- holder.time.setVisibility(View.VISIBLE);
- holder.value.setVisibility(View.VISIBLE);
- holder.stringvalue.setVisibility(View.GONE);
- holder.bolustype.setVisibility(View.VISIBLE);
- holder.duration.setVisibility(View.VISIBLE);
- holder.dailybasal.setVisibility(View.GONE);
- holder.dailybolus.setVisibility(View.GONE);
- holder.dailytotal.setVisibility(View.GONE);
- holder.alarm.setVisibility(View.GONE);
- break;
- case RecordTypes.RECORD_TYPE_DAILY:
- holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.recordDailyBasal) + "U");
- holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.recordDailyBolus) + "U");
- holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.recordDailyBolus + record.recordDailyBasal) + "U");
- holder.time.setText(DateUtil.dateString(record.recordDate));
- holder.time.setVisibility(View.VISIBLE);
- holder.value.setVisibility(View.GONE);
- holder.stringvalue.setVisibility(View.GONE);
- holder.bolustype.setVisibility(View.GONE);
- holder.duration.setVisibility(View.GONE);
- holder.dailybasal.setVisibility(View.VISIBLE);
- holder.dailybolus.setVisibility(View.VISIBLE);
- holder.dailytotal.setVisibility(View.VISIBLE);
- holder.alarm.setVisibility(View.GONE);
- break;
- case RecordTypes.RECORD_TYPE_GLUCOSE:
- holder.value.setText(Profile.toUnitsString(record.recordValue, record.recordValue * Constants.MGDL_TO_MMOLL, ProfileFunctions.getSystemUnits()));
- // rest is the same
- case RecordTypes.RECORD_TYPE_CARBO:
- case RecordTypes.RECORD_TYPE_BASALHOUR:
- case RecordTypes.RECORD_TYPE_ERROR:
- case RecordTypes.RECORD_TYPE_PRIME:
- case RecordTypes.RECORD_TYPE_REFILL:
- case RecordTypes.RECORD_TYPE_TB:
- holder.time.setVisibility(View.VISIBLE);
- holder.value.setVisibility(View.VISIBLE);
- holder.stringvalue.setVisibility(View.GONE);
- holder.bolustype.setVisibility(View.GONE);
- holder.duration.setVisibility(View.GONE);
- holder.dailybasal.setVisibility(View.GONE);
- holder.dailybolus.setVisibility(View.GONE);
- holder.dailytotal.setVisibility(View.GONE);
- holder.alarm.setVisibility(View.GONE);
- break;
- case RecordTypes.RECORD_TYPE_SUSPEND:
- holder.time.setVisibility(View.VISIBLE);
- holder.value.setVisibility(View.GONE);
- holder.stringvalue.setVisibility(View.VISIBLE);
- holder.bolustype.setVisibility(View.GONE);
- holder.duration.setVisibility(View.GONE);
- holder.dailybasal.setVisibility(View.GONE);
- holder.dailybolus.setVisibility(View.GONE);
- holder.dailytotal.setVisibility(View.GONE);
- holder.alarm.setVisibility(View.GONE);
- break;
- }
- }
-
- @Override
- public int getItemCount() {
- return historyList.size();
- }
-
- @Override
- public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
- super.onAttachedToRecyclerView(recyclerView);
- }
-
- static class HistoryViewHolder extends RecyclerView.ViewHolder {
- CardView cv;
- TextView time;
- TextView value;
- TextView bolustype;
- TextView stringvalue;
- TextView duration;
- TextView dailybasal;
- TextView dailybolus;
- TextView dailytotal;
- TextView alarm;
-
- HistoryViewHolder(View itemView) {
- super(itemView);
- cv = itemView.findViewById(R.id.danar_history_cardview);
- time = itemView.findViewById(R.id.danar_history_time);
- value = itemView.findViewById(R.id.danar_history_value);
- bolustype = itemView.findViewById(R.id.danar_history_bolustype);
- stringvalue = itemView.findViewById(R.id.danar_history_stringvalue);
- duration = itemView.findViewById(R.id.danar_history_duration);
- dailybasal = itemView.findViewById(R.id.danar_history_dailybasal);
- dailybolus = itemView.findViewById(R.id.danar_history_dailybolus);
- dailytotal = itemView.findViewById(R.id.danar_history_dailytotal);
- alarm = itemView.findViewById(R.id.danar_history_alarm);
- }
- }
- }
-
- private void loadDataFromDB(byte type) {
- historyList = MainApp.getDbHelper().getDanaRHistoryRecordsByType(type);
-
- runOnUiThread(() -> recyclerView.swapAdapter(new RecyclerViewAdapter(historyList), false));
- }
-
- private void clearCardView() {
- historyList = new ArrayList<>();
- runOnUiThread(() -> recyclerView.swapAdapter(new RecyclerViewAdapter(historyList), false));
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt
new file mode 100644
index 0000000000..361f8e716e
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt
@@ -0,0 +1,248 @@
+package info.nightscout.androidaps.plugins.pump.danaR.activities
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import android.widget.TextView
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.db.DanaRHistoryRecord
+import info.nightscout.androidaps.events.EventPumpStatusChanged
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.bus.RxBus.toObservable
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes
+import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRSyncStatus
+import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
+import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.androidaps.utils.FabricPrivacy
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.disposables.CompositeDisposable
+import kotlinx.android.synthetic.main.danar_historyactivity.*
+import org.slf4j.LoggerFactory
+import java.util.*
+
+class DanaRHistoryActivity : NoSplashAppCompatActivity() {
+ private val log = LoggerFactory.getLogger(L.PUMP)
+ private val disposable = CompositeDisposable()
+
+ private var showingType = RecordTypes.RECORD_TYPE_ALARM
+ private var historyList: List = ArrayList()
+
+ class TypeList internal constructor(var type: Byte, var name: String) {
+ override fun toString(): String = name
+ }
+
+ override fun onResume() {
+ super.onResume()
+ disposable.add(toObservable(EventPumpStatusChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ danar_history_status.text = it.getStatus() }) { FabricPrivacy.logException(it) }
+ )
+ disposable.add(toObservable(EventDanaRSyncStatus::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({
+ if (L.isEnabled(L.PUMP))
+ log.debug("EventDanaRSyncStatus: " + it.message)
+ danar_history_status.text = it.message
+ }) { FabricPrivacy.logException(it) }
+ )
+ }
+
+ override fun onPause() {
+ super.onPause()
+ disposable.clear()
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.danar_historyactivity)
+
+ danar_history_recyclerview.setHasFixedSize(true)
+ danar_history_recyclerview.layoutManager = LinearLayoutManager(this)
+ danar_history_recyclerview.adapter = RecyclerViewAdapter(historyList)
+ danar_history_status.visibility = View.GONE
+
+ val isKorean = DanaRKoreanPlugin.getPlugin().isEnabled(PluginType.PUMP)
+ val isRS = DanaRSPlugin.getPlugin().isEnabled(PluginType.PUMP)
+
+ // Types
+ val typeList = ArrayList()
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, MainApp.gs(R.string.danar_history_alarm)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, MainApp.gs(R.string.danar_history_basalhours)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_BOLUS, MainApp.gs(R.string.danar_history_bolus)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_CARBO, MainApp.gs(R.string.danar_history_carbohydrates)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_DAILY, MainApp.gs(R.string.danar_history_dailyinsulin)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, MainApp.gs(R.string.danar_history_glucose)))
+ if (!isKorean && !isRS) {
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_ERROR, MainApp.gs(R.string.danar_history_errors)))
+ }
+ if (isRS) typeList.add(TypeList(RecordTypes.RECORD_TYPE_PRIME, MainApp.gs(R.string.danar_history_prime)))
+ if (!isKorean) {
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, MainApp.gs(R.string.danar_history_refill)))
+ typeList.add(TypeList(RecordTypes.RECORD_TYPE_SUSPEND, MainApp.gs(R.string.danar_history_syspend)))
+ }
+ danar_history_spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
+
+ danar_history_reload.setOnClickListener {
+ val selected = danar_history_spinner.selectedItem as TypeList
+ runOnUiThread {
+ danar_history_reload.visibility = View.GONE
+ danar_history_status.visibility = View.VISIBLE
+ }
+ clearCardView()
+ ConfigBuilderPlugin.getPlugin().commandQueue.loadHistory(selected.type, object : Callback() {
+ override fun run() {
+ loadDataFromDB(selected.type)
+ runOnUiThread {
+ danar_history_reload.visibility = View.VISIBLE
+ danar_history_status.visibility = View.GONE
+ }
+ }
+ })
+ }
+ danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
+ val selected = danar_history_spinner.selectedItem as TypeList
+ loadDataFromDB(selected.type)
+ showingType = selected.type
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ clearCardView()
+ }
+ }
+ }
+
+ inner class RecyclerViewAdapter internal constructor(private var historyList: List) : RecyclerView.Adapter() {
+ override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): HistoryViewHolder =
+ HistoryViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.danar_history_item, viewGroup, false))
+
+ override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) {
+ val record = historyList[position]
+ holder.time.text = DateUtil.dateAndTimeString(record.recordDate)
+ holder.value.text = DecimalFormatter.to2Decimal(record.recordValue)
+ holder.stringValue.text = record.stringRecordValue
+ holder.bolusType.text = record.bolusType
+ holder.duration.text = DecimalFormatter.to0Decimal(record.recordDuration.toDouble())
+ holder.alarm.text = record.recordAlarm
+ when (showingType) {
+ RecordTypes.RECORD_TYPE_ALARM -> {
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.VISIBLE
+ holder.stringValue.visibility = View.GONE
+ holder.bolusType.visibility = View.GONE
+ holder.duration.visibility = View.GONE
+ holder.dailyBasal.visibility = View.GONE
+ holder.dailyBolus.visibility = View.GONE
+ holder.dailyTotal.visibility = View.GONE
+ holder.alarm.visibility = View.VISIBLE
+ }
+
+ RecordTypes.RECORD_TYPE_BOLUS -> {
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.VISIBLE
+ holder.stringValue.visibility = View.GONE
+ holder.bolusType.visibility = View.VISIBLE
+ holder.duration.visibility = View.VISIBLE
+ holder.dailyBasal.visibility = View.GONE
+ holder.dailyBolus.visibility = View.GONE
+ holder.dailyTotal.visibility = View.GONE
+ holder.alarm.visibility = View.GONE
+ }
+
+ RecordTypes.RECORD_TYPE_DAILY -> {
+ holder.dailyBasal.text = MainApp.gs(R.string.formatinsulinunits, record.recordDailyBasal)
+ holder.dailyBolus.text = MainApp.gs(R.string.formatinsulinunits, record.recordDailyBolus)
+ holder.dailyTotal.text = MainApp.gs(R.string.formatinsulinunits, record.recordDailyBolus + record.recordDailyBasal)
+ holder.time.text = DateUtil.dateString(record.recordDate)
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.GONE
+ holder.stringValue.visibility = View.GONE
+ holder.bolusType.visibility = View.GONE
+ holder.duration.visibility = View.GONE
+ holder.dailyBasal.visibility = View.VISIBLE
+ holder.dailyBolus.visibility = View.VISIBLE
+ holder.dailyTotal.visibility = View.VISIBLE
+ holder.alarm.visibility = View.GONE
+ }
+
+ RecordTypes.RECORD_TYPE_GLUCOSE -> {
+ holder.value.text = Profile.toUnitsString(record.recordValue, record.recordValue * Constants.MGDL_TO_MMOLL, ProfileFunctions.getSystemUnits())
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.VISIBLE
+ holder.stringValue.visibility = View.GONE
+ holder.bolusType.visibility = View.GONE
+ holder.duration.visibility = View.GONE
+ holder.dailyBasal.visibility = View.GONE
+ holder.dailyBolus.visibility = View.GONE
+ holder.dailyTotal.visibility = View.GONE
+ holder.alarm.visibility = View.GONE
+ }
+
+ RecordTypes.RECORD_TYPE_CARBO, RecordTypes.RECORD_TYPE_BASALHOUR, RecordTypes.RECORD_TYPE_ERROR, RecordTypes.RECORD_TYPE_PRIME, RecordTypes.RECORD_TYPE_REFILL, RecordTypes.RECORD_TYPE_TB -> {
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.VISIBLE
+ holder.stringValue.visibility = View.GONE
+ holder.bolusType.visibility = View.GONE
+ holder.duration.visibility = View.GONE
+ holder.dailyBasal.visibility = View.GONE
+ holder.dailyBolus.visibility = View.GONE
+ holder.dailyTotal.visibility = View.GONE
+ holder.alarm.visibility = View.GONE
+ }
+
+ RecordTypes.RECORD_TYPE_SUSPEND -> {
+ holder.time.visibility = View.VISIBLE
+ holder.value.visibility = View.GONE
+ holder.stringValue.visibility = View.VISIBLE
+ holder.bolusType.visibility = View.GONE
+ holder.duration.visibility = View.GONE
+ holder.dailyBasal.visibility = View.GONE
+ holder.dailyBolus.visibility = View.GONE
+ holder.dailyTotal.visibility = View.GONE
+ holder.alarm.visibility = View.GONE
+ }
+ }
+ }
+
+ override fun getItemCount(): Int {
+ return historyList.size
+ }
+
+ inner class HistoryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ var time: TextView = itemView.findViewById(R.id.danar_history_time)
+ var value: TextView = itemView.findViewById(R.id.danar_history_value)
+ var bolusType: TextView = itemView.findViewById(R.id.danar_history_bolustype)
+ var stringValue: TextView = itemView.findViewById(R.id.danar_history_stringvalue)
+ var duration: TextView = itemView.findViewById(R.id.danar_history_duration)
+ var dailyBasal: TextView = itemView.findViewById(R.id.danar_history_dailybasal)
+ var dailyBolus: TextView = itemView.findViewById(R.id.danar_history_dailybolus)
+ var dailyTotal: TextView = itemView.findViewById(R.id.danar_history_dailytotal)
+ var alarm: TextView = itemView.findViewById(R.id.danar_history_alarm)
+ }
+ }
+
+ private fun loadDataFromDB(type: Byte) {
+ historyList = MainApp.getDbHelper().getDanaRHistoryRecordsByType(type)
+ runOnUiThread { danar_history_recyclerview?.swapAdapter(RecyclerViewAdapter(historyList), false) }
+ }
+
+ private fun clearCardView() {
+ historyList = ArrayList()
+ runOnUiThread { danar_history_recyclerview?.swapAdapter(RecyclerViewAdapter(historyList), false) }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.java
deleted file mode 100644
index 0346b5320e..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.activities;
-
-import android.os.Bundle;
-import android.widget.Button;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
-import android.widget.Switch;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.DecimalFormat;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
-import info.nightscout.androidaps.events.EventInitializationChanged;
-import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
-import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
-import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import info.nightscout.androidaps.utils.NumberPicker;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-
-/**
- * Created by Rumen Georgiev on 5/31/2018.
- */
-
-public class DanaRUserOptionsActivity extends NoSplashAppCompatActivity {
- private static Logger log = LoggerFactory.getLogger(L.PUMP);
- private CompositeDisposable disposable = new CompositeDisposable();
-
- Switch timeFormat;
- Switch buttonScroll;
- Switch beep;
- RadioGroup pumpAlarm;
- RadioButton pumpAlarmSound;
- RadioButton pumpAlarmVibrate;
- RadioButton pumpAlarmBoth;
- Switch pumpUnits;
- NumberPicker screenTimeout;
- NumberPicker backlightTimeout;
- NumberPicker shutdown;
- NumberPicker lowReservoir;
- Button saveToPumpButton;
- // This is for Dana pumps only
- boolean isRS = DanaRSPlugin.getPlugin().isEnabled(PluginType.PUMP);
- boolean isDanaR = DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP);
- boolean isDanaRv2 = DanaRv2Plugin.getPlugin().isEnabled(PluginType.PUMP);
-
- @Override
- protected synchronized void onResume() {
- super.onResume();
- disposable.add(RxBus.INSTANCE
- .toObservable(EventInitializationChanged.class)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(event -> setData(), FabricPrivacy::logException)
- );
- }
-
- @Override
- protected synchronized void onPause() {
- disposable.clear();
- super.onPause();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.danar_user_options);
-
- timeFormat = (Switch) findViewById(R.id.danar_timeformat);
- buttonScroll = (Switch) findViewById(R.id.danar_buttonscroll);
- beep = (Switch) findViewById(R.id.danar_beep);
- pumpAlarm = (RadioGroup) findViewById(R.id.danar_pumpalarm);
- pumpAlarmSound = (RadioButton) findViewById(R.id.danar_pumpalarm_sound);
- pumpAlarmVibrate = (RadioButton) findViewById(R.id.danar_pumpalarm_vibrate);
- pumpAlarmBoth = (RadioButton) findViewById(R.id.danar_pumpalarm_both);
- screenTimeout = (NumberPicker) findViewById(R.id.danar_screentimeout);
- backlightTimeout = (NumberPicker) findViewById(R.id.danar_backlight);
- pumpUnits = (Switch) findViewById(R.id.danar_units);
- shutdown = (NumberPicker) findViewById(R.id.danar_shutdown);
- lowReservoir = (NumberPicker) findViewById(R.id.danar_lowreservoir);
- saveToPumpButton = (Button) findViewById(R.id.save_user_options);
-
- saveToPumpButton.setOnClickListener(v -> onSaveClick());
-
- DanaRPump pump = DanaRPump.getInstance();
- //used for debugging
- if (L.isEnabled(L.PUMP))
- log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago"
- + "\ntimeDisplayType:" + pump.timeDisplayType
- + "\nbuttonScroll:" + pump.buttonScrollOnOff
- + "\ntimeDisplayType:" + pump.timeDisplayType
- + "\nlcdOnTimeSec:" + pump.lcdOnTimeSec
- + "\nbacklight:" + pump.backlightOnTimeSec
- + "\npumpUnits:" + pump.units
- + "\nlowReservoir:" + pump.lowReservoirRate);
-
- screenTimeout.setParams((double) pump.lcdOnTimeSec, 5d, 240d, 5d, new DecimalFormat("1"), false, findViewById(R.id.ok));
- backlightTimeout.setParams((double) pump.backlightOnTimeSec, 1d, 60d, 1d, new DecimalFormat("1"), false, findViewById(R.id.ok));
- shutdown.setParams((double) pump.shutdownHour, 0d, 24d, 1d, new DecimalFormat("1"), true, findViewById(R.id.ok));
- lowReservoir.setParams((double) pump.lowReservoirRate, 10d, 60d, 10d, new DecimalFormat("10"), false, findViewById(R.id.ok));
- switch (pump.beepAndAlarm) {
- case 0x01:
- pumpAlarmSound.setChecked(true);
- break;
- case 0x02:
- pumpAlarmVibrate.setChecked(true);
- break;
- case 0x11:
- pumpAlarmBoth.setChecked(true);
- break;
- case 0x101:
- pumpAlarmSound.setChecked(true);
- beep.setChecked(true);
- break;
- case 0x110:
- pumpAlarmVibrate.setChecked(true);
- beep.setChecked(true);
- break;
- case 0x111:
- pumpAlarmBoth.setChecked(true);
- beep.setChecked(true);
- break;
- }
- if (pump.lastSettingsRead == 0)
- log.error("No settings loaded from pump!");
- else
- setData();
- }
-
- public void setData() {
- DanaRPump pump = DanaRPump.getInstance();
- // in DanaRS timeDisplay values are reversed
- timeFormat.setChecked((!isRS && pump.timeDisplayType != 0) || (isRS && pump.timeDisplayType == 0));
- buttonScroll.setChecked(pump.buttonScrollOnOff != 0);
- beep.setChecked(pump.beepAndAlarm > 4);
- screenTimeout.setValue((double) pump.lcdOnTimeSec);
- backlightTimeout.setValue((double) pump.backlightOnTimeSec);
- pumpUnits.setChecked(pump.getUnits() != null && pump.getUnits().equals(Constants.MMOL));
- shutdown.setValue((double) pump.shutdownHour);
- lowReservoir.setValue((double) pump.lowReservoirRate);
- }
-
- public void onSaveClick() {
- if (!isRS && !isDanaR && !isDanaRv2) {
- //exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware
- return;
- }
- DanaRPump pump = DanaRPump.getInstance();
- if (timeFormat.isChecked())
- pump.timeDisplayType = 1;
- else
- pump.timeDisplayType = 0;
- // displayTime on RS is reversed
- if (isRS) {
- if (timeFormat.isChecked())
- pump.timeDisplayType = 0;
- else
- pump.timeDisplayType = 1;
- }
- if (buttonScroll.isChecked())
- pump.buttonScrollOnOff = 1;
- else
- pump.buttonScrollOnOff = 0;
-
- pump.beepAndAlarm = 1; // default
- if (pumpAlarmSound.isChecked()) pump.beepAndAlarm = 1;
- else if (pumpAlarmVibrate.isChecked()) pump.beepAndAlarm = 2;
- else if (pumpAlarmBoth.isChecked()) pump.beepAndAlarm = 3;
- if (beep.isChecked()) pump.beepAndAlarm += 4;
-
-
- // step is 5 seconds
- int screenTimeoutValue = !screenTimeout.getText().isEmpty() ? (Integer.parseInt(screenTimeout.getText().toString()) / 5) * 5 : 5;
- if (screenTimeoutValue > 4 && screenTimeoutValue < 241) {
- pump.lcdOnTimeSec = screenTimeoutValue;
- } else {
- pump.lcdOnTimeSec = 5;
- }
- int backlightTimeoutValue = !backlightTimeout.getText().isEmpty() ? Integer.parseInt(backlightTimeout.getText().toString()) : 1;
- if (backlightTimeoutValue > 0 && backlightTimeoutValue < 61) {
- pump.backlightOnTimeSec = backlightTimeoutValue;
- }
- if (pumpUnits.isChecked()) {
- pump.units = 1;
- } else {
- pump.units = 0;
- }
- int shutDownValue = !shutdown.getText().isEmpty() ? Integer.parseInt(shutdown.getText().toString()) : 0;
- if (shutDownValue > -1 && shutDownValue < 25) {
- pump.shutdownHour = shutDownValue;
- } else {
- pump.shutdownHour = 0;
- }
- int lowReservoirValue = !lowReservoir.getText().isEmpty() ? (Integer.parseInt(lowReservoir.getText().toString()) * 10) / 10 : 10;
- if (lowReservoirValue > 9 && lowReservoirValue < 51) {
- pump.lowReservoirRate = lowReservoirValue;
- } else
- pump.lowReservoirRate = 10;
-
- ConfigBuilderPlugin.getPlugin().getCommandQueue().setUserOptions(null);
- finish();
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.kt
new file mode 100644
index 0000000000..a3a6c3c083
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRUserOptionsActivity.kt
@@ -0,0 +1,159 @@
+package info.nightscout.androidaps.plugins.pump.danaR.activities
+
+import android.content.Intent
+import android.os.Bundle
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
+import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
+import info.nightscout.androidaps.events.EventInitializationChanged
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.bus.RxBus.toObservable
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
+import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
+import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
+import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
+import info.nightscout.androidaps.queue.Callback
+import info.nightscout.androidaps.utils.FabricPrivacy
+import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.disposables.CompositeDisposable
+import kotlinx.android.synthetic.main.danar_user_options_activity.*
+import org.slf4j.LoggerFactory
+import java.text.DecimalFormat
+import kotlin.math.max
+import kotlin.math.min
+
+class DanaRUserOptionsActivity : NoSplashAppCompatActivity() {
+
+ private val log = LoggerFactory.getLogger(L.PUMP)
+
+ private val disposable = CompositeDisposable()
+
+ // This is for Dana pumps only
+ private var isRS = DanaRSPlugin.getPlugin().isEnabled(PluginType.PUMP)
+ private var isDanaR = DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)
+ private var isDanaRv2 = DanaRv2Plugin.getPlugin().isEnabled(PluginType.PUMP)
+
+ @Synchronized
+ override fun onResume() {
+ super.onResume()
+ disposable.add(toObservable(EventInitializationChanged::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ setData() }) { FabricPrivacy.logException(it) }
+ )
+ }
+
+ @Synchronized
+ override fun onPause() {
+ disposable.clear()
+ super.onPause()
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.danar_user_options_activity)
+
+ save_user_options.setOnClickListener { onSaveClick() }
+ val pump = DanaRPump.getInstance()
+
+ if (L.isEnabled(L.PUMP))
+ log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago"
+ + "\ntimeDisplayType:" + pump.timeDisplayType
+ + "\nbuttonScroll:" + pump.buttonScrollOnOff
+ + "\ntimeDisplayType:" + pump.timeDisplayType
+ + "\nlcdOnTimeSec:" + pump.lcdOnTimeSec
+ + "\nbackLight:" + pump.backlightOnTimeSec
+ + "\npumpUnits:" + pump.units
+ + "\nlowReservoir:" + pump.lowReservoirRate)
+
+ danar_screentimeout.setParams(pump.lcdOnTimeSec.toDouble(), 5.0, 240.0, 5.0, DecimalFormat("1"), false, save_user_options)
+ danar_backlight.setParams(pump.backlightOnTimeSec.toDouble(), 1.0, 60.0, 1.0, DecimalFormat("1"), false, save_user_options)
+ danar_shutdown.setParams(pump.shutdownHour.toDouble(), 0.0, 24.0, 1.0, DecimalFormat("1"), true, save_user_options)
+ danar_lowreservoir.setParams(pump.lowReservoirRate.toDouble(), 10.0, 60.0, 10.0, DecimalFormat("10"), false, save_user_options)
+ when (pump.beepAndAlarm) {
+ 0x01 -> danar_pumpalarm_sound.isChecked = true
+ 0x02 -> danar_pumpalarm_vibrate.isChecked = true
+ 0x11 -> danar_pumpalarm_both.isChecked = true
+
+ 0x101 -> {
+ danar_pumpalarm_sound.isChecked = true
+ danar_beep.isChecked = true
+ }
+
+ 0x110 -> {
+ danar_pumpalarm_vibrate.isChecked = true
+ danar_beep.isChecked = true
+ }
+
+ 0x111 -> {
+ danar_pumpalarm_both.isChecked = true
+ danar_beep.isChecked = true
+ }
+ }
+ if (pump.lastSettingsRead == 0L)
+ log.error("No settings loaded from pump!") else setData()
+ }
+
+ fun setData() {
+ val pump = DanaRPump.getInstance()
+ // in DanaRS timeDisplay values are reversed
+ danar_timeformat.isChecked = !isRS && pump.timeDisplayType != 0 || isRS && pump.timeDisplayType == 0
+ danar_buttonscroll.isChecked = pump.buttonScrollOnOff != 0
+ danar_beep.isChecked = pump.beepAndAlarm > 4
+ danar_screentimeout.value = pump.lcdOnTimeSec.toDouble()
+ danar_backlight.value = pump.backlightOnTimeSec.toDouble()
+ danar_units.isChecked = pump.getUnits() == Constants.MMOL
+ danar_shutdown.value = pump.shutdownHour.toDouble()
+ danar_lowreservoir.value = pump.lowReservoirRate.toDouble()
+ }
+
+ private fun onSaveClick() {
+ //exit if pump is not DanaRS, DanaR, or DanaR with upgraded firmware
+ if (!isRS && !isDanaR && !isDanaRv2) return
+
+ val pump = DanaRPump.getInstance()
+
+ if (isRS) // displayTime on RS is reversed
+ pump.timeDisplayType = if (danar_timeformat.isChecked) 0 else 1
+ else
+ pump.timeDisplayType = if (danar_timeformat.isChecked) 1 else 0
+
+ pump.buttonScrollOnOff = if (danar_buttonscroll.isChecked) 1 else 0
+ pump.beepAndAlarm = when {
+ danar_pumpalarm_sound.isChecked -> 1
+ danar_pumpalarm_vibrate.isChecked -> 2
+ danar_pumpalarm_both.isChecked -> 3
+ else -> 1
+ }
+ if (danar_beep.isChecked) pump.beepAndAlarm += 4
+
+ // step is 5 seconds, 5 to 240
+ pump.lcdOnTimeSec = min(max(danar_screentimeout.value.toInt() / 5 * 5, 5), 240)
+ // 1 to 60
+ pump.backlightOnTimeSec = min(max(danar_backlight.value.toInt(), 1), 60)
+
+ pump.units = if (danar_units.isChecked) 1 else 0
+
+ pump.shutdownHour = min(danar_shutdown.value.toInt(),24)
+
+ // 10 to 50
+ pump.lowReservoirRate = min(max(danar_lowreservoir.value.toInt() * 10 / 10, 10), 50)
+
+ ConfigBuilderPlugin.getPlugin().commandQueue.setUserOptions(object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.pumperror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ finish()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
index dba3b4ca77..848abd9b52 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
@@ -24,7 +24,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
index bb1f226730..0032a7e5e0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
@@ -24,7 +24,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java
index 0eedd374b2..8c8780d021 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java
@@ -34,7 +34,6 @@ import info.nightscout.androidaps.interfaces.DanaRInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -70,7 +69,7 @@ import io.reactivex.schedulers.Schedulers;
* Created by mike on 03.09.2017.
*/
-public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface, ProfileInterface {
+public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface {
private Logger log = LoggerFactory.getLogger(L.PUMP);
private CompositeDisposable disposable = new CompositeDisposable();
@@ -275,21 +274,6 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
return applyBolusConstraints(insulin);
}
- // Profile interface
-
- @Nullable
- @Override
- public ProfileStore getProfile() {
- if (DanaRPump.getInstance().lastSettingsRead == 0)
- return null; // no info now
- return DanaRPump.getInstance().createConvertedProfile();
- }
-
- @Override
- public String getProfileName() {
- return DanaRPump.getInstance().createConvertedProfileName();
- }
-
// Pump interface
@Override
@@ -354,8 +338,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
int basalIncrement = pump.basal48Enable ? 30 * 60 : 60 * 60;
for (int h = 0; h < basalValues; h++) {
Double pumpValue = pump.pumpProfiles[pump.activeProfile][h];
- Double profileValue = profile.getBasalTimeFromMidnight((Integer) (h * basalIncrement));
- if (profileValue == null) return true;
+ Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement);
if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) {
if (L.isEnabled(L.PUMP))
log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java
index 42e910f291..87c904212c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java
@@ -5,6 +5,7 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult;
+import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
@@ -24,22 +25,20 @@ import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSDeviceCh
import info.nightscout.androidaps.utils.SP;
public class BLEScanActivity extends NoSplashAppCompatActivity {
- private ListView listView = null;
private ListAdapter mListAdapter = null;
private ArrayList mDevices = new ArrayList<>();
- private BluetoothAdapter mBluetoothAdapter = null;
private BluetoothLeScanner mBluetoothLeScanner = null;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.danars_blescanner_activity);
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mListAdapter = new ListAdapter();
- listView = (ListView) findViewById(R.id.danars_blescanner_listview);
+ ListView listView = findViewById(R.id.danars_blescanner_listview);
listView.setEmptyView(findViewById(R.id.danars_blescanner_nodevice));
listView.setAdapter(mListAdapter);
@@ -50,8 +49,9 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
protected void onResume() {
super.onResume();
- mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter != null) {
+ if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
if (mBluetoothLeScanner == null) {
@@ -89,11 +89,7 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
}
mDevices.add(item);
- new Handler().post(new Runnable() {
- public void run() {
- mListAdapter.notifyDataSetChanged();
- }
- });
+ new Handler().post(() -> mListAdapter.notifyDataSetChanged());
}
private ScanCallback mBleScanCallback = new ScanCallback() {
@@ -134,19 +130,19 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
}
BluetoothDeviceItem item = getItem(i);
- holder.setData(i, item);
+ holder.setData(item);
return v;
}
private class ViewHolder implements View.OnClickListener {
private BluetoothDeviceItem item = null;
- private TextView mName = null;
- private TextView mAddress = null;
+ private TextView mName;
+ private TextView mAddress;
- public ViewHolder(View v) {
- mName = (TextView) v.findViewById(R.id.ble_name);
- mAddress = (TextView) v.findViewById(R.id.ble_address);
+ ViewHolder(View v) {
+ mName = v.findViewById(R.id.ble_name);
+ mAddress = v.findViewById(R.id.ble_address);
v.setOnClickListener(ViewHolder.this);
}
@@ -160,7 +156,7 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
finish();
}
- public void setData(int pos, BluetoothDeviceItem data) {
+ public void setData(BluetoothDeviceItem data) {
if (data != null) {
try {
String tTitle = data.device.getName();
@@ -174,7 +170,7 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
mAddress.setText(data.device.getAddress());
item = data;
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
}
}
@@ -185,14 +181,14 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
private class BluetoothDeviceItem {
private BluetoothDevice device;
- public BluetoothDeviceItem(BluetoothDevice device) {
+ BluetoothDeviceItem(BluetoothDevice device) {
super();
this.device = device;
}
@Override
public boolean equals(Object o) {
- if (device == null || o == null || !(o instanceof BluetoothDeviceItem)) {
+ if (device == null || !(o instanceof BluetoothDeviceItem)) {
return false;
}
BluetoothDeviceItem checkItem = (BluetoothDeviceItem) o;
@@ -202,7 +198,7 @@ public class BLEScanActivity extends NoSplashAppCompatActivity {
return stringEquals(device.getAddress(), checkItem.device.getAddress());
}
- public boolean stringEquals(String arg1, String arg2) {
+ boolean stringEquals(String arg1, String arg2) {
try {
return arg1.equals(arg2);
} catch (Exception e) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java
deleted file mode 100644
index 5be6d7fbd1..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.activities;
-
-import android.os.Bundle;
-
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
-
-public class PairingHelperActivity extends NoSplashAppCompatActivity {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- PairingProgressDialog bolusProgressDialog = new PairingProgressDialog();
- bolusProgressDialog.setHelperActivity(this);
- bolusProgressDialog.show(this.getSupportFragmentManager(), "PairingProgress");
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt
new file mode 100644
index 0000000000..ba73e1b368
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt
@@ -0,0 +1,16 @@
+package info.nightscout.androidaps.plugins.pump.danaRS.activities
+
+import android.content.pm.ActivityInfo
+import android.os.Bundle
+import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
+import info.nightscout.androidaps.plugins.pump.danaRS.dialogs.PairingProgressDialog
+
+class PairingHelperActivity : NoSplashAppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ PairingProgressDialog()
+ .setHelperActivity(this)
+ .show(supportFragmentManager, "PairingProgress")
+ requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/dialogs/PairingProgressDialog.java
similarity index 75%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java
rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/dialogs/PairingProgressDialog.java
index afb5e86387..bad9e98112 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/dialogs/PairingProgressDialog.java
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.activities;
+package info.nightscout.androidaps.plugins.pump.danaRS.dialogs;
import android.app.Activity;
@@ -8,6 +8,8 @@ import android.os.HandlerThread;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -17,23 +19,22 @@ import androidx.fragment.app.DialogFragment;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.bus.RxBus;
+import info.nightscout.androidaps.plugins.pump.danaRS.activities.PairingHelperActivity;
import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPairingSuccess;
import info.nightscout.androidaps.utils.FabricPrivacy;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
-public class PairingProgressDialog extends DialogFragment implements View.OnClickListener {
+public class PairingProgressDialog extends DialogFragment {
private CompositeDisposable disposable = new CompositeDisposable();
- TextView statusView;
- ProgressBar progressBar;
- Button button;
- PairingHelperActivity helperActivity;
+ private TextView statusView;
+ private ProgressBar progressBar;
+ private Button button;
+ private PairingHelperActivity helperActivity;
- static int secondsPassed = 0;
- public static boolean pairingEnded = false;
- public static boolean running = true;
+ private static boolean pairingEnded = false;
private static Handler sHandler;
private static HandlerThread sHandlerThread;
@@ -46,7 +47,6 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
sHandlerThread.start();
sHandler = new Handler(sHandlerThread.getLooper());
}
- secondsPassed = 0;
}
@@ -54,17 +54,21 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.danars_pairingprogressdialog, container, false);
- getDialog().setTitle(MainApp.gs(R.string.pairing));
- statusView = (TextView) view.findViewById(R.id.danars_pairingprogress_status);
- progressBar = (ProgressBar) view.findViewById(R.id.danars_pairingprogress_progressbar);
- button = (Button) view.findViewById(R.id.ok);
+
+ getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
+ setCancelable(false);
+ getDialog().setCanceledOnTouchOutside(false);
+
+ statusView = view.findViewById(R.id.danars_pairingprogress_status);
+ progressBar = view.findViewById(R.id.danars_pairingprogress_progressbar);
+ button = view.findViewById(R.id.ok);
progressBar.setMax(100);
progressBar.setProgress(0);
statusView.setText(MainApp.gs(R.string.waitingforpairing));
button.setVisibility(View.GONE);
- button.setOnClickListener(this);
- setCancelable(false);
+ button.setOnClickListener(v -> dismiss());
sHandler.post(() -> {
for (int i = 0; i < 20; i++) {
@@ -110,8 +114,8 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
.observeOn(Schedulers.io())
.subscribe(event -> pairingEnded = true, FabricPrivacy::logException)
);
- running = true;
if (pairingEnded) dismiss();
+ getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
@@ -126,16 +130,10 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
public void onPause() {
super.onPause();
disposable.clear();
- running = false;
}
- public void setHelperActivity(PairingHelperActivity activity) {
+ public PairingProgressDialog setHelperActivity(PairingHelperActivity activity) {
this.helperActivity = activity;
- }
-
- @Override
- public void onClick(View v) {
- running = false;
- dismiss();
+ return this;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
index 2850f08c8d..4e56133222 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
@@ -26,8 +26,8 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@@ -181,6 +181,20 @@ public class DanaRSService extends Service {
RxBus.INSTANCE.send(new EventInitializationChanged());
return;
}
+ long now = System.currentTimeMillis();
+ if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
+ RxBus.INSTANCE.send(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
+ bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
+ bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
+ bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
+ bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
+ bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
+ bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
+ bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
+ bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option()); // Getting user options
+ danaRPump.lastSettingsRead = now;
+ }
+
if (L.isEnabled(L.PUMPCOMM))
log.debug("Pump time difference: " + timeDiff + " seconds");
if (Math.abs(timeDiff) > 3) {
@@ -201,9 +215,13 @@ public class DanaRSService extends Service {
RxBus.INSTANCE.send(new EventInitializationChanged());
return;
} else {
- waitForWholeMinute(); // Dana can set only whole minute
- // add 10sec to be sure we are over minute (will be cutted off anyway)
- bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(new Date(DateUtil.now() + T.secs(10).msecs())));
+ if (danaRPump.protocol >= 6) {
+ bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(new Date()));
+ } else {
+ waitForWholeMinute(); // Dana can set only whole minute
+ // add 10sec to be sure we are over minute (will be cutted off anyway)
+ bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(new Date(DateUtil.now() + T.secs(10).msecs())));
+ }
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L;
if (L.isEnabled(L.PUMPCOMM))
@@ -211,20 +229,6 @@ public class DanaRSService extends Service {
}
}
- long now = System.currentTimeMillis();
- if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized()) {
- RxBus.INSTANCE.send(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
- bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
- bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
- bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option()); // Getting user options
- danaRPump.lastSettingsRead = now;
- }
-
loadEvents();
RxBus.INSTANCE.send(new EventDanaRNewStatus());
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
index e528a67fae..ef254580f9 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
@@ -25,8 +25,8 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
index f0d10e0370..48780e2343 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
@@ -44,11 +44,10 @@ import info.nightscout.androidaps.plugins.common.ManufacturerType;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
index dec0cb80f6..90cb11f71f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
@@ -56,7 +56,7 @@ public enum PumpHistoryEntryType // implements CodeEnum
ChangeMaxBasal(0x2c, "Change Max Basal", PumpHistoryEntryGroup.Configuration), //
BolusWizardEnabled(0x2d, "Bolus Wizard Enabled", PumpHistoryEntryGroup.Configuration), // V3 ?
- /**/EventUnknown_MM512_0x2e(0x2e, "Unknown Event 0x2e", PumpHistoryEntryGroup.Unknown), //
+ /**/EventUnknown_MM512_0x2e(0x2e, "Unknown Event 0x2e", PumpHistoryEntryGroup.Unknown, 2, 5, 100), //
BolusWizard512(0x2f, "Bolus Wizard (512)", PumpHistoryEntryGroup.Bolus, 2, 5, 12), //
UnabsorbedInsulin512(0x30, "Unabsorbed Insulin (512)", PumpHistoryEntryGroup.Statistic, 5, 0, 0), // FIXME
ChangeBGReminderOffset(0x31, "Change BG Reminder Offset", PumpHistoryEntryGroup.Configuration), //
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
index 2e23d2a955..11d1bad3d9 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
@@ -32,6 +32,7 @@ import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder;
@@ -613,6 +614,8 @@ public class MedtronicHistoryData {
return;
}
+ filterOutNonInsulinEntries(entriesFromHistory);
+
if (doubleBolusDebug)
LOG.debug("DoubleBolusDebug: List (after filter): {}, FromDb={}", gson.toJson(entryList),
gsonCore.toJson(entriesFromHistory));
@@ -640,6 +643,23 @@ public class MedtronicHistoryData {
}
+ private void filterOutNonInsulinEntries(List extends DbObjectBase> entriesFromHistory) {
+ // when we try to pair PumpHistory with AAPS treatments, we need to ignore all non-insulin entries
+ List removeList = new ArrayList<>();
+
+ for (DbObjectBase dbObjectBase : entriesFromHistory) {
+
+ Treatment treatment = (Treatment)dbObjectBase;
+
+ if (RileyLinkUtil.isSame(treatment.insulin, 0d)) {
+ removeList.add(dbObjectBase);
+ }
+ }
+
+ entriesFromHistory.removeAll(removeList);
+ }
+
+
private void processTBREntries(List entryList) {
Collections.reverse(entryList);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java
index 1d72ed2e72..b67cadfed4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.source;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -9,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -25,6 +23,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.T;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -35,17 +34,17 @@ import io.reactivex.disposables.CompositeDisposable;
public class BGSourceFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
+ private RecyclerView recyclerView;
- final long MILLS_TO_THE_PAST = T.hours(12).msecs();
+ private final long MILLS_TO_THE_PAST = T.hours(12).msecs();
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
try {
View view = inflater.inflate(R.layout.bgsource_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.bgsource_recyclerview);
+ recyclerView = view.findViewById(R.id.bgsource_recyclerview);
recyclerView.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
@@ -91,6 +90,7 @@ public class BGSourceFragment extends Fragment {
this.bgReadings = bgReadings;
}
+ @NonNull
@Override
public BgReadingsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.bgsource_item, viewGroup, false);
@@ -113,7 +113,7 @@ public class BGSourceFragment extends Fragment {
return bgReadings.size();
}
- class BgReadingsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class BgReadingsViewHolder extends RecyclerView.ViewHolder {
TextView date;
TextView value;
TextView direction;
@@ -123,46 +123,22 @@ public class BGSourceFragment extends Fragment {
BgReadingsViewHolder(View itemView) {
super(itemView);
- date = (TextView) itemView.findViewById(R.id.bgsource_date);
- value = (TextView) itemView.findViewById(R.id.bgsource_value);
- direction = (TextView) itemView.findViewById(R.id.bgsource_direction);
- invalid = (TextView) itemView.findViewById(R.id.invalid_sign);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.bgsource_remove);
- remove.setOnClickListener(this);
+ date = itemView.findViewById(R.id.bgsource_date);
+ value = itemView.findViewById(R.id.bgsource_value);
+ direction = itemView.findViewById(R.id.bgsource_direction);
+ invalid = itemView.findViewById(R.id.invalid_sign);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.bgsource_remove);
+ remove.setOnClickListener(v -> {
+ final BgReading bgReading = (BgReading) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(ProfileFunctions.getSystemUnits()), () -> {
+ bgReading.isValid = false;
+ MainApp.getDbHelper().update(bgReading);
+ updateGUI();
+ });
+ });
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
-
- @Override
- public void onClick(View v) {
- final BgReading bgReading = (BgReading) v.getTag();
- switch (v.getId()) {
-
- case R.id.bgsource_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(ProfileFunctions.getSystemUnits()));
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
-/* final String _id = bgReading._id;
- if (NSUpload.isIdValid(_id)) {
- NSUpload.removeFoodFromNS(_id);
- } else {
- UploadQueue.removeID("dbAdd", _id);
- }
-*/
- bgReading.isValid = false;
- MainApp.getDbHelper().update(bgReading);
- updateGUI();
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
-
- }
- }
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt
new file mode 100644
index 0000000000..ea6731ca60
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt
@@ -0,0 +1,77 @@
+package info.nightscout.androidaps.plugins.source
+
+import android.content.Intent
+import android.os.Handler
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.db.BgReading
+import info.nightscout.androidaps.interfaces.BgSourceInterface
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.T
+import info.nightscout.androidaps.utils.isRunningTest
+import org.slf4j.LoggerFactory
+import java.util.*
+import kotlin.math.PI
+import kotlin.math.sin
+
+object RandomBgPlugin : PluginBase(PluginDescription()
+ .mainType(PluginType.BGSOURCE)
+ .fragmentClass(BGSourceFragment::class.java.name)
+ .pluginName(R.string.randombg)
+ .shortName(R.string.randombg_short)
+ .description(R.string.description_source_randombg)), BgSourceInterface {
+
+ private val log = LoggerFactory.getLogger(L.BGSOURCE)
+
+ private val loopHandler = Handler()
+ private lateinit var refreshLoop: Runnable
+
+ const val interval = 5L // minutes
+
+ init {
+ refreshLoop = Runnable {
+ handleNewData(Intent())
+ loopHandler.postDelayed(refreshLoop, T.mins(interval).msecs())
+ }
+ }
+
+ override fun advancedFilteringSupported(): Boolean {
+ return false
+ }
+
+ override fun onStart() {
+ super.onStart()
+ loopHandler.postDelayed(refreshLoop, T.mins(interval).msecs())
+ }
+
+ override fun onStop() {
+ super.onStop()
+ loopHandler.removeCallbacks(refreshLoop)
+ }
+
+ override fun specialEnableCondition(): Boolean {
+ return VirtualPumpPlugin.getPlugin().isEnabled(PluginType.PUMP) && (MainApp.engineeringMode || isRunningTest())
+ }
+
+ override fun handleNewData(intent: Intent) {
+ if (!isEnabled(PluginType.BGSOURCE)) return
+ val min = 70
+ val max = 190
+
+ val cal = GregorianCalendar()
+ val currentMinute = cal.get(Calendar.MINUTE) + (cal.get(Calendar.HOUR_OF_DAY) % 2) * 60
+ val bgMgdl = min + (max - min) * sin(currentMinute / 120.0 * 2 * PI)
+
+ val bgReading = BgReading()
+ bgReading.value = bgMgdl
+ bgReading.date = DateUtil.now()
+ bgReading.raw = bgMgdl
+ MainApp.getDbHelper().createIfNotExists(bgReading, "RandomBG")
+ log.debug("Generated BG: $bgReading")
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java
index 0e7215b368..f22523160d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java
@@ -9,7 +9,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.T;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
index 004f44858d..8ec0b48ffa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
@@ -45,7 +45,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
+import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
@@ -103,11 +103,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@Override
protected void onStart() {
- initializeTempBasalData();
- initializeTreatmentData();
- initializeExtendedBolusData();
- initializeTempTargetData();
- initializeProfileSwitchData();
+ initializeData(range());
super.onStart();
disposable.add(RxBus.INSTANCE
.toObservable(EventReloadTreatmentData.class)
@@ -115,8 +111,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
.subscribe(event -> {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("EventReloadTreatmentData");
- initializeTreatmentData();
- initializeExtendedBolusData();
+ initializeTreatmentData(range());
+ initializeExtendedBolusData(range());
updateTotalIOBTreatments();
RxBus.INSTANCE.send(event.getNext());
},
@@ -125,13 +121,13 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
disposable.add(RxBus.INSTANCE
.toObservable(EventReloadProfileSwitchData.class)
.observeOn(Schedulers.io())
- .subscribe(event -> initializeProfileSwitchData(),
+ .subscribe(event -> initializeProfileSwitchData(range()),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventTempTargetChange.class)
.observeOn(Schedulers.io())
- .subscribe(event -> initializeTempTargetData(),
+ .subscribe(event -> initializeTempTargetData(range()),
FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
@@ -140,7 +136,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
.subscribe(event -> {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("EventReloadTempBasalData");
- initializeTempBasalData();
+ initializeTempBasalData(range());
updateTotalIOBTempBasals();
},
FabricPrivacy::logException
@@ -157,61 +153,61 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
return this.service;
}
- private void initializeTreatmentData() {
+ private long range() {
+ double dia = Constants.defaultDIA;
+ if (ConfigBuilderPlugin.getPlugin() != null && ProfileFunctions.getInstance().getProfile() != null)
+ dia = ProfileFunctions.getInstance().getProfile().getDia();
+ return (long) (60 * 60 * 1000L * (24 + dia));
+ }
+
+ public void initializeData(long range) {
+ initializeTempBasalData(range);
+ initializeTreatmentData(range);
+ initializeExtendedBolusData(range);
+ initializeTempTargetData(range);
+ initializeProfileSwitchData(range);
+ }
+
+ private void initializeTreatmentData(long range) {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("initializeTreatmentData");
- double dia = Constants.defaultDIA;
- if (ConfigBuilderPlugin.getPlugin() != null && ProfileFunctions.getInstance().getProfile() != null)
- dia = ProfileFunctions.getInstance().getProfile().getDia();
- long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
synchronized (treatments) {
treatments.clear();
- treatments.addAll(getService().getTreatmentDataFromTime(fromMills, false));
+ treatments.addAll(getService().getTreatmentDataFromTime(DateUtil.now() - range, false));
}
}
- private void initializeTempBasalData() {
+ private void initializeTempBasalData(long range) {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("initializeTempBasalData");
- double dia = Constants.defaultDIA;
- if (ConfigBuilderPlugin.getPlugin() != null && ProfileFunctions.getInstance().getProfile() != null)
- dia = ProfileFunctions.getInstance().getProfile().getDia();
- long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
-
synchronized (tempBasals) {
- tempBasals.reset().add(MainApp.getDbHelper().getTemporaryBasalsDataFromTime(fromMills, false));
+ tempBasals.reset().add(MainApp.getDbHelper().getTemporaryBasalsDataFromTime(DateUtil.now() - range, false));
}
}
- private void initializeExtendedBolusData() {
+ private void initializeExtendedBolusData(long range) {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("initializeExtendedBolusData");
- double dia = Constants.defaultDIA;
- if (ConfigBuilderPlugin.getPlugin() != null && ProfileFunctions.getInstance().getProfile() != null)
- dia = ProfileFunctions.getInstance().getProfile().getDia();
- long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
-
synchronized (extendedBoluses) {
- extendedBoluses.reset().add(MainApp.getDbHelper().getExtendedBolusDataFromTime(fromMills, false));
+ extendedBoluses.reset().add(MainApp.getDbHelper().getExtendedBolusDataFromTime(DateUtil.now() - range, false));
}
}
- private void initializeTempTargetData() {
+ private void initializeTempTargetData(long range) {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("initializeTempTargetData");
synchronized (tempTargets) {
- long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24;
- tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false));
+ tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(DateUtil.now() - range, false));
}
}
- private void initializeProfileSwitchData() {
+ private void initializeProfileSwitchData(long range) {
if (L.isEnabled(L.DATATREATMENTS))
log.debug("initializeProfileSwitchData");
synchronized (profiles) {
- profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(false));
+ profiles.reset().add(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - range, false));
}
}
@@ -261,7 +257,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
if (!pumpInterface.isFakingTempsByExtendedBoluses())
synchronized (extendedBoluses) {
- for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
+ for (int pos = 0; pos < extendedBoluses.size(); pos++) {
ExtendedBolus e = extendedBoluses.get(pos);
if (e.date > time) continue;
IobTotal calc = e.iobCalc(time);
@@ -365,11 +361,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@Override
- public List getTreatments5MinBackFromHistory(long time) {
+ public List getCarbTreatments5MinBackFromHistory(long time) {
List in5minback = new ArrayList<>();
synchronized (treatments) {
- for (Integer pos = 0; pos < treatments.size(); pos++) {
- Treatment t = treatments.get(pos);
+ for (Treatment t : treatments) {
if (!t.isValid)
continue;
if (t.date <= time && t.date > time - 5 * 60 * 1000 && t.carbs > 0)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.kt
index c65c75c00e..63f3b57f65 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.kt
@@ -6,9 +6,13 @@ import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
+import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.JsonHelper
+import info.nightscout.androidaps.utils.StringUtils
import kotlinx.android.synthetic.main.treatments_wizardinfo_dialog.*
import org.json.JSONObject
@@ -30,34 +34,36 @@ class WizardInfoDialog : DialogFragment() {
super.onViewCreated(view, savedInstanceState)
close.setOnClickListener { dismiss() }
-
+ val units = ProfileFunctions.getSystemUnits()
+ val bg_string: String
+ if (units.equals(Constants.MGDL)) { bg_string = DecimalFormatter.to0Decimal(JsonHelper.safeGetDouble(json, "bg"))} else { bg_string = DecimalFormatter.to1Decimal(JsonHelper.safeGetDouble(json, "bg"))}
// BG
- treatments_wizard_bg.text = DecimalFormatter.to1Decimal(JsonHelper.safeGetDouble(json, "bg")) + " ISF: " + DecimalFormatter.to1Decimal(JsonHelper.safeGetDouble(json, "isf"))
- treatments_wizard_bginsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulinbg")) + "U"
+ treatments_wizard_bg.text = MainApp.gs(R.string.format_bg_isf, bg_string , JsonHelper.safeGetDouble(json, "isf"))
+ treatments_wizard_bginsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulinbg"))
treatments_wizard_bgcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "insulinbgused")
treatments_wizard_ttcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "ttused")
// Trend
treatments_wizard_bgtrend.text = JsonHelper.safeGetString(json, "trend")
- treatments_wizard_bgtrendinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulintrend")) + "U"
+ treatments_wizard_bgtrendinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulintrend"))
treatments_wizard_bgtrendcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "trendused")
// COB
- treatments_wizard_cob.text = DecimalFormatter.to0Decimal(JsonHelper.safeGetDouble(json, "cob")) + "g IC: " + DecimalFormatter.to1Decimal(JsonHelper.safeGetDouble(json, "ic"))
- treatments_wizard_cobinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulincob")) + "U"
+ treatments_wizard_cob.text = MainApp.gs(R.string.format_cob_ic, JsonHelper.safeGetDouble(json, "cob"), JsonHelper.safeGetDouble(json, "ic"))
+ treatments_wizard_cobinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulincob"))
treatments_wizard_cobcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "cobused")
// Bolus IOB
- treatments_wizard_bolusiobinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "bolusiob")) + "U"
+ treatments_wizard_bolusiobinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "bolusiob"))
treatments_wizard_bolusiobcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "bolusiobused")
// Basal IOB
- treatments_wizard_basaliobinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "basaliob")) + "U"
+ treatments_wizard_basaliobinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "basaliob"))
treatments_wizard_basaliobcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "basaliobused")
// Superbolus
- treatments_wizard_sbinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulinsuperbolus")) + "U"
+ treatments_wizard_sbinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulinsuperbolus"))
treatments_wizard_sbcheckbox.isChecked = JsonHelper.safeGetBoolean(json, "superbolusused")
// Carbs
- treatments_wizard_carbs.text = DecimalFormatter.to0Decimal(JsonHelper.safeGetDouble(json, "carbs")) + "g IC: " + DecimalFormatter.to1Decimal(JsonHelper.safeGetDouble(json, "ic"))
- treatments_wizard_carbsinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulincarbs")) + "U"
+ treatments_wizard_carbs.text = MainApp.gs(R.string.format_carbs_ic, JsonHelper.safeGetDouble(json, "carbs"), JsonHelper.safeGetDouble(json, "ic"))
+ treatments_wizard_carbsinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulincarbs"))
// Correction
- treatments_wizard_correctioninsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "othercorrection")) + "U"
+ treatments_wizard_correctioninsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "othercorrection"))
// Profile
treatments_wizard_profile.text = JsonHelper.safeGetString(json, "profile")
// Notes
@@ -65,6 +71,6 @@ class WizardInfoDialog : DialogFragment() {
// Percentage
treatments_wizard_percent_used.text = DecimalFormatter.to0Decimal(JsonHelper.safeGetDouble(json, "percentageCorrection", 100.0)) + "%"
// Total
- treatments_wizard_totalinsulin.text = DecimalFormatter.to2Decimal(JsonHelper.safeGetDouble(json, "insulin")) + "U"
+ treatments_wizard_totalinsulin.text = StringUtils.formatInsulin(JsonHelper.safeGetDouble(json, "insulin"))
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java
index ee78c6748b..27e35ed456 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.treatments.fragments;
-import android.content.Context;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -10,7 +8,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
+import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -38,24 +36,21 @@ import info.nightscout.androidaps.plugins.treatments.dialogs.WizardInfoDialog;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import static info.nightscout.androidaps.utils.DateUtil.now;
-public class TreatmentsBolusFragment extends Fragment implements View.OnClickListener {
+public class TreatmentsBolusFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
- LinearLayoutManager llm;
+ private RecyclerView recyclerView;
- TextView iobTotal;
- TextView activityTotal;
- Button refreshFromNS;
- Button deleteFutureTreatments;
-
- Context context;
+ private TextView iobTotal;
+ private TextView activityTotal;
+ private Button deleteFutureTreatments;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
@@ -65,6 +60,7 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
this.treatments = treatments;
}
+ @NonNull
@Override
public TreatmentsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_bolus_item, viewGroup, false);
@@ -72,16 +68,16 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
}
@Override
- public void onBindViewHolder(TreatmentsViewHolder holder, int position) {
+ public void onBindViewHolder(@NonNull TreatmentsViewHolder holder, int position) {
Profile profile = ProfileFunctions.getInstance().getProfile();
if (profile == null)
return;
Treatment t = treatments.get(position);
holder.date.setText(DateUtil.dateAndTimeString(t.date));
- holder.insulin.setText(DecimalFormatter.toPumpSupportedBolus(t.insulin) + " U");
- holder.carbs.setText(DecimalFormatter.to0Decimal(t.carbs) + " g");
+ holder.insulin.setText(MainApp.gs(R.string.formatinsulinunits, t.insulin));
+ holder.carbs.setText(MainApp.gs(R.string.format_carbs, (int) t.carbs));
Iob iob = t.iobCalc(System.currentTimeMillis(), profile.getDia());
- holder.iob.setText(DecimalFormatter.to2Decimal(iob.iobContrib) + " U");
+ holder.iob.setText(MainApp.gs(R.string.formatinsulinunits, iob.iobContrib));
holder.mealOrCorrection.setText(t.isSMB ? "SMB" : t.mealBolus ? MainApp.gs(R.string.mealbolus) : MainApp.gs(R.string.correctionbous));
holder.ph.setVisibility(t.source == Source.PUMP ? View.VISIBLE : View.GONE);
holder.ns.setVisibility(NSUpload.isIdValid(t._id) ? View.VISIBLE : View.GONE);
@@ -105,7 +101,7 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
}
@Override
- public void onAttachedToRecyclerView(RecyclerView recyclerView) {
+ public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
@@ -124,19 +120,19 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
TreatmentsViewHolder(View itemView) {
super(itemView);
- cv = (CardView) itemView.findViewById(R.id.treatments_cardview);
- date = (TextView) itemView.findViewById(R.id.treatments_date);
- insulin = (TextView) itemView.findViewById(R.id.treatments_insulin);
- carbs = (TextView) itemView.findViewById(R.id.treatments_carbs);
- iob = (TextView) itemView.findViewById(R.id.treatments_iob);
- mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
- ph = (TextView) itemView.findViewById(R.id.pump_sign);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- invalid = (TextView) itemView.findViewById(R.id.invalid_sign);
- calculation = (TextView) itemView.findViewById(R.id.treatments_calculation);
+ cv = itemView.findViewById(R.id.treatments_cardview);
+ date = itemView.findViewById(R.id.treatments_date);
+ insulin = itemView.findViewById(R.id.treatments_insulin);
+ carbs = itemView.findViewById(R.id.treatments_carbs);
+ iob = itemView.findViewById(R.id.treatments_iob);
+ mealOrCorrection = itemView.findViewById(R.id.treatments_mealorcorrection);
+ ph = itemView.findViewById(R.id.pump_sign);
+ ns = itemView.findViewById(R.id.ns_sign);
+ invalid = itemView.findViewById(R.id.invalid_sign);
+ calculation = itemView.findViewById(R.id.treatments_calculation);
calculation.setOnClickListener(this);
calculation.setPaintFlags(calculation.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
- remove = (TextView) itemView.findViewById(R.id.treatments_remove);
+ remove = itemView.findViewById(R.id.treatments_remove);
remove.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
@@ -148,28 +144,25 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
return;
switch (v.getId()) {
case R.id.treatments_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(treatment.date));
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- final String _id = treatment._id;
- if (treatment.source == Source.PUMP) {
- treatment.isValid = false;
- TreatmentsPlugin.getPlugin().getService().update(treatment);
- } else {
- if (NSUpload.isIdValid(_id)) {
- NSUpload.removeCareportalEntryFromNS(_id);
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord),
+ MainApp.gs(R.string.configbuilder_insulin) + ": " + MainApp.gs(R.string.formatinsulinunits, treatment.insulin) +
+ "\n" + MainApp.gs(R.string.carbs) + ": " + MainApp.gs(R.string.format_carbs, (int) treatment.carbs) +
+ "\n" + MainApp.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(treatment.date),
+ (dialog, id) -> {
+ final String _id = treatment._id;
+ if (treatment.source == Source.PUMP) {
+ treatment.isValid = false;
+ TreatmentsPlugin.getPlugin().getService().update(treatment);
} else {
- UploadQueue.removeID("dbAdd", _id);
+ if (NSUpload.isIdValid(_id)) {
+ NSUpload.removeCareportalEntryFromNS(_id);
+ } else {
+ UploadQueue.removeID("dbAdd", _id);
+ }
+ TreatmentsPlugin.getPlugin().getService().delete(treatment);
}
- TreatmentsPlugin.getPlugin().getService().delete(treatment);
- }
- updateGui();
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
+ updateGui();
+ }, null);
break;
case R.id.treatments_calculation:
FragmentManager manager = getFragmentManager();
@@ -193,71 +186,48 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_bolus_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.treatments_recyclerview);
+ recyclerView = view.findViewById(R.id.treatments_recyclerview);
recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(view.getContext());
+ LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getTreatmentsFromHistory());
recyclerView.setAdapter(adapter);
- iobTotal = (TextView) view.findViewById(R.id.treatments_iobtotal);
- activityTotal = (TextView) view.findViewById(R.id.treatments_iobactivitytotal);
+ iobTotal = view.findViewById(R.id.treatments_iobtotal);
+ activityTotal = view.findViewById(R.id.treatments_iobactivitytotal);
- refreshFromNS = (Button) view.findViewById(R.id.treatments_reshreshfromnightscout);
- refreshFromNS.setOnClickListener(this);
+ Button refreshFromNS = view.findViewById(R.id.treatments_reshreshfromnightscout);
+ refreshFromNS.setOnClickListener(v -> OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.refresheventsfromnightscout) + "?", () -> {
+ TreatmentsPlugin.getPlugin().getService().resetTreatments();
+ RxBus.INSTANCE.send(new EventNSClientRestart());
+ }));
- deleteFutureTreatments = (Button) view.findViewById(R.id.treatments_delete_future_treatments);
- deleteFutureTreatments.setOnClickListener(this);
+ deleteFutureTreatments = view.findViewById(R.id.treatments_delete_future_treatments);
+ deleteFutureTreatments.setOnClickListener(v -> {
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.overview_treatment_label), MainApp.gs(R.string.deletefuturetreatments) + "?", () -> {
+ final List futureTreatments = TreatmentsPlugin.getPlugin().getService()
+ .getTreatmentDataFromTime(now() + 1000, true);
+ for (Treatment treatment : futureTreatments) {
+ final String _id = treatment._id;
+ if (NSUpload.isIdValid(_id)) {
+ NSUpload.removeCareportalEntryFromNS(_id);
+ } else {
+ UploadQueue.removeID("dbAdd", _id);
+ }
+ TreatmentsPlugin.getPlugin().getService().delete(treatment);
+ }
+ updateGui();
+ });
+ });
boolean nsUploadOnly = SP.getBoolean(R.string.key_ns_upload_only, false);
if (nsUploadOnly)
refreshFromNS.setVisibility(View.GONE);
- context = getContext();
-
return view;
}
- @Override
- public void onClick(View view) {
- AlertDialog.Builder builder;
- switch (view.getId()) {
- case R.id.treatments_reshreshfromnightscout:
- builder = new AlertDialog.Builder(this.getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + "?");
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- TreatmentsPlugin.getPlugin().getService().resetTreatments();
- RxBus.INSTANCE.send(new EventNSClientRestart());
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- case R.id.treatments_delete_future_treatments:
- builder = new AlertDialog.Builder(this.getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.deletefuturetreatments) + "?");
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- final List futureTreatments = TreatmentsPlugin.getPlugin().getService()
- .getTreatmentDataFromTime(now() + 1000, true);
- for (Treatment treatment : futureTreatments) {
- final String _id = treatment._id;
- if (NSUpload.isIdValid(_id)) {
- NSUpload.removeCareportalEntryFromNS(_id);
- } else {
- UploadQueue.removeID("dbAdd", _id);
- }
- TreatmentsPlugin.getPlugin().getService().delete(treatment);
- }
- updateGui();
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
- }
-
@Override
public synchronized void onResume() {
super.onResume();
@@ -292,5 +262,4 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
deleteFutureTreatments.setVisibility(View.GONE);
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java
index 4810a1ed8c..5aa4f091d8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.treatments.fragments;
-import android.content.Context;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -10,7 +8,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
+import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -28,6 +26,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.Translator;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -37,14 +36,10 @@ import io.reactivex.disposables.CompositeDisposable;
* Created by mike on 13/01/17.
*/
-public class TreatmentsCareportalFragment extends Fragment implements View.OnClickListener {
+public class TreatmentsCareportalFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
- LinearLayoutManager llm;
- Button refreshFromNS;
-
- Context context;
+ private RecyclerView recyclerView;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
@@ -54,11 +49,11 @@ public class TreatmentsCareportalFragment extends Fragment implements View.OnCli
this.careportalEventList = careportalEventList;
}
+ @NonNull
@Override
public CareportalEventsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_careportal_item, viewGroup, false);
- CareportalEventsViewHolder CareportalEventsViewHolder = new CareportalEventsViewHolder(v);
- return CareportalEventsViewHolder;
+ return new CareportalEventsViewHolder(v);
}
@Override
@@ -77,11 +72,11 @@ public class TreatmentsCareportalFragment extends Fragment implements View.OnCli
}
@Override
- public void onAttachedToRecyclerView(RecyclerView recyclerView) {
+ public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
- public class CareportalEventsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class CareportalEventsViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView date;
TextView type;
@@ -91,38 +86,30 @@ public class TreatmentsCareportalFragment extends Fragment implements View.OnCli
CareportalEventsViewHolder(View itemView) {
super(itemView);
- cv = (CardView) itemView.findViewById(R.id.careportal_cardview);
- date = (TextView) itemView.findViewById(R.id.careportal_date);
- type = (TextView) itemView.findViewById(R.id.careportal_type);
- note = (TextView) itemView.findViewById(R.id.careportal_note);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.careportal_remove);
- remove.setOnClickListener(this);
+ cv = itemView.findViewById(R.id.careportal_cardview);
+ date = itemView.findViewById(R.id.careportal_date);
+ type = itemView.findViewById(R.id.careportal_type);
+ note = itemView.findViewById(R.id.careportal_note);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.careportal_remove);
+ remove.setOnClickListener(v -> {
+ final CareportalEvent careportalEvent = (CareportalEvent) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord),
+ "\n" + MainApp.gs(R.string.careportal_newnstreatment_eventtype) + ": " + Translator.translate(careportalEvent.eventType) +
+ "\n" + MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.getNotes() +
+ "\n" + MainApp.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(careportalEvent.date),
+ (dialog, id) -> {
+ final String _id = careportalEvent._id;
+ if (NSUpload.isIdValid(_id)) {
+ NSUpload.removeCareportalEntryFromNS(_id);
+ } else {
+ UploadQueue.removeID("dbAdd", _id);
+ }
+ MainApp.getDbHelper().delete(careportalEvent);
+ }, null);
+ });
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
-
- @Override
- public void onClick(View v) {
- final CareportalEvent careportalEvent = (CareportalEvent) v.getTag();
- switch (v.getId()) {
- case R.id.careportal_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(careportalEvent.date));
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- final String _id = careportalEvent._id;
- if (NSUpload.isIdValid(_id)) {
- NSUpload.removeCareportalEntryFromNS(_id);
- } else {
- UploadQueue.removeID("dbAdd", _id);
- }
- MainApp.getDbHelper().delete(careportalEvent);
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
- }
}
}
@@ -131,20 +118,23 @@ public class TreatmentsCareportalFragment extends Fragment implements View.OnCli
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_careportal_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.careportal_recyclerview);
+ recyclerView = view.findViewById(R.id.careportal_recyclerview);
recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(view.getContext());
+ LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getDbHelper().getCareportalEvents(false));
recyclerView.setAdapter(adapter);
- refreshFromNS = (Button) view.findViewById(R.id.careportal_refreshfromnightscout);
- refreshFromNS.setOnClickListener(this);
+ Button refreshFromNS = view.findViewById(R.id.careportal_refreshfromnightscout);
+ refreshFromNS.setOnClickListener(v ->
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.careportal), MainApp.gs(R.string.refresheventsfromnightscout) + " ?", () -> {
+ MainApp.getDbHelper().resetCareportalEvents();
+ RxBus.INSTANCE.send(new EventNSClientRestart());
+ }));
- view.findViewById(R.id.careportal_removeandroidapsstartedevents).setOnClickListener(this);
-
- context = getContext();
+ view.findViewById(R.id.careportal_removeandroidapsstartedevents).setOnClickListener(v ->
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.careportal), MainApp.gs(R.string.careportal_removestartedevents), this::removeAndroidAPSStatedEvents));
boolean nsUploadOnly = SP.getBoolean(R.string.key_ns_upload_only, false);
if (nsUploadOnly)
@@ -170,36 +160,6 @@ public class TreatmentsCareportalFragment extends Fragment implements View.OnCli
disposable.clear();
}
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.careportal_refreshfromnightscout:
- AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + " ?");
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- MainApp.getDbHelper().resetCareportalEvents();
- RxBus.INSTANCE.send(new EventNSClientRestart());
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- case R.id.careportal_removeandroidapsstartedevents:
- builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.careportal_removestartedevents));
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- removeAndroidAPSStatedEvents();
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
-
- }
-
private void updateGui() {
recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getDbHelper().getCareportalEvents(false)), false);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java
index 5ce7b57564..928e2d30aa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.treatments.fragments;
-import android.content.Context;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -9,7 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
+import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -31,6 +29,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -38,10 +37,7 @@ import io.reactivex.disposables.CompositeDisposable;
public class TreatmentsExtendedBolusesFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
- LinearLayoutManager llm;
-
- Context context;
+ private RecyclerView recyclerView;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
@@ -51,6 +47,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
this.extendedBolusList = extendedBolusList;
}
+ @NonNull
@Override
public ExtendedBolusesViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_extendedbolus_item, viewGroup, false);
@@ -101,11 +98,11 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
}
@Override
- public void onAttachedToRecyclerView(RecyclerView recyclerView) {
+ public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
- public class ExtendedBolusesViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class ExtendedBolusesViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView date;
TextView duration;
@@ -120,31 +117,22 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
ExtendedBolusesViewHolder(View itemView) {
super(itemView);
- cv = (CardView) itemView.findViewById(R.id.extendedboluses_cardview);
- date = (TextView) itemView.findViewById(R.id.extendedboluses_date);
- duration = (TextView) itemView.findViewById(R.id.extendedboluses_duration);
- insulin = (TextView) itemView.findViewById(R.id.extendedboluses_insulin);
- realDuration = (TextView) itemView.findViewById(R.id.extendedboluses_realduration);
- ratio = (TextView) itemView.findViewById(R.id.extendedboluses_ratio);
- insulinSoFar = (TextView) itemView.findViewById(R.id.extendedboluses_netinsulin);
- iob = (TextView) itemView.findViewById(R.id.extendedboluses_iob);
- ph = (TextView) itemView.findViewById(R.id.pump_sign);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.extendedboluses_remove);
- remove.setOnClickListener(this);
- remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
- }
-
- @Override
- public void onClick(View v) {
- final ExtendedBolus extendedBolus = (ExtendedBolus) v.getTag();
- switch (v.getId()) {
- case R.id.extendedboluses_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(extendedBolus.date));
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
+ cv = itemView.findViewById(R.id.extendedboluses_cardview);
+ date = itemView.findViewById(R.id.extendedboluses_date);
+ duration = itemView.findViewById(R.id.extendedboluses_duration);
+ insulin = itemView.findViewById(R.id.extendedboluses_insulin);
+ realDuration = itemView.findViewById(R.id.extendedboluses_realduration);
+ ratio = itemView.findViewById(R.id.extendedboluses_ratio);
+ insulinSoFar = itemView.findViewById(R.id.extendedboluses_netinsulin);
+ iob = itemView.findViewById(R.id.extendedboluses_iob);
+ ph = itemView.findViewById(R.id.pump_sign);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.extendedboluses_remove);
+ remove.setOnClickListener(v -> {
+ final ExtendedBolus extendedBolus = (ExtendedBolus) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord),
+ MainApp.gs(R.string.extended_bolus)
+ + "\n" + MainApp.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(extendedBolus.date), (dialog, id) -> {
final String _id = extendedBolus._id;
if (NSUpload.isIdValid(_id)) {
NSUpload.removeCareportalEntryFromNS(_id);
@@ -152,12 +140,9 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
UploadQueue.removeID("dbAdd", _id);
}
MainApp.getDbHelper().delete(extendedBolus);
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
+ }, null);
+ });
+ remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
}
}
@@ -167,16 +152,14 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_extendedbolus_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.extendedboluses_recyclerview);
+ recyclerView = view.findViewById(R.id.extendedboluses_recyclerview);
recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(view.getContext());
+ LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory());
recyclerView.setAdapter(adapter);
- context = getContext();
-
return view;
}
@@ -205,5 +188,4 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
private void updateGui() {
recyclerView.swapAdapter(new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory()), false);
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
index a125f7a8c3..45d25124de 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
@@ -1,13 +1,11 @@
package info.nightscout.androidaps.plugins.treatments.fragments
-import android.content.DialogInterface
import android.graphics.Paint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
-import androidx.appcompat.app.AlertDialog
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
@@ -17,6 +15,7 @@ import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.db.ProfileSwitch
import info.nightscout.androidaps.db.Source
+import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
@@ -42,18 +41,15 @@ class TreatmentsProfileSwitchFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
profileswitch_recyclerview.setHasFixedSize(true)
profileswitch_recyclerview.layoutManager = LinearLayoutManager(view.context)
- profileswitch_recyclerview.adapter = RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(false))
+ profileswitch_recyclerview.adapter = RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(), false))
profileswitch_refreshfromnightscout.setOnClickListener {
- val builder = AlertDialog.Builder(this.context!!)
- builder.setTitle(MainApp.gs(R.string.confirmation))
- builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + "?")
- builder.setPositiveButton(MainApp.gs(R.string.ok)) { _ , _->
- MainApp.getDbHelper().resetProfileSwitch()
- RxBus.send(EventNSClientRestart())
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.refresheventsfromnightscout) + "?", Runnable {
+ MainApp.getDbHelper().resetProfileSwitch()
+ RxBus.send(EventNSClientRestart())
+ })
}
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null)
- builder.show()
}
if (SP.getBoolean(R.string.key_ns_upload_only, false)) profileswitch_refreshfromnightscout.visibility = View.GONE
@@ -63,9 +59,9 @@ class TreatmentsProfileSwitchFragment : Fragment() {
override fun onResume() {
super.onResume()
disposable.add(RxBus
- .toObservable(EventProfileNeedsUpdate::class.java)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe({ updateGUI() }) { FabricPrivacy.logException(it) }
+ .toObservable(EventProfileNeedsUpdate::class.java)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe({ updateGUI() }) { FabricPrivacy.logException(it) }
)
updateGUI()
}
@@ -77,17 +73,17 @@ class TreatmentsProfileSwitchFragment : Fragment() {
}
fun updateGUI() =
- profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(false)), false)
+ profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(), false)), false)
- inner class RecyclerProfileViewAdapter(var profileSwitchList: List) : RecyclerView.Adapter() {
+ inner class RecyclerProfileViewAdapter(private var profileSwitchList: List) : RecyclerView.Adapter() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder {
return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false))
}
override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) {
val profileSwitch = profileSwitchList[position]
- holder.ph.visibility = if (profileSwitch.source == Source.PUMP) View.VISIBLE else View.GONE
- holder.ns.visibility = if (NSUpload.isIdValid(profileSwitch._id)) View.VISIBLE else View.GONE
+ holder.ph.visibility = (profileSwitch.source == Source.PUMP).toVisibility()
+ holder.ns.visibility = NSUpload.isIdValid(profileSwitch._id).toVisibility()
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
if (!profileSwitch.isEndingEvent) {
holder.duration.text = DecimalFormatter.to0Decimal(profileSwitch.durationInMinutes.toDouble()) + " " + MainApp.gs(R.string.unit_minute_short)
@@ -121,21 +117,28 @@ class TreatmentsProfileSwitchFragment : Fragment() {
override fun onClick(v: View) {
val profileSwitch = v.tag as ProfileSwitch
when (v.id) {
- R.id.profileswitch_remove ->
- OKDialog.showConfirmation(activity, MainApp.gs(R.string.removerecord) + "\n" + profileSwitch.profileName + "\n" + DateUtil.dateAndTimeString(profileSwitch.date)) {
- val id = profileSwitch._id
- if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
- else UploadQueue.removeID("dbAdd", id)
- MainApp.getDbHelper().delete(profileSwitch)
+ R.id.profileswitch_remove ->
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.removerecord),
+ MainApp.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
+ "\n" + MainApp.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(profileSwitch.date), Runnable {
+ val id = profileSwitch._id
+ if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
+ else UploadQueue.removeID("dbAdd", id)
+ MainApp.getDbHelper().delete(profileSwitch)
+ })
}
- R.id.profileswitch_clone ->
- OKDialog.showConfirmation(activity, MainApp.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + DateUtil.dateAndTimeString(profileSwitch.date)) {
- profileSwitch.profileObject?.let {
- val nonCustomized = it.convertToNonCustomizedProfile()
- LocalProfilePlugin.addProfile(LocalProfilePlugin.SingleProfile().copyFrom(nonCustomized, profileSwitch.customizedName + " " + DateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
- RxBus.send(EventLocalProfileChanged())
- }
+ R.id.profileswitch_clone ->
+ activity?.let { activity ->
+ OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_profileswitch), MainApp.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + DateUtil.dateAndTimeString(profileSwitch.date), Runnable {
+ profileSwitch.profileObject?.let {
+ val nonCustomized = it.convertToNonCustomizedProfile()
+ LocalProfilePlugin.addProfile(LocalProfilePlugin.SingleProfile().copyFrom(nonCustomized, profileSwitch.customizedName + " " + DateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
+ RxBus.send(EventLocalProfileChanged())
+ }
+ })
}
+
R.id.profileswitch_date, R.id.profileswitch_name -> {
val args = Bundle()
args.putLong("time", (v.tag as ProfileSwitch).date)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
index 3ee36b87dd..8b73ec8ed2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
@@ -1,8 +1,5 @@
package info.nightscout.androidaps.plugins.treatments.fragments;
-import android.app.Activity;
-import android.content.Context;
-import android.content.DialogInterface;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -11,7 +8,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
-import androidx.appcompat.app.AlertDialog;
+import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -33,6 +30,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -41,14 +39,10 @@ import io.reactivex.disposables.CompositeDisposable;
* Created by mike on 13/01/17.
*/
-public class TreatmentsTempTargetFragment extends Fragment implements View.OnClickListener {
+public class TreatmentsTempTargetFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
- LinearLayoutManager llm;
- Button refreshFromNS;
-
- Context context;
+ private RecyclerView recyclerView;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
@@ -60,11 +54,11 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
currentlyActiveTarget = tempTargetList.getValueByInterval(System.currentTimeMillis());
}
+ @NonNull
@Override
public TempTargetsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_temptarget_item, viewGroup, false);
- TempTargetsViewHolder TempTargetsViewHolder = new TempTargetsViewHolder(v);
- return TempTargetsViewHolder;
+ return new TempTargetsViewHolder(v);
}
@Override
@@ -104,11 +98,11 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
}
@Override
- public void onAttachedToRecyclerView(RecyclerView recyclerView) {
+ public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
- public class TempTargetsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class TempTargetsViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView date;
TextView duration;
@@ -123,31 +117,23 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
TempTargetsViewHolder(View itemView) {
super(itemView);
- cv = (CardView) itemView.findViewById(R.id.temptargetrange_cardview);
- date = (TextView) itemView.findViewById(R.id.temptargetrange_date);
- duration = (TextView) itemView.findViewById(R.id.temptargetrange_duration);
- low = (TextView) itemView.findViewById(R.id.temptargetrange_low);
- high = (TextView) itemView.findViewById(R.id.temptargetrange_high);
- reason = (TextView) itemView.findViewById(R.id.temptargetrange_reason);
- reasonLabel = (TextView) itemView.findViewById(R.id.temptargetrange_reason_label);
- reasonColon = (TextView) itemView.findViewById(R.id.temptargetrange_reason_colon);
- ph = (TextView) itemView.findViewById(R.id.pump_sign);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.temptargetrange_remove);
- remove.setOnClickListener(this);
- remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
- }
-
- @Override
- public void onClick(View v) {
- final TempTarget tempTarget = (TempTarget) v.getTag();
- switch (v.getId()) {
- case R.id.temptargetrange_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(tempTarget.date));
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
+ cv = itemView.findViewById(R.id.temptargetrange_cardview);
+ date = itemView.findViewById(R.id.temptargetrange_date);
+ duration = itemView.findViewById(R.id.temptargetrange_duration);
+ low = itemView.findViewById(R.id.temptargetrange_low);
+ high = itemView.findViewById(R.id.temptargetrange_high);
+ reason = itemView.findViewById(R.id.temptargetrange_reason);
+ reasonLabel = itemView.findViewById(R.id.temptargetrange_reason_label);
+ reasonColon = itemView.findViewById(R.id.temptargetrange_reason_colon);
+ ph = itemView.findViewById(R.id.pump_sign);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.temptargetrange_remove);
+ remove.setOnClickListener(v -> {
+ final TempTarget tempTarget = (TempTarget) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord),
+ MainApp.gs(R.string.careportal_temporarytarget) + ": " + tempTarget.friendlyDescription(ProfileFunctions.getSystemUnits()) +
+ "\n" + DateUtil.dateAndTimeString(tempTarget.date),
+ (dialog, id) -> {
final String _id = tempTarget._id;
if (NSUpload.isIdValid(_id)) {
NSUpload.removeCareportalEntryFromNS(_id);
@@ -155,12 +141,9 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
UploadQueue.removeID("dbAdd", _id);
}
MainApp.getDbHelper().delete(tempTarget);
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
+ }, null);
+ });
+ remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
}
}
@@ -170,18 +153,20 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_temptarget_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.temptargetrange_recyclerview);
+ recyclerView = view.findViewById(R.id.temptargetrange_recyclerview);
recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(view.getContext());
+ LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getTempTargetsFromHistory());
recyclerView.setAdapter(adapter);
- refreshFromNS = (Button) view.findViewById(R.id.temptargetrange_refreshfromnightscout);
- refreshFromNS.setOnClickListener(this);
-
- context = getContext();
+ Button refreshFromNS = view.findViewById(R.id.temptargetrange_refreshfromnightscout);
+ refreshFromNS.setOnClickListener(v ->
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.refresheventsfromnightscout) + " ?", () -> {
+ MainApp.getDbHelper().resetTempTargets();
+ RxBus.INSTANCE.send(new EventNSClientRestart());
+ }));
boolean nsUploadOnly = SP.getBoolean(R.string.key_ns_upload_only, false);
if (nsUploadOnly)
@@ -207,26 +192,6 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
disposable.clear();
}
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.temptargetrange_refreshfromnightscout:
- AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + " ?");
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- MainApp.getDbHelper().resetTempTargets();
- RxBus.INSTANCE.send(new EventNSClientRestart());
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
-
- }
-
private void updateGui() {
recyclerView.swapAdapter(new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getTempTargetsFromHistory()), false);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java
index 45f930410e..22dd86e381 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.treatments.fragments;
-import android.content.Context;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -9,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -33,6 +31,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
+import info.nightscout.androidaps.utils.OKDialog;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -40,12 +39,9 @@ import io.reactivex.disposables.CompositeDisposable;
public class TreatmentsTemporaryBasalsFragment extends Fragment {
private CompositeDisposable disposable = new CompositeDisposable();
- RecyclerView recyclerView;
- LinearLayoutManager llm;
+ private RecyclerView recyclerView;
- TextView tempBasalTotalView;
-
- Context context;
+ private TextView tempBasalTotalView;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
@@ -55,6 +51,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
this.tempBasalList = tempBasalList;
}
+ @NonNull
@Override
public TempBasalsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_tempbasals_item, viewGroup, false);
@@ -123,11 +120,11 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
}
@Override
- public void onAttachedToRecyclerView(RecyclerView recyclerView) {
+ public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
- public class TempBasalsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ class TempBasalsViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView date;
TextView duration;
@@ -144,45 +141,37 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
TempBasalsViewHolder(View itemView) {
super(itemView);
- cv = (CardView) itemView.findViewById(R.id.tempbasals_cardview);
- date = (TextView) itemView.findViewById(R.id.tempbasals_date);
- duration = (TextView) itemView.findViewById(R.id.tempbasals_duration);
- absolute = (TextView) itemView.findViewById(R.id.tempbasals_absolute);
- percent = (TextView) itemView.findViewById(R.id.tempbasals_percent);
- realDuration = (TextView) itemView.findViewById(R.id.tempbasals_realduration);
- netRatio = (TextView) itemView.findViewById(R.id.tempbasals_netratio);
- netInsulin = (TextView) itemView.findViewById(R.id.tempbasals_netinsulin);
- iob = (TextView) itemView.findViewById(R.id.tempbasals_iob);
- extendedFlag = (TextView) itemView.findViewById(R.id.tempbasals_extendedflag);
- ph = (TextView) itemView.findViewById(R.id.pump_sign);
- ns = (TextView) itemView.findViewById(R.id.ns_sign);
- remove = (TextView) itemView.findViewById(R.id.tempbasals_remove);
- remove.setOnClickListener(this);
+ cv = itemView.findViewById(R.id.tempbasals_cardview);
+ date = itemView.findViewById(R.id.tempbasals_date);
+ duration = itemView.findViewById(R.id.tempbasals_duration);
+ absolute = itemView.findViewById(R.id.tempbasals_absolute);
+ percent = itemView.findViewById(R.id.tempbasals_percent);
+ realDuration = itemView.findViewById(R.id.tempbasals_realduration);
+ netRatio = itemView.findViewById(R.id.tempbasals_netratio);
+ netInsulin = itemView.findViewById(R.id.tempbasals_netinsulin);
+ iob = itemView.findViewById(R.id.tempbasals_iob);
+ extendedFlag = itemView.findViewById(R.id.tempbasals_extendedflag);
+ ph = itemView.findViewById(R.id.pump_sign);
+ ns = itemView.findViewById(R.id.ns_sign);
+ remove = itemView.findViewById(R.id.tempbasals_remove);
+ remove.setOnClickListener(v -> {
+ final TemporaryBasal tempBasal = (TemporaryBasal) v.getTag();
+ OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.removerecord),
+ MainApp.gs(R.string.pump_tempbasal_label) + ": " + tempBasal.toStringFull() +
+ "\n" + MainApp.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(tempBasal.date),
+ ((dialog, id) -> {
+ final String _id = tempBasal._id;
+ if (NSUpload.isIdValid(_id)) {
+ NSUpload.removeCareportalEntryFromNS(_id);
+ } else {
+ UploadQueue.removeID("dbAdd", _id);
+ }
+ MainApp.getDbHelper().delete(tempBasal);
+ }), null);
+ });
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
- @Override
- public void onClick(View v) {
- final TemporaryBasal tempBasal = (TemporaryBasal) v.getTag();
- switch (v.getId()) {
- case R.id.tempbasals_remove:
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(tempBasal.date));
- builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
- final String _id = tempBasal._id;
- if (NSUpload.isIdValid(_id)) {
- NSUpload.removeCareportalEntryFromNS(_id);
- } else {
- UploadQueue.removeID("dbAdd", _id);
- }
- MainApp.getDbHelper().delete(tempBasal);
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
- break;
- }
- }
}
}
@@ -191,17 +180,15 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.treatments_tempbasals_fragment, container, false);
- recyclerView = (RecyclerView) view.findViewById(R.id.tempbasals_recyclerview);
+ recyclerView = view.findViewById(R.id.tempbasals_recyclerview);
recyclerView.setHasFixedSize(true);
- llm = new LinearLayoutManager(view.getContext());
+ LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(TreatmentsPlugin.getPlugin().getTemporaryBasalsFromHistory());
recyclerView.setAdapter(adapter);
- tempBasalTotalView = (TextView) view.findViewById(R.id.tempbasals_totaltempiob);
-
- context = getContext();
+ tempBasalTotalView = view.findViewById(R.id.tempbasals_totaltempiob);
return view;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
index f24b02171f..05efc63aa3 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
+++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
@@ -15,6 +15,7 @@ import java.util.LinkedList;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.activities.BolusProgressHelperActivity;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
@@ -25,8 +26,7 @@ import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressHelperActivity;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
@@ -279,7 +279,7 @@ public class CommandQueue {
}
removeAll(Command.CommandType.BOLUS);
removeAll(Command.CommandType.SMB_BOLUS);
- ConfigBuilderPlugin.getPlugin().getActivePump().stopBolusDelivering();
+ new Thread(() -> ConfigBuilderPlugin.getPlugin().getActivePump().stopBolusDelivering()).run();
}
// returns true if command is queued
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.java
index 6348ea31b9..5a67759594 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.java
+++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.java
@@ -8,7 +8,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
+import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DecimalFormatter;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AutoStartReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java
similarity index 89%
rename from app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AutoStartReceiver.java
rename to app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java
index 6c8c7ae159..8abfb22953 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/AutoStartReceiver.java
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.general.nsclient.receivers;
+package info.nightscout.androidaps.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java
deleted file mode 100644
index 4c8a3f660e..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package info.nightscout.androidaps.receivers;
-
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.PowerManager;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
-import info.nightscout.androidaps.interfaces.PumpInterface;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-import info.nightscout.androidaps.queue.commands.Command;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import info.nightscout.androidaps.utils.LocalAlertUtils;
-import info.nightscout.androidaps.utils.T;
-
-
-/**
- * Created by mike on 07.07.2016.
- */
-public class KeepAliveReceiver extends BroadcastReceiver {
- private static Logger log = LoggerFactory.getLogger(L.CORE);
- public static final long STATUS_UPDATE_FREQUENCY = T.mins(15).msecs();
- private static long lastReadStatus = 0;
- private static long lastRun = 0;
-
- public static void cancelAlarm(Context context) {
- Intent intent = new Intent(context, KeepAliveReceiver.class);
- PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
- AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
- alarmManager.cancel(sender);
- }
-
- @Override
- public void onReceive(Context context, Intent rIntent) {
- PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:KeepAliveReciever");
- wl.acquire();
-
- LocalAlertUtils.shortenSnoozeInterval();
- LocalAlertUtils.checkStaleBGAlert();
- checkPump();
-
- if (L.isEnabled(L.CORE))
- log.debug("KeepAlive received");
- wl.release();
- }
-
- private void checkPump() {
- final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
- final Profile profile = ProfileFunctions.getInstance().getProfile();
- if (pump != null && profile != null) {
- long lastConnection = pump.lastDataTime();
- boolean isStatusOutdated = lastConnection + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis();
- boolean isBasalOutdated = Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep;
-
- if (L.isEnabled(L.CORE))
- log.debug("Last connection: " + DateUtil.dateAndTimeString(lastConnection));
- // sometimes keepalive broadcast stops
- // as as workaround test if readStatus was requested before an alarm is generated
- if (lastReadStatus != 0 && lastReadStatus > System.currentTimeMillis() - T.mins(5).msecs()) {
- LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated);
- }
-
- if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- RxBus.INSTANCE.send(new EventProfileNeedsUpdate());
- } else if (isStatusOutdated && !pump.isBusy()) {
- lastReadStatus = System.currentTimeMillis();
- ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
- } else if (isBasalOutdated && !pump.isBusy()) {
- lastReadStatus = System.currentTimeMillis();
- ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Basal outdated.", null);
- }
- }
- if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
- log.error("KeepAlive fail");
- FabricPrivacy.getInstance().logCustom("KeepAliveFail");
- }
- lastRun = System.currentTimeMillis();
- }
-
- //called by MainApp at first app start
- public void setAlarm(Context context) {
-
- LocalAlertUtils.shortenSnoozeInterval();
- LocalAlertUtils.presnoozeAlarms();
-
- AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
- Intent i = new Intent(context, KeepAliveReceiver.class);
- PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
- try {
- pi.send();
- } catch (PendingIntent.CanceledException e) {
- }
- am.cancel(pi);
- am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.keepAliveMsecs, pi);
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
new file mode 100644
index 0000000000..7ca4f962ae
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
@@ -0,0 +1,121 @@
+package info.nightscout.androidaps.receivers
+
+import android.app.AlarmManager
+import android.app.PendingIntent
+import android.app.PendingIntent.CanceledException
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.PowerManager
+import android.os.SystemClock
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.bus.RxBus.send
+import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
+import info.nightscout.androidaps.queue.commands.Command
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.LocalAlertUtils
+import info.nightscout.androidaps.utils.T
+import org.slf4j.LoggerFactory
+import kotlin.math.abs
+
+class KeepAliveReceiver : BroadcastReceiver() {
+ private var lastReadStatus: Long = 0
+ private var lastRun: Long = 0
+ private var lastIobUpload: Long = 0
+
+ override fun onReceive(context: Context, rIntent: Intent) {
+ if (L.isEnabled(L.CORE))
+ log.debug("KeepAlive received")
+ val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager
+ val wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:KeepAliveReceiver")
+ wl.acquire(T.mins(2).msecs())
+ LocalAlertUtils.shortenSnoozeInterval()
+ LocalAlertUtils.checkStaleBGAlert()
+ checkPump()
+ checkAPS()
+ wl.release()
+ }
+
+ companion object {
+ private val log = LoggerFactory.getLogger(L.CORE)
+
+ private val KEEP_ALIVE_MILLISECONDS = T.mins(5).msecs()
+ private val STATUS_UPDATE_FREQUENCY = T.mins(15).msecs()
+ private val IOB_UPDATE_FREQUENCY = T.mins(5).msecs()
+
+ //called by MainApp at first app start
+ @JvmStatic
+ fun setAlarm(context: Context) {
+ if (L.isEnabled(L.CORE))
+ log.debug("KeepAlive scheduled")
+ SystemClock.sleep(5000) // wait for app initialization
+ LocalAlertUtils.shortenSnoozeInterval()
+ LocalAlertUtils.presnoozeAlarms()
+ val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
+ val i = Intent(context, KeepAliveReceiver::class.java)
+ val pi = PendingIntent.getBroadcast(context, 0, i, 0)
+ try {
+ pi.send()
+ } catch (e: CanceledException) {
+ }
+ am.cancel(pi)
+ am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), KEEP_ALIVE_MILLISECONDS, pi)
+ }
+
+ @JvmStatic
+ fun cancelAlarm(context: Context) {
+ if (L.isEnabled(L.CORE))
+ log.debug("KeepAlive canceled")
+ val intent = Intent(context, KeepAliveReceiver::class.java)
+ val sender = PendingIntent.getBroadcast(context, 0, intent, 0)
+ val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
+ alarmManager.cancel(sender)
+ }
+ }
+
+ private fun checkAPS() {
+ val usedAPS = ConfigBuilderPlugin.getPlugin().activeAPS
+ var shouldUploadStatus = false
+ if (usedAPS == null) shouldUploadStatus = true
+ else if (DateUtil.isOlderThan(usedAPS.lastAPSRun, 5)) shouldUploadStatus = true
+ if (DateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY) && shouldUploadStatus) {
+ lastIobUpload = DateUtil.now()
+ NSUpload.uploadDeviceStatus()
+ }
+ }
+
+ private fun checkPump() {
+ val pump = ConfigBuilderPlugin.getPlugin().activePump
+ val profile = ProfileFunctions.getInstance().profile
+ if (pump != null && profile != null) {
+ val lastConnection = pump.lastDataTime()
+ val isStatusOutdated = lastConnection + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis()
+ val isBasalOutdated = abs(profile.basal - pump.baseBasalRate) > pump.pumpDescription.basalStep
+ if (L.isEnabled(L.CORE))
+ log.debug("Last connection: " + DateUtil.dateAndTimeString(lastConnection))
+ // sometimes keep alive broadcast stops
+ // as as workaround test if readStatus was requested before an alarm is generated
+ if (lastReadStatus != 0L && lastReadStatus > System.currentTimeMillis() - T.mins(5).msecs()) {
+ LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated)
+ }
+ if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().commandQueue.isRunning(Command.CommandType.BASALPROFILE)) {
+ send(EventProfileNeedsUpdate())
+ } else if (isStatusOutdated && !pump.isBusy) {
+ lastReadStatus = System.currentTimeMillis()
+ ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("KeepAlive. Status outdated.", null)
+ } else if (isBasalOutdated && !pump.isBusy) {
+ lastReadStatus = System.currentTimeMillis()
+ ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("KeepAlive. Basal outdated.", null)
+ }
+ }
+ if (lastRun != 0L && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
+ log.error("KeepAlive fail")
+ FabricPrivacy.getInstance().logCustom("KeepAliveFail")
+ }
+ lastRun = System.currentTimeMillis()
+ }
+}
\ No newline at end of file
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 44050ece35..5907ac8392 100644
--- a/app/src/main/java/info/nightscout/androidaps/services/DataService.java
+++ b/app/src/main/java/info/nightscout/androidaps/services/DataService.java
@@ -56,10 +56,6 @@ public class DataService extends IntentService {
boolean acceptNSData = !SP.getBoolean(R.string.key_ns_upload_only, false);
Bundle bundles = intent.getExtras();
- if (bundles != null && bundles.containsKey("islocal")) {
- acceptNSData = acceptNSData || bundles.getBoolean("islocal");
- }
-
final String action = intent.getAction();
if (Intents.ACTION_NEW_BG_ESTIMATE.equals(action)) {
diff --git a/app/src/main/java/info/nightscout/androidaps/services/Intents.java b/app/src/main/java/info/nightscout/androidaps/services/Intents.java
index 98c2355a4f..e4a2d0b33b 100644
--- a/app/src/main/java/info/nightscout/androidaps/services/Intents.java
+++ b/app/src/main/java/info/nightscout/androidaps/services/Intents.java
@@ -20,11 +20,6 @@ public interface Intents {
String ACTION_URGENT_ALARM = "info.nightscout.client.URGENT_ALARM";
String ACTION_CLEAR_ALARM = "info.nightscout.client.CLEAR_ALARM";
-
- // App -> NSClient
- String ACTION_DATABASE = "info.nightscout.client.DBACCESS";
- String ACTION_ACK_ALARM = "info.nightscout.client.ACK_ALARM";
-
// xDrip -> App
String RECEIVER_PERMISSION = "com.eveningoutpost.dexdrip.permissions.RECEIVE_BG_ESTIMATE";
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
index 37cfe695b4..a0dff38104 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
@@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.Config;
+import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.PreferencesActivity;
@@ -22,13 +23,11 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
-import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
-import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
-import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs;
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
+import info.nightscout.androidaps.dialogs.ProfileSwitchDialog;
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment;
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment;
@@ -49,6 +48,8 @@ import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.PasswordProtection;
import info.nightscout.androidaps.utils.SP;
+import static info.nightscout.androidaps.utils.EspressoTestHelperKt.isRunningTest;
+
public class SWDefinition {
private AppCompatActivity activity;
private List screens = new ArrayList<>();
@@ -66,7 +67,7 @@ public class SWDefinition {
}
private SWDefinition add(SWScreen newScreen) {
- screens.add(newScreen);
+ if (newScreen != null) screens.add(newScreen);
return this;
}
@@ -119,18 +120,17 @@ public class SWDefinition {
private SWScreen displaySettings = new SWScreen(R.string.wear_display_settings)
.skippable(false)
- .add(new SWEditNumberWithUnits(4d, 3d, 8d)
+ .add(new SWEditNumberWithUnits(Constants.LOWMARK * Constants.MGDL_TO_MMOLL, 3d, 8d)
.preferenceId(R.string.key_low_mark)
.updateDelay(5)
.label(R.string.low_mark)
.comment(R.string.low_mark_comment))
.add(new SWBreak())
- .add(new SWEditNumberWithUnits(10d, 5d, 20d)
+ .add(new SWEditNumberWithUnits(Constants.HIGHMARK * Constants.MGDL_TO_MMOLL, 5d, 20d)
.preferenceId(R.string.key_high_mark)
.updateDelay(5)
.label(R.string.high_mark)
- .comment(R.string.high_mark_comment))
- .validator(() -> SP.contains(R.string.key_low_mark) && SP.contains(R.string.key_high_mark));
+ .comment(R.string.high_mark_comment));
private SWScreen screenPermissionBattery = new SWScreen(R.string.permission)
.skippable(false)
@@ -295,18 +295,14 @@ public class SWDefinition {
.validator(() -> LocalProfilePlugin.INSTANCE.getProfile() != null && LocalProfilePlugin.INSTANCE.getProfile().getDefaultProfile() != null && LocalProfilePlugin.INSTANCE.getProfile().getDefaultProfile().isValid("StartupWizard"))
.visibility(() -> LocalProfilePlugin.INSTANCE.isEnabled(PluginType.PROFILE));
- private SWScreen screenProfileSwitch = new SWScreen(R.string.profileswitch)
+ private SWScreen screenProfileSwitch = new SWScreen(R.string.careportal_profileswitch)
.skippable(false)
.add(new SWInfotext()
.label(R.string.profileswitch_ismissing))
.add(new SWButton()
- .text(R.string.profileswitch)
+ .text(R.string.doprofileswitch)
.action(() -> {
- NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
- final OptionsToShow profileSwitch = CareportalFragment.PROFILESWITCHDIRECT;
- profileSwitch.executeProfileSwitch = true;
- newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch);
- newDialog.show(getActivity().getSupportFragmentManager(), "NewNSTreatmentDialog");
+ new ProfileSwitchDialog().show(getActivity().getSupportFragmentManager(), "SetupWizard");
}))
.validator(() -> ProfileFunctions.getInstance().getProfile() != null)
.visibility(() -> ProfileFunctions.getInstance().getProfile() == null);
@@ -432,7 +428,7 @@ public class SWDefinition {
add(screenSetupWizard)
.add(screenLanguage)
.add(screenEula)
- .add(screenPermissionBattery)
+ .add(isRunningTest() ? null : screenPermissionBattery) // cannot mock ask battery optimalization
.add(screenPermissionBt)
.add(screenPermissionStore)
.add(screenImport)
@@ -460,7 +456,7 @@ public class SWDefinition {
add(screenSetupWizard)
.add(screenLanguage)
.add(screenEula)
- .add(screenPermissionBattery)
+ .add(isRunningTest() ? null : screenPermissionBattery) // cannot mock ask battery optimalization
.add(screenPermissionBt)
.add(screenPermissionStore)
.add(screenImport)
@@ -484,7 +480,7 @@ public class SWDefinition {
add(screenSetupWizard)
.add(screenLanguage)
.add(screenEula)
- .add(screenPermissionBattery)
+ .add(isRunningTest() ? null : screenPermissionBattery) // cannot mock ask battery optimalization
.add(screenPermissionStore)
.add(screenImport)
.add(screenUnits)
@@ -496,5 +492,4 @@ public class SWDefinition {
.add(screenSensitivity)
;
}
-
}
\ No newline at end of file
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 603292d3cc..b74567d027 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java
@@ -8,13 +8,10 @@ import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.List;
import info.nightscout.androidaps.MainActivity;
@@ -37,8 +34,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class SetupWizardActivity extends NoSplashAppCompatActivity {
- //logging
- private static Logger log = LoggerFactory.getLogger(SetupWizardActivity.class);
private CompositeDisposable disposable = new CompositeDisposable();
ScrollView scrollView;
@@ -54,7 +49,7 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
LocaleHelper.INSTANCE.update(getApplicationContext());
setContentView(R.layout.activity_setupwizard);
- scrollView = (ScrollView) findViewById(R.id.sw_scrollview);
+ scrollView = findViewById(R.id.sw_scrollview);
Intent intent = getIntent();
currentWizardPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE, 0);
@@ -62,7 +57,7 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
SWScreen currentScreen = screens.get(currentWizardPage);
//Set screen name
- TextView screenName = (TextView) findViewById(R.id.sw_content);
+ TextView screenName = findViewById(R.id.sw_content);
screenName.setText(currentScreen.getHeader());
swDefinition.setActivity(this);
@@ -187,7 +182,7 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
return page;
page++;
}
- return currentWizardPage;
+ return Math.min(currentWizardPage, screens.size() - 1);
}
private int previousPage() {
@@ -197,21 +192,18 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
return page;
page--;
}
- return currentWizardPage;
+ return Math.max(currentWizardPage, 0);
}
@Override
- public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull 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();
+ OKDialog.show(this, MainApp.gs(R.string.permission), MainApp.gs(R.string.alert_dialog_storage_permission_text));
break;
case AndroidPermission.CASE_LOCATION:
case AndroidPermission.CASE_SMS:
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/ActivityMonitor.kt b/app/src/main/java/info/nightscout/androidaps/utils/ActivityMonitor.kt
new file mode 100644
index 0000000000..8cf5922392
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/ActivityMonitor.kt
@@ -0,0 +1,79 @@
+package info.nightscout.androidaps.utils
+
+import android.app.Activity
+import android.app.Application
+import android.os.Bundle
+import android.text.Spanned
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.logging.L
+import org.slf4j.LoggerFactory
+
+object ActivityMonitor : Application.ActivityLifecycleCallbacks {
+ private val log = LoggerFactory.getLogger(L.CORE)
+ override fun onActivityPaused(activity: Activity?) {
+ val name = activity?.javaClass?.simpleName ?: return
+ val resumed = SP.getLong("Monitor_" + name + "_" + "resumed", 0)
+ if (resumed == 0L) {
+ log.debug("onActivityPaused: $name resumed == 0")
+ return
+ }
+ val elapsed = DateUtil.now() - resumed
+ val total = SP.getLong("Monitor_" + name + "_total", 0)
+ if (total == 0L) {
+ SP.putLong("Monitor_" + name + "_start", DateUtil.now())
+ }
+ SP.putLong("Monitor_" + name + "_total", total + elapsed)
+ log.debug("onActivityPaused: $name elapsed=$elapsed total=${total + elapsed}")
+ }
+
+ override fun onActivityResumed(activity: Activity?) {
+ val name = activity?.javaClass?.simpleName ?: return
+ log.debug("onActivityResumed: $name")
+ SP.putLong("Monitor_" + name + "_" + "resumed", DateUtil.now())
+ }
+
+ override fun onActivityStarted(activity: Activity?) {
+ }
+
+ override fun onActivityDestroyed(activity: Activity?) {
+ }
+
+ override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
+ }
+
+ override fun onActivityStopped(activity: Activity?) {
+ }
+
+ override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
+ }
+
+ fun toText(): String {
+ val keys: Map = SP.getAll()
+ var result = ""
+ for ((key, value) in keys)
+ if (key.startsWith("Monitor") && key.endsWith("total")) {
+ val v = if (value is Long) value else SafeParse.stringToLong(value as String)
+ val activity = key.split("_")[1].replace("Activity", "")
+ val duration = DateUtil.niceTimeScalar(v as Long)
+ val start = SP.getLong(key.replace("total", "start"), 0)
+ val days = T.msecs(DateUtil.now() - start).days()
+ result += "$activity: $duration in $days days
"
+ }
+ return result
+ }
+
+ fun stats(): Spanned {
+ return HtmlHelper.fromHtml("
" + MainApp.gs(R.string.activitymonitor) + ":
" + toText())
+ }
+
+ fun reset() {
+ val keys: Map = SP.getAll()
+ for ((key, _) in keys)
+ if (key.startsWith("Monitor") && key.endsWith("total")) {
+ SP.remove(key)
+ SP.remove(key.replace("total", "start"))
+ SP.remove(key.replace("total", "resumed"))
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java
index 9f7986cb97..fdee5417a3 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java
@@ -17,11 +17,13 @@ import androidx.core.content.ContextCompat;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction;
+import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
public class AndroidPermission {
@@ -79,7 +81,7 @@ public class AndroidPermission {
}
public static synchronized void notifyForSMSPermissions(Activity activity) {
- if (SP.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)) {
+ if (SmsCommunicatorPlugin.INSTANCE.isEnabled(PluginType.GENERAL)) {
if (permissionNotGranted(activity, Manifest.permission.RECEIVE_SMS)) {
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_SMS, MainApp.gs(R.string.smscommunicator_missingsmspermission), Notification.URGENT);
notification.action(R.string.request, () -> AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.RECEIVE_SMS,
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.kt
index 89e0751e60..6d71a80ba1 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.kt
@@ -2,9 +2,9 @@ package info.nightscout.androidaps.utils
import android.content.Context
import android.content.Intent
-import androidx.appcompat.app.AlertDialog
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.db.CareportalEvent
@@ -20,7 +20,6 @@ import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
-import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
@@ -127,8 +126,8 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
if (useBg && bg > 0) {
bgDiff = when {
bg in targetBGLow..targetBGHigh -> 0.0
- bg <= targetBGLow -> bg - targetBGLow
- else -> bg - targetBGHigh
+ bg <= targetBGLow -> bg - targetBGLow
+ else -> bg - targetBGHigh
}
insulinFromBG = bgDiff / sens
}
@@ -142,7 +141,6 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
}
}
-
// Insulin from carbs
ic = profile.ic
insulinFromCarbs = carbs / ic
@@ -185,7 +183,7 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
}
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep
- ?: 0.1
+ ?: 0.1
calculatedTotalInsulin = Round.roundTo(calculatedTotalInsulin, bolusStep)
insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(calculatedTotalInsulin)).value()
@@ -236,7 +234,7 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
private fun confirmMessageAfterConstraints(pump: PumpInterface): String {
- var confirmMessage = MainApp.gs(R.string.entertreatmentquestion)
+ var confirmMessage = ""
if (insulinAfterConstraints > 0) {
val pct = if (percentageCorrection != 100.0) " (" + percentageCorrection.toInt() + "%)" else ""
confirmMessage += "
" + MainApp.gs(R.string.bolus) + ": " + "" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints) + "U" + pct + ""
@@ -268,89 +266,83 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
val pump = ConfigBuilderPlugin.getPlugin().activePump ?: return
if (calculatedTotalInsulin > 0.0 || carbs > 0.0) {
+ if (accepted) {
+ log.debug("guarding: already accepted")
+ return
+ }
+ accepted = true
+
val confirmMessage = confirmMessageAfterConstraints(pump)
- val builder = AlertDialog.Builder(context)
- builder.setTitle(MainApp.gs(R.string.confirmation))
- builder.setMessage(HtmlHelper.fromHtml(confirmMessage))
- builder.setPositiveButton(MainApp.gs(R.string.ok)) { _, _ ->
- synchronized(builder) {
- if (accepted) {
- log.debug("guarding: already accepted")
- return@setPositiveButton
- }
- accepted = true
- if (insulinAfterConstraints > 0 || carbs > 0) {
- if (useSuperBolus) {
- val loopPlugin = LoopPlugin.getPlugin()
- if (loopPlugin.isEnabled(PluginType.LOOP)) {
- loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
- RxBus.send(EventRefreshOverview("WizardDialog"))
- }
-
- val pump1 = ConfigBuilderPlugin.getPlugin().activePump
-
- if (pump1?.pumpDescription?.tempBasalStyle == PumpDescription.ABSOLUTE) {
- ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalAbsolute(0.0, 120, true, profile, object : Callback() {
- override fun run() {
- if (!result.success) {
- val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
- i.putExtra("soundid", R.raw.boluserror)
- i.putExtra("status", result.comment)
- i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- MainApp.instance().startActivity(i)
- }
- }
- })
- } else {
-
- ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalPercent(0, 120, true, profile, object : Callback() {
- override fun run() {
- if (!result.success) {
- val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
- i.putExtra("soundid", R.raw.boluserror)
- i.putExtra("status", result.comment)
- i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- MainApp.instance().startActivity(i)
- }
- }
- })
- }
+ OKDialog.showConfirmation(context, MainApp.gs(R.string.boluswizard), HtmlHelper.fromHtml(confirmMessage), Runnable {
+ if (insulinAfterConstraints > 0 || carbs > 0) {
+ if (useSuperBolus) {
+ val loopPlugin = LoopPlugin.getPlugin()
+ if (loopPlugin.isEnabled(PluginType.LOOP)) {
+ loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000)
+ RxBus.send(EventRefreshOverview("WizardDialog"))
}
- val detailedBolusInfo = DetailedBolusInfo()
- detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD
- detailedBolusInfo.insulin = insulinAfterConstraints
- detailedBolusInfo.carbs = carbs.toDouble()
- detailedBolusInfo.context = context
- detailedBolusInfo.glucose = bg
- detailedBolusInfo.glucoseType = "Manual"
- detailedBolusInfo.carbTime = carbTime
- detailedBolusInfo.boluscalc = nsJSON()
- detailedBolusInfo.source = Source.USER
- detailedBolusInfo.notes = notes
- if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
- ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
+
+ val pump1 = ConfigBuilderPlugin.getPlugin().activePump
+
+ if (pump1?.pumpDescription?.tempBasalStyle == PumpDescription.ABSOLUTE) {
+ ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalAbsolute(0.0, 120, true, profile, object : Callback() {
override fun run() {
if (!result.success) {
val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", result.comment)
- i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
MainApp.instance().startActivity(i)
}
}
})
} else {
- TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false)
+
+ ConfigBuilderPlugin.getPlugin().commandQueue.tempBasalPercent(0, 120, true, profile, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
}
}
+ val detailedBolusInfo = DetailedBolusInfo()
+ detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD
+ detailedBolusInfo.insulin = insulinAfterConstraints
+ detailedBolusInfo.carbs = carbs.toDouble()
+ detailedBolusInfo.context = context
+ detailedBolusInfo.glucose = bg
+ detailedBolusInfo.glucoseType = "Manual"
+ detailedBolusInfo.carbTime = carbTime
+ detailedBolusInfo.boluscalc = nsJSON()
+ detailedBolusInfo.source = Source.USER
+ detailedBolusInfo.notes = notes
+ if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
+ ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
+ override fun run() {
+ if (!result.success) {
+ val i = Intent(MainApp.instance(), ErrorHelperActivity::class.java)
+ i.putExtra("soundid", R.raw.boluserror)
+ i.putExtra("status", result.comment)
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror))
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ MainApp.instance().startActivity(i)
+ }
+ }
+ })
+ } else {
+ TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false)
+ }
}
- }
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null)
- builder.show()
+ })
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java
index 98c4d3a071..b03d8cb43f 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java
@@ -117,6 +117,14 @@ public class DateUtil {
return df.format(mills);
}
+ public static String dateStringShort(long mills) {
+ String format = "MM/dd";
+ if (android.text.format.DateFormat.is24HourFormat(MainApp.instance())) {
+ format = "dd/MM";
+ }
+ return new DateTime(mills).toString(DateTimeFormat.forPattern(format));
+ }
+
public static String timeString(Date date) {
String format = "hh:mma";
if (android.text.format.DateFormat.is24HourFormat(MainApp.instance())) {
@@ -209,6 +217,11 @@ public class DateUtil {
return diff < T.mins(2).msecs();
}
+ public static boolean isOlderThan(long date, long minutes) {
+ long diff = now() - date;
+ return diff > T.mins(minutes).msecs();
+ }
+
public static GregorianCalendar gregorianCalendar() {
return new GregorianCalendar();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.java b/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.java
deleted file mode 100644
index 7ea507e280..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package info.nightscout.androidaps.utils;
-
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
-
-public class DefaultValueHelper {
-
- /**
- * returns the corresponding EatingSoon TempTarget based on the given units (MMOL / MGDL)
- *
- * @param units
- * @return
- */
- public double getDefaultEatingSoonTT(String units) {
- return Constants.MMOL.equals(units) ? Constants.defaultEatingSoonTTmmol
- : Constants.defaultEatingSoonTTmgdl;
- }
-
- /**
- * returns the corresponding Activity TempTarget based on the given units (MMOL / MGDL)
- *
- * @param units
- * @return
- */
- public double getDefaultActivityTT(String units) {
- return Constants.MMOL.equals(units) ? Constants.defaultActivityTTmmol
- : Constants.defaultActivityTTmgdl;
- }
-
- /**
- * returns the corresponding Hypo TempTarget based on the given units (MMOL / MGDL)
- *
- * @param units
- * @return
- */
- public double getDefaultHypoTT(String units) {
- return Constants.MMOL.equals(units) ? Constants.defaultHypoTTmmol
- : Constants.defaultHypoTTmgdl;
- }
-
- /**
- * returns the configured EatingSoon TempTarget, if this is set to 0, the Default-Value is returned.
- *
- * @return
- */
- public double determineEatingSoonTT() {
- String units = ProfileFunctions.getSystemUnits();
- double value = SP.getDouble(R.string.key_eatingsoon_target, this.getDefaultEatingSoonTT(units));
- value = Profile.toCurrentUnits(value);
- return value > 0 ? value : this.getDefaultEatingSoonTT(units);
- }
-
- public int determineEatingSoonTTDuration() {
- int value = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration);
- return value > 0 ? value : Constants.defaultEatingSoonTTDuration;
- }
-
-
- /**
- * returns the configured Activity TempTarget, if this is set to 0, the Default-Value is returned.
- *
- * @return
- */
- public double determineActivityTT() {
- String units = ProfileFunctions.getSystemUnits();
- double value = SP.getDouble(R.string.key_activity_target, this.getDefaultActivityTT(units));
- value = Profile.toCurrentUnits(value);
- return value > 0 ? value : this.getDefaultActivityTT(units);
- }
-
- public int determineActivityTTDuration() {
- int value = SP.getInt(R.string.key_activity_duration, Constants.defaultActivityTTDuration);
- return value > 0 ? value : Constants.defaultActivityTTDuration;
- }
-
- /**
- * returns the configured Hypo TempTarget, if this is set to 0, the Default-Value is returned.
- *
- * @return
- */
- public double determineHypoTT() {
- String units = ProfileFunctions.getSystemUnits();
- double value = SP.getDouble(R.string.key_hypo_target, this.getDefaultHypoTT(units));
- value = Profile.toCurrentUnits(value);
- return value > 0 ? value : this.getDefaultHypoTT(units);
- }
-
- public int determineHypoTTDuration() {
- int value = SP.getInt(R.string.key_hypo_duration, Constants.defaultHypoTTDuration);
- return value > 0 ? value : Constants.defaultHypoTTDuration;
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt b/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt
new file mode 100644
index 0000000000..7b40d5d35b
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/DefaultValueHelper.kt
@@ -0,0 +1,95 @@
+package info.nightscout.androidaps.utils
+
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+
+object DefaultValueHelper {
+ /**
+ * returns the corresponding EatingSoon TempTarget based on the given units (MMOL / MGDL)
+ *
+ * @param units
+ * @return
+ */
+ fun getDefaultEatingSoonTT(units: String): Double {
+ return if (Constants.MMOL == units) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl
+ }
+
+ /**
+ * returns the corresponding Activity TempTarget based on the given units (MMOL / MGDL)
+ *
+ * @param units
+ * @return
+ */
+ fun getDefaultActivityTT(units: String): Double {
+ return if (Constants.MMOL == units) Constants.defaultActivityTTmmol else Constants.defaultActivityTTmgdl
+ }
+
+ /**
+ * returns the corresponding Hypo TempTarget based on the given units (MMOL / MGDL)
+ *
+ * @param units
+ * @return
+ */
+ fun getDefaultHypoTT(units: String): Double {
+ return if (Constants.MMOL == units) Constants.defaultHypoTTmmol else Constants.defaultHypoTTmgdl
+ }
+
+ /**
+ * returns the configured EatingSoon TempTarget, if this is set to 0, the Default-Value is returned.
+ *
+ * @return
+ */
+ @JvmStatic
+ fun determineEatingSoonTT(): Double {
+ val units = ProfileFunctions.getSystemUnits()
+ var value = SP.getDouble(R.string.key_eatingsoon_target, getDefaultEatingSoonTT(units))
+ value = Profile.toCurrentUnits(value)
+ return if (value > 0) value else getDefaultEatingSoonTT(units)
+ }
+
+ @JvmStatic
+ fun determineEatingSoonTTDuration(): Int {
+ val value = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration)
+ return if (value > 0) value else Constants.defaultEatingSoonTTDuration
+ }
+
+ /**
+ * returns the configured Activity TempTarget, if this is set to 0, the Default-Value is returned.
+ *
+ * @return
+ */
+ @JvmStatic
+ fun determineActivityTT(): Double {
+ val units = ProfileFunctions.getSystemUnits()
+ var value = SP.getDouble(R.string.key_activity_target, getDefaultActivityTT(units))
+ value = Profile.toCurrentUnits(value)
+ return if (value > 0) value else getDefaultActivityTT(units)
+ }
+
+ @JvmStatic
+ fun determineActivityTTDuration(): Int {
+ val value = SP.getInt(R.string.key_activity_duration, Constants.defaultActivityTTDuration)
+ return if (value > 0) value else Constants.defaultActivityTTDuration
+ }
+
+ /**
+ * returns the configured Hypo TempTarget, if this is set to 0, the Default-Value is returned.
+ *
+ * @return
+ */
+ @JvmStatic
+ fun determineHypoTT(): Double {
+ val units = ProfileFunctions.getSystemUnits()
+ var value = SP.getDouble(R.string.key_hypo_target, getDefaultHypoTT(units))
+ value = Profile.toCurrentUnits(value)
+ return if (value > 0) value else getDefaultHypoTT(units)
+ }
+
+ @JvmStatic
+ fun determineHypoTTDuration(): Int {
+ val value = SP.getInt(R.string.key_hypo_duration, Constants.defaultHypoTTDuration)
+ return if (value > 0) value else Constants.defaultHypoTTDuration
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/EspressoTestHelper.kt b/app/src/main/java/info/nightscout/androidaps/utils/EspressoTestHelper.kt
new file mode 100644
index 0000000000..7288e6679f
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/EspressoTestHelper.kt
@@ -0,0 +1,11 @@
+package info.nightscout.androidaps.utils
+
+@Synchronized
+fun isRunningTest(): Boolean {
+ return try {
+ Class.forName("androidx.test.espresso.Espresso")
+ true
+ } catch (e: ClassNotFoundException) {
+ false
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java b/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java
deleted file mode 100644
index 5308c62420..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package info.nightscout.androidaps.utils;
-
-import androidx.annotation.Nullable;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * JSonHelper is a Helper class which contains several methods to safely get data from the ggiven JSONObject.
- *
- * Created by triplem on 04.01.18.
- */
-
-public class JsonHelper {
-
- private static final Logger log = LoggerFactory.getLogger(JsonHelper.class);
-
- private JsonHelper() {}
-
- public static Object safeGetObject(JSONObject json, String fieldName, Object defaultValue) {
- Object result = defaultValue;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.get(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- @Nullable
- public static String safeGetString(JSONObject json, String fieldName) {
- String result = null;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getString(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- public static String safeGetString(JSONObject json, String fieldName, String defaultValue) {
- String result = defaultValue;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getString(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- public static double safeGetDouble(JSONObject json, String fieldName) {
- double result = 0d;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getDouble(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- public static double safeGetDouble(JSONObject json, String fieldName, double defaultValue) {
- double result = defaultValue;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getDouble(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- public static int safeGetInt(JSONObject json, String fieldName) {
- int result = 0;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getInt(fieldName);
- } catch (JSONException ignored) {
- }
- }
-
- return result;
- }
-
- public static long safeGetLong(JSONObject json, String fieldName) {
- long result = 0;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getLong(fieldName);
- } catch (JSONException e) {
- }
- }
-
- return result;
- }
-
- public static boolean safeGetBoolean(JSONObject json, String fieldName) {
- boolean result = false;
-
- if (json != null && json.has(fieldName)) {
- try {
- result = json.getBoolean(fieldName);
- } catch (JSONException e) {
- }
- }
-
- return result;
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.kt b/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.kt
new file mode 100644
index 0000000000..484f679345
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.kt
@@ -0,0 +1,126 @@
+package info.nightscout.androidaps.utils
+
+import org.json.JSONException
+import org.json.JSONObject
+
+object JsonHelper {
+ @JvmStatic
+ fun safeGetObject(json: JSONObject?, fieldName: String, defaultValue: Any): Any {
+ var result = defaultValue
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json[fieldName]
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetJSONObject(json: JSONObject?, fieldName: String, defaultValue: JSONObject?): JSONObject? {
+ var result = defaultValue
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getJSONObject(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetString(json: JSONObject?, fieldName: String): String? {
+ var result: String? = null
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getString(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetString(json: JSONObject?, fieldName: String, defaultValue: String): String {
+ var result = defaultValue
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getString(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetStringAllowNull(json: JSONObject?, fieldName: String, defaultValue: String?): String? {
+ var result = defaultValue
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getString(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetDouble(json: JSONObject?, fieldName: String): Double {
+ var result = 0.0
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getDouble(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetDouble(json: JSONObject?, fieldName: String, defaultValue: Double): Double {
+ var result = defaultValue
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getDouble(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetInt(json: JSONObject?, fieldName: String): Int {
+ var result = 0
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getInt(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetLong(json: JSONObject?, fieldName: String): Long {
+ var result: Long = 0
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getLong(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+
+ @JvmStatic
+ fun safeGetBoolean(json: JSONObject?, fieldName: String): Boolean {
+ var result = false
+ if (json != null && json.has(fieldName)) {
+ try {
+ result = json.getBoolean(fieldName)
+ } catch (ignored: JSONException) {
+ }
+ }
+ return result
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/NumberPicker.java b/app/src/main/java/info/nightscout/androidaps/utils/NumberPicker.java
index 54e676a52d..b91236ba25 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/NumberPicker.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/NumberPicker.java
@@ -154,6 +154,11 @@ public class NumberPicker extends LinearLayout implements View.OnKeyListener,
});
}
+ @Override
+ public void setTag(Object tag) {
+ editText.setTag(tag);
+ }
+
public void setOnValueChangedListener(OnValueChangedListener onValueChangedListener) {
mOnValueChangedListener = onValueChangedListener;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java
deleted file mode 100644
index cee3b7ea08..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package info.nightscout.androidaps.utils;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Handler;
-import android.os.SystemClock;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.view.ContextThemeWrapper;
-import android.text.Spanned;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-
-/**
- * Created by mike on 31.03.2017.
- */
-
-public class OKDialog {
- private static Logger log = LoggerFactory.getLogger(OKDialog.class);
-
- public static void show(final Context context, String title, String message, final Runnable runnable) {
- try {
- AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.AppTheme));
- builder.setTitle(title);
- builder.setMessage(message);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- if (runnable != null) {
- SystemClock.sleep(100);
- runOnUiThread(runnable);
- }
- }
- });
-
- builder.create().show();
- } catch (Exception e) {
- log.debug("show_dialog exception: ", e);
- }
- }
-
- public static boolean runOnUiThread(Runnable theRunnable) {
- final Handler mainHandler = new Handler(MainApp.instance().getApplicationContext().getMainLooper());
- return mainHandler.post(theRunnable);
- }
-
- public static void show(final Activity activity, String title, Spanned message, final Runnable runnable) {
- try {
- AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme));
- builder.setTitle(title);
- builder.setMessage(message);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- if (runnable != null) {
- SystemClock.sleep(100);
- activity.runOnUiThread(runnable);
- }
- }
- });
-
- builder.create().show();
- } catch (Exception e) {
- log.debug("show_dialog exception: " + e);
- }
- }
-
- public static void showConfirmation(final Activity activity, String message, final Runnable runnable) {
- AlertDialog alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
- .setMessage(message)
- .setPositiveButton(android.R.string.ok, (dialog, which) -> {
- dialog.dismiss();
- if (runnable != null) {
- SystemClock.sleep(100);
- activity.runOnUiThread(runnable);
- }
- })
- .setNegativeButton(android.R.string.cancel, null)
- .show();
- }
-
- public static void showConfirmation(final Activity activity, String message, final Runnable ok, final Runnable cancel) {
- AlertDialog alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
- .setMessage(message)
- .setPositiveButton(android.R.string.ok, (dialog, which) -> {
- dialog.dismiss();
- if (ok != null) {
- SystemClock.sleep(100);
- activity.runOnUiThread(ok);
- }
- })
- .setNegativeButton(android.R.string.cancel, (dialog, which) -> {
- dialog.dismiss();
- if (cancel != null) {
- SystemClock.sleep(100);
- activity.runOnUiThread(cancel);
- }
- })
- .show();
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.kt b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.kt
new file mode 100644
index 0000000000..1d22c380ca
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.kt
@@ -0,0 +1,203 @@
+package info.nightscout.androidaps.utils
+
+import android.app.Activity
+import android.content.Context
+import android.content.DialogInterface
+import android.os.Handler
+import android.os.SystemClock
+import android.text.Spanned
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.appcompat.app.AlertDialog
+import androidx.appcompat.view.ContextThemeWrapper
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+
+object OKDialog {
+ @JvmStatic
+ @JvmOverloads
+ fun show(context: Context, title: String, message: String, runnable: Runnable? = null) {
+ var notEmptytitle = title
+ if (notEmptytitle.isEmpty()) notEmptytitle = MainApp.gs(R.string.message)
+ val titleLayout = LayoutInflater.from(context).inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = notEmptytitle
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(context, R.style.AppTheme))
+ .setCustomTitle(titleLayout)
+ .setMessage(message)
+ .setPositiveButton(MainApp.gs(R.string.ok)) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runOnUiThread(runnable)
+ }
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ fun runOnUiThread(theRunnable: Runnable?) {
+ val mainHandler = Handler(MainApp.instance().applicationContext.mainLooper)
+ theRunnable?.let { mainHandler.post(it) }
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun show(activity: Activity, title: String, message: Spanned, runnable: Runnable? = null) {
+ var notEmptytitle = title
+ if (notEmptytitle.isEmpty()) notEmptytitle = MainApp.gs(R.string.message)
+ val titleLayout = activity.layoutInflater.inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = notEmptytitle
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(activity, R.style.AppTheme))
+ .setCustomTitle(titleLayout)
+ .setMessage(message)
+ .setPositiveButton(MainApp.gs(R.string.ok)) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runnable?.let { activity.runOnUiThread(it) }
+ }
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(activity: Activity, message: String, ok: Runnable?) {
+ showConfirmation(activity, MainApp.gs(R.string.confirmation), message, ok, null)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(activity: Activity, message: Spanned, ok: Runnable?) {
+ showConfirmation(activity, MainApp.gs(R.string.confirmation), message, ok, null)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(activity: Activity, title: String, message: Spanned, ok: Runnable?, cancel: Runnable? = null) {
+ val titleLayout = activity.layoutInflater.inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = title
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(activity, R.style.AppTheme))
+ .setMessage(message)
+ .setCustomTitle(titleLayout)
+ .setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ ok?.let { activity.runOnUiThread(it) }
+ }
+ .setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ cancel?.let { activity.runOnUiThread(it) }
+ }
+ .setNegativeButton(android.R.string.cancel, null)
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ @JvmStatic
+ fun showConfirmation(activity: Activity, title: String, message: String, ok: Runnable?, cancel: Runnable? = null) {
+ val titleLayout = activity.layoutInflater.inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = title
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(activity, R.style.AppTheme))
+ .setMessage(message)
+ .setCustomTitle(titleLayout)
+ .setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ ok?.let { activity.runOnUiThread(it) }
+ }
+ .setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ cancel?.let { activity.runOnUiThread(it) }
+ }
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(context: Context, message: Spanned, ok: Runnable?, cancel: Runnable? = null) {
+ showConfirmation(context, MainApp.gs(R.string.confirmation), message, ok, cancel)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(context: Context, title: String, message: Spanned, ok: Runnable?, cancel: Runnable? = null) {
+ val titleLayout = LayoutInflater.from(context).inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = title
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(context, R.style.AppTheme))
+ .setMessage(message)
+ .setCustomTitle(titleLayout)
+ .setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runOnUiThread(ok)
+ }
+ .setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runOnUiThread(cancel)
+ }
+ .setNegativeButton(android.R.string.cancel, null)
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(context: Context, message: String, ok: Runnable?, cancel: Runnable? = null) {
+ showConfirmation(context, MainApp.gs(R.string.confirmation), message, ok, cancel)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(context: Context, title: String, message: String, ok: Runnable?, cancel: Runnable? = null) {
+ val titleLayout = LayoutInflater.from(context).inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = title
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(context, R.style.AppTheme))
+ .setMessage(message)
+ .setCustomTitle(titleLayout)
+ .setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runOnUiThread(ok)
+ }
+ .setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ runOnUiThread(cancel)
+ }
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+
+ @JvmStatic
+ @JvmOverloads
+ fun showConfirmation(context: Context, title: String, message: String, ok: DialogInterface.OnClickListener?, cancel: DialogInterface.OnClickListener? = null) {
+ val titleLayout = LayoutInflater.from(context).inflate(R.layout.dialog_alert_custom, null)
+ (titleLayout.findViewById(R.id.alertdialog_title) as TextView).text = title
+ (titleLayout.findViewById(R.id.alertdialog_icon) as ImageView).setImageResource(R.drawable.ic_check_while_48dp)
+ AlertDialog.Builder(ContextThemeWrapper(context, R.style.AppTheme))
+ .setMessage(message)
+ .setCustomTitle(titleLayout)
+ .setPositiveButton(android.R.string.ok) { dialog: DialogInterface, which: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ ok?.onClick(dialog, which)
+ }
+ .setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, which: Int ->
+ dialog.dismiss()
+ SystemClock.sleep(100)
+ cancel?.onClick(dialog, which)
+ }
+ .show()
+ .setCanceledOnTouchOutside(false)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/PasswordProtection.java b/app/src/main/java/info/nightscout/androidaps/utils/PasswordProtection.java
index 230be97e22..6c4348bb03 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/PasswordProtection.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/PasswordProtection.java
@@ -2,10 +2,10 @@ package info.nightscout.androidaps.utils;
import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.TextView;
import info.nightscout.androidaps.MainApp;
@@ -18,10 +18,7 @@ import info.nightscout.androidaps.R;
public class PasswordProtection {
static public boolean isLocked(String preference) {
final String password = SP.getString(preference, "");
- if (password.equals("")) {
- return false;
- }
- return true;
+ return !password.equals("");
}
static public void QueryPassword(final Context context, int stringID, String preference, final Runnable ok, final Runnable fail) {
@@ -30,39 +27,38 @@ public class PasswordProtection {
if (ok != null) ok.run();
return;
}
- LayoutInflater li = LayoutInflater.from(context);
- View promptsView = li.inflate(R.layout.passwordprompt, null);
+ View promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null);
+
+ View titleLayout = LayoutInflater.from(context).inflate(R.layout.dialog_alert_custom, null);
+ ((TextView) titleLayout.findViewById(R.id.alertdialog_title)).setText(R.string.confirmation);
+ ((ImageView) titleLayout.findViewById(R.id.alertdialog_icon)).setImageResource(R.drawable.ic_check_while_48dp);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setView(promptsView);
+ alertDialogBuilder.setCustomTitle(titleLayout);
- final TextView label = (TextView) promptsView.findViewById(R.id.passwordprompt_text);
+ final TextView label = promptsView.findViewById(R.id.passwordprompt_text);
label.setText(MainApp.gs(stringID));
- final EditText userInput = (EditText) promptsView.findViewById(R.id.passwordprompt_pass);
+ final EditText userInput = promptsView.findViewById(R.id.passwordprompt_pass);
// set dialog message
alertDialogBuilder
.setCancelable(false)
- .setPositiveButton("OK",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,int id) {
- String enteredPassword = userInput.getText().toString();
- if (password.equals(enteredPassword)) {
- if (ok != null) ok.run();
- } else {
- ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.wrongpassword));
- if (fail != null) fail.run();
- }
+ .setPositiveButton(android.R.string.ok,
+ (dialog, id) -> {
+ String enteredPassword = userInput.getText().toString();
+ if (password.equals(enteredPassword)) {
+ if (ok != null) ok.run();
+ } else {
+ ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.wrongpassword));
+ if (fail != null) fail.run();
}
})
- .setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,int id) {
- dialog.cancel();
- }
- });
+ .setNegativeButton(android.R.string.cancel,
+ (dialog, id) -> dialog.cancel());
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
+ alertDialog.setCanceledOnTouchOutside(false);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/SP.java b/app/src/main/java/info/nightscout/androidaps/utils/SP.java
index e45e650ace..191fd9421b 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/SP.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/SP.java
@@ -3,6 +3,8 @@ package info.nightscout.androidaps.utils;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
+import java.util.Map;
+
import info.nightscout.androidaps.MainApp;
/**
@@ -12,6 +14,10 @@ import info.nightscout.androidaps.MainApp;
public class SP {
private static SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
+ static public Map getAll() {
+ return sharedPreferences.getAll();
+ }
+
static public void clear() {
sharedPreferences.edit().clear().apply();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TIR.kt b/app/src/main/java/info/nightscout/androidaps/utils/TIR.kt
new file mode 100644
index 0000000000..5f2ea9bbaf
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/TIR.kt
@@ -0,0 +1,26 @@
+package info.nightscout.androidaps.utils
+
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import kotlin.math.roundToInt
+
+class TIR(val date: Long, val lowThreshold: Double, val highThreshold: Double) {
+ internal var below = 0
+ internal var inRange = 0
+ internal var above = 0
+ internal var error = 0
+ internal var count = 0
+
+ fun error() = run { error++ }
+ fun below() = run { below++; count++ }
+ fun inRange() = run { inRange++; count++ }
+ fun above() = run { above++; count++ }
+
+ fun belowPct() = if (count > 0) (below.toDouble() / count * 100.0).roundToInt() else 0
+ fun inRangePct() = if (count > 0) (inRange.toDouble() / count * 100.0).roundToInt() else 0
+ fun abovePct() = if (count > 0) (above.toDouble() / count * 100.0).roundToInt() else 0
+
+ fun toText(): String = MainApp.gs(R.string.tirformat, DateUtil.dateStringShort(date), belowPct(), inRangePct(), abovePct())
+
+ fun toText(days: Int): String = MainApp.gs(R.string.tirformat, "%02d".format(days) + " " + MainApp.gs(R.string.days), belowPct(), inRangePct(), abovePct())
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TddCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/TddCalculator.kt
new file mode 100644
index 0000000000..0210247eb3
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/TddCalculator.kt
@@ -0,0 +1,81 @@
+package info.nightscout.androidaps.utils
+
+import android.text.Spanned
+import android.util.LongSparseArray
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.db.TDD
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
+import org.slf4j.LoggerFactory
+
+object TddCalculator : TreatmentsPlugin() {
+ private val log = LoggerFactory.getLogger(L.DATATREATMENTS)
+
+ fun calculate(days: Long): LongSparseArray {
+ val range = T.days(days + 1).msecs()
+ val startTime = MidnightTime.calc(DateUtil.now()) - T.days(days).msecs()
+ val endTime = MidnightTime.calc(DateUtil.now())
+ initializeData(range)
+
+ val result = LongSparseArray()
+ for (t in treatmentsFromHistory) {
+ if (!t.isValid) continue
+ if (t.date < startTime || t.date > endTime) continue
+ val midnight = MidnightTime.calc(t.date)
+ val tdd = result[midnight] ?: TDD(midnight, 0.0, 0.0, 0.0)
+ tdd.bolus += t.insulin
+ result.put(midnight, tdd)
+ }
+
+ for (t in startTime until endTime step T.mins(5).msecs()) {
+ val midnight = MidnightTime.calc(t)
+ val tdd = result[midnight] ?: TDD(midnight, 0.0, 0.0, 0.0)
+ val tbr = getTempBasalFromHistory(t)
+ val profile = ProfileFunctions.getInstance().getProfile(t) ?: continue
+ val absoluteRate = tbr?.tempBasalConvertedToAbsolute(t, profile) ?: profile.getBasal(t)
+ tdd.basal += absoluteRate / 60.0 * 5.0
+ result.put(midnight, tdd)
+ }
+ for (i in 0 until result.size()) {
+ val tdd = result.valueAt(i)
+ tdd.total = tdd.bolus + tdd.basal
+ }
+ log.debug(result.toString())
+ return result
+ }
+
+ fun averageTDD(tdds: LongSparseArray): TDD {
+ val totalTdd = TDD()
+ for (i in 0 until tdds.size()) {
+ val tdd = tdds.valueAt(i)
+ totalTdd.basal += tdd.basal
+ totalTdd.bolus += tdd.bolus
+ totalTdd.total += tdd.total
+ }
+ totalTdd.basal /= tdds.size().toDouble()
+ totalTdd.bolus /= tdds.size().toDouble()
+ totalTdd.total /= tdds.size().toDouble()
+ return totalTdd
+ }
+
+ fun stats(): Spanned {
+ val tdds = calculate(7)
+ val averageTdd = averageTDD(tdds)
+ return HtmlHelper.fromHtml(
+ "" + MainApp.gs(R.string.tdd) + ":
" +
+ toText(tdds) +
+ "" + MainApp.gs(R.string.average) + ":
" +
+ averageTdd.toText(tdds.size())
+ )
+ }
+
+ fun toText(tdds: LongSparseArray): String {
+ var t = ""
+ for (i in 0 until tdds.size()) {
+ t += "${tdds.valueAt(i).toText()}
"
+ }
+ return t
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java
index d9ed263c98..0143377bb2 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java
@@ -50,6 +50,7 @@ public class TimeListEdit {
private Context context;
private View view;
private int resLayoutId;
+ private String tagPrefix;
private String label;
private JSONArray data1;
private JSONArray data2;
@@ -63,10 +64,11 @@ public class TimeListEdit {
private int inflatedUntil = -1;
- public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double min, double max, double step, NumberFormat formatter, Runnable save) {
+ public TimeListEdit(Context context, View view, int resLayoutId, String tagPrefix, String label, JSONArray data1, JSONArray data2, double min, double max, double step, NumberFormat formatter, Runnable save) {
this.context = context;
this.view = view;
this.resLayoutId = resLayoutId;
+ this.tagPrefix = tagPrefix;
this.label = label;
this.data1 = data1;
this.data2 = data2;
@@ -185,7 +187,7 @@ public class TimeListEdit {
int before, int count) {
}
});
-
+ numberPickers1[position].setTag(tagPrefix +"-1-" + position);
numberPickers2[position].setTextWatcher(new TextWatcher() {
@Override
@@ -205,6 +207,7 @@ public class TimeListEdit {
int before, int count) {
}
});
+ numberPickers2[position].setTag(tagPrefix +"-2-" + position);
layout.addView(childView);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TirCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/TirCalculator.kt
new file mode 100644
index 0000000000..4e41f9a331
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/TirCalculator.kt
@@ -0,0 +1,85 @@
+package info.nightscout.androidaps.utils
+
+import android.text.Spanned
+import android.util.LongSparseArray
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.Profile
+
+object TirCalculator {
+ fun calculate(days: Long, lowMgdl: Double, highMgdl: Double): LongSparseArray {
+ if (lowMgdl < 39) throw RuntimeException("Low below 39")
+ if (lowMgdl > highMgdl) throw RuntimeException("Low > High")
+ val startTime = MidnightTime.calc(DateUtil.now()) - T.days(days).msecs()
+ val endTime = MidnightTime.calc(DateUtil.now())
+
+ val bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime(startTime, endTime, true)
+ val result = LongSparseArray()
+ for (bg in bgReadings) {
+ val midnight = MidnightTime.calc(bg.date)
+ var tir = result[midnight]
+ if (tir == null) {
+ tir = TIR(midnight, lowMgdl, highMgdl)
+ result.append(midnight, tir)
+ }
+ if (bg.value < 39) tir.error()
+ if (bg.value >= 39 && bg.value < lowMgdl) tir.below()
+ if (bg.value in lowMgdl..highMgdl) tir.inRange()
+ if (bg.value > highMgdl) tir.above()
+ }
+ return result
+ }
+
+ fun averageTIR(tirs: LongSparseArray): TIR {
+ val totalTir = if (tirs.size() > 0) {
+ TIR(tirs.valueAt(0).date, tirs.valueAt(0).lowThreshold, tirs.valueAt(0).highThreshold)
+ } else {
+ TIR(7, 70.0, 180.0)
+ }
+ for (i in 0 until tirs.size()) {
+ val tir = tirs.valueAt(i)
+ totalTir.below += tir.below
+ totalTir.inRange += tir.inRange
+ totalTir.above += tir.above
+ totalTir.error += tir.error
+ totalTir.count += tir.count
+ }
+ return totalTir
+ }
+
+ fun stats(): Spanned {
+ val lowTirMgdl = Constants.STATS_RANGE_LOW_MMOL * Constants.MMOLL_TO_MGDL
+ val highTirMgdl = Constants.STATS_RANGE_HIGH_MMOL * Constants.MMOLL_TO_MGDL
+ val lowTitMgdl = Constants.STATS_TARGET_LOW_MMOL * Constants.MMOLL_TO_MGDL
+ val highTitMgdl = Constants.STATS_TARGET_HIGH_MMOL * Constants.MMOLL_TO_MGDL
+
+ val tir7 = calculate(7, lowTirMgdl, highTirMgdl)
+ val averageTir7 = averageTIR(tir7)
+ val tir30 = calculate(30, lowTirMgdl, highTirMgdl)
+ val averageTir30 = averageTIR(tir30)
+ val tit7 = calculate(7, lowTitMgdl, highTitMgdl)
+ val averageTit7 = averageTIR(tit7)
+ val tit30 = calculate(30, lowTitMgdl, highTitMgdl)
+ val averageTit30 = averageTIR(tit30)
+ return HtmlHelper.fromHtml(
+ "
" + MainApp.gs(R.string.tir) + ":
" +
+ toText(tir7) +
+ "
" + MainApp.gs(R.string.average) + " (" + Profile.toCurrentUnitsString(lowTirMgdl) + "-" + Profile.toCurrentUnitsString(highTirMgdl) + "):
" +
+ averageTir7.toText(tir7.size()) + "
" +
+ averageTir30.toText(tir30.size()) +
+ "
" + MainApp.gs(R.string.average) + " (" + Profile.toCurrentUnitsString(lowTitMgdl) + "-" + Profile.toCurrentUnitsString(highTitMgdl) + "):
" +
+ averageTit7.toText(tit7.size()) + "
" +
+ averageTit30.toText(tit30.size())
+ )
+ }
+
+ fun toText(tirs: LongSparseArray): String {
+ var t = ""
+ for (i in 0 until tirs.size()) {
+ t += "${tirs.valueAt(i).toText()}
"
+ }
+ return t
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/UIUtils.kt b/app/src/main/java/info/nightscout/androidaps/utils/UIUtils.kt
new file mode 100644
index 0000000000..99c4a4af31
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/utils/UIUtils.kt
@@ -0,0 +1,10 @@
+package info.nightscout.androidaps.utils
+
+import android.view.View
+
+/**
+ * Created by adrian on 2019-12-20.
+ */
+
+fun Boolean.toVisibility() = if (this) View.VISIBLE else View.GONE
+
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java
index 404a082112..4354ccd528 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java
@@ -1,11 +1,9 @@
package info.nightscout.androidaps.utils;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import androidx.appcompat.app.AlertDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -25,20 +23,10 @@ import info.nightscout.androidaps.services.Intents;
public class XdripCalibrations {
private static Logger log = LoggerFactory.getLogger(XdripCalibrations.class);
- public static void confirmAndSendCalibration(final Double bg, Context parentContext) {
+ public static void confirmAndSendCalibration(final Double bg, final Context parentContext) {
if (parentContext != null) {
String confirmMessage = String.format(MainApp.gs(R.string.send_calibration), bg);
-
- AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
- builder.setTitle(MainApp.gs(R.string.confirmation));
- builder.setMessage(confirmMessage);
- builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- sendIntent(bg);
- }
- });
- builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
- builder.show();
+ OKDialog.showConfirmation(parentContext, confirmMessage, () -> sendIntent(bg));
}
}
diff --git a/app/src/main/res/drawable/ic_action_orange_48dp.xml b/app/src/main/res/drawable/ic_action_orange_48dp.xml
new file mode 100644
index 0000000000..07e8c306a8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_action_orange_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_bluetooth_white_48dp.xml b/app/src/main/res/drawable/ic_bluetooth_white_48dp.xml
new file mode 100644
index 0000000000..f5f2fa4797
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bluetooth_white_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_check_while_48dp.xml b/app/src/main/res/drawable/ic_check_while_48dp.xml
new file mode 100644
index 0000000000..2c136685ec
--- /dev/null
+++ b/app/src/main/res/drawable/ic_check_while_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_error_red_48dp.xml b/app/src/main/res/drawable/ic_error_red_48dp.xml
new file mode 100644
index 0000000000..b3666f2662
--- /dev/null
+++ b/app/src/main/res/drawable/ic_error_red_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_trending_flat_white_48dp.xml b/app/src/main/res/drawable/ic_trending_flat_white_48dp.xml
new file mode 100644
index 0000000000..a9bd780027
--- /dev/null
+++ b/app/src/main/res/drawable/ic_trending_flat_white_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_trigger_green_48dp.xml b/app/src/main/res/drawable/ic_trigger_green_48dp.xml
new file mode 100644
index 0000000000..1bfc8d3e0d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_trigger_green_48dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml
index 3e809b3b02..77a5ab00dd 100644
--- a/app/src/main/res/layout/actions_fragment.xml
+++ b/app/src/main/res/layout/actions_fragment.xml
@@ -1,138 +1,275 @@
-
-
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
-
+ android:layout_marginTop="15dp"
+ android:paddingStart="15dp"
+ android:paddingEnd="15dp"
+ android:text="@string/actions" />
+
+
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/careportal_profileswitch"
+
+ app:layout_column="0"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="0" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/careportal_temporarytarget"
+
+ app:layout_column="1"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="0" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/overview_tempbasal_button"
+
+ app:layout_column="0"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="1" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/canceltemp"
+ android:visibility="gone"
+
+ app:layout_column="0"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="1" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/overview_extendedbolus_button"
+
+ app:layout_column="1"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="1" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/overview_extendedbolus_cancel_button"
+ android:visibility="gone"
+
+ app:layout_column="1"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="1" />
+
+
+
+
+
+
+
+
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/primefill"
+
+ app:layout_column="1"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="2" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/nav_historybrowser"
+ app:layout_column="0"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="4" />
+ android:paddingLeft="0dp"
+ android:paddingRight="0dp"
+ android:text="@string/danar_stats_tdd"
-
+ app:layout_column="1"
+ app:layout_columnWeight="1"
+ app:layout_gravity="fill"
+ app:layout_row="4" />
-
+
-
+
+
+
diff --git a/app/src/main/res/layout/activity_setupwizard.xml b/app/src/main/res/layout/activity_setupwizard.xml
index 2c2930b827..1a9a7aad94 100644
--- a/app/src/main/res/layout/activity_setupwizard.xml
+++ b/app/src/main/res/layout/activity_setupwizard.xml
@@ -13,6 +13,7 @@
android:orientation="horizontal">
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".plugins.general.automation.dialogs.EditActionDialog">
-
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/automation_dialog_choose_action.xml b/app/src/main/res/layout/automation_dialog_choose_action.xml
index 8a2d714067..029ba36b07 100644
--- a/app/src/main/res/layout/automation_dialog_choose_action.xml
+++ b/app/src/main/res/layout/automation_dialog_choose_action.xml
@@ -3,26 +3,56 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".plugins.general.automation.dialogs.EditEventDialog">
+ android:orientation="vertical">
-
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+
+
+
+
+
+
+
+ android:padding="10dp"/>
diff --git a/app/src/main/res/layout/automation_dialog_choose_trigger.xml b/app/src/main/res/layout/automation_dialog_choose_trigger.xml
index 8589096af7..11b874b3eb 100644
--- a/app/src/main/res/layout/automation_dialog_choose_trigger.xml
+++ b/app/src/main/res/layout/automation_dialog_choose_trigger.xml
@@ -3,26 +3,49 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".plugins.general.automation.dialogs.EditEventDialog">
+ android:orientation="vertical">
-
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+
+
+
+
+
+ android:padding="10dp"/>
diff --git a/app/src/main/res/layout/automation_dialog_edit_trigger.xml b/app/src/main/res/layout/automation_dialog_edit_trigger.xml
index 594a78055e..a30a54ce4b 100644
--- a/app/src/main/res/layout/automation_dialog_edit_trigger.xml
+++ b/app/src/main/res/layout/automation_dialog_edit_trigger.xml
@@ -3,27 +3,49 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".plugins.general.automation.dialogs.EditEventDialog">
+ android:orientation="vertical">
-
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/automation_dialog_event.xml b/app/src/main/res/layout/automation_dialog_event.xml
index d440b8cf27..03ff617168 100644
--- a/app/src/main/res/layout/automation_dialog_event.xml
+++ b/app/src/main/res/layout/automation_dialog_event.xml
@@ -1,112 +1,171 @@
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".plugins.general.automation.dialogs.EditEventDialog">
-
-
-
-
+ android:orientation="vertical">
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
-
+ android:contentDescription="@string/automation"
+ android:src="@drawable/ic_action_orange_48dp" />
+ android:layout_centerInParent="true"
+ android:layout_gravity="center"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
+ android:text="@string/automation_event"
+ android:textAlignment="center"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
-
-
-
+ android:orientation="horizontal"
+ android:padding="5dp" />
-
+ android:padding="10dp"
+ android:orientation="vertical">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp"
+ android:orientation="vertical" />
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/automation_fragment.xml b/app/src/main/res/layout/automation_fragment.xml
index 2f24e1b70c..57ba8c60e0 100644
--- a/app/src/main/res/layout/automation_fragment.xml
+++ b/app/src/main/res/layout/automation_fragment.xml
@@ -18,6 +18,7 @@
android:id="@+id/automation_logView"
android:layout_width="match_parent"
android:layout_height="100dp"
+ android:scrollbars = "vertical"
android:layout_alignParentBottom="true" />
diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
index fc0fa1ea49..4251efd3a2 100644
--- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
+++ b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
@@ -544,7 +544,7 @@
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
- android:text="@string/careportal_newnstreatment_eventtime_label"
+ android:text="@string/event_time_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
diff --git a/app/src/main/res/layout/careportal_stats_fragment_short.xml b/app/src/main/res/layout/careportal_stats_fragment_short.xml
deleted file mode 100644
index 482d4321cb..0000000000
--- a/app/src/main/res/layout/careportal_stats_fragment_short.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/close.xml b/app/src/main/res/layout/close.xml
index a500295275..682cf2bc22 100644
--- a/app/src/main/res/layout/close.xml
+++ b/app/src/main/res/layout/close.xml
@@ -1,25 +1,11 @@
-
@@ -27,8 +13,7 @@
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
style="@style/mdtp_ActionButton.Text"
- android:text="@string/close_navigation" />
+ android:text="@string/close" />
diff --git a/app/src/main/res/layout/danar_historyactivity.xml b/app/src/main/res/layout/danar_historyactivity.xml
index 3324a98029..ea371daedb 100644
--- a/app/src/main/res/layout/danar_historyactivity.xml
+++ b/app/src/main/res/layout/danar_historyactivity.xml
@@ -3,74 +3,91 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".plugins.pump.danaR.activities.DanaRHistoryActivity">
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+ android:layout_marginEnd="20dp" />
+ android:layout_height="match_parent"
+ android:layout_above="@id/danar_history_reload"
+ android:layout_below="@+id/danar_history_status" />
-
-
-
-
-
+ android:drawableStart="@drawable/icon_actions_refill"
+ android:text="@string/danar_historyreload" />
diff --git a/app/src/main/res/layout/danar_user_options.xml b/app/src/main/res/layout/danar_user_options.xml
deleted file mode 100644
index 517e921f10..0000000000
--- a/app/src/main/res/layout/danar_user_options.xml
+++ /dev/null
@@ -1,404 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/danar_user_options_activity.xml b/app/src/main/res/layout/danar_user_options_activity.xml
new file mode 100644
index 0000000000..489e174fe6
--- /dev/null
+++ b/app/src/main/res/layout/danar_user_options_activity.xml
@@ -0,0 +1,328 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/danars_blescanner_activity.xml b/app/src/main/res/layout/danars_blescanner_activity.xml
index e6173a26c3..654f8c1fb6 100644
--- a/app/src/main/res/layout/danars_blescanner_activity.xml
+++ b/app/src/main/res/layout/danars_blescanner_activity.xml
@@ -1,10 +1,38 @@
-
+
+
+
+
+
+
+
+
-
+
diff --git a/app/src/main/res/layout/danars_pairingprogressdialog.xml b/app/src/main/res/layout/danars_pairingprogressdialog.xml
index a94aba0b67..496c4a90f6 100644
--- a/app/src/main/res/layout/danars_pairingprogressdialog.xml
+++ b/app/src/main/res/layout/danars_pairingprogressdialog.xml
@@ -1,15 +1,45 @@
-
+ android:orientation="vertical"
+ tools:context=".plugins.pump.danaRS.dialogs.PairingProgressDialog" >
-
+ android:layout_gravity="center"
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+
+
+
+
+
+
+
-
-
+
diff --git a/app/src/main/res/layout/datetime.xml b/app/src/main/res/layout/datetime.xml
new file mode 100644
index 0000000000..043c7de761
--- /dev/null
+++ b/app/src/main/res/layout/datetime.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_alert_custom.xml b/app/src/main/res/layout/dialog_alert_custom.xml
new file mode 100644
index 0000000000..eea5fc6882
--- /dev/null
+++ b/app/src/main/res/layout/dialog_alert_custom.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_bolusprogress_dialog.xml b/app/src/main/res/layout/dialog_bolusprogress.xml
similarity index 56%
rename from app/src/main/res/layout/overview_bolusprogress_dialog.xml
rename to app/src/main/res/layout/dialog_bolusprogress.xml
index 2abd9d4e80..e2da43a067 100644
--- a/app/src/main/res/layout/overview_bolusprogress_dialog.xml
+++ b/app/src/main/res/layout/dialog_bolusprogress.xml
@@ -3,10 +3,43 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context=".plugins.general.overview.dialogs.BolusProgressDialog"
- android:paddingTop="15dp"
- android:paddingBottom="15dp">
+ tools:context=".dialogs.BolusProgressDialog"
+>
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_calibration.xml b/app/src/main/res/layout/dialog_calibration.xml
new file mode 100644
index 0000000000..1dbd83bd40
--- /dev/null
+++ b/app/src/main/res/layout/dialog_calibration.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_carbs.xml b/app/src/main/res/layout/dialog_carbs.xml
new file mode 100644
index 0000000000..fdf83cff5b
--- /dev/null
+++ b/app/src/main/res/layout/dialog_carbs.xml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_care.xml b/app/src/main/res/layout/dialog_care.xml
new file mode 100644
index 0000000000..500b118afa
--- /dev/null
+++ b/app/src/main/res/layout/dialog_care.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_error.xml b/app/src/main/res/layout/dialog_error.xml
new file mode 100644
index 0000000000..42ad93318d
--- /dev/null
+++ b/app/src/main/res/layout/dialog_error.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_extendedbolus.xml b/app/src/main/res/layout/dialog_extendedbolus.xml
new file mode 100644
index 0000000000..26c15117a7
--- /dev/null
+++ b/app/src/main/res/layout/dialog_extendedbolus.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/actions_fill_dialog.xml b/app/src/main/res/layout/dialog_fill.xml
similarity index 62%
rename from app/src/main/res/layout/actions_fill_dialog.xml
rename to app/src/main/res/layout/dialog_fill.xml
index ce52f25abb..3e0bed7478 100644
--- a/app/src/main/res/layout/actions_fill_dialog.xml
+++ b/app/src/main/res/layout/dialog_fill.xml
@@ -1,79 +1,86 @@
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:focusableInTouchMode="true"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ tools:context=".dialogs.FillDialog">
+ android:orientation="vertical">
-
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+ android:textAlignment="center"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
-
+
+
+
+ android:orientation="vertical"
+ android:padding="5dp">
-
-
+ android:orientation="horizontal">
+ android:width="120dp"
+ android:padding="10dp"
+ android:text="@string/overview_insulin_label"
+ android:textStyle="bold" />
-
+ android:layout_height="wrap_content"
+ android:padding="5dp">
-
diff --git a/app/src/main/res/layout/dialog_insulin.xml b/app/src/main/res/layout/dialog_insulin.xml
new file mode 100644
index 0000000000..9ed84e4779
--- /dev/null
+++ b/app/src/main/res/layout/dialog_insulin.xml
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_profileswitch.xml b/app/src/main/res/layout/dialog_profileswitch.xml
new file mode 100644
index 0000000000..e726097369
--- /dev/null
+++ b/app/src/main/res/layout/dialog_profileswitch.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_profileviewer.xml b/app/src/main/res/layout/dialog_profileviewer.xml
new file mode 100644
index 0000000000..c55ea7027c
--- /dev/null
+++ b/app/src/main/res/layout/dialog_profileviewer.xml
@@ -0,0 +1,426 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_tempbasal.xml b/app/src/main/res/layout/dialog_tempbasal.xml
new file mode 100644
index 0000000000..c748960c33
--- /dev/null
+++ b/app/src/main/res/layout/dialog_tempbasal.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_temptarget.xml b/app/src/main/res/layout/dialog_temptarget.xml
new file mode 100644
index 0000000000..be4258ec5c
--- /dev/null
+++ b/app/src/main/res/layout/dialog_temptarget.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_treatment.xml b/app/src/main/res/layout/dialog_treatment.xml
new file mode 100644
index 0000000000..47c406a0fd
--- /dev/null
+++ b/app/src/main/res/layout/dialog_treatment.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_wizard_dialog.xml b/app/src/main/res/layout/dialog_wizard.xml
similarity index 93%
rename from app/src/main/res/layout/overview_wizard_dialog.xml
rename to app/src/main/res/layout/dialog_wizard.xml
index 71ce0e31e9..e7074ecb45 100644
--- a/app/src/main/res/layout/overview_wizard_dialog.xml
+++ b/app/src/main/res/layout/dialog_wizard.xml
@@ -1,44 +1,54 @@
-
+ tools:context=".dialogs.InsulinDialog">
-
+ android:background="@color/dialog_title_background"
+ android:orientation="horizontal"
+ android:padding="5dp">
+ android:contentDescription="@string/boluswizard"
+ android:src="@drawable/icon_calculator" />
+ android:textAlignment="center"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
-
+
+
+
@@ -65,9 +75,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:gravity="left"
- android:paddingLeft="5dp"
- android:text="mg/dl"
+ android:gravity="start"
+ android:padding="5dp"
+ android:text="@string/mgdl"
android:textAppearance="?android:attr/textAppearanceSmall" />
@@ -96,8 +106,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:gravity="left"
- android:paddingLeft="5dp"
+ android:gravity="start"
+ android:padding="5dp"
android:text="@string/shortgramm"
android:textAppearance="?android:attr/textAppearanceSmall" />
@@ -126,8 +136,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:gravity="left"
- android:paddingStart="5dp"
+ android:gravity="start"
+ android:padding="5dp"
android:text="@string/insulin_unit_shortname"
android:textAppearance="?android:attr/textAppearanceSmall" />
@@ -156,8 +166,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:gravity="left"
- android:paddingStart="5dp"
+ android:gravity="start"
+ android:padding="5dp"
android:text="@string/unit_minute_short"
android:textAppearance="?android:attr/textAppearanceSmall" />
@@ -165,7 +175,7 @@
-
@@ -251,7 +262,7 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:autofillHints="@string/careportal_newnstreatment_notes_label"
- android:gravity="left"
+ android:gravity="start"
android:inputType="text|textCapSentences"
android:textAppearance="?android:attr/textAppearanceSmall" />
@@ -261,10 +272,10 @@
android:id="@+id/done_background"
android:layout_width="match_parent"
android:layout_height="56dp"
- android:orientation="horizontal"
+ android:layout_gravity="center_vertical"
android:background="@android:color/transparent"
- android:layout_gravity="center_vertical"
- android:paddingBottom="8dp">
+ android:orientation="horizontal"
+ android:padding="5dp">
+ android:src="@drawable/ic_visibility" />
@@ -312,7 +322,8 @@
+ android:layout_height="wrap_content"
+ android:padding="5dp">
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/overview_calibration_dialog.xml b/app/src/main/res/layout/overview_calibration_dialog.xml
deleted file mode 100644
index 7caca56269..0000000000
--- a/app/src/main/res/layout/overview_calibration_dialog.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_error_dialog.xml b/app/src/main/res/layout/overview_error_dialog.xml
deleted file mode 100644
index 41a9dcac00..0000000000
--- a/app/src/main/res/layout/overview_error_dialog.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml
index 8741cf1c2a..467c8c171a 100644
--- a/app/src/main/res/layout/overview_fragment.xml
+++ b/app/src/main/res/layout/overview_fragment.xml
@@ -1,518 +1,583 @@
-
+
-
+
-
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
-
+
+
+
+
+ app:layout_constraintBottom_toTopOf="@+id/overview_pumpstatuslayout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_notifications">
-
+
-
-
+
+
+
+
+
+
+
+
+ android:layout_marginLeft="5dp"
+ android:layout_marginRight="5dp"
+ android:gravity="center_vertical|center_horizontal"
+ android:paddingTop="3dp"
+ android:paddingBottom="3dp"
+ android:text="@string/initializing"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
-
- android:textAppearance="?android:attr/textAppearanceSmall" />
+
-
-
-
-
-
-
-
-
+ android:text="00.0"
+ android:textSize="42sp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_arrow"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
-
-
-
+ android:layout_marginTop="5dp"
+ android:paddingStart="-2dp"
+ android:paddingEnd="0dp"
+ android:text="→"
+ android:textSize="28sp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_bg_guideline"
+ app:layout_constraintStart_toEndOf="@+id/overview_bg"
+ app:layout_constraintTop_toTopOf="@+id/overview_bg" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:text=" "
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_bg_guideline"
+ app:layout_constraintStart_toEndOf="@+id/overview_arrow"
+ app:layout_constraintTop_toTopOf="@+id/overview_bg" />
-
-
-
-
-
-
+ android:text="1 min ago"
+ android:textSize="14sp"
+ app:layout_constraintBottom_toTopOf="@+id/overview_delta"
+ app:layout_constraintEnd_toEndOf="@+id/overview_arrow"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_bg" />
-
+
-
+
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:layout_marginStart="10dp"
+ android:text="0.50U/h @17:35 1/30min"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="@+id/overview_extendedbolus_label"
+ app:layout_constraintStart_toEndOf="@+id/overview_extendedbolus_colon" />
-
-
-
-
-
-
-
-
-
-
+
+ android:layout_height="wrap_content"
+ android:text="@string/sensitivity_short"
+ android:textSize="16sp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/overview_bg_guideline"
+ app:layout_constraintTop_toBottomOf="@+id/overview_extendedbolus_label" />
-
+
-
+
-
+
+ app:layout_constraintBottom_toTopOf="@+id/overview_bggraph"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
-
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text=""
+ android:textSize="14sp" />
+
+
+
+
+
+
+
+
+
-
+
+
+ android:layout_marginTop="5dp"
+ android:layout_marginEnd="5dp"
+ android:contentDescription="@string/chartmenu"
+ app:layout_constraintEnd_toEndOf="@+id/overview_bggraph"
+ app:layout_constraintTop_toTopOf="@+id/overview_bggraph"
+ app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/overview_fragment_nsclient.xml b/app/src/main/res/layout/overview_fragment_nsclient.xml
index ddc6801651..fa086ab00b 100644
--- a/app/src/main/res/layout/overview_fragment_nsclient.xml
+++ b/app/src/main/res/layout/overview_fragment_nsclient.xml
@@ -1,4 +1,5 @@
-
+
+ android:id="@+id/overview_toppart_scrollbar"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toTopOf="@id/overview_buttons_layout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
-
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toTopOf="@+id/overview_looplayout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
-
+ app:layout_constraintBottom_toTopOf="@+id/overview_pumpstatuslayout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_notifications">
+ android:paddingBottom="3dp"
+ android:text="@string/openloop"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/overview_activeprofile"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:paddingBottom="3dp"
+ android:text="@string/profile"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/overview_temptarget"
+ app:layout_constraintStart_toEndOf="@+id/overview_apsmode"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:textColor="@color/mdtp_white"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/overview_activeprofile"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
+ app:layout_constraintBottom_toTopOf="@+id/bg_tbr_layout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_looplayout">
+
-
+ android:orientation="horizontal"
+ app:layout_constraintBottom_toTopOf="@+id/overview_statuslights_nscl"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_pumpstatuslayout">
+ android:textSize="42sp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_arrow"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:textSize="28sp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_bg_guideline"
+ app:layout_constraintStart_toEndOf="@+id/overview_bg"
+ app:layout_constraintTop_toTopOf="@+id/overview_bg" />
+ android:text=" "
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/overview_bg_guideline"
+ app:layout_constraintStart_toEndOf="@+id/overview_arrow"
+ app:layout_constraintTop_toTopOf="@+id/overview_bg" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:textSize="16sp"
+ android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="@+id/overview_sensitivity_label"
+ app:layout_constraintStart_toEndOf="@+id/overview_sensitivity_colon" />
-
+
-
+
+
+
+ android:paddingStart="2dp"
+ android:paddingEnd="1dp"
+ android:scaleType="centerInside"
+ android:src="@drawable/icon_cp_age_canula" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:paddingStart="4sp"
+ android:paddingEnd="4sp"
+ android:text="Pump: running"
+ android:textColor="@android:color/white"
+ android:textSize="16sp"
+ app:layout_constraintBottom_toTopOf="@+id/overview_openaps"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_statuslights_nscl" />
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_centerInParent="true"
+ android:text=""
+ android:textSize="15sp"
+ app:layout_constraintBottom_toBottomOf="@+id/overview_bggraph"
+ app:layout_constraintEnd_toEndOf="@+id/overview_bggraph"
+ app:layout_constraintStart_toStartOf="@+id/overview_bggraph"
+ app:layout_constraintTop_toTopOf="@+id/overview_bggraph" />
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/overview_fragment_nsclient_tablet.xml b/app/src/main/res/layout/overview_fragment_nsclient_tablet.xml
index 6dd854c0a6..07f3324f4b 100644
--- a/app/src/main/res/layout/overview_fragment_nsclient_tablet.xml
+++ b/app/src/main/res/layout/overview_fragment_nsclient_tablet.xml
@@ -27,54 +27,62 @@
-
+ app:layout_constraintBottom_toTopOf="@+id/overview_pumpstatuslayout"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/overview_notifications">
+ android:paddingBottom="3dp"
+ android:text="@string/openloop"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/overview_activeprofile"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:paddingBottom="3dp"
+ android:text="@string/profile"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/overview_temptarget"
+ app:layout_constraintStart_toEndOf="@+id/overview_apsmode"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:textColor="@color/mdtp_white"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/overview_activeprofile"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/overview_newcarbs_dialog.xml b/app/src/main/res/layout/overview_newcarbs_dialog.xml
deleted file mode 100644
index 457e11c15d..0000000000
--- a/app/src/main/res/layout/overview_newcarbs_dialog.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml b/app/src/main/res/layout/overview_newextendedbolus_dialog.xml
deleted file mode 100644
index b3a17229d3..0000000000
--- a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_newinsulin_dialog.xml b/app/src/main/res/layout/overview_newinsulin_dialog.xml
deleted file mode 100644
index a3f3b6d56f..0000000000
--- a/app/src/main/res/layout/overview_newinsulin_dialog.xml
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/overview_newtempbasal_dialog.xml b/app/src/main/res/layout/overview_newtempbasal_dialog.xml
deleted file mode 100644
index 1bd77a26e0..0000000000
--- a/app/src/main/res/layout/overview_newtempbasal_dialog.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_newtreatment_dialog.xml b/app/src/main/res/layout/overview_newtreatment_dialog.xml
deleted file mode 100644
index 9aec3699e9..0000000000
--- a/app/src/main/res/layout/overview_newtreatment_dialog.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/spinner_centered.xml b/app/src/main/res/layout/spinner_centered.xml
index cfa5773725..8e633c7356 100644
--- a/app/src/main/res/layout/spinner_centered.xml
+++ b/app/src/main/res/layout/spinner_centered.xml
@@ -3,6 +3,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
- android:paddingBottom="5dp"
android:paddingTop="5dp"
+ android:paddingBottom="5dp"
+ android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="#FFFFFF" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/stats_activity.xml b/app/src/main/res/layout/stats_activity.xml
new file mode 100644
index 0000000000..83cf37918b
--- /dev/null
+++ b/app/src/main/res/layout/stats_activity.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/survey_activity.xml b/app/src/main/res/layout/survey_activity.xml
new file mode 100644
index 0000000000..868995c2d5
--- /dev/null
+++ b/app/src/main/res/layout/survey_activity.xml
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/treatments_fragment.xml b/app/src/main/res/layout/treatments_fragment.xml
index 88d4f65199..1ab1bbe88e 100644
--- a/app/src/main/res/layout/treatments_fragment.xml
+++ b/app/src/main/res/layout/treatments_fragment.xml
@@ -38,7 +38,7 @@
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
- android:text="@string/extendedbolus" />
+ android:text="@string/extended_bolus" />
+ android:text="@string/pump_tempbasal_label" />
+ android:text="@string/careportal_temporarytarget" />
+ android:text="@string/careportal_profileswitch" />
+
+
- Ins:
IAB:
Totale IOB:
- Insulin
- Karbs
BG
TT
Karbs
@@ -112,7 +110,6 @@
Oorsig
Ns Profiel
Maklike profiel
- TydelikeBasaal
Behandelings
Virtuele Pomp
Careportal
@@ -144,21 +141,17 @@
Beperkings skending
Bolus aflewering fout
Tempbasal aflewering fout
- Basale waarde [%%]
- %% (100%% = huidig)
Aanvaar nuwe tydelike basale:
Behandeling
Rekenaar
Beperking toegepas!
Bevestiging
- Voer nuwe behandeling in:
Bolus
Bolus:
Basale
Basale:
Karbs
Verander jou insette!
- Stel nuwe verlengde bolus:
BG bron
Waarvandaan moet AndroidAPS data kry?
xDrip
@@ -185,7 +178,6 @@
CGM Sensor insetsel
CGM Sensor Begin
Insulien stoor verandering
- Profiel wissel
Peuselhappie Bolus
Maaltyd Bolus
Regstelling Bolus
@@ -206,7 +198,6 @@
Persentasie
Absolute
Notas
- Gebeurtenis tyd
Profiel
Ingetik deur
Glukose tipe
@@ -230,7 +221,6 @@
Koppel
Gekoppel
Ontkoppel
- DanaR pump settings
Eindverbruiker Lisensie Ooreenkoms
MOET NIE GEBRUIK WORD OM MEDIESE BESLUITE TE MAAK NIE. DAAR IS GEEN WAARBORG DAT DIE PROGRAM, ONDERWORPE AAN TOEPASSELIKE WETTE EN WETGEWING. TENSY ANDERS GEMELD IN TEKS VOORSIEN DIE KOPIEREG-HOUERS EN / OF ANDER PARTYE DIE PROGRAM \"AS IS\" SONDER ËNIGE WAARBORG VAN ENIGE ORDE, UITDRUKKELIK OF IMPLISIET, INKLUSIEF, MAAR NIE BEPERK TOT DIE IMPLISIETE WAARBORG VAN TOEPAASBAARHEID OF NUT VIR EEN SPESIFIEKE DOEL. DIE TOTALE EN ALLE RISIKOVIR DIE KWALITEIT EN PRESTASIE VAN DIE PROGRAM RUS MET JOUSELF. VIR ENIGE PROGRAM DEFEKTIEWE OF FALINGS MOET JY PERSOONLIK DIE KOSTE EN REGSAANSPREEKLIKHEID DRA VAN ALLE NODIGE AKSIES, DIENS, REPARASIES OF KORREKSIES VIR USELF OF ENIGE DERDE PARTYE EN/OF AKSIES, DIENS, REPARASIES OF KORREKSIES WAT DEUR DIE PROGRAM GEDOEN WAS.
EK VERSTAAN en STEM IN
@@ -267,8 +257,6 @@
Vinger
Sensor
Per hand
- Tydelike teiken
- Tydelike teiken kanselleer
DanaR profiel stellings
DIA [h]
Duur van insulien aktiwiteit
@@ -401,7 +389,6 @@
Eet binnekort
Hipo
Aktiwiteit
- Verwyder rekord:
DanaR Stats
Kumulatiewe TDD
Eksponensiele geweegde TDD
@@ -558,16 +545,12 @@
Alle data na NS gestuur word laat val is gedaal. AAPS is gekoppel aan NS maar geen verandering in NS is gedoen
Basale Stap
Bolus Stap
- VerlengdeBolus
- TydelikeDoelwit
Kanselleer Verlengde Bolus
Sensor ouderdom
Canula tydsduur
Insulien ouderdom
ure
- Basale tipe
Ongeldige profiel !!!
- ProfileSwitch
Pomp battery ouderdom
Pomp Battery Verander
Alarm Opsies
@@ -615,7 +598,6 @@
KARBS & BOLUS
CGM & OPENAPS
POMP
- Basale waarde [U/h]
Durasie [min]
OpenAPS SMB
SMB
@@ -635,7 +617,6 @@
Wag vir paring op pomp
Paring OK
Paring tyd verstreke
- PARING
Geen toestel gevind so ver
Leë stoor
Bloed suiker meting alarm
@@ -744,7 +725,6 @@
\'n Bolus met dieselfde hoeveelheid was versoek binne die laaste twee minute. Om te waak teen toevallige dubbele boluses en om te waak teen goggas is dit nie toegelaat nie.
Nou
Lees pomp geskiedenis
- pomp geskiedenis
Instelling basale profiel
Pomp kasset vlak is laag
Pomp battery is laag
@@ -939,11 +919,7 @@
Klank
Vibreer
Beide
- LCD aantyd [s]
- Agterlig aantyd [s]
Glukose eenhede
- Staking(ure)
- Lae reserwe (eenhede)
Stoor opsies te pomp
Aan
Af
@@ -1159,7 +1135,6 @@
Die weergawe is ongeldig. Lus afgeskakel!
ou weergawe
baie ou weergawe
- Nuwe weergawe reeds beskikbaar vir %1$d! Sal na 60 dae terugval na LGS, lus sal ongeldig gemaak word na 90 dae
2h
%1$.2fU
DexcomG App (opgedateerde)
@@ -1186,15 +1161,12 @@
Lengte:
Afst [m]:
Naam:
- Ligging is %1$s
Laaste bolus
Laaste bolus tyd %1$s %2$s min terug
KOB
KOB %1$s %2$.0f
Aksie naam
WYSIG
- Kies asb \'n aksie tipe:
- Kies \'n sneller tipe:
Snellers:
VERWYDER
Vereistes:
@@ -1284,7 +1256,6 @@
Pomp frekwensie word nie ondersteun.
RileyLink Adres ongeldig.
Pomp tipe bespeur en is nie dieselfde as gestelde.
- Basale Profiele is nie aan op pomp.
Basale profiel is verkeerd op pomp (moet STD wees).
Verkeerde TBR op pomp (Moet Absoluut wees).
Verkeerde Maks Bolus gestel op Pomp(moet %1$.2f wees).
@@ -1335,7 +1306,6 @@
Laaste konneksie na pomp [minute gelede]
Vorige konneksie na pomp %1$s %2$s min terug
Stuur\'n SMS: %1$s
- Stuur SMS na alle fone in voorkeure
Stuur\'n SMS met die teks
Bolus beperking aangewend: %2$.2fU to %3$.2fU]]>
%1$.0f / %2$d U
diff --git a/app/src/main/res/values-bg-rBG/objectives.xml b/app/src/main/res/values-bg-rBG/objectives.xml
index 677b26f326..d2e47ec386 100644
--- a/app/src/main/res/values-bg-rBG/objectives.xml
+++ b/app/src/main/res/values-bg-rBG/objectives.xml
@@ -46,7 +46,7 @@
Следващия неотговорен
Код (request code): %1$s
(отбележете всички правилни отговори)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
Не може да се вземе времето
Задачите не са изпълнени
diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml
index edbbe5e92b..e5e933fa3e 100644
--- a/app/src/main/res/values-bg-rBG/strings.xml
+++ b/app/src/main/res/values-bg-rBG/strings.xml
@@ -74,8 +74,6 @@
Инс:
IOB:
Общо IOB:
- Инсулин (ед.):
- Въглехидрати (гр.):
КЗ
Вр.цел
ВХ
@@ -114,7 +112,6 @@
Общ
NS Профил
Обикновен профил
- Временен базал
Лечения
Виртуална помпа
Careportal
@@ -146,21 +143,18 @@
Нарушено ограничение
Грешка при подаване на болус
Грешка при подаване на временен базал
- Базална стойност [%%]
- %% (100%% = текущ)
+ Базална стойност [%]
Приложи нов временен базал:
Болус
Калкулатор
Приложено ограничение!
Потвърждение
- Въведете ново лечение:
Болус
Болус:
Базал
Базал:
Въглехидрати
Променете данните!
- Задай нов удължен болус:
Източник на данни за КЗ
От къде трябва да AndroidAPS да си взима данни?
xDrip
@@ -208,7 +202,7 @@
Процент
Абсолютна
Бележки
- Време на събитие
+ Време
Профил
Въведено от
Тип КЗ
@@ -337,13 +331,13 @@
За да превключите профила към %1$s %2$d%% отговорете с код %3$s
За да започнете удължен болус %1$.2fЕ за %2$d мин отговорете с код %3$s
За да въведете %1$dг в %2$s отговорете с код %3$s
- За да стартирате базал от %1$d%Е/ч за %2$d мин отговорете с код %3$s
+ За да стартирате базал от %1$d%%Е/ч за %2$d мин отговорете с код %3$s
За да спрете APS за %1$d минути отговорете с код %2$s
Временен базал от %1$.2fЕ/ч за %2$d мин стартиран успешно
Удължен болус %1$.2fU за %2$d мин стартиран успешно
Въглехидрати %1$dг въведени
Въвеждане на%1$dг въглехидрати - НЕУСПЕШНО
- Временен базал от %1$d%Е/ч за %2$d мин стартиран успешно
+ Временен базал от %1$d%%Е/ч за %2$d мин стартиран успешно
Неуспешно стартиране на временен базал
Неуспешно стартиране на удължен болус
За да спрете времен базал отговорете с код %1$s
@@ -422,7 +416,7 @@
Преди хранене
Хипоглекимия
Физ.активност
- Премахни запис:
+ Премахни
DanaR статистика
Комулативна TDD
Експоненциално претеглена TDD
@@ -583,16 +577,13 @@
Всички данни за NS се пропускат. AAPS е свързан с NS, но не прави промени в NS
Стъпка при базал
Стъпка при болус
- Удължен болус
- Вр. цел
Спри удължен болус
Възраст на сензора
Възраст на канюла
Възраст на инсулина
часа
- Тип базал
Грешен профил !!!
- Смяна на профил
+ Смени профил
Възраст на батерията на помпата
Смяна на батерия
Опции за аларми
@@ -641,7 +632,6 @@
ХРАНА И БОЛУС
CGM & OPENAPS
ПОМПА
- Базална стойност [Е/ч]
Продължителност [мин.]
OpenAPS SMB
SMB
@@ -661,7 +651,7 @@
Очаква сдвояване с помпа
Сдвояване - ОК
Времето за сдвояване изтече
- СДВОЯВАНЕ
+ Сдвояване
Все още устройството не е намерено
Празен резервоар
Предупреждение за измерване на КЗ
@@ -792,6 +782,7 @@
Sight
преди
%1$.2f ч
+ %1$d мин
Разреши SMB постоянно
Разрешава SMB постоянно и независимо от болусите. Възможно само с източник на КЗ с добра филтрация като G5
Разреши SMB след въглехидрати
@@ -968,11 +959,11 @@
Звукова
Вибрация
И двете
- Включен екран за [сек]
- Подсветка за [сек]
+ Включен екран за [seconds]
+ Подсветка [seconds]
Единици на КЗ
- Изключване след(часа)
- Минимален инсулин в резервоара (единици)
+ Изключване след [hours]
+ Минимален инсулин в резервоара [Units]
Запиши опциите в помпата
Вкл
Изкл
@@ -1190,7 +1181,7 @@
Използвате грешна версия. APS е изключен!
стара версия
много стара версия
- Има нова версия от най-малко %1$d дни! Връщане към LGS след 60 дни, цикълът ще бъде изключен след 90 дни
+ Има нова версия от най-малко %1$d дни! Ще спре подаването на инсулин след %2$d дни, цикълът ще бъде изключен след %3$d дни
2ч
%1$.2fЕ
Dexcom приложение (модифицирано)
@@ -1218,15 +1209,20 @@
Дължина:
Разсt [м]:
Име:
- Местоположението e %1$s
+ %1$s %2$s
+ Когато
+ Когато сте в зоната
+ Когато сте извън зоната на
+ Когато влезе в тази зона
+ Когато напуснете тази зона
Последен болус
Последен болус преди %1$s %2$s минути
Активни въглехидрати
Въгл %1$s %2$.0f
Име на правилото
РЕД
- Моля изберете действие:
- Моля изберете условие:
+ Избиране на действие
+ Иберете условие
Активиращи условия:
ИЗТРИИ
Предварителни условия:
@@ -1319,7 +1315,7 @@
Честотата не се поддържа.
Грешен RileyLink адрес.
Откритата помпа не е идентична с кокнфигурираната.
- Базалните профили не са разрешени в помпата.
+ Базалните профили/настройки не са позволен в помпата. Включванете го от настройките на помпата.
Базалния профил в помпата е грешен (трябва да е STD).
Грешен тип TBR в помпата ( трябва да е Absolute).
Грешен максимален болус в помпата ( трябвба да е %1$.2f).
@@ -1370,7 +1366,7 @@
Последнa връзкa с помпата [минути]
Последна връзка с помпата е %1$s %2$s минути преди
Изпращане на SMS с текст %1$s
- Изпрати SMS до всички телефони от настройките
+ Изпратете SMS на всички
Изпрати SMS с текст
%2$+.2fг Е]]>
Ограничение на болуса: %2$.2fЕ на %3$.2fЕ]]>
@@ -1417,4 +1413,37 @@
Името на профила съдържа точка.\nТова не се поддържа от НС.\nПрофилът не е качен в НС.
Ниската граница на диапазона (графика)
Високата граница на диапазона (графика)
+ Подреди
+ Възраст:
+ Тегло:
+ Номер:
+ Изпрати
+ Най-често използван профил:
+ Забележка: Само данни, видими на този екран, ще бъдат анонимно изпратени. Номер се дава за тази инсталация на AndroidAPS. Отново можете да изпратите данните, ако вашият основен профил се промени, но нека да работи поне една седмица, за да се види резултата във Време в границите. Много благодарим за Вашата помощ.
+ Проучване
+ Невалидна възраст
+ Невалидно тегло
+ %1$s: ∑: %2$.2f Бол: %3$.2f Баз: %4$.2f]]>
+ %1$s: Ниски: %2$02d%% В: %3$02d%% Вис: %4$02d%%]]>
+ Средно
+ ТДД
+ Време в границите
+ Мониторинг на активност
+ Искате да нулирате статистиката?
+ Статистика
+ Произволна КЗ
+ Генерира произволни захари(демо режим)
+ КЗ
+ Инструменти
+ Покажи изчисленията
+ Грешка
+ 12ч
+ 24ч
+ Събитие
+ Вече направено
+ Съобщение
+ Изтрий опашка? Всички данни ще се загубят!
+ Използване на удължен болус ще спре режим затворен цикъл за времето на болуса. Сигурни ли сте?
+ Затворен цикъл е недостъпен поради стартиран Удължен болус
+ УБ
diff --git a/app/src/main/res/values-cs-rCZ/objectives.xml b/app/src/main/res/values-cs-rCZ/objectives.xml
index 259403ad81..76597c063d 100644
--- a/app/src/main/res/values-cs-rCZ/objectives.xml
+++ b/app/src/main/res/values-cs-rCZ/objectives.xml
@@ -46,10 +46,10 @@
Další nedokončená
Kód žádosti: %1$s
(zatrhněte všechny správné odpovědi)
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/FAQ.html#co-delat-pri-sprchovani-a-koupani
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#konfigurace
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/FAQ.html#co-delat-pri-sprchovani-a-koupani
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#konfigurace
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
Chybí připojení k internetu
Nepodařilo se načíst čas
Požadavky cíle nejsou splněny
diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml
index bf45a700ac..27b740f305 100644
--- a/app/src/main/res/values-cs-rCZ/strings.xml
+++ b/app/src/main/res/values-cs-rCZ/strings.xml
@@ -74,8 +74,6 @@
Inz:
IOB:
Celkové IOB:
- Množství inzulínu
- Množství sacharidů
Glykémie
DC
Sacharidy
@@ -114,7 +112,6 @@
Přehled
NS profil
Jednoduchý profil
- DočasnýBazál
Ošetření
Virtuální pumpa
Péče
@@ -146,21 +143,18 @@
Mimo povolený rozsah
Chyba podání bolusu
Chyba nastavování dočasného bazálu
- Hodnota bazálu [%%]
- %% (100%% = současný)
+ Hodnota bazálu [%]
Spustit nový dočasný bazál:
Bolus
Kalkulačka
Aplikováno omezení!
Potvrzení
- Aplikovat bolus:
Bolus
Bolus:
Bazál
Bazál:
Sacharidy
Změňte zadání!
- Spustit nový prodloužený bolus:
Zdroj glykémie
Odkud má získávat AndroidAPS glykémie?
xDrip
@@ -208,7 +202,7 @@
Procenta
Absolutní
Poznámky
- Čas
+ Čas
Profil
Zadal
Zadání glykémie
@@ -233,7 +227,7 @@
Připojuji
Připojeno
Odpojeno
- DanaR nastavení
+ Nastavení pumpy Dana
Licenční ujednání
MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
ROZUMÍM A POTVRZUJI
@@ -422,7 +416,7 @@
Před jídlem
Hypoglykémie
Aktivita
- Odstranit záznam:
+ Odstranit záznam
Statistika z pumpy
Kumulativní TDD
Exponenciálně vážené TDD
@@ -583,16 +577,13 @@
Všechna data odeslaná do NS jsou zahozena. AAPS je připojen k NS, ale nedělá do něj žádné změny
Krok bazálu
Krok bolusu
- ProdlouženýBolus
- DočasnýCíl
Zrušit prodloužený bolus
Stáří senzoru
Stáří kanyly
Stáří inzulínu
hodin
- Typ bazálu
Chybný profil !!!
- Přepnutí profilu
+ Proveďte přepnutí profilu
Stáří baterie v pumpě
Výměna baterie pumpy
Nastavení alarmů
@@ -641,7 +632,6 @@
SACHARIDY & BOLUSY
CGM & OPENAPS
PUMPA
- Hodnota bazálu [U/h]
Trvání [min]
OpenAPS SMB
SMB
@@ -661,7 +651,7 @@
Čekání na spárování na pumpě
Spárováno
Vypršel časový limit pro párování
- PÁROVÁNÍ
+ Párování
Prozatím žádné zařízení nenalezeno
Prázdný zásobník
Výstraha měření glykémie
@@ -772,7 +762,7 @@
Bolus stejné velikosti už byl během poslední minuty požadován. Jako preventivní ochrana před zdvojeným bolusem byla operace zakázána.
Teď
Načítání historie pumpy
- Historie
+ Historie pumpy
Nastavení bazálního profilu
V zásobníku je málo inzulínu
Slabá baterie v pumpě
@@ -792,6 +782,7 @@
Insight
zpět
%1$.2f h
+ %1$d min
Vždy povolit SMB
Povolit SMB nezávisle na bolusech. Možno pouze se zdroji glykémií s dobrým filtrováním dat, jako např. G5
Povolit SMB po jídle
@@ -968,11 +959,11 @@
Zvuk
Vibrace
Oboje
- Čas před vypnutím displeje [s]
- Podsvícení [s]
+ Čas před vypnutím displeje [sekundy]
+ Podsvícení [sekundy]
Jednotky
- Vypnutí [h]
- Nízký stav zásobníku [U]
+ Vypnutí [hodiny]
+ Nízký stav zásobníku [Jednotky]
Uložit do pumpy
ZAP
VYP
@@ -1190,7 +1181,7 @@
Zjistili jsme, že používáte neplatnou verzi, smyčka zakázána!
stará verze
velmi stará verze
- Nová verze je dostupná minimálně %1$d dní! Přepnutí na ochranu před nízkou glykémií po 60 dnech, vypnutí smyčky po 90 dnech
+ Nová verze je dostupná minimálně %1$d dní! Přepnutí na ochranu před nízkou glykémií po %2$d dnech, vypnutí smyčky po %3$d dnech
2h
%1$.2fU
Aplikace Dexcom (upravená)
@@ -1218,15 +1209,20 @@
Zem. délka:
Vzdálenost [m]:
Jméno:
- Poloha je %1$s
+ %1$s %2$s
+ Kdy
+ Když se nacházíte v oblasti
+ Když se nacházíte mimo oblast
+ Když vstoupíte do oblasti s názvem
+ Když opustíte oblast s názvem
Poslední bolus
Poslední bolus %1$s před %2$s min
COB
COB %1$s %2$.0f
Název úkolu
EDIT
- Zvolte typ akce prosím:
- Zvolte typ podmínky:
+ Vyberte akci
+ Vyberte podmínku
Podmínky:
ODSTRANIT
Nutné podmínky:
@@ -1319,7 +1315,7 @@
Nepodporovaná frekvence pumpy.
Chybná adresa RileyLinku.
Detekovaná pumpa je jiného typu než nakonfigurovaná.
- Bazální profily nejsou na pumpě povolené.
+ Nastavení bazálních profilů/vzorů není na pumpě povoleno. Povolte je na pumpě.
Bazální profil na pumpě je chybný (musí být STD).
Chybný typ dočasného bazálu na pumpě (musí být absolutní).
Chybný max. bolus na pumpě (musí být %1$.2f).
@@ -1370,7 +1366,7 @@
Poslední připojení k pumpě před [minutami]
Poslední připojení k pumpě %1$s před %2$s minutami
Poslat SMS: %1$s
- Odeslat SMS na všechna čísla v předvolbách
+ Poslat SMS na všechna čísla
Odeslat SMS s textem
%2$+.2fU]]>
Aplikováno omezení bolusu: %2$.2fU na %3$.2fU]]>
@@ -1417,4 +1413,38 @@
Název profilu obsahuje tečky.\nToto není v NS podporováno.\nProfil není přenesen do NS.
Spodní hodnota oblasti v rozsahu (pouze zobrazování)
Horní hodnota oblasti v rozsahu (pouze zobrazování)
+ Změna pořadí
+ Věk:
+ Váha:
+ ID:
+ Odeslat
+ Nejběžnější profil:
+ Poznámka: Pouze data viditelná na této obrazovce budou odesílána anonymně. ID je přiřazeno k této instalaci produktu AndroidAPS. Data můžete znovu odeslat, pokud se váš hlavní profil změní, ale nechte ho běžet alespoň týden, aby byl výsledek viditelný v čase v rozsahu. Vážíme si Vaši pomoci.
+ Průzkum
+ Neplatná položka věku
+ Neplatná položka váhy
+ %1$s: ∑: %2$.2f Bol: %3$.2f Baz: %4$.2f]]>
+ %1$s: Pod: %2$02d%% V: %3$02d%% Nad: %4$02d%%]]>
+ Průměr
+ CDD
+ Čas v rozsahu
+ Monitor aktivity
+ Chcete resetovat statistiky aktivity?
+ Statistika
+ Náhodná glykémie
+ Generovat náhodná data glykémie (pouze režim Demo)
+ GLYK
+ Nástroje
+ Zobrazit kalkulaci
+ Chyba
+ 12h
+ 24h
+ Událost automatizace
+ Již nastaveno
+ Zpráva
+ Vymazat frontu? Všechna data ve frontě budou ztracena!
+ Použití funkce rozloženého bolusu zastaví uzavřenou smyčku po dobu trvání rozloženého bolusu. Opravdu to chcete?
+ Uzavřená smyčka je zastavena kvůli běžícímu rozloženému bolusu
+ EB
+ PhoneChecker
diff --git a/app/src/main/res/values-de-rDE/objectives.xml b/app/src/main/res/values-de-rDE/objectives.xml
index 1158cee370..c2a3fe603e 100644
--- a/app/src/main/res/values-de-rDE/objectives.xml
+++ b/app/src/main/res/values-de-rDE/objectives.xml
@@ -47,10 +47,10 @@ die Formel maxIOB = durchschnittlicher Essensbolus + 3 x höchste BasalrateNächste offene
Code anfordern: %1$s
(Kreuze alle richtigen Antworten an)
- https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/FAQ.html#was-mache-ich-wenn-ich-duschen-oder-ein-bad-nehmen-mochte
- https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#die-startseite
- https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#konfiguration
- https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#die-startseite
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/FAQ.html#was-mache-ich-wenn-ich-duschen-oder-ein-bad-nehmen-mochte
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#die-startseite
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#konfiguration
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Getting-Started/Screenshots.html#die-startseite
Keine Verbindung zum Internet
Abruf der Uhrzeit fehlgeschlagen
Anforderungen des Zieles nicht erfüllt
diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml
index d223e1092e..ad2e7a7629 100644
--- a/app/src/main/res/values-de-rDE/strings.xml
+++ b/app/src/main/res/values-de-rDE/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
Gesamt IOB:
- Insulin-Menge
- Kohlenhydrat-Menge
BZ
TT
Kohlenhydrate
@@ -114,7 +112,6 @@
Übersicht
Nightscout-Profil
Einfaches Profil
- TBR
Behandlungen
Virtuelle Pumpe
Careportal
@@ -146,21 +143,18 @@
Beschränkungen wurden verletzt oder Limit erreicht.
Bolus-Abgabefehler
TBR Abgabe-Fehler
- Basal-Wert [%%]
- %% (100%% = aktuell)
+ Basal-Wert [%]
Akzeptiere neue TBR:
Bolus
Rechner
Beschränkungen angewendet!
Bestätigung
- Gebe neue Behandlung ein:
Bolus
Bolus:
Basal
Basal:
Kohlenhydrate
Ändere deine Eingabe!
- Setze neuen verzögerten Bolus:
BZ-Quelle
Woher soll AndroidAPS seine Blutzuckerwerte beziehen?
xDrip
@@ -208,7 +202,7 @@
Prozent
Absolut
Notiz
- Ereignis-Zeit
+ Ereignis-Zeit
Profil
Eingegeben durch
Glukose-Art
@@ -233,7 +227,7 @@
Verbinden
Verbunden
Getrennt
- DanaR Pumpen-Einstellungen
+ Dana Pumpen-Einstellungen
Endbenutzervereinbarung
DAS PROGRAMM DARF NICHT FÜR MEDIZINISCHE ENTSCHEIDUNGEN BENUTZT WERDEN. ES GIBT IN DIESEM PROJEKT KEINE GEWÄHRLEISTUNG ODER GARANTIERTE UNTERSTÜTZUNG IN IRGENDEINER ART. WENN DU DICH ENTSCHEIDEST, ES ZU NUTZEN, HÄNGT DIE QUALITÄT UND LEISTUNGSFÄHIGKEIT DIESES PROJEKTES VON DIR SELBST AB. ES WIRD \"WIE BESEHEN\" ZUR VERFÜGUNG GESTELLT. SOLLTE SICH DAS PROGRAMM ALS FEHLERHAFT ERWEISEN, ÜBERNEHMEN SIE ALLE NOTWENDIGEN KRANKHEITSKOSTEN, SERVICELEISTUNGEN, REPARATUREN ODER KORREKTUREN.
Ich verstehe und stimme zu.
@@ -369,7 +363,7 @@
Zu Nightscout nur hochladen. Nicht wirksam bei BZ-Werten, wenn nicht eine lokale Quelle wie z. B. xDrip gewählt wird; nicht wirksam bei Profilen, wenn Nightscout-Profile verwendet werden.
Pumpe nicht initialisiert!
Pumpe nicht initialisiert, Profil nicht gesetzt!
- Vorfüllen/Füllen
+ Katheterwechsel
Bitte vergewissere Dich, dass die Füllmenge den Eigenschaften des Katheters entspricht!
Andere
Füll-/Vorfüll-Standardmengen
@@ -422,7 +416,7 @@
Bald essen
Hypo
Aktivität
- Lösche Eintrag:
+ Eintrag löschen
DanaR Statistiken
Kumulative TDD
Exponentiell gewichtete TDD
@@ -583,16 +577,13 @@
Alle an Nightscout gesendeten Daten werden verworfen. AAPS ist verbunden, aber Nightscout-Daten werden nicht geändert.
Basal-Schritt
Bolus-Schritt
- Verzögerter Bolus
- Temporäres Ziel
Verzögerten Bolus abbrechen
Sensoralter
Katheteralter
Insulinalter
Stunden
- Basaltyp
Ungültiges oder defektes Profil!
- Profilwechsel
+ Profilwechsel durchführen
Batteriealter
Pumpenbatterie Wechsel
Alarm-Optionen
@@ -641,7 +632,6 @@
CARBS & BOLUS
CGM & OPENAPS
PUMPE
- Basal Wert [IE/h]
Dauer [min]
OpenAPS SMB
SMB
@@ -661,7 +651,7 @@
Auf Verbindung warten
Pairing OK
Zeitüberschreitung beim Pairing
- PAIRING
+ Koppeln
Pumpe noch nicht gefunden
Reservoir leer
Alarm BZ-Messung
@@ -772,7 +762,7 @@
Ein gleich großer Bolus wurde in den letzten zwei Minuten angefordert. Dies ist nicht zulässig, um ungewollte Doppelboli zu verhindern und vor eventuellen Bugs zu schützen.
Jetzt
Historie wird gelesen
- Pumpen-Speicher
+ Pumpen Historie
BR-Profil wird aktualisiert.
Das Reservoir in der Pumpe ist fast leer
Die Batterie in der Pumpe ist fast leer
@@ -792,6 +782,7 @@
Sight
her
%1$.2f h
+ %1$d mins
SMB immer aktivieren
Aktiviere SMB immer, unabhängig von Boli. Dies ist nur möglich, wenn eine BZ-Quelle genutzt wird, die die Daten besonders gut filtert wie z. B. G5.
Aktiviere SMB nach Mahlzeiten.
@@ -855,7 +846,7 @@
Das Einlesen der geänderten Basalrate in der Pumpe schlug fehl
Änderungen der Historie werden gesucht
Der Import mehrerer Boli der gleichen Menge, abgegeben in der gleichen Minute, ist gescheitert: Nur ein Datensatz konnte den Behandlungen hinzugefügt werden. Bitte überprüfe die Pumpe und verwende das Careportal, um fehlende Einträge hinzuzufügen. Stelle sicher, dass keine Einträge für genau dieselbe Minute mit derselben Menge hinzugefügt werden.
- \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)
+ \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nSupport:\nhttps://de.loopercommunity.org/ (de)\nhttp://facebook.androidaps.org
Der letzte Bolus liegt mehr als 24 Stunden zurück oder liegt in der Zukunft. Prüfe bitte das Datum auf der Pumpe.
Zeit/Datum des abgegebenen Boluses auf der Pumpe erscheint falsch, IOB ist wahrscheinlich nicht korrekt. Bitte prüfe Zeit/Datum der Pumpe.
Profil-Wechsel fehlt, bitte nimm einen Profil-Wechsel vor oder drücke \"AKTIVIERE PROFIL\" im lokalen Profil.
@@ -968,10 +959,10 @@
Töne
Vibration
Beides
- LCD-Einschaltdauer [s]
- Einschaltdauer der Hintergrundbeleuchtung [s]
+ LCD-Einschaltdauer [Sek.]
+ Einschaltdauer Hintergrundbeleuchtung [Sek.]
BZ-Einheit
- Abschalten (h)
+ Abschalten (Std.)
Reservoir fast leer (IE)
In Pumpe speichern
Ein
@@ -1013,7 +1004,7 @@
NSClient Störung. Ziehe einen Neustart von NS und NSClient in Betracht.
AS
Version %1$s ist verfügbar.
- Zeit Verschiebung
+ Zeitversatz
Bevorzugter APS-Modus
Gesamt
Berech.
@@ -1191,7 +1182,7 @@ Unerwartetes Verhalten.
Wir haben festgestellt, dass Du eine ungültige Version verwendest. Loop deaktiviert!
Vorherige Version
sehr alte Version
- Neue Version für mindestens %1$d Tage verfügbar! Rückfall zur sensorunterstützten Pumpentherapie nach 60 Tagen, Loop wird nach 90 Tagen deaktiviert
+ Neue Version für mindestens %1$d Tage verfügbar! Rückfall zur sensorunterstützten Pumpentherapie nach %2$d Tagen, Loop wird nach %3$d Tagen deaktiviert.
2h
%1$.2f IE
gepatchte Dexcom App
@@ -1219,15 +1210,20 @@ Unerwartetes Verhalten.
Längengrad:
Umkreis [m]:
Name:
- Standort: %1$s
+ %1$s %2$s
+ Wenn
+ Wenn Du innerhalb des Gebietes bist
+ Wenn Du außerhalb des Gebietes bist
+ Beim Betreten des angegebenen Gebiets
+ Beim Verlassen des angegebenen Gebiets
Letzter Bolus vor
Letzter Bolus vor %1$s %2$s Min
COB
COB %1$s %2$.0f
Name der Aufgabe
BEARBEITEN
- Bitte wähle eine Aktion:
- Bitte wähle einen Auslöser:
+ Aktion wählen
+ Auslöser wählen
Auslöser:
ENTFERNEN
Voraussetzung:
@@ -1320,7 +1316,7 @@ Unerwartetes Verhalten.
Pumpen-Frequenz nicht unterstützt.
RileyLink Adresse ungültig.
Erkannter Pumpentyp entspricht nicht dem eingestellen Pumpentyp.
- Basalprofile auf Pumpe nicht aktiviert.
+ Einstellung für Basalprofile/-muster ist auf der Pumpe nicht aktiviert. Aktiviere es auf der Pumpe.
Das eingestellte Basalprofl der Pumpe ist falsch (muss STD sein).
Falscher TBR-Typ auf der Pumpe (muss \"Absolut\" sein).
Falscher Max-Bolus auf Pumpe eingestellt (muss %1$.2f sein).
@@ -1371,7 +1367,7 @@ Unerwartetes Verhalten.
Letzte Verbindung zur Pumpe [vor X Minuten]
Letzte Verbindung zur Pumpe vor %1$s %2$s Minuten
SMS senden: %1$s
- SMS an alle vorgegebenen Nummern senden
+ SMS an alle Nummern senden
SMS mit Text senden
%2$+.2fU]]>
Bolus-Einschränkung angewendet: %2$.2fIE zu %3$.2fIE]]>
@@ -1400,8 +1396,8 @@ Unerwartetes Verhalten.
%1$dg
Ein
Aus
- Löschen abgeschlossen
- Löschen gestartet
+ Ziel erneut öffnen
+ Ziel neu starten
Zeiterkennung
Möchtest Du den Start der Ziele zurücksetzen? Du verlierst Deine Fortschritte.
Keine Pumpe ausgewählt
@@ -1411,11 +1407,47 @@ Unerwartetes Verhalten.
IC
ISF
ZIEL
- Duplizieren
+ Klonen
Speichere oder verwerfe die aktuellen Änderungen zuerst
Aktuelles Profil löschen?
Neues lokales Profil auf Basis dieses Profilwechsels erstellen?
Profilname enthält Punkte.\nDies wird von NS nicht unterstützt.\nProfil wird nicht zu NS hochgeladen.
Unterer Wert des Zielbereichs (nur Anzeige)
Oberer Wert des Zielbereichs (nur Anzeige)
+ Umsortieren
+ Alter:
+ Gewicht:
+ ID:
+ Senden
+ Meistgenutztes Profil:
+ Hinweis: Nur Daten, die auf diesem Bildschirm sichtbar sind, werden anonym hochgeladen. Die ID wird dieser Installation von AndroidAPS zugeordnet. Du kannst erneut Daten senden, wenn sich Dein Hauptprofil geändert hat. Lasse es aber es mindestens eine Woche lang laufen, damit dessen Ergebnis in der Time in Range sichtbar wird. Danke für Deine Unterstützung.
+ Umfrage
+ Ungültige Altersangabe
+ Ungültige Gewichtsangabe
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Low: %2$02d%% In: %3$02d%% High: %4$02d%%]]>
+ Durchschnitt
+ TDD
+ TIR
+ Aktivitätsmonitor
+ Willst Du die Aktivitätsstatistik zurücksetzen?
+ Statistiken
+ Zufalls-BZ
+ Zufalls-BZ Daten erstellen (nur Demo-Modus)
+ BZ
+ Tools
+ Berechnung anzeigen
+ Fehler
+ 12h
+ 24h
+ Automatisierungs-Ereignis
+ Bereits festgelegt
+ Nachricht
+ Warteschlange löschen? Alle Daten in der Warteschlange gehen verloren!
+ Die Verwendung eines Verzögerungsbolus unterbricht dem Closed Loop Modus für die Dauer des Verzögerungsbolus. Willst Du das wirklich?
+ Closed Loop wegen Verzögerungsbolus unterbrochen
+ VB
+ \"PhoneChecker\"
+ Diagrammmenü
+ AS
diff --git a/app/src/main/res/values-el-rGR/insight_alert_descriptions.xml b/app/src/main/res/values-el-rGR/insight_alert_descriptions.xml
index af456804da..84daeb424d 100644
--- a/app/src/main/res/values-el-rGR/insight_alert_descriptions.xml
+++ b/app/src/main/res/values-el-rGR/insight_alert_descriptions.xml
@@ -1,7 +1,7 @@
- %1$d%\nΔιάρκεια:%2$sh]]>
+ %1$d%%\nΔιάρκεια:%2$sh]]>
%1$s U]]>
Αλλαγή μπαταρίας.
Ορίστε ώρα/ημερομηνία.
diff --git a/app/src/main/res/values-el-rGR/objectives.xml b/app/src/main/res/values-el-rGR/objectives.xml
index 7941ad4e61..4a2ce25a1e 100644
--- a/app/src/main/res/values-el-rGR/objectives.xml
+++ b/app/src/main/res/values-el-rGR/objectives.xml
@@ -45,10 +45,10 @@
Επόμενο ημιτελές
Κωδικός αιτήματος: %1$s
(ελέγξτε όλες τις σωστές απαντήσεις)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Δεν είστε συνδεδεμένοι στο internet
Απέτυχε η ανάκτηση ώρας
Αντικειμενικές προϋποθέσεις δεν πληρούνται
diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml
index 9a807fae20..a314644f29 100644
--- a/app/src/main/res/values-el-rGR/strings.xml
+++ b/app/src/main/res/values-el-rGR/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
Συνολική IOB:
- Ινσουλίνη
- Υδατάνθρακες
BG
TT
Υδατάνθρακες
@@ -114,7 +112,6 @@
Επισκόπηση
Προφίλ NS
Απλό Προφίλ
- Προσωρινός Ρυθμός
Θεραπείες
Εικονική Αντλία
Φροντίδα
@@ -146,21 +143,17 @@
Παραβίαση Περιορισμών
Σφάλμα παράδοσης Bolus
Σφάλμα παράδοσης Προσ Ρυθμού
- Τιμή Βασικού [%%]
- %% (100%% = τρέχων)
Αποδοχή νέου Προσ Ρυθμού:
Θεραπεία
Υπολογιστής
Εφαρμόστηκαν Περιορισμοί!
Επιβεβαίωση
- Εισάγετε νέα Θεραπεία:
Bolus
Bolus:
Βασικός Ρυθμός
Βασικός Ρυθμός:
Υδατάνθρακες
Αλλάξτε αυτό που εισάγατε!
- Θέστε νέο εκτεταμμένο bolus:
Πηγή BG
Από πού πρέπει το AndroidAPS να πάρει τα δεδομένα του;
xDrip
@@ -187,7 +180,6 @@
Εισαγωγή Αισθητήρα CGM
Έναρξη Αισθητήρα CGM
Αλλαγή Αμπούλας Ινσουλίνης
- Αλλαγή Προφίλ
Bolus για σνακ
Bolus Γεύματος
Διορθωτικό Bolus
@@ -208,7 +200,6 @@
Ποσοστό
Απόλυτο
Σημειώσεις
- Ώρα Συμβάντος
Προφίλ
Εισαγωγή από
Τύπος Γλυκόζης
@@ -233,7 +224,6 @@
Συνδέεται
Συνδέθηκε
Αποσυνδέθηκε
- Ρυθμίσεις αντλίας DanaR
Άδεια χρήσης τελικού χρήστη
ΔΕΝ ΠΡΕΠΕΙ ΝΑ ΧΡΗΣΙΜΟΠΟΙΗΘΕΙ ΓΙΑ ΝΑ ΚΑΝΕΤΕ ΙΑΤΡΙΚΗ ΑΠΟΦΑΣΗ. ΔΕΝ ΥΠΑΡΧΕΙ ΕΓΓΥΗΣΗ ΓΙΑ ΤΟ ΠΡΟΓΡΑΜΜΑ, ΣΤΟ ΒΑΘΜΟ ΠΟΥ ΕΠΙΤΡΕΠΕΤΑΙ ΑΠΟ ΤΟ ΕΦΑΡΜΟΣΤΕΟ ΔΙΚΑΙΟ. ΕΚΤΟΣ ΟΠΟΙΑΣΔΗΠΟΤΕ ΔΙΑΒΑΘΜΙΣΜΕΝΗ ΚΑΤΑ ΤΗΝ ΕΓΓΡΑΦΗ ΤΩΝ ΚΑΤΟΧΟΙ ΠΝΕΥΜΑΤΙΚΩΝ ΔΙΚΑΙΩΜΑΤΩΝ ΚΑΙ/Ή ΑΛΛΑ ΜΕΡΗ ΠΑΡΕΧΟΝΤΑΙ ΤΟ ΠΡΟΓΡΑΜΜΑ \"ΩΣ ΕΧΕΙ\" ΧΩΡΙΣ ΕΓΓΥΗΣΗ ΟΠΟΙΟΥΔΗΠΟΤΕ ΕΙΔΟΥΣ, ΕΞΑΙΡΟΥΜΕΝΕΣ Ή ΣΙΩΠΗΡΕΣ, ΣΥΜΠΕΡΙΛΑΜΒΑΝΟΜΕΝΩΝ, ΕΝΔΕΙΚΤΙΚΑ, ΤΩΝ ΣΙΩΠΗΡΩΝ ΕΓΓΥΗΣΕΩΝ ΕΜΠΟΡΕΥΣΙΜΟΤΗΤΑΣ ΚΑΙ ΚΑΤΑΛΛΗΛΟΤΗΤΑΣ ΓΙΑ ΣΥΓΚΕΚΡΙΜΕΝΟ ΣΚΟΠΟ. Ο ΟΛΟΚΛΗΡΩΜΕΝΟΣ ΚΙΝΔΥΝΟΣ ΟΣΟΝ ΑΦΟΡΑ ΤΗΝ ΠΟΙΟΤΗΤΑ ΚΑΙ ΤΗΝ ΑΠΟΔΟΣΗ ΤΟΥ ΠΡΟΓΡΑΜΜΑΤΟΣ ΕΙΝΑΙ ΔΙΚΟ ΣΑΣ. ΕΑΝ ΤΟ ΠΡΟΓΡΑΜΜΑ ΔΕΝ ΕΙΝΑΙ ΕΛΑΤΤΩΜΑΤΙΚΟ, ΠΡΕΠΕΙ ΝΑ ΕΞΕΤΑΣΤΕ ΤΟ ΚΟΣΤΟΣ ΟΛΩΝ ΤΩΝ ΑΠΑΡΑΙΤΗΤΩΝ ΣΥΝΤΗΡΗΣΕΩΝ, ΕΠΙΣΚΕΥΩΝ Ή ΔΙΟΡΘΩΣΕΩΝ.
ΚΑΤΑΛΑΒΑ ΚΑΙ ΣΥΜΦΩΝΩ
@@ -270,8 +260,6 @@
Δάκτυλο
Αισθητήρας
Χειροκίνητα
- Προσωρινός Στόχος
- Ακύρωση Προσωρινού Στόχου
Ρυθμίσεις προφίλ DanaR
DIA [h]
Διάρκεια Δράσης Ινσουλίνης
@@ -322,7 +310,7 @@
Δεν επιτρέπεται απομακρυσμένη εντολή
Απομακρυσμένο bolus μη διαθέσιμο. Δοκιμάστε ξανά αργότερα.
Για έναρξη βασικού %1$.2fU/h για %2$d λεπτά στείλτε κωδικό %3$s
- Για αλλαγή προφίλ σε %1$s %2$d% στείλτε κωδικό %3$s
+ Για αλλαγή προφίλ σε %1$s %2$d%% στείλτε κωδικό %3$s
Για έναρξη εκτεταμένου bolus %1$.2fU για %2$d λεπτά στείλτε κωδικό %3$s
Για έναρξη βασικού %1$d%% για %2$d λεπτά στείλτε κωδικό %3$s
Για αναστολή κυκλκώματος για %1$d λεπτών στείλτε με κωδικό %2$s
@@ -404,7 +392,6 @@
Γεύμα Σύντομα
Υπογλυκαιμία
Άσκηση
- Διαγραφή εγγραφής:
Στατιστικά DanaR
Άθροισμα TDD
Εκθετικά Σταθμισμένο TDD
@@ -565,16 +552,12 @@
Όλα τα δεδομένα που αποστέλλονται στην NS έχουν καταργηθεί. Το AAPS συνδέεται με NS, αλλά δεν γίνεται καμία αλλαγή στα NS
Βήμα Βασικού
Βήμα Bolus
- Εκτεταμένο Bolus
- Στόχος Προσ Ρυθμού
Ακύρωση Εκτεταμμένου bolus
Χρόνος ζωής Αισθητήρα
Χρόνος ζωής Κάνουλας
Χρόνος ζωής Ινσουλίνης
ώρες
- Τύπος Βασικού
Μη έγκυρο προφίλ!!!
- Μεταβείτε στο προφίλ
Χρόνος ζωής μπαταρίας αντλίας
Αλλαγή μπαταρίας αντλίας
Επιλογές συναγερμού
@@ -623,7 +606,6 @@
ΥΔΑΤΑΝΘΡΑΚΕΣ & BOLUS
CGM & OPENAPS
ΑΝΤΛΙΑ
- Τιμή Βασικού ρυθμού [U/h]
Διάρκεια [min]
OpenAPS SMB
SMB
@@ -643,7 +625,6 @@
Περιμένετε για σύζευξη με αντλία
Σύζευξη ΟΚ
Τέλος χρόνου σύζευξης
- ΣΥΖΕΥΞΗ
Δεν βρέθηκε συσκευή ακόμα
Άδεια αμπούλα
Ειδοποίηση υψηλής τιμής σακχάρου
@@ -752,7 +733,6 @@
Ένα bolus με την ίδια ποσότητα ζητήθηκε τα τελευταία 2 λεπτά. Για την αποφυγή κατά λάθους διπλών bolus και για ασφάλεια από λάθος του προγράμματος αυτό απαγορεύεται.
Τώρα
Ανάγνωση ιστορικού αντλίας
- ιστορικό αντλίας
Ρύθμιση βασικού προφίλ
Η στάθμη της αμπούλας της αντλίας είναι χαμηλά
Η μπαταρία της αντλίας είναι χαμηλά
@@ -948,11 +928,7 @@
Ήχος
Δόνηση
Και τα δύο
- Χρόνος ενεργής οθόνης [s]
- Χρόνος οπίσθιου φωτισµού [s]
Μονάδες γλυκόζης
- Απενεργοποίηση(ώρες)
- Χαμηλή αμπούλα (μονάδες)
Αποθήκευση ρυθμίσεων στην αντλία
Ενεργό
Ανενεργό
@@ -1168,7 +1144,6 @@
Διαπιστώσαμε ότι εκτελείτε μη έγκυρη έκδοση. Κύκλωμα απενεργοποιήθηκε!
παλιά έκδοση
πολύ παλιά έκδοση
- Νέα έκδοση για τουλάχιστον %1$d ημέρες διαθέσιμη! Επιστροφή σε LGS μετά από 60 ημέρες, το κύκλωμα θα απενεργοποιηθεί μετά από 90 ημέρες
2ώρες
%1$.2fU
Εφαρμογή Dexcom (τροποποιημένη)
@@ -1196,15 +1171,12 @@
Lon:
Αποστ [m]:
Όνομα:
- Η τοποθεσία είναι %1$s
Τελευταίο Bolus
Τελευταίο bolus %1$s %2$s λεπτά πριν
COB
COB %1$s %2$.0f
Όνομα εργασίας
Επεξεργασία
- Επιλέξτε έναν τύπο δράσης:
- Επιλέξτε έναν τύπο ενεργοποίησης:
Ενεργοποιήσεις:
ΜΕΤΑΚΙΝΗΣΗ
Προϋποθέσεις:
@@ -1295,7 +1267,6 @@
Συχνότητα Αντλίας δεν υποστηρίζεται.
Διεύθυνση RileyLink μη έγκυρη.
Ο τύπος αντλίας που ανιχνεύτηκε δεν είναι ο ίδιος με αυτόν που ορίστηκε.
- Τα προφίλ βασικού δεν είναι ενεργοποιημένα στην αντλία.
Το βασικό προφίλ που ορίστηκε στην αντλία είναι λάθoς (πρέπει να είναι STD).
Λάθος τύπος TBR ορίστηκε στην αντλία (πρέπει να είναι Absolute).
Λάθος μέγιστο bolus ορίστηκε στην αντλία (πρέπει να είναι %1$.2f).
@@ -1346,7 +1317,6 @@
Τελευταία σύνδεση με αντλία [λεπτά πριν]
Τελευταία σύνδεση με αντλία %1$s %2$s λεπτά πριν
Στείλτε SMS: %1$s
- Στείλτε SMS προς όλους τους αριθμούς στις Επιλογές
Στείλτε SMS με κείμενο
%2$+.2fU]]>
Bolus constraint applied: %2$.2fU to %3$.2fU]]>
diff --git a/app/src/main/res/values-es-rES/objectives.xml b/app/src/main/res/values-es-rES/objectives.xml
index 08ffcf5887..9f6a95c2b1 100644
--- a/app/src/main/res/values-es-rES/objectives.xml
+++ b/app/src/main/res/values-es-rES/objectives.xml
@@ -46,10 +46,10 @@
Siguien&te sin terminar
Solicitar código: %1$s
(compruebe todas las respuestas correctas)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Sin conexión a Internet
Fallo tiempo de recuperación
No se cumplen los requisitos de objetivo
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index beb5bf4feb..48e69e0564 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB (Insulina Activa):
IOB Total:
- Insulina [U]
- Carbohidratos [g]
BG
OT
Carbohidratos
@@ -114,7 +112,6 @@
Inicio
Perfil NS
Perfil simple
- Basal temporal
Tratamientos
Bomba virtual
Portal de Tratamientos
@@ -146,21 +143,18 @@
Violación restricciones
Error de administración del bolo
Basal Temporal no emitida
- Dosis basal [%%]
- %% (100%% = actual)
+ Valor basal [%]
Aceptar nueva basal temporal:
Tratamiento
Calculadora
Restricción aplicada!
Confirmación
- Introduzca nuevo tratamiento:
Bolo
Bolo:
Dosis Basal
Dosis Basal:
Carbohidratos
¡Cambiar datos!
- Establecer nuevo bolo extendido:
Origen BG
¿De donde debe AndroidAPS obtener sus datos?
xDrip
@@ -208,7 +202,7 @@
Dosis
Absoluto
Notas
- Fecha Hora
+ Hora del evento
Perfil
Introducido por
Tipo de glucosa
@@ -233,7 +227,7 @@
Conectando
Conectado
Desconectado
- Ajustes de la bomba DanaR
+ Ajustes de la bomba Dana
Acuerdo de licencia de usuario final
NO DEBE UTILIZARSE PARA TOMAR DECISIONES MÉDICAS. NO HAY NINGUNA GARANTÍA PARA EL PROGRAMA, EN LA MEDIDA PERMITIDA POR LA LEY APLICABLE. EXCEPTO CUANDO SE INDIQUE LO CONTRARIO POR ESCRITO, LOS TITULARES DE LOS DERECHOS DE AUTOR Y/O OTRAS PARTES PROPORCIONAN EL PROGRAMA \"TAL CUAL\" SIN GARANTÍA DE NINGÚN TIPO, YA SEA EXPRESA O IMPLÍCITA, INCLUIDAS, ENTRE OTRAS, LAS GARANTÍAS IMPLÍCITAS DE COMERCIABILIDAD Y ADECUACIÓN PARA UN PROPÓSITO EN PARTICULAR. TODO EL RIESGO EN CUANTO A LA CALIDAD Y EL RENDIMIENTO DEL PROGRAMA ES SUYA. SI EL PROGRAMA TUVIERA UN ERROR, USTED ASUME EL COSTE DE TODO SERVICIO, REPARACIÓN O CORRECCIÓN NECESARIOS.
ENTIENDO Y ACEPTO
@@ -333,7 +327,7 @@
El valor %1$s está fuera de límites
Comando remoto no permitido
El bolo remoto no está disponible. Inténtalo de nuevo más tarde.
- Para iniciar una basal de %1$.2f% durante %2$d min, responder con el código %3$s
+ Para iniciar una basal de %1$.2fU/h durante %2$d min, responder con el código %3$s
Para cambiar el perfil a %1$s %2$d%% responder con el código %3$s
Para iniciar un bolo extendido de %1$.2fU durante %2$d minutos, responder con el código %3$s
Para introducir %1$dg en %2$s responder con código %3$s
@@ -376,8 +370,11 @@
Botón 1
Botón 2
Botón 3
+ Unidades:
+ Unidades
mg/dl
mmol/l
+ Tiempo de acción de la insulina
Rango Objetivo:
Rango de visualización
Marcas Alta y Baja para gráficos en pantalla Inicio y Smartwatch
@@ -419,7 +416,7 @@
ComidendoPronto
Hipo
Actividad
- Eliminar registro:
+ Eliminar registro
Estadísticas de DanaR
TDD acumulativa
TDD ampliada exponencialmente
@@ -580,16 +577,13 @@
Todos los datos mandados a NS son borrados. AAPS esta conectado a NS pero no hay cambios en NS
Nivel base
Nivel bolo
- Bolo extendido
- Objectivo temporal
Cancelar bolo extendido
Edad sensor
Edad cánula
Edad insulina
horas
- Tipo basal
Perfil invalido !!!
- Cambio Perfil
+ Cambio de perfil
Edad batería bomba
Cambio batería bomba
Opciones alarma
@@ -638,7 +632,6 @@
CARBS Y BOLUS
CGM Y OPENAPS
BOMBA
- Dosis basal [U/h]
Duración [min]
OpenAPS SMB
SMB
@@ -658,7 +651,7 @@
Esperando para conectar con bomba
Conexión OK
Tiempo de Vinculación agotado
- CONECTANDO
+ Emparejando
Aparato no encontrado
Deposito vacío
Alerta de control de BG
@@ -769,7 +762,7 @@
Un bolo de mismo valor ha sido dado durante el pasado minuto. Para evitar bolos dobles y prevenir fallos de programa esto no está permitido.
Ahora
Leyendo historia bomba
- Historial
+ Historial de la bomba
Activando perfil base
Nivel del depósito bajo
Batería casi agotada
@@ -789,6 +782,7 @@
Sight
hace
%1$.2f h
+ %1$d min
Habilitar SMB siempre
Habilitar SMB siempre de forma independiente a los Bolos. Solo posible con fuente BG con buen filtrado de datos como G5
Habilitar SMB después de Carbohidratos
@@ -965,11 +959,11 @@
Sonido
Vibrar
Ambos
- Tiempo LCD encendido [s]
- Tiempo luz fondo encendida [s]
+ Tiempo de encendido de LCD [seconds]
+ Tiempo de luz fondo encendida [seconds]
Unidades de glucosa
- Apagar (horas)
- Deposito bajo (unidades)
+ Apagar [hours]
+ Depósito bajo [Units]
Guardar las opciones en la bomba
Activado
Desactivado
@@ -1187,7 +1181,7 @@
Hemos detectado que está ejecutando una versión no válida. ¡Bucle desactivado!
versión antigua
versión muy antigua
- Nueva versión desde al menos %1$d dias disponible! Respaldo a LGS después de 60 días, se deshabilitará el lazo después de 90 días
+ Nueva versión desde al menos %1$d dias disponible! Respaldo a LGS después de %2$d días, se deshabilitará el lazo después de %3$d días
2h
%1$.2fU
DexcomG App (parcheada)
@@ -1215,15 +1209,20 @@
Long:
Dist. [m]:
Nombre:
- La ubicación es %1$s
+ %1$s%2$s
+ Cuando
+ Cuando estés dentro de la zona
+ Cuando estés fuera de la zona
+ Cuando entres en el area llamada
+ Cuando dejes el área llamada
Último bolo
Hora del último bolo: hace %1$s %2$s min
COB
COB %1$s %2$.0f
Nombre de la tarea
Editar
- Por favor, elija el tipo de acción:
- Por favor, elija un tipo de activación:
+ Seleccionar un tipo de acción
+ Seleccione tipo de activador
Activadores:
ELIMINAR
Precondiciones:
@@ -1316,7 +1315,7 @@
Frecuencia de la infusora no soportada.
Dirección de RileyLink no válida.
El tipo de infusora detectado no es el mismo que el tipo configurado.
- Los perfiles basales no están habilitados en la infusora.
+ Los perfiles de basal/valor de los patrones no están activados en la bomba. Actívalos en la bomba.
El perfil basal establecido en la infusora es incorrecto (debe ser estándar).
Tipo incorrecto de basal temporal en la infusora (debe ser Absoluto).
Valor máximo incorrecto configurado en la infusora (debe ser %1$.2f).
@@ -1367,7 +1366,7 @@
Última conexión con la bomba [ minutos atrás]
Última conexión con la bomba hace %1$s %2$s min
Enviar a %1$s
- Enviar SMS a todos los números en las preferencias
+ Enviar SMS a todos los números
Mandar mensaje SMS
%2$+.2fU]]>
Restricción de bolo aplicada: %2$.2fU a %3$.2fU]]>
@@ -1389,6 +1388,10 @@
%1$d%%
Asistente Bolus
min
+ Nombre del perfil:
+ Seleccionado:
+ Unidades
+ ¿Desea cambiar el perfil y descartar los cambios realizados al perfil actual?
%1$dg
Activado
Desactivado
@@ -1396,4 +1399,51 @@
Limpieza iniciada
Detección de tiempo
¿Desea reiniciar el objetivo? Puedes perder tu progreso.
+ Ninguna bomba seleccionada
+ Seleccione las unidades en las que desea visualizar los valores
+ Subir cambios de perfil local a NS
+ DIA (Duración Insulina Activa)
+ IC
+ ISF
+ TARG
+ Clonar
+ Guardar o restablecer los cambios actuales primero
+ ¿Eliminar el perfil actual?
+ ¿Crear un nuevo perfil local a partir de este conmutador de perfil?
+ El nombre de perfil contiene puntos.\nEsto no está soportado por NS.\nEl perfil no se carga en NS.
+ Valor inferior del área de rango (sólo visualización)
+ Valor superior al área de rango (sólo visualización)
+ Repetir
+ Edad:
+ Peso:
+ ID:
+ Enviar
+ Perfil más común:
+ Nota: Sólo los datos visibles en esta pantalla se cargarán de forma anónima. El ID se asigna a esta instalación de AndroidAPS. Puede volver a enviar datos si cambia su perfil principal, pero deja que se ejecute al menos una semana para que el resultado sea visible en el tiempo en rango. Agradecemos su ayuda.
+ Encuesta
+ Entrada de edad no válida
+ Peso no válido
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Low: %2$02d%% In: %3$02d%% High: %4$02d%%]]>
+ Promedio
+ TDD
+ TIR
+ Monitor de actividad
+ ¿Desea restablecer las estadísticas de actividad?
+ Estadísticas
+ BG aleatorio
+ Generar datos aleatorios de BG (solo modo Demo)
+ BG
+ Herramientas
+ Mostrar cálculo
+ Error
+ 12 h
+ 24 h
+ Automatización de eventos
+ Set listo
+ Mensaje
+ ¿Borrar cola? ¡Se perderán todos los datos de la cola!
+ El uso de la función de bolo extendido detendrá el modo de bucle cerrado durante el tiempo de ejecución del bolo extendido. ¿Realmente quieres esto?
+ Bucle cerrado inhabilitado debido a la ejecución del bolo extendido
+ EB
diff --git a/app/src/main/res/values-fr-rFR/objectives.xml b/app/src/main/res/values-fr-rFR/objectives.xml
index b39e5ce285..89af39e082 100644
--- a/app/src/main/res/values-fr-rFR/objectives.xml
+++ b/app/src/main/res/values-fr-rFR/objectives.xml
@@ -46,10 +46,10 @@
Prochain non terminé
Code requis : %1$s
(Sélectionnez toutes les bonnes réponses)
- https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/fr/Getting-Started/Screenshots.html#the-homescreen
Non connecté à Internet
Échec de la récupération de l\'heure
Exigences de l\'objectif non atteintes
diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml
index 1d322049f8..2437913625 100644
--- a/app/src/main/res/values-fr-rFR/strings.xml
+++ b/app/src/main/res/values-fr-rFR/strings.xml
@@ -74,8 +74,6 @@
Ins:
IA:
IA Totale :
- Insuline
- Glucides
Gly
TT
Glucides
@@ -114,7 +112,6 @@
Aperçu
Profil NS
Profil simple
- Basal temporaire
Traitements
Pompe virtuelle
Careportal
@@ -146,21 +143,18 @@
Violation des restrictions
Erreur injection bolus
Erreur injection basal temporaire
- Valeur de Basal [%%]
- %% (100%% = actuel)
+ Valeur Basal [%]
Accepter nouveau basal temporaire :
Traitement
Calculatrice
Restriction appliquée !
Confirmation
- Entrez le nouveau traitement :
Bolus
Bolus:
Basal
Basal:
Glucides
Changez vos entrées !
- Définir un nouveau bolus étendu
Source des glycémies
Quelle source de données doit être utilisée par AndroidAPS ?
xDrip
@@ -187,7 +181,7 @@
Insertion Capteur MGC
Début Capteur MGC
Changement du Réservoir
- Changement profil
+ Changement de profil
Bolus Goûter
Bolus Repas
Bolus de correction
@@ -208,7 +202,7 @@
Pourcentage
Absolu
Notes
- Heure de l\'événement
+ Heure événement
Profil
Entré par
Source de Glycémie
@@ -233,7 +227,7 @@
Connection en cours
Connectée
Déconnectée
- Paramètres pompe DanaR
+ Paramètres de la pompe Dana
Contrat de Licence pour Utilisateur Final
NE DOIT PAS ÊTRE UTILISÉ POUR PRENDRE DES DÉCISIONS MÉDICALES. IL N\'Y A AUCUNE GARANTIE POUR LE PROGRAMME, DANS LA LIMITE PERMISE PAR LA LOI APPLICABLE. SAUF S\'IL EST INDIQUÉ LE CONTRAIRE PAR ÉCRIT. LES TITULAIRES DU DROIT D\'AUTEUR ET / OU D\'AUTRES PARTIES FOURNISSENT LE PROGRAMME «EN L\'ÉTAT» SANS GARANTIE D\'AUCUNE SORTE, EXPLICITE OU IMPLICITE, Y COMPRIS MAIS NON SEULEMENT AUX GARANTIES IMPLICITES DE QUALITÉ MARCHANDE ET D\'ADÉQUATION À UN USAGE PARTICULIER
L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME SONT DE VOTRE RESPONSABILITÉ. SI LE PROGRAMME EST DÉFECTUEUX, VOUS ASSUMEZ LE COÛT DE TOUS LES SERVICES, RÉPARATIONS OU CORRECTIONS NÉCESSAIRES.
@@ -284,7 +278,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Capteur
Manuel
Cible temp.
- Annulation Cible Temporaire
+ Annuler Cible Temporaire
Paramètres du profil DanaR
Durée d\'Action [h]
Durée d\'Action de l\'Insuline
@@ -377,8 +371,11 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Bouton 1
Bouton 2
Bouton 3
+ Unités :
+ Unités
mg/dl
mmol/l
+ DAI
Fourchette cible :
Fourchette de visualisation
Les repères hauts et bas sur les graphiques pour l\'aperçu et la montre
@@ -420,13 +417,13 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Repas imminent
Hypo
Activité
- Retirer l\'enregistrement :
+ Supprimer l\'enregistrement
Dana Stats
DTI cumulé
DTI avec Pondération Exponentielle
Basal
Bolus
- DTI Dosage Total d\'Insuline
+ DTI
Date
Ratio
Nb Jours
@@ -581,16 +578,13 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Toutes les données envoyées à NS sont abandonnées. AAPS est connecté à NS mais aucun changement n’est fait dans NS
Incrément Basal
Incrément Bolus
- Bolus étendu
- Cible Temporaire
Annuler Bolus étendu
Age Capteur
Age Cathéter
Age Insuline
heures
- Type du Basal
Profil incorrect !!!
- Changement Profil
+ Changer de profil
Age batterie pompe
Nouvelle Batterie Pompe
Options d\'alarme
@@ -614,7 +608,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Sensibilité Oref1
Sensibilité AAPS
Paramètres d’absorption
- Durée maximale d’absorption pour un repas
+ Durée max d’absorption d\'un repas [h]
Le temps estimé en heures pour une absorbption totale des glucides d’un repas
Afficher le bolus étendu en %%
AgeC
@@ -634,12 +628,11 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Les profils ne sont pas tous téléchargés !
Valeurs non enregistrées !
Active les diffusions vers d\'autres applications (comme xDrip). Ne pas activer si plusieurs instances d\'AAPS ou de NSClient sont installées !
- Activer les transmissions locales.
+ Activer les transmissions locales
ACTIVITÉ et FEEDBACK
GLUCIDES et BOLUS
MGC et OPENAPS
POMPE
- Valeur Basal [U/h]
Durée [min]
OpenAPS SMB
SMB
@@ -659,7 +652,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Attente de l\'appairage de la pompe
Appairage OK
Temps d\'appairage dépassé
- APPAIRAGE
+ Appairage
Jusqu\'à présent aucun appareil n\'a été trouvé
Réservoir vide
Alerte de mesure de glycémie
@@ -674,11 +667,11 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Pourcentage
Décalage horaire
Cibles Temporaires par défaut
- Durée pour le prochain repas [min]
+ durée repas imminent [min]
Cible Glyc. pour le prochain repas
Durée d\'activité
Cible Glycémie pour l\'activité
- Durée de période hypo [min]
+ durée hypo [min]
Cible Glycémie pendant l’hypo
Amorcer
Obtenir l\'état du bolus étendu
@@ -770,7 +763,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Un bolus avec la même quantité d’insuline a été demandé au cours de la dernière minute. Pour prévenir l’administration accidentelle de deux bolus à la fois et pour protéger contre les bugs, ceci (bolus) n\'est pas autorisé.
Maintenant
Lecture historique pompe
- Historique
+ Historique pompe
Définir le profil basal
Niveau réservoir pompe bas
Niveau batterie pompe bas
@@ -790,6 +783,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
AC-I
passé(e)s
%1$.2f h
+ %1$d min
Activer en permanence les SMB
Activer toujours SMB de manière autonome pour les bolus. Ceci est possible uniquement avec une source de glycémie ayant un très bon filtrage de données comme le G5
Activer SMB après ingestion de glucides
@@ -815,7 +809,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Notifier en SMB
Afficher SMB sur la montre comme un bolus standard.
Créer des messages d’erreurs
- Créer des annonces Nightscout pour les dialogues d’erreur et alertes locales (également visible dans Careportal sous Traitements)
+ Créer une annonce Nightscout pour les messages d\'erreur et les alertes locales (également visible dans la section Careportal de l\'onglet traitements)
Affichez les prédictions sur l\'écran de montre.
Prédictions
Choix de données
@@ -830,7 +824,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Catégorie
Sous-catégorie
Le bolus sera seulement enregistré
- Réassortiment automatique des glycémies manquantes en utilisant NS
+ Remplissage automatique des glycémies manquantes en utilisant NS
SMB défini par la pompe
Activité
Sensibilité
@@ -853,7 +847,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Le pourcentage de basal a changé dans la pompe mais sa lecture a échoué
Vérification des modifications de l\'historique
De multiples bolus similaires viennent d\'être importés dans la même minute. Un seul enregistrement a pu être ajouté aux traitements. Merci de vérifier la pompe et d\'ajouter manuellement un enregistrement de bolus en utilisant l\'onglet Careportal. Assurez vous de créer ce bolus avec un temps différent de tous les autres Bolus.
- \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)
+ \n\nhttps://androidaps.readthedocs.io/en/latest/CROWDIN/fr\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)
Le dernier bolus enregistré date d\'il y a plus de 24h ou est dans le futur. Vérifiez que la date dans la pompe est correctement définie.
L\'heure/date sur la pompe du dernier bolus administré semble erroné. L\'IA est probablement incorrecte. Vérifiez l\'heure/date de la pompe.
ProfileSwitch manquant. S’il vous plaît faire un changement de profil ou appuyez sur « Activer le profil » dans le LocalProfile.
@@ -966,11 +960,11 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Son
Vibration
Les deux
- Durée allumage écran [s]
- Durée rétroéclairage [s]
+ Durée affichage LCD [secondes]
+ Rétro-éclairage [secondes]
Unités glycémie
- Arrêt (heures)
- Réservoir bas (Unités)
+ Éteindre [heures]
+ Réservoir faible [Unités]
Enregistrer les options sur la pompe
Activé
Désactivé
@@ -1008,7 +1002,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Pas de données d\'Autosens disponibles
Paramètres journal
Réinitialiser les valeurs par défaut
- Dysfonctionnement du NSClient. Considérerez une réinitialisation de NS et de NSClient.
+ Dysfonctionnement NSClient. Faites une réinitialisation de NS et de NSClient.
AS
Version %1$s disponible
Décalage horaire
@@ -1062,9 +1056,9 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Arrêter la pompe
Mode de fonctionnement
État
- Bolus DTI
- DTI basale
- Total DTI
+ DTI Bolus
+ DTI Basale
+ DTI Total
Récupération en cours.
Non appairé
Dernière connexion
@@ -1188,7 +1182,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Nous avons détecté que vous utilisez une version invalide. Boucle désactivée !
ancienne version
très ancienne version
- Une nouvelle version est disponible depuis au moins %1$d jours ! Retour au traitement par pompe assistée par capteur (Arrêt par Glycémie Basse (AGB), Low Glucose Suspend (LGS) ) après 60 jours et la Boucle sera désactivée après 90 jours
+ Nouvelle version disponible depuis %1$d jours ! Retour à Arrêt Glycémie Basse (AGB) dans %2$d jours, la boucle sera désactivée dans %3$d jours
2 h
%1$.2fU
App Dexcom (patchée)
@@ -1203,28 +1197,33 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Début du profil %1$d%%
existe
n\'existe pas
- Temp cible %1$s
+ Cible Temp. %1$s
SSID WiFi %1$s %2$s
Autosens %1$s %2$s %%
Autosens %
%3$s %1$s %2$s
- Différence de glycémies
- Différence Glycémie [%1$s]
+ Delta de glycémies
+ Delta Glyc. [%1$s]
Localisation actuelle
Localisation
Lat :
Long :
Dist [m]:
Nom :
- La localisation est %1$s
+ %1$s %2$s
+ Quand
+ Quand vous êtes à l\'intérieur de la zone
+ Quand vous êtes à l\'extérieur de la zone
+ Quand vous entrez dans la zone
+ Quand vous sortez de la zone
Lors du dernier Bolus
- Dernièr Bolus %1$s il y a %2$s min
+ Heure du dernier bolus %1$s il y a %2$s min
GA
GA %1$s %2$.0f
Nom de tâche
ÉDITER
- Merci de choisir un type d\'action :
- Merci de choisir un type de déclencheur :
+ Choisir un type d\'action
+ Choisir un type de déclencheur
Déclencheurs :
SUPPRIMER
Conditions préalables :
@@ -1317,7 +1316,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Fréquence de pompe non pris en charge.
Adresse RileyLink invalide.
Le type de pompe détecté n\'est pas le même que le type configuré.
- Les profils Basal ne sont pas activés sur la pompe.
+ Le réglage des profils de basal n\'est pas activé sur la pompe. Activez-le sur la pompe.
Le profil Basal défini sur la pompe est incorrect (doit être STD).
Mauvais type DBT (TBR) réglé sur la pompe (doit être Absolu).
Mauvais paramètre Max Bolus sur la pompe (doit être %1$.2f).
@@ -1365,10 +1364,10 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Remplacer le profil par
Remplacer le profil par %1$s
Dernière connexion à la pompe
- Dernière connexion de pompe [minutes]
- Dernière connexion à la pompe %1$s il y a %2$s min
+ Dernière connexion [min]
+ Dernière connexion pompe %1$s il y a %2$s min
Envoyer SMS : %1$s
- Envoyer SMS à tous les numéros dans les préférences
+ Envoyer SMS à tous les numéros
Envoyer SMS avec du texte
%2$+.2fU]]>
Contraintes de Bolus appliquées : %2$.2fU à %3$.2f]]>
@@ -1390,10 +1389,63 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
%1$d%%
Assistant Bolus
min
+ Nom du profil :
+ Sélectionné :
+ Unités
+ Voulez-vous changer de profil et annuler les modifications faites dans le profil actuel ?
%1$dg
On
Off
Suppression terminée
Suppression démarrée
+ Détection de temps
Voulez-vous réinitialiser le début de l\'objectif ? Vous risquez de perdre vos progrès.
+ Aucune pompe sélectionnée
+ Sélectionnez les unités dans lesquelles vous souhaitez afficher les valeurs
+ Remonter les modifications de profil local dans NS
+ DAI
+ G/I
+ SI
+ CIBLE
+ Dupliquer
+ Sauver ou réinitialiser les modifications actuelles en premier
+ Supprimer le profil actuel ?
+ Créer un nouveau profil local à partir de ce changement de profil ?
+ Le nom du profil contient des points.\nCe n\'est pas pris en charge par NS.\nLe profil n\'est pas remonté dans NS.
+ Valeur inférieure dans la plage (affichage uniquement)
+ Valeur supérieure dans la plage (affichage uniquement)
+ Réordonner
+ Âge :
+ Poids :
+ ID :
+ Envoyer
+ Profil le plus courant :
+ Remarque : seules les données visibles sur cet écran seront téléchargées de manière anonyme. L\'ID est attribué à cette installation d\'AndroidAPS. Vous pouvez soumettre à nouveau des données si votre profil principal est modifié, mais laissez-le fonctionner au moins pendant une semaine pour rendre le résultat visible dans le temps. Votre aide est appréciée.
+ Sondage
+ Âge invalide
+ Poids invalide
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Bas: %2$02d%% Médian: %3$02d%% Haut: %4$02d%%]]>
+ Moyenne
+ DTI
+ TIR
+ Moniteur d\'activité
+ Voulez-vous réinitialiser les stats d\'activité ?
+ Statistiques
+ Gly Aléatoire
+ Générer des glycémies aléatoires (mode démo uniquement)
+ Gly
+ Outils
+ Afficher le calcul
+ Erreur
+ 12h
+ 24h
+ Evénement d\'automatisation
+ Déjà configuré
+ Message
+ Effacer la file d\'attente ? Toutes les données en file d\'attente seront perdues !
+ L\'utilisation du bolus étendu arrètera la boucle fermée pour la durée d\'exécution du bolus étendu. Voulez-vous vraiment le faire ?
+ Boucle fermée désactivée à cause du bolus étendu
+ EB
+ \"Vérif. du téléphone\"
diff --git a/app/src/main/res/values-ga-rIE/strings.xml b/app/src/main/res/values-ga-rIE/strings.xml
index df88c88e20..d4b0807169 100644
--- a/app/src/main/res/values-ga-rIE/strings.xml
+++ b/app/src/main/res/values-ga-rIE/strings.xml
@@ -5,6 +5,22 @@
+ Sainroghanna
+ An bhfuil tú cinnte gur mian leat an bhunachair sonraí a athshocrú?
+ Le do thoil atosaigh do ghuthán nó atosaigh AndroidAPS ó Socruithe an Chórais \nmura dhéanann tú é seo, ní bheidh logáil ag na appana AndroidAPS (tá sé tábhachtach na halgartaim a rianú agus a fhíorú go bhfuil siad ag obair i gceart)!
+ Luachanna BG a fháil ón 600SeriesAndroidUploader.
+ Sonraí a íoslódáil ó Nightscout
+ Luachanna BG a fháil ó xDrip.
+ Cuspóir
+ mg/dL
+ mmol/l
+ MM640g
+ TBB * 2
+ IOB
+ COB
+ PBAGE
+ OAPS
+ SMB
diff --git a/app/src/main/res/values-it-rIT/objectives.xml b/app/src/main/res/values-it-rIT/objectives.xml
index 6097ec7ddd..d3cf5f110c 100644
--- a/app/src/main/res/values-it-rIT/objectives.xml
+++ b/app/src/main/res/values-it-rIT/objectives.xml
@@ -41,15 +41,15 @@
Codice non valido
Dai prova della tua conoscenza
Studia e rispondi correttamente alle domande
- Risposta disabilitata per: %1$s
+ Risposta disabilitata fino a: %1$s
Risposta sbagliata!
Prossimo N.C.
Codice richiesta: %1$s
(segna tutte le risposte corrette)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Non connesso a internet
Impossibile recuperare l\'orario
Requisiti obiettivo non soddisfatti
diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml
index d352436aa5..8f8afcf3b8 100644
--- a/app/src/main/res/values-it-rIT/strings.xml
+++ b/app/src/main/res/values-it-rIT/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
IOB totale:
- Insulina
- CHO
BG
TT
CHO
@@ -114,7 +112,6 @@
Panoramica
Profilo NS
Profilo semplice
- Basale temporanea
Trattamenti
Micro Virtuale
Portale
@@ -135,7 +132,7 @@
Loop
Usalo per attivare l\'integrazione del loop di AndroidAPS.
APS
- Dopo aver elaborato i vincoli
+ Dopo elaborazione vincoli
Basale temporanea impostata dal micro
Ultima attivazione
OK
@@ -146,22 +143,19 @@
Violazione dei vincoli
Errore erogazione bolo
Errore erogazione basale temporanea
- Valore Basale [%%]
- %% (100%% = corrente)
+ Valore basale [%]
Accetta nuova basale temporanea:
Trattamento
Calcolatore
Vincolo applicato!
Conferma
- Inserisci nuovo trattamento:
Bolo
Bolo:
Basale
Basale
CHO
Cambia il tuo input!
- Imposta nuovo bolo esteso:
- Origine glicemia
+ Origine BG
Da dove AndroidAPS dovrebbe ottenere i suoi dati?
xDrip
Modalità APS
@@ -178,7 +172,7 @@
IOB da basale
Vincolo bolo applicato
Vincolo CHO applicato
- Controllo glicemia
+ Controllo BG
Annuncio
Nota
Domanda
@@ -208,7 +202,7 @@
Percentuale
Assoluto
Note
- Data evento
+ Ora evento
Profilo
Inserito da
Tipo glicemia
@@ -233,7 +227,7 @@
Connessione
Connesso
Disconnesso
- Impostazioni micro DanaR
+ Impostazioni micro Dana
Contratto di licenza per l\'utente
NON DEVE ESSERE UTILIZZATO PER PRENDERE DECISIONI MEDICHE. NON ESISTE ALCUNA GARANZIA PER IL PROGRAMMA, NELLA MISURA CONSENTITA DALLA LEGGE APPLICABILE. TRANNE QUANDO DIVERSAMENTE INDICATO PER ISCRITTO, I DETENTORI DEL COPYRIGHT E/O ALTRE PARTI FORNISCONO IL PROGRAMMA \"COSÌ COM\'È\" SENZA GARANZIA DI ALCUN TIPO, ESPLICITA O IMPLICITA, INCLUSE, MA NON LIMITATAMENTE A, GARANZIE IMPLICITE DI COMMERCIABILITÀ E IDONEITÀ PER UN SCOPO PARTICOLARE. L\'INTERO RISCHIO RIGUARDO LA QUALITÀ E LE PRESTAZIONI DEL PROGRAMMA È TUO. SE IL PROGRAMMA DOVESSE RISULTARE DIFETTOSO, TI ASSUMI IL COSTO DI TUTTE LE NECESSARIE MANUTENZIONI, RIPARAZIONI O CORREZIONI.
COMPRENDO E ACCETTO
@@ -252,7 +246,7 @@
Attivato
Commento
OK
- Per cento
+ Percentuale
Assoluto
Cancellare basale temporanea
Comunicazioni SMS
@@ -401,8 +395,8 @@
Abilita bolo esteso sul micro
Cambia la modalità da U/d a U/h nel micro
Valore basale inferiore al minimo. Profilo non impostato!
- Glicemia:
- Ultima glicemia:
+ BG:
+ Ultimo BG:
MDI
MM640g
Notifica in corso
@@ -422,7 +416,7 @@
Pasto a breve
Ipoglicemia
Attività
- Rimuovi record:
+ Rimuovi record
Statistiche DanaR
TDD cumulativo
TDD esponenzialmente ponderato
@@ -583,16 +577,13 @@
Tutti i dati inviati a NS vengono rifiutati. AAPS è connesso a NS, ma non vengono apportate modifiche
Incremento basale
Incremento bolo
- Bolo esteso
- TempTarget
Cancella bolo esteso
Età sensore
Età cannula
Età insulina
ore
- Tipo basale
Profilo non valido !!!
- Cambio profilo
+ Cambia profilo
Età batteria micro
Cambio batteria micro
Opzioni allarme
@@ -629,7 +620,7 @@
EXT
Mantieni lo schermo acceso
Evita che Android disattivi lo schermo. Consumerà molta energia quando non è collegato alla presa di corrente.
- Attivando la funzione Autosense, ricorda di dichiarare tutti i carboidrati assunti. Altrimenti le deviazioni di glicemia dovute ai carboidrati saranno identificate erroneamente come variazione di sensibilità !!
+ Attivando la funzione Autosense, ricorda di inserire tutti i carboidrati assunti. Altrimenti le deviazioni di glicemia dovute ai carboidrati saranno identificate erroneamente come variazione di sensibilità !!
Sensibilità WeightedAverage
OK
Annulla
@@ -641,7 +632,6 @@
CHO & BOLO
CGM & OPENAPS
MICRO
- Valore basale [U/h]
Durata [min]
OpenAPS SMB
SMB
@@ -661,7 +651,7 @@
In attesa di associare il micro
Associazione OK
Time out associazione micro
- ASSOCIAZIONE
+ Accoppiamento
Nessun dispositivo trovato finora
Serbatoio vuoto
Avviso misurazione glicemia
@@ -709,10 +699,10 @@
Il comando verrà eseguito ora
Driver del micro corretto
Micro irraggiungibile
- Letture glicemia mancanti
+ Letture BG mancanti
Usa le notifiche di sistema per gli avvisi
Allarmi locali
- Allarme se non si ricevono dati glicemia
+ Allarme se non si ricevono dati BG
Allarme se il micro non è raggiungibile
Soglia micro irraggiungibile [min]
Allarme urgente
@@ -721,19 +711,19 @@
BT Watchdog
Spegne il bluetooth del telefono per qualche secondo se non è possibile alcuna connessione al micro. Questo può essere utile su alcuni telefoni.
Eversense app (modificata)
- Carica dati glicemia su NS
- Impostazioni caricamento glicemia
+ Carica dati BG su NS
+ Impostazioni caricamento BG
Mostra delta dettagliato
Mostra delta con una cifra decimale in più
Max minuti SMB
Max minuti di basale a cui limitare SMB
Firmware del micro non supportato
- Invia dati glicemia a xDrip+
+ Invia dati BG a xDrip+
In xDrip+ seleziona origine dati 640g/Eversense
- Glicemia NSClient
+ BG NSClient
Valore basale sostituito dal minimo valore supportato: %1$s
Valore basale sostituito dal massimo valore supportato: %1$s
- Calcolo glicemia
+ Calcolo BG
Calcolo IOB da bolo
Calcolo IOB da basale
Calcolo trend
@@ -749,7 +739,7 @@
NSClient ha il permesso di scrittura
Modalità chiusa abilitata
Max IOB impostata correttamente
- Glicemia disponibile da sorgente selezionata
+ BG disponibile da sorgente selezionata
Valori basali non allineati alle ore: %1$s
Profilo non valido: %1$s
Programmazione micro per erogazione
@@ -772,7 +762,7 @@
Un bolo con la stessa quantità è stato richiesto negli ultimi due minuti. Questo non è consentito al fine di evitare boli doppi accidentali e a protezione di eventuali \"bug\".
Adesso
Lettura storico micro
- storico micro
+ Storico micro
Impostazione profilo basale
Livello serbatoio basso
Livello batteria basso
@@ -792,6 +782,7 @@
Sight
fa
%1$.2f h
+ %1$d min
Abilita SMB sempre
Abilita SMB sempre, indipendentemente dai boli. Possibile solo con sorgente glicemia con un buon filtraggio dei dati, come G5
Abilita SMB dopo i CHO
@@ -931,7 +922,7 @@
Definizione micro
Bolo: Step=%1$s\nBolo Esteso: [Step=%2$s, Durata=%3$smin-%4$sh]\nBasale: Step=%5$s\nTBR: %6$s (di %7$s), Durata=%8$smin-%9$sh\n%10$s
* Sono supportati solo valori discreti, non intervalli di valori, come incrementi per basale/bolo nel micro virtuale.
- Riempimento automatico glicemie
+ Riempimento automatico BG
Impostazioni Calcolatore
Calcoli inclusi nel risultato del Calcolatore:
Impostazioni di visualizzazione
@@ -949,7 +940,7 @@
https://github.com/MilosKozak/AndroidAPS/wiki/Sensitivity-detection-and-COB
NSClient gestisce la connessione a Nightscout. Puoi saltare questa parte ora, ma non sarai in grado di superare gli obiettivi fino a quando non ne porterai a termine la configurazione.
Ricorda: i nuovi profili di insulina richiedono una DIA di almeno 5h. DIA di 5 - 6h sui nuovi profili sono uguali a DIA di 3h sui vecchi profili di insulina.
- Configura sorgente glicemia
+ Configura sorgente BG
Seleziona il tipo di profilo. Se il paziente è un bambino dovresti utilizzare il profilo di NS. Se non c\'è nessuno a seguirti su Nightscout probabilmente preferirai il profilo locale. Ricorda che stai solo selezionando la sorgente del profilo. Per utilizzarlo devi attivarlo tramite l\'esecuzione del comando \"Cambio profilo\"
Seleziona uno degli algoritmi disponibili. Sono ordinati dal più vecchio al più recente. L\'algoritmo più recente è solitamente più potente e più aggressivo. Pertanto, se sei un nuovo utente, probabilmente dovresti iniziare con AMA e non con l\'ultimo. Non dimenticare di leggere la documentazione di OpenAPS e di configurarlo prima dell\'uso.
Avvia il tuo primo obiettivo
@@ -968,11 +959,11 @@
Suono
Vibrazione
Entrambi
- LCD acceso [s]
- Retroilluminazione accesa [s]
+ LCD attivo [seconds]
+ Retroilluminazione attiva [seconds]
Unità glucosio
- Spegnimento(ore)
- Livello serbatoio basso (Unità)
+ Spegnimento [hours]
+ Livello serbatoio basso [Units]
Salva opzioni nel micro
On
Off
@@ -1120,11 +1111,11 @@
Glicemia non disponibile
Glicemia %1$s %2$.0f %3$s
Glicemia %1$s %2$.1f %3$s
- Pct profilo %1$s %2$d
+ PCT profilo %1$s %2$d
IOB %1$s %2$.1f
- And
- Or
- Xor
+ E
+ O
+ O (esclusivo)
A %1$s
Usa posizione di rete
Usa posizione GPS
@@ -1164,7 +1155,7 @@
Carica trattamenti (insulina, carboidrati)
Carica basali temporanee
Carica cambi profilo, target temporanei
- Carica test glicemia
+ Carica test BG
Cambio all\'ora legale in 24h o meno
Cambio all\'ora legale avvenuto meno di 3 ore fa - Loop chiuso disabilitato
vincolo di archiviazione interna
@@ -1173,7 +1164,7 @@
Codice errato. Comando annullato.
Non configurato
Cambio profilo creato
- Ora ripetizione
+ Tempo ricorrente
Ogni
Mai
%1$dmin
@@ -1184,13 +1175,13 @@
CANC
AGG
COPIA
- Aggiungere nuovo
+ Aggiungi nuovo
Controllo Versione
Verificatore firma
Abbiamo rilevato che stai eseguendo una versione non valida. Loop disabilitato!
versione datata
versione molto datata
- Nuova versione disponibile da %1$d giorni! Ritorno a LGS trascorsi 60 giorni, disattivazione del loop dopo 90 giorni
+ Nuova versione disponibile per almeno %1$d giorni! Ritorno a LGS dopo %2$d giorni, disattivazione del loop dopo %3$d giorni
2h
%1$.2fU
Dexcom app (modificata)
@@ -1210,23 +1201,28 @@
Autosens %1$s %2$s %%
Autosens %
%3$s %1$s %2$s
- Differenza glicemia
- Differenza glicemia [%1$s]
+ Differenza BG
+ Differenza BG [%1$s]
Posizione corrente
Posizione
Lat:
Lon:
Dist [m]:
Nome:
- La posizione è %1$s
+ %1$s %2$s
+ Quando
+ Quando sei all\'interno dell\'area
+ Quando sei all\'esterno dell\'area
+ Quando accedi all\'area denominata
+ Quando lasci l\'area denominata
Ultimo bolo
Ora ultimo bolo %1$s %2$s min fa
COB
COB %1$s %2$.0f
Nome task
MODIFICA
- Scegli un tipo di azione:
- Scegli un tipo di trigger:
+ Scegli un tipo di azione
+ Scegli un tipo di trigger
Trigger:
RIMUOVI
Presupposti:
@@ -1319,7 +1315,7 @@
Frequenza micro non supportata.
Indirizzo RileyLink non valido.
Il tipo di micro rilevato non è uguale al tipo configurato.
- I profili basali non sono abilitati nel microinfusore.
+ L\'impostazione di modelli/profili basali non è abilitata sul micro. Abilitala sul micro.
Il profilo basale impostato nel micro non è corretto (deve essere STD).
Tipo TBR errato impostato nel micro (deve essere Assoluto).
Max bolo errato impostato nel micro (deve essere %1$.2f).
@@ -1370,7 +1366,7 @@
Ultima connessione al micro [minuti fa]
Ultima connessione al micro %1$s %2$s min fa
Invia SMS: %1$s
- Invia SMS a tutti i numeri nelle preferenze
+ Invia SMS a tutti i numeri
Invia SMS con testo
%2$+.2fU]]>
Vincolo Bolo applicato: %2$.2fU a %3$.2fU]]>
@@ -1417,4 +1413,40 @@
Il nome profilo contiene dei punti.\nQuesto non è supportato da NS.\nIl profilo non viene caricato in NS.
Valore più basso per l\'intervallo di visualizzazione dell\'area \"in range\"
Valore più alto per l\'intervallo di visualizzazione dell\'area \"in range\"
+ Riordina
+ Età:
+ Peso:
+ ID:
+ Invia
+ Profilo più comune:
+ Nota: solo i dati visibili su questa schermata verranno caricati (in modo anonimo). Un ID è assegnato a questa installazione di AndroidAPS. Puoi inviare nuovamente i dati se il tuo profilo principale viene modificato, ma lascialo in esecuzione almeno per una settimana per rendere visibili i risultati nel time in range. Il tuo aiuto è apprezzato.
+ Sondaggio
+ Inserimento età non valido
+ Inserimento peso non valido
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Basso: %2$02d%% In: %3$02d%% Alto: %4$02d%%]]>
+ Media
+ TDD
+ TIR
+ Monitor attività
+ Vuoi resettare le statistiche sull\'attività?
+ Statistiche
+ BG casuale
+ Genera dati glicemia casuali (solo modalità demo)
+ BG
+ Strumenti
+ Mostra calcolo
+ Errore
+ 12h
+ 24h
+ Evento di automazione
+ Già impostato
+ Messaggio
+ Cancellare la coda? Tutti i dati in coda andranno persi!
+ L\'uso della funzione bolo esteso interromperà la modalità loop chiuso per il tempo di esecuzione del bolo esteso. Lo vuoi davvero?
+ Loop chiuso disabilitato a causa dell\'esecuzione di un bolo esteso
+ BE
+ \"PhoneChecker\"
+ Menu grafico
+ AS
diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml
index 79706233d5..167b2d0412 100644
--- a/app/src/main/res/values-ko-rKR/strings.xml
+++ b/app/src/main/res/values-ko-rKR/strings.xml
@@ -74,8 +74,6 @@
인슐린:
IOB:
IOB 총량:
- 인슐린 양
- 탄수화물 양
혈당
임시목표
탄수화물
@@ -113,7 +111,6 @@
개요
NS 프로파일
Simple 프로파일
- 임시Basal
관리
가상펌프
케어포털
@@ -145,21 +142,17 @@
제한 위반
Bolus 주입 에러
임시Basal 주입 에러
- Basal 값[%%]
- %% (100%% = 현재)
새 임시Basal 적용:
관리
계산기
제한 적용!
확인
- 새 Treatment 입력:
Bolus
Bolus:
Basal
Basal:
탄수화물
입력값을 변경하세요!
- 새 확장Bolus 설정:
혈당 소스
AndroidAPS가 어디에서 데이터를 가져옵니까?
xDrip
@@ -186,7 +179,6 @@
CGM 센서 삽입
CGM 센서 시작
인슐린 카트리지 교체
- 프로파일 변경
간식Bolus
식사Bolus
교정Bolus
@@ -207,7 +199,6 @@
퍼센트
절대값
노트
- 이벤트 시간
프로파일
입력자
혈당 종류
@@ -231,7 +222,6 @@
연결중
연결됨
연결 끊김
- 다나R 펌프 설정
최종 사용자 라이선스 동의서
이 프로그램을 의학적 결정을 내리는 데 사용해서는 안되며, 여기에 대한 어떠한 보증도 없습니다. 이 프로그램의 품질과 성능에 관한 모든 위험은 사용자에게 있습니다.\nMUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
모두 이해하였고 동의합니다.
@@ -268,8 +258,6 @@
체혈
센서
수동
- 임시목표
- 임시목표 취소
DanaR 프로파일 설정
인슐린활동시간(DIA) [h]
인슐린 활동 기간
@@ -402,7 +390,6 @@
식사직전
저혈당
활동
- 기록 삭제:
DanaR 통계
누적 일총량
지수가중 일총량
@@ -559,16 +546,12 @@
NS로 보낼 모든 데이터가 버려집니다. AAPS는 NS에 연결되어 있지만 NS에는 변화가 없을것입니다.
Basal 단위
Bolus 단위
- 확장Bolus
- 임시목표
확장Bolus 취소
센서 사용기간
캐뉼라 사용기간
인슐린 사용기간
시간
- Basal 종류
프로파일이 유효하지 않습니다!!!
- 프로파일변경
펌프배터리사용기간
펌프 배터리 교체
알람 옵션
@@ -616,7 +599,6 @@
탄수화물 & Bolus
CGM & OPENAPS
펌프
- Basal값 [U/h]
기간 [min]
OpenAPS SMB
SMB
@@ -636,7 +618,6 @@
펌프연동 대기중
연동완료
연동시간초과
- 연동중
현재까지 발견된 기기가 없습니다.
빈 주사기
혈당측정알람
@@ -745,7 +726,6 @@
2개의 동일한 양의 Bolus 주입이 요청되었습니다. 이중으로 Bolus가 주입 되는 사고를 막고 버그로부터 보호하기 위하여 이는 금지됩니다.
현재
펌프 이력 읽기
- 펌프 이력
Basal 프로파일 설정
펌프 카트리지 레벨이 낮습니다.
펌프배터리가 부족합니다.
@@ -941,11 +921,7 @@
소리
진동
모두
- LCD 시간[s]
- 화면조명 시간[s]
혈당 단위
- 종료(시간)
- 낮은 주사기량(단위)
펌프로 옵션 저장
켜짐
꺼짐
@@ -1161,7 +1137,6 @@
유효하지 않은 버전을 이용 중입니다. Loop가 비활성화 되었습니다!
오래된 버전
아주 오래된 버전
- 최소 %1$d일 새버전이 가능합니다! 60일 후엔 LGS(저혈당 주입중지기능)으로 복귀되며, 90일이후엔 Loop가 비활성화 될 것입니다.
2h
%1$.2fU
Dexcom 앱(패치버전)
@@ -1189,15 +1164,12 @@
경도
거리 [m]:
이름:
- 위치는 %1$s
마지막 Bolus 전
마지막 Bolus 시간 %1$s %2$s 분 전
COB
COB %1$s %2$.0f
작업명
편집
- 액션 타입을 선택하세요:
- 트리거 타입을 선택하세요:
트리거:
삭제
전제 조건:
@@ -1287,7 +1259,6 @@
지원되지 않는 펌프 주파수입니다.
RileyLink 주소가 유효하지 않습니다.
감지된 펌프타입이 설정된 타입과 다릅니다.
- 펌프에서 Basal 프로파일이 활성화되지 않았습니다.
펌프에 설정된 Basal 프로파일이 올바르지 않습니다 (STD 이어야 합니다).
펌프에 잘못된 TBR 유형이 설정되었습니다 (절대값이어야합니다).
펌프에 잘못된 최대 Bolus가 설정되었습니다 (%1$.2f 이어야 합니다.).
diff --git a/app/src/main/res/values-lt-rLT/objectives.xml b/app/src/main/res/values-lt-rLT/objectives.xml
index 95034771a6..bf4a460fae 100644
--- a/app/src/main/res/values-lt-rLT/objectives.xml
+++ b/app/src/main/res/values-lt-rLT/objectives.xml
@@ -36,6 +36,7 @@
Parodyti Ciklo įskiepio turinį
Panaudokite vaizdo dydžio keitimo funkciją ilgai spaudžiant ant glikemijos kreivės
Įeiti
+ Jei anksčiau naudojote OpenAPS ir jūsų Nightscout svetainėje yra bent trijų mėnesių uždaro ciklo duomenų, galite atsiųsti el. laišką objectives@androidaps.org su savo NS svetainės adresu, ir paprašykite kodo, kad praleistumėte likusius tikslus. Įveskite kodą, kurį pateikė kūrėjai
Kodas priimtas
Neteisingas kodas
Patvirtinkite savo žinias
@@ -45,10 +46,10 @@
Kitas neužbaigtas
Paprašyti kodo: %1$s
(pasirinkite visus teisingus atsakymus)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Neprisijungta prie interneto
Nepavyko nuskaityti laiko
Tikslo reikalavimai neįvykdyti
diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml
index 4ef25d9fbc..4b6fac99cb 100644
--- a/app/src/main/res/values-lt-rLT/strings.xml
+++ b/app/src/main/res/values-lt-rLT/strings.xml
@@ -74,8 +74,6 @@
Ins:
AIO:
Visas AIO:
- Insulinas
- AV
KG
LT
AV
@@ -114,7 +112,6 @@
Apžvalga
NS profilis
Paprastas profilis
- Laikina bazė
Terapija
Virtuali pompa
Priežiūra
@@ -146,21 +143,18 @@
Apribojimų pažeidimas
Boluso suleidimo klaida
Laikinos bazės suleidimo klaida
- Valandinė bazė [%%]
- %%(100%% - pasirinkta)
+ Valandinė bazė [%]
Patvirtinti naują laikiną bazę:
Terapija
Skaičiuotuvas
Taikomas ribojimas!
Patvirtinimas
- Įvesti naują paskyrimą:
Bolusas
Bolusas:
Valandinė bazė
Valandinė bazė:
AV
Pakeiskite įvestus duomenis!
- Nustatyti naują ištęstą bolusą:
KG šaltinis
Iš kur AndroidAPS gaus duomenis?
xDrip
@@ -182,18 +176,18 @@
Pranešimas
Pastaba
Klausimas
- FA-fizinis aktyvumas
+ Fizinis aktyvumas
Kateterio keitimas
- CGM sensoriaus įvedimas
- CGM sensoriaus paleidimas
+ NGJ sensoriaus įvedimas
+ NGJ sensoriaus paleidimas
Insulino rezervuaro keitimas
Profilio keitimas
- Užkandžio bolusas
+ Bolusas užkandžiui
Bolusas valgiui
Bolusas korekcijai
Kombinuotas bolusas
- Pradėti laikiną bazę
- Užbaigti laikiną bazę
+ Pradėta laikina bazė
+ Užbaigta laikina bazė
Angliavandeniai korekcijai
OpenAPS neprisijungus
Įvykio tipas
@@ -208,7 +202,7 @@
Procentai
Absoliutus
Pastabos
- Įvykio laikas
+ Įvykio laikas
Profilis
Įvedė
Gliukozės tipas
@@ -233,7 +227,7 @@
Jungiamasi
Prisijungta
Atsijungta
- DanaR pompos nustatymai
+ Dana pompos nustatymai
Licencinė sutartis su vartotoju
PROGRAMA NEGALI BŪTI NAUDOJAMA GYDYMO SPRENDIMAMS PRIIMTI. PAGAL GALIOJANČIUS ĮSTATYMUS PROGRAMA NESUTEIKIA JOKIŲ GARANTIJŲ VARTOTOJUI. JEI RAŠTU NENURODYTA KITAIP, PROGRAMOS AUTORINIŲ TEISIŲ TURĖTOJAS IR/AR KITOS ŠALYS PATEIKIA PROGRAMĄ \"KAIP YRA\" BE JOKIŲ GARANTIJŲ, TIEK AKIVAIZDŽIŲ, TIEK NUMANOMŲ, ĮSKAITANT, BET NEAPSIRIBOJANT GALIMYBĘ NAUDOTI PROGRAMĄ KOMERCINIAMS AR KITOKIEMS DALINIAMS TIKSLAMS. RIZIKĄ, KYLANČIĄ NAUDOJANT PROGRAMĄ PRISIIMA PATS VARTOTOJAS. JEI PROGRAMA VEIKIA NETINKAMAI, IŠLAIDOS, SUSIJUSIOS SU PROGRAMOS SERVISU, TAISYMU AR KOREGAVIMU, TENKA VARTOTOJUI.
SUPRATAU IR SUTINKU
@@ -260,18 +254,30 @@
Leidžiami telefono numeriai
+370XXXXXXXX; +370YYYYYYYY
Norėdami suleisti %1$.2fvv bolusą, atsakykite kodu %2$s
+ Norėdami suleisti %1$.2fvv bolusą, atsakykite su kodu %2$s
+ Norėdami nustatyti laikiną tikslą %1$s, atsakykite su kodu %2$s
+ Norėdami atšaukti laikiną tikslą, atsakykite su kodu %1$s
+ Norėdami išjungti SMS nuotolinį valdymą, atsakykite kodu %1$s.\n\n Turėkite omenyje, kad jūs funkciją galėsite atnaujinti tiesiai tik iš AAPS pagrindinio telefono.
+ SMS nuotolinio valdymo funkcija sustojo. Norėdami ją atnaujinti, naudokite AAPS pagrindinį išmanųjį telefoną.
Norėdami nusiųsti kalibraciją %1$.2f, atsakykite kodu %2$s
Bolusas nesuleistas
+ Minimalus minučių skaičius, kuris turi praeiti nuo vieno boluso, suleisto nuotoliniu būdu iki kito
+ Kiek mažiausiai minučių turi praeiti tarp vieno ir kito boluso
+ Jūsų saugumui, norėdami redaguoti šį pasirinkimą, jums reikia pridėti ne mažiau kaip 2 telefono numerius.
%1$.2fvv bolusas sėkmingai suleistas
Bus suleista %1$.2fvv
%1$.2fvv bolusas sėkmingai suleistas
+ Bolusas %1$.2fvv sėkmingai suleistas
+ Tikslas %1$s %2$d minutėms
+ Tikslas %1$s %2$d minutėms nustatytas sėkmingai
+ Laikinas tikslas atšauktas sėkmingai
Leidžiama %1$.2fvv
Leisti nuotolines komandas SMS žinutėmis
Iš piršto
Iš sensoriaus
Rankiniu būdu
Laikinas tikslas
- Atšaukti laikiną tikslą
+ Laikino tikslo atšaukimas
DanaR profilio nustatymai
IVT [h]
Insulino veikimo trukmė
@@ -324,10 +330,13 @@
Norėdami aktyvuoti %1$.2fvv/val bazę, kurios trukmė %2$d min, atsakykite kodu %3$s
Norėdami perjungti profilį %1$s %2$d%%, atsakykite kodu %3$s
Norint pradėti ištęstinį bolusą %1$.2fvv %2$d min., atsakykite kodu %3$s
+ Įvedimui %1$dg %2$s atsakykite kodu %3$s
Norėdami aktyvuoti %1$d%% bazę %2$d min., atsakykite kodu %3$s
Norėdami sustabdyti Ciklą %1$d min., atsakykite kodu %2$s
%1$.2f vv/val laikina bazė, kurios trukmė %2$d min., aktyvuota sėkmingai
%1$.2f vv ištęstas bolusas, kurio trukmė %2$d min., aktyvuotas sėkmingai
+ %1$dg angliavandeniai įrašyti sėkmingai
+ Įvesti %1$dg angliavandenių nepavyko
%1$d%% laikina bazė, kurios trukmė %2$d min., aktyvuota sėkmingai
Laikina bazė neaktyvuota
Ištęstinis bolusas nepradėtas
@@ -354,15 +363,18 @@
Duomenys tik perkeliami į Nightscout. Gliukozės duomenys perkeliami tik tada, kai naudojama lokali programa, pvz.: xDrip. Naudojant NS-profilį, kiti profiliai neaktyvūs.
Pompa neprijungta!
Pompa neprijungta, profilis nepasirinktas!
- Užpildyti kateterį/adatą
+ Užpildymas
Įsitikinkite, kad nurodytas kiekis atitinka Jūsų infuzijos rinkinio specifikaciją!
Kita
Standartiniai insulino kiekiai kateterio/kaniulės užpildymui.
Mygtukas 1
Mygtukas 2
Mygtukas 3
+ Vienetai:
+ Vienetai
mg/dl
mmol/l
+ IVT (Insulino Veikimo Trukmė)
Tikslinis diapazonas:
Vizualizacijos diapazonas
Aukštoji ir žemoji riba Apžvalgos grafikuose bei išmaniuosiuose laikrodžiuose
@@ -404,18 +416,18 @@
Netrukus valgysiu
Hipo
Aktyvumas
- Ištrinti įrašą:
+ Ištrinti įrašą
DanaR statistika
BPD viso
Eksponentiškai svertinė BPD
Valandinė bazė
Bolusas
- BPD bendroji paros dozė
+ BPD
Data
Koeficientas
# dienų
Svoris
- Duomenys netikslūs, jei bolusai naudojami sistemos ar adatų užpildymui!
+ Duomenys netikslūs, jei bolusai naudojami kateterių užpildymui!
Duomenys seni, spauskite \"ATNAUJINTI\"
Pagrindinė bazė (PB)
PB * 2
@@ -543,7 +555,7 @@
Įgalina superbolusų naudojimą insulino skaičiuoklėje. Nenaudokite, kol nesuprantate, ką superbolus funkcija atlieka. NAUDODAMI AKLAI GALITE PERDOZUOTI INSULINO!
Pradžios ekrane rodyti spalvotus indikatorius
Pradžios ekrane rodyti papildomus šviesos indikatorius
- Pradžios ekrane rodyti papildomus šviesos indikatorius adatos, insulino, sensoriaus naudojimo trukmei bei baterijos įkrovimo lygiui.
+ Pradžios ekrane rodyti papildomus šviesos indikatorius kateterio, insulino, sensoriaus naudojimo trukmei bei baterijos įkrovimo lygiui.
Įspėjimo apie žemą rezervuaro lygį riba [U]
Įspėjimo apie kritiškai žemą rezervuaro lygį riba [U]
Įspėjimo apie žemą baterijos įkrovimo lygį riba [%]
@@ -565,18 +577,15 @@
Visi duomenys, kurie gali būti siunčiami į NS, paliekami. AAPS yra susieta su NS, bet jokie pokyčiai NS nedaromi
Bazės žingsnis
Boluso žingsnis
- Ištęstas bolusas
- Laik.tikslas
Atšaukti ištęstą bolusą
- Sensoriaus naudojimo laikas
- Adatos naudojimo laikas
- Insulino naudojimo laikas
+ Sensorius
+ Kateteris
+ Insulinas
valandos
- Valandinės bazės tipas
Netinkamas profilis!!!
- Profilio keitimas
- Pompos baterijos naudojimo laikas
- Pompos baterijos pakeitimas
+ Profilio keitimas
+ Pompos baterija
+ Pompos baterijos keitimas
Aliarmų nustatymai
Kritiškai aukštas
Aukštas
@@ -620,10 +629,9 @@
Įgalinti perdavimą į kitas programas (pvz., „XDrip“). Neįgalinkite, jei įdiegta daugiau nei vienas AAPS arba NSClient egzempliorius!
Įgalinti lokalų duomenų perdavimą.
AKTYVUMAS & ATGALINIS RYŠYS
- ANGLIAVANDENIAI & BOLUSAS
- CGM & OPENAPS
+ ANGLIAVANDENIAI & BOLUSAI
+ NGJ & OPENAPS
POMPA
- Valandinė bazė [vv/val]
Trukmė [min]
OpenAPS SMB
SMB
@@ -643,7 +651,7 @@
Laukiama ryšio su pompa
Sujungta
Sujungimui skirtas laikas baigėsi
- SUJUNGIMAS
+ Sujungiama
Nerasta jokio prietaiso
Rezervuaras tuščias
Gliukozės kiekio kraujyje matavimo perspėjimas
@@ -678,6 +686,7 @@
g
min
val
+ d
]]>
kJ
Energ. vertė
@@ -706,6 +715,7 @@
KG duomenų perdavimo nustatymai
Rodyti gliukozės pokyčio detales
Rodyti pokytį su reikšme po kablelio
+ SMB max minutės
SMB atitinka valandinės bazės insulino kiekį, kuris gaunamas ne daugiau, kaip per
Pompos programinės įrangos versija nepalaikoma
Siųsti KG duomenis į xDrip+
@@ -772,6 +782,7 @@
Sight
prieš
%1$.2f h
+ %1$d minutės
Leisti SMB visada
Leisti SMB visada, nepriklausomai nuo bolusų. Įmanoma tik naudojant patikimų, filtruotų KG duomenų šaltinį, pvz.: Dexcom G5
Leisti SMB po angliavandenių įvedimo
@@ -791,8 +802,8 @@
Atidaro xDrip+, o mygtukas ATGAL gražina į AAPS
Paspaudus mygtuką įvedamas nustatytas angliavandenių kiekis
Paspaudus mygtuką įvedamas nustatytas insulino kiekis
- Nepavyko paleisti CGM programos. Įsitikinkite, kad ji įdiegta.
- CGM
+ Nepavyko paleisti NGJ programos. Įsitikinkite, kad ji įdiegta.
+ NGJ
Istorija
Pranešti apie SMB
Rodyti SMB laikrodyje kaip standartinį bolusą.
@@ -894,7 +905,7 @@
Pirmas angliavandenių kiekio žingsnis
Antras angliavandenių kiekio žingsnis
Trečias angliavandenių kiekio žingsnis
- CGM
+ NGJ
Naudoti tik WiFi
WiFi pavadinimas
Tik įkraunant
@@ -948,11 +959,11 @@
Garsas
Vibravimas
Abu
- Ekrano aktyvumo laikas [s]
- Ekrano apšvietimo laikas [s]
+ Ekrano aktyvumo laikas [seconds]
+ Ekrano apšvietimo laikas [seconds]
KG vienetai
- Išjungimas (val.)
- Žemas rezervuaro lygis (vv)
+ Išjungimas [hours]
+ Žemas rezervuaro lygis [Units]
Išsaugoti nustatymus pompoje
Įjungti
Išjungti
@@ -1145,6 +1156,8 @@
Perkelti laikiną bazę
Perduoti profilio pokyčius, laikinas bazes
Perduoti KG testus
+ Laiko persukimas įvyks po 24 val ar mažiau
+ Laiko persukimas įvyks po mažiau nei 3 val - Uždaras ciklas deaktyvuotas
vidinės saugyklos apribojimas
Atlaisvinkite ne mažiau kaip %1$d MB iš vidinės atminties! Ciklas išjungtas!
Neteisingas formatas
@@ -1168,7 +1181,7 @@
Nustatyta, kad naudojate neteisingą versiją. Ciklas išjungtas!
sena versija
labai sena versija
- Nauja versija pasiekiama mažiausiai %1$d dienų! Po 60 d. grįšite prie stabdymo prie žemo, po 90 d. ciklas bus išjungtas.
+ Nauja versija pasiekiama mažiausiai %1$d dienų! Po %2$d grįšite prie stabdymo prie žemo, po %3$d ciklas bus išjungtas
2 val
%1$.2fV
Dexcom programėlė (modifikuota)
@@ -1196,15 +1209,20 @@
Ilguma:
Atstumas [m]:
Vardas:
- Vietovė %1$s
+ %1$s %2$s
+ Kada
+ Kai esate nustatytoje zonoje
+ Kai nesate nustatytoje zonoje
+ Kai įeinate į zoną, kurios pavadinimas
+ Kai paliekate zoną, kurios pavadinimas
Paskutinis bolusas
Paskutinis Bolusas prieš %1$s %2$s min
AAO
AAO %1$s %2$.0f
Užduoties pavadinimas
Keisti
- Pasirinkite veiksmo tipą:
- Pasirinkite sąlygos tipą:
+ Pasirinkite veiksmo tipą
+ Pasirinkite sąlygos tipą
Sąlygos:
PAŠALINTI
Išankstinės sąlygos:
@@ -1232,6 +1250,8 @@
Nepasirinkta (paprastas vaizdas)
Šarminė (išplėstinis vaizdas)
Ličio (išplėstinis vaizdas)
+ Šarminė (išplėstinis vaizdas)
+ Boluso/Terapijos Derinimas
SKENAVIMAS
STOP
@@ -1295,7 +1315,7 @@
Nepalaikomas pompos dažnis.
RileyLink adresas neteisingas.
Aptiktas pompos tipas neatitinka nustatymų.
- Pompoje neįjungtas bazės profilis.
+ Bazės profilis / nustatymas pompoje nėra įgalintas. Įgalinkite jį pompoje.
Pompoje nustatytas neteisingas bazės profilis (turi būti STD).
Pompoje nustatytas neteisingas laikinos bazės tipas (turi būti absoliutus).
Pompoje nustatytas neteisingas Max Bolusas (turi būti %1$.2f).
@@ -1346,7 +1366,7 @@
Paskutinis prijungimas prie pompos [min]
Paskutinis prijungimas prie pompos prieš %1$s%2$s min.
Siųsti SMS: %1$s
- Siųsti SMS visais nurodytais numeriais
+ Siųsti SMS į visus numerius
Išsiųsti SMS žinutę su tekstu
%2$+.2fU]]>
Pritaikyti boluso apribojimai: %2$.2fU to %3$.2fU]]>
@@ -1368,5 +1388,62 @@
%1$d%%
Boluso patarėjas
min.
+ Profilio pavadinimas:
+ Parinkta:
+ Vienetai
+ Ar norite pakeisti profilį ir atsisakyti pakeitimų, atliktų dabartiniame profilyje?
%1$dg
+ Įjungta
+ Išjungta
+ Išvalyti užbaigtus
+ Išvalyti pradėtus
+ Laiko apibrėžimas
+ Ar norite iš naujo nustatyti tikslų pradžią? Jūs galite prarasti jau pasiektus.
+ Pompa nepasirinkta
+ Pasirinkite vienetus, kurių vertes norite parodyti
+ Įkelti vietinio profilio pakeitimus į NS
+ IVT (Insulino Veikimo Trukmė)
+ IA (insulino/angliavandenių santykis)
+ JIF (jautrumo insulinui faktorius)
+ TIKSLAS
+ Klonuoti
+ Pirmiausia išsaugoti arba anuliuoti dabartinius pokyčius
+ Ištrinti esamą profilį?
+ Kurti naują vietinį profilį iš šito?
+ Profilio pavadinime yra taškų.\nŠios funkcijos NS nepalaiko.\nProfilis neįkeltas į NS.
+ Mažiausia tikslinės srities vertė (tik rodymui)
+ Didžiausia tikslinės srities vertė (tik rodymui)
+ Pertvarkyti
+ Amžius:
+ Svoris:
+ ID:
+ Pateikti
+ Dažniausiai naudojamas profilis:
+ Pastaba: anonimiškai bus įkelti tik tie duomenys, kurie matomi šiame ekrane. Šiam diegimui AndroidAPS priskiria ID. Galite pateikti duomenis dar kartą, jei pasikeitė jūsų pagrindinis profilis. Vis dėlto leiskite jam veikti bent savaitę, kad jo rezultatas būtų matomas laiko diapazone. Ačiū už palaikymą.
+ Apklausa
+ Neteisingas amžiaus įrašas
+ Neteisingas svorio įrašas
+ %1$s: ∑: %2$.2f Bolusas: %3$.2f Bazinis: %4$.2f]]>
+ %1$s: Žemas: %2$02d%% Norma: %3$02d%% Aukštas: %4$02d%%]]>
+ Vidutinis
+ BPD
+ TIR (Laikas normos ribose)
+ Aktyvumo stebėjimas
+ Ar norite iš naujo nustatyti aktyvumo statistiką?
+ Statistika
+ Atsitiktinė KG
+ Generuoti atsitiktinių KG duomenis (demonstracinis režimas)
+ KG
+ Įrankiai
+ Rodyti skaičiavimą
+ Klaida
+ 12h
+ 24h
+ Automatizuotas įvykis
+ Jau nustatyta
+ Pranešimas
+ Išvalyti eilę? Visi eilės duomenys bus prarasti!
+ Ištęsto boluso funkcija sustabdys uždaro ciklo režimą ištęsto boluso veikimo metu. Ar tikrai norite patvirtinti savo pasirinkimą?
+ Uždara ciklas išjungtas dėl ištęsto boluso veikimo
+ IB (Ištęstas bolusas)
diff --git a/app/src/main/res/values-nl-rNL/exam.xml b/app/src/main/res/values-nl-rNL/exam.xml
index 489aec894a..9768183305 100644
--- a/app/src/main/res/values-nl-rNL/exam.xml
+++ b/app/src/main/res/values-nl-rNL/exam.xml
@@ -10,18 +10,18 @@
U moet uw eigen waarde bepalen (maar niet minder dan 5 uur).
Thema: Hypo Tijdelijk Streefdoel
Wat is de primaire reden om een hypo TT in te stellen?
- Voorkomen dat BG te laag wordt als er een tijdelijk basaal van 0 (nul-temp) wordt uitgevoerd.
+ Voorkomen dat BG te laag wordt als er al een tijdelijk basaal van 0 (nul-temp) wordt uitgevoerd.
Om te voorkomen dat AAPS te veel insuline toedient na een stijging veroorzaakt door snelwerkende koolhydraten gebruikt voor de behandeling van een lage BG.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Usage/temptarget.html
- Welk profiel kan offline worden gebruikt en geconfigureerd?
+ Welk profiel kan offline worden gebruikt én worden aangepast?
Thema: offline profiel
- NS-Profiel kan worden gebruikt, maar niet geconfigureerd.
+ NS-Profiel kan worden gebruikt, maar niet worden aangepast.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Configuration/Config-Builder.html#profiel
Onderwerp: Ontkoppelen van de Pomp
Wat moet er gebeuren bij het loskoppelen van de pomp?
Klik op \'pomp ontkoppelen\' zodat AAPS weet dat er geen insuline wordt afgeleverd.
Klik op \'lus onderbreken\' zodat AAPS stopt met loopen terwijl de pomp is losgekoppeld.
- Verander niets in AAPS, koppel de pomp gewoon af.
+ Verander niets in AAPS, koppel gewoon de pomp af.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/FAQ.html#overige-instellingen
Onderwerp: AndroidAPS Instellingen
Welke dingen kun je het beste doen om een back-up van uw instellingen te maken?
@@ -41,20 +41,20 @@
Schakel de telefoon uit.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#filteren-van-bloed-glucose-waardes
Zorg dat uw CGM-app de BG-gegevens vloeiend maakt.
- Onderwerp: Inspanning
+ Onderwerp: Fysieke inspanning
Hoe kunt u het systeem helpen zich aan te passen bij sporten?
Met behulp van de tijdelijk streefdoel functie.
- Pas het profiel %% aan naar een waarde onder de 100%.
- Pas het profiel %% aan naar een waarde boven de 100%.
+ Pas het profiel percentage aan naar een waarde onder de 100%.
+ Pas het profiel percentage aan naar een waarde boven de 100%.
Stop de Loop.
Stel een tijdelijk streefdoel in voorafgaand aan het starten met sporten.
Het instellen van een tijdelijk streefdoel nadat u met sporten bent gestart, leidt tot slechtere resultaten dan wanneer u dit enige tijd voorafgaand aan het sporten had ingesteld.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Usage/temptarget.html#activiteit-tijdelijk-streefdoel
Onderwerp: Uitgeschakelde/onderbroken loop
- Ontvang ik insuline wanneer de lus is uitgeschakeld/onderbroken?
+ Ontvang ik insuline wanneer de Loop is uitgeschakeld/onderbroken?
Ja, de basale insuline wordt nog steeds geleverd.
Nee, de levering van insuline is gestopt.
- Onderwerp: Basaal, ISF en IC-tests
+ Onderwerp: Testen van Basaal, ISF en IC
Wanneer moet ik de basaal, ISF, en KH-waarden uittesten?
Voordat ik begin te loopen.
Wanneer je vaak een lage BG hebt.
@@ -89,7 +89,7 @@
Lees de volledige AndroidAPS documentatie (kies voor Nederlands in het menu)
Bezoek de AndroidAPS Gitter Room.
Bezoek AndroidAPS Google-ondersteuning
- Praat met je endocrinoloog.
+ Praat met je internist.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Installing-AndroidAPS/Update-to-new-version.html#problemen-oplossen
https://www.facebook.com/groups/AndroidAPSUsers/
https://gitter.im/MilosKozak/AndroidAPS
@@ -127,7 +127,7 @@
Hogere ISF-waarden leiden tot minder insulineafgifte wanneer AAPS voor hoge BG corrigeert.
Lagere ISF-waarden leiden tot minder insulineafgifte wanneer AAPS voor hoge BG corrigeert.
Het wijzigen van de ISF-waarden heeft geen effect op de hoeveelheid insuline die wordt geleverd wanneer AAPS voor hoge BG corrigeert.
- U moet ISF invoeren in Voorkeuren.
+ U moet ISF invoeren in Instellingen.
Het wijzigen van de ISF-waarde in uw profiel is voldoende om de wijziging toe te passen.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/FAQ.html#insuline-gevoeligheids-factor-insulin-sensitivity-factor-ISF-mmol-l-E-of-mg-dl-E
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Usage/Profielen.html
@@ -135,15 +135,15 @@
Hogere KH ratios leiden tot minder insuline afgifte voor een bepaalde hoeveelheid koolhydraten.
Lagere KH ratios leiden tot minder insuline afgifte voor een bepaalde hoeveelheid koolhydraten.
Als je 0 COB hebt zal het veranderen van KH ratio leiden tot een andere hoeveelheid insuline om jouw BG te corrigeren.
- KH ratio zal anders zijn als je brood-eenheid telt als 10g of 12g.
+ KH ratio zal anders zijn als je een brood-eenheid telt als 10g of 12g.
KH ratio betekent: Hoeveel brood-eenheden gebruik je voor 1U insuline.
https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/FAQ.html#Koolhydraat-ratio-KH-g-E
Onderwerp: Profiel wissels
Bij het opgeven van 90% in je profiel wissel…
Basalen zullen 10% hoger zijn.
Basalen zullen 10% lager zijn.
- De KH ratio wordt 10% hoger.
- De KH ratio wordt 10% lager.
+ De KH ratio zal 10% hoger worden.
+ De KH ratio zal 10% lager worden.
ISF-waarde wordt 10% hoger.
ISF-waarde wordt 10% lager.
In totaal zul je ongeveer 10% minder insuline krijgen.
diff --git a/app/src/main/res/values-nl-rNL/objectives.xml b/app/src/main/res/values-nl-rNL/objectives.xml
index f85af9f2c5..bd41e6d26e 100644
--- a/app/src/main/res/values-nl-rNL/objectives.xml
+++ b/app/src/main/res/values-nl-rNL/objectives.xml
@@ -46,10 +46,10 @@
Volgende onvoltooide
Aanvraagcode: %1$s
(controleer alle juiste antwoorden)
- https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/FAQ.html#wat-te-doen-tijdens-het-douchen
- https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#overzicht-scherm
- https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#configurator
- https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#overzicht-scherm
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/FAQ.html#wat-te-doen-tijdens-het-douchen
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#overzicht-scherm
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#configurator
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Getting-Started/Screenshots.html#overzicht-scherm
Niet verbonden met het internet
Ophalen tijd mislukt
Vereisten van doel niet behaald
diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml
index 09f55f1b94..e797344f49 100644
--- a/app/src/main/res/values-nl-rNL/strings.xml
+++ b/app/src/main/res/values-nl-rNL/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
Totale IOB:
- Insuline hoeveelheid
- Koolhydraten hoeveelheid
BG
TT
Koolhydraten
@@ -114,7 +112,6 @@
Overzicht
NS Profiel
Eenvoudig profiel
- Tijdelijk basaal
Behandelingen
Virtuele Pomp
Careportal
@@ -146,21 +143,17 @@
In strijd met beperkingen
Bolus toedien storing
Tijdelijk basaal toedien storing
- Basaal waarde [%%]
- %% (100%% = huidig)
Accepteer nieuw tijdelijk basaal:
Bolus
Bolus wizard
Beperking toegepast!
Bevestiging
- Nieuwe behandeling ingeven:
Bolus
Bolus:
Basaal
Basaal:
Koolhydraten
Wijzig het ingegevene!
- Stel nieuwe vertraagde bolus in:
BG bron
Waar moet de AndroidAPS zijn gegevens vandaan halen?
xDrip
@@ -187,7 +180,6 @@
CGM Sens. ingebracht
CGM Sens. Start
Insuline ampul wissel
- Profiel wissel
Snack bolus
Maaltijd bolus
Correctie bolus
@@ -208,7 +200,6 @@
Procent
Absoluut
Notities
- Gebeurtenis tijdstip
Profiel
Ingegeven door
Glucose type
@@ -233,7 +224,6 @@
Verbinden
Verbonden
Niet verbonden
- DanaR pomp instellingen
Eind gebruiker overeenkomst
MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
Begrepen en goedgekeurd
@@ -282,8 +272,6 @@
Vingerprik
Sensor
Manueel
- Tijd. streefdoel
- Tijdelijk streefdoel annuleren
DanaR profiel instellingen
DIA [uur]
Duur van insuline activiteit
@@ -337,7 +325,7 @@
Om naar profiel %1$s %2$d%% te wisselen antwoord met code %3$s
Om een vertraagde bolus van %1$.2fE voor %2$d min te starten antwoord met code %3$s
Antwoord met code %3$s om %1$dg in te voeren op %2$s
- Om een basaal van %1$d% voor %2$d min te starten antwoord met code %3$s
+ Om een basaal van %1$d%% voor %2$d min te starten antwoord met code %3$s
Om de loop te onderbreken voor %1$d minuten antwoord met de code %2$s
Tijdelijk basaal %1$.2fE/u voor %2$d minuten succesvol gestart
Vertraagde bolus %1$.2fE voor %2$d minuten succesvol gestart
@@ -376,8 +364,11 @@
Knop 1
Knop 2
Knop 3
+ Eenheden:
+ Eenheden
mg/dl
mmol/l
+ DIA
Streefdoel:
Bereik voor visualisatie
Hoge en lage grens voor grafieken op het Overzicht en op Wear
@@ -419,7 +410,6 @@
Eet binnenkort
Hypo
Activiteit
- Verwijder record:
DanaR Statistiek
Cumulatieve TDD
Exponentieel verhoogd TDD
@@ -580,16 +570,12 @@
AAPS is verbonden met NS maar er worden geen wijzigingen uitgevoerd op NS
Basaal stap
Bolus Stap
- Vertraagde bolus
- Tijdelijk streefdoel
Annuleer vertraagde bolus
Ouderdom sensor
Ouderdom infusie set
Ouderdom insuline
uren
- Basaal type
Ongeldig profiel !!!
- Profiel Wissel
Ouderdom batterij
Pomp bat. wissel
Alarm opties
@@ -638,7 +624,6 @@
KOOLHYDRATEN & BOLUS
CGM & OPENAPS
POMP
- Basale waarde [E/uur]
Tijdsduur [min]
OpenAPS SMB
SMB
@@ -658,7 +643,6 @@
Wachten op koppelen van de pomp
Koppeling geslaagd
Koppeling verlopen
- Koppelen
Geen toestel gevonden
Ampul leeg
Bloed glucose meetpunt alarm
@@ -769,7 +753,6 @@
Een bolus met dezelfde hoeveelheid was gevraagd binnen de afgelopen twee minuten. Om incidentele of door bugs veroorzaakte dubbele bolussen te voorkomen is deze bolus geannuleerd.
Zojuist
Lezen van pomp historiek
- Historiek
Instellen van basaal profiel
Insuline ampul is bijna leeg
Batterij pomp is bijna leeg
@@ -965,11 +948,7 @@
Geluid
Trillen
Beide
- LCD on time [s]
- Backlight on time [s]
Glucose units
- Shutdown(hours)
- Laag reservoir (eenheden)
Opslaan van de opties om de pomp
Aan
Uit
@@ -1187,7 +1166,7 @@
We hebben gedetecteerd dat je een ongeldige versie gebruikt. Loop is uitgeschakeld!
oude versie
zeer oude versie
- Er is als sinds ten minste %1$d dagen een nieuwe versie beschikbaar! Na 60 dagen wordt de loop beperkt tot LGS, na 90 dagen zal de loop worden uitgeschakeld
+ Nieuwe versie al zeker %1$d dagen beschikbaar! Terugval LGS na %2$d dagen, loop zal worden uitgeschakeld na %3$d dagen
2u
%1$.2fE
Dexcom App (patched)
@@ -1215,15 +1194,18 @@
Leng:
Afst [m]:
Naam:
- Locatie is %1$s
+ %1$s %2$s
+ Wanneer
+ Wanneer u zich in het gebied bevindt
+ Wanneer u zich buiten het gebied bevindt
+ Wanneer u het gebied met deze naam binnengaat
+ Wanneer u het gebied met deze naam verlaat
Laatste bolus
Laatste bolus %1$s %2$s min geleden
COB
COB %1$s %2$.0f
Taaknaam
EDIT
- Kies een type actie:
- Kies een type trigger:
Triggers:
VERWIJDER
Voorwaarden:
@@ -1316,7 +1298,6 @@
Pomp frequentie niet ondersteund.
RileyLink adres ongeldig.
Gedetecteerde pomp type komt niet overeen met ingestelde pomp type.
- Basaalprofielen zijn niet ingeschakeld op pomp.
Basaalprofiel ingesteld op pomp is onjuist (moet STD zijn).
Verkeerde Tijdelijk Basaal-type ingesteld op pomp (moet Insulinesnelh (E/H) zijn).
Verkeerde Max Bolus ingesteld op pomp (moet %1$.2f zijn).
@@ -1367,7 +1348,6 @@
Laatste verbinding met pomp [minuten geleden]
Laatste verbinding met pomp %1$s %2$s min geleden
Stuur SMS: %1$s
- Stuur SMS naar alle nummers in voorkeuren
Stuur SMS met tekst
%2$+.2fU]]>
Bolus limiet bereikt: %2$.2fU naar %3$.2fU]]>
@@ -1389,6 +1369,10 @@
%1$d%%
Bolus wizard
min
+ Profielnaam:
+ Geselecteerd:
+ Eenheden
+ Wilt u van profiel wisselen en de wijzigingen in het huidige profiel ongedaan maken?
%1$dg
Aan
Uit
@@ -1396,4 +1380,24 @@
Wissen gestart
Tijd detectie
Wil je dit leerdoel opnieuw starten? Je kunt je voortgang verliezen.
+ Geen pomp geselecteerd
+ Selecteer eenheden waarin je waarden wilt weergeven
+ Upload lokale profielwijzigingen naar NS
+ DIA
+ KH ratio
+ ISF
+ DOEL
+ Dupliceren
+ Huidige wijzigingen eerst opslaan of ongedaan maken
+ Huidige profiel verwijderen?
+ Nieuw lokaal profiel maken op basis van deze profiel wissel?
+ Profielnaam bevat punten.\nDit wordt niet ondersteund door NS.\nProfiel is niet geüpload naar NS.
+ Laagste waarde in bereik (alleen weergave)
+ Hoogste waarde in bereik (alleen weergave)
+ Sorteren
+ Leeftijd:
+ Gewicht:
+ ID:
+ Verzenden
+ Opmerking: Alleen gegevens die zichtbaar zijn op dit scherm worden anoniem geüpload. ID is toegewezen aan deze installatie van AndroidAPS. U kunt gegevens opnieuw indienen als uw hoofdprofiel wordt gewijzigd, maar laat het ten minste een week draaien om resultaat zichtbaar te maken in de tijd in het bereik. Uw hulp wordt gewaardeerd.
diff --git a/app/src/main/res/values-pl-rPL/objectives.xml b/app/src/main/res/values-pl-rPL/objectives.xml
index af8c38edd9..3e529a5c92 100644
--- a/app/src/main/res/values-pl-rPL/objectives.xml
+++ b/app/src/main/res/values-pl-rPL/objectives.xml
@@ -36,6 +36,7 @@
Wyświetl zawartość wtyczki Pętla (Loop)
Użyj funkcji skalowania przez dłuższe przytrzymanie wykresu glikemii
Wprowadź
+ Jeśli używano OpenAPS przez co najmniej 3 miesiące z NS, gromadząc dane z pętli, można wysłać e-mail na adres objectives@androidaps.org podając adres serwera NightScout i kod zapytania aby pominąć resztę zadań. Wprowadź kod odpowiedzi uzyskany od programistów
Kod został zaakceptowany
Niepoprawny kod
Potwierdź swoje umiejętności
@@ -45,10 +46,10 @@
Następny niedokończony
Kod zapytania: %1$s
(sprawdź wszystkie poprawne odpowiedzi)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Brak połączenia z Internetem
Nie udało się odzyskać
Wymagania celu nie zostały spełnione
diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml
index 0551d3d7d0..6260b24658 100644
--- a/app/src/main/res/values-pl-rPL/strings.xml
+++ b/app/src/main/res/values-pl-rPL/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
Całkowita IOB:
- Insulina
- Węglow.
BG
TT
Węglow
@@ -114,7 +112,6 @@
Przegląd
Profil Nightscout
Prosty profil
- TymczasowaBaza
Leczenie
Pompa wirtualna
PortalOpieki
@@ -146,21 +143,18 @@
Naruszenie ograniczeń
Błąd podania bolusa
Błąd podania bazy tymczasowej
- Wartość bazy [%%]
- %% (100%% = aktualny)
+ Wartość bazy [%]
Akceptuj nową bazę tymczasową:
Leczenie
Kalkulator
Ograniczenie nałożone!
Potwierdzenie
- Wprowadź nowe leczenie:
Bolus
Bolus:
Baza
Baza:
Węglow.
Zmień wprowadzone dane!
- Ustaw nowy bolus przedłużony:
Źródło BG
Skąd AndroidAPS powinien czerpać dane?
xDrip
@@ -208,7 +202,7 @@
Procent
Całkowity
Notatki
- Czas zdarzenia
+ Czas zdarzenia
Profil
Wprowadzone przez
Typ glukozy
@@ -233,7 +227,7 @@
Łączę
Połączono
Rozłączono
- Ustawienia pompy DanaR
+ Ustawienia pompy Dana
Umowa licencyjna użytkownika końcowego
NIE MOŻE BY WYKORZYSTYWANY DO PODEJMOWANIA DECYZJI MEDYCZNYCH. NIE MA ŻADNEJ GWARANCJI NA PROGRAM, W ZAKRESIE DOZWOLONYM PRZEZ OBOWIĄZUJĄCE PRAWO. Z WYJĄTKIEM PRZYPADKÓW, GDY W INNY SPOSÓB PISMO OŚWIADCZENIA PRAW AUTORSKICH I / LUB INNYCH STRON, PRZEDSTAWIAĆ PROGRAM \"W STANIE TAKIM, W JAKIM SIĘ ZNAJDUJE\" BEZ JAKIEJKOLWIEK GWARANCJI, WYRAŹNEJ LUB DOMNIEMANEJ, W TYM MIĘDZY INNYMI DOMNIEMANYCH GWARANCJI PRZYDATNOŚCI HANDLOWEJ I PRZYDATNOŚCI DO OKREŚLONEGO CELU. CAŁKOWITE RYZYKO ZWIĄZANE Z JAKOŚCIĄ I WYNIKIEM PROGRAMU JEST PO PAŃSTWA STRONIE. W PRZYPADKU USZKODZENIA PROGRAMU UŻYTKOWNIK PONOSI KOSZT CAŁEGO NIEZBĘDNEGO SERWISU, NAPRAWY LUB POPRAWEK. W PRZYPADKU NIEPOROZUMIEŃ ZASTOSOWANIE PRAWNE MA UMOWA W ANGIELSKIEJ WERSJI JĘZYKOWEJ!!!
ROZUMIEM I WYRAŻAM ZGODĘ
@@ -260,11 +254,23 @@
Dozwolone numery telefonów
+XXXXXXXXXX;+YYYYYYYYYY
Aby dostarczyć bolus %1$.2fU wprowadź kod %2$s
+ Aby podać do posiłku bolus %1$.2fU odeślij %2$s
+ Aby ustawić cel tymczasowy %1$s odeślij w SMS kod %2$s
+ Aby anulować cel docelowy odeślij w SMS kod %1$s
+ Aby wyłączyć zdalne sterowanie SMS-ami odeślij kod %1$s.\n\nPamiętaj że możesz to ponownie włączyć tylko bezpośrednio w aplikacji AAPS na głównym telefonie.
+ Zatrzymano zdalne sterowanie SMS-ami. Aby ponownie włączyć użyj aplikacji AAPS na głównym telefonie.
Aby wysłać kalibrację %1$.2f wprowadź kod %2$s
Bolus nieudany
+ Minimalna liczba minut która musi upłynąć pomiędzy jednym a drugim zdalnie podawanym bolusem
+ Ile co najmniej minut musi upłynąć pomiędzy jednym a drugim bolusem
+ Dla twojego bezpieczeństwa, aby zmienić to ustawienie musisz dodać co najmniej 2 numery telefonów.
Bolus %1$.2fU dostarczony prawidłowo
Zamierzam podać %1$.2fU
Bolus %1$.2fU dostarczony prawidłowo
+ Pomyślnie podano %1$.2fU bolusa posiłkowego
+ Cel %1$s na %2$d minut
+ Pomyślnie ustawiono cel %1$s na %2$d minuty
+ Pomyślnie anulowano cel tymczasowy
Dostarczam %1$.2fU
Zezwalaj na komendy zdalne via SMS
Palec
@@ -324,10 +330,13 @@
Aby rozpocząć bazę %1$.2fU/h przez %2$d min. odpowiedz kodem %3$s
Aby przełączyć profil na %1$s %2$d%% odpowiedz kodem %3$s
Aby rozpocząć bolus przedłużony %1$.2fU przez %2$d min. odpowiedz kodem %3$s
+ Aby wprowadzić %1$dg o %2$s odeślij w SMS kod %3$s
Aby rozpocząć bolus przedłużony %1$d%% przez %2$d min. odpowiedz kodem %3$s
Aby wstrzymać pętle na %1$d minut odpowiedz kodem %2$s
Tymczasowa baza %1$.2fU/h przez %2$d min rozpoczęta
Bolus przedłużony %1$.2fU na %2$d min. rozpoczęty pomyślnie
+ Pomyślnie wprowadzono %1$dg węglowodanów
+ Próba wprowadzenia %1$dg węglowodanów nie powiodła się
Tymczasowa baza %1$d%% przez %2$d min. pomyślnie rozpoczęta
Rozpoczęcie tymczasowej bazy nie powiodło się
Nie powiodło się podanie bolusa przedłużonego
@@ -361,8 +370,11 @@
Przycisk 1
Przycisk 2
Przycisk 3
+ Jednostki:
+ Jednostki
mg/dl
mmol/l
+ DIA
Zakres docelowy:
Zakres do wizualizacji (na wykresie)
Oznaczenia wysokiego i niskiego cukru na wykresie w oknie przegląd i na smartwatch\'u
@@ -404,7 +416,7 @@
Wkrótce posiłek
Hipo
Ćwiczenia
- Usuń rekord:
+ Usuń wpis
DanaR Statystyki
Kumulatywna TDD (dawka dzienna)
Ważona wykładniczo TDD
@@ -566,16 +578,13 @@
żadnych zmian w NS
Krok bazy
Krok bolusa
- BolusPrzedłużony
- CelTymczasowy
Anuluj bolus przedłużony
Czas sensora
Czas wkłucia
Czas insuliny
godzin
- Typ bazy
Nieprawidłowy profil !!!
- ZmieńProfil
+ Zmień profil
Czas baterii pompy
Zmiana baterii pompy
Opcje alarmu
@@ -624,7 +633,6 @@
WĘGLOW. & BOLUS
CGM & OPENAPS
POMPA
- Wartość bazy [U/h]
Czas trwania [min]
OpenAPS SMB
SMB
@@ -644,7 +652,7 @@
Oczekiwanie na pompe na sparowanie
Parowanie OK
Przekroczono limit czasu parowania
- PAROWANIE
+ Parowanie
Urządzenie nie zostało znalezione do tej pory
Pusty zasobnik
Alarm pomiaru poziomu cukru
@@ -679,6 +687,7 @@
g
m
h
+ d
]]>
kJ
En
@@ -707,6 +716,7 @@
Ustawienia wysyłania wartości BG (poziomów cukru)
Pokaż szczegółowe delta
Pokaż deltę z jednym więcej miejscem dziesiętnym
+ SMB max. minut
Maks. ilość minut dawki bazowej do ograniczenia SMB
Nieobsługiwane oprogramowanie pompy
Prześlij dane BG do xDrip+
@@ -753,7 +763,7 @@
W ciągu ostatnich dwóch minut zażądano bolusa o tej samej wielkości. Z uwagi na zapobieganie przypadkowym podwójnym bolusom i ochronę przed błędami jest to zabronione.
Teraz
Sczytuję historię pompy
- historia pompy
+ Historia pompy
Wczytuje profil bazowy
Poziom zasobnika pompy jest niski
Poziom baterii pompy jest niski
@@ -773,6 +783,7 @@
Sight
temu
%1$.2f h
+ %1$d min.
Włącz SMB (Super Mikro Bolusy) zawsze
Włącz SMB (Super Mikro Bolusy) zawsze, niezależnie od bolusów. Możliwe jedynie ze źródłem BG (poziomu cukru) z dobrym filtrowaniem, jak aplikacja G5
Włącz SMB po węglowodanach
@@ -949,11 +960,11 @@
Dźwięk
Wibracja
Obie opcje
- Czas LCD [s]
- Czas podświetlenia [s]
+ LCD na czas [sekund]
+ Podświetlenie na czas [sekund]
Jednostki glukozy
- Automatyczne wyłączenie (godziny)
- Niski poziom zbiornika (jednostki)
+ Wyłączenie [godzin]
+ Niska zawartość zbiornika [Jednostki]
Zapisz ustawienia w pompie
Włącz
Wyłącz
@@ -1171,7 +1182,7 @@
Wykryliśmy, że używasz nieprawidlowej wersji. Pętla wyłączona!
stara wersja
bardzo stara wersja
- Nowa wersja dostępna co najmniej %1$d dni! Powrót do LGS (zawieszania podawania bazy przy niskim poziomie) po 60 dniach, pętla zostanie wyłączona po 90 dniach
+ Nowa wersja dostępna co najmniej %1$d dni! Powrót do LGS (zawieszania podawania bazy przy niskim poziomie) po %2$d dniach, pętla zostanie wyłączona po %3$d dniach
2 h
%1$.2fU
Apka Dexcom (spatchowana)
@@ -1199,15 +1210,20 @@
Długość:
Odległość [m]:
Nazwa:
- Lokalizacja to %1$s
+ %1$s %2$s
+ Gdy
+ Kiedy znajdujesz się wewnątrz obszaru
+ Kiedy znajdujesz się poza obszarem
+ Kiedy wejdziesz do obszaru o nazwie
+ Kiedy opuścisz obszar o nazwie
Przed ostatnim bolusem
Czas ostatniego bolusa %1$s %2$s min temu
Węgle
Węgle %1$s %2$.0f
Nazwa zadania
EDYTUJ
- Proszę wybrać typ akcji:
- Proszę wybrać typ wyzwalacza:
+ Wybierz typ czynności
+ Wybierz typ wyzwalacza
Wyzwalacz:
USUŃ
Warunki wstępne:
@@ -1300,7 +1316,7 @@
Częstotliwość pompy nie wspierana.
Adres RileyLink niewłaściwy.
Wykryty typ pompy jest inny niż ustawiony.
- Profile bazowe nie są uruchomione na pompie.
+ Ustawienia bazy/ wzorców nie są włączone w pompie. Włącz je na pompie.
Profil bazowy ustawiony na pompie nie jest właściwy (musi być STD).
Ustawiony na pompie typ dawki tymczasowej jest niewłaściwy (musi być całkowity - Absolute).
Ustawiony na pompie typ Bolus Maksymalny jest niewłaściwy (musi być %1$.2f).
@@ -1351,7 +1367,7 @@
Ostatnie połączenie z pompą [minut temu]
Ostatnie połączenie z pompą %1$s %2$s min temu
Wyślij SMS: %1$s
- Wyślij SMS do wszystkich numerów w preferencjach
+ Wyślij SMS do wszystkich numerów
Wyślij SMS z tekstem
%2$+.2fU]]>
Wprowadzono ograniczenie bolusa: %2$.2fU to %3$.2fU]]>
@@ -1373,6 +1389,10 @@
%1$d%%
Kalkulator bolusa
min
+ Nazwa profilu:
+ Wybrany:
+ Jednostki
+ Czy chcesz przełączyć profil i porzucić zmiany wprowadzone w bieżącym profilu?
%1$dg
Włącz
Wyłącz
@@ -1380,4 +1400,48 @@
Wyczyść rozpoczęte
Wykrywanie czasu
Czy chcesz zresetować czas rozpoczęcia zadania? Możesz utracić postępy.
+ Nie wybrano pompy
+ Wybierz jednostki, w których chcesz wyświetlać wartości
+ Prześlij zmiany w profilu lokalnym do NS
+ DIA
+ IC
+ ISF
+ CEL
+ Sklonuj
+ Najpierw zapisz lub wycofaj bieżące zmiany
+ Skasować bieżący profil?
+ Utworzyć nowy profil lokalny na bazie wybranego profilu?
+ Nazwa profilu zawiera kropki.\nTo nie jest obsługiwane przez NS.\nProfil nie zostanie przesyłany do NS.
+ Dolna wartość zakresu docelowego (tylko do wyświetlania)
+ Górna wartość zakresu docelowego (tylko do wyświetlania)
+ Zmień kolejność
+ Wiek:
+ Waga:
+ ID:
+ Wyślij
+ Najczęściej używany profil:
+ Uwaga: Tylko dane widoczne na tym ekranie zostaną anonimowo przesłane. Tej instalacji AndroidAPS przypisano ID. Możesz przesłać dane ponownie jeśli twój główny profil ulegnie zmianie, ale pozwól mu działać przez co najmniej tydzień aby zobaczyć jego wpływ na wartość czasu w zakresie. Dziękujemy za wsparcie i pomoc.
+ Ankieta
+ Nieprawidłowy wpis wieku
+ Nieprawidłowy wpis wagi
+ %1$s: ∑: %2$.2f Bol: %3$.2f Baz: %4$.2f]]>
+ %1$s: Od: %2$02d%% Cel: %3$02d%% Do: %4$02d%%]]>
+ Średnio
+ TDD
+ TIR
+ Monitor aktywności
+ Czy chcesz zresetować statystyki aktywności?
+ Statystyki
+ Losowa BG
+ Generuj losowe dane BG (tylko tryb demonstracyjny)
+ BG (poziom cukru)
+ Narzędzia
+ Pokaż obliczenia
+ Błąd
+ 12h
+ 24h
+ Zdarzenie automatyzacji
+ Już ustawiono
+ Wiadomość
+ Wyczyścić kolejkę? Wszystkie dane w kolejce zostaną utracone!
diff --git a/app/src/main/res/values-pt-rBR/objectives.xml b/app/src/main/res/values-pt-rBR/objectives.xml
index 684b9bfa21..112ee86451 100644
--- a/app/src/main/res/values-pt-rBR/objectives.xml
+++ b/app/src/main/res/values-pt-rBR/objectives.xml
@@ -46,10 +46,10 @@
Próximo inacabado
Pedir Código: %1$s
(marque todas as respostas correctas)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Não está ligado à internet
Falha ao recuperar tempo
Requisitos de objectivo não cumpridos
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index c38bb1a3a9..aecda3ee0e 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
IOB Total:
- Insulina
- Carbos
BG
TT
Carbos
@@ -114,7 +112,6 @@
Visão geral
Perfil NS
Perfil simples
- BasalTemp
Tratamentos
Bomba virtual
Careportal
@@ -146,21 +143,18 @@
Violação das restrições
Erro na entrega do bolus
Erro na entrega da basal temporária
- Valor da Basal [%%]
- %% (100%% = atual)
+ Valor da Basal [%]
Aceitar nova basal temporária:
Tratamento
Calculadora
Restrição aplicada!
Confirmação
- Introduzir novo tratamento:
Bolus
Bolus:
Basal
Basal:
Carboidratos
Altere sua entrada!
- Definir novo bolus estendido:
Fonte de BG
De onde o AndroidAPS deve obter os dados?
xDrip
@@ -208,7 +202,7 @@
Porcentagem
Absoluto
Notas
- Tempo do evento
+ Hora do Evento
Perfil
Introduzido por
Tipo de glicose
@@ -233,7 +227,7 @@
Conectando
Conectado
Desconectado
- Definições bomba DanaR
+ Configurações da bomba Dana
Condições de Utilização
NÃO DEVE SER USADO PARA FAZER DECISÕES MÉDICAS. NÃO HÁ NENHUMA GARANTIA PARA O PROGRAMA, NA EXTENSÃO PERMITIDA PELA LEGISLAÇÃO APLICÁVEL. EXCETO QUANDO DE OUTRA FORMA, POR ESCRITO, OS TITULARES DOS DIREITOS DE AUTOR E / OU OUTRAS PARTES FORNECEM O PROGRAMA “TAL COMO ESTÁ”, SEM GARANTIA DE QUALQUER TIPO, EXPRESSA OU IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO, ÀS GARANTIAS IMPLÍCITAS DE COMERCIALIZAÇÃO E ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. TODO O RISCO QUANTO À QUALIDADE E DESEMPENHO DO PROGRAMA É COM VOCÊ. CASO O PROGRAMA SEJA DEFEITUOSO, VOCÊ ASSUME O CUSTO DE TODOS OS SERVIÇOS, REPAROS OU CORREÇÕES NECESSÁRIOS.
EU ENTENDO E CONCORDO
@@ -260,17 +254,29 @@
Números de telefone permitidos
+XXXXXXXXXX;+YYYYYYYYYY
Para dar bolus %1$.2fU responder com código %2$s
+ Para dar bólus %1$.2fU responder com código %2$s
+ Para definir o Alvo Tempo %1$s responda com o código %2$s
+ Para cancelar Alvo Temp responda com o código %1$s
+ Para desactivar o Serviço Remoto SMS de responda com o código %1$s.\n\nTenha em mente que será capaz de o reactivar directamente apenas a partir do telemóvel mestre do AAPS.
+ SMS Serviço Remoto interrompido. Para reactivá-lo, use o AAPS no telemóvel mestre.
Para enviar calibração %1$.2f responder com código %2$s
Bolus falhou
+ Número mínimo de minutos que deve decorrer entre um bólus remoto e o próximo
+ Quantos minutos deve decorrer, pelo menos, entre um bólus e o próximo
+ Para sua segurança, para editar esta preferência você precisa adicionar pelo menos 2 números de telefone.
Bolus %1$.2fU entregue com sucesso
Vão ser administradas %1$.2fU
Bólus %1$.2fU enviado com êxito
+ Bólus de refeição %1$.2fU entregue com sucesso
+ Alvo %1$s para %2$d minutos
+ Alvo %1$s para %2$d minutos definido com sucesso
+ Alvo Temp cancelado com êxito
Administrando %1$.2fU
Permitir comandos remotos via SMS
Dedo
Sensor
Manual
- Alvo temporário
+ Alvo Temporário
Cancelar alvo temporário
Definições perfil DanaR
DIA [h]
@@ -324,11 +330,14 @@
Para começar a basal %1$.2fU/h durante%2$d min responda com o código %3$s
Para mudar o perfil para %1$s %2$d%% responda com o código %3$s
Para começar o bólus estendido %1$.2fU/h para %2$d min responda com o código %3$s
- Para começar a basal %1$d% U/h durante %2$d min responda com o código %3$s
+ Para inserir %1$dg em %2$s responda com código %3$s
+ Para começar a basal %1$d%% U/h durante %2$d min responda com o código %3$s
Para suspender o loop por %1$d minutos resposta com código %2$s
Basal temporária %1$.2fU/h para %2$d min iniciada com êxito
Bólus estendido %1$.2fU/h para %2$d min iniciado com êxito
- Basal temporária %1$d% U/h durante%2$d min iniciada com êxito
+ Hidratos %1$dg inseridos com sucesso
+ Introdução de %1$dg de hidratos falhou
+ Basal temporária %1$d%% U/h durante%2$d min iniciada com êxito
Falha ao iniciar basal temp
Falha ao iniciar o bolus estendido
Para parar a basal temporária responda com o código %1$s
@@ -361,8 +370,11 @@
Botão 1
Botão 2
Botão 3
+ Unidades:
+ Unidades
mg/dL
mmol/L
+ DIA
Intervalo Alvo:
Intervalo para visualização
Marca alta e baixa para as cartas em Visão geral e Smartwatch
@@ -404,7 +416,7 @@
Comer em breve
Hipo
Atividade
- Remover registo:
+ Remover registo
Estatísticas DanaR
Dose diária acumulativa
Dose diária exponencialmente ponderada
@@ -565,16 +577,13 @@
Todos os dados enviados para NS são descartados. AAPS está conectado ao NS, mas não é feita nenhuma alteração no NS
Valor da Basal
Incremento de bolus
- BólusEstendido
- AlvoTemp
Cancelar Bólus Estendido
Idade do sensor
Idade da Canula
Idade de Insulina
horas
- Tipo de Basal
Perfil inválido !!!
- TrocarPerfil
+ Fazer Mudança De Perfil
Idade bateria bomba
Mudança de Bateria
Opções Alarme
@@ -623,7 +632,6 @@
CARBOS & BOLUS
CGM & OPENAPS
BOMBA
- Valor da Basal [U/h]
Duração [min]
SMB OpenAPS
SMB
@@ -643,7 +651,7 @@
Aguardando emparelhamento na bomba
Emparelhamento OK
Tempo emparelhamento excedido
- A EMPARELHAR
+ A emparelhar
Nenhum dispositivo encontrado até agora
Reservatório vazio
Alerta medição da glicemia
@@ -754,7 +762,7 @@
Um bolus com o mesmo valor foi introduzido nos 2 últimos minutos. Para evitar introduções acidentais e segurança contra bugs existentes o bolus foi cancelado.
Agora
Lendo histórico da bomba
- histórico bomba
+ Histórico da Bomba
Configurando perfil basal
Nível cartucho da bomba está baixo
Bateria da bomba está fraca
@@ -774,6 +782,7 @@
Visão
atrás
%1$.2f h
+ %1$d mins
SMB sempre activado
SMB sempre activo independentemente dos bolus. Possível apenas quando o medidor tive um bom filtro de dados como o G5
Ativar SMB após carbos
@@ -950,11 +959,11 @@
Som
Vibrar
Ambos
- Desligar LCD [s]
- Desligar luz de fundo [s]
+ LCD na hora [segundos]
+ Luz de fundo na hora [segundos]
Unidades de Glucose
- Desligar(horas)
- Reservatório baixo (Unidades)
+ Desligar [horas]
+ Reservatório baixo [Unidades]
Gravar opções para a bomba
Ligado
Desligado
@@ -1172,7 +1181,7 @@
Detectamos que está a correr uma versão inválida. Loop desactivado!
versão antiga
versão muito antiga
- Nova versão para pelo menos %1$d dias disponíveis! Voltar para o LGS após 60 dias, o loop será desativado após 90 dias
+ Nova versão para pelo menos %1$d dias disponíveis! Retorno a LGS após %2$d dias, o loop será desactivado após %3$d dias
2h
%1$.2fU
App Dexcom (com patch)
@@ -1200,15 +1209,20 @@
Long.:
Dist [m]:
Nome:
- Localização é %1$s
+ %1$s %2$s
+ Quando
+ Quando estiver dentro da área
+ Quando estiver fora da área
+ Quando entrar na área definida
+ Quando sair da área definida
Último bolus atrás
Última vez do bolus %1$s %2$s atrás
COB
COB %1$s %2$.0f
Nome da Tarefa
EDITAR
- Escolha um tipo de acção:
- Escolha um tipo de gatilho:
+ Escolha um tipo de acção
+ Escolha um tipo de gatilho
Gatilhos:
REMOVER
Precondições:
@@ -1301,7 +1315,7 @@
Frequência da Bomba não suportada.
Endereço RileyLink inválido.
A bomba detectada não é a mesma que a bomba configurada.
- Perfis de Basal não estão ativos na Bomba.
+ A configuração de perfis/padrões da basal não éstá atcivada na bomba. Active-a na bomba.
Perfil Basal definido na Bomba está incorrecto (deve ser STD).
Tipo de DBT errado definido na bomba (deve ser Absoluto).
Máx. Basal definida na Bomba está incorreta (deve ser %1$.2f).
@@ -1352,7 +1366,7 @@
Última ligação à bomba [minutos atrás]
Última ligação à bomba %1$s %2$s min atrás
Enviar SMS: %1$s
- Enviar SMS para todos os números nas preferências
+ Enviar SMS para todos os números
Enviar SMS com texto
%2$+.2fU]]>
Restrição de Bolus aplicada: %2$.2fU para %3$.2fU]]>
@@ -1374,7 +1388,63 @@
%1$d%%
Assistente de Bólus
min
+ Nome do Perfil:
+ Seleccionado:
+ Unidades
+ Deseja mudar de perfil e descartar as alterações feitas no perfil actual?
%1$dg
Ligado
Desligado
+ Limpar terminado
+ Limpar iniciado
+ Detecção de tempo
+ Deseja reiniciar o objectivo? Pode perder seu progresso.
+ Nenhuma bomba seleccionada
+ Seleccione as unidades em que deseja exibir os valores
+ Carregar as alterações do perfil local para NS
+ DIA
+ IC
+ FSI
+ ALV
+ Clone
+ Guardar ou repor as alterações actuais primeiro
+ Eliminar perfil actual?
+ Criar novo perfil local a partir desta troca de perfil?
+ Nome do perfil contém pontos.\nIsso não é suportado pelo NS.\nPerfil não é enviado para o NS.
+ Valor mais baixo da área de intervalo (apenas exibição)
+ Valor mais alto da área de intervalo (apenas exibição)
+ Reordenar
+ Idade:
+ Peso:
+ ID:
+ Enviar
+ Perfil mais comum:
+ Nota: Apenas os dados visíveis neste ecrã serão enviados anonimamente. O ID é atribuído a esta instalação do AndroidAPS. Você pode enviar dados novamente se o perfil principal for alterado, mas deixá-lo rodar pelo menos uma semana para tornar o resultado visível no intervalo de tempo. Sua ajuda é apreciada.
+ Questionário
+ Entrada de idade inválida
+ Entrada de peso inválida
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Hipo: %2$02d%% Dentro: %3$02d%% Hiper: %4$02d%%]]>
+ Média
+ TDD
+ TIR
+ Monitor de actividade
+ Quer reiniciar as estatísticas de actividade?
+ Estatísticas
+ Glic. Aleatória
+ Gerar dados de Glic. aleatórios (Somente modo de Demonstração)
+ GLIC
+ Ferramentas
+ Mostrar Localização
+ Erro
+ 12h
+ 24h
+ Evento de automação
+ Já definido
+ Mensagem
+ Limpar fila? Todos os dados na fila serão perdidos!
+ O uso do Bólus Estendido irá parar o modo Closed Loop no tempo do bólus estendido. Quer realmente isso?
+ Closed Loop desabilitado por causa da execução do Bólus Estendido
+ BE
+ \"VerificadorTelefone\"
diff --git a/app/src/main/res/values-pt-rPT/objectives.xml b/app/src/main/res/values-pt-rPT/objectives.xml
index dae6fcc431..875a605631 100644
--- a/app/src/main/res/values-pt-rPT/objectives.xml
+++ b/app/src/main/res/values-pt-rPT/objectives.xml
@@ -46,10 +46,10 @@
Próximo inacabado
Pedir Código: %1$s
(marque todas as respostas correctas)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Não está ligado à internet
Falha ao recuperar tempo
Requisitos de objectivo não cumpridos
diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml
index a066ebb901..d2c3a9d519 100644
--- a/app/src/main/res/values-pt-rPT/strings.xml
+++ b/app/src/main/res/values-pt-rPT/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
IOB Total:
- Insulina
- Hidratos
GLIC
TT
Hidratos
@@ -114,7 +112,6 @@
Visão geral
Perfil NS
Perfil simples
- Basal Temporária
Tratamentos
Bomba virtual
Careportal
@@ -146,21 +143,18 @@
Violação das restrições
Erro na entrega do bolus
Erro na entrega da basal temporária
- Valor da Basal [%%]
- %% (100%% = actual)
+ Valor da Basal [%]
Aceitar nova basal temporária:
Tratamento
Calculadora
Restrição aplicada!
Confirmação
- Introduzir novo tratamento:
Bolus
Bolus:
Basal
Basal:
Hidratos de Carbono
Altere o seu input!
- Configure um novo bolus prolongado:
Origem dos valores de Glucose
De onde deve o AndroidAPS obter os dados?
xDrip
@@ -208,7 +202,7 @@
Percentagem
Absoluto
Notas
- Tempo do evento
+ Hora do Evento
Perfil
Inserido por
Tipo de glicose
@@ -233,7 +227,7 @@
A ligar
Ligado
Desligado
- Definições bomba DanaR
+ Configurações da bomba Dana
Condições de Utilização
NÃO DEVE SER USADO PARA FAZER DECISÕES MÉDICAS. NÃO HÁ NENHUMA GARANTIA PARA O PROGRAMA, NA EXTENSÃO PERMITIDA PELA LEGISLAÇÃO APLICÁVEL. EXCETO QUANDO DE OUTRA FORMA, POR ESCRITO, OS TITULARES DOS DIREITOS DE AUTOR E / OU OUTRAS PARTES FORNECEM O PROGRAMA “TAL COMO ESTÁ”, SEM GARANTIA DE QUALQUER TIPO, EXPRESSA OU IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO, ÀS GARANTIAS IMPLÍCITAS DE COMERCIALIZAÇÃO E ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. TODO O RISCO QUANTO À QUALIDADE E DESEMPENHO DO PROGRAMA É COM VOCÊ. CASO O PROGRAMA SEJA DEFEITUOSO, VOCÊ ASSUME O CUSTO DE TODOS OS SERVIÇOS, REPAROS OU CORREÇÕES NECESSÁRIOS.
EU ENTENDO E CONCORDO
@@ -260,11 +254,20 @@
Número de telefones permitidos
+XXXXXXXXXX;+YYYYYYYYYY
Para dar bolus %1$.2fU responder com código %2$s
+ Para dar bólus %1$.2fU responder com código %2$s
+ Para definir o Alvo Tempo %1$s responda com o código %2$s
+ Para cancelar Alvo Temp responda com o código %1$s
+ Para desactivar o Serviço Remoto SMS de responda com o código %1$s.\n\nTenha em mente que será capaz de o reactivar directamente apenas a partir do telemóvel mestre do AAPS.
+ SMS Serviço Remoto interrompido. Para reactivá-lo, use o AAPS no telemóvel mestre.
Para enviar calibração %1$.2f responder com código %2$s
Bólus falhado
+ Número mínimo de minutos que deve decorrer entre um bólus remoto e o próximo
+ Quantos minutos deve decorrer, pelo menos, entre um bólus e o próximo
+ Para sua segurança, para editar esta preferência você precisa adicionar pelo menos 2 números de telefone.
Bólus %1$.2fU enviado com êxito
Vai ser enviado %1$.2fU
Bólus %1$.2fU enviado com êxito
+ Bólus de refeição %1$.2fU entregue com sucesso
Alvo %1$s para %2$d minutos
Alvo %1$s para %2$d minutos definido com sucesso
Alvo Temp cancelado com êxito
@@ -273,7 +276,7 @@
Dedo
Sensor
Manual
- Alvo temporário
+ Alvo Temporário
Cancelar alvo temporário
Definições perfil DanaR
DIA [h]
@@ -324,17 +327,17 @@
O valor %1$s está fora dos limites permitidos
O comando remoto não é permitido
O bólus remoto não está disponível. Tente novamente mais tarde.
- Para começar a basal %1$.2fU/h durante%2$d min responda com o código %3$s
+ Para começar a basal %1$.2fU/h durante %2$d min responda com o código %3$s
Para mudar o perfil para %1$s %2$d%% responda com o código %3$s
Para começar o bólus estendido %1$.2fU/h para %2$d min responda com o código %3$s
Para inserir %1$dg em %2$s responda com código %3$s
- Para começar a basal %1$d% U/h durante %2$d min responda com o código %3$s
+ Para começar a basal %1$d%% U/h durante %2$d min responda com o código %3$s
Para suspender o loop por %1$d minutos resposta com código %2$s
Basal temporária %1$.2fU/h para %2$d min iniciada com êxito
Bólus estendido %1$.2fU/h para %2$d min iniciado com êxito
Hidratos %1$dg inseridos com sucesso
Introdução de %1$dg de hidratos falhou
- Basal temporária %1$d% U/h durante%2$d min iniciada com êxito
+ Basal temporária %1$d%% U/h durante%2$d min iniciada com êxito
Início basal temp falhou
Falha ao iniciar o bólus estendido
Para parar a basal temporária responda com o código %1$s
@@ -413,7 +416,7 @@
Comer brevemente
Hipo
Actividade
- Remover registo:
+ Remover registo
Estatísticas DanaR
Dose diária acumulativa
Dose diária exponencialmente ponderada
@@ -574,16 +577,13 @@
Todos os dados enviados para NS são descartados. AAPS está conectado ao NS, mas não é feita nenhuma alteração no NS
Valor da Basal
Incremento de bolus
- BólusEstendido
- AlvoTemp
Cancelar Bólus Estendido
Idade Sensor
Idade Canula
Idade Insulina
horas
- Tipo de Basal
Perfil inválido !!!
- TrocaPerfil
+ Fazer Mudança De Perfil
Idade bateria bomba
Troca bateria bomba
Opções Alarme
@@ -632,7 +632,6 @@
HIDRATOS & BÓLUS
CGM & OPENAPS
BOMBA
- Valor da Basal [U/h]
Duração [min]
OpenAPS SMB
SMB
@@ -652,7 +651,7 @@
Aguardando emparelhamento na bomba
Emparelhamento OK
Tempo emparelhamento excedido
- A EMPARELHAR
+ A emparelhar
Nenhum dispositivo encontrado até agora
Reservatório vazio
Alerta medição da glicemia
@@ -763,7 +762,7 @@
Um bolus com o mesmo valor foi introduzido nos 2 últimos minutos. Para evitar introduções acidentais e segurança contra bugs existentes o bolus foi cancelado.
Agora
A ler histórico bomba
- histórico bomba
+ Histórico da Bomba
A definir perfil basal
Nível cartucho da bomba está baixo
Bateria da bomba está fraca
@@ -783,6 +782,7 @@
Visão
atrás
%1$.2f h
+ %1$d mins
SMB sempre activado
SMB sempre activo independentemente dos bolus. Possível apenas quando o medidor tive um bom filtro de dados como o G5
Activar SMB após hidratos
@@ -959,11 +959,11 @@
Som
Vibrar
Ambos
- Desligar LCD [s]
- Desligar luz de fundo [s]
+ LCD na hora [segundos]
+ Luz de fundo na hora [segundos]
Unidades de Glucose
- Desligar(horas)
- Reservatório baixo (Unidades)
+ Desligar [horas]
+ Reservatório baixo [Unidades]
Gravar opções para a bomba
Ligado
Desligado
@@ -1181,7 +1181,7 @@
Detectamos que está a correr uma versão inválida. Loop desactivado!
versão antiga
versão muito antiga
- Nova versão para pelo menos %1$d dias disponíveis! Voltar para o LGS após 60 dias, o loop será desativado após 90 dias
+ Nova versão para pelo menos %1$d dias disponíveis! Retorno a LGS após %2$d dias, o loop será desactivado após %3$d dias
2h
%1$.2fU
App Dexcom (com patch)
@@ -1209,15 +1209,20 @@
Long.:
Dist [m]:
Nome:
- Localização é %1$s
+ %1$s %2$s
+ Quando
+ Quando estiver dentro da área
+ Quando estiver fora da área
+ Quando entrar na área definida
+ Quando sair da área definida
Último bolus atrás
Última vez do bolus %1$s %2$s atrás
COB
COB %1$s %2$.0f
Nome da Tarefa
EDITAR
- Escolha um tipo de acção:
- Escolha um tipo de gatilho:
+ Escolha um tipo de acção
+ Escolha um tipo de gatilho
Gatilhos:
REMOVER
Precondições:
@@ -1310,7 +1315,7 @@
Frequência da Bomba não suportada.
Endereço RileyLink inválido.
A bomba detectada não é a mesma que a bomba configurada.
- Perfis de Basal não estão activos na Bomba.
+ A configuração de perfis/padrões da basal não éstá atcivada na bomba. Active-a na bomba.
Perfil Basal definido na Bomba está incorrecto (deve ser STD).
Tipo de DBT errado definido na bomba (deve ser Absoluto).
Máx. Basal definida na Bomba está incorreta (deve ser %1$.2f).
@@ -1361,7 +1366,7 @@
Última ligação à bomba [minutos atrás]
Última ligação à bomba %1$s %2$s min atrás
Enviar SMS: %1$s
- Enviar SMS para todos os números nas preferências
+ Enviar SMS para todos os números
Enviar SMS com texto
%2$+.2fU]]>
Restrição de Bolus aplicada: %2$.2fU para %3$.2fU]]>
@@ -1393,6 +1398,7 @@
Limpar terminado
Limpar iniciado
Detecção de tempo
+ Deseja reiniciar o objectivo? Pode perder seu progresso.
Nenhuma bomba seleccionada
Seleccione as unidades em que deseja exibir os valores
Carregar as alterações do perfil local para NS
@@ -1401,7 +1407,46 @@
FSI
ALV
Clone
+ Guardar ou repor as alterações actuais primeiro
Eliminar perfil actual?
Criar novo perfil local a partir desta troca de perfil?
Nome do perfil contém pontos.\nIsso não é suportado pelo NS.\nPerfil não é enviado para o NS.
+ Valor mais baixo da área de intervalo (apenas exibição)
+ Valor mais alto da área de intervalo (apenas exibição)
+ Reordenar
+ Idade:
+ Peso:
+ ID:
+ Enviar
+ Perfil mais comum:
+ Nota: Apenas os dados visíveis neste ecrã serão enviados anonimamente. O ID é atribuído a esta instalação do AndroidAPS. Você pode enviar dados novamente se o perfil principal for alterado, mas deixá-lo rodar pelo menos uma semana para tornar o resultado visível no intervalo de tempo. Sua ajuda é apreciada.
+ Questionário
+ Entrada de idade inválida
+ Entrada de peso inválida
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Hipo: %2$02d%% Dentro: %3$02d%% Hiper: %4$02d%%]]>
+ Média
+ TDD
+ TIR
+ Monitor de actividade
+ Quer reiniciar as estatísticas de actividade?
+ Estatísticas
+ Glic. Aleatória
+ Gerar dados de Glic. aleatórios (Somente modo de Demonstração)
+ GLIC
+ Ferramentas
+ Mostrar Localização
+ Erro
+ 12h
+ 24h
+ Evento de automação
+ Já definido
+ Mensagem
+ Limpar fila? Todos os dados na fila serão perdidos!
+ O uso do Bólus Estendido irá parar o modo Closed Loop no tempo do bólus estendido. Quer realmente isso?
+ Closed Loop desabilitado por causa da execução do Bólus Estendido
+ BE
+ \"VerificadorTelefone\"
+ Menu do Gráfico
+ AS
diff --git a/app/src/main/res/values-ro-rRO/objectives.xml b/app/src/main/res/values-ro-rRO/objectives.xml
index 0c4e5ad161..c37a61470e 100644
--- a/app/src/main/res/values-ro-rRO/objectives.xml
+++ b/app/src/main/res/values-ro-rRO/objectives.xml
@@ -44,10 +44,10 @@
Următoarea nefinalizată
Solicită codul: %1$s
(bifați toate răspunsurile corecte)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Nu există conexiune la internet
Nu s-a reușit preluarea timpului
Nu au fost îndeplinite cerințele obiectivului
diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml
index 20f1ef7ee7..6bc27065bc 100644
--- a/app/src/main/res/values-ro-rRO/strings.xml
+++ b/app/src/main/res/values-ro-rRO/strings.xml
@@ -74,8 +74,6 @@
Ins:
IOB:
IOB totală:
- Cantitatea de insulină
- Cantitatea de carbohidrați
Glicemie
TT
Carbohidrați
@@ -113,7 +111,6 @@
Privire de ansamblu
Profil NS
Profil simplu
- BazalăTemp
Tratamente
Pompă virtuală
Careportal
@@ -145,21 +142,17 @@
Încălcare a unei limite
Eroare la livrarea bolusului
Eroare la setare bazală temporară
- Valoare bazală [%%]
- %% (100%% = curent)
Acceptă noua bazală temporară:
Tratament
Calculator
Limitare aplicată!
Confirmare
- Introduceți tratament nou:
Bolus
Bolus:
Bazală
Bazală:
Carbohidrați
Schimbați ceea ce ați introdus!
- Setați un nou bolus extins:
Sursă glicemie
De unde trebuie să primească AndroidAPS datele?
xDrip
@@ -186,7 +179,6 @@
Inserare senzor
Start senzor
Schimbare cartuș insulină
- Schimbare profil
Gustare
Masă
Bolus de corecție
@@ -207,7 +199,6 @@
Procent
Absolut
Note
- Ora evenimentului
Profil
Introdus de
Tip glicemie
@@ -232,7 +223,6 @@
Se conectează
Conectat
Deconectat
- Setări pompă DanaR
Licență utilizator final
NU FOLOSIȚI PENTRU LUAREA DE DECIZII MEDICALE. NU EXISTĂ RĂSPUNDERE LEGALĂ SAU GARANȚIE PENTRU ACEST PROGRAM, ÎN LIMITA APLICABILĂ A LEGII. CU EXCEPTIA CAZURILOR SPECIAL MENȚIONATE, AUTORUL ȘI/SAU ALTE PERSOANE IMPLICATE PUN LA DISPOZIȚIE ACEST PROGRAM FĂRĂ NICIO GARANȚIE, IMPLICITĂ SAU EXPLICITĂ, INCLUZÂND, DAR FĂRĂ A SE LIMITA LA, GARANȚIILE LEGATE DE VĂNZAREA SAU POTRIVIREA PENTRU UN ANUME SCOP. ÎNTREGUL RISC LEGAT DE CALITATEA ȘI PERFORMANȚA ACESTUI PROGRAM CAD ÎN RESPONSABILITATEA DUMNEAVOASTRĂ. DACĂ PROGRAMUL SE DOVEDEȘTE A FI DEFECT, DUMNEAVOASTRĂ VĂ ASUMAȚI ÎNTREAGA RĂSPUNDERE, PRECUM ȘI TOATE COSTURILE LEGATE DE SERVICE, REPARAȚII SAU CORECȚII.
ÎNȚELEG ȘI SUNT DE ACORD
@@ -269,8 +259,6 @@
Deget
Senzor
Manual
- Țintă temporară
- Renunțare la ținta temporară
Setări de profil DanaR
DIA [o]
Durata de Acțiune a Insulinei (DIA)
@@ -327,7 +315,7 @@
Pentru suspendarea buclei pentru %1$d minute trimiteți codul %2$s
Bazala temporară %1$.2fU/h pentru %2$d minute a fost trimisă cu succes
Bolusul extins de %1$.2fU pentru %2$d min a fost inițiat
- Bazala temporară %1$d% pentru %2$d minute a fost stabilită cu succes
+ Bazala temporară %1$d%% pentru %2$d minute a fost stabilită cu succes
Trimiterea bazalei temporare a eșuat
Pornirea bolusului extins a eșuat
Pentru oprirea bazalei temporare, răspundeți cu codul %1$s
@@ -403,7 +391,6 @@
Masă în curând
Hipo
Activitate
- Șterge înregistrarea:
Statistici DanaR
TDD cumulat
TDD estimat exponențial
@@ -562,16 +549,12 @@
Toate trimiterile de date către NS sunt oprite. AAPS este conectat la NS dar nu se fac schimbări în NS
Pas bazală
Pas bolus
- BolusExtins
- ȚintăTemporară
Renunță la bolusul extins
Vechime senzor
Vechime canulă
Vechime insulină
ore
- Tip bazală
Profil invalid!!!
- SchimbareProfil
Vechime baterie pompă
Schimbare baterie pompă
Opțiuni alarmare
@@ -620,7 +603,6 @@
CARBO ȘI BOLUS
CGM ȘI OPENAPS
POMPĂ
- Valoare bazală [U/o]
Durată [min]
OpenAPS SMB
SMB
@@ -640,7 +622,6 @@
Se așteaptă conectarea la pompă
Conectare OK
Conectare nereușită
- CONECTARE
Niciun dispozitiv găsit până acum
Rezervor gol
Alertă măsurare glicemie
@@ -749,7 +730,6 @@
Un bolus de aceeași valoare a fost livrat în ultimele două minute. Pentru a preveni bolusarea accidentală dublă și pentru a evita greșelile, acesta nu se va livra.
Acum
Se citește istoricul din pompă
- istoric pompă
Se setează profilul bazalei
Nivelul insulinei din pompă este scăzut
Nivelul bateriei pompei este scăzut
@@ -945,11 +925,7 @@
Sunet
Vibrație
Ambele
- LCD în timp [s]
- Timp lumină de fundal [s]
Unități glicemie
- Oprire (ore)
- Rezervor aproape golit (Unități)
Salvați opțiunile în pompă
Pornit
Oprit
@@ -1165,7 +1141,6 @@
S-a detectat rularea unei versiuni invalide. Buclă dezactivată!
versiune veche
versiune foarte veche
- Noua versiune este disponibilă de cel puțin %1$d zile! Revenire la LGS după 60 zile, bucla va fi dezactivată după 90 zile
2o
%1$.2fU
Aplicația Dexcom (modificată)
@@ -1193,15 +1168,12 @@
Long:
Dist [m]:
Nume:
- Localizarea este %1$s
Ultimul bolus
Ultimul bolus acum %1$s %2$s min
COB
COB %1$s %2$.0f
Numele acțiunii
EDITARE
- Trebuie să alegeți un tip de acțiune:
- Trebuie să alegeți un tip de declanșator:
Declanșatori:
ȘTERGE
Condiții pre-existente:
@@ -1292,7 +1264,6 @@
Frecvența pompei nesuportată.
Adresa RileyLink invalidă.
Tipul de pompă detectat nu corespunde cu cel configurat.
- Nu sunt active profile de rată bazală în pompă.
Tipul de profil bazal setat în pompă este incorect (trebuie să fie STD).
Tip incorect de RBT setat în pompă (trebuie să fie Absolut).
Bolus maxim setat incorect în pompă (trebuie să fie %1$.2f).
@@ -1343,7 +1314,6 @@
Ultima conexiune la pompă [minute în urmă]
Ultima conexiune la pompă %1$s %2$s minute în urmă
Trimite SMS: %1$s
- Trimite SMS la toate numerele prestabilite
Trimite SMS cu text
%2$+.2fU]]>
Restricție de bolus aplicată: %2$.2fU la %3$.2fU]]>
diff --git a/app/src/main/res/values-ru-rRU/objectives.xml b/app/src/main/res/values-ru-rRU/objectives.xml
index 97fac47306..71faff0d36 100644
--- a/app/src/main/res/values-ru-rRU/objectives.xml
+++ b/app/src/main/res/values-ru-rRU/objectives.xml
@@ -46,10 +46,10 @@
Следующий незавершенный
Код запроса: %1$s
(отметьте все правильные ответы)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Нет подключения к Интернету
Не удалось загрузить время
Требования к цели не выполнены
diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml
index 979ad94324..78b3450504 100644
--- a/app/src/main/res/values-ru-rRU/strings.xml
+++ b/app/src/main/res/values-ru-rRU/strings.xml
@@ -74,8 +74,6 @@
инс:
IOB: активный инсулин
общий IOB
- кол-во инсулина
- кол-во углеводов
гликемия
TT
углеводы
@@ -114,7 +112,6 @@
начало
профиль NS
простой профиль
- ВремБазал
Терапия
виртуальная помпа
Портал лечения / назначений
@@ -146,21 +143,18 @@
ограничение нарушено
Ошибка подачи болюса
Ошибка подачи врем базала
- Величина базала [%%]
- %% (100%% = текущее)
+ Величина базала [%]
принять новый врем базал:
болюс
калькулятор
применено ограничение!
подтверждение
- Ввести новое назначение:
болюс
болюс:
базал
базал:
углеводы
измените введенные данные
- Установить новый удлиненный болюс:
источник СК
Откуда должен получать данные AndroidAPS?
xdrip
@@ -187,7 +181,7 @@
Установка сенсора мониторинга глюкозы
старт сенсора
замена картриджа инсулина
- смена профиля
+ Смена профиля
болюс на перекус
болюс на еду
болюс на коррекцию
@@ -208,7 +202,7 @@
процент
абсолют
заметки
- время события
+ Время события
профиль
кем введено
тип глюкозы
@@ -233,7 +227,7 @@
соединение устанавливается
соединение установлено
Разъединено
- настройки помпы DanaR
+ Настройки помпы DanaR
лицензионное соглашение с пользователем
НЕ ДОЛЖНО ИСПОЛЬЗОВАТЬСЯ ДЛЯ ПРИНЯТИЯ МЕДИЦИНСКИХ РЕШЕНИЙ. ПРОГРАММА НЕ ДАЕТ ГАРАНТИЙ В РАМКАХ СУЩЕСТВУЮЩЕГО ЗАКОНОДАТЕЛЬСТВА. ПРЕДОСТАВЛЯЕТСЯ \"КАК ЕСТЬ\" БЕЗ ЯВНЫХ ИЛИ СКРЫТЫХ ГАРАНТИЙ ВКЛЮЧАЯ НО НЕ ОГРАНИЧИВАЯСЬ ВОЗМОЖНОСТЬЮ КОММЕРЧЕСКОГО ИСПОЛЬЗОВАНИ ИЛИ СООТВЕТСТВИЯ КАКИМ-ЛИБО ЦЕЛЯМ. ВСЕ РИСКИ ЛОЖАТСЯ НА ВАС. В СЛУЧАЕ НЕРАБОТОСПОСОБНОСТИ ПРОГРАММЫ ВЫ НЕСЕТЕ ВСЕ РАСХОДЫ СВЯЗАННЫЕ С ОБСЛУЖИВАНИЕМ РЕМОНТОМ ИЛИ КОРРЕКТИРОВКОЙ.
я понимаю и принимаю
@@ -282,8 +276,8 @@
палец
сенсор
вручную
- временное целевое значение
- отмена времнной цели
+ Временные целевые значения
+ Отмена времнной цели
настройки профиля DanaR
время действия инсулина (ч.):
Продолжительность активности инсулина
@@ -376,8 +370,11 @@
кнопка 1
кнопка 2
кнопка 3
+ Единицы:
+ Единицы
мг/дл
ммоль/л
+ Время действия инсулина DIA
целевой диапазон
диапазон для визуализации
Нижняя и верхняя граница диаграммы в отчетах и Smartwatch
@@ -419,7 +416,7 @@
Ожидаемый прием пищи
Гипо
Нагрузка
- удалить запись
+ Удалить запись
статистика DanaR
накопительные TDD
экспоненциально взвешенные TDD
@@ -580,16 +577,13 @@
данные передаваемые в NS не доходят. AAPS соединяется с NS но изменения туда не вносятся
шаг базала
шаг болюса
- Удлиненный болюс
- ВремЦель
Отмена удлиненного болюса
сенсор пропаботал
Катетер помпы проработал
Инсулин проработал
час
- тип базала
Неверный профиль !!!
- смена профиля
+ Переключить профиль
Батарея помпы работает
замена батареи помпы
опции оповещения
@@ -638,7 +632,6 @@
УГЛЕВОДЫ ; БОЛЮС
МОНИТОРИНГ; OPENAPS
ПОМПА
- значения базала (ед/ч)
Длительность (мин)
Супер микро болюс OpenAPS
Супер микро болюс SMB
@@ -658,7 +651,7 @@
Ожидание соединения на помпе
Соединение OK
Истекло время ожидания соединения
- Установка соединения
+ Сопряжение
Устройства пока не найдены
Резервуар пуст
Предупреждение при измерении уровня СК
@@ -769,7 +762,7 @@
Болюс с таким же количеством единиц был запрошен за последние две минуты. Для предотвращения случайных двойных болюсов и сбоев операция отменена.
Сейчас
Чтение истории помпы
- история помпы
+ Журнал помпы
Установка базального профиля
Низкий уровень инсулина в картридже помпы
Низкий заряд батареи помпы
@@ -789,6 +782,7 @@
Поле обзора
тому назад
%1$.2f ч
+ %1$d мин
Всегда включать супер микро болюс SMB
Всегда включать супер микро болюс SMB независимо от болюсов. Возможно только для источников СК с хорошей фильтрацией данных вроде G5
Активировать супер микро болюс SMB после углеводов
@@ -967,11 +961,11 @@ Context | Edit Context
Звуковой сигнал
Вибросигнал
Оба
- LCD экран на время [s]
- Подсветка на время [s]
+ Время LCD экрана [seconds]
+ Время подсветки [seconds]
Единиц глюкозы
- (Часов) до выключения помпы
- В резервуаре мало инсулина (ед.)
+ Выключение через [hours]
+ В резервуаре мало инсулина [Units]
Сохранить параметры в помпе
Вкл.
Выкл.
@@ -1189,7 +1183,7 @@ Context | Edit Context
Мы обнаружили, что вы используете недопустимую версию. Цикл отключен!
старая версия
очень старая версия
- Новая версия доступна не менее %1$d дней! После 60 дней переход на остановку при низкой гликемии LGS, замкнутый цикл будет отключен через 90 дней
+ Новая версия доступна уже %1$d дней! По истечении %2$d дн алгоритм переходит в режим работы только с остановкой при низкой гликемии LGS, замкнутый цикл будет отключен через %3$d дн
2ч
%1$.2f ед
Приложение Dexcom (модифицированное)
@@ -1217,15 +1211,20 @@ Context | Edit Context
Долгота:
Расст [м]:
Имя:
- Местоположение: %1$s
+ %1$s %2$s
+ Когда
+ Когда вы находитесь внутри зоны
+ Когда вы вне зоны
+ Когда вы входите в названную зону
+ Когда вы покидаете названную зону
Предыдущий болюс
Время болюса %1$s %2$s мин назад
Активн углеводы
Активн углеводы %1$s %2$.0f
Название задачи
РЕДАКТ
- Выберите тип действия:
- Выберите тип триггера:
+ Выберите тип действия
+ Выберите тип триггера
Триггеры:
УДАЛИТЬ
Предусловия:
@@ -1318,7 +1317,7 @@ Context | Edit Context
Частота помпы не поддерживается.
Недопустимый адрес RileyLink.
Обнаруженный тип помпы не соответствует настроенному.
- Профили базала не включены на помпе.
+ Базальные профили/настройки шаблонов не включены в помпе. Включите их на помпе.
Базовый профиль на помпе неверный (должен быть STD).
Неверный тип временной скорости базала TBR на помпе (должен быть Absolute).
На помпе задан неверный макс болюс (должен быть %1$.2f).
@@ -1369,7 +1368,7 @@ Context | Edit Context
Последняя связь с помпой [ мин. назад]
Последняя связь с помпой %1$s %2$sмин. назад
Отправить SMS: %1$s
- Отправьте SMS на все настроенные номера
+ Отправить SMS на все номера
Отправить SMS с текстом
%2$+.2fед]]>
Применено ограничение на болюс: %2$.2fед до %3$.2fед]]>
@@ -1391,6 +1390,10 @@ Context | Edit Context
%1$d%%
Мастер Болюса
мин
+ Название профиля:
+ Выбрано:
+ Единицы
+ Хотите переключить профиль и сбросить изменения, внесенные в текущий профиль?
%1$d гр
Вкл.
Выкл.
@@ -1398,4 +1401,52 @@ Context | Edit Context
Очистить начатые
Определение времени
Хотите сбросить начатую цель? Можете потерять уже достигнутое.
+ Помпа не выбрана
+ Выберите единицы, в которых вы хотите отображать значения
+ Перенести изменения локального профиля в NS
+ Время действия инсулина DIA
+ IC (инсулин/углеводы)
+ ISF (чувствительность к инсулину)
+ ЦЕЛЬ
+ Клонировать
+ Сначала сохраните или сбросьте текущие изменения
+ Удалить текущий профиль?
+ Создать новый локальный профиль из этого?
+ Имя профиля содержит точки.\nЭто не поддерживается NS.\nПрофиль не выгружен в NS.
+ Меньшее значение диапазона целевых значений (только для дисплея)
+ Большее значение диапазона целевых значений (только для дисплея)
+ Повторный заказ
+ Возраст:
+ Вес:
+ Идентификатор:
+ Отправить
+ Наиболее часто применяемый профиль:
+ Примечание: Данные, видимые на этом экране, будут загружены анонимно. Для этой установки AndroidAPS назначен идентификатор. Вы можете снова передать данные, если ваш основной профиль будет изменен, но пусть он работает по крайней мере в течение недели, чтобы результат был виден в динамике. Ваша помощь ценна.
+ Опрос
+ Некорректное значение возраст
+ Некорректное значение вес
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Низкий: %2$02d%% В целевом диапазоне: %3$02d%% Высокий: %4$02d%%]]>
+ Средний
+ TDD/общая суточная доза
+ Время в целевом диапазоне TIR
+ Монитор активности
+ Хотите сбросить статистику активности?
+ Статистика
+ Случайные значения ГК
+ Генерировать случайные данные ГК (только демо-режим)
+ BG/ГК
+ Инструментарий
+ Показать расчет
+ Ошибка
+ 12 ч
+ 24 ч
+ Автоматизированное событие
+ Уже установлено
+ Сообщение
+ Очистить очередь? Все данные в очереди будут потеряны!
+ Функция Пролонгированный Болюс остановит режим замкнутого цикла на время действия пролонгированного болюса. Подтверждаете выбор?
+ Замкнутый цикл отключен из-за работы Пролонгированного Болюса
+ ПБ
+ \"PhoneChecker\"
diff --git a/app/src/main/res/values-sk-rSK/objectives.xml b/app/src/main/res/values-sk-rSK/objectives.xml
index 0b55a38e96..467ae4f0de 100644
--- a/app/src/main/res/values-sk-rSK/objectives.xml
+++ b/app/src/main/res/values-sk-rSK/objectives.xml
@@ -46,10 +46,10 @@
Ďalšia nedokončená
Kód žiadosti: %1$s
(zaškrtnite všetky správne odpovede)
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/FAQ.html#co-delat-pri-sprchovani-a-koupani
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#konfigurace
- https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/FAQ.html#co-delat-pri-sprchovani-a-koupani
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#konfigurace
+ https://androidaps.readthedocs.io/en/latest/CROWDIN/cs/Getting-Started/Screenshots.html#hlavni-stranka
Nie ste pripojený k internetu
Vyčítanie času zlyhalo
Požiadavky cieľa nie sú splnené
diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml
index a31af19919..38500ca8a2 100644
--- a/app/src/main/res/values-sk-rSK/strings.xml
+++ b/app/src/main/res/values-sk-rSK/strings.xml
@@ -74,8 +74,6 @@
Inz:
IOB:
Celkový IOB:
- Množstvo inzulínu
- Množstvo sacharidov
Glykémia
TT
Sacharidy
@@ -114,7 +112,6 @@
Prehľad
NS Profil
Jednoduchý profil
- DočasnýBazál
Ošetrenia
Virtuálna pumpa
Starostlivosť
@@ -146,21 +143,18 @@
Mimo povolený rozsah
Chyba podania bolusu
Chyba podávania dočasného bazálu
- Hodnota bazálu [%%]
- %% (100%% = aktuálny)
+ Hodnota bazálu [%]
Povoliť nový dočasný bazál:
Bolus
Kalkulačka
Aplikované obmedzenie!
Potvrdenie
- Zadaj nové ošetrenie:
Bolus
Bolus:
Bazál
Bazál:
Sacharidy
Zmeňte zadanie!
- Spustiť nový predĺžený bolus:
Zdroj glykémie
Odkiaľ má AndroidAPS získavať glykémie?
xDrip
@@ -208,7 +202,7 @@
Percentá
Absolútne
Poznámky
- Čas udalosti
+ Čas udalosti
Profil
Zadal
Zadanie glykémie
@@ -233,7 +227,7 @@
Pripájanie
Pripojené
Odpojené
- DanaR nastavenia pumpy
+ Nastavenie pumpy Dana
Licenčná zmluva s koncovým používateľom
Tento program nemôže byť použitý na medicínske rozhodnutia. Na program neexistuje žiadna záruka, alebo garantovaná podpora v akejkoľvek podobe. Keď už sa rozhodneš pre používanie, tak jeho kvalita a celkové schopnosti tohto projektu závisia len na Tebe samotnom. Ak by sa ukázalo, že je program chybný, preberáš všetky potrebné náklady na liečbu, prípadne náklady na iné servisné služby, opravy, alebo korekcie.
ROZUMIEM A POTVRDZUJEM
@@ -422,7 +416,7 @@
Pred jedlom
Hypoglykémia
Aktivita
- Odstrániť záznam:
+ Odstrániť záznam
DanaR štatistiky
Kumulatívny TDD
Exponenciálne vážený TDD
@@ -583,16 +577,13 @@
Všetky dáta odoslané do NS, budú zahodené. AAPS je pripojený k NS, ale nerobí v ňom žiadne zmeny
Krok bazálu
Krok bolusu
- PredĺženýBolus
- DočasnýCieľ
Zrušiť predĺžený bolus
Vek senzora
Vek kanyly
Vek inzulínu
hodín
- Typ bazálu
Chybný profil !!!
- Prepnutie profilu
+ Vykonajte zmenu profilu
Vek batérie v pumpe
Výmena batérie v pumpe
Nastavenie alarmov
@@ -641,7 +632,6 @@
SACHARIDY & BOLUSY
CGM & OPENAPS
PUMPA
- Hodnota bazálu [JI/h]
Trvanie [min]
OpenAPS SMB
SMB
@@ -661,7 +651,7 @@
Čakanie na párovanie na pumpe
Spárované
Vypršal časový limit pre párovanie
- PÁROVANIE
+ Párovanie
Zatiaľ nenájdené žiadne zariadenie
Prázdny zásobník
Výstraha merania glykémie
@@ -772,7 +762,7 @@
Rovnako veľký bolus už bol v priebehu poslednej minúty požadovaný. Ako preventívna ochrana pred zdvojeným bolusom a ako ochrana pred chybami bola operácia zakázaná.
Teraz
Načítavam históriu z pumpy
- Pamäť pumpy
+ História pumpy
Nastavenie bazálneho profilu
Zásobník inzulínu v pumpe je takmer prázdny
Batéria v pumpe je takmer vybitá
@@ -792,6 +782,7 @@
Sight
pred
%1$.2f h
+ %1$d min
Vždy povoliť SMB
Povoliť SMB nezávisle na bolusoch. Možno iba zo zdrojom glykémií s dobrým filtrovaním dát, ako napr. G5
Povoliť SMB po jedle
@@ -968,11 +959,11 @@
Zvuk
Vibrácie
Oboje
- Čas pred vypnutím displeja [s]
- Podsvietenie [s]
+ Čas pred vypnutím displeja [sekundy]
+ Podsvietenie [sekundy]
Jednotky
- Vypnutie [h]
- Nízky stav zásobníka [U]
+ Vypnutie [hodiny]
+ Nízky stav zásobníka [Jednotky]
Uložiť do pumpy
ZAP
VYP
@@ -1190,7 +1181,7 @@
Zistili sme, že používate neplatnú verziu. Uzavretý okruh zakázaný!
stará verzia
veľmi stará verzia
- Nová verzia dostupná najmenej %1$d dní! Návrat k liečbe inzulínovou pumpou s podporou senzora po 60 dňoch, okruh bude deaktivovaný po 90 dňoch.
+ Nová verzia je dostupná minimálne %1$d dní! Prepnutie na ochranu pred nízkou glykémiou po %2$d dňoch, vypnutie uzavretého okruhu po %3$d dňoch
2h
%1$.2fJI
Dexcom aplikácia (upravená)
@@ -1218,15 +1209,20 @@
Lon:
Vzdial. [m]:
Meno:
- Poloha je %1$s
+ %1$s %2$s
+ Kedy
+ Keď sa nachádzate vo vnútri oblasti
+ Keď sa nachádzate mimo oblasť
+ Keď vstúpite do oblasti s názvom
+ Keď opustíte oblasť s názvom
Od posledného bolusu
Čas posledného bolusu: pred %1$s %2$s min
COB
COB %1$s %2$.0f
Názov úlohy
EDIT
- Prosím vyberte typ akcie:
- Zvoľte typ podmienky:
+ Vyberte akciu
+ Vyberte typ podmienky
Podmienky:
VYMAZAŤ
Predpoklady:
@@ -1319,7 +1315,7 @@
Nepodporovaná frekvencia pumpy.
Neplatná adresa RileyLinku.
Rozpoznaná pumpa je iného typu než nakonfigurovaná.
- Bazálne profily nie sú na pumpe aktivované.
+ Nastavenie bazálnych profilov/vzorov nie je na pumpe povolené. Povoľte ich na pumpe.
Bazálny profil na pumpe je chybný (musí byť STD).
Chybný typ dočasného bazálu na pumpe (musí byť absolútny).
Chybný max. bolus na pumpe (musí byť %1$.2f).
@@ -1370,7 +1366,7 @@
Posledné spojenie s pumpou [pred X minútami]
Posledné spojenie s pumpou pred %1$s %2$s minútami
Poslať SMS: %1$s
- Odoslať SMS na všetky predvolené čísla
+ Poslať SMS na všetky čísla
Odoslať SMS s textom
%2$+.2fU]]>
Aplikované obmedzenie bolusu: %2$.2fJI na %3$.2fJI]]>
@@ -1417,4 +1413,40 @@
Názov profilu obsahuje bodky.\nToto nie je podporované v NS.\nProfil nebude prenesený do NS.
Spodná hodnota v oblasti cieľového rozsahu (iba zobrazovanie)
Horná hodnota v oblasti cieľového rozsahu (iba zobrazovanie)
+ Zmena poradia
+ Vek:
+ Váha:
+ ID:
+ Odoslať
+ Najčastejšie používaný profil:
+ Poznámka: Len údaje zobrazené na tejto obrazovke budú odosielané anonymne. ID je pridelené na túto inštaláciu AndroidAPS. Údaje môžete odoslať znova, ak sa váš hlavný profil zmení, ale nechajte ho bežať aspoň týždeň, aby bol výsledok času v rozsahu viditeľný. Vaša pomoc je vítaná.
+ Prieskum
+ Neplatný záznam veku
+ Neplatný záznam váhy
+ %1$s: ∑: %2$.2f Bol: %3$.2f Baz: %4$.2f]]>
+ %1$s: Pod: %2$02d%% V: %3$02d%% Nad: %4$02d%%]]>
+ Priemer
+ CDD
+ Čas v rozsahu
+ Monitor aktivity
+ Chcete resetovať štatistiky aktivity?
+ Štatistiky
+ Náhodná glykémia
+ Vygeneruj náhodné dáta glykémií (iba Demo režim)
+ Glykémia
+ Nástroje
+ Zobraziť kalkuláciu
+ Chyba
+ 12h
+ 24h
+ Udalosť automatiky
+ Už nastavené
+ Správa
+ Vymazať frontu? Všetky dáta vo fronte budú stratené!
+ Použitie funkcie rozloženého bolusu zastaví uzavretý okruh na dobu trvania rozloženého bolusu. Naozaj to chcete?
+ Uzavretý okruh je zastavený kvôli prebiehajúcemu rozloženému bolusu
+ EB
+ PhoneChecker
+ Grafové menu
+ AS
diff --git a/app/src/main/res/values-sv-rSE/objectives.xml b/app/src/main/res/values-sv-rSE/objectives.xml
index 98ade1c143..f049262c18 100644
--- a/app/src/main/res/values-sv-rSE/objectives.xml
+++ b/app/src/main/res/values-sv-rSE/objectives.xml
@@ -46,10 +46,10 @@
Nästa icke slutförda
Begärd kod: %1$s
(kontrollera alla korrekta svar)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Inte ansluten till internet
Fel vid hämtning av tid
Målets krav är inte uppfyllda
diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml
index 67d5d3d7c6..ec0e76b738 100644
--- a/app/src/main/res/values-sv-rSE/strings.xml
+++ b/app/src/main/res/values-sv-rSE/strings.xml
@@ -75,8 +75,6 @@ Eversense-appen.
Ins:
IOB:
IOB fr basal:
- Insulin
- KH
BG
TT
KH
@@ -115,7 +113,6 @@ Eversense-appen.
Översikt
NS-profil
Enkel profil
- Temp basal
Behandlingar
Virtuell pump
Careportal
@@ -147,21 +144,18 @@ Eversense-appen.
Begränsning nådd
Fel vid bolusleverans
Fel vid justering av temp basal
- Basaldos [%%]
- %% (100%% = profilens värde)
+ Basaldos [%]
Acceptera ny temp basal:
Behandling
Kalkylator
Begränsning nådd
Bekräfta
- Ange ny behandling:
Bolus
Bolus:
Basal
Basal:
KH
Ändra inmatning
- Ställ in ny förlängd bolus:
BG-källa
Var ska AndroidAPS få sitt data ifrån?
xDrip
@@ -188,7 +182,7 @@ Eversense-appen.
Byte CGM-sensor
Start CGM-sensor
Byte insulinreservoar
- Byt profil
+ Profilbyte
Mellanmålsbolus
Måltidsbolus
Korrektionsbolus
@@ -209,7 +203,7 @@ Eversense-appen.
Procent
Absolut
Anteckning
- Tid
+ Tid för händelse
Profil
Loggat av
Glukostyp
@@ -283,8 +277,8 @@ Eversense-appen.
Finger
Sensor
Manuell
- Temp målvärde
- Temp målvärde avbrutet
+ Temp mål
+ Avbryt temp mål
Dana R profilinställningar
DIA [tim]
Insulinets verkningstid
@@ -370,15 +364,18 @@ Eversense-appen.
Endast uppladdning till Nightscout. Kommer inte få BG-data om inte lokal källa som xDrip används. Kommer heller inte att kunna hämta basalprofiler från Nightscout.
Pump inte initierad
Pump inte initierad, ingen profil vald.
- Prime/Fyll
+ Förfyllning
Försäkra dig om att mängden motsvarar det som är specificerat för just ditt infusionsset.
Övrigt
- Standardvärden för prime/fyll
+ Standardvärden för förfyllning av slang och kanyl.
Knapp 1
Knapp 2
Knapp 3
+ Enheter:
+ Enheter
mg/dl
mmol/l
+ Duration
Målområde:
Gränsvärden för visualisering
Högt och lågt värde för grafen i Översikt och i klockan
@@ -420,7 +417,7 @@ Eversense-appen.
Äta snart
Hypo
Träning
- Ta bort sparad data:
+ Ta bort post
Dana R statistik
Kumulativ TDD
Exponentiellt viktad TDD
@@ -581,16 +578,13 @@ Eversense-appen.
Ingen data sänds till Nightscout. AndroidAPS ansluter till Nightscout men inga ändringar görs i Nightscout
Basalsteg
Bolussteg
- Förlängd bolus
- Temp mål
Stoppa förlängd bolus
Sensorålder
Kanylålder
Insulinålder
timmar
- Basaltyp
Ogiltig profil!
- Profilbyte
+ Genomför profilbyte
Pumpbatteri ålder
Byte pumpbatteri
Larminställningar
@@ -639,7 +633,6 @@ Eversense-appen.
KOLHYDRATER & BOLUS
CGM & LOGGNING
PUMP
- Basal [E/tim]
Duration [min]
OpenAPS SMB
SMB
@@ -659,7 +652,7 @@ Eversense-appen.
Väntar på parkoppling med pump
Parkopplingen klar
Parkopplingen tog för lång tid
- PARKOPPLAR
+ Parkoppling
Ingen enhet funnen ännu
Tom reservoar
Varning om blodsockermätning
@@ -790,6 +783,7 @@ Eversense-appen.
Sight
sedan
%1$.2f h
+ %1$d min
Använd alltid SMB
Använd alltid SMB oberoende av bolus. Endast möjligt med en bra filtrerad BG-källa, t ex Dexcom G5.
Använd SMB efter kolhydrater
@@ -966,11 +960,11 @@ Eversense-appen.
Ljud
Vibrera
Båda
- LCD på, tid [s]
- Bakgrundsbelysning på, tid [s]
+ LCD på, tid [sek]
+ Bakgrundsbelysning på, tid [sek]
Glukosenheter
- Stäng av (timmar)
- Låg nivå reservoar (enheter)
+ Avstängning pump [tim]
+ Låg reservoar [Enheter]
Spara till pump
På
Av
@@ -1188,7 +1182,7 @@ Eversense-appen.
Du kör en ogiltig version. Loop avstängd!
gammal version
väldigt gammal version
- Ny version tillgänglig sedan %1$d dagar! Systemet kommer att byta läge till \"stopp innan lågt\" efter 60 dagar och sluta loopa helt efter 90 dagar
+ Ny version tillgänglig för %1$d dagar sedan. Systemet kommer att byta läge till \"stopp innan lågt\" efter %2$d dagar och sluta loopa helt efter %3$d dagar
2 tim
%1$.2f U
Dexcoms app (modifierad)
@@ -1199,7 +1193,7 @@ Eversense-appen.
Medd:
Procent av profil
Procent [%]:
- Byt till profil %1$d% i %2$d min
+ Byt till profil %1$d%% i %2$d min
Byt till profil %1$d%%
finns
finns inte
@@ -1216,15 +1210,20 @@ Eversense-appen.
Lon:
Dist [m]:
Namn:
- Platsen är %1$s
+ %1$s %2$s
+ När
+ När du är inne i området
+ När du är utanför området
+ När du går in i området som heter
+ När du lämnar området som heter
Senaste bolus
Senaste bolus %1$s %2$s min sedan
COB
COB %1$s %2$.0f
Åtgärdsnamn
ÄNDRA
- Vänligen välj åtgärdstyp:
- Vänligen välj typ av utlösare:
+ Välj en åtgärd
+ Vänligen välj typ av utlösare
Utlösare:
TA BORT
Förutsättningar:
@@ -1317,7 +1316,7 @@ Eversense-appen.
Pumpfrekvens stöds inte.
Riley Link adress felaktig.
Pumptypen verkar inte vara samma som den inställda.
- Basalprofiler inte aktiverat på pumpen.
+ Basalprofiler är inte aktiverade på pumpen. Aktivera det i pumpens menyer.
Fel basalprofiltyp inställt på pumpen (måste vara STD).
Fel typ av temp basal på pumpen (måste vara satt till Absolut).
Fel max bolus i pumpen (måste vara %1$.2f).
@@ -1368,7 +1367,7 @@ Eversense-appen.
Senaste anslutning till pump [min sedan]
Senaste anslutning till pump %1$s %2$s min sedan
Skicka SMS: %1$s
- Skicka SMS till alla nummer i inställningar
+ Skicka SMS till alla nummer
Skicka SMS med text
%2$+.2fU]]>
Bolusbegränsning: %2$.2fU till %3$.2fU]]>
@@ -1390,6 +1389,10 @@ Eversense-appen.
%1$d%%
Kalkylator
min
+ Profilnamn:
+ Valt:
+ Enheter
+ Vill du byta profil och ta bort ändringar som gjorts i den aktuella profilen?
%1$dg
På
Av
@@ -1397,4 +1400,52 @@ Eversense-appen.
Rensa påbörjade
Tidsdetektering
Vill du starta om målet? Du kan förlora de steg du gjort hittills.
+ Ingen pump har valts
+ Välj enheter du vill visa värden i
+ Överför lokala profiländringar till NS
+ DIA
+ IC
+ ISF
+ Mål
+ Kopiera
+ Spara eller återställa aktuella ändringar först
+ Ta bort aktuell profil?
+ Vill du skapa en ny lokal profil från detta profilbyte?
+ Profilnamnet innehåller punkter.\nDetta stöds inte av NS.\nProfil överförs inte till NS.
+ Nedre värdet för målområde (endast visning)
+ Övre värdet för målområde (endast visning)
+ Ändra ordning
+ Ålder:
+ Vikt:
+ ID:
+ Spara
+ Den vanligaste profilen:
+ Observera att endast data som visas på den här skärmen kommer att överföras anonymt. ID tilldelas till den här installationen av AndroidAPS. Du kan lämna in data igen om din huvudprofil ändras men låt den köra minst en vecka för att göra resultatet synligt i tid inom intervallet. Din hjälp är uppskattad.
+ Enkät
+ Ogiltig inmatning (ålder)
+ Ogiltig inmatning (vikt)
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Låg: %2$02d%% Mål: %3$02d%% Hög: %4$02d%%]]>
+ Medel
+ TDD
+ TIR
+ Aktivitetsövervakare
+ Vill du återställa aktivitetsstatistiken?
+ Statistik
+ Slumpgenerator för BG
+ Generera slumpmässiga BG-data (endast demo-läge)
+ BG
+ Verktyg
+ Visa beräkning
+ Fel
+ 12 tim
+ 24 tim
+ Automationshändelse
+ Redan satt
+ Meddelande
+ Allt data som inte synkats kommer att kastas bort. Är du säker på att du vill tömma kön?
+ OBS! Om du använder förlängd bolus, kommer du inte längre vara i Closed Loop under den tiden som den förlängda bolusen är igång. Vill du fortsätta?
+ Closed Loop-läget inaktiverat pga att en förlängd bolus är aktiv
+ FB
+ Telefonkontroll
diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml
index bf486de9f4..b14049e2b4 100644
--- a/app/src/main/res/values-tr-rTR/strings.xml
+++ b/app/src/main/res/values-tr-rTR/strings.xml
@@ -70,8 +70,6 @@
Ins:
IOB:
Toplam IOB:
- İnsülin
- Karbonhidrat
KŞ
TT
Karbonhidrat
@@ -109,7 +107,6 @@
Genel Bakış
Nightscout Profil
Basit Profil
- Geçici Bazal
Tedaviler
Sanal pompa
Careportal
@@ -146,14 +143,12 @@
Hesap makinesi
Sınırlaması uygulanır!
Onaylama
- Yeni tedavi girin:
Bolus
Bolus:
Bazal
Bazal:
Karbonhidrat
Girişinizi değiştirin!
- Yeni yayım bolusu ayarla:
KŞ kaynağı
AndroidAPS verilerini nereden alsın?
xDrip
@@ -180,7 +175,6 @@
CGM Sensör Yerleştir
CGM sensörü Başlat
İnsülin Kartuş Değişimi
- Profil değiştir
Aperatif Bolusu
Öğün Bolus
Düzeltme Bolus
@@ -201,7 +195,6 @@
Yüzde
Mutlak
Notlar
- Etkinlik saati
Profil
Tarafından girilen
Glikoz türü
@@ -225,7 +218,6 @@
Bağlanıyor
Bağlanıldı
Bağlantı kesildi
- DanaR pompa ayarları
Son Kullanıcı Lisans Sözleşmesi
TIBBİ KARAR VERMEK İÇİN KULLANILMAMALIDIR. UYGULANABİLİR YASANIN İZİN VERDİĞİ ÖLÇÜDE, PROGRAM İÇİN GARANTİ YOKTUR. TELİF HAKKI SAHİPLERİNİN VE / VEYA DİĞER TARAFLARIN YAZILI OLMASINA YÖNELİK BAŞKA HİÇBİR ŞEKİLDE BELİRTİLEN VEYA BELİRLİ BİR AMACA UYGUNLUK İLE İLGİLİ ZIMNİ GARANTİLER DE DAHİL OLMAK ÜZERE ANCAK BUNLARLA SINIRLI OLMAMAK ÜZERE AÇIK VEYA ZIMNİ HİÇBİR GARANTİ OLMAKSIZIN “OLDUĞU GİBİ” SAĞLAMAKTADIR. PROGRAMIN KALİTESİ VE PERFORMANSI İLE İLGİLİ TÜM RİSK SİZE AİTTİR. PROGRAMIN HASARLI OLMASI DURUMUNDA, TÜM GEREKLİ SERVİS, ONARIM VEYA DÜZELTME MALİYETİNİ KABUL ETMİŞ OLURSUNUZ.
BEN ANLADIM VE KABUL EDİYORUM
@@ -257,8 +249,6 @@
Parmak
Sensör
Manuel
- Geçici hedef
- Geçici hedef iptal
DanaR profil ayarları
DIA [h]
İnsülin aktivitesinin süresi
@@ -375,7 +365,6 @@
Yakında Öğün
Hipo
Eğzersiz
- Kaydı kaldır:
DanaR istatistikleri
Toplamsal GTD (Günlük Toplam Doz)
Katlanarak artan ağırlıklı GTD (Günlük Toplam Doz)
@@ -526,16 +515,12 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
NS\'ye gönderilen tüm veriler düştü. AAPS NS\'ye bağlandı, ancak NS\'de hiçbir değişiklik yapılmadı
Bazal adım
Bolus adım
- Yayım Bolus
- Geçici hedef
Yayma Bolusu iptal et
Sensör yaşı
Kanül yaşı
İnsülin yaşı
saatler
- Bazal tipi
Geçersiz profil!!!
- Profil değiştir
Pompa pil yaşı
Pompa Akü Değişimi
Alarm türleri
@@ -582,7 +567,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
KARBONHİDRATLAR & BOLUS
CGM & OPENAPS
PUMP
- Bazal değer [Ü/s]
Süre [min]
OpenAPS SMB
SMB
@@ -602,7 +586,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Pompada eşleştirme bekleniyor
Eşleştirme tamam
Eşleştirme zaman aşımı
- EŞLEŞTİRME
Şu ana kadar hiçbir cihaz bulunamadı
Rezervuar boş
Kan şekeri ölçüm uyarısı
@@ -704,7 +687,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Son iki dakikada aynı miktarda bir bolus talep edildi. Yanlışlıkla yapılan çift bolusları önlemek ve hatalara karşı koruma sağlamak için buna izin verilmez.
Şimdi
Pompa geçmişi okunuyor
- pompa geçmişi
Bazal profil ayarlanıyor
Pompa rezervuar seviyesi düşük
Pompa pili düşük
@@ -893,11 +875,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Ses
Titreşim
İkisi de
- LCD ekran saat süresi [s]
- Arka ışık süresi [s]
Glikoz birimleri
- Kapat(saatler)
- Düşük rezervuar (Ünite)
Seçenekleri pompaya kaydet
Aç
Kapa
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 5f187f80f6..be7793e576 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -72,8 +72,6 @@
Ins:
IOB活性胰岛素:
总 IOB:
- 胰岛素
- 碳水化合物
血糖
临时目标
碳水化合物
@@ -111,7 +109,6 @@
首页概览
NS 配置文件
简单配置文件
- 临时基础
治疗
虚拟泵
护理记录
@@ -143,21 +140,17 @@
违反约束条件
大剂量输注错误
临时基础输注错误
- 基础率值 [%%]
- %% (100%% = 当前)
接受新的临时基础率
治疗
计算器
应用约束!
确认
- 输入新的治疗:
大剂量
大剂量:
基础率
基础率:
碳水化合物
更改您的输入!
- 设定新的扩展大剂量
血糖来源
AndroidAPS 从何处获取数据?
xDrip
@@ -184,7 +177,6 @@
CGM 传感器插入
CGM 传感器启动
更换储药器
- 配置文件切换
零食大剂量
餐时大剂量
矫正大剂量
@@ -205,7 +197,6 @@
百分比
绝对
备注
- 事件时间
配置文件
输入者是
血糖类型
@@ -229,7 +220,6 @@
正在连接
已连接
已断开连接
- DanaR 泵设置
最终用户许可协议
不得用于制定医疗决定。在适用法律允许的范围内,对该程序不作任何保证。除非另有书面授权的版权所有者和/或其他方均按原样提供程序,不附带明示或暗示的任何形式的担保,包括但不限于对适销性和适用于特定用途的默示担保。对您的程序的质量和性能的完整风险。如果程序存在缺陷,您应承担所有必要维修,修理或更正的代价.
我理解并同意
@@ -266,8 +256,6 @@
手指
传感器
手动
- 临时目标
- 临时目标取消
DanaR 配置文件设置
DIA [h]
胰岛素活性持续时间
@@ -400,7 +388,6 @@
很快吃饭
低
活动
- 删除记录
DanaR 统计
累积的每日胰岛素输注的总量
日输注总量指数加权
@@ -555,16 +542,12 @@
所有发送到 NS 的数据都将被丢弃。AAPS 已连接到 NS, 但 NS中没有进行任何更改
基础率步值
大剂量步值
- 扩展大剂量
- 临时目标
取消扩展大剂量
传感器使用时间
管路使用时间
胰岛素使用时间
小时
- 基础率类型
无效的配置文件!!!
- 配置文件切换
泵电池使用时间
更换泵电池
报警选项
@@ -612,7 +595,6 @@
碳水化合物 & 大剂量
CGM & OPENAPS
泵
- 基础率值 [U/小时]
持续时间 [min]
OpenAPS SMB
SMB
@@ -632,7 +614,6 @@
等待泵配对
配对成功
配对超时
- 正在配对
迄今未找到任何设备
储药器空了
血糖测量警报
@@ -741,7 +722,6 @@
在最近2分钟内要输注相同数量的大剂量。 为了防止错误地重复打大剂量发生意外,不允许这样操作
现在
读取泵历史记录
- 泵历史记录
设置基础率配置文件
泵储药器快没胰岛素了
泵电池电量不足
@@ -934,11 +914,7 @@
声音
振动
两者都
- LCD屏幕亮的时间[s]
- 背景光开启的时间[s]
血糖单位
- 关机(小时)
- 储药器药量低(单位)
保存选项到泵上
开启
关闭
@@ -1098,7 +1074,6 @@
版本检查器
旧版本
非常旧版本
- 至少可用 %1$d 天的新版本!60 天后返回 LGS,90 天后循环将被禁用
2小时
%1$.2fU
德康app(补丁版)
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 0133d299e6..eca0961ca5 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -200,6 +200,16 @@
- @string/key_medtronic_pump_battery_nizn
+
+ - 15
+ - 30
+ - 45
+ - 60
+ - 75
+ - 90
+ - 105
+ - 120
+
key_medtronic_bolus_debug
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 216c21c379..7d9e0c5896 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -33,6 +33,7 @@
#424242
#BBBBBB
+ #B3FFFFFF
#77dd77
#77dd77
@@ -44,6 +45,9 @@
#40bbaa
#00695c
+ #303030
+ #121212
+
#121212
#779ECB
diff --git a/app/src/main/res/values/objectives.xml b/app/src/main/res/values/objectives.xml
index d5ffbc2e3a..dac9b0234a 100644
--- a/app/src/main/res/values/objectives.xml
+++ b/app/src/main/res/values/objectives.xml
@@ -57,10 +57,10 @@
Next unfinished
Request code: %1$s
(check all correct answers)
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
- https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder
+ https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen
Not connected to the internet
Failed retrieve time
Objective requirements not met
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6897110bd4..fe7cf225a0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -97,8 +97,6 @@
Ins:
IOB:
Total IOB:
- Insulin
- Carbs
BG
TT
Carbs
@@ -138,7 +136,6 @@
Overview
NS Profile
Simple profile
- TempBasal
Treatments
Virtual Pump
Careportal
@@ -173,21 +170,18 @@
Constraints violation
Bolus delivery error
Tempbasal delivery error
- Basal value [%%]
- %% (100%% = current)
+ Basal value [%]
Accept new temp basal:
Treatment
Calculator
Constraint applied!
Confirmation
- Enter new treatment:
Bolus
Bolus:
Basal
Basal:
Carbs
Change your input!
- Set new extended bolus:
BG Source
Where should AndroidAPS gain it\'s data from?
xDrip
@@ -216,7 +210,7 @@
CGM Sensor Insert
CGM Sensor Start
Insulin Cartridge Change
- Profile Switch
+ Profile switch
Snack Bolus
Meal Bolus
Correction Bolus
@@ -238,7 +232,7 @@
Percent
Absolute
Notes
- Event time
+ Event time
Profile
Entered By
Glucose type
@@ -265,7 +259,7 @@
Connecting
Connected
Disconnected
- DanaR pump settings
+ Dana pump settings
End User License Agreement
MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
I UNDERSTAND AND AGREE
@@ -315,8 +309,8 @@
Finger
Sensor
Manual
- Temporary Target
- Temporary Target Cancel
+ Temporary target
+ Temporary target cancel
DanaR profile settings
DIA [h]
Duration of Insulin Activity
@@ -456,7 +450,7 @@
Eating Soon
Hypo
Activity
- Remove record:
+ Remove record
DanaR Stats
Cumulative TDD
Exponentially Weighted TDD
@@ -651,16 +645,13 @@
ns_noupload
Basal Step
Bolus Step
- ExtendedBolus
- TempTarget
Cancel Extended Bolus
Sensor age
Canula age
Insulin age
hours
- Basal type
Invalid profile !!!
- ProfileSwitch
+ Do Profile Switch
Pump battery age
Pump Battery Change
Alarm options
@@ -725,7 +716,6 @@
CARBS & BOLUS
CGM & OPENAPS
PUMP
- Basal value [U/h]
Duration [min]
OpenAPS SMB
SMB
@@ -748,7 +738,7 @@
Waiting for pairing on pump
Pairing OK
Pairing timed out
- PAIRING
+ Pairing
danars_pairing_key_
danars_address
danars_name
@@ -888,7 +878,7 @@
A bolus with the same amount was requested within the last two minutes. To prevent accidental double boluses and to guard against bugs this is disallowed.
Now
Reading pump history
- pump history
+ Pump history
Setting basal profile
Pump cartridge level is low
Pump battery is low
@@ -908,6 +898,7 @@
Sight
ago
%1$.2f h
+ %1$d mins
enableSMB_always
enableSMB_with_COB
enableSMB_with_temptarget
@@ -1131,11 +1122,11 @@
Sound
Vibrate
Both
- LCD on time [s]
- Backlight on time [s]
+ LCD on time [seconds]
+ Backlight on time [seconds]
Glucose units
- Shutdown(hours)
- Low reservoir (Units)
+ Shutdown [hours]
+ Low reservoir [Units]
Save options to pump
On
Off
@@ -1394,7 +1385,7 @@
old version
very old version
- New version for at least %1$d days available! Fallback to LGS after 60 days, loop will be disabled after 90 days
+ New version for at least %1$d days available! Fallback to LGS after %2$d days, loop will be disabled after %3$d days
2h
%1$.2fU
@@ -1424,15 +1415,20 @@
Lon:
Dist [m]:
Name:
- Location is %1$s
+ %1$s %2$s
+ When
+ When you are inside the area
+ When you are outside the area
+ When you enter the area named
+ When you leave the area named
Last bolus ago
Last bolus time %1$s %2$s min ago
COB
COB %1$s %2$.0f
Task name
EDIT
- Please choose an action type:
- Please choose a trigger type:
+ Choose an action type
+ Choose a trigger type
Triggers:
REMOVE
Preconditions:
@@ -1560,7 +1556,7 @@
RileyLink Address invalid.
Pump type detected is not the same as configured type.
- Basal profiles are not enabled on pump.
+ Basal profiles/patterns setting is not enabled on pump. Enable it on the pump.
Basal profile set on pump is incorrect (must be STD).
Wrong TBR type set on pump (must be Absolute).
Wrong Max Bolus set on Pump (must be %1$.2f).
@@ -1616,7 +1612,7 @@
Last connection to pump [minutes ago]
Last connection to pump %1$s %2$s min ago
Send SMS: %1$s
- Send SMS to all numbers in preferences
+ Send SMS to all numbers
Send SMS with text
@@ -1676,4 +1672,40 @@
Higher value of in range area (display only)
Reorder
+ Age:
+ Weight:
+ ID:
+ Submit
+ Most common profile:
+ Note: Only data visible on this screen will be anonymously uploaded. ID is assigned to this installation of AndroidAPS. You can submit data again if your main profile get changed but let it running at least for a week to make result visible in time in range. Your help is appreciated.
+ Survey
+ Invalid age entry
+ Invalid weight entry
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+ %1$s: Low: %2$02d%% In: %3$02d%% High: %4$02d%%]]>
+ Average
+ TDD
+ TIR
+ Activity monitor
+ Do you want to reset activity stats?
+ Statistics
+ Random BG
+ Generate random BG data (Demo mode only)
+ BG
+ Tools
+ Show calcuation
+ Error
+ 12h
+ 24h
+ Automation event
+ Already set
+ Message
+ Clear queue? All data in queue will be lost!
+ Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?
+ Closed loop disabled because of running Extended bolus
+ EB
+ \"PhoneChecker\"
+ Chart menu
+ AS
+
diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml
index befec72ec4..63863118d1 100644
--- a/app/src/main/res/xml/pref_openapssmb.xml
+++ b/app/src/main/res/xml/pref_openapssmb.xml
@@ -80,17 +80,10 @@
+ android:title="@string/smbmaxminutes_summary" />
-
-
+
+
(1d));
when(DateUtil.now()).thenReturn(1000L);
+ when(SP.getLong(R.string.key_smscommunicator_remotebolusmindistance, T.msecs(Constants.remoteBolusMinDistance).mins())).thenReturn(15L);
//BOLUS 1
smsCommunicatorPlugin.setMessages(new ArrayList<>());
sms = new Sms("1234", "BOLUS 1");
diff --git a/app/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.java b/app/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.java
index 7cc5355bb7..359cc8de29 100644
--- a/app/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.java
@@ -4,7 +4,11 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
/**
* Created by mike on 12.03.2018.
@@ -12,20 +16,78 @@ import static org.junit.Assert.*;
public class JsonHelperTest {
- String jsonString = "{\"d\":\"3.0\",\"i\":\"4\",\"s\":\"5\"}";
+ private String jsonString = "{\"d\":\"3.0\",\"i\":\"4\",\"s\":\"5\",\"b\":\"true\",\"j\":{\"a\": \"1\"}}";
@Test
- public void runTest() throws JSONException {
+ public void safeGetObjectTest() throws JSONException {
JSONObject object = new JSONObject(jsonString);
- assertEquals(null, JsonHelper.safeGetString(object, "notexisting"));
+ Object o = new Object();
+ assertEquals(o, JsonHelper.safeGetObject(null, "x", o));
+ assertEquals(o, JsonHelper.safeGetObject(object, "x", o));
+ assertNotEquals(o, JsonHelper.safeGetObject(object, "d", o));
+ }
+
+ @Test
+ public void safeGetJSONObjectTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+ JSONObject o = new JSONObject();
+ assertEquals(o, JsonHelper.safeGetJSONObject(null, "x", o));
+ assertTrue(JsonHelper.safeGetJSONObject(object, "j", o).has("a"));
+ assertEquals(o, JsonHelper.safeGetJSONObject(object, "d", o));
+ }
+
+ @Test
+ public void safeGetStringTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+ Object o = new Object();
+ assertNull(JsonHelper.safeGetString(null, "s"));
+ assertNull(JsonHelper.safeGetString(object, "notexisting"));
assertEquals("5", JsonHelper.safeGetString(object, "s"));
+
+ assertEquals("default", JsonHelper.safeGetString(null, "notexisting", "default"));
assertEquals("default", JsonHelper.safeGetString(object, "notexisting", "default"));
assertEquals("5", JsonHelper.safeGetString(object, "s", "default"));
+ assertEquals("default", JsonHelper.safeGetStringAllowNull(null, "notexisting", "default"));
+ assertEquals("default", JsonHelper.safeGetStringAllowNull(object, "notexisting", "default"));
+ assertNull(JsonHelper.safeGetStringAllowNull(object, "notexisting", null));
+ assertEquals("5", JsonHelper.safeGetStringAllowNull(object, "s", "default"));
+ }
+
+ @Test
+ public void safeGetDoubleTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+
assertEquals(0.0d, JsonHelper.safeGetDouble(object, "notexisting"), 0.0d);
+ assertEquals(0.0d, JsonHelper.safeGetDouble(null, "notexisting"), 0.0d);
assertEquals(3.0d, JsonHelper.safeGetDouble(object, "d"), 0.000001d);
+ assertEquals(6d, JsonHelper.safeGetDouble(null, "notexisting", 6d), 0.0d);
+ assertEquals(6d, JsonHelper.safeGetDouble(object, "notexisting", 6d), 0.0d);
+ assertEquals(3d, JsonHelper.safeGetDouble(object, "d", 6d), 0.0d);
+ }
+
+ @Test
+ public void safeGetLntTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+ assertEquals(0, JsonHelper.safeGetInt(null, "notexisting"));
assertEquals(0, JsonHelper.safeGetInt(object, "notexisting"));
assertEquals(4, JsonHelper.safeGetInt(object, "i"));
}
+
+ @Test
+ public void safeGetLongTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+ assertEquals(0, JsonHelper.safeGetInt(null, "notexisting"));
+ assertEquals(0, JsonHelper.safeGetInt(object, "notexisting"));
+ assertEquals(4, JsonHelper.safeGetInt(object, "i"));
+ }
+
+ @Test
+ public void safeGetBooleanTest() throws JSONException {
+ JSONObject object = new JSONObject(jsonString);
+ assertFalse(JsonHelper.safeGetBoolean(null, "notexisting"));
+ assertFalse(JsonHelper.safeGetBoolean(object, "notexisting"));
+ assertTrue(JsonHelper.safeGetBoolean(object, "b"));
+ }
}
diff --git a/build.gradle b/build.gradle
index d10498081c..3327014f1f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.2'
+ classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.2'
diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml
index 1097be80be..4d197c5bd8 100644
--- a/wear/src/main/AndroidManifest.xml
+++ b/wear/src/main/AndroidManifest.xml
@@ -465,44 +465,44 @@
+ android:label="@string/menu_settings">
+ android:label="@string/menu_wizard">
+ android:label="@string/menu_prime_fill">
+ android:label="@string/menu_status">
+ android:label="@string/action_bolus">
+ android:label="@string/status_cpp">
+ android:label="@string/action_confirm">
+ android:label="@string/menu_prime_fill">
+ android:label="@string/action_carbs">
+ android:label="@string/menu_tempt">
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
index 814020d742..95dea79d47 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
@@ -12,10 +12,11 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
-
+import info.nightscout.androidaps.R;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse;
@@ -71,7 +72,7 @@ public class BolusActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editInsulin.editText.getText().toString());
}
editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
- setLabelToPlusMinusView(view, "insulin");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_insulin));
container.addView(view);
return view;
} else if(col == 1){
@@ -81,7 +82,7 @@ public class BolusActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
}
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false);
- setLabelToPlusMinusView(view, "carbs");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs));
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java
index fa5ee6f70a..b9626b47da 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java
@@ -14,6 +14,7 @@ import android.widget.ImageView;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse;
@@ -83,7 +84,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editTimeshift.editText.getText().toString());
}
editTimeshift = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 23d, 1d, new DecimalFormat("0"), true, true);
- setLabelToPlusMinusView(view, "timeshift");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_timeshift));
container.addView(view);
return view;
} else if(col == 1){
@@ -93,7 +94,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editPercentage.editText.getText().toString());
}
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false);
- setLabelToPlusMinusView(view, "percentage");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_percentage));
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java
index a598a39c2c..cae69b34a5 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java
@@ -14,6 +14,7 @@ import android.widget.ImageView;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse;
@@ -71,7 +72,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
}
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true);
- setLabelToPlusMinusView(view, "carbs");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs));
container.addView(view);
return view;
} else if(col == 1){
@@ -81,7 +82,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editStartTime.editText.getText().toString());
}
editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 15d, new DecimalFormat("0"), false);
- setLabelToPlusMinusView(view, "start [min]");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_start_min));
container.addView(view);
return view;
} else if(col == 2){
@@ -91,7 +92,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editDuration.editText.getText().toString());
}
editDuration = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 8d, 1d, new DecimalFormat("0"), false);
- setLabelToPlusMinusView(view, "duration [h]");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_duration_h));
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
index 694dc0283c..3f9eac6475 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
@@ -16,6 +16,7 @@ import android.widget.TextView;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse;
@@ -70,7 +71,7 @@ public class FillActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editInsulin.editText.getText().toString());
}
editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
- setLabelToPlusMinusView(view, "insulin");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_insulin));
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
index 4b04a72cdc..885f1cd1ba 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
@@ -18,6 +18,7 @@ import android.widget.TextView;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse;
@@ -85,7 +86,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(time.editText.getText().toString());
time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 24 * 60d, 5d, new DecimalFormat("0"), false);
}
- setLabelToPlusMinusView(view, "duration");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_duration));
container.addView(view);
return view;
@@ -105,9 +106,9 @@ public class TempTargetActivity extends ViewSelectorActivity {
lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
if(isSingleTarget){
- setLabelToPlusMinusView(view, "target");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_target));
} else {
- setLabelToPlusMinusView(view, "low");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_low));
}
container.addView(view);
return view;
@@ -126,7 +127,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
}
highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
- setLabelToPlusMinusView(view, "high");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_high));
container.addView(view);
return view;
}else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
index 5c16063bb2..a3a10ae03d 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
@@ -17,6 +17,7 @@ import android.widget.TextView;
import java.text.DecimalFormat;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
@@ -80,7 +81,7 @@ public class WizardActivity extends ViewSelectorActivity {
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false);
}
- setLabelToPlusMinusView(view, "carbs");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs));
container.addView(view);
return view;
} else if(col == 1 && hasPercentage){
@@ -91,7 +92,7 @@ public class WizardActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(editPercentage.editText.getText().toString());
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false);
}
- setLabelToPlusMinusView(view, "percentage");
+ setLabelToPlusMinusView(view, aaps.gs(R.string.action_percentage));
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.java
index a4d1a3d181..77dc2b903b 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.java
@@ -2,6 +2,8 @@ package info.nightscout.androidaps.interaction.menus;
import android.content.Intent;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.actions.FillActivity;
import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@@ -15,22 +17,22 @@ public class FillMenuActivity extends MenuListActivity {
@Override
protected String[] getElements() {
return new String[]{
- "Preset 1",
- "Preset 2",
- "Preset 3",
- "Free amount"
+ aaps.gs(R.string.action_preset_1),
+ aaps.gs(R.string.action_preset_2),
+ aaps.gs(R.string.action_preset_3),
+ aaps.gs(R.string.action_free_amount)
};
}
@Override
protected void doAction(String action) {
- if ("Preset 1".equals(action)) {
+ if (aaps.gs(R.string.action_preset_1).equals(action)) {
ListenerService.initiateAction(this, "fillpreset 1");
- } else if ("Preset 2".equals(action)) {
+ } else if (aaps.gs(R.string.action_preset_2).equals(action)) {
ListenerService.initiateAction(this, "fillpreset 2");
- } else if ("Preset 3".equals(action)) {
+ } else if (aaps.gs(R.string.action_preset_3).equals(action)) {
ListenerService.initiateAction(this, "fillpreset 3");
- } else if ("Free amount".equals(action)) {
+ } else if (aaps.gs(R.string.action_free_amount).equals(action)) {
Intent intent = new Intent(this, FillActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java
index 0692f273fb..50ee1ad8ee 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java
@@ -7,6 +7,8 @@ import android.preference.PreferenceManager;
import java.util.Vector;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.AAPSPreferences;
import info.nightscout.androidaps.interaction.actions.AcceptActivity;
@@ -46,13 +48,13 @@ public class MainMenuActivity extends MenuListActivity {
boolean showWizard = sp.getBoolean("showWizard", true);
Vector menuitems = new Vector();
- menuitems.add("TempT");
- if(showWizard) menuitems.add("Wizard");
- menuitems.add("eCarb");
- menuitems.add("Bolus");
- menuitems.add("Settings");
- menuitems.add("Status");
- if (showPrimeFill) menuitems.add("Prime/Fill");
+ menuitems.add(aaps.gs(R.string.menu_tempt));
+ if(showWizard) menuitems.add(aaps.gs(R.string.menu_wizard));
+ menuitems.add(aaps.gs(R.string.menu_ecarb));
+ menuitems.add(aaps.gs(R.string.menu_bolus));
+ menuitems.add(aaps.gs(R.string.menu_settings));
+ menuitems.add(aaps.gs(R.string.menu_status));
+ if (showPrimeFill) menuitems.add(aaps.gs(R.string.menu_prime_fill));
return menuitems.toArray(new String[menuitems.size()]);
}
@@ -62,33 +64,33 @@ public class MainMenuActivity extends MenuListActivity {
Intent intent;
- if ("Settings".equals(action)) {
+ if (aaps.gs(R.string.menu_settings).equals(action)) {
intent = new Intent(this, AAPSPreferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Re-Sync".equals(action)) {
ListenerService.requestData(this);
- } else if ("TempT".equals(action)) {
+ } else if (aaps.gs(R.string.menu_tempt).equals(action)) {
intent = new Intent(this, TempTargetActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
- } else if ("Bolus".equals(action)) {
+ } else if (aaps.gs(R.string.menu_bolus).equals(action)) {
intent = new Intent(this, BolusActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
- } else if ("Wizard".equals(action)) {
+ } else if (aaps.gs(R.string.menu_wizard).equals(action)) {
intent = new Intent(this, WizardActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
- } else if ("Status".equals(action)) {
+ } else if (aaps.gs(R.string.menu_status).equals(action)) {
intent = new Intent(this, StatusMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
- } else if ("Prime/Fill".equals(action)) {
+ } else if (aaps.gs(R.string.menu_prime_fill).equals(action)) {
intent = new Intent(this, FillMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
- } else if ("eCarb".equals(action)) {
+ } else if (aaps.gs(R.string.menu_ecarb).equals(action)) {
intent = new Intent(this, ECarbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java
index f17bc23e46..8d9a78ec5e 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java
@@ -1,5 +1,7 @@
package info.nightscout.androidaps.interaction.menus;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@@ -12,23 +14,23 @@ public class StatusMenuActivity extends MenuListActivity {
@Override
protected String[] getElements() {
return new String[] {
- "Pump",
- "Loop",
- "CPP",
- "TDD"};
+ aaps.gs(R.string.status_pump),
+ aaps.gs(R.string.status_loop),
+ aaps.gs(R.string.status_cpp),
+ aaps.gs(R.string.status_tdd)};
}
@Override
protected void doAction(String action) {
- if ("Pump".equals(action)) {
+ if (aaps.gs(R.string.status_pump).equals(action)) {
ListenerService.initiateAction(this, "status pump");
- } else if ("Loop".equals(action)) {
+ } else if (aaps.gs(R.string.status_loop).equals(action)) {
ListenerService.initiateAction(this, "status loop");
- } else if ("CPP".equals(action)) {
+ } else if (aaps.gs(R.string.status_cpp).equals(action)) {
ListenerService.initiateAction(this, "opencpp");
- } else if ("TDD".equals(action)) {
+ } else if (aaps.gs(R.string.status_tdd).equals(action)) {
ListenerService.initiateAction(this, "tddstats");
}
}
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/SafeParse.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/SafeParse.java
index 0d654567b0..81ef482194 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/SafeParse.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/SafeParse.java
@@ -25,12 +25,22 @@ public class SafeParse {
}
public static Long stringToLong(String input) {
- Long result = 0L;
- input = input.replace(",", ".");
- try {
- result = Long.parseLong(input);
- } catch (Exception e) {
- }
- return result;
+ Long result = 0L;
+ input = input.replace(",", ".");
+ try {
+ result = Long.parseLong(input);
+ } catch (Exception e) {
+ }
+ return result;
+ }
+
+ public static Float stringToFloat(String input) {
+ Float result = 0f;
+ input = input.replace(",", ".");
+ try {
+ result = Float.valueOf(input);
+ } catch (Exception e) {
+ }
+ return result;
}
}
diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
index 78a6e401a2..51faedeb4b 100644
--- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
@@ -34,6 +34,7 @@ import com.ustwo.clockwise.common.WatchShape;
import java.text.SimpleDateFormat;
import java.util.Date;
+import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.complications.BaseComplicationProviderService;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.data.ListenerService;
@@ -341,7 +342,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
mIOB1.setText(rawData.sIOB1);
mIOB2.setText(rawData.sIOB2);
} else {
- mIOB1.setText("IOB");
+ mIOB1.setText(aaps.gs(R.string.activity_IOB));
mIOB2.setText(rawData.sIOB1);
}
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
index a600290a04..48f7a4e792 100644
--- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
@@ -10,7 +10,7 @@ import android.view.animation.RotateAnimation;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
-
+import info.nightscout.androidaps.interaction.utils.SafeParse;
/**
* Created by andrew-warrington on 01/12/2017.
*/
@@ -124,34 +124,51 @@ public class Steampunk extends BaseWatchFace {
float deltaIsNegative = 1f; //by default go clockwise
if (!rawData.sAvgDelta.equals("--")) { //if a legitimate delta value is received, then...
if (rawData.sAvgDelta.substring(0,1).equals("-")) deltaIsNegative = -1f; //if the delta is negative, go counter-clockwise
-
+ Float AbssAvgDelta = SafeParse.stringToFloat(rawData.sAvgDelta.substring(1)) ; //get rid of the sign so it can be converted to float.
+ String autogranularity = "0" ; //autogranularity off
//ensure the delta gauge is the right units and granularity
if (!rawData.sUnits.equals("-")) {
if (rawData.sUnits.equals("mmol")) {
- if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
+ if (sharedPrefs.getString("delta_granularity", "2").equals("4")) { //Auto granularity
+ autogranularity = "1"; // low (init)
+ if (AbssAvgDelta < 0.3 ) {
+ autogranularity = "3" ; // high if below 0.3 mmol/l
+ } else if (AbssAvgDelta < 0.5) {
+ autogranularity = "2" ; // medium if below 0.5 mmol/l
+ }
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("1") || autogranularity.equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 30f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 30f);
}
- if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
+ if (sharedPrefs.getString("delta_granularity", "2").equals("2") || autogranularity.equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 60f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 60f);
}
- if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
+ if (sharedPrefs.getString("delta_granularity", "2").equals("3") || autogranularity.equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 100f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 100f);
}
} else {
- if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
+ if (sharedPrefs.getString("delta_granularity", "2").equals("4")) { //Auto granularity
+ autogranularity = "1"; // low (init)
+ if (AbssAvgDelta < 5 ) {
+ autogranularity = "3" ; // high if below 5 mg/dl
+ } else if (AbssAvgDelta < 10) {
+ autogranularity = "2" ; // medium if below 10 mg/dl
+ }
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("1") || autogranularity.equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 1.5f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 1.5f);
}
- if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
+ if (sharedPrefs.getString("delta_granularity", "2").equals("2") || autogranularity.equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 3f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 3f);
}
- if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
+ if (sharedPrefs.getString("delta_granularity", "2").equals("3") || autogranularity.equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5);
- deltaRotationAngle = (Float.valueOf(rawData.sAvgDelta.substring(1)) * 6f); //get rid of the sign so it can be converted to float.
+ deltaRotationAngle = (AbssAvgDelta * 6f);
}
}
}
diff --git a/wear/src/main/res/layout-v26/list_item.xml b/wear/src/main/res/layout-v26/list_item.xml
new file mode 100644
index 0000000000..8084d832e6
--- /dev/null
+++ b/wear/src/main/res/layout-v26/list_item.xml
@@ -0,0 +1,23 @@
+
+
+
+
diff --git a/wear/src/main/res/layout/modern_layout.xml b/wear/src/main/res/layout/modern_layout.xml
index 247de09964..c1d429b229 100644
--- a/wear/src/main/res/layout/modern_layout.xml
+++ b/wear/src/main/res/layout/modern_layout.xml
@@ -35,7 +35,7 @@
android:textSize="18sp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
- android:text="no status"
+ android:text="@string/activity_no_status"
android:layout_gravity="center"
android:layout_marginTop="-5dp" />
diff --git a/wear/src/main/res/layout/rect_activity_home_2.xml b/wear/src/main/res/layout/rect_activity_home_2.xml
index 87debd0465..3708761c1f 100644
--- a/wear/src/main/res/layout/rect_activity_home_2.xml
+++ b/wear/src/main/res/layout/rect_activity_home_2.xml
@@ -237,7 +237,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:text="Carb"
+ android:text="@string/activity_carb"
android:textColor="#FFFFFF"
android:textSize="10sp"
android:textStyle="bold" />
@@ -327,7 +327,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:text="IOB"
+ android:text="@string/activity_IOB"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="10sp"
diff --git a/wear/src/main/res/layout/round_activity_home_2.xml b/wear/src/main/res/layout/round_activity_home_2.xml
index 6643bc068c..6b9c3b8d08 100644
--- a/wear/src/main/res/layout/round_activity_home_2.xml
+++ b/wear/src/main/res/layout/round_activity_home_2.xml
@@ -245,7 +245,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:text="Carb"
+ android:text="@string/activity_carb"
android:textColor="#FFFFFF"
android:textSize="10sp"
android:textStyle="bold" />
@@ -335,7 +335,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:text="IOB"
+ android:text="@string/activity_IOB"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="10sp"
diff --git a/wear/src/main/res/values-af-rZA/strings.xml b/wear/src/main/res/values-af-rZA/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-af-rZA/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-bg-rBG/strings.xml b/wear/src/main/res/values-bg-rBG/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-bg-rBG/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-cs-rCZ/strings.xml b/wear/src/main/res/values-cs-rCZ/strings.xml
new file mode 100644
index 0000000000..9b7c4d66de
--- /dev/null
+++ b/wear/src/main/res/values-cs-rCZ/strings.xml
@@ -0,0 +1,94 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(velké)
+ AAPS(VelkýGraf)
+ AAPS(BezGrafu)
+ APS(Kruh)
+ AAPSv2
+ AAPS (Cockpit)
+ AAPS (Steampunk)
+ Žádná data!
+ Stará data!
+ Od %1$s
+ Synchronizovat s AAPS!
+ Od %1$s nebyla obdržena žádná data! Zkontrolujte, zda AAPS na telefonu odesílá data ke sledování
+ AAPS data jsou %1$s stará! Zkontrolujte svůj senzor, xDrip +, NS, AAPS konfigurace nebo ostatní!
+ Zap.
+ Vyp.
+ Vibrovat při bolusu
+ Zobrazit datum
+ Zobrazit IOB
+ Zobrazit COB
+ Zobrazit deltu
+ Zobrazit průměrnou deltu
+ Zobrazit stav baterie telefonu
+ Zobrazit bazál
+ Zobrazovat stav smyčky
+ Zobrazovat glykemii
+ Zobrazovat trendovou šipku
+ Zobrazit aktualizováno před
+ Tmavý
+ Zvýraznit bazály
+ Odpovídající oddělovač
+ Časové okno grafu
+ 1 hodina
+ 2 hodiny
+ 3 hodiny
+ 4 hodiny
+ 5 hodin
+ Výchozí
+ Nízká
+ Střední
+ Vysoká
+ Animace
+ Kalkulačka v nabídce
+ Plnění v nabídce
+ Jeden cíl
+ Verze:
+ TempT
+ Kalkulačka
+ Bolus
+ eCarbs
+ Nastavení
+ Stav
+ Plnění/doplňování
+ Nic
+ Výchozí
+ Menu
+ trvání
+ cíl
+ nízká
+ vysoká
+ sacharidy
+ začátek [min]
+ trvání [h]
+ inzulín
+ Předvolba 1
+ Předvolba 2
+ Předvolba 3
+ Libovolné množství
+ POTVRDIT
+ STAV PUMPY
+ STAV SMYČKY
+ posun času
+ TDD vážený
+ bolus
+ Pumpa
+ Smyčka
+ TDD
+ Sacharidy
+ IOB
+ žádný stav
+ mg/dl
+ mmol/l
+ g
+ U
+ U/h
+ h
+ d
+ t
+
diff --git a/wear/src/main/res/values-de-rDE/strings.xml b/wear/src/main/res/values-de-rDE/strings.xml
new file mode 100644
index 0000000000..d60f1f517c
--- /dev/null
+++ b/wear/src/main/res/values-de-rDE/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(groß)
+ AAPS(GroßerGraph)
+ AAPS(KeinGraph)
+ AAPS(Kreis)
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
+ Keine Daten!
+ Veraltete Daten!
+ Seit %1$s
+ Synchronisiere mit AAPS!
+ Keine Daten seit %1$s! Prüfe, ob AAPS auf dem Smartphone Daten an die Uhr sendet.
+ AAPS Daten sind %1$s alt! Prüfe Deinen Sensor, xDrip+, NS, AAPS Einstellungen etc!
+ Ein
+ Aus
+ Bei Bolus vibrieren
+ Einheit (mg/dl od. mmol/l)
+ Datum anzeigen
+ IOB anzeigen
+ COB anzeigen
+ Abweichung anzeigen
+ Durchschnittl. Abweichung anzeigen
+ Akkustand Smartphone
+ Akkustand Rig
+ Basalrate anzeigen
+ Loop Status anzeigen
+ BZ anzeigen
+ Trendpfeil anzeigen
+ Min. seit letztem Wert
+ Dunkel
+ Basal hervorheben
+ Querbalken farbgleich
+ Zeitraum Diagramm
+ 1 Std.
+ 2 Std.
+ 3 Std.
+ 4 Std.
+ 5 Std.
+ Design Eingabe
+ Standard
+ Schnell rechts
+ Schnell links
+ Modern Sparse
+ Genauigkeit (Steampunk)
+ Niedrig
+ Mittel
+ Hoch
+ Auto
+ Große Zahlen
+ Ring BZ-Historie
+ Ring BZ-Historie light
+ Animationen
+ Rechner im Menü
+ Befüllung im Menü
+ Einzelzielwert
+ Rechner mit %
+ Tipp Komplikation
+ Unicode in Komplikationen
+ Version:
+ Temp. Ziel
+ Rechner
+ Bolus
+ eCarb
+ Einstellung
+ Status
+ (Vor-)Füllen
+ Kein(e)
+ Standard
+ Menü
+ Dauer
+ Ziel
+ niedrig
+ hoch
+ gKH
+ %-Satz
+ Start [min]
+ Dauer [h]
+ Insulin
+ Voreinstellung 1
+ Voreinstellung 2
+ Voreinstellung 3
+ Freie Menge
+ BESTÄTIGEN
+ PUMPEN-STATUS
+ LOOP-STATUS
+ Zeitverschiebung
+ TDD gewichtet
+ Bolus
+ Pumpe
+ Loop
+ CPP
+ TDD
+ KH
+ IOB
+ Kein Status
+ mg/dl
+ mmol/l
+ g
+ IE
+ IE/h
+ h
+ d
+ w
+
diff --git a/wear/src/main/res/values-el-rGR/strings.xml b/wear/src/main/res/values-el-rGR/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-el-rGR/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-es-rES/strings.xml b/wear/src/main/res/values-es-rES/strings.xml
new file mode 100644
index 0000000000..af200da3fb
--- /dev/null
+++ b/wear/src/main/res/values-es-rES/strings.xml
@@ -0,0 +1,109 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS (Grande)
+ AAPS(BigChart)
+ AAPS (NoChart)
+ AAPS (Círculo)
+ AAPSv2
+ AAPS (Cockpit)
+ AAPS (Steampunk)
+ ¡Sin datos!
+ ¡Viejos datos!
+ Desde %1$s
+ ¡Sincronización con AAPS!
+ No se han recibido datos desde %1$s. Comprobar si AAPS en el teléfono envía los datos al reloj
+ ¡Los datos de AAPS son %1$s antiguos! ¡Compruebe su sensor, xDrip+, NS, configuración AAPS u otro!
+ Activado
+ Desactivado
+ Vibrar con bolos
+ Unidades para Acciones
+ Mostrar fecha
+ Mostrar Insulina activa (IOB)
+ Mostrar COB
+ Mostrar delta
+ Mostrar AvgDelta
+ Mostrar batería del teléfono
+ Mostrar batería de Rig
+ Mostrar Tasa Basal
+ Mostrar estado del lazo
+ Mostrar BG
+ Mostrar flecha de dirección
+ Mostrar histórico
+ Oscuro
+ Resaltar las basales
+ Divisor de coincidencia
+ Gráfico por franja de tiempo
+ 1 hora
+ 2 horas
+ 3 horas
+ 4 horas
+ 5 horas
+ Diseño de entrada
+ Por defecto
+ Rápido a la derecha
+ Rápido a la izquierda
+ Disperso moderno
+ Granularidad delta (Steampunk)
+ Bajo
+ Medio
+ Alto
+ Números grandes
+ Historial de Ring
+ Historial de Ring Light
+ Animaciones
+ Asistente en el menú
+ Cebar en menú
+ Objetivo único
+ Porcentaje del asistente
+ Acción de Toque Complicación
+ Unicode en complicaciones
+ Versión:
+ TempT
+ Asistente
+ Bolo
+ eCarb
+ Configuración
+ Estado
+ Cebar/llenar
+ Ninguno
+ Por defecto
+ Menú
+ duración
+ objetivo
+ bajo
+ alto
+ carbohidratos
+ porcentaje
+ inicio [min]
+ duración [h]
+ insulina
+ Predefinido 1
+ Predefinido 2
+ Predefinido 3
+ Importe gratuito
+ Confirmar
+ ESTADO DE LA BOMBA
+ Estado del loop
+ intervalo de tiempo
+ TDD ponderada
+ bolo
+ Bomba
+ Lazo
+ CPP
+ TDD
+ Carbohidratos
+ IOB
+ sin estado
+ mg/dl
+ mmol/l
+ g
+ U
+ U/h
+ h
+ d
+ s
+
diff --git a/wear/src/main/res/values-fi-rFI/strings.xml b/wear/src/main/res/values-fi-rFI/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-fi-rFI/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-fr-rFR/strings.xml b/wear/src/main/res/values-fr-rFR/strings.xml
new file mode 100644
index 0000000000..8318132564
--- /dev/null
+++ b/wear/src/main/res/values-fr-rFR/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS (Large)
+ AAPS (GrandGraph)
+ AAPS (SansGraph)
+ AAPS (Cercle)
+ AAPSv2
+ AAPS (Cockpit)
+ AAPS (Steampunk)
+ Pas de données !
+ Données anciennes!
+ Depuis %1$s
+ Synchro avec AAPS !
+ Aucune donnée deçues depuis %1$s! Vérifez sur le téléphone si AAPS envoie les données à la montre
+ Données AAPS anciennes de %1$s ! Vérifiez votre capteur, les configurations xDrip+, NS, AAPS ou autre !
+ Oui
+ Non
+ Vibrer sur Bolus
+ Unités pour les Actions
+ Afficher Date
+ Afficher IA
+ Afficher GA
+ Afficher Delta
+ Afficher Delta Moyen
+ Afficher Batterie Téléphone
+ Afficher Batterie Système
+ Afficher Basale
+ Afficher État Boucle
+ Afficher Glycémie
+ Afficher Flèche
+ Afficher Min Passées
+ Sombre
+ Surbrillance Basale
+ Séparateur Noir
+ Echelle Graphique
+ 1 heure
+ 2 heures
+ 3 heures
+ 4 heures
+ 5 heures
+ Design de saisie
+ Défaut
+ Droitier
+ Gaucher
+ Moderne
+ Précision Delta (Steampunk)
+ Faible
+ Moyen
+ Élevé
+ Auto
+ Gros chiffres (Cercle)
+ Historique (Cercle)
+ Historique Léger (Cercle)
+ Animations (Cercle)
+ Assistant dans Menu
+ Amorcer dans Menu
+ Cible Unique
+ Assistant Pourcentage
+ Action Appui Complication
+ Unicode dans Complications
+ Version:
+ Cible Temp.
+ Assistant
+ Bolus
+ eGlucides
+ Paramètres
+ États
+ Amorcer/Remplir
+ Aucun
+ Défaut
+ Menu
+ durée
+ cible
+ bas
+ haut
+ glucides
+ pourcentage
+ début [min]
+ durée [h]
+ insuline
+ Quantité 1
+ Quantité 2
+ Quantité 3
+ Quantité libre
+ CONFIRMER
+ ÉTAT POMPE
+ ÉTAT BOUCLE
+ décalage
+ DTI pondéré
+ bolus
+ Pompe
+ Boucle
+ Profil
+ DTI
+ GA
+ IA
+ aucun statut
+ mg/dl
+ mmol/l
+ g
+ U
+ U/h
+ h
+ j
+ s
+
diff --git a/wear/src/main/res/values-ga-rIE/strings.xml b/wear/src/main/res/values-ga-rIE/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-ga-rIE/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-hr-rHR/strings.xml b/wear/src/main/res/values-hr-rHR/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-hr-rHR/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-it-rIT/strings.xml b/wear/src/main/res/values-it-rIT/strings.xml
new file mode 100644
index 0000000000..5247ee0674
--- /dev/null
+++ b/wear/src/main/res/values-it-rIT/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Large)
+ AAPS(BigChart)
+ AAPS(NoChart)
+ AAPS(Circle)
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
+ No dati!
+ Dati vecchi!
+ Da %1$s
+ Sincro con AAPS!
+ Nessun dato ricevuto da %1$s! Controlla se AAPS sul telefono invia i dati allo smartwatch
+ I dati di AAPS sono vecchi di %1$s ! Controlla il tuo sensore, xDrip+, NS, la configurazione di AAPS o altro!
+ On
+ Off
+ Vibra durante bolo
+ Unità per Azioni
+ Mostra data
+ Mostra IOB
+ Mostra COB
+ Mostra delta
+ Mostra AvgDelta
+ Mostra batteria telefono
+ Mostra Batteria Rig
+ Mostra velocità basale
+ Mostra stato loop
+ Mostra BG
+ Mostra frecce direzionali
+ Mostra Indietro
+ Scuro
+ Evidenzia basali
+ Matching divider
+ Timeframe Grafico
+ 1 ora
+ 2 ore
+ 3 ore
+ 4 ore
+ 5 ore
+ Input Design
+ Default
+ Quick righty
+ Quick lefty
+ Modern Sparse
+ Delta Granularity (Steampunk)
+ Basso
+ Medio
+ Alto
+ Auto
+ Numeri grandi
+ Storico Ring
+ Storico Light Ring
+ Animazioni
+ Wizard in Menu
+ Carica in Menu
+ Target singolo
+ Percentuale Wizard
+ Complication Tap Action
+ Unicode in Complications
+ Versione:
+ TempT
+ Wizard
+ Bolo
+ eCarb
+ Impostazioni
+ Stato
+ Carica/Riempi
+ Nessuno
+ Default
+ Menu
+ durata
+ target
+ basso
+ alto
+ CHO
+ percentuale
+ avvio [min]
+ durata [h]
+ insulina
+ Preset 1
+ Preset 2
+ Preset 3
+ Quantità libera
+ CONFERMA
+ STATO MICRO
+ STATO LOOP
+ timeshift
+ TDD ponderato
+ bolo
+ Micro
+ Loop
+ CPP
+ TDD
+ CHO
+ IOB
+ no stato
+ mg/dl
+ mmol/l
+ g
+ U
+ U/h
+ h
+ d
+ w
+
diff --git a/wear/src/main/res/values-iw-rIL/strings.xml b/wear/src/main/res/values-iw-rIL/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-iw-rIL/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-ja-rJP/strings.xml b/wear/src/main/res/values-ja-rJP/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-ja-rJP/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-ko-rKR/strings.xml b/wear/src/main/res/values-ko-rKR/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-ko-rKR/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-lt-rLT/strings.xml b/wear/src/main/res/values-lt-rLT/strings.xml
new file mode 100644
index 0000000000..8d2fb735dd
--- /dev/null
+++ b/wear/src/main/res/values-lt-rLT/strings.xml
@@ -0,0 +1,107 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Didelis)
+ AAPS(DidelisGrafikas)
+ AAPS(BeGrafiko)
+ AAPS(Apvalus)
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
+ Nėra duomenų!
+ Seni duomenys!
+ Nuo %1$s
+ Sinchronizavimas su AAPS!
+ Nėra duomenų nuo %1$s! Patikrinkite, ar AAPS telefone siunčia duomenis laikrodžiui
+ AAPS duomenys yra %1$s senumo! Patikrinkite sensorių, xDrip+, NS, AAPS konfigūratorių ar kt.!
+ Įjungti
+ Išjungti
+ Vibruoti, kai leidžiamas bolusas
+ Veiksmų vienetai
+ Rodyti datą
+ Rodyti AIO
+ Rodyti AAO
+ Rodyti pokytį
+ Rodyti vidutinį pokytį
+ Rodyti telefono bateriją
+ Rodyti įrenginio bateriją
+ Rodyti valandinę bazę
+ Rodyti Ciklo statusą
+ Rodyti KG
+ Rodyti krypties rodyklę
+ Laikas nuo pask. vertės
+ Tamsus
+ Paryškinti valandines bazes
+ Vienodos spalvos skirtukas
+ Diagramos laikotarpis
+ 1 val.
+ 2 val.
+ 3 val.
+ 4 val.
+ 5 val.
+ Įvesties Dizainas
+ Numatytasis
+ Greitai dešinėn
+ Greitai kairėn
+ Minimalistinis
+ Detalus pokytis (Steampunk)
+ Žemas
+ Vidutinis
+ Aukštas
+ Auto
+ Dideli Skaičiai
+ Glikemijos istorija
+ Glikemijos istorija - šviesi
+ Animacijos
+ Meniu vedlys
+ Užpildyti per meniu
+ Pavienis tikslas
+ Vedlys su %
+ Versija:
+ LaikinasTikslas
+ Vedlys
+ Bolusas
+ iAV
+ Parametrai
+ Būsena
+ Užpildymas
+ Nėra
+ Numatytasis
+ Meniu
+ trukmė
+ tikslas
+ žemas
+ aukštas
+ AV
+ procentais
+ pradėti [min]
+ trukmė [h]
+ insulinas
+ Ruošinys 1
+ Ruošinys 2
+ Ruošinys 3
+ Užpildymo kiekis
+ PATVIRTINTI
+ POMPOS BŪKLĖ
+ CIKLO STATUSAS
+ laiko postūmis
+ BPD įvertinta
+ bolusas
+ Pompa
+ Ciklas
+ CPP (Procentinis dienos profilis)
+ BPD
+ AV
+ AIO
+ nėra statuso
+ mg/dl
+ mmol/l
+ g
+ vv
+ Vv/val
+ val
+ d.
+
diff --git a/wear/src/main/res/values-nl-rNL/strings.xml b/wear/src/main/res/values-nl-rNL/strings.xml
new file mode 100644
index 0000000000..e1e7c4c3d6
--- /dev/null
+++ b/wear/src/main/res/values-nl-rNL/strings.xml
@@ -0,0 +1,18 @@
+
+
+
+ AAPS gegevens zijn %1$s oud! Controleer je sensor, xDrip+, NS, AAPS instellingen of andere!
+ Aan
+ Uit
+ Trillen bij bolus
+ Eenheden voor acties
+ Toon datum
+ Toon Delta
+ Toon gemiddelde delta
+ 1 uur
+ 2 uren
+ 3 uren
+ 4 uren
+ 5 uren
+ Standaard
+
diff --git a/wear/src/main/res/values-pl-rPL/strings.xml b/wear/src/main/res/values-pl-rPL/strings.xml
new file mode 100644
index 0000000000..debe325b46
--- /dev/null
+++ b/wear/src/main/res/values-pl-rPL/strings.xml
@@ -0,0 +1,109 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Duży)
+ AAPS(DużyWykres)
+ AAPS(BezWykresu)
+ AAPS(Koło)
+ AAPSv2
+ AAPS(Kokpit)
+ AAPS(Steampunk)
+ Brak danych!
+ Stare dane!
+ Od %1$s
+ Synchronizuj z AAPS!
+ Nie otrzymano danych od %1$s! Sprawdź czy AAPS na telefonie wysyła dane do zegarka
+ Dane z AAPS są %1$s stare! Sprawdź swój sensor, xDrip+, NS, konfigurację AAPS i inne ustawienia!
+ Włącz
+ Wyłącz
+ Wibruj przy Bolusie
+ Jednostki dla akcji
+ Pokaż Datę
+ Pokaż IOB
+ Pokaż COB
+ Pokaż Deltę
+ Pokaż Śr. Deltę
+ Pokaż Baterię Telefonu
+ Pokaż Baterię Zestawu
+ Pokaż Bazę
+ Pokaż Status Pętli
+ Pokaż glikemię
+ Pokaż strzałkę trendu
+ Pokaż aktualność
+ Tryb ciemny
+ Podświetl Bazę
+ Separator pod kolor
+ Ramy czasowe wykresu
+ 1 godzina
+ 2 godziny
+ 3 godziny
+ 4 godziny
+ 5 godzin
+ Styl wprowadzania
+ Domyślny
+ Szybki prawy
+ Szybki lewy
+ Minimalistyczny
+ Granularność Delty (Steampunk)
+ Niska
+ Średnia
+ Wysoka
+ Duże Cyfry
+ Historia glikemi
+ Dyskretniejsza historia
+ Animacje
+ Kalkulator w Menu
+ Wypełnianie w menu
+ Pojedyńcza wartość Celu
+ Kalkulator z korektą w %
+ Akcja po kliknięciu komplikacji
+ Unicode w Komplikacjach
+ Wersja:
+ CelTymcz.
+ Kalkulator
+ Bolus
+ eWęgle
+ Ustawienia
+ Status
+ Wypełnianie
+ Brak
+ Domyślnie
+ Menu
+ czas trwania
+ cel
+ nisko
+ wysoko
+ węglow.
+ procent
+ start [min]
+ czas trwania [g]
+ insulina
+ Ustawienie 1
+ Ustawienie 2
+ Ustawienie 3
+ Podana wartość
+ POTWIERDŹ
+ STATUS POMPY
+ STATUS PĘTLI
+ przesunięcie czasu
+ Ważone TDD
+ bolus
+ Pompa
+ Pętla
+ CPP
+ TDD
+ Węgl.
+ IOB
+ brak statusu
+ mg/dl
+ mmol/l
+ g
+ U
+ U/g
+ g
+ d
+ t
+
diff --git a/wear/src/main/res/values-pt-rBR/strings.xml b/wear/src/main/res/values-pt-rBR/strings.xml
new file mode 100644
index 0000000000..32261260b4
--- /dev/null
+++ b/wear/src/main/res/values-pt-rBR/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Grande)
+ AAPS(GrafGrande)
+ AAPS(SemGraf)
+ AAPS(Círculo)
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
+ Sem dados!
+ Dados antigos!
+ Desde %1$s
+ Sincronizar com AAPS!
+ Nenhum dado recebido desde %1$s! Confira se o AAPS no telefone envia dados para o relógio
+ Dados AAPS são %1$s antigos! Verifique sensor, xDrip+, NS, configuração AAPS ou outra!
+ Lig.
+ Desl.
+ Vibrar no Bólus
+ Unidades para Acções
+ Mostrar Data
+ Mostrar IOB
+ Mostrar COB
+ Mostrar Delta
+ Mostrar MedDelta
+ Mostrar Bateria Telefone
+ Mostrar Bateria Equipamento
+ Mostrar Taxa Basal
+ Mostrar Estado Loop
+ Mostrar Glic.
+ Mostrar Seta Direcção
+ Mostrar Atrás
+ Escuro
+ Destacar Basais
+ Divisor correspondente
+ Cronograma do Gráfico
+ 1 hora
+ 2 horas
+ 3 horas
+ 4 horas
+ 5 horas
+ Design de Entrada
+ Padrão
+ Rápido Direito
+ Rápido Esquerdo
+ Moderno Esparso
+ Delta Granularidade (Steampunk)
+ Baixo
+ Médio
+ Alto
+ Auto
+ Números Grandes
+ Anel Histórico
+ Anel Suave Histórico
+ Animações
+ Assistente no Menu
+ Purgar no Menu
+ Alvo Único
+ Assistente Percentagem
+ Complicação de Toque
+ Unicode em Complicações
+ Versão:
+ AlvoT
+ Assistente
+ Bólus
+ eCarb
+ Definições
+ Estado
+ Purgar/Preencher
+ Nenhum
+ Padrão
+ Menu
+ duração
+ alvo
+ hipo
+ hiper
+ hidratos
+ percentagem
+ iniciar [min]
+ duração [h]
+ insulina
+ Predefinição 1
+ Predefinição 2
+ Predefinição 3
+ Valor livre
+ CONFIRMAR
+ ESTADO BOMBA
+ ESTADO LOOP
+ alteração turno
+ TDD ponderada
+ bólus
+ Bomba
+ Loop
+ CPP
+ TDD
+ Hidratos
+ IOB
+ sem estado
+ mg/dL
+ mmol/L
+ g
+ U
+ U/h
+ h
+ d
+ s
+
diff --git a/wear/src/main/res/values-pt-rPT/strings.xml b/wear/src/main/res/values-pt-rPT/strings.xml
new file mode 100644
index 0000000000..32261260b4
--- /dev/null
+++ b/wear/src/main/res/values-pt-rPT/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Grande)
+ AAPS(GrafGrande)
+ AAPS(SemGraf)
+ AAPS(Círculo)
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
+ Sem dados!
+ Dados antigos!
+ Desde %1$s
+ Sincronizar com AAPS!
+ Nenhum dado recebido desde %1$s! Confira se o AAPS no telefone envia dados para o relógio
+ Dados AAPS são %1$s antigos! Verifique sensor, xDrip+, NS, configuração AAPS ou outra!
+ Lig.
+ Desl.
+ Vibrar no Bólus
+ Unidades para Acções
+ Mostrar Data
+ Mostrar IOB
+ Mostrar COB
+ Mostrar Delta
+ Mostrar MedDelta
+ Mostrar Bateria Telefone
+ Mostrar Bateria Equipamento
+ Mostrar Taxa Basal
+ Mostrar Estado Loop
+ Mostrar Glic.
+ Mostrar Seta Direcção
+ Mostrar Atrás
+ Escuro
+ Destacar Basais
+ Divisor correspondente
+ Cronograma do Gráfico
+ 1 hora
+ 2 horas
+ 3 horas
+ 4 horas
+ 5 horas
+ Design de Entrada
+ Padrão
+ Rápido Direito
+ Rápido Esquerdo
+ Moderno Esparso
+ Delta Granularidade (Steampunk)
+ Baixo
+ Médio
+ Alto
+ Auto
+ Números Grandes
+ Anel Histórico
+ Anel Suave Histórico
+ Animações
+ Assistente no Menu
+ Purgar no Menu
+ Alvo Único
+ Assistente Percentagem
+ Complicação de Toque
+ Unicode em Complicações
+ Versão:
+ AlvoT
+ Assistente
+ Bólus
+ eCarb
+ Definições
+ Estado
+ Purgar/Preencher
+ Nenhum
+ Padrão
+ Menu
+ duração
+ alvo
+ hipo
+ hiper
+ hidratos
+ percentagem
+ iniciar [min]
+ duração [h]
+ insulina
+ Predefinição 1
+ Predefinição 2
+ Predefinição 3
+ Valor livre
+ CONFIRMAR
+ ESTADO BOMBA
+ ESTADO LOOP
+ alteração turno
+ TDD ponderada
+ bólus
+ Bomba
+ Loop
+ CPP
+ TDD
+ Hidratos
+ IOB
+ sem estado
+ mg/dL
+ mmol/L
+ g
+ U
+ U/h
+ h
+ d
+ s
+
diff --git a/wear/src/main/res/values-ro-rRO/strings.xml b/wear/src/main/res/values-ro-rRO/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-ro-rRO/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-ru-rRU/strings.xml b/wear/src/main/res/values-ru-rRU/strings.xml
new file mode 100644
index 0000000000..0cd5c49d54
--- /dev/null
+++ b/wear/src/main/res/values-ru-rRU/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS (Большой)
+ AAPS (Крупный график)
+ AAPS (Без графика)
+ AAPS (круглый)
+ AAPSv2
+ AAPS (кабина пилота)
+ AAPS (Стимпанк)
+ Данные не поступают!
+ Старые данные!
+ Длится с: %1$s
+ Синхронизация с ААПС!
+ Нет данных начиная с %1$s! Убедитесь, что AAPS на телефоне отправляет данные на часы
+ Старые данные AAPS от %1$s! Проверьте сенсор, xDrip +, NS, конфигурацию AAPS, другое!
+ Вкл.
+ Выкл.
+ Вибрировать при болюсе
+ Единицы для начала действий
+ Показать дату
+ Показать акт инс IOB
+ Показать акт угл COB
+ Показывать дельту
+ Показывать среднюю дельту
+ Показывать заряд батареи телефона
+ Показывать заряд батареи системы
+ Показать базальную скорость
+ Показывать состояние цикла
+ Показывать ГК
+ Показывать стрелку тренда
+ Показывать ретро события
+ Тёмная
+ Выделить базалы
+ Соответствующий делитель
+ Временной диапазон графика
+ 1 час
+ 2 часа
+ 3 часа
+ 4 часа
+ 5 часов
+ Дизайн Ввода
+ По умолчанию
+ Быстрый правосторонний
+ Быстрый левосторонний
+ Современный разреженный
+ Дельта детально (Стимпанк)
+ Низкий
+ Средний
+ Высокий
+ Авто
+ Цифры крупно
+ Показывать историю в кольце
+ Показывать историю в кольце менее подробно
+ Анимация
+ Мастер в меню
+ Первичное заполнение в меню
+ Единичная цель
+ Процент мастера
+ Действия при нажатии кнопки расширений
+ Юникод в репликации
+ Версия:
+ ВремЦ
+ Мастер настройки
+ Болюс
+ eCarbs/производные углеводы
+ Настройки
+ Состояние
+ Прайм/заполнение
+ Не показывать
+ По умолчанию
+ Menu
+ продолжительность
+ целевое значение ГК:
+ низкий
+ высокий
+ углеводы
+ процент
+ начало [min]
+ продолжительность [h]
+ инсулин
+ Предустановка 1
+ Предустановка 2
+ Предустановка 3
+ Произвольное количество
+ ПОДТВЕРДИТЬ
+ СОСТОЯНИЕ ПОМПЫ
+ СОСТОЯНИЕ ЦИКЛА
+ сдвиг по времени
+ Суммарная суточная доза TDD-взвешенная
+ болюс
+ Помпа
+ Замкнутый цикл
+ Суточный профиль в процентах
+ TDD/общая суточная доза
+ Углеводы
+ IOB
+ статус отсутствует
+ мг/дл
+ ммоль/л
+ г
+ Ед
+ Ед/ч
+ ч
+ д
+ н
+
diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml
new file mode 100644
index 0000000000..3ff2d06385
--- /dev/null
+++ b/wear/src/main/res/values-sk-rSK/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS(Veľké)
+ AAPS(VeľkýGraf)
+ AAPS(ŽiadnyGraf)
+ AAPS(Kruh)
+ AAPSv2
+ AAPS (Cockpit)
+ AAPS (Steampunk)
+ Žiadne dáta!
+ Zastaralé dáta!
+ Od %1$s
+ Synchronizácia s AAPS!
+ Žiadne dáta od %1$s! Skontroluj, či AAPS na telefóne posiela dáta na hodinky
+ AAPS dáta sú %1$s staré! Skontroluj tvoj senzor, xDrip+, NS, AAPS nastavenia atď.!
+ Zap
+ Vyp
+ Zavibrovať pri boluse
+ Jednotky (mmol/l alebo mg/dl)
+ Zobraziť dátum
+ Zobraziť IOB
+ Zobraziť COB
+ Zobraziť odchýlku
+ Zobraziť priemernú odchýlku
+ Zobraziť stav batérie telefónu
+ Zobrazovať kruhový graf batérie
+ Zobraziť bazál
+ Zobrazovať stav uzavretého okruhu
+ Zobrazovať glykémiu
+ Zobrazovať trendovú šípku
+ Zobraziť aktualizované pred
+ Tmavý
+ Zvýrazniť bazály
+ Zodpovedajúci oddeľovač
+ Časové okno grafu
+ 1 hodina
+ 2 hodiny
+ 3 hodiny
+ 4 hodiny
+ 5 hodín
+ Vložte dizajn
+ Štandardný
+ Rýchlo vpravo
+ Rýchlo vľavo
+ Modern Sparse
+ Presnosť (Steampunk)
+ Nízka
+ Stredná
+ Vysoká
+ Auto
+ Veľké čísla
+ História glykémií - kruh
+ História glykémií - svetlý kruh
+ Animácie
+ Sprievodca v nastaveniach
+ Plnenie v nastaveniach
+ Jeden cieľ
+ Sprievodca percentuálne
+ Zadaj komplikáciu
+ Unicode v komplikáciach
+ Verzia:
+ TempT
+ Sprievodca
+ Bolus
+ eCarbs
+ Nastavenia
+ Stav
+ Plnenie/Doplňovanie
+ Žiadny
+ Štandardný
+ Ponuka
+ trvanie
+ cieľ
+ nízka
+ vysoká
+ sacharidy
+ Percento
+ začiatok [min]
+ trvanie [h]
+ inzulín
+ Predvoľba 1
+ Predvoľba 2
+ Predvoľba 3
+ Ľubovoľné množstvo
+ POTVRDIŤ
+ STAV PUMPY
+ STAV UZAVRETÉHO OKRUHU
+ časový posun
+ TDD vážený
+ bolus
+ Pumpa
+ Uzavretý okruh
+ PROFIL
+ TDD
+ Sacharidy
+ IOB
+ žiadny stav
+ mg/dL
+ mmol/l
+ g
+ JI
+ JI/h
+ h
+ d
+ t
+
diff --git a/wear/src/main/res/values-sv-rSE/strings.xml b/wear/src/main/res/values-sv-rSE/strings.xml
new file mode 100644
index 0000000000..ff8d4c8c1a
--- /dev/null
+++ b/wear/src/main/res/values-sv-rSE/strings.xml
@@ -0,0 +1,110 @@
+
+
+
+ AAPS
+ AAPS
+ AAPS
+ AAPS (Large)
+ AAPS (BigChart)
+ AAPS (NoChart)
+ AAPS (Circle)
+ AAPS v2
+ AAPS (Cockpit)
+ AAPS (Steampunk)
+ Inga data!
+ Gamla data!
+ Sedan %1$s
+ Synka med AAPS!
+ Inga data har tagits emot sedan %1$s! Kontrollera om AAPS i telefonen skickar data till klockan
+ AAPS-data är %1$s gammal. Kontrollera sensorn, xDrip+, NS, AAPS-inställning eller något annat!
+ På
+ Av
+ Vibrera vid bolus
+ Enheter för åtgärder
+ Visa datum
+ Visa IOB
+ Visa COB
+ Visa skillnad
+ Visa genomsnittlig skillnad
+ Visa telefonens batterinivå
+ Visa riggens batterinivå
+ Visa basaldos
+ Visa APS-status
+ Visa BG
+ Visa riktningspil
+ Visa sedan
+ Mörkt
+ Markera basaler
+ Matchande avdelare
+ Tidsspann för diagram
+ 1 timme
+ 2 timmar
+ 3 timmar
+ 4 timmar
+ 5 timmar
+ Inmatningsdesign
+ Standardinställning
+ Snabb höger
+ Snabb vänster
+ Modern Sparse
+ Precision för skillnad (Steampunk)
+ Låg
+ Mellan
+ Hög
+ Auto
+ Stora siffror
+ Ringhistorik
+ Ljus ringhistorik
+ Animationer
+ Guide i menyn
+ Förfyllning i menyn
+ Enkelt målvärde
+ Procent av guiden
+ Åtgärd för komplikation \"tryck\"
+ Unicode i komplikationer
+ Version:
+ Tempmål
+ Guide
+ Bolus
+ eCarb
+ Inställningar
+ Status
+ Förfyllning
+ Ingen
+ Standardinställning
+ Meny
+ duration
+ målvärde
+ låg
+ hög
+ KH
+ procent
+ start [min]
+ varaktighet [tim]
+ insulin
+ Förinställning 1
+ Förinställning 2
+ Förinställning 3
+ Valfri mängd
+ BEKRÄFTA
+ STATUS PUMP
+ STATUS LOOP
+ tidsförskjutning
+ TDD viktad
+ bolus
+ Pump
+ APS
+ CPP
+ TDD
+ KH
+ IOB
+ Ingen Status
+ mg/dL
+ mmol/L
+ g
+ U
+ U/h
+ t
+ d
+ v
+
diff --git a/wear/src/main/res/values-tr-rTR/strings.xml b/wear/src/main/res/values-tr-rTR/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-tr-rTR/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values-zh-rCN/strings.xml b/wear/src/main/res/values-zh-rCN/strings.xml
new file mode 100644
index 0000000000..70489fbc5e
--- /dev/null
+++ b/wear/src/main/res/values-zh-rCN/strings.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/wear/src/main/res/values/arrays.xml b/wear/src/main/res/values/arrays.xml
index 9985ab6e7d..b3f80eb126 100644
--- a/wear/src/main/res/values/arrays.xml
+++ b/wear/src/main/res/values/arrays.xml
@@ -2,11 +2,11 @@
- - 1 hour
- - 2 hours
- - 3 hours
- - 4 hours
- - 5 hours
+ - @string/pref_1_hour
+ - @string/pref_2_hours
+ - @string/pref_3_hours
+ - @string/pref_4_hours
+ - @string/pref_5_hours
@@ -18,22 +18,24 @@
- - Low
- - Medium
- - High
+ - @string/pref_low
+ - @string/pref_medium
+ - @string/pref_high
+ - @string/pref_auto
- 1
- 2
- 3
+ - 4
- - Default
- - Quick righty
- - Quick lefty
- - Modern Sparse
+ - @string/pref_default
+ - @string/pref_quick_righty
+ - @string/pref_quick_lefty
+ - @string/pref_modern_sparse
@@ -44,13 +46,13 @@
- - Default
- - Menu
- - Wizard
- - Bolus
- - eCarb
- - Status
- - None
+ - @string/menu_default
+ - @string/menu_menu
+ - @string/menu_wizard
+ - @string/menu_bolus
+ - @string/menu_ecarb
+ - @string/menu_status
+ - @string/menu_none
diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml
index 87ca25e0b9..d003d24a18 100644
--- a/wear/src/main/res/values/strings.xml
+++ b/wear/src/main/res/values/strings.xml
@@ -4,13 +4,14 @@
AAPS
AAPS
-
AAPS
AAPS(Large)
AAPS(BigChart)
AAPS(NoChart)
AAPS(Circle)
-
+ AAPSv2
+ AAPS(Cockpit)
+ AAPS(Steampunk)
No data!
Old data!
@@ -20,4 +21,102 @@
No data received since %1$s! Check if AAPS on the phone sends data to watch
AAPS data is %1$s old! Check your sensor, xDrip+, NS, AAPS config or other!
+ On
+ Off
+ Vibrate on Bolus
+ Units for Actions
+ Show Date
+ Show IOB
+ Show COB
+ Show Delta
+ Show AvgDelta
+ Show Phone Battery
+ Show Rig Battery
+ Show Basal Rate
+ Show Loop Status
+ Show BG
+ Show Direction Arrow
+ Show Ago
+ Dark
+ Highlight Basals
+ Matching divider
+ Chart Timeframe
+ 1 hour
+ 2 hours
+ 3 hours
+ 4 hours
+ 5 hours
+ Input Design
+ Default
+ Quick righty
+ Quick lefty
+ Modern Sparse
+ Delta Granularity (Steampunk)
+ Low
+ Medium
+ High
+ Auto
+ Big Numbers
+ Ring History
+ Light Ring History
+ Animations
+ Wizard in Menu
+ Prime in Menu
+ Single Target
+ Wizard Percentage
+ Complication Tap Action
+ Unicode in Complications
+ Version:
+
+ TempT
+ Wizard
+ Bolus
+ eCarb
+ Settings
+ Status
+ Prime/Fill
+ None
+ Default
+ Menu
+
+ duration
+ target
+ low
+ high
+ carbs
+ percentage
+ start [min]
+ duration [h]
+ insulin
+ Preset 1
+ Preset 2
+ Preset 3
+ Free amount
+ CONFIRM
+ STATUS PUMP
+ STATUS LOOP
+ timeshift
+ TDD weighted
+ bolus
+
+
+ Pump
+ Loop
+ CPP
+ TDD
+
+ Carb
+ IOB
+ no status
+
+ mg/dl
+ mmol/l
+ g
+ U
+ U/h
+ h
+ d
+ w
+
+
diff --git a/wear/src/main/res/xml/preferences.xml b/wear/src/main/res/xml/preferences.xml
index d74b6e1301..3c114cb59c 100644
--- a/wear/src/main/res/xml/preferences.xml
+++ b/wear/src/main/res/xml/preferences.xml
@@ -5,14 +5,14 @@
@@ -36,7 +36,7 @@
@@ -45,7 +45,7 @@
android:defaultValue="true"
android:key="showDelta"
android:summary="Show delta. (Circle WF)"
- android:title="Show Delta"
+ android:title="@string/pref_show_delta"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -53,35 +53,35 @@
android:defaultValue="true"
android:key="showAvgDelta"
android:summary="Show the avgDelta."
- android:title="Show AvgDelta"
+ android:title="@string/pref_show_avgdelta"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -89,7 +89,7 @@
android:defaultValue="true"
android:key="showBG"
android:summary="Show BG. (Circle WF)"
- android:title="Show BG"
+ android:title="@string/pref_show_bg"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -97,7 +97,7 @@
android:defaultValue="true"
android:key="show_direction"
android:summary="Show direction arrow"
- android:title="Show Direction Arrow"
+ android:title="@string/pref_show_direction_arrow"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -105,7 +105,7 @@
android:defaultValue="true"
android:key="showAgo"
android:summary="Minutes since last reading. (Circle WF)"
- android:title="Show Ago"
+ android:title="@string/pref_show_ago"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -113,7 +113,7 @@
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
- android:title="Dark"
+ android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -121,7 +121,7 @@
android:defaultValue="false"
android:key="highlight_basals"
android:summary="Better visible basal rate and temp basals"
- android:title="Highlight Basals"
+ android:title="@string/pref_highlight_basals"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -129,7 +129,7 @@
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
- android:title="Matching divider"
+ android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -139,7 +139,7 @@
android:entryValues="@array/chart_timeframe_values"
android:key="chart_timeframe"
android:summary="Chart Timeframe"
- android:title="Chart Timeframe" />
+ android:title="@string/pref_chart_timeframe" />
+ android:title="@string/pref_input_design" />
+ android:title="@string/pref_delta_granularity" />
@@ -169,7 +169,7 @@
android:defaultValue="false"
android:key="showRingHistory"
android:summary="Graphical history. (Circle WF)"
- android:title="Ring History"
+ android:title="@string/pref_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
@@ -177,7 +177,7 @@
android:defaultValue="true"
android:key="softRingHistory"
android:summary="Less eyecandy. (Circle WF)"
- android:title="Light Ring History"
+ android:title="@string/pref_light_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -185,7 +185,7 @@
android:defaultValue="true"
android:key="animation"
android:summary="Animations. (Circle WF)"
- android:title="Animations"
+ android:title="@string/pref_animations"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@@ -193,49 +193,55 @@
android:defaultValue="true"
android:key="showWizard"
android:summary="Wizard from watch possible"
- android:title="Wizard in Menu"
+ android:title="@string/pref_wizard_in_menu"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
+
+
+
+
+ android:title="@string/pref_complication_tap_action" />
+
+
+ android:title="@string/pref_version" />