mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
grey out irrelevant settings
This commit is contained in:
parent
a2aa7b0ba8
commit
0070583c11
@ -133,13 +133,10 @@ class InstanceSettings : MaterialPreferenceFragment() {
|
||||
}
|
||||
|
||||
val deleteAccount = findPreference<Preference>(PreferenceKeys.DELETE_ACCOUNT)
|
||||
deleteAccount?.isEnabled = PreferenceHelper.getToken() != ""
|
||||
deleteAccount?.setOnPreferenceClickListener {
|
||||
if (PreferenceHelper.getToken() != "") {
|
||||
val newFragment = DeleteAccountDialog()
|
||||
newFragment.show(childFragmentManager, DeleteAccountDialog::class.java.name)
|
||||
} else {
|
||||
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -20,16 +20,27 @@ class NotificationSettings : MaterialPreferenceFragment() {
|
||||
|
||||
val notificationsEnabled =
|
||||
findPreference<SwitchPreferenceCompat>(PreferenceKeys.NOTIFICATION_ENABLED)
|
||||
notificationsEnabled?.setOnPreferenceChangeListener { _, _ ->
|
||||
val checkingFrequency = findPreference<ListPreference>(PreferenceKeys.CHECKING_FREQUENCY)
|
||||
val requiredNetwork = findPreference<ListPreference>(PreferenceKeys.REQUIRED_NETWORK)
|
||||
|
||||
notificationsEnabled?.setOnPreferenceChangeListener { _, newValue ->
|
||||
checkingFrequency?.isEnabled = newValue as Boolean
|
||||
requiredNetwork?.isEnabled = newValue
|
||||
updateNotificationPrefs()
|
||||
true
|
||||
}
|
||||
|
||||
val checkingFrequency = findPreference<ListPreference>(PreferenceKeys.CHECKING_FREQUENCY)
|
||||
checkingFrequency?.isEnabled = notificationsEnabled!!.isChecked
|
||||
checkingFrequency?.setOnPreferenceChangeListener { _, _ ->
|
||||
updateNotificationPrefs()
|
||||
true
|
||||
}
|
||||
|
||||
requiredNetwork?.isEnabled = notificationsEnabled.isChecked
|
||||
requiredNetwork?.setOnPreferenceChangeListener { _, _ ->
|
||||
updateNotificationPrefs()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNotificationPrefs() {
|
||||
|
Loading…
Reference in New Issue
Block a user