From c423d2b3ca26be635b60f479ae0749b39fd13d7d Mon Sep 17 00:00:00 2001 From: Jakub Kalinowski Date: Sun, 18 Dec 2022 11:25:06 +0100 Subject: [PATCH] Issue 1574: Fixed the almost invisible watch hands in snooze activity (#1592) * Setting the current theme correctly * Ktlint correction --- .../SnoozeDelayPickerActivity.kt | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/notifications/SnoozeDelayPickerActivity.kt b/uhabits-android/src/main/java/org/isoron/uhabits/notifications/SnoozeDelayPickerActivity.kt index 42514b118..f1723ee16 100644 --- a/uhabits-android/src/main/java/org/isoron/uhabits/notifications/SnoozeDelayPickerActivity.kt +++ b/uhabits-android/src/main/java/org/isoron/uhabits/notifications/SnoozeDelayPickerActivity.kt @@ -33,7 +33,8 @@ import org.isoron.uhabits.HabitsApplication import org.isoron.uhabits.R import org.isoron.uhabits.activities.AndroidThemeSwitcher import org.isoron.uhabits.core.models.Habit -import org.isoron.uhabits.core.ui.ThemeSwitcher.Companion.THEME_LIGHT +import org.isoron.uhabits.core.ui.views.DarkTheme +import org.isoron.uhabits.core.ui.views.LightTheme import org.isoron.uhabits.receivers.ReminderController import org.isoron.uhabits.utils.SystemUtils import java.util.Calendar @@ -51,11 +52,8 @@ class SnoozeDelayPickerActivity : FragmentActivity(), OnItemClickListener { val app = applicationContext as HabitsApplication val appComponent = app.component val themeSwitcher = AndroidThemeSwitcher(this, appComponent.preferences) - if (themeSwitcher.getSystemTheme() == THEME_LIGHT) { - setTheme(R.style.BaseDialog) - } else { - setTheme(R.style.BaseDialogDark) - } + themeSwitcher.setTheme() + val data = intent.data if (data == null) { finish() @@ -75,6 +73,16 @@ class SnoozeDelayPickerActivity : FragmentActivity(), OnItemClickListener { SystemUtils.unlockScreen(this) } + private fun AndroidThemeSwitcher.setTheme() { + if (this.isNightMode) { + setTheme(R.style.BaseDialogDark) + this.currentTheme = DarkTheme() + } else { + setTheme(R.style.BaseDialog) + this.currentTheme = LightTheme() + } + } + private fun showTimePicker() { val calendar = Calendar.getInstance() val dialog = TimePickerDialog.newInstance(