Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a9ff812 authored by Walter Jang's avatar Walter Jang
Browse files

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
parent c1f2724b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -277,11 +277,16 @@ public abstract class AccountType {
    }

    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;
        }