mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
grey out when disabled
This commit is contained in:
parent
49bbe312d1
commit
67ec07f573
@ -8,6 +8,7 @@ import com.github.libretube.R
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.ui.activities.SettingsActivity
|
||||
import com.github.libretube.ui.base.BasePreferenceFragment
|
||||
import com.github.libretube.ui.views.TimePickerPreference
|
||||
import com.github.libretube.util.NotificationHelper
|
||||
|
||||
class NotificationSettings : BasePreferenceFragment() {
|
||||
@ -41,6 +42,19 @@ class NotificationSettings : BasePreferenceFragment() {
|
||||
updateNotificationPrefs()
|
||||
true
|
||||
}
|
||||
|
||||
val notificationTime = findPreference<SwitchPreferenceCompat>(PreferenceKeys.NOTIFICATION_TIME_ENABLED)
|
||||
val notificationStartTime = findPreference<TimePickerPreference>(PreferenceKeys.NOTIFICATION_START_TIME)
|
||||
val notificationEndTime = findPreference<TimePickerPreference>(PreferenceKeys.NOTIFICATION_END_TIME)
|
||||
listOf(notificationStartTime, notificationEndTime).forEach {
|
||||
it?.isEnabled = notificationTime?.isChecked == true
|
||||
}
|
||||
notificationTime?.setOnPreferenceChangeListener { _, newValue ->
|
||||
listOf(notificationStartTime, notificationEndTime).forEach {
|
||||
it?.isEnabled = newValue as Boolean
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNotificationPrefs() {
|
||||
|
Loading…
Reference in New Issue
Block a user