Skip to content

Commit 55e4cd8

Browse files
committed
This fixes #2, resolves #3 and closes #4
1 parent 5cc46c7 commit 55e4cd8

37 files changed

+1712
-1221
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ Change Log
22
==========
33

44

5+
Version 1.2.0 *(2014-10-21)*
6+
----------------------------
7+
8+
* Support multiple iconic fonts.
9+
* Support for displaying the preview in edit mode.
10+
* Fix: Font size too large to fit in cache.
11+
12+
513
Version 1.1.0 *(2014-10-06)*
614
----------------------------
715

README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Download
1818
Gradle:
1919

2020
```groovy
21-
compile 'com.github.johnkil.print:print:1.1.0'
21+
compile 'com.github.johnkil.print:print:1.2.0'
2222
```
2323

2424
Maven:
@@ -27,22 +27,23 @@ Maven:
2727
<dependency>
2828
<groupId>com.github.johnkil.print</groupId>
2929
<artifactId>print</artifactId>
30-
<version>1.1.0</version>
30+
<version>1.2.0</version>
3131
</dependency>
3232
```
3333

3434
Usage
3535
-----
3636

37-
First, you need to initialize the iconic font in [Application.onCreate()][1] method.
37+
First, you need to initialize the default iconic font in [Application.onCreate()][1] method. If
38+
the font is not specified, then the font is used by default.
3839

3940
```java
4041
public class MyApplication extends Application {
4142

4243
@Override
4344
public void onCreate() {
4445
super.onCreate();
45-
Print.initFont(getAssets(), "fonts/iconic-font.ttf");
46+
PrintConfig.initDefault(getAssets(), "fonts/iconic-font.ttf");
4647
}
4748

4849
}
@@ -53,11 +54,12 @@ public class MyApplication extends Application {
5354
Use `PrintView` as single icon in your layout.
5455

5556
```xml
56-
<com.github.johnkil.print.widget.PrintView
57+
<com.github.johnkil.print.PrintView
5758
android:layout_width="wrap_content"
5859
android:layout_height="wrap_content"
5960
print:iconColor="@color/icon_color"
6061
print:iconSize="@dimen/icon_size"
62+
print:iconFont="fonts/iconic-font.ttf"
6163
print:iconText="@string/ic_android"
6264
android:contentDescription="@string/ic_android_description"/>
6365
```
@@ -67,11 +69,12 @@ Use `PrintView` as single icon in your layout.
6769
Use `PrintButton` to create a button with an icon.
6870

6971
```xml
70-
<com.github.johnkil.print.widget.PrintButton
72+
<com.github.johnkil.print.PrintButton
7173
android:layout_width="wrap_content"
7274
android:layout_height="wrap_content"
7375
print:iconColor="@color/icon_color"
7476
print:iconSize="@dimen/icon_size"
77+
print:iconFont="fonts/iconic-font.ttf"
7578
print:iconText="@string/ic_android"
7679
android:contentDescription="@string/ic_android_description"/>
7780
```
@@ -83,10 +86,14 @@ If you need an icon in `ImageView` or in `ActionBar`, then you should use `Print
8386
```java
8487
ImageView imageView = (ImageView) findViewById(R.id.image);
8588
// Set an icon in the ImageView
86-
imageView.setImageDrawable(new PrintDrawable()
87-
.iconText(getResources().getString(R.string.ic_info))
88-
.iconColor(getResources().getColor(R.color.icon_color))
89-
.iconSize(getResources().getDimensionPixelSize(R.dimen.icon_size)));
89+
imageView.setImageDrawable(
90+
new PrintDrawable.Builder(context)
91+
.iconText(R.string.ic_info)
92+
.iconColor(R.color.icon_color)
93+
.iconSize(R.dimen.icon_size)
94+
.iconFont("fonts/iconic-font.ttf")
95+
.build()
96+
);
9097
```
9198

9299
```java
@@ -95,10 +102,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
95102
getMenuInflater().inflate(R.menu.main, menu);
96103
// Set an icon in the ActionBar
97104
menu.findItem(R.id.action_info).setIcon(
98-
new PrintDrawable()
99-
.iconText(getResources().getString(R.string.ic_info))
100-
.iconColor(getResources().getColor(R.color.ab_icon_color))
101-
.iconSize(getResources().getDimensionPixelSize(R.dimen.ab_icon_size))
105+
new PrintDrawable.Builder(context)
106+
.iconText(R.string.ic_info)
107+
.iconColor(R.color.ab_icon_color)
108+
.iconSize(R.dimen.ab_icon_size)
109+
.iconFont("fonts/iconic-font.ttf")
110+
.build()
102111
);
103112
return true;
104113
}
@@ -129,4 +138,9 @@ License
129138

130139

131140
[1]: http://developer.android.com/reference/android/app/Application.html#onCreate%28%29
132-
[2]: https://github.com/johnkil/Android-Icon-Fonts
141+
[2]: https://github.com/johnkil/Android-Icon-Fonts
142+
143+
[0]: https://github.com/shamanland/fonticon
144+
[0]: https://github.com/atermenji/IconicDroid
145+
[0]: https://github.com/JoanZapata/android-iconify
146+
[0]: https://github.com/chrisjenx/Calligraphy

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
jcenter()
44
}
55
dependencies {
6-
classpath 'com.android.tools.build:gradle:0.13.2'
6+
classpath 'com.android.tools.build:gradle:0.13.3'
77
}
88
}
99

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=1.1.0-SNAPSHOT
2-
VERSION_CODE=2
1+
VERSION_NAME=1.2.0-SNAPSHOT
2+
VERSION_CODE=3
33
GROUP=com.github.johnkil.print
44

55
POM_DESCRIPTION=A lightweight Android library for use iconic fonts.

print-sample/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 20
5-
buildToolsVersion "20.0.0"
4+
compileSdkVersion 21
5+
buildToolsVersion "21.0.1"
66

77
defaultConfig {
88
applicationId "com.github.johnkil.print.sample"
99
minSdkVersion 8
10-
targetSdkVersion 20
11-
versionCode 2
12-
versionName "1.1.0"
10+
targetSdkVersion 21
11+
versionCode 3
12+
versionName "1.2.0"
1313
}
1414
}
1515

1616
dependencies {
17-
compile 'com.android.support:appcompat-v7:20.0.0'
17+
compile 'com.android.support:appcompat-v7:21.0.0'
1818
compile project(':print')
1919
}
19.6 KB
Binary file not shown.

print-sample/src/main/java/com/github/johnkil/print/sample/MainActivity.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Evgeny Shishkin
2+
* Copyright (C) 2014 Evgeny Shishkin
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,13 +25,9 @@
2525
import android.widget.SeekBar;
2626
import android.widget.TextView;
2727

28-
import com.github.johnkil.print.drawable.PrintDrawable;
29-
import com.github.johnkil.print.widget.PrintView;
28+
import com.github.johnkil.print.PrintDrawable;
29+
import com.github.johnkil.print.PrintView;
3030

31-
32-
/**
33-
* @author Evgeny Shishkin
34-
*/
3531
public class MainActivity extends ActionBarActivity {
3632

3733
@Override
@@ -46,9 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
4642
@Override
4743
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
4844
sizeValue.setText(getString(R.string.size_format, progress));
49-
int iconSize = (int) TypedValue.applyDimension(
50-
TypedValue.COMPLEX_UNIT_DIP, progress, getResources().getDisplayMetrics());
51-
iconView.setIconSize(iconSize);
45+
iconView.setIconSize(TypedValue.COMPLEX_UNIT_DIP, progress);
5246
}
5347

5448
@Override
@@ -70,16 +64,19 @@ public void onClick(View v) {
7064
// on click process
7165
}
7266
});
67+
7368
}
7469

7570
@Override
7671
public boolean onCreateOptionsMenu(Menu menu) {
7772
getMenuInflater().inflate(R.menu.main, menu);
7873
menu.findItem(R.id.action_info).setIcon(
79-
new PrintDrawable()
80-
.iconText(getResources().getString(R.string.ic_info))
81-
.iconColor(getResources().getColor(R.color.ab_icon_color))
82-
.iconSize(getResources().getDimensionPixelSize(R.dimen.ab_icon_size))
74+
new PrintDrawable.Builder(this)
75+
.iconText(R.string.ic_holo_about)
76+
.iconColor(R.color.ab_icon_color)
77+
.iconFont("fonts/holo-icon-font.ttf")
78+
.iconSize(R.dimen.ab_icon_size)
79+
.build()
8380
);
8481
return true;
8582
}

print-sample/src/main/java/com/github/johnkil/print/sample/PrintApplication.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Evgeny Shishkin
2+
* Copyright (C) 2014 Evgeny Shishkin
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,17 +18,14 @@
1818

1919
import android.app.Application;
2020

21-
import com.github.johnkil.print.Print;
21+
import com.github.johnkil.print.PrintConfig;
2222

23-
/**
24-
* @author Evgeny Shishkin
25-
*/
2623
public class PrintApplication extends Application {
2724

2825
@Override
2926
public void onCreate() {
3027
super.onCreate();
31-
Print.initFont(getAssets(), "fonts/material-icon-font.ttf");
28+
PrintConfig.initDefault(getAssets(), "fonts/material-icon-font.ttf");
3229
}
3330

3431
}

print-sample/src/main/res/color/icon.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (C) 2014 Evgeny Shishkin
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
217

318
<selector xmlns:android="http://schemas.android.com/apk/res/android">
419
<item android:state_pressed="true"

0 commit comments

Comments
 (0)