Search in sources :

Example 1 with TwoTargetPreference

use of com.android.settingslib.TwoTargetPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DefaultAppPreferenceControllerTest method updateState_twoTargetPref_shouldUseMediumIcon.

@Test
public void updateState_twoTargetPref_shouldUseMediumIcon() {
    final TwoTargetPreference pref = mock(TwoTargetPreference.class);
    mController = new TestPreferenceController(mContext);
    mController.updateState(pref);
    verify(pref).setIconSize(ICON_SIZE_MEDIUM);
}
Also used : TwoTargetPreference(com.android.settingslib.TwoTargetPreference) Test(org.junit.Test)

Example 2 with TwoTargetPreference

use of com.android.settingslib.TwoTargetPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DefaultAppPreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    final DefaultAppInfo app = getDefaultAppInfo();
    CharSequence defaultAppLabel = getDefaultAppLabel();
    if (preference instanceof TwoTargetPreference) {
        // 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).setIconSize(ICON_SIZE_MEDIUM);
    }
    if (!TextUtils.isEmpty(defaultAppLabel)) {
        preference.setSummary(defaultAppLabel);
        Utils.setSafeIcon(preference, getDefaultAppIcon());
    } else {
        Log.d(TAG, "No default app");
        preference.setSummary(R.string.app_list_preference_none);
        preference.setIcon(null);
    }
    mayUpdateGearIcon(app, preference);
}
Also used : TwoTargetPreference(com.android.settingslib.TwoTargetPreference) DefaultAppInfo(com.android.settingslib.applications.DefaultAppInfo)

Aggregations

TwoTargetPreference (com.android.settingslib.TwoTargetPreference)2 DefaultAppInfo (com.android.settingslib.applications.DefaultAppInfo)1 Test (org.junit.Test)1