Update IconicsArrayBuilder.java
Added support typefaces for icons
MODIFY
library-core/src/main/java/com/mikepenz/iconics/IconicsArrayBuilder.java
library-core/src/main/java/com/mikepenz/iconics/IconicsArrayBuilder.java
@@ -9,24 +9,34 @@ import java.util.ArrayList;
*/
public class IconicsArrayBuilder {
private IconicsDrawable mIconBase;
- private ArrayList<Object> mIcons = new ArrayList<>();
+ private ArrayList<Pair<Object, Typeface>> mIcons = new ArrayList<>();
public IconicsArrayBuilder(IconicsDrawable iconicsDrawable) {
this.mIconBase = iconicsDrawable;
}
public IconicsArrayBuilder add(IIcon icon) {
- mIcons.add(icon);
+ mIcons.add(Pair.create(icon, null));
return this;
}
public IconicsArrayBuilder add(String icon) {
- mIcons.add(icon);
+ mIcons.add(Pair.create(icon, Typeface.DEFAULT));
return this;
}
public IconicsArrayBuilder add(Character icon) {
- mIcons.add(icon);
+ mIcons.add(Pair.create(icon, Typeface.DEFAULT));
+ return this;
+ }
+
+ public IconicsArrayBuilder add(String icon, Typeface typeface) {
+ mIcons.add(Pair.create(icon, typeface));
+ return this;
+ }
+
+ public IconicsArrayBuilder add(Character icon, Typeface typeface) {
+ mIcons.add(Pair.create(icon, typeface));
return this;
}
@@ -34,12 +44,13 @@ public class IconicsArrayBuilder {
IconicsDrawable[] iconicsDrawables = new IconicsDrawable[mIcons.size()];
for (int i = 0; i < mIcons.size(); i++) {
- if (mIcons.get(i) instanceof IIcon) {
- iconicsDrawables[i] = mIconBase.clone().icon((IIcon) mIcons.get(i));
- } else if (mIcons.get(i) instanceof Character) {
- iconicsDrawables[i] = mIconBase.clone().icon((Character) mIcons.get(i));
- } else if (mIcons.get(i) instanceof String) {
- iconicsDrawables[i] = mIconBase.clone().iconText((String) mIcons.get(i));
+ Pair<Object, Typeface> pair = mIcons.get(i);
+ if (pair.first instanceof IIcon) {
+ iconicsDrawables[i] = mIconBase.clone().icon((IIcon) pair.first);
+ } else if (pair.first instanceof Character) {
+ iconicsDrawables[i] = mIconBase.clone().icon((Character) pair.first, pair.second);
+ } else if (pair.first instanceof String) {
+ iconicsDrawables[i] = mIconBase.clone().iconText((String) pair.first, pair.second);
}
}

Update IconicsArrayBuilder.java

- Added support typefaces for icons