2019-12-09 19:03:26 +01:00
|
|
|
package info.nightscout.androidaps.activities
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
import info.nightscout.androidaps.R
|
2021-03-31 00:18:55 +02:00
|
|
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
2021-01-22 14:20:56 +01:00
|
|
|
import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
2021-02-09 17:57:28 +01:00
|
|
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
2019-12-09 19:03:26 +01:00
|
|
|
import info.nightscout.androidaps.utils.ActivityMonitor
|
2020-04-08 14:03:57 +02:00
|
|
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
2019-12-31 14:40:06 +01:00
|
|
|
import info.nightscout.androidaps.utils.stats.TddCalculator
|
|
|
|
import info.nightscout.androidaps.utils.stats.TirCalculator
|
2019-12-28 22:51:04 +01:00
|
|
|
import javax.inject.Inject
|
2019-12-09 19:03:26 +01:00
|
|
|
|
|
|
|
class StatsActivity : NoSplashAppCompatActivity() {
|
2021-01-18 22:47:55 +01:00
|
|
|
|
2019-12-30 00:53:44 +01:00
|
|
|
@Inject lateinit var tddCalculator: TddCalculator
|
2019-12-31 14:40:06 +01:00
|
|
|
@Inject lateinit var tirCalculator: TirCalculator
|
2019-12-31 09:41:02 +01:00
|
|
|
@Inject lateinit var activityMonitor: ActivityMonitor
|
2021-02-09 17:57:28 +01:00
|
|
|
@Inject lateinit var uel: UserEntryLogger
|
2019-12-28 22:51:04 +01:00
|
|
|
|
2021-01-22 14:20:56 +01:00
|
|
|
private lateinit var binding: ActivityStatsBinding
|
|
|
|
|
2019-12-09 19:03:26 +01:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
2021-01-22 14:20:56 +01:00
|
|
|
binding = ActivityStatsBinding.inflate(layoutInflater)
|
|
|
|
setContentView(binding.root)
|
2019-12-09 19:03:26 +01:00
|
|
|
|
2021-01-22 14:20:56 +01:00
|
|
|
binding.tdds.text = tddCalculator.stats()
|
|
|
|
binding.tir.text = tirCalculator.stats()
|
|
|
|
binding.activity.text = activityMonitor.stats()
|
2019-12-09 19:03:26 +01:00
|
|
|
|
2021-01-22 14:20:56 +01:00
|
|
|
binding.ok.setOnClickListener { finish() }
|
|
|
|
binding.reset.setOnClickListener {
|
|
|
|
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
|
2021-02-28 15:54:37 +01:00
|
|
|
uel.log(Action.STAT_RESET)
|
2019-12-31 09:41:02 +01:00
|
|
|
activityMonitor.reset()
|
2019-12-09 19:03:26 +01:00
|
|
|
recreate()
|
2021-01-22 14:20:56 +01:00
|
|
|
}
|
2019-12-09 19:03:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|