-> jetpack
This commit is contained in:
parent
b9477eef16
commit
9409193935
|
@ -2,11 +2,11 @@ package info.nightscout.androidaps.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
||||||
import info.nightscout.androidaps.utils.ActivityMonitor
|
import info.nightscout.androidaps.utils.ActivityMonitor
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.stats.TddCalculator
|
import info.nightscout.androidaps.utils.stats.TddCalculator
|
||||||
import info.nightscout.androidaps.utils.stats.TirCalculator
|
import info.nightscout.androidaps.utils.stats.TirCalculator
|
||||||
import kotlinx.android.synthetic.main.activity_stats.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class StatsActivity : NoSplashAppCompatActivity() {
|
class StatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
@ -15,20 +15,23 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var tirCalculator: TirCalculator
|
@Inject lateinit var tirCalculator: TirCalculator
|
||||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||||
|
|
||||||
|
private lateinit var binding: ActivityStatsBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_stats)
|
binding = ActivityStatsBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
stats_tdds.text = tddCalculator.stats()
|
binding.tdds.text = tddCalculator.stats()
|
||||||
stats_tir.text = tirCalculator.stats()
|
binding.tir.text = tirCalculator.stats()
|
||||||
stats_activity.text = activityMonitor.stats()
|
binding.activity.text = activityMonitor.stats()
|
||||||
|
|
||||||
ok.setOnClickListener { finish() }
|
binding.ok.setOnClickListener { finish() }
|
||||||
stats_reset.setOnClickListener {
|
binding.reset.setOnClickListener {
|
||||||
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats), Runnable {
|
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
|
||||||
activityMonitor.reset()
|
activityMonitor.reset()
|
||||||
recreate()
|
recreate()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,21 +48,21 @@
|
||||||
android:padding="5dp" />
|
android:padding="5dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_tdds"
|
android:id="@+id/tdds"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_tir"
|
android:id="@+id/tir"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_activity"
|
android:id="@+id/activity"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
android:paddingBottom="8dp">
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/stats_reset"
|
android:id="@+id/reset"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
|
|
Loading…
Reference in a new issue