Switch to use small icon for most app related pages
- Renamed AppProgressPreference to AppPreference to handle most app related prefs - Add ed AppSwitchPreference - the same layout as AppPreference except it's a SwitchPreference - Use above 2 prefs in most app related pages. - Everything under special access pages - Recent app list in App & notifications - App data usage detail page - Default app picker pages Bug: 65182905 Test: robotests Change-Id: I96c980ba1db49e36dabe25b5eade1197215aad11
This commit is contained in:
@@ -38,6 +38,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.notification.EmptyTextSettings;
|
||||
import com.android.settings.widget.AppPreference;
|
||||
import com.android.settings.wrapper.ActivityInfoWrapper;
|
||||
import com.android.settings.wrapper.UserManagerWrapper;
|
||||
import com.android.settingslib.wrapper.PackageManagerWrapper;
|
||||
@@ -176,7 +177,7 @@ public class PictureInPictureSettings extends EmptyTextSettings {
|
||||
final String packageName = appInfo.packageName;
|
||||
final CharSequence label = appInfo.loadLabel(pm);
|
||||
|
||||
final Preference pref = new Preference(prefContext);
|
||||
final Preference pref = new AppPreference(prefContext);
|
||||
pref.setIcon(mIconDrawableFactory.getBadgedIcon(appInfo, userId));
|
||||
pref.setTitle(pm.getUserBadgedLabel(label, user));
|
||||
pref.setSummary(PictureInPictureDetails.getPreferenceSummary(prefContext,
|
||||
|
||||
@@ -18,14 +18,13 @@ package com.android.settings.applications;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.Formatter;
|
||||
|
||||
import android.util.Log;
|
||||
import com.android.settings.AppProgressPreference;
|
||||
import com.android.settings.widget.AppPreference;
|
||||
|
||||
public class ProcessStatsPreference extends AppProgressPreference {
|
||||
public class ProcessStatsPreference extends AppPreference {
|
||||
static final String TAG = "ProcessStatsPreference";
|
||||
|
||||
private ProcStatsPackageEntry mEntry;
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.util.Log;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.widget.AppPreference;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.wrapper.PackageManagerWrapper;
|
||||
@@ -230,8 +231,7 @@ public class RecentAppsPreferenceController extends AbstractPreferenceController
|
||||
boolean rebindPref = true;
|
||||
Preference pref = appPreferences.remove(pkgName);
|
||||
if (pref == null) {
|
||||
pref = new Preference(prefContext);
|
||||
pref.setLayoutResource(R.layout.preference_app);
|
||||
pref = new AppPreference(prefContext);
|
||||
rebindPref = false;
|
||||
}
|
||||
pref.setKey(pkgName);
|
||||
|
||||
@@ -84,6 +84,11 @@ public abstract class DefaultAppPickerFragment extends RadioButtonPickerFragment
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRadioButtonPreferenceCustomLayoutResId() {
|
||||
return R.layout.preference_app;
|
||||
}
|
||||
|
||||
protected ConfirmationDialogFragment newConfirmationDialogFragment(String selectedKey,
|
||||
CharSequence confirmationMessage) {
|
||||
final ConfirmationDialogFragment fragment = new ConfirmationDialogFragment();
|
||||
|
||||
@@ -29,6 +29,7 @@ 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.TwoTargetPreference;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.wrapper.PackageManagerWrapper;
|
||||
|
||||
@@ -53,6 +54,12 @@ public abstract class DefaultAppPreferenceController extends AbstractPreferenceC
|
||||
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).setUseSmallIcon(true);
|
||||
}
|
||||
if (!TextUtils.isEmpty(defaultAppLabel)) {
|
||||
preference.setSummary(defaultAppLabel);
|
||||
Utils.setSafeIcon(preference, getDefaultAppIcon());
|
||||
|
||||
Reference in New Issue
Block a user