Skip to content

Commit bf2c751

Browse files
committed
Open Source!
0 parents  commit bf2c751

File tree

195 files changed

+11537
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+11537
-0
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# generated files
12+
*/bin/
13+
*/gen/
14+
15+
# Local configuration file (sdk path, etc)
16+
*/local.properties
17+
18+
19+
# local build config items
20+
SparkCore/res/values/local_build.xml
21+
22+
23+
# Eclipse project files
24+
# COMMENTED OUT: we want these.
25+
#.classpath
26+
#.project
27+
28+
*/.metadata/
29+
*/.settings/

Fontify/.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Android Generated Files:
2+
bin
3+
gen
4+
lint.xml
5+
6+
# Eclipse Files:
7+
.project
8+
.classpath
9+
.settings
10+
.checkstyle
11+
12+
# IntelliJ IDEA Files:
13+
.idea
14+
*.iml
15+
*.ipr
16+
*.iws
17+
classes
18+
gen-external-apklibs
19+
20+
# Maven Files:
21+
target
22+
release.properties
23+
pom.xml.*
24+
25+
# Ant Files:
26+
ant.properties
27+
local.properties
28+
proguard.cfg
29+
proguard-project.txt
30+
31+
# Other Files:
32+
.DS_Store
33+
tmp

Fontify/AndroidManifest.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.danh32.fontify"
3+
android:versionCode="1"
4+
android:versionName="1.0" >
5+
6+
<uses-sdk
7+
android:minSdkVersion="14"
8+
android:targetSdkVersion="19" />
9+
10+
<application android:allowBackup="true" >
11+
</application>
12+
13+
</manifest>

Fontify/pom.xml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.danh32.fontify</groupId>
6+
<artifactId>fontify</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>apklib</packaging>
9+
10+
<name>Fontify</name>
11+
<description>Android TextView subclasses with easy custom font capabilities.</description>
12+
<url>https://github.com/danh32/Fontify</url>
13+
14+
<licenses>
15+
<license>
16+
<name>The Apache Software License, Version 2.0</name>
17+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
18+
<distribution>repo</distribution>
19+
</license>
20+
</licenses>
21+
22+
<scm>
23+
<url>https://github.com/danh32/Fontify</url>
24+
</scm>
25+
26+
<properties>
27+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
28+
<platform.version> 4.1.1.4
29+
</platform.version>
30+
<android.plugin.version>3.5.3</android.plugin.version>
31+
</properties>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>com.google.android</groupId>
36+
<artifactId>android</artifactId>
37+
<version>${platform.version}</version>
38+
<scope>provided</scope>
39+
</dependency>
40+
</dependencies>
41+
42+
<build>
43+
<plugins>
44+
<plugin>
45+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
46+
<artifactId>android-maven-plugin</artifactId>
47+
<version>${android.plugin.version}</version>
48+
<extensions>true</extensions>
49+
<configuration>
50+
<sdk>
51+
<platform>17</platform>
52+
</sdk>
53+
</configuration>
54+
</plugin>
55+
</plugins>
56+
</build>
57+
</project>

Fontify/project.properties

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-19
15+
android.library=true

Fontify/readme.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#Fontify
2+
3+
Fontify is an Android library project providing drop-in replacements for all Android TextView subclasses, allowing developers to apply custom fonts via xml layouts and/or styles.
4+
5+
##Set Up:
6+
1) Clone Fontify locally
7+
2) Import library project into Eclipse
8+
3) Add Fontify to your app as a library project
9+
10+
##Usage:
11+
###Getting fonts in place:
12+
1) Put your custom font file in Android's assets folder (assets/fonts/helvetica.ttf)
13+
2) Put the path to your file in your strings.xml for ease of use:
14+
15+
<string name="FONT_HELVETICA">fonts/helvetica.ttf</string>
16+
17+
###Applying fonts:
18+
####In styles/themes:
19+
1) Declare your style in res/values/styles.xml:
20+
21+
<style name="CustomTextViewStyle">
22+
<item name="font">@string/FONT_HELVETICA</item>
23+
</style>
24+
2) Use the Fontify subclass of your TextView:
25+
<com.danh32.fontify.TextView
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
style="@style/CustomTextViewStyle" />
29+
30+
####In layouts:
31+
1) Add new XML NameSpace to root element of layout:
32+
33+
xmlns:fontify="http://schemas.android.com/apk/res-auto"
34+
2) Use the Fontify subclass of your TextView:
35+
36+
<com.danh32.fontify.TextView
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
fontify:font="@string/FONT_HELVETICA" />
40+
41+
####In Java:
42+
Use the textView.setFont(String fontPath) or textView.setFont(int resId) method:
43+
44+
import com.danh32.fontify.TextView;
45+
46+
public class CustomFontActivity extends Activity {
47+
@Override
48+
onCreate (Bundle savedInstanceState) {
49+
super(savedInstanceState);
50+
51+
TextView tv = new TextView(this);
52+
tv.setFont(R.string.FONT_HELVETICA);
53+
}
54+
}
55+
56+
##License
57+
Copyright 2013 Daniel Hill
58+
59+
Licensed under the Apache License, Version 2.0 (the "License");
60+
you may not use this file except in compliance with the License.
61+
You may obtain a copy of the License at
62+
63+
http://www.apache.org/licenses/LICENSE-2.0
64+
65+
Unless required by applicable law or agreed to in writing, software
66+
distributed under the License is distributed on an "AS IS" BASIS,
67+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
68+
See the License for the specific language governing permissions and
69+
limitations under the License.

Fontify/res/values/attrs.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="Fontify">
4+
<attr name="font" format="string" />
5+
</declare-styleable>
6+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.danh32.fontify;
2+
3+
4+
import android.content.Context;
5+
import android.util.AttributeSet;
6+
7+
8+
public class AutoCompleteTextView extends android.widget.AutoCompleteTextView {
9+
public AutoCompleteTextView(Context context) {
10+
super(context);
11+
}
12+
13+
public AutoCompleteTextView(Context context, AttributeSet attrs) {
14+
super(context, attrs);
15+
16+
// return early for eclipse preview mode
17+
if (isInEditMode()) return;
18+
19+
FontManager.getInstance().setFont(this, attrs);
20+
}
21+
22+
public void setFont(String fontPath) {
23+
FontManager.getInstance().setFont(this, fontPath);
24+
}
25+
26+
public void setFont(int resId) {
27+
String fontPath = getContext().getString(resId);
28+
setFont(fontPath);
29+
}
30+
}
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.danh32.fontify;
2+
3+
4+
import android.content.Context;
5+
import android.graphics.Paint;
6+
import android.util.AttributeSet;
7+
8+
9+
public class Button extends android.widget.Button {
10+
11+
public Button(Context context) {
12+
super(context);
13+
setup();
14+
}
15+
16+
public Button(Context context, AttributeSet attrs) {
17+
super(context, attrs);
18+
setup();
19+
// return early for eclipse preview mode
20+
if (isInEditMode())
21+
return;
22+
23+
FontManager.getInstance().setFont(this, attrs);
24+
}
25+
26+
public void setFont(String fontPath) {
27+
FontManager.getInstance().setFont(this, fontPath);
28+
}
29+
30+
public void setFont(int resId) {
31+
String fontPath = getContext().getString(resId);
32+
setFont(fontPath);
33+
}
34+
35+
private void setup() {
36+
setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.HINTING_ON);
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.danh32.fontify;
2+
3+
4+
import android.content.Context;
5+
import android.graphics.Paint;
6+
import android.util.AttributeSet;
7+
8+
9+
public class CheckBox extends android.widget.CheckBox {
10+
11+
public CheckBox(Context context) {
12+
super(context);
13+
setup();
14+
}
15+
16+
public CheckBox(Context context, AttributeSet attrs) {
17+
super(context, attrs);
18+
setup();
19+
// return early for eclipse preview mode
20+
if (isInEditMode()) {
21+
return;
22+
23+
}
24+
FontManager.getInstance().setFont(this, attrs);
25+
}
26+
27+
public void setFont(String fontPath) {
28+
FontManager.getInstance().setFont(this, fontPath);
29+
}
30+
31+
public void setFont(int resId) {
32+
String fontPath = getContext().getString(resId);
33+
setFont(fontPath);
34+
}
35+
36+
private void setup() {
37+
setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.HINTING_ON);
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.danh32.fontify;
2+
3+
4+
import android.content.Context;
5+
import android.util.AttributeSet;
6+
7+
8+
public class CheckedTextView extends android.widget.CheckedTextView {
9+
public CheckedTextView(Context context) {
10+
super(context);
11+
}
12+
13+
public CheckedTextView(Context context, AttributeSet attrs) {
14+
super(context, attrs);
15+
16+
// return early for eclipse preview mode
17+
if (isInEditMode()) return;
18+
19+
FontManager.getInstance().setFont(this, attrs);
20+
}
21+
22+
public void setFont(String fontPath) {
23+
FontManager.getInstance().setFont(this, fontPath);
24+
}
25+
26+
public void setFont(int resId) {
27+
String fontPath = getContext().getString(resId);
28+
setFont(fontPath);
29+
}
30+
}

0 commit comments

Comments
 (0)