fix(accessibility suw): fix unexpected large padding in accessibility suw when force-two-pane mode

Like the screenshots in b/323771329#comment26, the headerLayout padding is too large when
force-two-pane mode. Therefore, as a short-term fix, we make the AccessibilitySetupWizardUtils
not to adjust the headerLayout padding when shouldForceTwoPane, which
described in b/323771329#comment30. The long-term goal is to remove the
padding adjustment in AccessibilitySetupWizardUtils after the the
padding is handled in SUW library internally.

Bug: 323771329
Flag: NONE
Test: manually
Change-Id: Ie4585d9ee352ca74733d4bc14e957bf901347fdc
This commit is contained in:
Roy Chou
2024-04-10 09:01:12 +00:00
parent d5e69fa0ea
commit f85bca368c

View File

@@ -26,6 +26,7 @@ import androidx.annotation.StringRes;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.template.Mixin;
import com.google.android.setupcompat.util.ForceTwoPaneHelper;
import com.google.android.setupdesign.GlifPreferenceLayout;
import com.google.android.setupdesign.R;
import com.google.android.setupdesign.util.ThemeHelper;
@@ -63,6 +64,16 @@ public class AccessibilitySetupWizardUtils {
layout.setDividerInsets(Integer.MAX_VALUE, 0);
if (ThemeHelper.shouldApplyMaterialYouStyle(context)) {
// For b/323771329#comment26, if the layout is forced-two-pan, we should not adjust the
// headerLayout horizontal padding to 0, which will make an unexpected large padding on
// two-pane layout.
// TODO: This is just a short-term quick workaround for force-two-pane devices padding
// issue. The long-term goal here is to remove the header padding adjustment since it
// should be handled in setup design lib. (b/331878747)
if (ForceTwoPaneHelper.shouldForceTwoPane(context)) {
return;
}
final LinearLayout headerLayout = layout.findManagedViewById(R.id.sud_layout_header);
if (headerLayout != null) {
headerLayout.setPadding(0, layout.getPaddingTop(), 0,