From b7bb078b981f92c157d42391607ef2bf8a7c8b42 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 28 Feb 2018 19:42:55 +0100 Subject: [PATCH] make sure the date gets updated properly at midnight --- .../com/simplemobiletools/clock/fragments/ClockFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt index ea059598..43ce58cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt @@ -13,7 +13,7 @@ import java.util.* class ClockFragment(context: Context, attributeSet: AttributeSet) : RelativeLayout(context, attributeSet) { private val ONE_SECOND = 1000L private var passedSeconds = 0 - private val calendar = Calendar.getInstance() + private var calendar = Calendar.getInstance() private val updateHandler = Handler() @@ -52,6 +52,7 @@ class ClockFragment(context: Context, attributeSet: AttributeSet) : RelativeLayo } private fun updateDate() { + calendar = Calendar.getInstance() val dayOfWeek = (calendar.get(Calendar.DAY_OF_WEEK) + 5) % 7 // make sure index 0 means monday val dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH) val month = calendar.get(Calendar.MONTH)