Updates the padding of the reset button to meet for SetupWizard style.

Goals: Call the function LayoutStyler#applyPartnerCustomizationLayoutPaddingStyle to dynamically adjust the padding of the view.

Bug: 231511522
Test: manual test
Change-Id: Idd4a00c004eca8ec9699edeabe85bbee4bd49af9
This commit is contained in:
Peter_Liang
2022-05-12 23:52:03 +08:00
parent 3198bd8cec
commit 5bdc11a00d
2 changed files with 21 additions and 0 deletions

View File

@@ -27,8 +27,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
import com.android.settingslib.Utils;
import com.android.settingslib.widget.LayoutPreference;
import com.google.android.setupdesign.GlifPreferenceLayout;
import com.google.android.setupdesign.util.LayoutStyler;
/**
* A {@link androidx.preference.PreferenceFragmentCompat} that displays the settings page related
@@ -47,6 +50,8 @@ public class TextReadingPreferenceFragmentForSetupWizard extends TextReadingPref
icon.setTintList(Utils.getColorAttr(getContext(), android.R.attr.colorPrimary));
AccessibilitySetupWizardUtils.updateGlifPreferenceLayout(getContext(), layout, title,
/* description= */ null, icon);
updateResetButtonPadding();
}
@Override
@@ -66,4 +71,14 @@ public class TextReadingPreferenceFragmentForSetupWizard extends TextReadingPref
// Hides help center in action bar and footer bar in SuW
return 0;
}
/**
* Updates the padding of the reset button to meet for SetupWizard style.
*/
private void updateResetButtonPadding() {
final LayoutPreference resetPreference = (LayoutPreference) findPreference(RESET_KEY);
final ViewGroup parentView =
(ViewGroup) resetPreference.findViewById(R.id.reset_button).getParent();
LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(parentView);
}
}