Issue 1574: Fixed the almost invisible watch hands in snooze activity (#1592)

* Setting the current theme correctly

* Ktlint correction
pull/1582/head
Jakub Kalinowski 3 years ago committed by GitHub
parent 758fc56277
commit c423d2b3ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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(

Loading…
Cancel
Save