Compact editor photo picker 2/2 (E15)
Expose static method to get an AccountType Drawable
from the underlying resource IDs and sync adapter
package names.
Bug 19697372
Bug 23589603
Change-Id: I57ab4090ce13618c292c9d267f1735135f8fc950
diff --git a/src/com/android/contacts/common/model/account/AccountType.java b/src/com/android/contacts/common/model/account/AccountType.java
index 53ab47d..8b50d79 100644
--- a/src/com/android/contacts/common/model/account/AccountType.java
+++ b/src/com/android/contacts/common/model/account/AccountType.java
@@ -277,11 +277,16 @@
}
public Drawable getDisplayIcon(Context context) {
- if (this.titleRes != -1 && this.syncAdapterPackageName != null) {
+ return getDisplayIcon(context, titleRes, iconRes, syncAdapterPackageName);
+ }
+
+ public static Drawable getDisplayIcon(Context context, int titleRes, int iconRes,
+ String syncAdapterPackageName) {
+ if (titleRes != -1 && syncAdapterPackageName != null) {
final PackageManager pm = context.getPackageManager();
- return pm.getDrawable(this.syncAdapterPackageName, this.iconRes, null);
- } else if (this.titleRes != -1) {
- return context.getResources().getDrawable(this.iconRes);
+ return pm.getDrawable(syncAdapterPackageName, iconRes, null);
+ } else if (titleRes != -1) {
+ return context.getResources().getDrawable(iconRes);
} else {
return null;
}