mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Changes some preferences to be enabled or disabled by labs flag
This commit is contained in:
parent
d77ce27953
commit
9564c8f144
@ -77,10 +77,20 @@ class VectorSettingsLabsFragment :
|
||||
|
||||
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_NEW_APP_LAYOUT_KEY)?.let { pref ->
|
||||
pref.isVisible = vectorFeatures.isNewAppLayoutFeatureEnabled()
|
||||
|
||||
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
onNewLayoutPreferenceClicked()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
configureUnreadNotificationsAsTabPreference()
|
||||
}
|
||||
|
||||
private fun configureUnreadNotificationsAsTabPreference() {
|
||||
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_UNREAD_NOTIFICATIONS_AS_TAB)?.let { pref ->
|
||||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled()
|
||||
pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,4 +133,11 @@ class VectorSettingsLabsFragment :
|
||||
displayLoadingView()
|
||||
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
|
||||
}
|
||||
|
||||
/**
|
||||
* Action when new layout preference switch is actually clicked.
|
||||
*/
|
||||
private fun onNewLayoutPreferenceClicked() {
|
||||
configureUnreadNotificationsAsTabPreference()
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ class VectorSettingsPreferencesFragment :
|
||||
|
||||
findPreference<Preference>(VectorPreferences.SETTINGS_PREF_SPACE_CATEGORY)!!.let { pref ->
|
||||
pref.isVisible = !vectorFeatures.isNewAppLayoutFeatureEnabled()
|
||||
pref.isEnabled = !vectorPreferences.isNewAppLayoutEnabled()
|
||||
}
|
||||
|
||||
// Url preview
|
||||
|
Loading…
Reference in New Issue
Block a user