Merge branch 'dev' into bugfix_clone_invalid_profile_causes_fatal_error

This commit is contained in:
Milos Kozak 2020-11-29 13:29:44 +01:00 committed by GitHub
commit 7a96c90ecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 10 deletions

View file

@ -27,6 +27,7 @@ import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.joanzapata.iconify.Iconify import com.joanzapata.iconify.Iconify
import com.joanzapata.iconify.fonts.FontAwesomeModule import com.joanzapata.iconify.fonts.FontAwesomeModule
import dev.doubledot.doki.ui.DokiActivity
import info.nightscout.androidaps.activities.ProfileHelperActivity import info.nightscout.androidaps.activities.ProfileHelperActivity
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.activities.PreferencesActivity
@ -304,9 +305,10 @@ class MainActivity : NoSplashAppCompatActivity() {
.setIcon(iconsProvider.getIcon()) .setIcon(iconsProvider.getIcon())
.setMessage(messageSpanned) .setMessage(messageSpanned)
.setPositiveButton(resourceHelper.gs(R.string.ok), null) .setPositiveButton(resourceHelper.gs(R.string.ok), null)
.create().also { .setNeutralButton(resourceHelper.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) }
it.show() .create().apply {
(it.findViewById<View>(android.R.id.message) as TextView).movementMethod = LinkMovementMethod.getInstance() show()
findViewById<TextView>(android.R.id.message)?.movementMethod = LinkMovementMethod.getInstance()
} }
return true return true
} }

View file

@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.RelativeLayout import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import androidx.lifecycle.lifecycleScope
import com.jjoe64.graphview.GraphView import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
@ -37,7 +38,6 @@ import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_historybrowse.* import kotlinx.android.synthetic.main.activity_historybrowse.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.* import java.util.*
@ -256,7 +256,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
} }
private fun runCalculation(from: String) { private fun runCalculation(from: String) {
GlobalScope.launch(Dispatchers.Default) { lifecycleScope.launch(Dispatchers.Default) {
treatmentsPluginHistory.initializeData(start - T.hours(8).msecs()) treatmentsPluginHistory.initializeData(start - T.hours(8).msecs())
val end = start + T.hours(rangeToDisplay.toLong()).msecs() val end = start + T.hours(rangeToDisplay.toLong()).msecs()
iobCobCalculatorPluginHistory.stopCalculation(from) iobCobCalculatorPluginHistory.stopCalculation(from)
@ -273,7 +273,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
val lowLine = defaultValueHelper.determineLowLine() val lowLine = defaultValueHelper.determineLowLine()
val highLine = defaultValueHelper.determineHighLine() val highLine = defaultValueHelper.determineHighLine()
GlobalScope.launch(Dispatchers.Main) { lifecycleScope.launch(Dispatchers.Main) {
historybrowse_noprofile?.visibility = (profile == null).toVisibility() historybrowse_noprofile?.visibility = (profile == null).toVisibility()
profile ?: return@launch profile ?: return@launch

View file

@ -22,6 +22,7 @@ import android.widget.LinearLayout
import android.widget.RelativeLayout import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.text.toSpanned import androidx.core.text.toSpanned
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.jjoe64.graphview.GraphView import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector 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_loop_pumpstatus_layout.*
import kotlinx.android.synthetic.main.overview_statuslights_layout.* import kotlinx.android.synthetic.main.overview_statuslights_layout.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.* import java.util.*
@ -798,7 +798,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
} ?: "" } ?: ""
// ****** GRAPH ******* // ****** GRAPH *******
GlobalScope.launch(Dispatchers.Main) { viewLifecycleOwner.lifecycleScope.launch(Dispatchers.Main) {
overview_bggraph ?: return@launch overview_bggraph ?: return@launch
val graphData = GraphData(injector, overview_bggraph, iobCobCalculatorPlugin, treatmentsPlugin) val graphData = GraphData(injector, overview_bggraph, iobCobCalculatorPlugin, treatmentsPlugin)
val secondaryGraphsData: ArrayList<GraphData> = ArrayList() val secondaryGraphsData: ArrayList<GraphData> = ArrayList()

View file

@ -851,7 +851,7 @@
<string name="combo_error_failure_reading_changed_basal_rate">Basal rate changed on pump, but reading it failed</string> <string name="combo_error_failure_reading_changed_basal_rate">Basal rate changed on pump, but reading it failed</string>
<string name="combo_activity_checking_for_history_changes">Checking for history changes</string> <string name="combo_activity_checking_for_history_changes">Checking for history changes</string>
<string name="combo_error_multiple_boluses_with_identical_timestamp">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.</string> <string name="combo_error_multiple_boluses_with_identical_timestamp">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.</string>
<string name="about_link_urls">\n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)</string> <string name="about_link_urls">\n\ndocumentation:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers</string>
<string name="combo_check_date">The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly.</string> <string name="combo_check_date">The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly.</string>
<string name="combo_suspious_bolus_time">Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date.</string> <string name="combo_suspious_bolus_time">Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date.</string>
<string name="profileswitch_ismissing">ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.</string> <string name="profileswitch_ismissing">ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.</string>
@ -1467,5 +1467,6 @@
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string> <string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
<string name="filter">Filter</string> <string name="filter">Filter</string>
<string name="copytolocalprofile_invalid">Unable to create local profile. Profile is invalid.</string> <string name="copytolocalprofile_invalid">Unable to create local profile. Profile is invalid.</string>
<string name="cta_dont_kill_my_app_info">Don\'t kill my app?</string>
</resources> </resources>

View file

@ -54,6 +54,7 @@ allprojects {
artifact '/[organisation]/[module]/archive/[revision].[ext]' artifact '/[organisation]/[module]/archive/[revision].[ext]'
} }
} }
maven { url 'https://jitpack.io' }
} }
//Support @JvmDefault //Support @JvmDefault
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {

View file

@ -45,8 +45,8 @@ dependencies {
implementation "androidx.appcompat:appcompat:$appcompat_verison" implementation "androidx.appcompat:appcompat:$appcompat_verison"
implementation "androidx.preference:preference-ktx:$preferencektx_version" implementation "androidx.preference:preference-ktx:$preferencektx_version"
implementation 'androidx.biometric:biometric:1.0.1' implementation 'androidx.biometric:biometric:1.0.1'
implementation "androidx.activity:activity:${activityVersion}"
implementation "androidx.activity:activity-ktx:${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.android.material:material:$material_version"
implementation "com.google.dagger:dagger-android:$dagger_version" implementation "com.google.dagger:dagger-android:$dagger_version"
@ -84,6 +84,11 @@ dependencies {
// pumpCommon // pumpCommon
implementation "com.google.code.gson:gson:2.8.6" 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" testImplementation "junit:junit:$junit_version"
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'