JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 527 forks source link

Error occurred when set the icon color as @android:color/xxx #127

Closed guobosheng closed 8 years ago

guobosheng commented 8 years ago

An error occurred when processing {ion-radio-waves 29sp @android:color/holo_blue_light}

09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:  Caused by: java.lang.IllegalArgumentException: Unknown expression @android:color/holo_blue_light in "{ion-radio-waves 29sp @android:color/holo_blue_light} Share with family"
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:     at com.joanzapata.iconify.internal.ParsingUtil.recursivePrepareSpannableIndexes(ParsingUtil.java:153)
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:     at com.joanzapata.iconify.internal.ParsingUtil.parse(ParsingUtil.java:31)
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:     at com.joanzapata.iconify.Iconify.compute(Iconify.java:59)
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:     at com.joanzapata.iconify.widget.IconTextView.setText(IconTextView.java:34)
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:     at android.widget.TextView.<init>(TextView.java:1320)
09-25 16:20:08.922 28932-28932/com.abc.example E/AndroidRuntime:    at android.widget.TextView.<init>(TextView

The relevant code:ParsingUtil.java:31

        // Look for an icon color
        else if (stroke.matches("#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})")) {
            iconColor = Color.parseColor(stroke);
        } else if (stroke.matches("@color/(.*)")) {
            iconColor = getColorFromResource(context, stroke.substring(7));
            if (iconColor == Integer.MAX_VALUE)
                throw new IllegalArgumentException("Unknown resource " + stroke + " in \"" + fullText + "\"");
        } else {
            throw new IllegalArgumentException("Unknown expression " + stroke + " in \"" + fullText + "\"");
        }
JoanZapata commented 8 years ago

Fixed on develop, will be in 2.1.1