fe741277857d146a953d8cb60594aa3c5cc06650
mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/BitmapHelper.java
| ... | ... | @@ -110,15 +110,16 @@ public class BitmapHelper { |
| 110 | 110 | * @return the Drawable of the resource |
| 111 | 111 | */ |
| 112 | 112 | public static Drawable getAttrDrawable(Context context, @AttrRes int attrRes) { |
| 113 | - Drawable drawable = null; |
|
| 113 | + final Drawable drawable; |
|
| 114 | 114 | TypedValue value = new TypedValue(); |
| 115 | 115 | if (context.getTheme().resolveAttribute(attrRes, value, true)) { |
| 116 | - String[] data = String.valueOf(value.string).split("/"); |
|
| 117 | - int resId = context.getResources().getIdentifier(data[2].substring(0, data[2].length() - 4), "drawable", |
|
| 118 | - context.getPackageName()); |
|
| 119 | - if (resId != 0) { |
|
| 120 | - drawable = ContextCompat.getDrawable(context, resId); |
|
| 116 | + if (value.resourceId != 0) { |
|
| 117 | + drawable = ContextCompat.getDrawable(context, value.resourceId); |
|
| 118 | + } else { |
|
| 119 | + drawable = null; |
|
| 121 | 120 | } |
| 121 | + } else { |
|
| 122 | + drawable = null; |
|
| 122 | 123 | } |
| 123 | 124 | return drawable; |
| 124 | 125 | } |