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

Commit 82986534 authored by Sunny Shao's avatar Sunny Shao
Browse files

Update the Builder to add the title parameter checking

Fixes: 139163212
Test: compilation
Change-Id: Ieccaabff5d01c6d8043505661fa77b1b0a174485
parent c422b02f
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -99,7 +99,7 @@ public class FooterPreference extends Preference {
         * To set the key value of the {@link FooterPreference}.
         * To set the key value of the {@link FooterPreference}.
         * @param key The key value.
         * @param key The key value.
         */
         */
        public Builder setKey(String key) {
        public Builder setKey(@NonNull String key) {
            mKey = key;
            mKey = key;
            return this;
            return this;
        }
        }
@@ -128,11 +128,12 @@ public class FooterPreference extends Preference {
        public FooterPreference build() {
        public FooterPreference build() {
            final FooterPreference footerPreference = new FooterPreference(mContext);
            final FooterPreference footerPreference = new FooterPreference(mContext);
            footerPreference.setSelectable(false);
            footerPreference.setSelectable(false);
            if (!TextUtils.isEmpty(mKey)) {
            if (TextUtils.isEmpty(mTitle)) {
                footerPreference.setKey(mKey);
                throw new IllegalArgumentException("Footer title cannot be empty!");
            }
            }
            if (!TextUtils.isEmpty(mTitle)) {
            footerPreference.setTitle(mTitle);
            footerPreference.setTitle(mTitle);
            if (!TextUtils.isEmpty(mKey)) {
                footerPreference.setKey(mKey);
            }
            }
            return footerPreference;
            return footerPreference;
        }
        }