Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
24fc69c26b
1 changed files with 18 additions and 9 deletions
|
@ -93,11 +93,11 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
overviewData = OverviewData(injector, aapsLogger, resourceHelper, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loopPlugin, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
|
||||
|
||||
binding.left.setOnClickListener {
|
||||
setTime(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
|
||||
adjustTimeRange(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
|
||||
loadAll("onClickLeft")
|
||||
}
|
||||
binding.right.setOnClickListener {
|
||||
setTime(overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs())
|
||||
adjustTimeRange(overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs())
|
||||
loadAll("onClickRight")
|
||||
}
|
||||
binding.end.setOnClickListener {
|
||||
|
@ -265,6 +265,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
@Suppress("SameParameterValue")
|
||||
private fun loadAll(from: String) {
|
||||
updateDate()
|
||||
Thread {
|
||||
overviewData.prepareBasalData(from)
|
||||
overviewData.prepareTemporaryTargetData(from)
|
||||
|
@ -276,17 +277,21 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun setTime(start: Long) {
|
||||
Calendar.getInstance().also { calendar ->
|
||||
GregorianCalendar().also { calendar ->
|
||||
calendar.timeInMillis = start
|
||||
calendar[Calendar.MILLISECOND] = 0
|
||||
calendar[Calendar.SECOND] = 0
|
||||
calendar[Calendar.MINUTE] = 0
|
||||
calendar[Calendar.HOUR_OF_DAY] = 0
|
||||
overviewData.fromTime = calendar.timeInMillis
|
||||
calendar[Calendar.HOUR_OF_DAY] -= (calendar[Calendar.HOUR_OF_DAY] % rangeToDisplay)
|
||||
adjustTimeRange(calendar.timeInMillis)
|
||||
}
|
||||
}
|
||||
|
||||
private fun adjustTimeRange(start: Long) {
|
||||
overviewData.fromTime = start
|
||||
overviewData.toTime = overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs()
|
||||
overviewData.endTime = overviewData.toTime
|
||||
}
|
||||
}
|
||||
|
||||
private fun runCalculation(from: String) {
|
||||
Thread {
|
||||
|
@ -307,13 +312,17 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
runningRefresh = false
|
||||
}
|
||||
|
||||
fun updateDate() {
|
||||
binding.date.text = dateUtil.dateAndTimeString(overviewData.fromTime)
|
||||
binding.zoom.text = rangeToDisplay.toString()
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun updateGUI(from: String) {
|
||||
aapsLogger.debug(LTag.UI, "updateGui $from")
|
||||
|
||||
binding.date.text = dateUtil.dateAndTimeString(overviewData.fromTime)
|
||||
binding.zoom.text = rangeToDisplay.toString()
|
||||
updateDate()
|
||||
|
||||
val pump = activePlugin.activePump
|
||||
val graphData = GraphData(injector, binding.bgGraph, overviewData)
|
||||
|
|
Loading…
Reference in a new issue