diff --git a/app/build.gradle b/app/build.gradle index 47a0923870..32c274ea74 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,14 +22,6 @@ jacoco { toolVersion = "0.8.3" } -ext { - powermockVersion = "1.7.3" - dexmakerVersion = "1.2" - retrofit2Version = '2.9.0' - okhttp3Version = '4.9.0' -} - - repositories { jcenter { url "https://jcenter.bintray.com/" } mavenCentral() @@ -230,11 +222,9 @@ android { allprojects { repositories { - jcenter() flatDir { dirs 'libs' } - maven { url 'https://jitpack.io' } } } @@ -250,63 +240,6 @@ dependencies { implementation project(':omnipod') implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.google.android.gms:play-services-wearable:17.0.0' - implementation 'com.google.android.gms:play-services-location:17.1.0' - implementation platform('com.google.firebase:firebase-bom:25.12.0') - implementation "com.google.firebase:firebase-analytics-ktx" - implementation 'com.google.firebase:firebase-auth-ktx' - implementation 'com.google.firebase:firebase-database-ktx' - - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.biometric:biometric:1.0.1' - implementation 'androidx.recyclerview:recyclerview:1.1.0' - implementation 'androidx.gridlayout:gridlayout:1.0.0' - implementation 'androidx.percentlayout:percentlayout:1.0.0' - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment-ktx:${fragmentktx_version}" - implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" - implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" - implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - implementation "com.google.android.material:material:$material_version" - - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - - implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}" - implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}" - implementation("com.github.tony19:logback-android-classic:1.1.1-6") { - exclude group: "com.google.android", module: "android" - } - implementation "org.apache.commons:commons-lang3:$commonslang3_version" - implementation 'org.slf4j:slf4j-api:1.7.30' - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" - implementation 'com.madgag.spongycastle:core:1.58.0.0' - implementation("com.google.android:flexbox:0.3.0") { - exclude group: "com.android.support" - } - implementation("io.socket:socket.io-client:1.0.0") { - // excluding org.json which is provided by Android - exclude group: "org.json", module: "json" - } - implementation "com.google.code.gson:gson:2.8.6" - implementation('com.google.guava:guava:30.0-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.6' - - implementation 'org.mozilla:rhino:1.7.13' - - implementation 'com.github.DavidProdinger:weekdays-selector:1.1.0' - - implementation 'com.github.kenglxn.QRGen:android:2.6.0' - implementation 'com.eatthepath:java-otp:0.2.0' testImplementation "junit:junit:$junit_version" testImplementation 'org.json:json:20200518' @@ -323,31 +256,16 @@ dependencies { testImplementation "org.skyscreamer:jsonassert:1.5.0" testImplementation "org.hamcrest:hamcrest-all:1.3" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - - // new for tidepool - implementation "com.squareup.okhttp3:okhttp:$okhttp3Version" - implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3Version" - implementation "com.squareup.retrofit2:retrofit:$retrofit2Version" - implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit2Version" - implementation "com.squareup.retrofit2:converter-gson:$retrofit2Version" - - // Phone checker - implementation 'com.scottyab:rootbeer-lib:0.0.8' - 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-beta01' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2' /* Dagger2 - We are going to use dagger.android which includes * support for Activity and fragment injection so we need to include * the following dependencies */ - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" + + annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" @@ -356,15 +274,6 @@ dependencies { kapt "com.google.dagger:dagger-compiler:$dagger_version" androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' - - //WorkManager - implementation "androidx.work:work-runtime:$work_version" - implementation "androidx.work:work-runtime-ktx:$work_version" - implementation "androidx.work:work-rxjava2:$work_version" - - implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.0.0' - - implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' } /* diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 96763d8274..e0e2a6b05b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ @@ -71,6 +72,10 @@ + { - protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, Runnable { + protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { val i = Intent(this, PreferencesActivity::class.java) i.putExtra("id", -1) startActivity(i) @@ -304,9 +305,10 @@ class MainActivity : NoSplashAppCompatActivity() { .setIcon(iconsProvider.getIcon()) .setMessage(messageSpanned) .setPositiveButton(resourceHelper.gs(R.string.ok), null) - .create().also { - it.show() - (it.findViewById(android.R.id.message) as TextView).movementMethod = LinkMovementMethod.getInstance() + .setNeutralButton(resourceHelper.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) } + .create().apply { + show() + findViewById(android.R.id.message)?.movementMethod = LinkMovementMethod.getInstance() } return true } @@ -321,7 +323,7 @@ class MainActivity : NoSplashAppCompatActivity() { R.id.nav_plugin_preferences -> { val plugin = (main_pager.adapter as TabPageAdapter).getPluginAt(main_pager.currentItem) - protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, Runnable { + protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { val i = Intent(this, PreferencesActivity::class.java) i.putExtra("id", plugin.preferencesId) startActivity(i) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index 705c377afa..b3f3024de6 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -61,6 +61,7 @@ import javax.inject.Inject class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListener, HasAndroidInjector { private var pluginId = -1 + private var filter = "" @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper @@ -115,11 +116,13 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang override fun setArguments(args: Bundle?) { super.setArguments(args) pluginId = args?.getInt("id") ?: -1 + filter = args?.getString("filter") ?: "" } override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putInt("id", pluginId) + outState.putString("filter", filter) } override fun onDestroy() { @@ -150,6 +153,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang if (bundle.containsKey("id")) { pluginId = bundle.getInt("id") } + if (bundle.containsKey("filter")) { + filter = bundle.getString("filter") ?: "" + } } if (pluginId != -1) { addPreferencesFromResource(pluginId, rootKey) @@ -191,6 +197,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } initSummary(preferenceScreen, pluginId != -1) preprocessPreferences() + if (filter != "") updateFilterVisibility(filter, preferenceScreen) } override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { @@ -288,6 +295,33 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } } + private fun updateFilterVisibility(filter: String, p: Preference): Boolean { + + var visible = false + + if (p is PreferenceGroup) { + for (i in 0 until p.preferenceCount) { + visible = updateFilterVisibility(filter, p.getPreference(i)) || visible + } + if (visible && p is PreferenceCategory) { + p.initialExpandedChildrenCount = Int.MAX_VALUE + } + } else { + if (p.key != null) { + visible = visible || p.key.contains(filter, true) + } + if (p.title != null) { + visible = visible || p.title.contains(filter, true) + } + if (p.summary != null) { + visible = visible || p.summary.contains(filter, true) + } + } + + p.isVisible = visible + return visible + } + private fun updatePrefSummary(pref: Preference?) { if (pref is ListPreference) { pref.setSummary(pref.entry) @@ -391,4 +425,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } return super.onPreferenceTreeClick(preference) } + + public fun setFilter(filter: String) { + this.filter = filter + updateFilterVisibility(filter, preferenceScreen) + } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt index ea90f4b250..42deb79742 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt @@ -2,11 +2,15 @@ package info.nightscout.androidaps.activities import android.content.Context import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceScreen import info.nightscout.androidaps.R import info.nightscout.androidaps.utils.locale.LocaleHelper import info.nightscout.androidaps.utils.resources.ResourceHelper +import kotlinx.android.synthetic.main.activity_preferences.* +import kotlinx.android.synthetic.main.local_insight_status_item.view.* import javax.inject.Inject class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback { @@ -14,18 +18,35 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa @Inject lateinit var resourceHelper: ResourceHelper var preferenceId = 0 + var myPreferenceFragment: MyPreferenceFragment? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_single_fragment) + setContentView(R.layout.activity_preferences) + + pref_filter.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} + override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { + filterPreferences() + } + + override fun afterTextChanged(s: Editable) {} + }) + + pref_filter_clear.setOnClickListener() { + pref_filter.setText(""); + } + title = resourceHelper.gs(R.string.nav_preferences) supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) - val myPreferenceFragment = MyPreferenceFragment() + myPreferenceFragment = MyPreferenceFragment() preferenceId = intent.getIntExtra("id", -1) val args = Bundle() args.putInt("id", preferenceId) - myPreferenceFragment.arguments = args - supportFragmentManager.beginTransaction().replace(R.id.frame_layout, myPreferenceFragment).commit() + args.putString("filter", pref_filter.text.toString()) + myPreferenceFragment?.arguments = args + supportFragmentManager.beginTransaction().replace(R.id.frame_layout, myPreferenceFragment!!).commit() } override fun onPreferenceStartScreen(caller: PreferenceFragmentCompat, pref: PreferenceScreen): Boolean { @@ -44,4 +65,8 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa override fun attachBaseContext(newBase: Context) { super.attachBaseContext(LocaleHelper.wrap(newBase)) } + + private fun filterPreferences() { + myPreferenceFragment?.setFilter(pref_filter.text.toString()) + } } \ 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 ef38b9e44e..679e119b21 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -417,6 +417,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { try { getDaoBgReadings().update(bgReading); openHumansUploader.enqueueBGReading(bgReading); + aapsLogger.debug(LTag.DATABASE, "BG: Updating record from: "+ bgReading.toString()); + scheduleBgHistoryChange(bgReading.date); // trigger cache invalidation } catch (SQLException e) { aapsLogger.error("Unhandled exception", e); } diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt index 10c10b27f5..894f017995 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt @@ -58,7 +58,7 @@ class CalibrationDialog : DialogFragmentWithDate() { val units = profileFunction.getUnits() val unitLabel = if (units == Constants.MMOL) resourceHelper.gs(R.string.mmol) else resourceHelper.gs(R.string.mgdl) val actions: LinkedList = LinkedList() - val bg = overview_calibration_bg.value + val bg = overview_calibration_bg?.value ?: return false actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, bg) + " " + unitLabel) if (bg > 0) { activity?.let { activity -> diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt index 22ed2bb688..f911c1ef66 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt @@ -150,7 +150,7 @@ class CarbsDialog : DialogFragmentWithDate() { } override fun submit(): Boolean { - val carbs = overview_carbs_carbs.value.toInt() + val carbs = overview_carbs_carbs?.value?.toInt() ?: return false val carbsAfterConstraints = constraintChecker.applyCarbsConstraints(Constraint(carbs)).value() val units = profileFunction.getUnits() val activityTTDuration = defaultValueHelper.determineActivityTTDuration() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt index 78b436269a..dce221bf9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt @@ -62,7 +62,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { } override fun submit(): Boolean { - val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin.text) + val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin?.text ?: return false) val durationInMinutes = actions_extendedbolus_duration.value.toInt() val actions: LinkedList = LinkedList() val insulinAfterConstraint = constraintChecker.applyExtendedBolusConstraints(Constraint(insulin)).value() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt index 24b2f798ea..167ee2cd84 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt @@ -85,7 +85,7 @@ class FillDialog : DialogFragmentWithDate() { } override fun submit(): Boolean { - val insulin = SafeParse.stringToDouble(fill_insulinamount.text) + val insulin = SafeParse.stringToDouble(fill_insulinamount?.text ?: return false) val actions: LinkedList = LinkedList() val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(insulin)).value() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt index f1c9c406db..881d5f8de0 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -129,7 +129,7 @@ class InsulinDialog : DialogFragmentWithDate() { override fun submit(): Boolean { val pumpDescription = activePlugin.activePump.pumpDescription - val insulin = SafeParse.stringToDouble(overview_insulin_amount.text) + val insulin = SafeParse.stringToDouble(overview_insulin_amount?.text ?: return false) val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(insulin)).value() val actions: LinkedList = LinkedList() val units = profileFunction.getUnits() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index 5ea091fa28..05f01297ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -91,7 +91,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { ?: return false val actions: LinkedList = LinkedList() - val duration = overview_profileswitch_duration.value.toInt() + val duration = overview_profileswitch_duration?.value?.toInt() ?: return false if (duration > 0) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, duration)) val profile = overview_profileswitch_profile.selectedItem.toString() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index 68be68e060..cf8fad96b6 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -84,7 +84,7 @@ class TempBasalDialog : DialogFragmentWithDate() { override fun submit(): Boolean { var percent = 0 var absolute = 0.0 - val durationInMinutes = actions_tempbasal_duration.value.toInt() + val durationInMinutes = actions_tempbasal_duration?.value?.toInt() ?: return false val profile = profileFunction.getProfile() ?: return false val actions: LinkedList = LinkedList() if (isPercentPump) { diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index e4f5208471..9bdf58287f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -116,7 +116,7 @@ class TempTargetDialog : DialogFragmentWithDate() { override fun submit(): Boolean { val actions: LinkedList = LinkedList() - val reason = overview_temptarget_reason.selectedItem.toString() + val reason = overview_temptarget_reason?.selectedItem?.toString() ?: return false val unitResId = if (profileFunction.getUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol val target = overview_temptarget_temptarget.value val duration = overview_temptarget_duration.value.toInt() diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt index 429862ede9..c54f7b8378 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt @@ -94,7 +94,7 @@ class TreatmentDialog : DialogFragmentWithDate() { override fun submit(): Boolean { val pumpDescription = activePlugin.activePump.pumpDescription - val insulin = SafeParse.stringToDouble(overview_treatment_insulin.text) + val insulin = SafeParse.stringToDouble(overview_treatment_insulin?.text ?: return false) val carbs = SafeParse.stringToInt(overview_treatment_carbs.text) val recordOnlyChecked = overview_treatment_record_only.isChecked val actions: LinkedList = LinkedList() diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt index df22cabde6..e72154ab1c 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt @@ -8,6 +8,7 @@ import android.view.ViewGroup import android.widget.LinearLayout import android.widget.RelativeLayout import android.widget.TextView +import androidx.lifecycle.lifecycleScope import com.jjoe64.graphview.GraphView import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R @@ -37,7 +38,6 @@ import io.reactivex.disposables.CompositeDisposable import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.activity_historybrowse.* import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.util.* @@ -168,7 +168,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { if (it.cause is EventCustomCalculationFinished) { updateGUI("EventAutosensCalculationFinished", bgOnly = false) } - }) { fabricPrivacy::logException } + }, fabricPrivacy::logException ) ) disposable.add(rxBus .toObservable(EventAutosensBgLoaded::class.java) @@ -178,12 +178,12 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { if (it.cause is EventCustomCalculationFinished) { updateGUI("EventAutosensCalculationFinished", bgOnly = true) } - }) { fabricPrivacy::logException } + }, fabricPrivacy::logException ) ) disposable.add(rxBus .toObservable(EventIobCalculationProgress::class.java) .observeOn(AndroidSchedulers.mainThread()) - .subscribe({ overview_iobcalculationprogess?.text = it.progress }) { fabricPrivacy::logException } + .subscribe({ overview_iobcalculationprogess?.text = it.progress }, fabricPrivacy::logException ) ) disposable.add(rxBus .toObservable(EventRefreshOverview::class.java) @@ -193,7 +193,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { prepareGraphs() updateGUI("EventRefreshOverview", bgOnly = false) } - }) { fabricPrivacy::logException } + }, fabricPrivacy::logException ) ) if (start == 0L) { // set start of current day @@ -256,7 +256,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { } private fun runCalculation(from: String) { - GlobalScope.launch(Dispatchers.Default) { + lifecycleScope.launch(Dispatchers.Default) { treatmentsPluginHistory.initializeData(start - T.hours(8).msecs()) val end = start + T.hours(rangeToDisplay.toLong()).msecs() iobCobCalculatorPluginHistory.stopCalculation(from) @@ -273,7 +273,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { val lowLine = defaultValueHelper.determineLowLine() val highLine = defaultValueHelper.determineHighLine() - GlobalScope.launch(Dispatchers.Main) { + lifecycleScope.launch(Dispatchers.Main) { historybrowse_noprofile?.visibility = (profile == null).toVisibility() profile ?: return@launch diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt index 598ddf085f..58d31eb29b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt @@ -46,17 +46,17 @@ class ConfigBuilderPlugin @Inject constructor( } private fun setAlwaysEnabledPluginsEnabled() { - for (plugin in activePlugin.pluginsList) { + for (plugin in activePlugin.getPluginsList()) { if (plugin.pluginDescription.alwaysEnabled) plugin.setPluginEnabled(plugin.getType(), true) } storeSettings("setAlwaysEnabledPluginsEnabled") } override fun storeSettings(from: String) { - activePlugin.pluginsList + activePlugin.getPluginsList() aapsLogger.debug(LTag.CONFIGBUILDER, "Storing settings from: $from") activePlugin.verifySelectionInCategories() - for (p in activePlugin.pluginsList) { + for (p in activePlugin.getPluginsList()) { val type = p.getType() if (p.pluginDescription.alwaysEnabled && p.pluginDescription.alwaysVisible) continue if (p.pluginDescription.alwaysEnabled && p.pluginDescription.neverVisible) continue @@ -82,7 +82,7 @@ class ConfigBuilderPlugin @Inject constructor( private fun loadSettings() { aapsLogger.debug(LTag.CONFIGBUILDER, "Loading stored settings") - for (p in activePlugin.pluginsList) { + for (p in activePlugin.getPluginsList()) { val type = p.getType() loadPref(p, type, true) if (p.getType() == PluginType.PUMP) { @@ -110,7 +110,7 @@ class ConfigBuilderPlugin @Inject constructor( } fun logPluginStatus() { - for (p in activePlugin.pluginsList) { + for (p in activePlugin.getPluginsList()) { aapsLogger.debug(LTag.CONFIGBUILDER, p.name + ":" + (if (p.isEnabled(PluginType.GENERAL)) " GENERAL" else "") + (if (p.isEnabled(PluginType.TREATMENT)) " TREATMENT" else "") + @@ -147,7 +147,7 @@ class ConfigBuilderPlugin @Inject constructor( } } - fun performPluginSwitch(changedPlugin: PluginBase, enabled: Boolean, type: PluginType) { + override fun performPluginSwitch(changedPlugin: PluginBase, enabled: Boolean, type: PluginType) { changedPlugin.setPluginEnabled(type, enabled) changedPlugin.setFragmentVisible(type, enabled) processOnEnabledCategoryChanged(changedPlugin, type) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt index 3958f17d78..05b020fac4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt @@ -15,13 +15,13 @@ class PluginStore @Inject constructor( lateinit var plugins: List<@JvmSuppressWildcards PluginBase> - private var activeBgSource: BgSourceInterface? = null - private var activePump: PumpInterface? = null + private var activeBgSourceStore: BgSourceInterface? = null + private var activePumpStore: PumpInterface? = null private var activeProfile: ProfileInterface? = null - private var activeAPS: APSInterface? = null - private var activeInsulin: InsulinInterface? = null - private var activeSensitivity: SensitivityInterface? = null - private var activeTreatments: TreatmentsInterface? = null + private var activeAPSStore: APSInterface? = null + private var activeInsulinStore: InsulinInterface? = null + private var activeSensitivityStore: SensitivityInterface? = null + private var activeTreatmentsStore: TreatmentsInterface? = null fun loadDefaults() { verifySelectionInCategories() @@ -71,34 +71,34 @@ class PluginStore @Inject constructor( // PluginType.APS if (!config.NSCLIENT && !config.PUMPCONTROL) { pluginsInCategory = getSpecificPluginsList(PluginType.APS) - activeAPS = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? - if (activeAPS == null) { - activeAPS = getDefaultPlugin(PluginType.APS) as APSInterface - (activeAPS as PluginBase).setPluginEnabled(PluginType.APS, true) + activeAPSStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? + if (activeAPSStore == null) { + activeAPSStore = getDefaultPlugin(PluginType.APS) as APSInterface + (activeAPSStore as PluginBase).setPluginEnabled(PluginType.APS, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface") } - setFragmentVisiblities((activeAPS as PluginBase).name, pluginsInCategory, PluginType.APS) + setFragmentVisiblities((activeAPSStore as PluginBase).name, pluginsInCategory, PluginType.APS) } // PluginType.INSULIN pluginsInCategory = getSpecificPluginsList(PluginType.INSULIN) - activeInsulin = getTheOneEnabledInArray(pluginsInCategory, PluginType.INSULIN) as InsulinInterface? - if (activeInsulin == null) { - activeInsulin = getDefaultPlugin(PluginType.INSULIN) as InsulinInterface - (activeInsulin as PluginBase).setPluginEnabled(PluginType.INSULIN, true) + activeInsulinStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.INSULIN) as InsulinInterface? + if (activeInsulinStore == null) { + activeInsulinStore = getDefaultPlugin(PluginType.INSULIN) as InsulinInterface + (activeInsulinStore as PluginBase).setPluginEnabled(PluginType.INSULIN, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting InsulinInterface") } - setFragmentVisiblities((activeInsulin as PluginBase).name, pluginsInCategory, PluginType.INSULIN) + setFragmentVisiblities((activeInsulinStore as PluginBase).name, pluginsInCategory, PluginType.INSULIN) // PluginType.SENSITIVITY pluginsInCategory = getSpecificPluginsList(PluginType.SENSITIVITY) - activeSensitivity = getTheOneEnabledInArray(pluginsInCategory, PluginType.SENSITIVITY) as SensitivityInterface? - if (activeSensitivity == null) { - activeSensitivity = getDefaultPlugin(PluginType.SENSITIVITY) as SensitivityInterface - (activeSensitivity as PluginBase).setPluginEnabled(PluginType.SENSITIVITY, true) + activeSensitivityStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.SENSITIVITY) as SensitivityInterface? + if (activeSensitivityStore == null) { + activeSensitivityStore = getDefaultPlugin(PluginType.SENSITIVITY) as SensitivityInterface + (activeSensitivityStore as PluginBase).setPluginEnabled(PluginType.SENSITIVITY, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting SensitivityInterface") } - setFragmentVisiblities((activeSensitivity as PluginBase).name, pluginsInCategory, PluginType.SENSITIVITY) + setFragmentVisiblities((activeSensitivityStore as PluginBase).name, pluginsInCategory, PluginType.SENSITIVITY) // PluginType.PROFILE pluginsInCategory = getSpecificPluginsList(PluginType.PROFILE) @@ -112,33 +112,33 @@ class PluginStore @Inject constructor( // PluginType.BGSOURCE pluginsInCategory = getSpecificPluginsList(PluginType.BGSOURCE) - activeBgSource = getTheOneEnabledInArray(pluginsInCategory, PluginType.BGSOURCE) as BgSourceInterface? - if (activeBgSource == null) { - activeBgSource = getDefaultPlugin(PluginType.BGSOURCE) as BgSourceInterface - (activeBgSource as PluginBase).setPluginEnabled(PluginType.BGSOURCE, true) + activeBgSourceStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.BGSOURCE) as BgSourceInterface? + if (activeBgSourceStore == null) { + activeBgSourceStore = getDefaultPlugin(PluginType.BGSOURCE) as BgSourceInterface + (activeBgSourceStore as PluginBase).setPluginEnabled(PluginType.BGSOURCE, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting BgInterface") } - setFragmentVisiblities((activeBgSource as PluginBase).name, pluginsInCategory, PluginType.PUMP) + setFragmentVisiblities((activeBgSourceStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) // PluginType.PUMP pluginsInCategory = getSpecificPluginsList(PluginType.PUMP) - activePump = getTheOneEnabledInArray(pluginsInCategory, PluginType.PUMP) as PumpInterface? - if (activePump == null) { - activePump = getDefaultPlugin(PluginType.PUMP) as PumpInterface - (activePump as PluginBase).setPluginEnabled(PluginType.PUMP, true) + activePumpStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.PUMP) as PumpInterface? + if (activePumpStore == null) { + activePumpStore = getDefaultPlugin(PluginType.PUMP) as PumpInterface + (activePumpStore as PluginBase).setPluginEnabled(PluginType.PUMP, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface") } - setFragmentVisiblities((activePump as PluginBase).name, pluginsInCategory, PluginType.PUMP) + setFragmentVisiblities((activePumpStore as PluginBase).name, pluginsInCategory, PluginType.PUMP) // PluginType.TREATMENT pluginsInCategory = getSpecificPluginsList(PluginType.TREATMENT) - activeTreatments = getTheOneEnabledInArray(pluginsInCategory, PluginType.TREATMENT) as TreatmentsInterface? - if (activeTreatments == null) { - activeTreatments = getDefaultPlugin(PluginType.TREATMENT) as TreatmentsInterface - (activeTreatments as PluginBase).setPluginEnabled(PluginType.TREATMENT, true) + activeTreatmentsStore = getTheOneEnabledInArray(pluginsInCategory, PluginType.TREATMENT) as TreatmentsInterface? + if (activeTreatmentsStore == null) { + activeTreatmentsStore = getDefaultPlugin(PluginType.TREATMENT) as TreatmentsInterface + (activeTreatmentsStore as PluginBase).setPluginEnabled(PluginType.TREATMENT, true) aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting PumpInterface") } - setFragmentVisiblities((activeTreatments as PluginBase).name, pluginsInCategory, PluginType.TREATMENT) + setFragmentVisiblities((activeTreatmentsStore as PluginBase).name, pluginsInCategory, PluginType.TREATMENT) } /** @@ -203,27 +203,31 @@ class PluginStore @Inject constructor( // ***** Interface ***** - override fun getActiveBgSource(): BgSourceInterface { - return activeBgSource ?: checkNotNull(activeBgSource) { "No bg source selected" } - } + override val activeBgSource: BgSourceInterface + get() = activeBgSourceStore ?: checkNotNull(activeBgSourceStore) { "No bg source selected" } - override fun getActiveProfileInterface(): ProfileInterface = - activeProfile ?: checkNotNull(activeProfile) { "No profile selected" } + override val activeProfileInterface: ProfileInterface + get() = activeProfile ?: checkNotNull(activeProfile) { "No profile selected" } - override fun getActiveInsulin(): InsulinInterface = - activeInsulin ?: checkNotNull(activeInsulin) { "No insulin selected" } + override val activeInsulin: InsulinInterface + get() = activeInsulinStore ?: checkNotNull(activeInsulinStore) { "No insulin selected" } - override fun getActiveAPS(): APSInterface = - activeAPS ?: checkNotNull(activeAPS) { "No APS selected" } + override val activeAPS: APSInterface + get() = activeAPSStore ?: checkNotNull(activeAPSStore) { "No APS selected" } - override fun getActivePump(): PumpInterface = - activePump ?: checkNotNull(activePump) { "No pump selected" } + override val activePump: PumpInterface + get() = activePumpStore ?: checkNotNull(activePumpStore) { "No pump selected" } - override fun getActiveSensitivity(): SensitivityInterface = - activeSensitivity ?: checkNotNull(activeSensitivity) { "No sensitivity selected" } + override val activeSensitivity: SensitivityInterface + get() = activeSensitivityStore + ?: checkNotNull(activeSensitivityStore) { "No sensitivity selected" } - override fun getActiveTreatments(): TreatmentsInterface = - activeTreatments ?: checkNotNull(activeTreatments) { "No treatments selected" } + override val activeTreatments: TreatmentsInterface + get() = activeTreatmentsStore + ?: checkNotNull(activeTreatmentsStore) { "No treatments selected" } + + override val activeOverview: OverviewInterface + get() = getSpecificPluginsListByInterface(OverviewInterface::class.java).first() as OverviewInterface override fun getPluginsList(): ArrayList = ArrayList(plugins) 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 44929a9dee..e7391bc032 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 @@ -113,7 +113,7 @@ class EditEventDialog : DialogFragmentWithDate() { override fun submit(): Boolean { // check for title - val title = automation_inputEventTitle.text.toString() + val title = automation_inputEventTitle?.text?.toString() ?: return false if (title.isEmpty()) { ToastUtils.showToastInUiThread(context, R.string.automation_missing_task_name) return false diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt index 661dc3a2bb..5394a581d5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt @@ -1,13 +1,13 @@ package info.nightscout.androidaps.plugins.general.maintenance import android.Manifest -import androidx.appcompat.app.AppCompatActivity import android.bluetooth.BluetoothAdapter import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.provider.Settings import androidx.annotation.StringRes +import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity @@ -21,6 +21,7 @@ import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.maintenance.formats.* +import info.nightscout.androidaps.utils.AndroidPermission import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.OKDialog @@ -43,12 +44,6 @@ import javax.inject.Singleton * Created by mike on 03.07.2016. */ -private const val REQUEST_EXTERNAL_STORAGE = 1 -private val PERMISSIONS_STORAGE = arrayOf( - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE -) - @Singleton class ImportExportPrefs @Inject constructor( private var log: AAPSLogger, @@ -57,6 +52,7 @@ class ImportExportPrefs @Inject constructor( private val buildHelper: BuildHelper, private val rxBus: RxBusWrapper, private val passwordCheck: PasswordCheck, + private val androidPermission: AndroidPermission, private val classicPrefsFormat: ClassicPrefsFormat, private val encryptedPrefsFormat: EncryptedPrefsFormat, private val prefFileList: PrefFileListProvider @@ -73,12 +69,15 @@ class ImportExportPrefs @Inject constructor( } fun verifyStoragePermissions(fragment: Fragment, onGranted: Runnable) { - fragment.context?.let { - val permission = ContextCompat.checkSelfPermission(it, + fragment.context?.let { ctx -> + val permission = ContextCompat.checkSelfPermission(ctx, Manifest.permission.WRITE_EXTERNAL_STORAGE) if (permission != PackageManager.PERMISSION_GRANTED) { // We don't have permission so prompt the user - fragment.requestPermissions(PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE) + fragment.activity?.let { + androidPermission.askForPermission(it, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE), AndroidPermission.CASE_STORAGE) + } } else { onGranted.run() } 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 757692e655..39671df25f 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 @@ -15,10 +15,13 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.Config; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.interfaces.ConfigInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.aps.loop.APSResult; +import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.HtmlHelper; import info.nightscout.androidaps.utils.Round; @@ -85,6 +88,8 @@ public class NSDeviceStatus { private final SP sp; private final ResourceHelper resourceHelper; private final NSSettingsStatus nsSettingsStatus; + private final ConfigInterface config; + private final RunningConfiguration runningConfiguration; private JSONObject data = null; @@ -93,12 +98,16 @@ public class NSDeviceStatus { AAPSLogger aapsLogger, SP sp, ResourceHelper resourceHelper, - NSSettingsStatus nsSettingsStatus + NSSettingsStatus nsSettingsStatus, + ConfigInterface config, + RunningConfiguration runningConfiguration ) { this.aapsLogger = aapsLogger; this.sp = sp; this.resourceHelper = resourceHelper; this.nsSettingsStatus = nsSettingsStatus; + this.config = config; + this.runningConfiguration = runningConfiguration; } public void handleNewData(JSONArray devicestatuses) { @@ -114,8 +123,13 @@ public class NSDeviceStatus { // Objectives 0 sp.putBoolean(R.string.key_ObjectivespumpStatusIsAvailableInNS, true); } + if (devicestatusJson.has("configuration") && config.getNSCLIENT()) { + // copy configuration of Insulin and Sensitivity from main AAPS + runningConfiguration.apply(devicestatusJson.getJSONObject("configuration")); + } } - } catch (JSONException ignored) { + } catch (JSONException jsonException) { + jsonException.printStackTrace(); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansAPI.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansAPI.kt index 70dc24f533..91fa60ca25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansAPI.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansAPI.kt @@ -43,8 +43,8 @@ class OpenHumansAPI( .toSingle() .map { response -> response.use { _ -> - val body = response.body - val jsonObject = body?.let { JSONObject(it.string()) } + val responseBody = response.body + val jsonObject = responseBody?.let { JSONObject(it.string()) } if (!response.isSuccessful) throw OHHttpException(response.code, response.message, jsonObject?.getString("error")) if (jsonObject == null) throw OHHttpException(response.code, response.message, "No body") if (!jsonObject.has("expires_in")) throw OHMissingFieldException("expires_in") diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt index 6aade7412d..b1c80f5b25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt @@ -564,7 +564,7 @@ class OpenHumansUploader @Inject constructor( creationDate = uploadDate.time ), content = bytes, - highestQueueId = items.map { it.id }.max() + highestQueueId = items.map { it.id }.maxOrNull() )) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 90c1230619..39df181b7d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -22,6 +22,7 @@ import android.widget.LinearLayout import android.widget.RelativeLayout import android.widget.TextView import androidx.core.text.toSpanned +import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import com.jjoe64.graphview.GraphView import dagger.android.HasAndroidInjector @@ -99,7 +100,6 @@ import kotlinx.android.synthetic.main.overview_info_layout.overview_timeagoshort import kotlinx.android.synthetic.main.overview_loop_pumpstatus_layout.* import kotlinx.android.synthetic.main.overview_statuslights_layout.* import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.util.* @@ -185,7 +185,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList super.onViewCreated(view, savedInstanceState) // pre-process landscape mode - skinProvider.activeSkin().preProcessLandscapeOverviewLayout(dm, overview_iob_llayout, overview_time_llayout) + skinProvider.activeSkin().preProcessLandscapeOverviewLayout(dm, view, resourceHelper.gb(R.bool.isTablet)) overview_pumpstatus?.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder)) @@ -684,7 +684,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // Basal, TBR val activeTemp = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()) - overview_basebasal?.text = activeTemp?.let { if (resourceHelper.shortTextMode()) "T:" + activeTemp.toStringVeryShort() else activeTemp.toStringFull() } + overview_basebasal?.text = activeTemp?.let { "T:" + activeTemp.toStringVeryShort() } ?: resourceHelper.gs(R.string.pump_basebasalrate, profile.basal) overview_basal_llayout?.setOnClickListener { var fullText = "${resourceHelper.gs(R.string.basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}" @@ -705,10 +705,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // Extended bolus val extendedBolus = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis()) - overview_extendedbolus?.text = if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses) { - if (resourceHelper.shortTextMode()) resourceHelper.gs(R.string.pump_basebasalrate, extendedBolus.absoluteRate()) - else extendedBolus.toStringMedium() - } else "" + overview_extendedbolus?.text = + if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses) + resourceHelper.gs(R.string.pump_basebasalrate, extendedBolus.absoluteRate()) + else "" overview_extendedbolus?.setOnClickListener { if (extendedBolus != null) activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.extended_bolus), extendedBolus.toString()) @@ -733,15 +733,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList treatmentsPlugin.updateTotalIOBTempBasals() val bolusIob = treatmentsPlugin.lastCalculationTreatments.round() val basalIob = treatmentsPlugin.lastCalculationTempBasals.round() - overview_iob?.text = when { - resourceHelper.shortTextMode() -> - resourceHelper.gs(R.string.formatinsulinunits, bolusIob.iob + basalIob.basaliob) + overview_iob?.text = resourceHelper.gs(R.string.formatinsulinunits, bolusIob.iob + basalIob.basaliob) - else -> - resourceHelper.gs(R.string.formatinsulinunits, bolusIob.iob + basalIob.basaliob) + " (" + - resourceHelper.gs(R.string.formatinsulinunits, bolusIob.iob) + "/" + - resourceHelper.gs(R.string.formatinsulinunits, basalIob.basaliob) + ")" - } overview_iob_llayout?.setOnClickListener { activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.iob), @@ -805,7 +798,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } ?: "" // ****** GRAPH ******* - GlobalScope.launch(Dispatchers.Main) { + viewLifecycleOwner.lifecycleScope.launch(Dispatchers.Main) { overview_bggraph ?: return@launch val graphData = GraphData(injector, overview_bggraph, iobCobCalculatorPlugin, treatmentsPlugin) val secondaryGraphsData: ArrayList = ArrayList() 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 668e7c7fc2..3691de301d 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 @@ -6,6 +6,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Config import info.nightscout.androidaps.R import info.nightscout.androidaps.events.EventRefreshOverview +import info.nightscout.androidaps.interfaces.OverviewInterface import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType @@ -16,9 +17,12 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.extensions.plusAssign +import info.nightscout.androidaps.utils.extensions.* import info.nightscout.androidaps.utils.resources.ResourceHelper +import info.nightscout.androidaps.utils.sharedPreferences.SP import io.reactivex.disposables.CompositeDisposable import io.reactivex.schedulers.Schedulers +import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -28,6 +32,7 @@ class OverviewPlugin @Inject constructor( private val notificationStore: NotificationStore, private val fabricPrivacy: FabricPrivacy, private val rxBus: RxBusWrapper, + private val sp: SP, aapsLogger: AAPSLogger, resourceHelper: ResourceHelper, private val config: Config @@ -41,7 +46,7 @@ class OverviewPlugin @Inject constructor( .preferencesId(R.xml.pref_overview) .description(R.string.description_overview), aapsLogger, resourceHelper, injector -) { +), OverviewInterface { private var disposable: CompositeDisposable = CompositeDisposable() @@ -82,4 +87,57 @@ class OverviewPlugin @Inject constructor( } } } + + override fun configuration(): JSONObject = + JSONObject() + .putString(R.string.key_quickwizard, sp, resourceHelper) + .putInt(R.string.key_eatingsoon_duration, sp, resourceHelper) + .putDouble(R.string.key_eatingsoon_target, sp, resourceHelper) + .putInt(R.string.key_activity_duration, sp, resourceHelper) + .putDouble(R.string.key_activity_target, sp, resourceHelper) + .putInt(R.string.key_hypo_duration, sp, resourceHelper) + .putDouble(R.string.key_hypo_target, sp, resourceHelper) + .putDouble(R.string.key_low_mark, sp, resourceHelper) + .putDouble(R.string.key_high_mark, sp, resourceHelper) + .putDouble(R.string.key_statuslights_cage_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_cage_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_iage_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_iage_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_sage_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_sage_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_sbat_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_sbat_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_bage_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_bage_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_res_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_res_critical, sp, resourceHelper) + .putDouble(R.string.key_statuslights_bat_warning, sp, resourceHelper) + .putDouble(R.string.key_statuslights_bat_critical, sp, resourceHelper) + + override fun applyConfiguration(configuration: JSONObject) { + configuration + .storeString(R.string.key_quickwizard, sp, resourceHelper) + .storeInt(R.string.key_eatingsoon_duration, sp, resourceHelper) + .storeDouble(R.string.key_eatingsoon_target, sp, resourceHelper) + .storeInt(R.string.key_activity_duration, sp, resourceHelper) + .storeDouble(R.string.key_activity_target, sp, resourceHelper) + .storeInt(R.string.key_hypo_duration, sp, resourceHelper) + .storeDouble(R.string.key_hypo_target, sp, resourceHelper) + .storeDouble(R.string.key_low_mark, sp, resourceHelper) + .storeDouble(R.string.key_high_mark, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_cage_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_cage_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_iage_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_iage_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_sage_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_sage_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_sbat_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_sbat_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_bage_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_bage_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_res_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_res_critical, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_bat_warning, sp, resourceHelper) + .storeDouble(R.string.key_statuslights_bat_critical, sp, resourceHelper) + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt index f467cc1fce..35fd71c6e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt @@ -22,7 +22,7 @@ import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification -import info.nightscout.androidaps.services.AlarmSoundService +import info.nightscout.androidaps.services.AlarmSoundServiceHelper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.IconsProvider import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -39,6 +39,7 @@ class NotificationStore @Inject constructor( private val resourceHelper: ResourceHelper, private val context: Context, private val iconsProvider: IconsProvider, + private val alarmSoundServiceHelper: AlarmSoundServiceHelper, private val dateUtil: DateUtil ) { @@ -46,10 +47,12 @@ class NotificationStore @Inject constructor( private var usesChannels = false companion object { + private const val CHANNEL_ID = "AndroidAPS-Overview" } inner class NotificationComparator : Comparator { + override fun compare(o1: Notification, o2: Notification): Int { return o1.level - o2.level } @@ -68,17 +71,9 @@ class NotificationStore @Inject constructor( store.add(n) if (sp.getBoolean(R.string.key_raise_notifications_as_android_notifications, false) && n !is NotificationWithAction) { raiseSystemNotification(n) - if (usesChannels && n.soundId != null && n.soundId != 0) { - val alarm = Intent(context, AlarmSoundService::class.java) - alarm.putExtra("soundid", n.soundId) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(alarm) else context.startService(alarm) - } + if (usesChannels && n.soundId != null && n.soundId != 0) alarmSoundServiceHelper.startAlarm(context, n.soundId) } else { - if (n.soundId != null && n.soundId != 0) { - val alarm = Intent(context, AlarmSoundService::class.java) - alarm.putExtra("soundid", n.soundId) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(alarm) else context.startService(alarm) - } + if (n.soundId != null && n.soundId != 0) alarmSoundServiceHelper.startAlarm(context, n.soundId) } Collections.sort(store, NotificationComparator()) return true @@ -87,10 +82,7 @@ class NotificationStore @Inject constructor( @Synchronized fun remove(id: Int): Boolean { for (i in store.indices) { if (store[i].id == id) { - if (store[i].soundId != null) { - val alarm = Intent(context, AlarmSoundService::class.java) - context.stopService(alarm) - } + if (store[i].soundId != null) alarmSoundServiceHelper.stopService(context) store.removeAt(i) return true } @@ -195,10 +187,10 @@ class NotificationStore @Inject constructor( @Suppress("SetTextI18n") holder.text.text = dateUtil.timeString(notification.date) + " " + notification.text when (notification.level) { - Notification.URGENT -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationUrgent)) - Notification.NORMAL -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationNormal)) - Notification.LOW -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationLow)) - Notification.INFO -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationInfo)) + Notification.URGENT -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationUrgent)) + Notification.NORMAL -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationNormal)) + Notification.LOW -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationLow)) + Notification.INFO -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationInfo)) Notification.ANNOUNCEMENT -> holder.cv.setBackgroundColor(resourceHelper.gc(R.color.notificationAnnouncement)) } } @@ -208,6 +200,7 @@ class NotificationStore @Inject constructor( } inner class NotificationsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var cv: CardView = itemView.findViewById(R.id.notification_cardview) var text: TextView = itemView.findViewById(R.id.notification_text) var dismiss: Button = itemView.findViewById(R.id.notification_dismiss) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt index 5fcf9ee85b..ecca16c581 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt @@ -44,7 +44,7 @@ class DummyService : DaggerService() { .subscribe({ aapsLogger.debug(LTag.CORE, "EventAppExit received") stopSelf() - }) { fabricPrivacy::logException } + }, fabricPrivacy::logException ) ) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt index c2e61f19b9..47bb29e1cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.kt @@ -22,9 +22,9 @@ class InsulinFragment : DaggerFragment() { override fun onResume() { super.onResume() - insulin_name?.setText(activePlugin.getActiveInsulin().getFriendlyName()) - insulin_comment?.setText(activePlugin.getActiveInsulin().getComment()) - insulin_dia?.text = resourceHelper.gs(R.string.dia) + ": " + activePlugin.getActiveInsulin().getDia() + "h" - insulin_graph?.show(activePlugin.getActiveInsulin()) + insulin_name?.setText(activePlugin.activeInsulin.friendlyName) + insulin_comment?.setText(activePlugin.activeInsulin.comment) + insulin_dia?.text = resourceHelper.gs(R.string.dia) + ": " + activePlugin.activeInsulin.dia + "h" + insulin_graph?.show(activePlugin.activeInsulin) } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt index b5fa0fea3d..c9f2a6d96e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt @@ -3,10 +3,11 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -18,10 +19,11 @@ class InsulinLyumjevPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { + override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_LYUMJEV + override val friendlyName get(): String = resourceHelper.gs(R.string.lyumjev) - override fun getId(): Int = InsulinInterface.OREF_LYUMJEV - - override fun getFriendlyName(): String = resourceHelper.gs(R.string.lyumjev) + override fun configuration(): JSONObject = JSONObject() + override fun applyConfiguration(configuration: JSONObject) {} override fun commentStandardText(): String = resourceHelper.gs(R.string.lyumjev) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt index 935fad3ccb..1e90792d25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt @@ -3,16 +3,16 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.data.Iob +import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.InsulinInterface import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.utils.resources.ResourceHelper /** @@ -35,15 +35,16 @@ abstract class InsulinOrefBasePlugin( ), InsulinInterface { private var lastWarned: Long = 0 - override fun getDia(): Double { - val dia = userDefinedDia - return if (dia >= MIN_DIA) { - dia - } else { - sendShortDiaNotification(dia) - MIN_DIA + override val dia + get(): Double { + val dia = userDefinedDia + return if (dia >= MIN_DIA) { + dia + } else { + sendShortDiaNotification(dia) + MIN_DIA + } } - } open fun sendShortDiaNotification(dia: Double) { if (System.currentTimeMillis() - lastWarned > 60 * 1000) { @@ -62,17 +63,13 @@ abstract class InsulinOrefBasePlugin( return profile?.dia ?: MIN_DIA } - fun iobCalcForTreatment(treatment: Treatment, time: Long): Iob { - return this.iobCalcForTreatment(treatment, time, 0.0) - } - override fun iobCalcForTreatment(treatment: Treatment, time: Long, dia: Double): Iob { val result = Iob() val peak = peak if (treatment.insulin != 0.0) { val bolusTime = treatment.date val t = (time - bolusTime) / 1000.0 / 60.0 - val td = getDia() * 60 //getDIA() always >= MIN_DIA + val td = dia * 60 //getDIA() always >= MIN_DIA val tp = peak.toDouble() // force the IOB to 0 if over DIA hours have passed if (t < td) { @@ -86,19 +83,21 @@ abstract class InsulinOrefBasePlugin( return result } - override fun getComment(): String { - var comment = commentStandardText() - val userDia = userDefinedDia - if (userDia < MIN_DIA) { - comment += "\n" + resourceHelper.gs(R.string.dia_too_short, userDia, MIN_DIA) + override val comment + get(): String { + var comment = commentStandardText() + val userDia = userDefinedDia + if (userDia < MIN_DIA) { + comment += "\n" + resourceHelper.gs(R.string.dia_too_short, userDia, MIN_DIA) + } + return comment } - return comment - } abstract val peak: Int abstract fun commentStandardText(): String companion object { + const val MIN_DIA = 5.0 } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt index f1804cbd43..b5df82a4e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt @@ -3,11 +3,14 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.utils.extensions.storeInt +import info.nightscout.androidaps.utils.extensions.putInt import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP +import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -23,12 +26,13 @@ class InsulinOrefFreePeakPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { - override fun getId(): Int { - return InsulinInterface.OREF_FREE_PEAK - } + override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_FREE_PEAK - override fun getFriendlyName(): String { - return resourceHelper.gs(R.string.free_peak_oref) + override val friendlyName get(): String = resourceHelper.gs(R.string.free_peak_oref) + + override fun configuration(): JSONObject = JSONObject().putInt(R.string.key_insulin_oref_peak, sp, resourceHelper) + override fun applyConfiguration(configuration: JSONObject) { + configuration.storeInt(R.string.key_insulin_oref_peak, sp, resourceHelper) } override fun commentStandardText(): String { @@ -39,6 +43,7 @@ class InsulinOrefFreePeakPlugin @Inject constructor( get() = sp.getInt(R.string.key_insulin_oref_peak, DEFAULT_PEAK) companion object { + private const val DEFAULT_PEAK = 75 } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt index a0241ff9c9..bcf526253c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt @@ -3,10 +3,11 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -21,18 +22,13 @@ class InsulinOrefRapidActingPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { + override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_RAPID_ACTING + override val friendlyName get(): String = resourceHelper.gs(R.string.rapid_acting_oref) - override fun getId(): Int { - return InsulinInterface.OREF_RAPID_ACTING - } + override fun configuration(): JSONObject = JSONObject() + override fun applyConfiguration(configuration: JSONObject) {} - override fun getFriendlyName(): String { - return resourceHelper.gs(R.string.rapid_acting_oref) - } - - override fun commentStandardText(): String { - return resourceHelper.gs(R.string.fastactinginsulincomment) - } + override fun commentStandardText(): String = resourceHelper.gs(R.string.fastactinginsulincomment) override val peak = 75 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt index a793c47e89..257ae10ffe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt @@ -3,10 +3,11 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -21,10 +22,11 @@ class InsulinOrefUltraRapidActingPlugin @Inject constructor( rxBus: RxBusWrapper, aapsLogger: AAPSLogger ) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { + override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.OREF_ULTRA_RAPID_ACTING + override val friendlyName get(): String = resourceHelper.gs(R.string.ultrarapid_oref) - override fun getId(): Int = InsulinInterface.OREF_ULTRA_RAPID_ACTING - - override fun getFriendlyName(): String = resourceHelper.gs(R.string.ultrarapid_oref) + override fun configuration(): JSONObject = JSONObject() + override fun applyConfiguration(configuration: JSONObject) {} override fun commentStandardText(): String = resourceHelper.gs(R.string.ultrafastactinginsulincomment) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt index e954b886a8..1d6ab21c4e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt @@ -404,7 +404,7 @@ class VirtualPumpPlugin @Inject constructor( } fun refreshConfiguration() { - val pumptype = sp.getString(R.string.key_virtualpump_type, "Generic AAPS") + val pumptype = sp.getString(R.string.key_virtualpump_type, PumpType.GenericAAPS.description) val pumpTypeNew = PumpType.getByDescription(pumptype) aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumptype, PumpType object: $pumpTypeNew") if (pumpType == pumpTypeNew) return diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java index 7e1ff541dd..35d6ec337e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java @@ -3,6 +3,10 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.annotation.NonNull; import androidx.collection.LongSparseArray; +import org.jetbrains.annotations.NotNull; +import org.json.JSONException; +import org.json.JSONObject; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -11,6 +15,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; @@ -22,6 +27,7 @@ import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.interfaces.ProfileFunction; +import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; @@ -179,4 +185,36 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin { return output; } + + @NotNull @Override public SensitivityType getId() { + return SensitivityType.SENSITIVITY_AAPS; + } + + @NotNull @Override public JSONObject configuration() { + JSONObject c = new JSONObject(); + try { + c.put(getResourceHelper().gs(R.string.key_absorption_maxtime), getSp().getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_period), getSp().getInt(R.string.key_openapsama_autosens_period, 24)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_max), getSp().getDouble(R.string.key_openapsama_autosens_max, 1.2)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_min), getSp().getDouble(R.string.key_openapsama_autosens_min, 0.7)); + } catch (JSONException e) { + e.printStackTrace(); + } + return c; + } + + @Override public void applyConfiguration(@NotNull JSONObject configuration) { + try { + if (configuration.has(getResourceHelper().gs(R.string.key_absorption_maxtime))) + getSp().putDouble(R.string.key_absorption_maxtime, configuration.getDouble(getResourceHelper().gs(R.string.key_absorption_maxtime))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_period))) + getSp().putDouble(R.string.key_openapsama_autosens_period, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_period))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_max))) + getSp().getDouble(R.string.key_openapsama_autosens_max, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_max))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_min))) + getSp().getDouble(R.string.key_openapsama_autosens_min, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_min))); + } catch (JSONException e) { + e.printStackTrace(); + } + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java index 1283ef268a..f4da392efa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java @@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.collection.LongSparseArray; import org.jetbrains.annotations.NotNull; +import org.json.JSONException; +import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; @@ -12,6 +14,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; @@ -23,6 +26,7 @@ import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; +import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData; @@ -246,4 +250,36 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { return output; } + + @NotNull @Override public JSONObject configuration() { + JSONObject c = new JSONObject(); + try { + c.put(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact), getSp().getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)); + c.put(getResourceHelper().gs(R.string.key_absorption_cutoff), getSp().getDouble(R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_max), getSp().getDouble(R.string.key_openapsama_autosens_max, 1.2)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_min), getSp().getDouble(R.string.key_openapsama_autosens_min, 0.7)); + } catch (JSONException e) { + e.printStackTrace(); + } + return c; + } + + @Override public void applyConfiguration(@NotNull JSONObject configuration) { + try { + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact))) + getSp().putDouble(R.string.key_openapsama_min_5m_carbimpact, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact))); + if (configuration.has(getResourceHelper().gs(R.string.key_absorption_cutoff))) + getSp().putDouble(R.string.key_absorption_cutoff, configuration.getDouble(getResourceHelper().gs(R.string.key_absorption_cutoff))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_max))) + getSp().getDouble(R.string.key_openapsama_autosens_max, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_max))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_min))) + getSp().getDouble(R.string.key_openapsama_autosens_min, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_min))); + } catch (JSONException e) { + e.printStackTrace(); + } + } + + @NotNull @Override public SensitivityType getId() { + return SensitivityType.SENSITIVITY_OREF1; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java index d38489ea3b..906a29266b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java @@ -2,12 +2,17 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.collection.LongSparseArray; +import org.jetbrains.annotations.NotNull; +import org.json.JSONException; +import org.json.JSONObject; + import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; @@ -199,4 +204,36 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin return output; } + + @NotNull @Override public SensitivityType getId() { + return SensitivityType.SENSITIVITY_WEIGHTED; + } + + @NotNull @Override public JSONObject configuration() { + JSONObject c = new JSONObject(); + try { + c.put(getResourceHelper().gs(R.string.key_absorption_maxtime), getSp().getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_period), getSp().getInt(R.string.key_openapsama_autosens_period, 24)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_max), getSp().getDouble(R.string.key_openapsama_autosens_max, 1.2)); + c.put(getResourceHelper().gs(R.string.key_openapsama_autosens_min), getSp().getDouble(R.string.key_openapsama_autosens_min, 0.7)); + } catch (JSONException e) { + e.printStackTrace(); + } + return c; + } + + @Override public void applyConfiguration(@NotNull JSONObject configuration) { + try { + if (configuration.has(getResourceHelper().gs(R.string.key_absorption_maxtime))) + getSp().putDouble(R.string.key_absorption_maxtime, configuration.getDouble(getResourceHelper().gs(R.string.key_absorption_maxtime))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_period))) + getSp().putDouble(R.string.key_openapsama_autosens_period, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_period))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_max))) + getSp().getDouble(R.string.key_openapsama_autosens_max, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_max))); + if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_autosens_min))) + getSp().getDouble(R.string.key_openapsama_autosens_min, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_autosens_min))); + } catch (JSONException e) { + e.printStackTrace(); + } + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt index 5727383033..c44a5121b1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt @@ -7,22 +7,27 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerFragment import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.R import info.nightscout.androidaps.db.BgReading +import info.nightscout.androidaps.events.EventNewBG import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.nsclient.NSUpload -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished +import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryBgData import info.nightscout.androidaps.plugins.source.BGSourceFragment.RecyclerViewAdapter.BgReadingsViewHolder import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.ListDiffCallback +import info.nightscout.androidaps.utils.ListUpdateCallbackHelper import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.alertDialogs.OKDialog +import info.nightscout.androidaps.utils.extensions.toVisibility import info.nightscout.androidaps.utils.resources.ResourceHelper import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable @@ -30,6 +35,7 @@ import kotlinx.android.synthetic.main.bgsource_fragment.* import javax.inject.Inject class BGSourceFragment : DaggerFragment() { + @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var resourceHelper: ResourceHelper @@ -51,14 +57,24 @@ class BGSourceFragment : DaggerFragment() { bgsource_recyclerview.setHasFixedSize(true) bgsource_recyclerview.layoutManager = LinearLayoutManager(view.context) val now = System.currentTimeMillis() - bgsource_recyclerview.adapter = RecyclerViewAdapter(MainApp.getDbHelper().getAllBgreadingsDataFromTime(now - MILLS_TO_THE_PAST, false)) + bgsource_recyclerview.adapter = RecyclerViewAdapter(getBgData(now)) + } + + override fun onDestroyView() { + super.onDestroyView() + bgsource_recyclerview?.adapter = null // avoid leaks } @Synchronized override fun onResume() { super.onResume() disposable.add(rxBus - .toObservable(EventAutosensCalculationFinished::class.java) + .toObservable(EventNewBG::class.java) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe({ updateGUI() }) { fabricPrivacy.logException(it) } + ) + disposable.add(rxBus + .toObservable(EventNewHistoryBgData::class.java) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ updateGUI() }) { fabricPrivacy.logException(it) } ) @@ -73,30 +89,62 @@ class BGSourceFragment : DaggerFragment() { private fun updateGUI() { val now = System.currentTimeMillis() - bgsource_recyclerview?.swapAdapter(RecyclerViewAdapter(MainApp.getDbHelper().getAllBgreadingsDataFromTime(now - MILLS_TO_THE_PAST, false)), true) + (bgsource_recyclerview?.adapter as? RecyclerViewAdapter)?.setData(getBgData(now)) } - inner class RecyclerViewAdapter internal constructor(private var bgReadings: List) : RecyclerView.Adapter() { + private fun getBgData(now: Long) = MainApp.getDbHelper() + .getAllBgreadingsDataFromTime(now - MILLS_TO_THE_PAST, false) + + inner class RecyclerViewAdapter internal constructor(bgReadings: List) : RecyclerView.Adapter() { + + private var callbackHelper = ListUpdateCallbackHelper(this) { bgsource_recyclerview?.smoothScrollToPosition(0) } + + private val currentData: MutableList = mutableListOf().also { it.addAll(bgReadings) } + + fun setData(newList: List) { + val diffResult = DiffUtil.calculateDiff(getListDiffCallback(ArrayList(newList), ArrayList(currentData))) + currentData.clear() + currentData.addAll(newList) + diffResult.dispatchUpdatesTo(callbackHelper) + } + + private fun getListDiffCallback(newItems: List, oldItems: List): ListDiffCallback = + object : ListDiffCallback(newItems, oldItems) { + override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { + val new = newItems[newItemPosition] + val old = oldItems[oldItemPosition] + return new.hasValidNS == old.hasValidNS && + new.isValid == old.isValid && + new.date == old.date && + new.value == old.value + } + + override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = + newItems[newItemPosition].date == oldItems[oldItemPosition].date + } + override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): BgReadingsViewHolder { val v = LayoutInflater.from(viewGroup.context).inflate(R.layout.bgsource_item, viewGroup, false) return BgReadingsViewHolder(v) } override fun onBindViewHolder(holder: BgReadingsViewHolder, position: Int) { - val bgReading = bgReadings[position] - holder.ns.visibility = if (NSUpload.isIdValid(bgReading._id)) View.VISIBLE else View.GONE - holder.invalid.visibility = if (!bgReading.isValid) View.VISIBLE else View.GONE + val bgReading = currentData[position] + holder.ns.visibility = (NSUpload.isIdValid(bgReading._id)).toVisibility() + holder.invalid.visibility = bgReading.isValid.not().toVisibility() holder.date.text = dateUtil.dateAndTimeString(bgReading.date) holder.value.text = bgReading.valueToUnitsToString(profileFunction.getUnits()) holder.direction.setImageResource(bgReading.directionToIcon(databaseHelper)) holder.remove.tag = bgReading + holder.remove.visibility = bgReading.isValid.toVisibility() } override fun getItemCount(): Int { - return bgReadings.size + return currentData.size } inner class BgReadingsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var date: TextView = itemView.findViewById(R.id.bgsource_date) var value: TextView = itemView.findViewById(R.id.bgsource_value) var direction: ImageView = itemView.findViewById(R.id.bgsource_direction) @@ -112,7 +160,6 @@ class BGSourceFragment : DaggerFragment() { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable { bgReading.isValid = false MainApp.getDbHelper().update(bgReading) - updateGUI() }) } } @@ -120,4 +167,7 @@ class BGSourceFragment : DaggerFragment() { } } } -} \ No newline at end of file +} + +val BgReading.hasValidNS + get() = NSUpload.isIdValid(this._id) \ No newline at end of file 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 f7bbe547c7..a116369ce5 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 @@ -145,8 +145,12 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable { profileSwitch.profileObject?.let { val nonCustomized = it.convertToNonCustomizedProfile() - localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_"))) - rxBus.send(EventLocalProfileChanged()) + if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) { + localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_"))) + rxBus.send(EventLocalProfileChanged()) + } else { + OKDialog.show(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile_invalid)) + } } }) } 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 26814a7644..3ada48f073 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/services/DataService.java @@ -69,7 +69,7 @@ public class DataService extends DaggerIntentService { aapsLogger.debug(LTag.DATASERVICE, "onHandleIntent " + BundleLogger.log(intent.getExtras())); - boolean acceptNSData = !sp.getBoolean(R.string.key_ns_upload_only, false); + boolean acceptNSData = !sp.getBoolean(R.string.key_ns_upload_only, true); final String action = intent.getAction(); if (Intents.ACTION_NEW_BG_ESTIMATE.equals(action)) { diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt index 95a95748c6..d2c595b246 100644 --- a/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt @@ -1,35 +1,81 @@ package info.nightscout.androidaps.skins import android.util.DisplayMetrics +import android.util.TypedValue.COMPLEX_UNIT_PX +import android.view.View import android.widget.LinearLayout +import android.widget.TextView import androidx.annotation.LayoutRes import androidx.annotation.StringRes import androidx.constraintlayout.widget.ConstraintLayout import info.nightscout.androidaps.R +import kotlinx.android.synthetic.main.overview_fragment_nsclient.view.* +import kotlinx.android.synthetic.main.overview_info_layout.view.* +import kotlinx.android.synthetic.main.overview_statuslights_layout.view.* interface SkinInterface { - @get:StringRes val description : Int - val mainGraphHeight : Int // in dp - val secondaryGraphHeight : Int // in dp - @LayoutRes fun overviewLayout(isLandscape : Boolean, isTablet : Boolean, isSmallHeight : Boolean): Int - @LayoutRes fun actionsLayout(isLandscape : Boolean, isSmallWidth : Boolean): Int = R.layout.actions_fragment + @get:StringRes val description: Int - fun preProcessLandscapeOverviewLayout(dm: DisplayMetrics, iobLayout: LinearLayout, timeLayout: LinearLayout) { + val mainGraphHeight: Int // in dp + val secondaryGraphHeight: Int // in dp + + @LayoutRes + fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int + + @LayoutRes + fun actionsLayout(isLandscape: Boolean, isSmallWidth: Boolean): Int = R.layout.actions_fragment + + fun preProcessLandscapeOverviewLayout(dm: DisplayMetrics, view: View, isTablet: Boolean) { // pre-process landscape mode val screenWidth = dm.widthPixels val screenHeight = dm.heightPixels val landscape = screenHeight < screenWidth if (landscape) { - val iobLayoutParams = iobLayout.layoutParams as ConstraintLayout.LayoutParams + val iobLayoutParams = view.overview_iob_llayout.layoutParams as ConstraintLayout.LayoutParams iobLayoutParams.startToStart = ConstraintLayout.LayoutParams.UNSET - iobLayoutParams.startToEnd = timeLayout.id + iobLayoutParams.startToEnd = view.overview_time_llayout.id iobLayoutParams.topToBottom = ConstraintLayout.LayoutParams.UNSET iobLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID - val timeLayoutParams = timeLayout.layoutParams as ConstraintLayout.LayoutParams + val timeLayoutParams = view.overview_time_llayout.layoutParams as ConstraintLayout.LayoutParams timeLayoutParams.endToEnd = ConstraintLayout.LayoutParams.UNSET - timeLayoutParams.endToStart = iobLayout.id + timeLayoutParams.endToStart = view.overview_iob_llayout.id + val cobLayoutParams = view.overview_cob_llayout.layoutParams as ConstraintLayout.LayoutParams + cobLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID + val basalLayoutParams = view.overview_basal_llayout.layoutParams as ConstraintLayout.LayoutParams + basalLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID + val extendedLayoutParams = view.overview_extended_llayout.layoutParams as ConstraintLayout.LayoutParams + extendedLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID + val asLayoutParams = view.overview_as_llayout.layoutParams as ConstraintLayout.LayoutParams + asLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID + + if (isTablet) { + for (v in listOf( + view.overview_bg, + view.overview_time, + view.overview_timeagoshort, + view.overview_iob, + view.overview_cob, + view.overview_basebasal, + view.overview_extendedbolus, + view.overview_sensitivity + )) v.setTextSize(COMPLEX_UNIT_PX, v.textSize * 1.5f) + for (v in listOf( + view.overview_pump, + view.overview_openaps, + view.overview_uploader, + view.careportal_canulaage, + view.careportal_insulinage, + view.careportal_reservoirlevel, + view.careportal_reservoirlevel, + view.careportal_sensorage, + view.careportal_pbage, + view.careportal_batterylevel + )) v.setTextSize(COMPLEX_UNIT_PX, v.textSize * 1.3f) + view.overview_time_llayout.orientation = LinearLayout.HORIZONTAL + view.overview_timeagoshort.setTextSize(COMPLEX_UNIT_PX, view.overview_time.textSize) + } } } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinLowRes.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinLowRes.kt index ba0db8a010..0eb1b2c1ea 100644 --- a/app/src/main/java/info/nightscout/androidaps/skins/SkinLowRes.kt +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinLowRes.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.skins import android.util.DisplayMetrics -import android.widget.LinearLayout +import android.view.View import info.nightscout.androidaps.Config import info.nightscout.androidaps.R import javax.inject.Inject @@ -17,15 +17,15 @@ class SkinLowRes @Inject constructor(private val config: Config) : SkinInterface override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int = when { config.NSCLIENT -> R.layout.overview_fragment_nsclient - isSmallHeight || isLandscape -> R.layout.overview_fragment_landscape + isLandscape -> R.layout.overview_fragment_landscape else -> R.layout.overview_fragment } override fun actionsLayout(isLandscape: Boolean, isSmallWidth: Boolean): Int = when { - isLandscape || !isSmallWidth -> R.layout.actions_fragment + isLandscape -> R.layout.actions_fragment else -> R.layout.actions_fragment_lowres } - override fun preProcessLandscapeOverviewLayout(dm: DisplayMetrics, iobLayout: LinearLayout, timeLayout: LinearLayout) {} -} \ No newline at end of file + override fun preProcessLandscapeOverviewLayout(dm: DisplayMetrics, view: View, isTablet: Boolean) {} +} diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt index 3cf3addeeb..b2d294da1a 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt @@ -46,7 +46,7 @@ class AndroidPermission @Inject constructor( private var permission_battery_optimization_failed = false @SuppressLint("BatteryLife") - private fun askForPermission(activity: FragmentActivity, permission: Array, requestCode: Int) { + fun askForPermission(activity: FragmentActivity, permission: Array, requestCode: Int) { var test = false var testBattery = false for (s in permission) { diff --git a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt index 78cbaf4a9d..65752ab28e 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt @@ -68,7 +68,7 @@ class TddCalculator @Inject constructor( val absoluteRate = tbr?.tempBasalConvertedToAbsolute(t, profile) ?: profile.getBasal(t) tdd.basal += absoluteRate / 60.0 * 5.0 - if (!activePlugin.getActivePump().isFakingTempsByExtendedBoluses()) { + if (!activePlugin.activePump.isFakingTempsByExtendedBoluses()) { // they are not included in TBRs val eb = getExtendedBolusFromHistory(t) val absoluteEbRate = eb?.absoluteRate() ?: 0.0 diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizard.kt index 14380bfb72..928e01ecd7 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizard.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizard.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.utils.wizard import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.R import info.nightscout.androidaps.utils.sharedPreferences.SP import org.json.JSONArray import org.json.JSONObject @@ -16,7 +17,7 @@ class QuickWizard @Inject constructor( private var storage = JSONArray() init { - setData(JSONArray(sp.getString("QuickWizard", "[]"))) + setData(JSONArray(sp.getString(R.string.key_quickwizard, "[]"))) } fun getActive(): QuickWizardEntry? { @@ -32,7 +33,7 @@ class QuickWizard @Inject constructor( } fun save() { - sp.putString("QuickWizard", storage.toString()) + sp.putString(R.string.key_quickwizard, storage.toString()) } fun size(): Int = storage.length() diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml new file mode 100644 index 0000000000..042c7515b2 --- /dev/null +++ b/app/src/main/res/layout/activity_preferences.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/overview_info_layout.xml b/app/src/main/res/layout/overview_info_layout.xml index 750fe69459..147b468ff9 100644 --- a/app/src/main/res/layout/overview_info_layout.xml +++ b/app/src/main/res/layout/overview_info_layout.xml @@ -35,6 +35,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="@+id/overview_bg" app:layout_constraintEnd_toStartOf="@+id/overview_apsmode_llayout" app:layout_constraintStart_toEndOf="@+id/overview_arrow" app:layout_constraintTop_toTopOf="parent"> @@ -111,6 +112,7 @@ android:layout_marginTop="5dp" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="@+id/overview_bg" app:layout_constraintEnd_toStartOf="@id/overview_time_llayout" app:layout_constraintStart_toEndOf="@id/overview_deltas_llayout" app:layout_constraintTop_toTopOf="parent"> @@ -142,6 +144,7 @@ android:layout_marginTop="5dp" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="@+id/overview_bg" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/overview_apsmode_llayout" app:layout_constraintTop_toTopOf="parent"> @@ -178,6 +181,7 @@ android:layout_marginStart="5dp" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/overview_cob_llayout" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/overview_bg"> @@ -206,15 +210,16 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/overview_basal_llayout" app:layout_constraintStart_toEndOf="@+id/overview_iob_llayout" app:layout_constraintTop_toTopOf="@+id/overview_iob_llayout"> @@ -264,6 +270,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/overview_as_llayout" app:layout_constraintStart_toEndOf="@+id/overview_basal_llayout" app:layout_constraintTop_toTopOf="@+id/overview_iob_llayout"> @@ -292,6 +299,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/overview_extended_llayout" app:layout_constraintTop_toTopOf="@+id/overview_iob_llayout"> diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml index b5222a73c3..1f62997e71 100644 --- a/app/src/main/res/values-af-rZA/strings.xml +++ b/app/src/main/res/values-af-rZA/strings.xml @@ -570,7 +570,6 @@ Basale koers is verander op pomp, maar kon nie dit teruglees nie Kontroleer tans vir geskiedenis veranderinge Veelvuldige boluses met dieselfde hoeveelheid binne die dieselfde minuut was nounet ingevoer. Slegs een rekord kon bygevoeg word in behandelings. Kontroleer asseblief die pomp en voeg per hand \'n bolus rekord met behulp van die Careportal oortjie maak seker om \'n bolus te skep met \'n tyd deur geen ander bolus gebruik. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Die laaste bolus is ouer as 24 uur of is in die toekoms. Kontroleer asseblief of die datum op die pomp reg ingestel is. Tyd/datum van die gelewerde bolus op pomp lyk verkeerd, IAB is waarskynlik verkeerd. Kontroleer asseblief pomp tyd/datum. ProfileSwitch ontbreek. Doen \'n profiel skakelaar of druk \"Aktiveer profiel\" in die LokaleProfiel. diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml index 8723c5e3d4..8087edb5ec 100644 --- a/app/src/main/res/values-bg-rBG/strings.xml +++ b/app/src/main/res/values-bg-rBG/strings.xml @@ -405,11 +405,13 @@ Раздели IOB от болус и от базал на часовника неуспешно - моля проверете телефона --- + Тип пациент Дете Тийнейджър Възрастен Възрастни с голяма инсулинова резистентност Бременност + Моля, изберете тип на пациента за настройка на границите за безопастност Име на пациента Моля, посочете име на пациента или измислено име, за да се различават Потребител @@ -717,7 +719,7 @@ Базалният процент е променен в помпата, но прочитането е неуспешно Проверка за промени в историята на помпата Бяха внесени няколко болуса със същото количество в рамките на една и съща минута. Само един запис може да бъде добавен към лечението. Моля, проверете помпата и ръчно добавете болус запис, като използвате раздела Careportal . Уверете се, че сте създали болус и нямате друг болус за същото време. - http://www.androidaps.org facebook: http://facebook.androidaps.org + \n\nдокументация:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers Последният болус е с време от преди 24 часа или е в бъдеще. Моля, проверете дали датата на помпата е зададена правилно. Времето/датата на доставения болус на помпата изглежда погрешно, IOB вероятно е неправилно. Моля, проверете часа/датата на помпата. Смяната на профила не е отразена. Моля, направете превключване на потребителския профил или натиснете \"Активирай профил\" в Локален профил. @@ -1231,4 +1233,7 @@ Качени данни Следните данни ще бъдат качвани във вашия Open Humans акаунт: Глюкозни стойности, болуси, въглехидрати, удължени болуси, профилни смени, общи дневни дози, временни базали, временни цели, предпочитания, версия на AAPS, модел на телефона и размери на екрана. Тайна или лична информация, като например вашия адрес на Nightscout или API, няма да бъдат качени. RileyLink статус: + Филтър + Не може да се създаде локален профил. Профилът е невалиден. + Не убивай приложението? diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index 85a132a6df..3963caab0d 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -386,7 +386,7 @@ Adresa URL: Posouvat Restart - Interní NSClient + NSClient Adresa Nightscoutu Vložte adresu Nightscoutu NS heslo (API secret) @@ -719,7 +719,7 @@ Bazál na pumpě byl změněn, ale čtení selhalo Kontroluji změny v historii Byly načteny bolusy stejné velikosti během jedné minuty. Do ošetření je možné přidat jen jeden. Zkontrolujte pumpu a přidejte bolus do ošetření ručně tak, aby čas nekolidoval. - \nhttp://www.androidaps.org\n\nfacebook: \nhttp://facebook.androidaps.org + \n\ndokumentace:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers Poslední bolus je starší než 24h nebo v budoucnu. Zkontrolujte čas v pumpě. Datum/čas podaného bolusu se zdá špatně. IOB bude chybné. Zkontrolujte čas v pumpě. Přepnutí profilu chybí. Proveďte přepnutí profilu nebo ho aktivujte na záložce lokálního profilu. @@ -1233,4 +1233,7 @@ Odeslaná data Následující data budou nahrána do vašeho účtu Open Humans: hodnoty glykémie, bolusy, sacharidy, události péče (kromě poznámek), rozložené bolusy, přepnutí profilu, celkové denní dávky, dočasné bazály, nastavení, verze aplikace, model zařízení a rozměry obrazovky. Tajné nebo soukromé informace, jako je URL nebo API heslo vašeho Nightscoutu, nahrány nebudou. Status RileyLink: + Filtr + Nelze vytvořit lokální profil. Profil je neplatný. + Nezabíjet mou aplikaci? diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 7071cfa7eb..8d431abcf2 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -719,7 +719,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\nSupport:\nhttps://de.loopercommunity.org/\nhttp://facebook.androidaps.org + \n\nDokumentation:\nhttps://androidaps.readthedocs.io\n\nLooper-Community:\nhttps://loopercommunity.org\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers 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. @@ -1234,4 +1234,7 @@ Unerwartetes Verhalten. Daten hochgeladen Die folgenden Daten werden auf Dein Open Humans-Konto hochgeladen: Glukosewerte, Boli, Kohlenhydrate, Careportal-Ereignisse (außer Notizen), erweiterte Boli, Profilwechsel, Gesamttagesdosen, temporäre Basalwerte, Temporäre Ziele, Einstellungen, Anwendungsversion, Gerätemodell und Bildschirmabmessungen. Vertrauliche oder private Informationen wie z.B. Deine Nightscout-URL oder Dein API-Secret werden nicht hochgeladen. RileyLink Status: + Filter + Lokales Profil kann nicht erstellt werden. Profil ist ungültig. + Don\'t kill my app? diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml index af6acbc6a9..89e5363eb4 100644 --- a/app/src/main/res/values-el-rGR/strings.xml +++ b/app/src/main/res/values-el-rGR/strings.xml @@ -575,7 +575,6 @@ Ο βασικός ρυθμός της αντλίας έχει αλλάξει αλλά η ανάγνωση έχει αποτύχει Έλεγχος για αλλαγές στο ιστορικό Πολλαπλά bolus της ίδιας ποσότητας φορτώθηκαν μέσα σε ένα λεπτό. Μόνο μία εγγραφή μπορεί να προστεθεί στη θεραπεία. Ελέγξτε την αντλία και προσθέστε χειροκίνητα το bolus χρησιμοποιώντας το Careportal. Σιγουρευτείτε ότι δημιουργήσατε ένα bolus σε χρόνο που να μη γίνεται άλλο bolus. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Το τελευταίο bolus είναι παλαιότερο από 24 ώρες ή είναι προγραμματισμένο στο μέλλον. Ελέγξτε αν είναι σωστή η ώρα στην αντλία. Η ημερομηνία/ώρα έγχυσης του bolus φαίνεται λάθος. Το IOB είναι λάθος. Ελέγξτε την ώρα/ημερομηνία της αντλίας. Η αλλαγή προφίλ λείπει. Αλλάξτε το προφίλ ή πατήστε \"Ενεργοποίηση Προφίλ\" στο Τοπικό Προφίλ. diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 279cf0d00a..08cc1f8bf4 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -701,7 +701,6 @@ Tasa Basal cambiada en bomba, pero falló al leer Comprobando cambios en el historial Múltiples bolos con la misma cantidad en el mismo minuto fueron importados. Sólo se puede agregar un registro a los tratamientos. Verifique la bomba y agregue manualmente un registro de bolo usando la pestaña Careportal. Asegúrese de crear un bolo con un tiempo que no use otro bolo. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) El último bolo tiene más de 24 horas o está en el futuro. Comprueba que la fecha en la bomba está configurada correctamente. La hora / fecha del bolo administrado en la bomba parece incorrecta; es probable que la IOB sea incorrecta. Verifique la hora / fecha de la bomba. Falta Cambio de Perfil. Haga un Cambio de Perfil o presione \"Activar perfil\" en PerfilLocal. diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index fc30f34133..7c82a345c6 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -720,7 +720,6 @@ 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\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. @@ -1234,4 +1233,5 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Données transférées Les données suivantes seront téléchargées sur votre compte Open Humans : glycémie, bolus, glucides, événements Careportal (sauf les notes), bolus étendus, changements de profil, doses quotidiennes totales, basales temporaires, cibles temporaires, préférences, version de l\'application, modèle de l\'appareil et dimensions de l\'écran. Les informations secrètes ou privées telles que votre URL Nightscout ou votre API secret ne seront pas téléchargés. État du RileyLink : + Filtrer diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index 18d0c81039..c9ab12121c 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -719,7 +719,6 @@ Velocità basale cambiata sul micro, ma la sua lettura è fallita Controllo modifiche allo storico Sono appena stati importati più boli con la stessa quantità nello stesso minuto. Solo un record può essere aggiunto ai trattamenti. Controlla il micro e aggiungi manualmente un record di bolo utilizzando la sezione Portale. Assicurati di creare un bolo con un\'ora non utilizzata da nessun altro bolo. - \n\nhttp://www.androidaps.org\n\nfacebook:\nhttp://facebook.androidaps.org L\'ultimo bolo è più vecchio di 24 ore o ha una data nel futuro. Controlla che la data sul micro sia impostata correttamente. L\'ora/la data del bolo erogato sul micro sembra errata, IOB probabilmente non è corretto. Controlla l\'ora e/o la data del micro. Nessun cambio profilo. Effettua un cambio profilo o premi \"Attiva profilo\" nella sezione Profilo locale. @@ -1233,4 +1232,5 @@ Dati caricati I seguenti dati verranno caricati sul tuo account Open Humans: valori glicemia, boli, carboidrati, eventi portale (eccetto note), boli estesi, cambi profilo, dosi giornaliere totali (TDD), basali temporanee, target temporanei, preferenze, versione dell\'applicazione, modello del dispositivo e dimensioni dello schermo. Informazioni segrete o private come l\'URL di Nightscout o l\'API secret non verranno caricate. Stato RileyLink: + Filtro diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml index 9517173acd..ad1e1a783c 100644 --- a/app/src/main/res/values-iw-rIL/strings.xml +++ b/app/src/main/res/values-iw-rIL/strings.xml @@ -13,7 +13,7 @@ אתם בטוחים שאתם רוצים לאפס את מסדי הנתונים? יציאה השתמש תמיד בערכים בזאלים מוחלטים - בבקשה אתחל את הסמרטפון שלך או תרענן את אפלקצית AndroidAPS בהגדרות המערכת \nאחרת AndroidAPS לא יוכל לבצע רישום (חשוב לעקוב אחר ולוודא כי האלגוריתמים פועלים כראוי)! + נא לאתחל את הסמרטפון שלכם או הפעילו מחדש את אפלקציית AndroidAPS בהגדרות המערכת \nאחרת AndroidAPS לא יוכל לבצע רישום (חשוב לעקוב ולוודא כי האלגוריתמים פועלים כראוי)! נראה שמכשיר זה אינו תומך ברשימת היתרים למיטוב הסוללה - ייתכן שתיתקל בבעיות ביצועים. לחצנים לגישה מהירה לפונקציות שימושיות משמש לקביעת תצורה של תוספים פעילים @@ -89,7 +89,7 @@ משאבה וירטואלית פורטל טיפולים משאבה - עם משאבה אתם מעוניינים להשתמש ב-AndroidAPS? + עם איזו משאבה אתם מעוניינים להשתמש ב-AndroidAPS? טיפולים איזה תוסף ישמש לתפעול הטיפולים? פרופיל @@ -719,7 +719,7 @@ המינון הבזאלי במשאבה השתנה אך קריאתו נכשלה בודק שינויים בהיסטוריה בולוסים מרובים באותו הגודל בתוך הובאו באותה דקה. ניתן להוסיף רק רשומה אחת לטיפולים. בדקו את המשאבה והוסיפו באופן ידני רשומת בולוס בלשונית פורטל הטיפולים. יש ליצור רשומות בולוס עם זמנים שונים מבולוסים אחרים. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) + \n\nתיעוד:\nhttps://androidaps.readthedocs.io\n\nפייסבוק:\nhttps://www.facebook.com/groups/AndroidAPSUsers הבולוס האחרון נרשם לפני 24 שעות או בשעה עתידית, נא לבדוק את כיוון השעון ותאריך במשאבה. זמן\תאריך הבולוס שהוזרק מהמשאבה נראה לא נכון, IOB כנראה שגוי, בדקו את השעון ואת התאריך במשאבה. שינוי פרופיל חסר. אנא החליפו פרופיל או לחצו על \"הפעל פרופיל\" בפרופיל המקומי. @@ -1233,4 +1233,7 @@ נתונים שהועלו הנתונים הבאים יועלו לחשבון Open Humans שלכם: ערכי גלוקוז, בולוסים, פחמימות, אירועים מפורטל הטיפולים (מלבד הערות), בולוסים ממושכים, החלפות פרופיל, מינונים יומיים כוללים, באזאלים זמניים, ערכי מטרה זמניים, העדפות, גרסת יישום, דגם המכשיר ומממדי המסך. מידע סודי או פרטי כגון כתובת ה-Nightscout האישית או סוד ה-API שלכם לא יועלו. מצב ריילילינק: + סינון + לא ניתן ליצור פרופיל מקומי. הפרופיל אינו חוקי. + לא להשבית את האפליקציה שלי? diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 3fda4cdd20..db2069737a 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -596,7 +596,6 @@ 펌프의 Basal 양이 변경되었지만 읽기를 실패했습니다. 이력 변경 확인중 동일한 시간(분)에 동일한 양의 2개이상의 Bolus가 주입되었습니다. 오직 하나의 기록만이 관리에 입력될 수 있습니다. 펌프를 확인한 후 케어포털 탭에서 Bolus 기록을 수동으로 추가하세요. 동일한 시간에 동일한 양의 Bolus를 주입하지 않도록 하세요. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) 최근 Bolus가 24시간 전 혹은 미래에 있습니다. 펌프의 날짜가 제대로 설정되어 있는지 확인해보세요. 펌프에서 주입된 Bolus의 시간/날짜가 잘못되었습니다. IOB가 부정확할 수 있습니다. 펌프 시간/날짜를 확인하세요. 프로파일변경 누락. 로컬 프로파일에서 프로파일 변경을 하거나 \"프로파일 활성화하기\"를 누르세요. diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml index b0d58a7eb8..5477019b68 100644 --- a/app/src/main/res/values-lt-rLT/strings.xml +++ b/app/src/main/res/values-lt-rLT/strings.xml @@ -707,7 +707,6 @@ Valandinė bazė pompoje pasikeitė, bet nuskaityti nepavyko Tikrinami istorijos pokyčiai Keletas bolusų su tuo pačiu kiekiu buvo importuoti per tą pačią minutę. Tik vienas įrašas gali būti pridėtas. Prašome patikrinti pompą ir rankiniu būdu įveskite bolusą, naudojant Priežiūra skiltį. Įsitikinkite, kad boluso įrašo laikas nesutampa su kitais įrašais. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Paskutinis bolusas įrašytas anksčiau nei prieš 24 val. arba yra ateityje. Prašome patikrinti, ar data pompoje nustatyta teisingai. Suleisto boluso laikas/data pompoje yra neteisingas, AIO panašu yra nekorektiškas. Prašome patikrinti pompos laiką/datą. Neatliktas profilio keitimas. Prašome atlikti profilio keitimą arba paspausti \"Aktyvuoti profilį\" Vietinio profilio (VP) skiltyje. diff --git a/app/src/main/res/values-nl-rNL/exam.xml b/app/src/main/res/values-nl-rNL/exam.xml index 3039d5ae62..e20ac31885 100644 --- a/app/src/main/res/values-nl-rNL/exam.xml +++ b/app/src/main/res/values-nl-rNL/exam.xml @@ -134,6 +134,8 @@ 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 een brood-eenheid telt als 10g of 12g koolhydraten. + KH ratio betekent: Hoeveel koolhydraten gebruik je voor 1E 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… diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml index 3a3caf6e30..17e1941081 100644 --- a/app/src/main/res/values-nl-rNL/strings.xml +++ b/app/src/main/res/values-nl-rNL/strings.xml @@ -261,6 +261,7 @@ Waarde %1$s valt buiten de toegestane harde limieten Om verbinding te maken met pomp antwoord met code %1$s Verbinding maken met pomp is mislukt + Om de pomp te ontkoppelen voor %1$d minuten antwoord met code %2$s Pomp verbinding verbroken Pomp opnieuw verbonden Commando\'s op afstand zijn niet toegestaan @@ -404,10 +405,13 @@ Splits IOB in bolus en basaal op de watchface Niet geslaagd - controleer de telefoon n.v.t. + Type patiënt Kind Tiener Volwassene insuline resistente volwassene + Zwangerschap + Selecteer het type patiënt om de veiligheidslimieten in te stellen Naam patiënt Geef de naam of roepnaam van de patiënt op om onderscheid te maken tussen meerdere setups Gebruiker @@ -451,6 +455,8 @@ Drempel alarm insuline leeftijd [h] Drempel waarschuwing sensor leeftijd [h] Drempel alarm sensor leeftijd [h] + Drempel waarschuwing batterij niveau [%] + Drempel alarm batterij niveau [%] Drempel waarschuwing batterij leeftijd [h] Drempel alarm batterij niveau [h] Drempel waarschuwing reservoir niveau [E] @@ -481,6 +487,12 @@ Ouderdom insuline Profiel wissel uitvoeren Ouderdom batterij + Sensor + Canule + Insuline + Pomp batterij + leeftijd: + level: Alarm opties Maak meldingen van NS alarmen Maak meldingen van NS aankondigingen @@ -707,7 +719,6 @@ Basaal patroon op de pomp is gewijzigd, maar kunnen niet worden uitgelezen Controle van historiek op wijzigingen Verschillende bolussen met dezelfde hoeveelheid op hetzelfde tijdstip zijn geïmporteerd. Er is er maar 1 toegevoegd aan de behandelingen lijst. Controleer op de pomp en voeg eventueel toe via het Careportal menu. Er mogen geen 2 bolussen op hetzelfde tijdstip aanwezig zijn. - \n\nhttp://www.androidaps.org \n\nfacebook:\nhttp://facebook.androidaps.org De laatste bolus is ouder dan 24 uren of bevind zich in de toekomst. Controleer de datum en tijd in de pomp aub. Datum/tijd van de geleverde bolus op de pomp is niet correct, IOB is waarschijnlijk foutief. Controleer aub de datum/tijd op de pomp. Profiel wissel ontbreekt. Doe aub een profiel wissel of duw op Activeer Profiel in het Lokale profiel. @@ -1175,6 +1186,7 @@ Kopieer instellingen van NS NS instellingen kopiëren (indien aanwezig)? Klassiek weergave thema + Lage resolutie skin Knoppen worden altijd weergegeven aan de onderkant van het scherm Groot scherm Skin @@ -1220,4 +1232,5 @@ Geüploade gegevens De volgende gegevens worden geüpload naar je Open Humans account: glucosewaarden, bolussen, koolhydraten, careportal-events (met uitzondering van notities), verlengde bolussen, profielwissels, totale dagelijkse doses, tijdelijke basaalstanden, tijdelijke doelen, voorkeuren, app-versie, apparaatmodel en schermafmetingen. Geheime of persoonlijke gegevens zoals je Nightscout-URL of API-secret worden niet geüpload. RileyLink Status: + Filter diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml index b0ceaf7462..942dca5279 100644 --- a/app/src/main/res/values-no-rNO/strings.xml +++ b/app/src/main/res/values-no-rNO/strings.xml @@ -719,7 +719,7 @@ Basal raten i pumpen er endret, men feilet i å lese ny verdi Sjekker for endringer i historikken Flere boluser levert i samme minutt og med samme insulinmengde ble importert. Bare en av doseringene ble lagt til i behandlinger. Vennligst sjekk pumpen og legg til manuelt ekstra bolus doseringer i Careportal. Ikke legg til flere boluser i samme minutt. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) + \n\ndokumentasjon:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers Den siste bolus er eldre enn 24t eller er i fremtiden. Vennligst sjekk at datoen i pumpen er korrekt. Tid/dato for levert bolus i pumpen er trolig feil, og IOB beregningen blir da feil. Vennligst sjekk pumpens tid/dato. Profil bytte mangler. Utfør et profil bytte og trykk på \"Aktiver profil\" i din lokale profil. @@ -1233,4 +1233,7 @@ Opplastede data Følgende data vil bli lastet opp til din Open Humans konto: glukoseverdier, boluser, karbohydrater, careportalhendelser (bortsett fra merknader), forlengede boluser, profilbytter, totale daglige doser, temp basaler, endringer i BS mål, innstillinger, app versjon, mobilmerke og skjermstørrelser. Hemmelig eller privat informasjon som din Nightscout URL eller API secret vil ikke bli lastet opp. RileyLink status: + Filter + Klarte ikke å opprette lokal profil. Profilen er ikke gyldig. + Avslutte app? diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml index 305039d112..1f5eb5d7d4 100644 --- a/app/src/main/res/values-pl-rPL/strings.xml +++ b/app/src/main/res/values-pl-rPL/strings.xml @@ -720,7 +720,6 @@ Dawka podstawowa zmieniła się na pompie, ale jej odczyt nie powiódł się Sprawdzanie zmian w historii Wielokrotne bolusy o tej samej wielkości w tej samej minucie zostały właśnie zaimportowane. Do leczenia można dodać tylko jeden taki rekord. Sprawdź pompę i ręcznie dodaj zapis bolusa za pomocą zakładki PortalOpieki. Upewnij się, że tworzysz bolus z czasem, którego nie używa żaden inny bolus. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Ostatni bolus jest starszy niż 24 godziny lub jest w przyszłości. Sprawdź, czy data na pompie jest ustawiona prawidłowo. Czas/data dostarczonego bolusa na pompie wydaje się błędna, IOB jest prawdopodobnie niepoprawny. Sprawdź czas/datę pompy. Brakuje ZmianyProfilu. Proszę wykonać ZmianęProfilu lub nacisnąć \"Aktywuj Profil\" w ProfiluLokalnym diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d3cc2f1645..26c897fd33 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -657,7 +657,6 @@ Rácio da basal foi alterado na bomba, mas a leitura falhou Verificando alterações de histórico Bólus múltiplos, com a mesma quantidade e no mesmo minuto acabaram de ser importados. Apenas um registo pôde ser adicionado aos tratamentos. Por favor confirma na bomba e adicione o registo de bólus manualmente, utilizando o separador do Careportal. Tenha em atenção que deve criar um bólus com um tempo em que nã oexistem outros registos de bólus. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) O último bólus tem mais de 24 horas ou está no futuro. Por favor verifique se a data está definida correctamente na bomba. Hora/data da entrega do bólus na bomba parece errado, IOB aparentemente está incorrecto. Verifique hora/data na bomba. TrocaPerfil em falta. Por favor faça uma troca de perfil ou pressione \"Ativar Perfil\" em PerfilLocal. diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 1cdb34559e..29c6803509 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -707,7 +707,6 @@ Rácio da basal foi alterado na bomba, mas a leitura falhou A verificar se há alterações de histórico Bólus múltiplos, com a mesma quantidade e no mesmo minuto acabaram de ser importados. Apenas um registo pôde ser adicionado aos tratamentos. Por favor confirma na bomba e adicione o registo de bólus manualmente, utilizando o separador do Careportal. Tenha em atenção que deve criar um bólus com um tempo em que nã oexistem outros registos de bólus. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) O último bólus tem mais de 24 horas ou está no futuro. Por favor verifique se a data está definida correctamente na bomba. Hora/data da administração do bólus na bomba parece errado, IOB aparentemente está incorrecto. Verifique hora/data na bomba. TrocaPerfil em falta. Por favor faça uma troca de perfil ou pressione \"Activar Perfil\" em PerfilLocal. diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml index 9d8e80321a..d60c0dd508 100644 --- a/app/src/main/res/values-ro-rRO/strings.xml +++ b/app/src/main/res/values-ro-rRO/strings.xml @@ -707,7 +707,6 @@ Rata bazală schimbată în pompă, dar nu s-a putut actualiza Se verifică schimbările în istoric Mai multe bolusuri de aceeași valoare au fost importate. Doar o singură înregistrare va fi adăugată în tratamente. Verifcați manual în pompă și adăugați înregistrările folosind Careportal. Asigurați-vă că veți crea un bolus care nu se suprapune peste altul în timp. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Ultimul bolus este mai vechi de 24 ore sau este în viitor. Verificați ca data să fie configurată corect în pompă. Ora/data bolusului livrat de pompă pare eronat, IOB este probabil incorect. Verificați ora/data pompei. Lipsă SchimbareProfil. Efectuați o schimbare de profil sau apăsați \"Activare profil\" în ProfilulLocal. diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index 82e509ac58..7bb276da0a 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -719,7 +719,7 @@ Скорость базала на помпе изменилась, но учесть ее не удалось Проверка изменений в истории событий помпы Только что импортировано несколько болюсов с одинаковым количеством инсулина в течение одной минуты. В лог лечения может быть добавлена только одна запись. Пожалуйста проверьте помпу и вручную введите запись о болюсе через вкладку портала назначений. Убедитесь, что данному времени соответствует только одна запись о болюсе. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de) \n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) + \n\nДокументация:\nhttps://androidaps.readthedocs.io\n\nFacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers Новый болюс старше 24 часов или запись относится к будущему. Пожалуйста убедитесь что дата на помпе установлена правильно. Время/дата поданного болюса неверны. Вероятно, кол-во активного инсулина IOB также неверно. Проверьте время/дату помпы. Профиль не переключен. Пожалуйста переключите профиль или нажмите \"активировать профиль\" в LocalProfile. @@ -1235,4 +1235,6 @@ Context | Edit Context Загруженные данные На ваш аккаунт Open Humans будут загружены следующие данные: значения ГК, события careportal (за исключением примечаний), пролонгированные болюсы, переключения профиля, суммарные суточные дозы, временные базалы, временные цели, настройки, версии приложения, модель устройства и размеры экрана. Секретная или конфиденциальная информация, такая как адрес вашего сайта Nightscout или API secret, не будет загружена. Статус RileyLink: + Фильтр + Не закрывать приложение? diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml index 7809168e77..d4df1efc62 100644 --- a/app/src/main/res/values-sk-rSK/strings.xml +++ b/app/src/main/res/values-sk-rSK/strings.xml @@ -21,6 +21,7 @@ Zobrazenie prednastavených jedál, definovaných v Nightscoute Predvoľba pre inzulín Humalog a Novorapid Predvoľba pre inzulín Fiasp + Predvoľba pre inzulín Lyumjev Umožňuje definovať vrchol účinnosti inzulínu a malo by byť používané iba pokročilými užívateľmi Aktivuje alebo deaktivuje spustenie uzavretého okruhu. Synchronizuje vaše dáta s NS @@ -260,6 +261,7 @@ Hodnota %1$s je mimo prednastavený rozsah Ak chcete pripojiť pumpu, odpovedzte pomocou SMS s kódom %1$s Pripojenie k pumpe zlyhalo + Ak chcete odpojiť pumpu na %1$d minút, odpovedzte pomocou SMS s kódom %2$s Pumpa odpojená Pumpa bola znovu pripojená Príkazy na diaľku nie sú povolené @@ -403,10 +405,13 @@ Rozpísať IOB na hodinkách do bolusového a bazálneho Neúspešné - skontrolujte telefón nie je k dispozícii + Typ pacienta Dieťa Dospievajúci Dospelý Dospelý s nízkou citlivosťou + Tehotenstvo + Prosím vyberte typ pacienta pre nastavenie bezpečnostných limitov Meno pacienta Zadajte meno pacienta, alebo prezývku pre rozlíšenie medzi viacerými nastaveniami Používateľ @@ -450,6 +455,8 @@ Prah kritického veku inzulínu [h] Prah upozornenia na vek senzora [h] Prah kritického veku senzora [h] + Prah upozornenia na úroveň batérie senzora [%] + Prah kritickej úrovne batérie senzora [%] Prah upozornenia na úroveň batérie [h] Prah kritickej úrovne batérie [h] Prah upozornenia na úroveň hladiny zásobníka [JI] @@ -480,6 +487,12 @@ Vek inzulínu Vykonajte zmenu profilu Vek batérie v pumpe + Senzor + Kanyla + Inzulín + Batéria do pumpy + vek: + úroveň: Nastavenie alarmov Vytvoriť oznámenia z alarmov NS Vytvoriť oznámenia z upozornení NS @@ -532,6 +545,7 @@ Voliteľný vrchol - Oref Rýchlo pôsobiaci - Oref Ultra rýchly - Oref + Lyumjev DIA %1$f je príliš krátke - AAPS namiesto toho použilo %2$f ! Aktivovať profil NEPLATNÝ @@ -705,7 +719,7 @@ Bazál na pumpe bol zmenený, ale jeho načítanie zlyhalo Kontrolujem zmeny v histórii Boli načítané bolusy rovnakej veľkosti v priebehu jednej minúty. Do ošetrení je možné pridať iba jeden. Skontrolujte pumpu a pridajte bolus do ošetrení ručne tak, aby čas nekolidoval. - \nhttp://www.androidaps.org\n\nfacebook: \nhttp://facebook.androidaps.org + \n\ndokumentácia:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers Posledný bolus je starší ako 24h, alebo je v budúcnosti. Skontrolujte čas v pumpe. Dátum/čas podaného bolusu se zdá byť nesprávny. IOB bude pravdepodobne chybné. Skontrolujte čas v pumpe. Prepnutie profilu chýba. Vykonajte prepnutie profilu, alebo ho aktivujte na záložke lokálneho profilu. @@ -794,6 +808,8 @@ Konfigurácia zdroja glykémií Vyberte zdroj profilov. Pokiaľ ide o dieťa, využijete pravdepodobne NS profil. Pokiaľ Vás nikto cez NS nesleduje, budete pravdepodobne preferovať lokálny profil. Uvedomte si, že nastavujete iba zdroj profilov. Na to aby se naozaj profil začal používať, je potrebné vykonať aktiváciu profilu použitím funkcie \"Prepnutie profilu\" Vyberte jeden z algoritmov. Sú zoradené od najstaršieho po najnovší. Novší je obvykle lepší a agresívnejší, ale vyžaduje presnejšie nastavenie. Preto pokiaľ s uzavretým okruhom začínate, mali by ste najskôr vybrať jen AMA a nie ten posledný. Nezabudnite si prečítať dokumentáciu k OpenAPS a prejsť nastavenia, kým ho začnete používať. + Čakám na pripojenie RileyLink…\n + Poznámka: Po inicializácii pumpy môžete pokračovať v nastavení.\n Spusťte prvý cieľ Povolenie Vyžiadať si povolenie @@ -983,6 +999,7 @@ obmedzenie interného úložiska Uvoľnite aspoň %1$d MB z interného úložiska! Uzavretý okruh zakázaný! Chybný formát + Trvanie dočasného bazálu musí byť násobkom %1$d minút a musí byť väčšie ako 0. Nesprávný kód. Príkaz zrušený. Nie je nakonfigurované Prepnutie profilu vytvorené @@ -1148,6 +1165,9 @@ Resetovať autentifikačný kľúč Ste si istý, že chcete obnoviť autentifikačný kľúč? Vyresetujete tým všetky aktuálne nakonfigurované autentikátory a budete ich musieť znovu nastaviť. Bol vygenerovaný nový autentifikačný kľúč! Prosím, použite aktualizovaný QR kód pre nastavenie autentifikátorov. + Export OTP tajného kľúča + Ste si istý, že chcete skopírovať tajný OTP kľúč do schránky?\n\nPravdepodobne to budete potrebovať iba v prípade, keď bude mať vaša overovacia aplikácia problém so skenováním QR kódu, chcete ho zadať ručne, alebo chcete nakonfigurovať hardwarový OTP token pomocou špeciálnej aplikácie. + Tajné OTP heslo (vo formáte Base32) bolo vyexportované a skopírované do schránky. Vložte ho do autentikátora, alebo programátora OTP hardwaru! 1. Nainštalujte Autentifikátor 2. Naskenujte kód pre nastavenie AndroidAPS OTP kódov 3. Odtestujte jednorázové heslo @@ -1167,6 +1187,7 @@ Kopírovať nastavenia z NS Skopírovať nastavenia NS (ak existujú)? Pôvodný vzhľad + Vzhľad pre nízke rozlišenie Tlačidlá sú vždy zobrazené v spodnej časti obrazovky Veľký displej Vzhľad @@ -1211,4 +1232,8 @@ Stav procesu: %s Odoslané údaje Následujúce dáta budú nahraté do vašeho účtu Open Humans: hodnoty glykémie, bolusy, sacharidy, udalosti starostlivosti (okrem poznámok), rozložené bolusy, prepnutia profilov, celkové denné dávky, dočasné bazály, nastavenia, verzia aplikácie, model zariadenia a rozmery obrazovky. Tajné, alebo súkromné informácie, ako je URL, alebo API heslo vašeho Nightscoutu, nahraté nebudú. + Stav RileyLinku: + Filter + Nie je možné vytvoriť lokálny profil. Profil je neplatný. + Nepotláčať moju aplikáciu? diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index 6926f1eeb7..c6934ea2d5 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -720,7 +720,6 @@ Eversense-appen. Basalen ändrad i pumpen, men det gick inte att läsa till vad Letar efter förändringar i historiken Flera bolusar med samma mängd insulin importerades just. Endast en kan läggas till i Careportal. Vänligen kontrollera pumpen och gör ändringar i Careportal manuellt vid behov. Observera att man bara kan ha en bolus per klockslag. - \n\nWeb: http://www.androidaps.org\n\nDocs: http://wiki.androidaps.org\n\nFB: http://facebook.androidaps.org Den senaste bolusen är äldre än 24 timmar eller i framtiden. Vänligen kontrollera tid och datum i pumpen. Tid/datum för bolusen verkar fel. IOB är troligen missvisande. Vänligen kontrollera tid och datum i pumpen. Profilbyte saknas. Vänligen gör ett profilbyte eller tryck Aktivera profil under Lokal Profil. diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index fd6a4ef74b..7bb06573b5 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -542,7 +542,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d Bazal oranı pompada değiştirildi, ancak okuma başarısız oldu Geçmiş değişiklikleri kontrol ediliyor Aynı dakika içinde aynı miktarda birden fazla boluslar eklenildi. Tedavilere sadece bir kayıt eklenebilir. Lütfen pompayı kontrol edin ve Careportal sekmesini kullanarak elle bir bolus kaydı ekleyin. Başka bolus kullanmayan bir zamana sahip bir bolus oluşturduğunuzdan emin olun. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) Son bolus 24 saatten daha eski veya gelecekte. Lütfen pompadaki tarihin doğru ayarlandığını kontrol edin. Teslim edilen bolusun pompadaki zamanı/tarihı yanlış görünüyor, IOB (Insulin On Board) muhtemelen yanlıştır. Lütfen pompa zamanını/tarihini kontrol edin. Profildeğiştir kayıp. Lütfen bir profil değiştir seçin veya YerelPorfil\'de \"Profili Etkinleştir\" düğmesine basın. diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index f3a71d5df5..d2b00e28d6 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -567,7 +567,6 @@ 泵上的基础率改变了,但是读取失败 检查历史记录变化 在同一分钟内使用相同数量的多个大剂量记录被导入的。治疗中只能增加一项记录。请手动检查泵并使用记录标签手动添加一个大剂量记录。确保创建一个和其他大剂量记录时间不重复的大剂量记录. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) 最后一次大剂量的输注时间是在24个小时以前或者在未来的时间,请检查泵上的日期设置的的是否正确 输注过的大剂量的时间/日期看着好像错了,活性胰岛素可能不准确。请检查泵的时间/日期 配置文件切换缺失。请做一次配置文件切换或者在本地配置文件里按“激活配置文件” diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 72f49373eb..4ef76927e0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -851,7 +851,7 @@ Basal rate changed on pump, but reading it failed Checking for history changes Multiple boluses with the same amount within the same minute were just imported. Only one record could be added to treatments. Please check the pump and manually add a bolus record using the Careportal tab. Make sure to create a bolus with a time no other bolus uses. - \n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de) + \n\ndocumentation:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly. Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date. ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile. @@ -932,7 +932,6 @@ Max daily safety multiplier Current basal safety multiplier n/a - virtualpump_type virtualpump_uploadstatus Virtual Pump Type Pump Definition @@ -1466,4 +1465,8 @@ Uploaded Data The following data will be uploaded to your Open Humans account: Glucose values, boluses, carbs, careportal events (except notes), extended boluses, profile switches, total daily doses, temporary basals, temp targets, preferences, application version, device model and screen dimensions. Secret or private information such as your Nightscout URL or API secret will not be uploaded. RileyLink status: + Filter + Unable to create local profile. Profile is invalid. + Don\'t kill my app? + diff --git a/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt index a0776e8365..358f417425 100644 --- a/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt @@ -40,7 +40,7 @@ class ProfileTest : TestBaseWithProfile() { @Before fun prepare() { - `when`(activePluginProvider.getActivePump()).thenReturn(virtualPumpPlugin) + `when`(activePluginProvider.activePump).thenReturn(virtualPumpPlugin) `when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription) `when`(resourceHelper.gs(R.string.profile_per_unit)).thenReturn("/U") `when`(resourceHelper.gs(R.string.profile_carbs_per_unit)).thenReturn("g/U") diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt index 7d35e2f1b2..d7c2fcd712 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt @@ -61,7 +61,7 @@ class LoopPluginTest : TestBase() { hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, nsUpload) loopPlugin = LoopPlugin(injector, aapsLogger, rxBus, sp, constraintChecker, resourceHelper, profileFunction, context, commandQueue, activePlugin, treatmentsPlugin, virtualPumpPlugin, actionStringHandler, iobCobCalculatorPlugin, receiverStatusStore, fabricPrivacy, nsUpload, hardLimits) - `when`(activePlugin.getActivePump()).thenReturn(virtualPumpPlugin) + `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt index 01ea1f9b8a..6bfea57ff9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt @@ -47,7 +47,7 @@ class InsulinLyumjevPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.OREF_LYUMJEV, sut.id) + assertEquals(InsulinInterface.InsulinType.OREF_LYUMJEV, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt index 646681c1dd..6558ed80be 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.logging.AAPSLogger @@ -9,8 +10,10 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA import info.nightscout.androidaps.db.Treatment +import info.nightscout.androidaps.interfaces.InsulinInterface import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject import org.junit.Assert import org.junit.Before import org.junit.Rule @@ -46,8 +49,10 @@ class InsulinOrefBasePluginTest { get() = testPeak override fun commentStandardText(): String = "" - override fun getId(): Int = 0 - override fun getFriendlyName(): String = "" + override val id get(): InsulinInterface.InsulinType = InsulinInterface.InsulinType.UNKNOWN + override val friendlyName get(): String = "" + override fun configuration(): JSONObject = JSONObject() + override fun applyConfiguration(configuration: JSONObject) {} } @get:Rule @@ -104,22 +109,22 @@ class InsulinOrefBasePluginTest { // check directly after bolus treatment.date = time treatment.insulin = 10.0 - Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 1 hour treatment.date = time - 1 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 2 hour treatment.date = time - 2 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 3 hour treatment.date = time - 3 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after dia treatment.date = time - 4 * 60 * 60 * 1000 treatment.insulin = 10.0 - Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index 8c65f3339f..a172e98116 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -54,7 +54,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Test fun getIdTest() { - assertEquals(InsulinInterface.OREF_FREE_PEAK, sut.id) + assertEquals(InsulinInterface.InsulinType.OREF_FREE_PEAK, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt index 7f1ec85ae9..e4a1b7a650 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt @@ -47,7 +47,7 @@ class InsulinOrefRapidActingPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.OREF_RAPID_ACTING, sut.id) + assertEquals(InsulinInterface.InsulinType.OREF_RAPID_ACTING, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt index 16b5a6dbc3..2690a826aa 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt @@ -47,7 +47,7 @@ class InsulinOrefUltraRapidActingPluginTest { @Test fun getIdTest() { - assertEquals(InsulinInterface.OREF_ULTRA_RAPID_ACTING, sut.id) + assertEquals(InsulinInterface.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt index f410b29a94..3c0e5168bb 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt @@ -5,11 +5,13 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.IobCobCalculatorInterface import info.nightscout.androidaps.interfaces.PluginDescription +import info.nightscout.androidaps.interfaces.SensitivityInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP +import org.json.JSONObject import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -28,6 +30,13 @@ class AbstractSensitivityPluginTest : TestBase() { override fun detectSensitivity(plugin: IobCobCalculatorInterface, fromTime: Long, toTime: Long): AutosensResult { return AutosensResult() } + + override val id: SensitivityInterface.SensitivityType + get() = SensitivityInterface.SensitivityType.UNKNOWN + + override fun configuration(): JSONObject = JSONObject() + + override fun applyConfiguration(configuration: JSONObject) { } } @Test diff --git a/build.gradle b/build.gradle index 481c61c128..a7ce6acdb8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { - kotlin_version = '1.4.10' + kotlin_version = '1.4.20' coreVersion = '1.3.2' rxjava_version = '2.2.19' rxandroid_version = '2.1.1' @@ -17,12 +17,19 @@ buildscript { nav_version = '2.3.1' appcompat_verison = '1.2.0' material_version = '1.2.1' - constraintlayout_version = '2.0.2' + constraintlayout_version = '2.0.4' preferencektx_version = '1.1.1' commonslang3_version = '3.11' work_version = '2.4.0' junit_version = '4.13.1' + powermockVersion = "1.7.3" + dexmakerVersion = "1.2" + retrofit2Version = '2.9.0' + okhttp3Version = '4.9.0' + + androidx_junit = '1.1.2' + androidx_rules = '1.3.1-alpha02' } repositories { google() @@ -31,7 +38,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.1.1' classpath 'com.google.gms:google-services:4.3.4' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -54,6 +61,7 @@ allprojects { artifact '/[organisation]/[module]/archive/[revision].[ext]' } } + maven { url 'https://jitpack.io' } } //Support @JvmDefault tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { diff --git a/core/build.gradle b/core/build.gradle index 6bde574fca..3a6c570b66 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -39,52 +39,5 @@ android { } } -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation 'androidx.biometric:biometric:1.0.1' - implementation "androidx.activity:activity:${activityVersion}" - implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "com.google.android.material:material:$material_version" - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" - annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" - annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" - kapt "com.google.dagger:dagger-android-processor:$dagger_version" - kapt "com.google.dagger:dagger-compiler:$dagger_version" - - //Logger - implementation 'org.slf4j:slf4j-api:1.7.30' - //Fabric - implementation platform('com.google.firebase:firebase-bom:25.12.0') - implementation "com.google.firebase:firebase-analytics-ktx" - implementation "com.google.firebase:firebase-crashlytics-ktx" - implementation "com.google.firebase:firebase-messaging-ktx" - - //RxBus - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - implementation "org.apache.commons:commons-lang3:$commonslang3_version" - - //CryptoUtil - implementation 'com.madgag.spongycastle:core:1.58.0.0' - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - //DateUtil - implementation 'net.danlew:android.joda:2.10.6' - - //db - implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}" - implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}" - - // pumpCommon - implementation "com.google.code.gson:gson:2.8.6" - - testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} +apply from: 'core_dependencies.gradle' \ No newline at end of file diff --git a/core/core_dependencies.gradle b/core/core_dependencies.gradle new file mode 100644 index 0000000000..d0333440b9 --- /dev/null +++ b/core/core_dependencies.gradle @@ -0,0 +1,120 @@ +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" + api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" + api "androidx.core:core-ktx:$coreVersion" + api 'androidx.legacy:legacy-support-v13:1.0.0' + api 'androidx.legacy:legacy-support-v4:1.0.0' + api "androidx.appcompat:appcompat:$appcompat_verison" + api "androidx.preference:preference-ktx:$preferencektx_version" + api 'androidx.biometric:biometric:1.0.1' + api "androidx.activity:activity-ktx:${activityVersion}" + api "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0" + api 'androidx.cardview:cardview:1.0.0' + api 'androidx.recyclerview:recyclerview:1.1.0' + api 'androidx.gridlayout:gridlayout:1.0.0' + api 'androidx.percentlayout:percentlayout:1.0.0' + api "com.google.android.material:material:$material_version" + + api "com.google.dagger:dagger-android:$dagger_version" + api "com.google.dagger:dagger-android-support:$dagger_version" + annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" + annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" + kapt "com.google.dagger:dagger-android-processor:$dagger_version" + kapt "com.google.dagger:dagger-compiler:$dagger_version" + + //Logger + api 'org.slf4j:slf4j-api:1.7.30' + api("com.github.tony19:logback-android-classic:1.1.1-6") { + exclude group: "com.google.android", module: "android" + } + + //Firebase + api platform('com.google.firebase:firebase-bom:25.12.0') + api "com.google.firebase:firebase-analytics-ktx" + api "com.google.firebase:firebase-crashlytics-ktx" + api "com.google.firebase:firebase-messaging-ktx" + api 'com.google.firebase:firebase-auth-ktx' + api 'com.google.firebase:firebase-database-ktx' + + //RxBus + api "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" + api "org.apache.commons:commons-lang3:$commonslang3_version" + + //CryptoUtil + api 'com.madgag.spongycastle:core:1.58.0.0' + + // Graphview cannot be upgraded + api "com.jjoe64:graphview:4.0.1" + + //DateUtil + api 'net.danlew:android.joda:2.10.6' + + //db + api "com.j256.ormlite:ormlite-core:${ormLiteVersion}" + api "com.j256.ormlite:ormlite-android:${ormLiteVersion}" + + // pumpCommon + api "com.google.code.gson:gson:2.8.6" + + // don't kill my app + api('dev.doubledot.doki:library:0.0.1@aar') { + transitive = true + } + + //WorkManager + api "androidx.work:work-runtime:$work_version" + api "androidx.work:work-runtime-ktx:$work_version" + api "androidx.work:work-rxjava2:$work_version" + api 'com.google.androidbrowserhelper:androidbrowserhelper:2.0.1' + api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' + + // new for tidepool + api "com.squareup.okhttp3:okhttp:$okhttp3Version" + api "com.squareup.okhttp3:logging-interceptor:$okhttp3Version" + api "com.squareup.retrofit2:retrofit:$retrofit2Version" + api "com.squareup.retrofit2:adapter-rxjava2:$retrofit2Version" + api "com.squareup.retrofit2:converter-gson:$retrofit2Version" + + api "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" + api 'net.danlew:android.joda:2.10.6' + + api "androidx.fragment:fragment-ktx:${fragmentktx_version}" + api "androidx.constraintlayout:constraintlayout:$constraintlayout_version" + api 'androidx.navigation:navigation-runtime-ktx:2.3.1' + api "androidx.navigation:navigation-fragment-ktx:$nav_version" + api "androidx.navigation:navigation-ui-ktx:$nav_version" + + api 'com.google.android.gms:play-services-wearable:17.0.0' + api 'com.google.android.gms:play-services-location:17.1.0' + + api("com.google.android:flexbox:0.3.0") { + exclude group: "com.android.support" + } + api("io.socket:socket.io-client:1.0.0") { + // excluding org.json which is provided by Android + exclude group: "org.json", module: "json" + } + + api('com.google.guava:guava:30.0-jre') { + exclude group: "com.google.code.findbugs", module: "jsr305" + } + api 'com.google.code.findbugs:jsr305:3.0.2' + + api 'org.mozilla:rhino:1.7.13' + + api 'com.github.DavidProdinger:weekdays-selector:1.1.0' + + api 'com.github.kenglxn.QRGen:android:2.6.0' + api 'com.eatthepath:java-otp:0.2.0' + + // Phone checker + api 'com.scottyab:rootbeer-lib:0.0.8' + + testImplementation "junit:junit:$junit_version" + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java b/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java index cfee68be27..ccb83b9781 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java +++ b/core/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java @@ -63,7 +63,7 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface { public int durationInMinutes = 0; // duration == 0 means end of extended bolus @DatabaseField - public int insulinInterfaceID = InsulinInterface.OREF_RAPID_ACTING; + public int insulinInterfaceID = InsulinInterface.InsulinType.OREF_RAPID_ACTING.getValue(); @DatabaseField public double dia = Constants.defaultDIA; diff --git a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java index 4aec4f1d56..9f179c168b 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java +++ b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java @@ -65,7 +65,7 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase { public boolean isSMB = false; @DatabaseField - public int insulinInterfaceID = InsulinInterface.OREF_RAPID_ACTING; // currently unused, will be used in the future + public int insulinInterfaceID = InsulinInterface.InsulinType.OREF_RAPID_ACTING.getValue(); // currently unused, will be used in the future @DatabaseField public double dia = Constants.defaultDIA; // currently unused, will be used in the future @DatabaseField diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt index 9d2035b279..aba0f3be62 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt @@ -1,8 +1,5 @@ package info.nightscout.androidaps.dialogs -import android.content.Context -import android.content.Intent -import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -13,11 +10,13 @@ import dagger.android.support.DaggerDialogFragment import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.core.R import info.nightscout.androidaps.logging.AAPSLogger -import info.nightscout.androidaps.services.AlarmSoundService +import info.nightscout.androidaps.services.AlarmSoundServiceHelper import kotlinx.android.synthetic.main.dialog_error.* import javax.inject.Inject class ErrorDialog : DaggerDialogFragment() { + + @Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper @Inject lateinit var aapsLogger: AAPSLogger var helperActivity: ErrorHelperActivity? = null @@ -80,17 +79,10 @@ class ErrorDialog : DaggerDialogFragment() { } private fun startAlarm() { - if (sound != 0) { - val alarm = Intent(context, AlarmSoundService::class.java) - alarm.putExtra("soundid", sound) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context?.startForegroundService(alarm) - } else { - context?.startService(alarm) - } - } + if (sound != 0) + context?.let { context -> alarmSoundServiceHelper.startAlarm(context, sound) } } private fun stopAlarm() = - context?.stopService(Intent(context, AlarmSoundService::class.java)) + context?.let { context -> alarmSoundServiceHelper.stopService(context) } } diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.java b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.java deleted file mode 100644 index 16bdb6a677..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -package info.nightscout.androidaps.interfaces; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; - -public interface ActivePluginProvider { - - @NotNull BgSourceInterface getActiveBgSource(); // Forced to Dexcom - - @NotNull ProfileInterface getActiveProfileInterface(); // Forced to LocalProfile if not changed - - @NotNull InsulinInterface getActiveInsulin(); // Forced to RapidActing if not changed - - @NotNull APSInterface getActiveAPS(); // Forced to SMB - - @NotNull PumpInterface getActivePump(); // Use in places not reachable without active pump. Otherwise IllegalStateException is thrown - - @NotNull SensitivityInterface getActiveSensitivity(); // Forced to oref1 if not changed - - @NotNull TreatmentsInterface getActiveTreatments(); // Forced to treatments - - @NotNull ArrayList getPluginsList(); - - @NotNull ArrayList getSpecificPluginsVisibleInListByInterface(Class interfaceClass, PluginType type); - - @NotNull ArrayList getSpecificPluginsVisibleInList(PluginType type); - - @NotNull ArrayList getSpecificPluginsListByInterface(Class interfaceClass); - -// @NotNull ArrayList getSpecificPluginsVisibleInList(Class interfaceClass); - - void verifySelectionInCategories(); -} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt new file mode 100644 index 0000000000..ba13cd3888 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ActivePluginProvider.kt @@ -0,0 +1,22 @@ +package info.nightscout.androidaps.interfaces + +import java.util.* + +interface ActivePluginProvider { + + val activeBgSource: BgSourceInterface // Forced to Dexcom + val activeProfileInterface: ProfileInterface // Forced to LocalProfile if not changed + val activeInsulin: InsulinInterface // Forced to RapidActing if not changed + val activeAPS: APSInterface // Forced to SMB + val activePump: PumpInterface // Use in places not reachable without active pump. Otherwise IllegalStateException is thrown + val activeSensitivity: SensitivityInterface // Forced to oref1 if not changed + val activeTreatments: TreatmentsInterface // Forced to treatments + val activeOverview: OverviewInterface // Forced to overview + + fun getPluginsList(): ArrayList + + fun getSpecificPluginsVisibleInListByInterface(interfaceClass: Class<*>, type: PluginType): ArrayList + fun getSpecificPluginsVisibleInList(type: PluginType): ArrayList + fun getSpecificPluginsListByInterface(interfaceClass: Class<*>): ArrayList + fun verifySelectionInCategories() +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt index effafb788a..6b248fd7dc 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt @@ -2,4 +2,5 @@ package info.nightscout.androidaps.interfaces interface ConfigBuilderInterface { fun storeSettings(from: String) + fun performPluginSwitch(changedPlugin: PluginBase, enabled: Boolean, type: PluginType) } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt new file mode 100644 index 0000000000..5e4cee973b --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigExportImportInterface.kt @@ -0,0 +1,9 @@ +package info.nightscout.androidaps.interfaces + +import org.json.JSONObject + +interface ConfigExportImportInterface { + + fun configuration(): JSONObject + fun applyConfiguration(configuration: JSONObject) +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.java b/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.java deleted file mode 100644 index caeb77de9a..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.java +++ /dev/null @@ -1,24 +0,0 @@ -package info.nightscout.androidaps.interfaces; - -import info.nightscout.androidaps.data.Iob; -import info.nightscout.androidaps.db.Treatment; - -/** - * Created by mike on 17.04.2017. - */ - -public interface InsulinInterface { - // int FASTACTINGINSULIN = 0; // old model no longer available - // int FASTACTINGINSULINPROLONGED = 1; // old model no longer available - int OREF_RAPID_ACTING = 2; - int OREF_ULTRA_RAPID_ACTING = 3; - int OREF_FREE_PEAK = 4; - int OREF_LYUMJEV = 5; - - - int getId(); - String getFriendlyName(); - String getComment(); - double getDia(); - Iob iobCalcForTreatment(Treatment treatment, long time, double dia); -} diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt new file mode 100644 index 0000000000..28a8ee8d0e --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/InsulinInterface.kt @@ -0,0 +1,30 @@ +package info.nightscout.androidaps.interfaces + +import info.nightscout.androidaps.data.Iob +import info.nightscout.androidaps.db.Treatment +import org.json.JSONObject + +interface InsulinInterface : ConfigExportImportInterface{ + + enum class InsulinType(val value: Int) { + UNKNOWN(-1), + // int FASTACTINGINSULIN = 0; // old model no longer available + // int FASTACTINGINSULINPROLONGED = 1; // old model no longer available + OREF_RAPID_ACTING(2), + OREF_ULTRA_RAPID_ACTING(3), + OREF_FREE_PEAK(4), + OREF_LYUMJEV(5); + + companion object { + private val map = values().associateBy(InsulinType::value) + fun fromInt(type: Int) = map[type] + } + } + + val id: InsulinType + val friendlyName: String + val comment: String + val dia: Double + + fun iobCalcForTreatment(treatment: Treatment, time: Long, dia: Double): Iob +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt new file mode 100644 index 0000000000..7bc6dfa429 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/OverviewInterface.kt @@ -0,0 +1,3 @@ +package info.nightscout.androidaps.interfaces + +interface OverviewInterface : ConfigExportImportInterface \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.java b/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.java deleted file mode 100644 index 04503c5690..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.java +++ /dev/null @@ -1,16 +0,0 @@ -package info.nightscout.androidaps.interfaces; - -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; - -/** - * Created by mike on 24.06.2017. - */ - -public interface SensitivityInterface { - - double MIN_HOURS = 1; - double MIN_HOURS_FULL_AUTOSENS = 4; - - AutosensResult detectSensitivity(IobCobCalculatorInterface plugin, long fromTime, long toTime); - -} diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt new file mode 100644 index 0000000000..7fa096bef4 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/SensitivityInterface.kt @@ -0,0 +1,27 @@ +package info.nightscout.androidaps.interfaces + +import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult +import org.json.JSONObject + +interface SensitivityInterface : ConfigExportImportInterface { + + enum class SensitivityType(val value: Int) { + UNKNOWN(-1), + SENSITIVITY_AAPS(0), + SENSITIVITY_WEIGHTED(1), + SENSITIVITY_OREF1(2); + + companion object { + private val map = values().associateBy(SensitivityType::value) + fun fromInt(type: Int) = map[type] + } + } + + val id: SensitivityType + fun detectSensitivity(plugin: IobCobCalculatorInterface, fromTime: Long, toTime: Long): AutosensResult + + companion object { + const val MIN_HOURS = 1.0 + const val MIN_HOURS_FULL_AUTOSENS = 4.0 + } +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java index e517ef1681..f883c49da7 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/DeviceStatus.java @@ -375,6 +375,7 @@ public class DeviceStatus { public JSONObject iob = null; public int uploaderBattery = 0; public String created_at = null; + public JSONObject configuration = null; public DeviceStatus(AAPSLogger aapsLogger) { this.aapsLogger = aapsLogger; @@ -393,6 +394,7 @@ public class DeviceStatus { record.put("openaps", openaps); if (uploaderBattery != 0) record.put("uploaderBattery", uploaderBattery); if (created_at != null) record.put("created_at", created_at); + if (configuration != null) record.put("configuration", configuration); } catch (JSONException e) { aapsLogger.error("Unhandled exception", e); } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt new file mode 100644 index 0000000000..3eb4d2ab94 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt @@ -0,0 +1,85 @@ +package info.nightscout.androidaps.plugins.configBuilder + +import info.nightscout.androidaps.core.R +import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface +import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.SensitivityInterface +import info.nightscout.androidaps.logging.AAPSLogger +import info.nightscout.androidaps.logging.LTag +import info.nightscout.androidaps.plugins.pump.common.defs.PumpType +import info.nightscout.androidaps.utils.JsonHelper +import info.nightscout.androidaps.utils.sharedPreferences.SP +import org.json.JSONException +import org.json.JSONObject +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class RunningConfiguration @Inject constructor( + private val activePlugin: ActivePluginProvider, + private val configBuilder: ConfigBuilderInterface, + private val sp: SP, + private val aapsLogger: AAPSLogger +) { + + private var counter = 0 + private val every = 20 // Send only every 20 devicestatus to save traffic + + // called in AAPS mode only + fun configuration(): JSONObject { + val json = JSONObject() + if (counter++ % every == 0) + try { + val insulinInterface = activePlugin.activeInsulin + val sensitivityInterface = activePlugin.activeSensitivity + val pumpInterface = activePlugin.activePump + val overviewInterface = activePlugin.activeOverview + + json.put("insulin", insulinInterface.id.value) + json.put("insulinConfiguration", insulinInterface.configuration()) + json.put("sensitivity", sensitivityInterface.id.value) + json.put("sensitivityConfiguration", sensitivityInterface.configuration()) + json.put("overviewConfiguration", overviewInterface.configuration()) + json.put("pump", pumpInterface.model().description) + } catch (e: JSONException) { + aapsLogger.error("Unhandled exception", e) + } + return json + } + + // called in NSClient mode only + fun apply(configuration: JSONObject) { + val insulin = InsulinInterface.InsulinType.fromInt(JsonHelper.safeGetInt(configuration, "insulin", InsulinInterface.InsulinType.UNKNOWN.value)) + for (p in activePlugin.getSpecificPluginsListByInterface(InsulinInterface::class.java)) { + val insulinPlugin = p as InsulinInterface + if (insulinPlugin.id == insulin) { + if (!p.isEnabled()) { + aapsLogger.debug(LTag.CORE, "Changing insulin plugin to ${insulin.name}") + configBuilder.performPluginSwitch(p, true, PluginType.INSULIN) + } + insulinPlugin.applyConfiguration(configuration.getJSONObject("insulinConfiguration")) + } + } + + val sensitivity = SensitivityInterface.SensitivityType.fromInt(JsonHelper.safeGetInt(configuration, "sensitivity", SensitivityInterface.SensitivityType.UNKNOWN.value)) + for (p in activePlugin.getSpecificPluginsListByInterface(SensitivityInterface::class.java)) { + val sensitivityPlugin = p as SensitivityInterface + if (sensitivityPlugin.id == sensitivity) { + if (!p.isEnabled()) { + aapsLogger.debug(LTag.CORE, "Changing sensitivity plugin to ${sensitivity.name}") + configBuilder.performPluginSwitch(p, true, PluginType.SENSITIVITY) + } + sensitivityPlugin.applyConfiguration(configuration.getJSONObject("sensitivityConfiguration")) + } + } + + val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GenericAAPS.description) + sp.putString(R.string.key_virtualpump_type, pumpType) + activePlugin.activePump.pumpDescription.setPumpDescription(PumpType.getByDescription(pumpType)) + + if (configuration.has("overviewConfiguration")) + activePlugin.activeOverview.applyConfiguration(configuration.getJSONObject("overviewConfiguration")) + } +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java b/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java index 199ef4014c..fde4728952 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java @@ -42,10 +42,10 @@ import info.nightscout.androidaps.interfaces.ProfileStore; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.UploadQueueInterface; import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.aps.loop.APSResult; import info.nightscout.androidaps.plugins.aps.loop.DeviceStatus; +import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration; import info.nightscout.androidaps.receivers.ReceiverStatusStore; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.JsonHelper; @@ -65,6 +65,7 @@ public class NSUpload { private final Context context; private final UploadQueueInterface uploadQueue; private final DatabaseHelperInterface databaseHelper; + private final RunningConfiguration runningConfiguration; @Inject public NSUpload( @@ -74,6 +75,7 @@ public class NSUpload { SP sp, Context context, UploadQueueInterface uploadQueue, + RunningConfiguration runningConfiguration, DatabaseHelperInterface databaseHelper ) { this.injector = injector; @@ -82,6 +84,7 @@ public class NSUpload { this.sp = sp; this.context = context; this.uploadQueue = uploadQueue; + this.runningConfiguration = runningConfiguration; this.databaseHelper = databaseHelper; } @@ -249,6 +252,9 @@ public class NSUpload { deviceStatus.uploaderBattery = batteryLevel; deviceStatus.created_at = DateUtil.toISOString(new Date()); + + deviceStatus.configuration = runningConfiguration.configuration(); + uploadQueue.add(new DbRequest("dbAdd", "devicestatus", deviceStatus.mongoRecord())); } catch (JSONException e) { aapsLogger.error("Unhandled exception", e); diff --git a/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.kt b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.kt index 6da80cf330..58ae6f6f33 100644 --- a/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.kt +++ b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.media.AudioManager import android.media.MediaPlayer +import android.os.Binder import android.os.Handler import android.os.IBinder import dagger.android.DaggerService @@ -18,6 +19,7 @@ import kotlin.math.ln import kotlin.math.pow class AlarmSoundService : DaggerService() { + @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var notificationHolder: NotificationHolderInterface @@ -27,6 +29,7 @@ class AlarmSoundService : DaggerService() { private var resourceId = R.raw.error companion object { + private const val VOLUME_INCREASE_STEPS = 40 // Total number of steps to increase volume with private const val VOLUME_INCREASE_INITIAL_SILENT_TIME_MILLIS = 3_000L // Number of milliseconds that the notification should initially be silent private const val VOLUME_INCREASE_BASE_DELAY_MILLIS = 15_000 // Base delay between volume increments @@ -41,23 +44,31 @@ class AlarmSoundService : DaggerService() { } + inner class LocalBinder : Binder() { + + fun getService(): AlarmSoundService = this@AlarmSoundService + } + + private val binder = LocalBinder() + override fun onBind(intent: Intent): IBinder = binder + private val increaseVolumeHandler = Handler() private var currentVolumeLevel = 0 - override fun onBind(intent: Intent): IBinder? = null - override fun onCreate() { super.onCreate() - aapsLogger.debug(LTag.CORE, "onCreate") + aapsLogger.debug(LTag.CORE, "onCreate parent called") startForeground(notificationHolder.notificationID, notificationHolder.notification) + aapsLogger.debug(LTag.CORE, "onCreate End") } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + aapsLogger.debug(LTag.CORE, "onStartCommand") startForeground(notificationHolder.notificationID, notificationHolder.notification) + aapsLogger.debug(LTag.CORE, "onStartCommand Foreground called") player?.let { if (it.isPlaying) it.stop() } - aapsLogger.debug(LTag.CORE, "onStartCommand") if (intent?.hasExtra("soundid") == true) resourceId = intent.getIntExtra("soundid", R.raw.error) player = MediaPlayer() try { @@ -80,19 +91,19 @@ class AlarmSoundService : DaggerService() { } catch (e: Exception) { aapsLogger.error("Unhandled exception", e) } + aapsLogger.debug(LTag.CORE, "onStartCommand End") return START_STICKY } override fun onDestroy() { + aapsLogger.debug(LTag.CORE, "onDestroy") increaseVolumeHandler.removeCallbacks(volumeUpdater) player?.stop() player?.release() - aapsLogger.debug(LTag.CORE, "onDestroy") + aapsLogger.debug(LTag.CORE, "onDestroy End") } - private fun getAudioManager(): AudioManager { - return getSystemService(Context.AUDIO_SERVICE) as AudioManager - } + private fun getAudioManager() = getSystemService(Context.AUDIO_SERVICE) as AudioManager // TODO replace with VolumeShaper when min API level >= 26 private val volumeUpdater = object : Runnable { diff --git a/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt new file mode 100644 index 0000000000..243dcb5872 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt @@ -0,0 +1,78 @@ +package info.nightscout.androidaps.services + +import android.content.ComponentName +import android.content.Context +import android.content.Intent +import android.content.ServiceConnection +import android.os.Build +import android.os.IBinder +import info.nightscout.androidaps.interfaces.NotificationHolderInterface +import javax.inject.Inject +import javax.inject.Singleton + +/* + This code replaces following + val alarm = Intent(context, AlarmSoundService::class.java) + alarm.putExtra("soundid", n.soundId) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(alarm) else context.startService(alarm) + + it fails randomly with error + Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{e317f7e u0 info.nightscout.nsclient/info.nightscout.androidaps.services.AlarmSoundService} + + */ +@Singleton +class AlarmSoundServiceHelper @Inject constructor( + private val notificationHolder: NotificationHolderInterface +) { + + fun startAlarm(context: Context, sound: Int) { + val connection = object : ServiceConnection { + override fun onServiceConnected(name: ComponentName?, service: IBinder?) { + // The binder of the service that returns the instance that is created. + val binder: AlarmSoundService.LocalBinder = service as AlarmSoundService.LocalBinder + + val alarmSoundService: AlarmSoundService = binder.getService() + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(getServiceIntent(context, sound)) + else + context.startService(getServiceIntent(context, sound)) + + // This is the key: Without waiting Android Framework to call this method + // inside Service.onCreate(), immediately call here to post the notification. + alarmSoundService.startForeground(notificationHolder.notificationID, notificationHolder.notification) + + // Release the connection to prevent leaks. + context.unbindService(this) + } + + override fun onServiceDisconnected(name: ComponentName?) { + TODO("Not yet implemented") + } + } + + try { + context.bindService(getServiceIntent(context, sound), connection, Context.BIND_AUTO_CREATE) + } catch (ignored: RuntimeException) { + // This is probably a broadcast receiver context even though we are calling getApplicationContext(). + // Just call startForegroundService instead since we cannot bind a service to a + // broadcast receiver context. The service also have to call startForeground in + // this case. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(getServiceIntent(context, sound)) + else + context.startService(getServiceIntent(context, sound)) + } + } + + fun stopService(context: Context) { + val alarm = Intent(context, AlarmSoundService::class.java) + context.stopService(alarm) + } + + private fun getServiceIntent(context: Context, sound: Int): Intent { + val alarm = Intent(context, AlarmSoundService::class.java) + alarm.putExtra("soundid", sound) + return alarm + } +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt b/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt new file mode 100644 index 0000000000..d1e6947e74 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt @@ -0,0 +1,65 @@ +package info.nightscout.androidaps.utils + +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListUpdateCallback +import androidx.recyclerview.widget.RecyclerView + +open class ListDiffCallback(private val newItems: List, private val oldItems: List) : DiffUtil.Callback() { + + override fun getOldListSize(): Int = oldItems.size + + override fun getNewListSize(): Int = newItems.size + + /** + * Called by the DiffUtil to decide whether two object represent the same Item. + *

+ * For example, if your items have unique ids, this method should check their id equality. + * + * @param oldItemPosition The position of the item in the old list + * @param newItemPosition The position of the item in the new list + * @return True if the two items represent the same object or false if they are different. + */ + override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = + newItems[newItemPosition] == oldItems[oldItemPosition] + + /** + * Called by the DiffUtil when it wants to check whether two items have the same data. + * DiffUtil uses this information to detect if the contents of an item has changed. + *

+ * DiffUtil uses this method to check equality instead of {@link Object#equals(Object)} + * so that you can change its behavior depending on your UI. + * For example, if you are using DiffUtil with a + * {@link RecyclerView.Adapter RecyclerView.Adapter}, you should + * return whether the items' visual representations are the same. + *

+ * This method is called only if {@link #areItemsTheSame(int, int)} returns + * {@code true} for these items. + * + * @param oldItemPosition The position of the item in the old list + * @param newItemPosition The position of the item in the new list which replaces the + * oldItem + * @return True if the contents of the items are the same or false if they are different. + */ + override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = + newItems[newItemPosition] == oldItems[oldItemPosition] +} + +class ListUpdateCallbackHelper(val adapter: RecyclerView.Adapter<*>, val insertCallback: (Int) -> Unit) : ListUpdateCallback { + + override fun onChanged(position: Int, count: Int, payload: Any?) { + adapter.notifyItemRangeChanged(position, count, payload) + } + + override fun onInserted(position: Int, count: Int) { + adapter.notifyItemRangeInserted(position, count) + insertCallback(position) + } + + override fun onMoved(fromPosition: Int, toPosition: Int) { + adapter.notifyItemMoved(fromPosition, toPosition) + } + + override fun onRemoved(position: Int, count: Int) { + adapter.notifyItemRangeRemoved(position, count) + } +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/utils/extensions/JSONObjectExt.kt b/core/src/main/java/info/nightscout/androidaps/utils/extensions/JSONObjectExt.kt new file mode 100644 index 0000000000..33ed290c5e --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/utils/extensions/JSONObjectExt.kt @@ -0,0 +1,48 @@ +package info.nightscout.androidaps.utils.extensions + +import androidx.annotation.StringRes +import info.nightscout.androidaps.utils.resources.ResourceHelper +import info.nightscout.androidaps.utils.sharedPreferences.SP +import org.json.JSONObject + +fun JSONObject.putInt(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject = + if (sp.contains(key)) put(resourceHelper.gs(key), sp.getInt(key, 0)) else this + +fun JSONObject.putLong(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject = + if (sp.contains(key)) put(resourceHelper.gs(key), sp.getLong(key, 0)) else this + +fun JSONObject.putDouble(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject = + if (sp.contains(key)) put(resourceHelper.gs(key), sp.getDouble(key, 0.0)) else this + +fun JSONObject.putString(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject = + if (sp.contains(key)) put(resourceHelper.gs(key), sp.getString(key, "")) else this + +fun JSONObject.putBoolean(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject = + if (sp.contains(key)) put(resourceHelper.gs(key), sp.getBoolean(key, false)) else this + +fun JSONObject.storeInt(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject { + if (has(resourceHelper.gs(key))) sp.putInt(key, getInt(resourceHelper.gs(key))) + return this +} + +fun JSONObject.storeLong(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject { + if (has(resourceHelper.gs(key))) sp.putLong(key, getLong(resourceHelper.gs(key))) + return this +} + +fun JSONObject.storeDouble(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject { + if (has(resourceHelper.gs(key))) sp.putDouble(key, getDouble(resourceHelper.gs(key))) + return this +} + +fun JSONObject.storeString(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject { + if (has(resourceHelper.gs(key))) sp.putString(key, getString(resourceHelper.gs(key))) + return this +} + +fun JSONObject.storeBoolean(@StringRes key: Int, sp: SP, resourceHelper: ResourceHelper): JSONObject { + if (has(resourceHelper.gs(key))) sp.putBoolean(key, getBoolean(resourceHelper.gs(key))) + return this +} + + diff --git a/core/src/main/res/values-bg-rBG/strings.xml b/core/src/main/res/values-bg-rBG/strings.xml index 37464462bd..1c031c2e51 100644 --- a/core/src/main/res/values-bg-rBG/strings.xml +++ b/core/src/main/res/values-bg-rBG/strings.xml @@ -170,6 +170,7 @@ Изчаква резултат от помпата SMB + %1$dгр допълнителни въглехидрати ще са необходими до %2$d минути Статистика Комулативна TDD diff --git a/core/src/main/res/values-nl-rNL/strings.xml b/core/src/main/res/values-nl-rNL/strings.xml index 54f299ecf4..73acf29ae2 100644 --- a/core/src/main/res/values-nl-rNL/strings.xml +++ b/core/src/main/res/values-nl-rNL/strings.xml @@ -170,6 +170,7 @@ Wachtend op resultaat SMB + %1$d g extra koolhydraten nodig binnen %2$d minuten Statistieken Cumulatieve TDD diff --git a/core/src/main/res/values-sk-rSK/strings.xml b/core/src/main/res/values-sk-rSK/strings.xml index 453614d602..0dcf0162f3 100644 --- a/core/src/main/res/values-sk-rSK/strings.xml +++ b/core/src/main/res/values-sk-rSK/strings.xml @@ -170,6 +170,7 @@ Čakanie na výsledok SMB + %1$d g dodatočných sacharidov požadovaných v priebehu %2$d minút Štatistiky Kumulatívny TDD diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 87e58a0b45..daca62fb65 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -27,6 +27,8 @@ missed_bg_readings_threshold gradually_increase_notification_volume ns_sync_use_absolute + virtualpump_type + QuickWizard Error diff --git a/dana/build.gradle b/dana/build.gradle index c7b03630d0..cdeb8d9bc3 100644 --- a/dana/build.gradle +++ b/dana/build.gradle @@ -43,33 +43,13 @@ dependencies { implementation project(':core') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - - implementation 'net.danlew:android.joda:2.10.6' - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/danar/build.gradle b/danar/build.gradle index be3f1d96ef..f4583508f7 100644 --- a/danar/build.gradle +++ b/danar/build.gradle @@ -45,32 +45,13 @@ dependencies { implementation project(':dana') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation 'net.danlew:android.joda:2.10.6' - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" - //RxBus - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/danars/build.gradle b/danars/build.gradle index a7f88c5795..87b0026fab 100644 --- a/danars/build.gradle +++ b/danars/build.gradle @@ -44,33 +44,16 @@ dependencies { implementation project(':dana') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation 'net.danlew:android.joda:2.10.6' - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" - //RxBus - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/medtronic/build.gradle b/medtronic/build.gradle index 6637c94d4d..d45bced541 100644 --- a/medtronic/build.gradle +++ b/medtronic/build.gradle @@ -44,40 +44,13 @@ dependencies { implementation project(':rileylink') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "com.google.android.material:material:$material_version" - - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" - - // medtronic - start - implementation "org.apache.commons:commons-lang3:$commonslang3_version" - implementation 'net.danlew:android.joda:2.10.6' - implementation 'org.slf4j:slf4j-api:1.7.30' - implementation "com.google.code.gson:gson:2.8.6" - // medtronic - end - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/omnipod/build.gradle b/omnipod/build.gradle index 46f11bf653..5e2efbf15b 100644 --- a/omnipod/build.gradle +++ b/omnipod/build.gradle @@ -3,10 +3,6 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -ext { - powermockVersion = "1.7.3" -} - android { compileSdkVersion 28 @@ -45,11 +41,9 @@ android { allprojects { repositories { - jcenter() flatDir { dirs 'libs' } - maven { url 'https://jitpack.io' } } } @@ -58,51 +52,17 @@ dependencies { implementation project(':rileylink') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment-ktx:${fragmentktx_version}" - implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" - implementation "com.google.android.material:material:$material_version" - - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" - - implementation "org.apache.commons:commons-lang3:$commonslang3_version" - implementation 'net.danlew:android.joda:2.10.6' - implementation "com.google.code.gson:gson:2.8.6" - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" - implementation 'androidx.navigation:navigation-runtime:2.3.1' annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" - // Navigation - implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" - implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - - implementation "com.google.android.material:material:$material_version" - testImplementation "junit:junit:$junit_version" testImplementation "org.mockito:mockito-core:2.8.47" testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion" testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" testImplementation 'joda-time:joda-time:2.10.6' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt index d877481c46..43d032991d 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt @@ -217,7 +217,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() { } private fun displayNotConfiguredDialog() { - context?.let { + context.let { UIRunnable(Runnable { OKDialog.show(it, resourceHelper.gs(R.string.omnipod_warning), resourceHelper.gs(R.string.omnipod_error_operation_not_possible_no_configuration), null) diff --git a/omnipod/src/main/res/values-bg-rBG/strings.xml b/omnipod/src/main/res/values-bg-rBG/strings.xml index 9af491cd61..0671b745a1 100644 --- a/omnipod/src/main/res/values-bg-rBG/strings.xml +++ b/omnipod/src/main/res/values-bg-rBG/strings.xml @@ -7,8 +7,9 @@ Звук при базал активен Звук при SMB активен Звук при временен базал активен - Бутон за спиране на инсулина активен - Разрешено е бутонът за Pulse Log + Показвай спряна доставката в раздела Omnipod + Показване на PULSE LOG в менюто на Pod Management + Бутон Показване RileyLink Stats в меню Управление на Pod Разрешено е Лятно часово време Напомняне за срок Часове преди изключване @@ -17,6 +18,7 @@ Сигнал при неясни TBR известия, разрешен Сигнал при неясни SMB известия, разрешен Сигнал при неясни болус известия, разрешен + Не показвай Pod алармите RileyLink Друго Известия @@ -31,6 +33,7 @@ Грешка в под Времето за активация изтече Неактивен + Грешка на под: %1$03d %2$s Край на напомняне за сдвояване Край на напомнянето за настройка @@ -84,6 +87,7 @@ Неизвестна команда: %1$s Неуспешно прочитане на Pulse Log Неуспешно опресняване на състояние + Неуспешно опресняване на състоянието при стартиране Неуспешно спиране на аларми Неуспешно спиране на болус Неуспешно задаване на време @@ -96,6 +100,9 @@ Неуспешно вмъкване на канюла Времето за активиране на капсулата е превишено. Капсулата вече не може да бъде активирана. Неуспешно проверяване на прогреса на активиране. Моля, опитайте отново. + Pod изключен + Неуспешно възпроизвеждане на тест-звук + В Pod има пуснат временен базал но AAPS не знае за него. Моля, отменете временния си базал ръчно. Потвърждение Време и/или промяна на часовата зона на помпата. @@ -126,6 +133,8 @@ Вземи лога Поставете фалшив временен базал, защото Pod е спряно Анулират фалшив временен базал, който е създаден, защото Pod е спряно + Конфигуразия на звук + Възпроизвеждане на тестов звук Управление на Pod Изчакване на RileyLink връзка… @@ -133,7 +142,12 @@ Деактивирай Pod Премахни Pod История в Pod - Ако натиснете OK, състоянието на Pod ще бъде нулирано и няма да можете да общувате с него повече. Правете това, само ако вече не можете да се свързвате с него. Ако все още можете да общувате с Pod, моля, използвайте опцията Деактивирай Pod! + RileyLink статистика + Прочети Pulse log + Четене на pulse log… + Ако натиснете OK, състоянието на Pod ще бъде нулирано и няма да можете да общувате с него повече. Правете това, само ако вече не можете да се свързвате с него. Ако все още можете да общувате с Pod, моля, използвайте опцията Деактивирай Pod! + Възпроизвеждане на тестов звук + Пускам тестов звук… Откажи Край @@ -169,8 +183,6 @@ Задаване на часа Спиране - Статистика на RL - Pulse лог Опресни Подновяване на доставката Управление на Pod @@ -219,4 +231,8 @@ %1$d ден %1$d дни + + Pod аларма: %1$s + Pod аларми + diff --git a/omnipod/src/main/res/values-cs-rCZ/strings.xml b/omnipod/src/main/res/values-cs-rCZ/strings.xml index 68e7de2152..7fd6d9468c 100644 --- a/omnipod/src/main/res/values-cs-rCZ/strings.xml +++ b/omnipod/src/main/res/values-cs-rCZ/strings.xml @@ -7,8 +7,9 @@ Pípnutí při bazálu povoleno Pípnutí při SMB povoleno Pípnutí při TBR povoleno - Tlačítko Pozastavit doručení povoleno - Tlačítko Pulse Log je zapnuto + Zobrazit tlačítko \"Pozastavit dodávku\" na záložce Omnipod + Zobrazit tlačítko Pulzní Log v menu Správa Podu + Zobrazit tlačítko Statistika RileyLink v nabídce Správa Podu Letní čas / Detekce časového pásma povoleno Připomenutí vypršení platnosti povoleno Hodiny před vypnutím @@ -86,6 +87,7 @@ Neznámý vlastní příkaz: %1$s Nezdařilo se čtení protokolu pulzů Nebylo možné aktualizovat stav + Nepodařilo se aktualizovat stav při spuštění Nezdařilo se potvrdit výstrahy Nepodařilo se pozastavit výdej Nepodařilo se nastavit čas @@ -99,6 +101,8 @@ Byl překročen čas aktivace Podu. Tento Pod již nelze aktivovat. Ověření procesu aktivace se nezdařilo. Zkuste to znovu. Pod pozastavený + Nepodařilo se přehrát testovací pípnutí + Dočasný bazál běží na Podu, ale AAPS o tomto dočasném bazálu neví. Prosím zrušte svůj dočasný bazál ručně. Potvrzení Čas a/nebo časová zóna změněna na Podu. @@ -129,6 +133,8 @@ Číst protokol pulsů Nastavit falešný dočasný bazál, protože Pod je pozastaven Zrušit falešný dočasný bazál který byl vytvořen, protože Pod byl pozastaven + Nastavení pípnutí + Přehrát testovací pípnutí Správa Podu Čekám na připojení RileyLink… @@ -136,7 +142,12 @@ Deaktivovat Pod Vyřadit Pod Historie Podu - Pokud zahodíte Pod, již s ním nebudete moci komunikovat. Měli byste to udělat pouze tehdy, pokud veškerá komunikace s Podem trvale selhává. Pokud stále můžete komunikovat s Podem, použijte možnost Deaktivovat Pod.\n\nPokud si přejete pokračovat, ujistěte se prosím, že odstraníte Pod z těla! + Statistika RileyLink + Číst protokol pulsů + Čtení protokolu pulsů… + Pokud zahodíte Pod, již s ním nebudete moci komunikovat. Měli byste to udělat pouze tehdy, pokud veškerá komunikace s Podem trvale selhává. Pokud stále můžete komunikovat s Podem, použijte možnost Deaktivovat Pod.\n\nPokud si přejete pokračovat, ujistěte se prosím, že odstraníte Pod z těla! + Přehrát testovací pípnutí + Přehrávání testovacího pípnutí… Zrušit Konec @@ -172,8 +183,6 @@ Nastavení času Pozastavit - Statistika RL - Protokol pulzů Obnovit Obnovit podávání inzulínu Správa Podu diff --git a/omnipod/src/main/res/values-de-rDE/strings.xml b/omnipod/src/main/res/values-de-rDE/strings.xml index db0e214d93..206fd2626c 100644 --- a/omnipod/src/main/res/values-de-rDE/strings.xml +++ b/omnipod/src/main/res/values-de-rDE/strings.xml @@ -7,8 +7,9 @@ Basal-Piep aktiviert SMB-Piep aktiviert TBR-Piep aktiviert - Button Abgabe aussetzen aktiviert - Pulse Log Button aktiviert + Button \'Insulinabgabe unterbrechen\' im Omnipod Tab anzeigen + Button \'Pulse Log\' im Menü Pod Mgmt. anzeigen + Button \'RileyLink Status\' im Menü Pod Mgmt. anzeigen Sommerzeit/Zeitzonen-Erkennung aktiviert Ablauferinnerung aktiviert Stunden bis zum Podende @@ -86,6 +87,7 @@ Unbekannter benutzerdefinierter Befehl: %1$s Fehler beim Lesen des Pulse-Log Status konnte nicht aktualisiert werden. + Status konnte beim Start nicht aktualisiert werden Warnungen konnten nicht bestätigt werden. Insulinabgabe konnte nicht unterbrochen werden. Zeiteinstellung fehlgeschlagen @@ -99,6 +101,8 @@ Die Aktivierungszeit des Pods wurde überschritten. Dieser Pod kann nicht mehr aktiviert werden. Überprüfen des Aktivierungsfortschritts gescheitert. Bitte erneut versuchen. Pod unterbrochen + Test-Piepton konnte nicht abgespielt werden + Auf dem Pod läuft eine temp. Basalrate, aber AAPS kennt diese nicht. Brich die TBR bitte manuell ab. Bestätigung Zeit und/oder Zeitzone auf dem Pod geändert. @@ -129,6 +133,8 @@ Pulse-Log lesen Fake TBR gesetzt, da der Pod pausiert ist. Abbruch der Fake TBR. Diese wurde eingestellt, da der Pod pausiert war. + Piep-Ton Konfiguration + Testton abspielen Pod Management Warte auf Verbindung mit RileyLink… @@ -136,7 +142,12 @@ Pod deaktivieren Pod verwerfen Pod Historie - Wenn Du den Pod verwirfst, kannst Du nicht mehr mit ihm kommunizieren. Mache das nur, wenn jede Kommunikation mit dem Pod dauerhaft fehlschlägt. Falls Du noch mit dem Pod kommunizieren kannst, verwende bitte die Option Pod deaktivieren.\n\nWenn Du fortfahren willst, entferne jetzt den Pod von Deinem Körper! + RileyLink Statistik + Pulse-Log lesen + Lese Puls-Log... + Wenn Du den Pod verwirfst, kannst Du nicht mehr mit ihm kommunizieren. Mache das nur, wenn jede Kommunikation mit dem Pod dauerhaft fehlschlägt. Falls Du noch mit dem Pod kommunizieren kannst, verwende bitte die Option Pod deaktivieren.\n\nWenn Du fortfahren willst, entferne jetzt den Pod von Deinem Körper! + Testton abspielen + Spiele Testton ab.... Abbrechen Beenden @@ -172,8 +183,6 @@ Zeit einstellen Unterbrechen - RL Stats - Pulse Log Aktualisieren Abgabe fortsetzen Pod Mgmt. diff --git a/omnipod/src/main/res/values-fr-rFR/strings.xml b/omnipod/src/main/res/values-fr-rFR/strings.xml index 1bf2e5fe57..68f9959299 100644 --- a/omnipod/src/main/res/values-fr-rFR/strings.xml +++ b/omnipod/src/main/res/values-fr-rFR/strings.xml @@ -7,8 +7,8 @@ Bips basal activés Bips SMB activés Bips DBT activés - Bouton Suspendre l\'injection activé - Bouton Journal d\'impulsions activé + Montrer le bouton Suspendre l\'injection dans l\'onglet Omnipod + Afficher le bouton Journal d\'impulsions dans le menu de gestion des pods Changement de Zone/Heure Activé Rappel d\'expiration activé Heures avant arrêt @@ -86,6 +86,7 @@ Commande personnalisée inconnue : %1$s Échec lecture Journal d\'impulsions Échec pour rafraichir l\'état + Échec pour rafraichir l\'état au démarrage Échec pour confirmer les alertes Échec pour suspendre l\'injection Échec pour définir l\'heure @@ -99,6 +100,8 @@ La durée d\'activation du Pod a été dépassée. Ce Pod ne peut plus être activé. Échec de la vérification de l\'activation. Veuillez réessayer. Pod suspendu + Échec du test des bips + Un basal temporaire est en cours d\'exécution sur le Pod, mais AAPS n\'est pas au courant de ce basal temporaire. Veuillez annuler votre basal temporaire manuellement. Confirmation Heure et/ou fuseau horaire changé sur le Pod. @@ -129,6 +132,8 @@ Lire Journal d\'impulsions Définir un faux débit de basal temporaire car le Pod est suspendu Annuler le faux débit de basal temporaire créé à cause du Pod suspendu + Configuration des bips + Tester les bips Gestion du Pod En attente de connexion RileyLink... @@ -136,7 +141,11 @@ Désactiver le Pod Supprimer le Pod Historique du Pod - Si vous supprimez le Pod, vous ne pourrez plus communiquer avec lui. Vous ne devez le faire que lorsque toutes les communications avec le Pod échouent de manière permanente. Si vous pouvez toujours communiquer avec le Pod, veuillez utiliser l\'option Désactiver le Pod .\n\nSi vous souhaitez continuer, assurez-vous de retirer la Pod de votre corps ! + Lire Journal d\'impulsions + Lecture journal d\'impulsion… + Si vous supprimez le Pod, vous ne pourrez plus communiquer avec lui. Vous ne devez le faire que lorsque toutes les communications avec le Pod échouent de manière permanente. Si vous pouvez toujours communiquer avec le Pod, veuillez utiliser l\'option Désactiver le Pod .\n\nSi vous souhaitez continuer, assurez-vous de retirer la Pod de votre corps ! + Tester les bips + Test des bips… Annuler Terminer @@ -172,11 +181,9 @@ Définir l\'heure Arrêter - État RL - Journal d\'impulsions Actualiser Reprendre l\'injection - Pod mngt + Gest. Pod Accepter les alertes État du Pod Total injecté diff --git a/omnipod/src/main/res/values-it-rIT/strings.xml b/omnipod/src/main/res/values-it-rIT/strings.xml index 1be3afd140..26f79a318a 100644 --- a/omnipod/src/main/res/values-it-rIT/strings.xml +++ b/omnipod/src/main/res/values-it-rIT/strings.xml @@ -7,8 +7,9 @@ BIP basale abilitato BIP SMB abilitato BIP TBR abilitato - Tasto \'sospendi erogazione\' abilitato - Tasto \'log impulsi\' abilitato + Mostra tasto \"sospendi erogazione\" nella scheda Omnipod + Mostra tasto \"log impulsi\" nel menu gestione pod + Mostra tasto \"statistiche RileyLink\" nel menu gestione pod Rilevamento ora legale/fuso orario abilitato Promemoria scadenza abilitato Ore prima dell\'arresto @@ -86,6 +87,7 @@ Comando personalizzato sconosciuto: %1$s Impossibile leggere il log impulsi Impossibile aggiornare lo stato + Impossibile aggiornare lo stato all\'avvio Impossibile confermare gli avvisi Impossibile sospendere l\'erogazione Impossibile impostare l\'ora @@ -99,6 +101,8 @@ Il tempo di attivazione del pod è stato superato. Questo pod non può più essere attivato. Impossibile verificare l\'avanzamento dell\'attivazione. Riprova. Pod sospeso + Impossibile eseguire BIP di test + Una basale temporanea è in esecuzione sul pod, ma AAPS non ne è a conoscenza. Cancella manualmente la tua basale temporanea. Conferma Ora e/o fuso orario cambiati nel pod. @@ -129,6 +133,8 @@ Leggi log impulsi Imposta basale temporanea fittizia perché il pod è sospeso Cancella basale temporanea fittizia creata perché il pod era sospeso + Configurazione BIP + Esegui BIP di test Gestione pod Attesa connessione RileyLink… @@ -136,7 +142,12 @@ Disattiva pod Scarta pod Storico pod - Se scarti il pod, non sarai più in grado di comunicare con esso. Dovresti farlo solo quando tutte le comunicazioni col pod falliscono persistentemente. Se puoi ancora comunicare col pod, usa l\'opzione Disattiva pod.\n\nSe desideri procedere, assicurati di rimuovere il pod dal tuo corpo! + Statistiche RileyLink + Leggi log impulsi + Lettura log impulsi… + Se scarti il pod, non sarai più in grado di comunicare con esso. Dovresti farlo solo quando tutte le comunicazioni col pod falliscono persistentemente. Se puoi ancora comunicare col pod, usa l\'opzione Disattiva pod.\n\nSe desideri procedere, assicurati di rimuovere il pod dal tuo corpo! + Esegui BIP di test + BIP di test in esecuzione… Annulla Fine @@ -172,8 +183,6 @@ Imposta ora Sospendi - Statistiche RL - Log impulsi Aggiorna Riprendi erogazione GSTN pod diff --git a/omnipod/src/main/res/values-iw-rIL/strings.xml b/omnipod/src/main/res/values-iw-rIL/strings.xml index c11c97ae99..71295581c6 100644 --- a/omnipod/src/main/res/values-iw-rIL/strings.xml +++ b/omnipod/src/main/res/values-iw-rIL/strings.xml @@ -7,8 +7,9 @@ צפצופי בזאלי מופעלים צפצופי SMB מופעלים צפצופי בזאלי זמני מופעלים - כפתור השהיית הזרקה מופעל - כפתור יומן פעימות מופעל + הצג לחצן \"השהיית מתן אינסולין\" בלשונית אומניפוד + הצג לחצן \"יומן פעימות\" בתפריט ניהול פוד + הצג לחצן \"סטטיסטיקת ריילילינק\" בתפריט ניהול פוד זיהוי אזור זמן ושעון קיץ מופעל תזכורת לתפוגה מופעלת שעות לפני כיבוי @@ -86,6 +87,7 @@ פקודה מותאמת אישית לא ידועה: %1$s קריאת יומן פעימות נכשלה נסיון עדכון סטטוס נכשל + רענון סטטוס בזמן האתחול נכשל לא ניתן להכיר בהתראות השעיית ההזרקה נכשלה הגדרת הזמן נכשלה @@ -99,6 +101,8 @@ זמן ההפעלה של הפוד חורג. לא ניתן להפעיל את פוד זה יותר. אימות התקדמות ההפעלה נכשל. אנא נסו שנית. הפוד מושהה + השמעת צפצוף בדיקה נכשלה + בזאלי זמני מופעל בפוד אבל AAPS אינו מודע לבזאלי זמני זה. יש לבטל את הבזאלי הזמני באופן ידני. אימות שעה ו/או אזור הזמן השתנו בפוד. @@ -129,14 +133,22 @@ קרא יומן פעימות הגדר בזאלי זמני מזויף כי הפוד מושהה בטל בזאלי זמני מזויף שנוצר מפני שהפוד הושהה + הגדרות צפצוף + השמע צפצוף ניסיון ניהול פוד ממתין לחיבור לריילילינק… הפעלת פוד - השבתת פוד + השבת פוד השלכת פוד היסטוריית הפוד - אם תזרקו את פוד, לא תוכלו לתקשר איתו יותר. כדאי לעשות את זה רק כאשר כל התקשורת עם הניצן תמיד נכשלת. אם אתם עדיין יכולים לתקשר עם הניצן, אנא השתמשו באפשרות השבתה.\n\n אם ברצונכם להמשיך, אנא הקפידו להסיר את הפוד מהגוף! + סטטיסטיקת ריילילינק + קרא יומן פעימות + קורא יומן פעימות… + אם הפוד יושבת, לא יהיה ניתן לתקשר איתו יותר. יש לבצע זאת רק כאשר כל ניסיונות ההתקשרות עם הפוד נכשלים. אם עדיין ניתן לתקשר עם הפוד, יש לבחור באפשרות השבת פוד.\n\n +אם מעוניינים להמשיך, יש לוודא הסרה וניתוק הפוד מהגוף! + השמע צפצוף ניסיון + משמיע צפצוף ניסיון… ביטול סיום @@ -172,8 +184,6 @@ הגדרת שעה השהיה - סטטיסטיקות ריילילינק - יומן פעימות רענן חידוש הזרקה ניהול הפוד diff --git a/omnipod/src/main/res/values-lt-rLT/strings.xml b/omnipod/src/main/res/values-lt-rLT/strings.xml index 2ff2746fa0..329ecb822a 100644 --- a/omnipod/src/main/res/values-lt-rLT/strings.xml +++ b/omnipod/src/main/res/values-lt-rLT/strings.xml @@ -7,8 +7,6 @@ Bazės signalai įjungti SMB signalai įjungti Laikinos bazės signalai įjungti - Įgalintas leidimo sustabdymo mygtukas - Įgalintas Pulse Log mygtukas Vasaros laiko/Laiko juostos aptikimas įgalintas Galiojimo pabaigos priminimas Valandos prieš išsijungimą @@ -18,8 +16,10 @@ Kiti Perspėjimai Patvirtinimo signalai + Pranešimai Nėra aktyvaus Pod + Vykdomas nustatymas (laukiama Pod aktyvavimo) Vykdomas nustatymas (laukiama kaniulės įvedimo) Vykdoma Sustabdyta @@ -35,15 +35,35 @@ Žemas rezervuaro lygis Nežinomas perspėjimas + Pod istorija Aprašymas Šaltinis Data Tipas: + %1$.2f vv + %1$.2f vv, AV=%2$.1f g + Kiekis: %1$.2f vv, trukmė: %2$d min Perspėjimas RileyLink adresas neteisingas. Operacija negalima.\n\n Pirmiausia turite sukonfigūruoti Omnipod pompą prieš atliekant šią operaciją. Nėra aktyvaus Pod + Įvyko netikėta klaida. Prašome pranešti! (%1$s: %2$s). + Ryšio klaida: pranešimo vientisumo patikra nepavyko + Ryšio klaida: netinkami įvesties iš Pod parametrai + Ryšio klaida: Pod būklė yra netinkama + Ryšio klaida: gautas netinkamas atsakymas iš Pod + Ryšio klaida: iš Pod gautas pranešimas su negaliojančiu serijos numeriu + Ryšio klaida: iš Pod gautas pranešimas su netinkamu adresu + Ryšio klaida: nepavyko iššifruoti pranešimo iš Pod + Ryšio klaida: nepavyko iš naujo sinchronizuoti unikalų kodą + Ryšio klaida: unikalus kodas nebuvo sinchronizuotas + Ryšio klaida: iš Pod gauta nepakankamai duomenų + Aptikta Pod klaida (%1$03d %2$s). Deaktyvuokite Pod ir aktyvuokite naują + Ryšio klaida: Pod pateikė klaidos atsakymą + Nėra atsakymo iš RileyLink + RileyLink ryšys pertrauktas + Nėra atsakymo iš Pod Nepavyko nustatyti bazės profilio. Insulino leidimas gali būti nutrauktas! Rankiniu būdu atnaujinkite Pod būseną Omnipod skirtuke ir, jei reikia, atnaujinkite insulino leidimą. Gali būti, kad bazės profilis nebuvo nustatytas. Insulino leidimas gali būti nutrauktas! Rankiniu būdu atnaujinkite Pod būseną Omnipod skirtuke ir, jei reikia, atnaujinkite insulino leidimą. Nepavyko nustatyti bazės profilio. Insulino leidimas buvo sustabdytas! Rankiniu būdu iš Omnipod skirtuko atnaujinkite insulino leidimą. diff --git a/omnipod/src/main/res/values-nl-rNL/strings.xml b/omnipod/src/main/res/values-nl-rNL/strings.xml index 9db3f5e4e3..92e069c673 100644 --- a/omnipod/src/main/res/values-nl-rNL/strings.xml +++ b/omnipod/src/main/res/values-nl-rNL/strings.xml @@ -7,8 +7,9 @@ Basaal pieptonen ingeschakeld SMB pieptonen ingeschakeld Tijdelijk basaal pieptonen ingeschakeld - Knop om insuline toediening te onderbreken ingeschakeld - Pulslog knop ingeschakeld + Knop voor het onderbreken van insulinetoediening weergeven in het Omnipod-tabblad + Knop voor het uitlezen van het Pulslog weergeven in het Podbeheer menu + Knop voor RileyLink statistieken weergeven in het Omnipod-tabblad Zomertijd-/tijdzonedetectie ingeschakeld Pieptonen voor uiterste gebruiksdatum ingeschakeld Aantal uur voordat de Pod stopt @@ -17,6 +18,7 @@ Geluid voor onzekere TBR notificaties ingeschakeld Geluid voor onzekere SMB notificaties ingeschakeld Geluid voor onzekere bolus notificaties ingeschakeld + Podwaarschuwingen automatisch bevestigen RileyLink Overige Waarschuwingen @@ -31,6 +33,7 @@ Pod fout Activatietijd overschreden Inactief + Podfout: %1$03d %2$s Herrinering om Pod initialisatie af te ronden Herinnering setup afronden @@ -84,6 +87,7 @@ Onbekend commando: %1$s Lezen van Pulslog is mislukt Verversen van status is mislukt + Status vernieuwen mislukt bij opstarten Bevestigen van waarschuwingen is mislukt Onderbreken van insulinetoediening is mislukt Instellen van de tijd mislukt @@ -95,6 +99,10 @@ Het initialiseren van de Pod is mislukt Het inbrengen van de canule is mislukt De activeringstijd van de pod is overschreden. Deze Pod kan niet meer geactiveerd worden. + Controleren van activatiestatus is mislukt. Probeer het opnieuw. + Pod onderbroken + Testpiep afspelen mislukt + Er loopt een tijdelijk basaal op de Pod, maar AndroidAPS is zich niet bewust van deze tijdelijke basaal. Annuleer de tijdelijke basal handmatig. Bevestiging Tijd en/of tijdzone gewijzigd op de Pod. @@ -125,6 +133,8 @@ Pulslog lezen Neppe tijdelijk basaal omdat insulinetoediening onderbroken is Annuleren van vals tijdelijk basaal wat ontstaan is omdat de insulinetoediening onderbroken was + Pieptoonconfiguratie + Testpieptoon afspelen Pod beheer Wachten op verbinding met RileyLink… @@ -132,7 +142,12 @@ Deactiveer Pod Pod verwerpen Pod historie - Als je de Pod verwerpt, kun je er niet meer mee communiceren. Doe dit alleen als communicatie met de Pod aanhoudend mislukt. Als je nog steeds kunt communiceren met de Pod, gebruik dan de Pod deactiveren optie.\n\nVerwijder de Pod van de huid als je ervoor kiest om door te gaan! + RileyLink statistieken + Pulslog uitlezen + Pulslog aan het uitlezen… + Als je de Pod verwerpt, kun je er niet meer mee communiceren. Doe dit alleen als communicatie met de Pod aanhoudend mislukt. Als je nog steeds kunt communiceren met de Pod, gebruik dan de Pod deactiveren optie.\n\nVerwijder de Pod van de huid als je ervoor kiest om door te gaan! + Testpieptoon afspelen + Testpieptoon aan het afspelen… Annuleren Voltooien @@ -168,8 +183,6 @@ Tijd instellen Onderbreken - RL stats - Pulslog Vernieuwen Hervat toediening Pod beheer @@ -218,4 +231,8 @@ %1$d dag %1$d dagen + + Pod waarschuwing: %1$s + Podwaarschuwing: %1$s + diff --git a/omnipod/src/main/res/values-no-rNO/strings.xml b/omnipod/src/main/res/values-no-rNO/strings.xml index d5b31a9679..6a863f149a 100644 --- a/omnipod/src/main/res/values-no-rNO/strings.xml +++ b/omnipod/src/main/res/values-no-rNO/strings.xml @@ -7,8 +7,9 @@ Bolus pip aktivert SMB pip aktivert TBR pip aktivert - Deaktiver insulin leveringknapp aktivert - Pulslogg knappen er aktivert + Vis Pause insulintilførsel knapp i Omnipod meny + Vis Puls logg knappen i Pod menyen + Vis RileyLink status knapp i Pod menyen DST/Tidssone deteksjon aktivert Utløpspåminnelse aktivert Timer før nedstenging @@ -86,6 +87,7 @@ Ukjent kommando: %1$s Feilet i å lese Pulsloggen Feilet i å oppdatere status + Feilet i å oppdatere status ved oppstart Feilet i å bekrefte varsler Feilet i å stoppe leveranser Feilet i å angi tid @@ -99,6 +101,8 @@ Pod\'ens aktiveringstid er overskredet. Denne Pod kan ikke lenger aktiveres. Klarte ikke å verifisere fremdrift i aktiveringen. Prøv på nytt. Pod er pauset + Feilet i avspilling av test lyd + En midlertidig basal utføres på Pod, men AAPS har ingen informasjon om denne midlertidige basalen. Vennligst avbryt midlertidig basal manuelt. Bekreftelse Tid og/eller tidssone endret på Pod. @@ -129,6 +133,8 @@ Les pulslogg Angi vilkårlig midlertidig basal fordi Pod er suspendert Avbryt vilkårlig midlertidig basal som er opprettet fordi Pod var suspendert + Oppsett lyd + Avspill test lyd Pod administrasjon Venter på RileyLink tilkobling… @@ -136,7 +142,12 @@ Deaktiver Pod Forkast Pod Pod historikk - Dersom du forkaster Pod, vil du ikke kunne kommunisere med den lenger. Du skal bare gjøre dette når all kommunikasjon med Pod kontinuerlig mislykkes. Hvis du fortsatt kan kommunisere med Pod, bruk alternativet Deaktiver Pod.\n\nHvis du ønsker å fortsette, må du huske på å fjerne Pod fra kroppen din! + RileyLink statistikk + Les Puls logg + Leser puls logg… + Hvis du forkaster Pod vil du ikke være i stand til å gjenopprette kommunikasjonen med den. Du skal bare gjøre dette hvis alle andre forsøk på å gjenopprette kommunikasjonen med Pod har feilet. Hvis du fortsatt kan kommunisere med Pod, vennligst bruk Deaktiver Pod valget.\n\nHvis du ønsker å fortsette, husk på å fjerne Pod fra kroppen din! + Avspill test lyd + Avspiller test lyd… Avbryt Fullfør @@ -172,8 +183,6 @@ Angi tid Pause - RL statistikk - Puls logg Oppdater Fortsett levering Pod håndtering diff --git a/omnipod/src/main/res/values-ro-rRO/strings.xml b/omnipod/src/main/res/values-ro-rRO/strings.xml index 86f9de98c5..9cd9acb97f 100644 --- a/omnipod/src/main/res/values-ro-rRO/strings.xml +++ b/omnipod/src/main/res/values-ro-rRO/strings.xml @@ -7,8 +7,6 @@ Bip pentru Bazală activat Bip pentru SMB activat Bip pentru TBR activat - Butonul \"Suspendare Livrare\" activat - Butonul \"Pulse Log\" activat Detectare fusului orar activată Notificare expirare activat Numar de ore înainte de oprire diff --git a/omnipod/src/main/res/values-ru-rRU/strings.xml b/omnipod/src/main/res/values-ru-rRU/strings.xml index 32e5ab5cfe..95e59b06f9 100644 --- a/omnipod/src/main/res/values-ru-rRU/strings.xml +++ b/omnipod/src/main/res/values-ru-rRU/strings.xml @@ -7,8 +7,9 @@ Звуковой сигнал базала включен Звуковой сигнал микроболюса SMB включен Звуковой сигнал временного базала TBR включен - Кнопка приостановки подачи инсулина активирована - Кнопка журнала событий активирована + Показывать кнопку Приостановить подачу на вкладке Omnipod + Показывать кнопку Pulse Log в меню управления Pod + Показывать кнопку статистики RileyLink в меню управления подом Включено обнаружение часового пояса Включено напоминание об истечении срока действия Часов до выключения @@ -86,6 +87,7 @@ Неизвестная кастомная команда: %1$s Не удалось прочитать журнал pulse Не удалось обновить статус + Не удалось обновить статус при запуске Не удалось подтвердить оповещения Не удалось приостановить подачу Не удалось задать время @@ -99,6 +101,8 @@ Превышено время активации Pod. Этот Pod больше не может быть активирован. Не удалось проверить ход активации. Повторите попытку. Omnipod остановлен + Не удалось воспроизвести тестовый звуковой сигнал + На Поде работает временный базал, но ААПС ничего не знает об этом временном базале. Отмените временный базал вручную. Подтверждение Время и/или часовой пояс изменены на Pod. @@ -129,6 +133,8 @@ Читать журнал импульсов Установить фейковый временный базал, так как Pod остановлен Отменить фейковый временный базал, который был создан из-за приостановки действия Pod + Конфигурация звукового сигнала + Воспроизвести тестовый звуковой сигнал Управление помпой Omnipod Ожидание соединения RileyLink… @@ -136,7 +142,12 @@ Деактивировать Pod Утилизировать Pod Журнал Pod - Если нажать Утилизировать Pod, вы больше не сможете обмениваться командами с Pod. Сделайте это только в том случае, если связь с помпой постоянно отсутствует. Если связь с Pod еще возможна, воспользуйтесь опцией Деактивировать Pod.\n\n Если все же хотите продолжить, снимите помпу с тела! + Статистика RileyLink + Читать журнал импульсов + Чтение журнала импульсов… + Если нажать Утилизировать Pod, вы больше не сможете обмениваться командами с Pod. Сделайте это только в том случае, если связь с помпой постоянно отсутствует. Если связь с Pod еще возможна, воспользуйтесь опцией Деактивировать Pod.\n\n Если все же хотите продолжить, снимите помпу с тела! + Воспроизвести тестовый звуковой сигнал + Воспроизведение тестового звукового сигнала… Отменить Завершить @@ -172,8 +183,6 @@ Установить время Останов - Статистика RL - Журнал Pulse Обновить Возобновить подачу Управление помпой @@ -228,4 +237,10 @@ %1$d дней %1$d дн + + Оповещение Pod: %1$s + Оповещений Pod: %1$s + Оповещений Pod: %1$s + Оповещений Pod: %1$s + diff --git a/omnipod/src/main/res/values-sk-rSK/strings.xml b/omnipod/src/main/res/values-sk-rSK/strings.xml index 42b8560748..c6e83f4f61 100644 --- a/omnipod/src/main/res/values-sk-rSK/strings.xml +++ b/omnipod/src/main/res/values-sk-rSK/strings.xml @@ -7,8 +7,9 @@ Pípnutie pri bazále povolené Pípnutie pri SMB povolené Pípnutie pri TBR povolené - Tlačidlo pozastaviť podávanie je povolené - Tlačítko Pulse Log je zapnuté + Zobraziť tlačítko \"Pozastaviť podávanie\" na záložke Omnipod + Zobraziť tlačítko Pulzný Log v menu Správa Podu + Zobraziť tlačítko Štatistika RileyLink v menu Správa Podu Letný čas / Detekcia časového pásma povolená Pripomenutie vypršania platnosti povolené Hodiny pred vypnutím @@ -17,6 +18,7 @@ Zvuk upozornenia pre neistý dočasný bazál povolený Zvuk upozornenia pre neistý SMB povolený Zvuk upozornenia pre neistý bolus povolený + Automaticky potvrzovať výstrahy Podu RileyLink Iné Výstrahy @@ -31,6 +33,7 @@ Chyba Podu Bol prekročený čas aktivácie Neaktívny + Chyba Podu: %1$03d %2$s Pripomienka ukončenia párovania Pripomienka ukončenia nastavenia @@ -84,12 +87,30 @@ Neznámy vlastný príkaz: %1$s Zlyhalo načítanie Pulse Log Nepodarilo sa obnoviť stav + Nepodarilo se aktualizovať stav pri spustení Nepodarilo sa potvrdiť výstrahy Nepodarilo sa pozastaviť podávanie inzulínu Nepodarilo sa nastaviť čas Podávanie inzulínu sa nepodarilo spustiť + Nepodarilo sa automaticky zmeniť čas na Pode. Mali by ste ručne synchronizovať čas na záložke Omnipod. + Nedá sa overiť, či bolus prebehol úspešne. Overte prosím manuálne, či je podávaný bolus, počúvaním klikov z Podu. Pokiaľ ste si istý, že bolus nebol úspešný, mali by ste ručne odstrániť položku bolusu z ošetrení, aj keď kliknete na tlačítko \'Zrušiť bolus\' teraz! + Nedá sa overiť, či bol bolus SMB (%1$.2f JI) úspešne podaný. Pokiaľ ste si istý, že bolus nebol podaný, mali by ste ručne odstrániť položku SMB z Ošetrení. + Podanie bolusu nebolo úspešné. + Nepodarilo sa inicializovať Pod + Nepodarilo sa vložiť kanylu + Bol prekročený čas aktivácie Podu. Tento Pod sa už nedá aktivovať. Nepodarilo sa overiť priebeh aktivácie. Skúste to znova. + Pod pozastavený + Nepodarilo se prehrať testovacie pípnutie + Dočasný bazál na Pode prebieha, ale AAPS o tomto dočasnom bazále nevie. Prosím zrušte svoj dočasný bazál ručne. + Potvrdenie + Čas a/alebo časová zóna zmenená na Pode. + Nastavenie výstrahy bolo v Pode aktualizované. + Čas na Pode bol aktualizovaný. + Všetko podávanie inzulínu bolo pozastavené. + Aktívne výstrahy boli potvrdené. + Podávanie inzulínu bolo obnovené. Deaktivovať Pod Vyradiť Pod @@ -107,18 +128,92 @@ Pozastaviť dodávanie inzulínu Pokračovať v dodávaní inzulínu Neznáma položka + Inicializovať Pod + Vložiť kanylu + Čítať protokol pulzov Nastaviť falošný dočasný bazál, pretože Pod je pozastavený Zrušiť falošný dočasný bazál ktorý bol vytvorený, pretože Pod bol pozastavený + Nastavenie pípnutia + Prehrať testovacie pípnutie + Správa Podu + Čakám na pripojenie RileyLink… + Aktivovať Pod + Deaktivovať Pod + Vyradiť Pod + História Podu + Štatistika RileyLink + Čítať protokol pulzov + Čítanie protokolu pulzov… + Pokiaľ zahodíte Pod, už s ním nebudete môcť komunikovať. Mali by ste to urobiť iba vtedy, pokiaľ celá komunikácia s Podom trvalo zlyháva. Pokiaľ stále môžete komunikovať s Podom, použite možnosť Deaktivovať Pod.\n\nPokiaľ si prajete pokračovať, uistite sa prosím, že odstránite Pod z tela! + Prehrať testovacie pípnutie + Prehrávanie testovacieho pípnutia… + Zrušiť Dokončiť Ďalšia + Opakovať + Deaktivovať Pod + Vyradiť Pod + Doposiaľ ste nedokončili všetky kroky. Ste si istý, že chcete ukončiť prácu? + Koniec + Naplniť Pod + Naplňte nový Pod dostatkom inzulínu na 3 dni.\n\nSledujte dve pípnutia z Podu v priebehu procesu plnenia. Tieto ukazujú, že minimálne množstvo 85U bolo naplnené. Uistite sa, že striekačka je úplne vyprázdnená a to aj po vypočutí dvoch pípnutí.\n\nPo naplnení Podu, prosím, stlačte Ďalšia.\n\nPoznámka: zatiaľ nesnímajte kryt z ihly.\nPoznámka:prosím umiestnite RileyLink vo zvislej polohe blízko Podu. + Inicializovať Pod + Snažíte sa spárovať nový Pod a naplniť ho.\n\nKeď bol úspešne dokončený inicializačný proces, môžete stlačiť tlačítko Ďalšia.\n\nPoznámka: položte RileyLink vo vzpriamenej polohe a umiestnite ho pár centimetrov od Podu. + Nasaďte Pod + Pripravte infúzne miesto. Odstráňte krytku ihly a náplasti a nalepte Pod.\n\nPokiaľ sa kanyla odlepí, stlačíte Zrušiť a zahoďte Pod.\n\nStlačte Ďalšia pre vloženie kanyly a spustenie bazálu. + Keď stlačíte OK, kanyla se vloží. Uistite sa, že ste pripojili Pod k infuznemu miestu. + Vložiť kanylu + Snažím sa nastaviť počiatočný základný bazál a vložiť kanylu.\n\nPo úspešnom vložení kanyly môžete stlačiť tlačítko Ďalšia. + Pod aktivovaný + Pod je teraz aktívny.\n\nVáš bazál bol naprogramovaný a kanyla bola vložená.\n\nOverte prosím, že kanyla bola vložená správne a prípadne vymeňte Pod. + Deaktivovať Pod + StlačteĎalšia pre deaktiváciu Podu.\n\nPoznámka: Úplne zastavíte podávanie inzulínu a deaktivujete Pod. + Deaktivácia Podu + Deaktivácia Podu.\n\nPo úspešnom dokončení deaktivácie môžete stlačiť Ďalšia. + Pod deaktivovaný + Pod deaktivovaný.\n\nOdstráňte Pod z tela a znehodnoťte ho. + Pod vyradený + Stav Podu bol vyradený. Podávanie inzulínu nebolo pozastavené, pretože Pod nebol riadne deaktivovaný!\n\nOdstráňte Pod z vašeho tela a recyklujte ho. + Pokiaľ tento Pod vyradíte, nebudete s ním už mocť komunikovať. Túto operáciu by ste mali urobiť iba v prípade, že celá komunikácia s týmto Podom trvale zlyháva. Naozaj chcete vyradiť Pod? + Vyradiť Pod + Nastavenie času + Pozastaviť + Obnoviť + Obnoviť podávanie inzulínu + Správa Podu + Potvrdiť výstrahy + Stav Podu + Celkovo podané + %1$.2f JI + Adresa Podu + Pod expiruje + Posledné spojenie + Posledný bolus + Dočasná bazálna dávka + Základná hodnota bazálu + Zásobník + Výstrahy aktívneho Podu + Verzia firmwaru + Čas na Pode + %1$.2fJI/h @%2$s (%3$d/%4$d minút) + Zostáva %1$.2f JI + Zostáva viac ako 50 JI + Chyby + Integrácia pumpy pre Omnipod, vyžaduje zariadenie RileyLink (s firmwarom aspoň 2.0). Resetovať konfiguráciu RileyLinku neznáme + Protokol pulzov + Protokol pulzov (skopírované do schránky) + Áno + Nie + OK + Zrušiť Pred chvíľou Pred menej ako minútou @@ -142,4 +237,10 @@ %1$d dní %1$d dní + + Výstraha Podu: %1$s + Výstrahy Podu: %1$s + Výstrahy Podu: %1$s + Výstrahy Podu: %1$s + diff --git a/rileylink/build.gradle b/rileylink/build.gradle index c5ac276ef1..cdeb8d9bc3 100644 --- a/rileylink/build.gradle +++ b/rileylink/build.gradle @@ -43,39 +43,13 @@ dependencies { implementation project(':core') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation "androidx.appcompat:appcompat:$appcompat_verison" - implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.preference:preference-ktx:$preferencektx_version" - implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "com.google.android.material:material:$material_version" - - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" - - // Graphview cannot be upgraded - implementation "com.jjoe64:graphview:4.0.1" - - implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" - - // rileylink - start - implementation "org.apache.commons:commons-lang3:$commonslang3_version" - implementation 'net.danlew:android.joda:2.10.6' - implementation 'org.slf4j:slf4j-api:1.7.30' - // rileylink - end - - implementation "com.google.dagger:dagger-android:$dagger_version" - implementation "com.google.dagger:dagger-android-support:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" testImplementation "junit:junit:$junit_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation "androidx.test.ext:junit:$androidx_junit" + androidTestImplementation "androidx.test:rules:$androidx_rules" } diff --git a/wear/build.gradle b/wear/build.gradle index 1e66bec826..a1cab4f14c 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -20,7 +20,6 @@ jacoco { ext { wearableVersion = "2.4.0" playServicesWearable = "17.0.0" - powermockVersion = "1.7.3" } def generateGitBuild = { -> @@ -49,7 +48,7 @@ android { defaultConfig { applicationId "info.nightscout.androidaps" - minSdkVersion 24 + minSdkVersion 23 targetSdkVersion 28 versionCode 1 versionName "1.0.2" diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index e665a92809..7bee0811ec 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -30,6 +30,9 @@ + @@ -48,6 +51,9 @@ + @@ -66,6 +72,9 @@ + @@ -76,7 +85,7 @@ + @@ -94,7 +106,7 @@ + @@ -112,7 +127,7 @@ + @@ -138,6 +156,9 @@ + @@ -155,6 +176,9 @@ + @@ -175,7 +199,7 @@ android:resource="@drawable/watchface_digitalstyle" /> + android:value="watch_face_configuration_digitalstyle" /> @@ -507,10 +531,19 @@ - - - + + + + + + + + + + + + diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/DigitalStyleConfigAct.java b/wear/src/main/java/info/nightscout/androidaps/interaction/ConfigurationActivity.java similarity index 59% rename from wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/DigitalStyleConfigAct.java rename to wear/src/main/java/info/nightscout/androidaps/interaction/ConfigurationActivity.java index e86c7a80d7..d1d8d71cc5 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/DigitalStyleConfigAct.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/ConfigurationActivity.java @@ -1,19 +1,24 @@ -package info.nightscout.androidaps.interaction.configurationActivities; +package info.nightscout.androidaps.interaction; +import android.content.res.XmlResourceParser; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.view.ViewGroup; - import info.nightscout.androidaps.R; import preference.WearPreferenceActivity; -public class DigitalStyleConfigAct extends WearPreferenceActivity { +public class ConfigurationActivity extends WearPreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setTitle("watchface"); - addPreferencesFromResource(R.xml.watch_face_digitalstyle_configuration); + setTitle("Watchface"); + String configFileName=getIntent().getAction(); + int resXmlId = getResources().getIdentifier(configFileName, "xml", getApplicationContext().getPackageName()); + Log.d("ConfigurationActivity::onCreate --->> getIntent().getAction()",configFileName); + Log.d("ConfigurationActivity::onCreate --->> resXmlId",String.valueOf(resXmlId)); + addPreferencesFromResource(resXmlId); ViewGroup view = (ViewGroup) getWindow().getDecorView(); removeBackgroundRecursively(view); view.setBackground(getResources().getDrawable(R.drawable.settings_background)); diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WatchfaceSettingsPreference.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WatchfaceSettingsPreference.java new file mode 100644 index 0000000000..1f23543d41 --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WatchfaceSettingsPreference.java @@ -0,0 +1,32 @@ +package info.nightscout.androidaps.interaction.utils; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Toast; + +import androidx.annotation.NonNull; + +import preference.WearListPreference; + + +public class WatchfaceSettingsPreference extends WearListPreference { + private String pref_moreWatchfaceSettings,pref_lookInYourWatchfaceConfiguration; + + public WatchfaceSettingsPreference(Context context, AttributeSet attrs) { + super(context, attrs); + + this.pref_moreWatchfaceSettings =context.getResources().getString(context.getResources().getIdentifier("pref_moreWatchfaceSettings", "string", context.getApplicationContext().getPackageName())); + this.pref_lookInYourWatchfaceConfiguration=context.getResources().getString(context.getResources().getIdentifier("pref_lookInYourWatchfaceConfiguration", "string", context.getApplicationContext().getPackageName())); + + entries = new CharSequence[]{pref_moreWatchfaceSettings}; + entryValues = new CharSequence[]{""}; + } + + @Override public CharSequence getSummary(@NonNull final Context context) { + return ""; + } + @Override + public void onPreferenceClick(@NonNull Context context) { + Toast.makeText(context, pref_lookInYourWatchfaceConfiguration, Toast.LENGTH_LONG).show(); + } +} diff --git a/wear/src/main/res/values-bg-rBG/strings.xml b/wear/src/main/res/values-bg-rBG/strings.xml index c0e66eeeb1..745e92da73 100644 --- a/wear/src/main/res/values-bg-rBG/strings.xml +++ b/wear/src/main/res/values-bg-rBG/strings.xml @@ -7,6 +7,10 @@ AAPS(Графика) AAPS(без рафика) AAPS(Кръгъл) + AAPSv2 + AAPS(Самолет) + AAPS(Steampunk) + AAPS (DigitalStyle) Няма данни! Стари данни! От %1$s @@ -57,6 +61,8 @@ Допълнителни действия при почукване Unicode кодиране Версия: + Настройки на Watchface + Погледнете в конфигурацията, моля. Врем цел Калкулатор Болус @@ -90,4 +96,36 @@ ВХ IOB няма Статус + червен + розово + лилаво + тъмно лилаво + индиго + синьо + светло синьо + синьозелено + металик + зелен + светло зелено + лимоненозелено + жълто + кехлибарено + оранжево + тъмно оранжево + кафяво + сиво + син сив + бяло + черно + многоцветно + Вибрира почасово + Показване на номер седмица + Вашият стил: + Няма избран стил + минимален стил + форма на стил + пълен стил + Вашият цвят: + Насищане на цвета: + Вашата цветна прозрачност: diff --git a/wear/src/main/res/values-cs-rCZ/strings.xml b/wear/src/main/res/values-cs-rCZ/strings.xml index 231621586b..289eb398e5 100644 --- a/wear/src/main/res/values-cs-rCZ/strings.xml +++ b/wear/src/main/res/values-cs-rCZ/strings.xml @@ -61,6 +61,8 @@ Akce po klepnutí na komplikaci Znaky Unicode v komplikacích Verze: + další nastavení Watchface + Podívejte se na konfiguraci hodinek prosím. TempT Kalkulačka Bolus diff --git a/wear/src/main/res/values-de-rDE/strings.xml b/wear/src/main/res/values-de-rDE/strings.xml index a752e32b58..ba21d88477 100644 --- a/wear/src/main/res/values-de-rDE/strings.xml +++ b/wear/src/main/res/values-de-rDE/strings.xml @@ -7,6 +7,10 @@ AAPS(GroßerGraph) AAPS(KeinGraph) AAPS(Kreis) + AAPSv2 + AAPS(Cockpit) + AAPS(Steampunk) + AAPS(DigitalStyle) Keine Daten! Veraltete Daten! Seit %1$s @@ -57,6 +61,8 @@ Tipp Komplikation Unicode in Komplikationen Version: + weitere Watchface Einstellungen + Schaue Dir bitte die Watchface-Konfiguration an. Temp. Ziel Rechner Bolus @@ -90,7 +96,36 @@ KH IOB Kein Status + rot + pink + lila dunkelviolett indigoblau + blau + hellblau + cyan + grünblau + grün + hellgrün + neongrün + gelb bernstein + orange + dunkelorange + braun + grau + blaugrau + weiß + schwarz + mehrfarbig + stündlich vibrieren + Kalenderwoche anzeigen + Ihr Stil: + ohne Stil + minimalistisches Stil + schattierter Stil + vollständiger Stil + Ihre Farbe: + Ihre Farbsättigung: + Deine Farbtransparenz: diff --git a/wear/src/main/res/values-iw-rIL/strings.xml b/wear/src/main/res/values-iw-rIL/strings.xml index 8d6abc30f0..e81180348a 100644 --- a/wear/src/main/res/values-iw-rIL/strings.xml +++ b/wear/src/main/res/values-iw-rIL/strings.xml @@ -61,6 +61,8 @@ פעולת הקשה על סיבוך יוניקוד בסיבוכים גירסה: + עוד הגדרות פני שעון + עיינו בהגדרות פני השעון בבקשה. מטרה זמנית אשף בולוס diff --git a/wear/src/main/res/values-lt-rLT/strings.xml b/wear/src/main/res/values-lt-rLT/strings.xml index 0731460ea6..4c74aa0d2d 100644 --- a/wear/src/main/res/values-lt-rLT/strings.xml +++ b/wear/src/main/res/values-lt-rLT/strings.xml @@ -7,6 +7,9 @@ AAPS(DidelisGrafikas) AAPS(BeGrafiko) AAPS(Apvalus) + AAPSv2 + AAPS(Steampunk) + AAPS(DigitalStyle) Nėra duomenų! Seni duomenys! Nuo %1$s @@ -57,6 +60,8 @@ Elementų skirtuko veiksmai Unikodas elementuose Versija: + Daugiau laikrodžio ekrano nustatymų + Prašom žiūrėti Watchface konfigūraciją. LaikinasTikslas Vedlys Bolusas @@ -90,4 +95,36 @@ AV AIO nėra statuso + raudona + rožinė + violetinė + tamsiai violetinė + indigo + mėlyna + žydra + ciano + žalsvai mėlyna + žalia + šviesiai žalia + gelsvai žalsva + geltona + gintaro spalvos + oranžinė + tamsiai oranžinė + ruda + pilka + mėlynai pilka + balta + juoda + daug spalvų + Vibruoti kas valandą + Rodyti savaitės numerį + Jūsų stilius: + jokio stiliaus + minimalus stilius + formos stilius + pilnas stilius + Jūsų spalva: + Jūsų spalvų sodrumas: + Jūsų spalvų nepermatomumas: diff --git a/wear/src/main/res/values-nl-rNL/strings.xml b/wear/src/main/res/values-nl-rNL/strings.xml index 46ed53d316..4d1a82540a 100644 --- a/wear/src/main/res/values-nl-rNL/strings.xml +++ b/wear/src/main/res/values-nl-rNL/strings.xml @@ -7,6 +7,10 @@ AAPS(GroteGrafiek) AAPS(GeenGrafiek) AAPS(Cirkel) + AAPSv2 + AAPS(Cockpit) + AAPS(Steampunk) + AAPS (DigitalStyle) Geen gegevens! Oude gegevens! Sinds %1$s @@ -90,4 +94,36 @@ Khd IOB geen status + rood + roze + paars + donkerpaars + indigo + blauw + lichtblauw + cyaan + groenblauw + groen + lichtgroen + lichtgroen + geel + geelbruin + oranje + diep oranje + bruin + grijs + blauwgrijs + wit + zwart + multicolor + Tril ieder uur + Weeknummer weergeven + Jouw stijl: + geen stijl + minimale stijl + vormstijl + volledige stijl + Jouw kleur: + Jouw kleurverzadiging: + Jouw kleurendoorzichtigheid: diff --git a/wear/src/main/res/values-no-rNO/strings.xml b/wear/src/main/res/values-no-rNO/strings.xml index 769ccb4d4c..ae2050a473 100644 --- a/wear/src/main/res/values-no-rNO/strings.xml +++ b/wear/src/main/res/values-no-rNO/strings.xml @@ -61,6 +61,8 @@ Komplikasjon trykk handling Unicode ikomplikasjoner Versjon: + flere urskive innstillinger + Vennligst sjekk urskive innstillinger. TempT Veiviser Bolus diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml index 081cf9a8d5..8a21ef4fdb 100644 --- a/wear/src/main/res/values-sk-rSK/strings.xml +++ b/wear/src/main/res/values-sk-rSK/strings.xml @@ -61,6 +61,8 @@ Zadaj komplikáciu Unicode v komplikáciach Verzia: + ďalšie nastavenia Watchface + Pozrite sa prosím do konfigurácie Watchface. TempT Sprievodca Bolus @@ -121,4 +123,9 @@ Váš štýl: žiadny štýl minimálny štýl + tvar štýlu + úplný štýl + Vaša farba: + Vaše nasýtenie farby: + Priehľadnosť farby: diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index 220c3b7808..4685ce2a08 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -67,6 +67,9 @@ Complication Tap Action Unicode in Complications Version: + more Watchface settings + Look into Watchface configuration, please. + TempT Wizard diff --git a/wear/src/main/res/xml/preferences.xml b/wear/src/main/res/xml/preferences.xml index c768e43e97..528d8bf00a 100644 --- a/wear/src/main/res/xml/preferences.xml +++ b/wear/src/main/res/xml/preferences.xml @@ -2,29 +2,6 @@ - - - - - - + + @@ -56,6 +41,21 @@ android:title="@string/pref_show_avgdelta" app:wear_iconOff="@drawable/settings_off" app:wear_iconOn="@drawable/settings_on"/> + + + - - - - - - - - + + + + - - - - - - - - - - + + + + - - + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_bigchart.xml b/wear/src/main/res/xml/watch_face_configuration_bigchart.xml new file mode 100644 index 0000000000..7953823134 --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_bigchart.xml @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_circle.xml b/wear/src/main/res/xml/watch_face_configuration_circle.xml new file mode 100644 index 0000000000..440b527bfa --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_circle.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_cockpit.xml b/wear/src/main/res/xml/watch_face_configuration_cockpit.xml new file mode 100644 index 0000000000..2e45811780 --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_cockpit.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_digitalstyle_configuration.xml b/wear/src/main/res/xml/watch_face_configuration_digitalstyle.xml similarity index 100% rename from wear/src/main/res/xml/watch_face_digitalstyle_configuration.xml rename to wear/src/main/res/xml/watch_face_configuration_digitalstyle.xml diff --git a/wear/src/main/res/xml/watch_face_configuration_home.xml b/wear/src/main/res/xml/watch_face_configuration_home.xml new file mode 100644 index 0000000000..6aae7b88eb --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_home.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_home2.xml b/wear/src/main/res/xml/watch_face_configuration_home2.xml new file mode 100644 index 0000000000..76379ba9dd --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_home2.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_largehome.xml b/wear/src/main/res/xml/watch_face_configuration_largehome.xml new file mode 100644 index 0000000000..6aae7b88eb --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_largehome.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_nochart.xml b/wear/src/main/res/xml/watch_face_configuration_nochart.xml new file mode 100644 index 0000000000..dc5b99cf8c --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_nochart.xml @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/wear/src/main/res/xml/watch_face_configuration_steampunk.xml b/wear/src/main/res/xml/watch_face_configuration_steampunk.xml new file mode 100644 index 0000000000..fea4e8f192 --- /dev/null +++ b/wear/src/main/res/xml/watch_face_configuration_steampunk.xml @@ -0,0 +1,19 @@ + + + + + + +