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

Commit 9663ad42 authored by csitari's avatar csitari
Browse files

Add ButtonPreference type and size setter method and make it visible to healthfitness

Bug: 378469065
Test: visual
Flag: EXEMPT bug fix
Change-Id: I557884ac5259552797dbc0a25dff8bf8b4414e40
parent b1b11e0d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -24,4 +24,8 @@ android_library {

    sdk_version: "system_current",
    min_sdk_version: "21",
    apex_available: [
        "//apex_available:platform",
        "com.android.healthfitness",
    ],
}
+24 −0
Original line number Diff line number Diff line
@@ -247,4 +247,28 @@ public class ButtonPreference extends Preference implements GroupSectionDividerM
            mButton.setLayoutParams(lp);
        }
    }

    /**
     * Sets the style of the button.
     *
     * @param type Specifies the button's type, which sets the attribute `buttonPreferenceType`.
     *             Possible values are:
     *             <ul>
     *                 <li>0: filled</li>
     *                 <li>1: tonal</li>
     *                 <li>2: outline</li>
     *             </ul>
     * @param size Specifies the button's size, which sets the attribute `buttonPreferenceSize`.
     *             Possible values are:
     *             <ul>
     *                 <li>0: normal</li>
     *                 <li>1: large</li>
     *                 <li>2: extra large</li>
     *             </ul>
     */
    public void setButtonStyle(int type, int size) {
        int layoutId = ButtonStyle.getLayoutId(type, size);
        setLayoutResource(layoutId);
        notifyChanged();
    }
}