From 8d2139fb59ee2babfeac958a107e8884f8fe7eb6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 11 Jun 2020 11:34:33 +0200 Subject: [PATCH] history browser x-axis fix --- .../historyBrowser/HistoryBrowseActivity.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt index 79fa0c4446..df22cabde6 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.kt @@ -113,9 +113,13 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { val dateSetListener = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth -> val cal = Calendar.getInstance() cal.timeInMillis = start - cal.set(Calendar.YEAR, year) - cal.set(Calendar.MONTH, monthOfYear) - cal.set(Calendar.DAY_OF_MONTH, dayOfMonth) + cal[Calendar.YEAR] = year + cal[Calendar.MONTH] = monthOfYear + cal[Calendar.DAY_OF_MONTH] = dayOfMonth + cal[Calendar.MILLISECOND] = 0 + cal[Calendar.SECOND] = 0 + cal[Calendar.MINUTE] = 0 + cal[Calendar.HOUR_OF_DAY] = 0 start = cal.timeInMillis historybrowse_date?.text = dateUtil.dateAndTimeString(start) runCalculation("onClickDate") @@ -282,7 +286,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { // do preparation in different thread withContext(Dispatchers.Default) { val fromTime: Long = start + T.secs(100).msecs() - val toTime: Long = start + T.hours(rangeToDisplay.toLong()).msecs() + val toTime: Long = start + T.hours(rangeToDisplay.toLong()).msecs() + T.secs(100).msecs() aapsLogger.debug(LTag.UI, "Period: " + dateUtil.dateAndTimeString(fromTime) + " - " + dateUtil.dateAndTimeString(toTime)) val pointer = System.currentTimeMillis()