Fix jiggle when opening custom manual modes

Looks like setting Preference visibility in updateState() is too late to avoid an animation, and isAvailable() should be used instead. This forces us to split ZenModeSetTriggerLinkPreferenceController (which handled the category and its two children) into separate controllers for the category and each child. Although untangling this code was annoying, the result is arguably cleaner, since the two child preferences deal with different things.

Fixes: 355623101
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I5fb1b3cbe424973b852f820ecf948491c050421f
This commit is contained in:
Matías Hernández
2024-07-26 16:59:46 +02:00
parent 69ce43462e
commit e8306014f0
9 changed files with 568 additions and 211 deletions

View File

@@ -65,8 +65,13 @@ public class ZenModeFragment extends ZenModeFragmentBase {
new ZenModePreferenceCategoryController(context, "modes_additional_actions"));
prefControllers.add(new ZenModeDisplayLinkPreferenceController(
context, "mode_display_settings", mBackend, mHelperBackend));
prefControllers.add(new ZenModeSetTriggerLinkPreferenceController(context,
"zen_automatic_trigger_category", this, mBackend));
prefControllers.add(new ZenModeTriggerCategoryPreferenceController(context,
"zen_automatic_trigger_category"));
prefControllers.add(new ZenModeTriggerUpdatePreferenceController(context,
"zen_automatic_trigger_settings", mBackend));
prefControllers.add(
new ZenModeTriggerAddPreferenceController(context, "zen_add_automatic_trigger",
this, mBackend));
prefControllers.add(new InterruptionFilterPreferenceController(
context, "allow_filtering", mBackend));
prefControllers.add(new ManualDurationPreferenceController(