File tree Expand file tree Collapse file tree
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 1111 */
1212class 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
You can’t perform that action at this time.
0 commit comments