-> jetpack

This commit is contained in:
Milos Kozak 2021-01-22 14:20:56 +01:00
parent b9477eef16
commit 9409193935
2 changed files with 16 additions and 13 deletions

View file

@ -2,11 +2,11 @@ package info.nightscout.androidaps.activities
import android.os.Bundle
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityStatsBinding
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.stats.TddCalculator
import info.nightscout.androidaps.utils.stats.TirCalculator
import kotlinx.android.synthetic.main.activity_stats.*
import javax.inject.Inject
class StatsActivity : NoSplashAppCompatActivity() {
@ -15,20 +15,23 @@ class StatsActivity : NoSplashAppCompatActivity() {
@Inject lateinit var tirCalculator: TirCalculator
@Inject lateinit var activityMonitor: ActivityMonitor
private lateinit var binding: ActivityStatsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_stats)
binding = ActivityStatsBinding.inflate(layoutInflater)
setContentView(binding.root)
stats_tdds.text = tddCalculator.stats()
stats_tir.text = tirCalculator.stats()
stats_activity.text = activityMonitor.stats()
binding.tdds.text = tddCalculator.stats()
binding.tir.text = tirCalculator.stats()
binding.activity.text = activityMonitor.stats()
ok.setOnClickListener { finish() }
stats_reset.setOnClickListener {
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats), Runnable {
binding.ok.setOnClickListener { finish() }
binding.reset.setOnClickListener {
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
activityMonitor.reset()
recreate()
})
}
}
}
}

View file

@ -48,21 +48,21 @@
android:padding="5dp" />
<TextView
android:id="@+id/stats_tdds"
android:id="@+id/tdds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="@+id/stats_tir"
android:id="@+id/tir"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="@+id/stats_activity"
android:id="@+id/activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
@ -79,7 +79,7 @@
android:paddingBottom="8dp">
<Button
android:id="@+id/stats_reset"
android:id="@+id/reset"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginEnd="8dp"