diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index 809914053a..e62cd087d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -27,6 +27,7 @@ import androidx.viewpager2.widget.ViewPager2 import com.google.android.material.tabs.TabLayoutMediator import com.joanzapata.iconify.Iconify import com.joanzapata.iconify.fonts.FontAwesomeModule +import dev.doubledot.doki.ui.DokiActivity import info.nightscout.androidaps.activities.ProfileHelperActivity import info.nightscout.androidaps.activities.NoSplashAppCompatActivity import info.nightscout.androidaps.activities.PreferencesActivity @@ -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 } 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..074ac67988 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.* @@ -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/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 2797b43967..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.* @@ -798,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/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6314c96645..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. @@ -1467,5 +1467,6 @@ RileyLink status: Filter Unable to create local profile. Profile is invalid. + Don\'t kill my app? diff --git a/build.gradle b/build.gradle index 481c61c128..a0e146a95d 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,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..ae8f3de3ec 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -45,8 +45,8 @@ dependencies { 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}" + api "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0" implementation "com.google.android.material:material:$material_version" implementation "com.google.dagger:dagger-android:$dagger_version" @@ -84,6 +84,11 @@ dependencies { // pumpCommon implementation "com.google.code.gson:gson:2.8.6" + // don't kill my app + api('dev.doubledot.doki:library:0.0.1@aar') { + transitive = true + } + testImplementation "junit:junit:$junit_version" androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'