You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -72,49 +80,52 @@ If you use the Iconics library via XML provide the icon you want to use in the f
72
80
available fonts and their `fontId` can be found near the end of the README.md
73
81
All icon names from the default fonts can be found via the [DEMO](https://play.google.com/store/apps/details?id=com.mikepenz.iconics.sample) application.
74
82
75
-
###As ImageView
76
-
```xml
77
-
<com.mikepenz.iconics.view.IconicsImageView
78
-
android:layout_width="72dp"
79
-
android:layout_height="72dp"
80
-
app:iiv_color="@android:color/holo_red_dark"
81
-
app:iiv_icon="gmd-favorite" />
82
-
```
83
-
84
-
###As Text
85
-
86
-
To use the icon within text use the `{` icon-definer `}` syntax
87
-
83
+
####Notation within text
84
+
Use the `{` icon-definer `}` syntax
88
85
```gson
89
86
Some great text with a {faw-android} font awesome icon and {met-wind} meteocons icons.
90
87
```
91
88
92
-
###Normal Views
93
-
94
-
####TextView / Button
95
-
If you are going to use the **Android-Iconics** on normal `TextView`s or `Buttons` you will have to overwrite
96
-
the `attachBaseContext` of your Activity.
97
-
98
-
**Note:** If you are going to use the **Android-Iconics** manually via `new Iconics.IconicsBuilder().ctx(this)....on(tv1) you should not use this.
###As TextView (only available if you inject the context)
107
111
```xml
108
112
<TextView
109
-
android:text="{gmd-chart} Chart"
110
-
android:textColor="@android:color/black"
111
-
android:layout_width="wrap_content"
112
-
android:layout_height="56dp"
113
-
android:textSize="16sp"/>
113
+
android:text="{gmd-chart} Chart"
114
+
android:textColor="@android:color/black"
115
+
android:layout_width="wrap_content"
116
+
android:layout_height="56dp"
117
+
android:textSize="16sp"/>
114
118
```
115
119
116
-
117
-
###Custom Views
120
+
###Custom Views (if you do NOT inject the context)
121
+
####As IconicsImageView
122
+
```xml
123
+
<com.mikepenz.iconics.view.IconicsImageView
124
+
android:layout_width="72dp"
125
+
android:layout_height="72dp"
126
+
app:iiv_color="@android:color/holo_red_dark"
127
+
app:iiv_icon="gmd-favorite" />
128
+
```
118
129
119
130
####As IconicsTextView
120
131
```xml
@@ -209,150 +220,18 @@ Sometimes you won't like to use the icon-key ("faw-adjust") like this, but use t
209
220
```
210
221
211
222
212
-
###Create custom fonts using [Fontello](http://fontello.com) or [IcoMoon](http://icomoon.io)
213
-
214
-
If you plan to use an existing icon font, one provided by your design team, or if you have an svg and want to use it as drawable just follow those simple steps.
215
-
216
-
####1. Create the icon font (not required if you already have one)
217
-
Open [Fontello](http://fontello.com) or [IcoMoon](http://icomoon.io) and select the icons you need. Add your vectors (.svg) and then just download the font.
218
-
219
-
####1.2. Add the font to your project
220
-
- Unpack the .zip you just downloaded and add the *.ttf to your project under `src/main/assets/fonts`
221
-
- In the next step you will have to know the unicode value for the icons
222
-
- this information can be found in the `fontello-codes.css` (if you used fontello)
223
-
- or in the style.css (if you used icomoon)
223
+
##Create custom fonts
224
+
This is possible with only the *.ttf and *.css mapping file. And will take you 2 minutes.
224
225
225
-
####2. Implement your CustomFont
226
-
- Great you got your IconFont and you know which unicode character displays which icon. Now you can create your own font with it. You have to options 2.1. or 2.2.
226
+
You can get these two files by downloading a web icon font, or if you want to create your
227
+
own custom icon font from *.svg files then you can use following tools:
228
+
*[Fontello](http://fontello.com)
229
+
*[IcoMoon](http://icomoon.io)
230
+
* let me know if you find other tools.
227
231
228
-
#####2.1. Implement as GenericFont
229
-
- To implement a GenericFont just provide the mapping before you use the Iconics. (best inside a [CustomApplication](https://github.com/mikepenz/Android-Iconics/blob/develop/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.java))
230
-
231
-
```java
232
-
//Create a new GenericFont by defining a 3 char long fontId and by defining the path to the font (starting inside src/main/assets)
- A more complex but easier to use / more safe implementation is to create a CustomFont.
249
-
- For a QuickStart just use the [CustomFont](https://github.com/mikepenz/Android-Iconics/blob/develop/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.java) used in the Sample app
250
-
- A CustomFont has to implement the `ITypeface` interface, and can then be easily used as any of the provided fonts
251
-
252
-
```java
253
-
publicclassCustomFontimplementsITypeface {
254
-
//define the font file to use
255
-
privatestaticfinalStringTTF_FILE="fontello.ttf";
256
-
257
-
privatestaticTypeface typeface =null;
258
-
privatestaticHashMap<String, Character> mChars;
259
-
260
-
//return a icon by it's key
261
-
@Override
262
-
publicIIcongetIcon(Stringkey) {
263
-
returnIcon.valueOf(key);
264
-
}
265
-
266
-
//return all possible key unicode-character mappings
//implement the enum containing all possible icons. each icon name is like `fontId`_`iconNamE` --> `fon_test1` maps to the icon with the unicode char \e800
321
-
publicstaticenumIconimplementsIIcon {
322
-
//define all possible mappings here:
323
-
fon_test1('\ue800'),
324
-
fon_test2('\ue801');
325
-
326
-
//define all methods required by the IIcon interface, you can just copy and paste those
327
-
char character;
328
-
Icon(charcharacter) {
329
-
this.character = character;
330
-
}
331
-
332
-
publicStringgetFormattedName() {
333
-
return"{"+ name() +"}";
334
-
}
335
-
336
-
publicchargetCharacter() {
337
-
return character;
338
-
}
339
-
340
-
publicStringgetName() {
341
-
return name();
342
-
}
343
-
344
-
// remember the typeface so we can use it later
345
-
privatestaticITypeface typeface;
346
-
347
-
publicITypefacegetTypeface() {
348
-
if (typeface ==null) {
349
-
typeface =newCustomFont();
350
-
}
351
-
return typeface;
352
-
}
353
-
}
354
-
}
355
-
```
232
+
After you got those two files, head over to the icon addon creation tool [android-iconics.mikepenz.com](http://android-iconics.mikepenz.com).
233
+
Enter all the information. Add the *.ttf and *.css and click the button. It will generate and download the icon font addon as
234
+
zip. (this tool is local only, no files are sent to a server, you can safely use it with any icons)
356
235
357
236
#ProGuard
358
237
Exclude `R` from ProGuard to enable the font addon auto detection
0 commit comments