fix requested changes part 1

This commit is contained in:
Christian Schabesberger 2018-04-29 13:15:52 +02:00
parent f158276939
commit 421be909a8
3 changed files with 36 additions and 19 deletions

View file

@ -190,4 +190,16 @@ public class ThemeHelper {
String defaultTheme = context.getResources().getString(R.string.default_theme_value);
return PreferenceManager.getDefaultSharedPreferences(context).getString(themeKey, defaultTheme);
}
/**
* This will get the R.drawable.* resource to which attr is currently pointing to.
*
* @param attr a R.attribute.* resource value
* @param context the context to use
* @return a R.drawable.* resource value
*/
public static int getIconByAttr(final int attr, final Context context) {
return context.obtainStyledAttributes(new int[] {attr})
.getResourceId(0, -1);
}
}