Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84084e10 authored by Jean Chen's avatar Jean Chen
Browse files

Fix: Color Inversion Preference Animation & Layout Glitch

Problem:
The color inversion preference exhibited an unwanted sliding animation when toggled on/off. This issue affected all accessibility animation illustration preferences.

Root Cause:
This animation anomaly stemmed from a recent change (specifically ag/33909109) that inadvertently set preferences to GONE. Given that accessibility fragments dynamically add images to preferences, setting their visibility to GONE caused a layout re-measurement and subsequent sliding effect.

Solution:
To resolve this immediate visual glitch, we've updated the visibility setting from GONE to INVISIBLE. This change prevents the layout from being re-measured, thus eliminating the unintended sliding animation.

Future Considerations:
We will also initiate a discussion regarding the long-term approach for accessibility fragments, exploring whether we can move away from dynamically setting images to prevent similar issues in the future.

Bug: 423482642
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Test: manual to test on a11y color inversion page
Change-Id: I2d37eee0b2bf5a2ce109e3ac9a0db6bbaa168b0f
parent 04b5cb20
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -140,12 +140,16 @@ public class IllustrationPreference extends Preference implements GroupSectionDi

        boolean isExpressive = SettingsThemeHelper.isExpressiveTheme(getContext());
        if (backgroundView != null) {
            backgroundView.setVisibility(
                    isExpressive || mIsTablet ? View.GONE : View.VISIBLE);
            // Setting visibility to INVISIBLE instead of GONE to prevent unnecessary layout
            // recalculations and redraws when dealing with dynamic set image.
            backgroundView.setVisibility(isExpressive
                    ? View.INVISIBLE : (mIsTablet ? View.GONE : View.VISIBLE));
        }
        if (backgroundViewTablet != null) {
            backgroundViewTablet.setVisibility(
                    isExpressive || !mIsTablet ? View.GONE : View.VISIBLE);
            // Setting visibility to INVISIBLE instead of GONE to prevent unnecessary layout
            // recalculations and redraws when dealing with dynamic set image.
            backgroundViewTablet.setVisibility(isExpressive
                    ? View.INVISIBLE : (!mIsTablet ? View.GONE : View.VISIBLE));
        }
        if (mIsTablet) {
            backgroundView = backgroundViewTablet;