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

Commit e0d21402 authored by Fan Zhang's avatar Fan Zhang
Browse files

Use proper icon size for default app prefs.

Change-Id: Ib48c7a546fcd3a3a9e32b7a65cbdadd54721f252
Fixes: 77726902
Test: robotests
parent 78e2cad8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
        android:gravity="start|center_vertical"
        android:minWidth="56dp"
        android:orientation="horizontal"
        android:paddingStart="4dp"
        android:paddingEnd="8dp"
        android:paddingTop="4dp"
        android:paddingBottom="4dp">
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public class ProviderPreference extends RestrictedPreference {
    public ProviderPreference(
            Context context, String accountType, Drawable icon, CharSequence providerName) {
        super(context);
        setUseSmallIcon(true);
        setIconSize(ICON_SIZE_MEDIUM);
        mAccountType = accountType;
        setIcon(icon);
        setPersistent(false);
+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.applications.defaultapps;

import static com.android.settingslib.TwoTargetPreference.ICON_SIZE_MEDIUM;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@@ -29,8 +31,8 @@ import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.GearPreference;
import com.android.settingslib.applications.DefaultAppInfo;
import com.android.settingslib.TwoTargetPreference;
import com.android.settingslib.applications.DefaultAppInfo;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.wrapper.PackageManagerWrapper;

@@ -59,7 +61,7 @@ public abstract class DefaultAppPreferenceController extends AbstractPreferenceC
            // For use small icon because we are displaying an app preference.
            // We only need to do this for TwoTargetPreference because the other prefs are
            // already using AppPreference so their icon is already normalized.
            ((TwoTargetPreference) preference).setUseSmallIcon(true);
            ((TwoTargetPreference) preference).setIconSize(ICON_SIZE_MEDIUM);
        }
        if (!TextUtils.isEmpty(defaultAppLabel)) {
            preference.setSummary(defaultAppLabel);
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class LegacyVpnPreference extends ManageablePreference {
    LegacyVpnPreference(Context context) {
        super(context, null /* attrs */);
        setIcon(R.drawable.ic_vpn_key);
        setUseSmallIcon(true);
        setIconSize(ICON_SIZE_SMALL);
    }

    public VpnProfile getProfile() {
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.accounts;

import static com.android.settingslib.TwoTargetPreference.ICON_SIZE_MEDIUM;
import static com.google.common.truth.Truth.assertThat;

import android.content.Context;
@@ -42,8 +43,8 @@ public class ProviderPreferenceTest {
    public void shouldUseSmallIcon() {
        final ProviderPreference providerPreference = new ProviderPreference(
                mContext, "account_type", null /* icon */, "provider_name");
        final boolean useSmallIcon =
                ReflectionHelpers.getField(providerPreference, "mUseSmallIcon");
        assertThat(useSmallIcon).isTrue();
        final int iconSize =
                ReflectionHelpers.getField(providerPreference, "mIconSize");
        assertThat(iconSize).isEqualTo(ICON_SIZE_MEDIUM);
    }
}
Loading