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

Commit 8a3e9641 authored by Edgar Wang's avatar Edgar Wang Committed by Android (Google) Code Review
Browse files

Merge "Add ButtonPreference type and size setter method and make it visible to...

Merge "Add ButtonPreference type and size setter method and make it visible to healthfitness" into main
parents 0cfc94d5 9663ad42
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();
    }
}