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:
Fan Zhang
2017-10-28 15:11:49 -07:00
parent 974d2fe080
commit 1c3a4de93d
25 changed files with 350 additions and 121 deletions

View File

@@ -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());