Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,26 @@ static String pullFontPathFromView(Context context, AttributeSet attrs, int attr
final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1);
return stringResourceId > 0
? context.getString(stringResourceId)
: attrs.getAttributeValue(null, attributeName);
: pullFontPathFromAttribute(context, attrs.getAttributeValue(null, attributeName));
}

/**
* Tries to convert from an attribute to a String
*/
static String pullFontPathFromAttribute(Context context, String attribute) {
String value = null;
if (attribute != null && attribute.startsWith("?")) {
try {
int identifier = context.getResources().getIdentifier(attribute.substring(1),
"attr",
context.getPackageName());
TypedValue attr = new TypedValue();
context.getTheme().resolveAttribute(identifier, attr, true);
value = attr.coerceToString().toString();
} catch (NullPointerException ignore) { /* Handle a missing attr or invalid value */ }
}
if (value == null) value = attribute; // Allow this to work as it always has
return value;
}

/**
Expand Down