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

Commit d8cd67b5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Password settings: Fix duplicate title" into sc-dev

parents 913fbf7e 437c0378
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@
        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_main"
            android:title="@string/autofill_app"
            settings:keywords="@string/autofill_keywords">
            <extra
                android:name="for_work"
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_main"
            android:title="@string/autofill_app"
            settings:keywords="@string/autofill_keywords">
            <extra
                android:name="for_work"
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_work"
            android:title="@string/autofill_app"
            settings:searchable="false">
            <extra
                android:name="for_work"
+17 −2
Original line number Diff line number Diff line
@@ -65,11 +65,19 @@ public abstract class DefaultAppPreferenceController extends AbstractPreferenceC
            ((TwoTargetPreference) preference).setIconSize(ICON_SIZE_MEDIUM);
        }
        if (!TextUtils.isEmpty(defaultAppLabel)) {
            if (showLabelAsTitle()) {
                preference.setTitle(defaultAppLabel);
            } else {
                preference.setSummary(defaultAppLabel);
            }
            preference.setIcon(Utils.getSafeIcon(getDefaultAppIcon()));
        } else {
            Log.d(TAG, "No default app");
            if (showLabelAsTitle()) {
                preference.setTitle(R.string.app_list_preference_none);
            } else {
                preference.setSummary(R.string.app_list_preference_none);
            }
            preference.setIcon(null);
        }
        mayUpdateGearIcon(app, preference);
@@ -102,6 +110,13 @@ public abstract class DefaultAppPreferenceController extends AbstractPreferenceC
        return null;
    }

    /**
     * Whether to show the default app label as the title, instead of as the summary.
     */
    protected boolean showLabelAsTitle() {
        return false;
    }

    public Drawable getDefaultAppIcon() {
        if (!isAvailable()) {
            return null;
+5 −0
Original line number Diff line number Diff line
@@ -69,4 +69,9 @@ public class DefaultAutofillPreferenceController extends DefaultAppPreferenceCon
        }
        return null;
    }

    @Override
    protected boolean showLabelAsTitle() {
        return true;
    }
}