Merge "Remove automatic rule icons" into oc-dr1-dev am: 0ed32cae99
am: 1f14e49fa5
Change-Id: I16bf3668f5ba49d7ff471322bd68937c6da23d0d
This commit is contained in:
@@ -304,11 +304,8 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0);
|
ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0);
|
||||||
LoadIconTask task = new LoadIconTask(this);
|
|
||||||
task.execute(info);
|
|
||||||
setSummary(computeRuleSummary(rule, isSystemRule, info.loadLabel(mPm)));
|
setSummary(computeRuleSummary(rule, isSystemRule, info.loadLabel(mPm)));
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
setIcon(R.drawable.ic_label);
|
|
||||||
appExists = false;
|
appExists = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -345,29 +342,6 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LoadIconTask extends AsyncTask<ApplicationInfo, Void, Drawable> {
|
|
||||||
private final WeakReference<Preference> prefReference;
|
|
||||||
|
|
||||||
public LoadIconTask(Preference pref) {
|
|
||||||
prefReference = new WeakReference<>(pref);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Drawable doInBackground(ApplicationInfo... params) {
|
|
||||||
return params[0].loadIcon(mPm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Drawable icon) {
|
|
||||||
if (icon != null) {
|
|
||||||
final Preference pref = prefReference.get();
|
|
||||||
if (pref != null) {
|
|
||||||
pref.setIcon(icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SummaryBuilder {
|
public static class SummaryBuilder {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
Reference in New Issue
Block a user