Skip to content

Commit 0b35c6d

Browse files
author
zedoref
committed
keep enum attribute
1 parent d909f70 commit 0b35c6d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapText.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public Builder addText(CharSequence text) {
5757
*/
5858
public Builder addFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
5959
IconSet iconSet = TypefaceProvider.retrieveRegisteredIconSet(FontAwesome.FONT_PATH);
60-
sb.append(iconSet.unicodeForKey(iconCode));
60+
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
6161
fontIndicesMap.put(sb.length(), iconSet);
6262
return this;
6363
}
@@ -68,7 +68,7 @@ public Builder addFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
6868
*/
6969
public Builder addTypicon(@Typicon.Icon CharSequence iconCode) {
7070
IconSet iconSet = TypefaceProvider.retrieveRegisteredIconSet(Typicon.FONT_PATH);
71-
sb.append(iconSet.unicodeForKey(iconCode));
71+
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
7272
fontIndicesMap.put(sb.length(), iconSet);
7373
return this;
7474
}
@@ -79,7 +79,7 @@ public Builder addTypicon(@Typicon.Icon CharSequence iconCode) {
7979
* @return the updated builder instance
8080
*/
8181
public Builder addIcon(CharSequence iconCode, IconSet iconSet) {
82-
sb.append(iconSet.unicodeForKey(iconCode));
82+
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
8383
fontIndicesMap.put(sb.length(), iconSet);
8484
return this;
8585
}

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/IconResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*/
1212
class IconResolver {
1313

14-
private static final String REGEX_FONT_AWESOME = "fa_[a-z_0-9]+";
15-
private static final String REGEX_TYPICONS = "ty_[a-z_0-9]+";
14+
private static final String REGEX_FONT_AWESOME = "(fa_|fa-)[a-z_0-9]+";
15+
private static final String REGEX_TYPICONS = "(ty_|ty-)[a-z_0-9]+";
1616

1717
/**
1818
* Resolves markdown to produce a BootstrapText instance. e.g. "{fa_android}" would be replaced
@@ -51,7 +51,7 @@ else if (c == '}') {
5151
if (startIndex != -1 && endIndex != -1) { // recognised markdown string
5252

5353
if (startIndex >= 0 && endIndex < markdown.length()) {
54-
String iconCode = markdown.substring(startIndex + 1, endIndex);
54+
String iconCode = markdown.substring(startIndex + 1, endIndex).replaceAll("\\-", "_");
5555
builder.addText(markdown.substring(lastAddedIndex, startIndex));
5656

5757
if (iconCode.matches(REGEX_FONT_AWESOME)) { // text is FontAwesome code

0 commit comments

Comments
 (0)