workaround(expressive): Fix padding issues Setup > Vision settings

- Works around issue where Setup and Settings libraries are clashing
  when applying their new expressive themes at the same time.
- Updates illustration prefs to match parent width. Otherwise this new
  padding workaround causes the images to get clipped.

Fix: 390545391
Bug: 400479388
Test: manual only; see screenshots
Flag: EXEMPT using custom flagging from Setup ThemeHelper lib
Change-Id: Ie00cdf3e68a2ff7c40aedd04eb5bed0adaa9cf84
This commit is contained in:
Chun-Ku Lin
2025-03-13 17:26:47 +00:00
committed by Daniel Norman
parent f257978cee
commit f5cc0119ee
9 changed files with 125 additions and 2 deletions

View File

@@ -54,6 +54,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.accessibility.common.ShortcutConstants;
@@ -71,6 +72,7 @@ import com.android.settingslib.widget.IllustrationPreference;
import com.android.settingslib.widget.TopIntroPreference;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.util.ThemeHelper;
import java.util.ArrayList;
import java.util.List;
@@ -426,7 +428,19 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
return drawable;
}
private void initAnimatedImagePreference() {
initAnimatedImagePreference(mImageUri, new IllustrationPreference(getPrefContext()));
initAnimatedImagePreference(mImageUri, new IllustrationPreference(getPrefContext()) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
if (ThemeHelper.shouldApplyGlifExpressiveStyle(getContext())
&& isAnySetupWizard()) {
View illustrationFrame = holder.findViewById(R.id.illustration_frame);
final ViewGroup.LayoutParams lp = illustrationFrame.getLayoutParams();
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
illustrationFrame.setLayoutParams(lp);
}
}
});
}
@VisibleForTesting