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

Commit 97a18c81 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix Utils.prepareCustomPreferencesList()

- and thus fix padding for all Fragments using it

See bug: #13140648 Settings needs to support the new Quantum Paper theme

Change-Id: I862c96d626ed906cbdafcfb40fa0e07bb804160f
parent 712df6cb
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -365,16 +365,20 @@ public final class Utils {
    public static void prepareCustomPreferencesList(
            ViewGroup parent, View child, View list, boolean ignoreSidePadding) {
        final boolean movePadding = list.getScrollBarStyle() == View.SCROLLBARS_OUTSIDE_OVERLAY;
        if (movePadding && parent instanceof PreferenceFrameLayout) {
            ((PreferenceFrameLayout.LayoutParams) child.getLayoutParams()).removeBorders = true;

        if (movePadding) {
            final Resources res = list.getResources();
            final int paddingSide = res.getDimensionPixelSize(R.dimen.settings_side_margin);
            final int paddingBottom = res.getDimensionPixelSize(
                    com.android.internal.R.dimen.preference_fragment_padding_bottom);

            if (parent instanceof PreferenceFrameLayout) {
                ((PreferenceFrameLayout.LayoutParams) child.getLayoutParams()).removeBorders = true;

                final int effectivePaddingSide = ignoreSidePadding ? 0 : paddingSide;
                list.setPaddingRelative(effectivePaddingSide, 0, effectivePaddingSide, paddingBottom);
            } else {
                list.setPaddingRelative(paddingSide, 0, paddingSide, paddingBottom);
            }
        }
    }