├── ascent ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── net │ │ └── jamesbaca │ │ └── ascent │ │ ├── FontHelper.java │ │ ├── InjectedAscent.java │ │ ├── Font.java │ │ └── Ascent.java ├── build.gradle └── pom.xml ├── demo ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ └── fonts │ │ │ │ ├── Lobster.ttf │ │ │ │ └── Playball-Regular.ttf │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── styles.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── main.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── net │ │ │ │ └── jamesbaca │ │ │ │ └── ascent │ │ │ │ └── mymodule │ │ │ │ └── app │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── DemoApplicationModule.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── net │ │ └── jamesbaca │ │ └── ascent │ │ └── mymodule │ │ └── app │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── simple-demo ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ └── fonts │ │ │ │ ├── Lobster.ttf │ │ │ │ └── Playball-Regular.ttf │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── styles.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── main.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── net │ │ │ └── jamesbaca │ │ │ └── ascent │ │ │ └── demo │ │ │ └── MainActivity.java │ └── androidTest │ │ └── java │ │ └── net │ │ └── jamesbaca │ │ └── ascent │ │ └── demo │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── licenses │ ├── OFL_Playball.txt │ └── OFL_Lobster.txt ├── ascent-processor ├── .gitignore ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── javax.annotation.processing.Processor │ │ └── java │ │ │ └── net │ │ │ └── jamesbaca │ │ │ └── ascent │ │ │ └── internal │ │ │ ├── AnnotatedField.java │ │ │ ├── WriterFactory.java │ │ │ ├── EnclosingClass.java │ │ │ ├── FontProcessor.java │ │ │ ├── FontClassWriter.java │ │ │ └── AnnotationsConverter.java │ └── test │ │ └── java │ │ └── AscentTest.java ├── build.gradle └── pom.xml ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .travis.yml ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE.txt /ascent/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /simple-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ascent-processor/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ascent', ':ascent-processor', ':demo', ':simple-demo', ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/src/main/assets/fonts/Lobster.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/assets/fonts/Lobster.ttf -------------------------------------------------------------------------------- /ascent-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | net.jamesbaca.ascent.internal.FontProcessor -------------------------------------------------------------------------------- /simple-demo/src/main/assets/fonts/Lobster.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/assets/fonts/Lobster.ttf -------------------------------------------------------------------------------- /demo/src/main/assets/fonts/Playball-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/assets/fonts/Playball-Regular.ttf -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple-demo/src/main/assets/fonts/Playball-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/assets/fonts/Playball-Regular.ttf -------------------------------------------------------------------------------- /simple-demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple-demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple-demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simple-demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desertjim/ascent/HEAD/simple-demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | android: 4 | components: 5 | - build-tools-20.0.0 6 | - android-14 7 | 8 | 9 | script: 10 | - TERM=dumb ./gradlew test 11 | -------------------------------------------------------------------------------- /ascent/src/main/java/net/jamesbaca/ascent/FontHelper.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent; 2 | 3 | public interface FontHelper { 4 | 5 | void applyFont(Object target, Ascent manager); 6 | 7 | } -------------------------------------------------------------------------------- /ascent/src/main/java/net/jamesbaca/ascent/InjectedAscent.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent; 2 | 3 | /** 4 | * Created by jamesbaca on 9/28/14. 5 | */ 6 | public class InjectedAscent { 7 | public static final String SUFFIX = "$$AscentGenerator"; 8 | } 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Module 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /ascent-processor/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | targetCompatibility = '1.6' 4 | sourceCompatibility = '1.6' 5 | 6 | dependencies { 7 | compile project(':ascent') 8 | compile 'com.google.guava:guava:15.0' 9 | compile 'com.google.auto.service:auto-service:1.0-rc1' 10 | 11 | testCompile 'com.google.testing.compile:compile-testing:0.4' 12 | testCompile 'com.google.android:android:2.2.1' 13 | } -------------------------------------------------------------------------------- /demo/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /ascent/src/main/java/net/jamesbaca/ascent/Font.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.FIELD; 7 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 8 | 9 | /** 10 | * Created by jamesbaca on 9/27/14. 11 | */ 12 | @Retention(RUNTIME) @Target(FIELD) 13 | public @interface Font { 14 | String value(); 15 | } 16 | -------------------------------------------------------------------------------- /simple-demo/src/androidTest/java/net/jamesbaca/ascent/demo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.demo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /demo/src/androidTest/java/net/jamesbaca/ascent/mymodule/app/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.mymodule.app; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 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 | out/ 15 | build/ 16 | 17 | # Local configuration file (sdk path, etc) 18 | local.properties 19 | 20 | .project 21 | .classpath 22 | .settings 23 | target/ 24 | libs/ 25 | classes/ 26 | gen-external-apklibs/ 27 | tmp/ 28 | 29 | # IDEA Ignores 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | .gradle/ 35 | 36 | # MAC 37 | *.DS_Store 38 | 39 | *.orig 40 | -------------------------------------------------------------------------------- /ascent/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'http://repo.springsource.org/plugins-release' } 4 | } 5 | dependencies { 6 | classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.1' 7 | } 8 | } 9 | 10 | apply plugin: 'java' 11 | 12 | apply plugin: 'propdeps' 13 | apply plugin: 'propdeps-maven' 14 | apply plugin: 'propdeps-idea' 15 | apply plugin: 'propdeps-eclipse' 16 | 17 | targetCompatibility = '1.6' 18 | sourceCompatibility = '1.6' 19 | 20 | dependencies { 21 | provided 'com.google.android:android:2.2.1' 22 | } -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /simple-demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /simple-demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /simple-demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "20.0.0" 6 | 7 | defaultConfig { 8 | applicationId "net.jamesbaca.ascent.demo" 9 | minSdkVersion 9 10 | targetSdkVersion 14 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:20.0.0' 25 | compile project(':ascent') 26 | 27 | provided project(':ascent-processor') 28 | } 29 | -------------------------------------------------------------------------------- /simple-demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /demo/src/main/java/net/jamesbaca/ascent/mymodule/app/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.mymodule.app; 2 | 3 | import android.app.Application; 4 | 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | import dagger.ObjectGraph; 9 | 10 | /** 11 | * Created by jamesbaca on 10/17/14. 12 | */ 13 | public class DemoApplication extends Application { 14 | private ObjectGraph mApplicationGraph; 15 | 16 | @Override public void onCreate() { 17 | super.onCreate(); 18 | 19 | mApplicationGraph = ObjectGraph.create(getModules().toArray()); 20 | } 21 | 22 | protected List getModules() { 23 | return Arrays.asList(new DemoApplicationModule(this)); 24 | } 25 | 26 | ObjectGraph getApplicationGraph() { 27 | return mApplicationGraph; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ascent-processor/src/main/java/net/jamesbaca/ascent/internal/AnnotatedField.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.internal; 2 | 3 | import javax.lang.model.element.TypeElement; 4 | 5 | class AnnotatedField { 6 | 7 | private final String name; 8 | private final String typeFaceName; 9 | private final TypeElement enclosingClassType; 10 | 11 | 12 | AnnotatedField(String name, String typeFaceName, TypeElement enclosingClassType) { 13 | this.name = name; 14 | this.typeFaceName = typeFaceName; 15 | this.enclosingClassType = enclosingClassType; 16 | 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public String getTypefaceName() { 24 | return typeFaceName; 25 | } 26 | 27 | public TypeElement getEnclosingClassType() { 28 | return enclosingClassType; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /demo/src/main/java/net/jamesbaca/ascent/mymodule/app/DemoApplicationModule.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.mymodule.app; 2 | 3 | import net.jamesbaca.ascent.Ascent; 4 | 5 | import javax.inject.Singleton; 6 | 7 | import dagger.Module; 8 | import dagger.Provides; 9 | 10 | /** 11 | * Created by jamesbaca on 10/17/14. 12 | */ 13 | @Module( 14 | injects = { 15 | MainActivity.class, 16 | }, 17 | library = true 18 | ) 19 | public class DemoApplicationModule { 20 | private final DemoApplication mApplication; 21 | private final Ascent mAscent = new Ascent(); 22 | 23 | public DemoApplicationModule(DemoApplication application) { 24 | mApplication = application; 25 | } 26 | 27 | @Provides @Singleton Ascent provideLocationManager() { 28 | mAscent.setAssetManager(mApplication.getAssets()); 29 | return mAscent; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "20.0.0" 6 | 7 | defaultConfig { 8 | applicationId "net.jamesbaca.ascent.mymodule.app" 9 | minSdkVersion 8 10 | targetSdkVersion 8 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | packagingOptions{ 22 | exclude 'META-INF/services/javax.annotation.processing.Processor' 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | compile 'com.android.support:appcompat-v7:20.0.0' 29 | 30 | compile 'com.jakewharton:butterknife:5.1.2' 31 | compile 'com.squareup.dagger:dagger:1.2.2' 32 | compile 'com.squareup.dagger:dagger-compiler:1.2.2' 33 | compile 'com.squareup:javawriter:2.5.0' 34 | compile 'javax.inject:javax.inject:1' 35 | 36 | compile project(':ascent') 37 | provided project(':ascent-processor') 38 | } 39 | -------------------------------------------------------------------------------- /ascent-processor/src/main/java/net/jamesbaca/ascent/internal/WriterFactory.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.internal; 2 | 3 | import java.io.IOException; 4 | import javax.annotation.processing.Filer; 5 | import javax.lang.model.element.TypeElement; 6 | import javax.lang.model.util.Elements; 7 | import javax.lang.model.util.Types; 8 | import javax.tools.JavaFileObject; 9 | 10 | class WriterFactory { 11 | private final Elements elementUtils; 12 | private final Types typeUtils; 13 | private final Filer filer; 14 | private final String suffix; 15 | 16 | public WriterFactory(Elements elementUtils, Types typeUtils, Filer filer, String suffix) { 17 | this.elementUtils = elementUtils; 18 | this.typeUtils = typeUtils; 19 | this.filer = filer; 20 | this.suffix = suffix; 21 | } 22 | 23 | public FontClassWriter writeClass(EnclosingClass enclosingClass) throws IOException { 24 | TypeElement classType = enclosingClass.getElement(); 25 | String fqcn = enclosingClass.getClassPackage() + "." + enclosingClass.getClassName() + suffix; 26 | JavaFileObject jfo = filer.createSourceFile(fqcn, classType); 27 | return new FontClassWriter(jfo, suffix, enclosingClass); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /simple-demo/src/main/java/net/jamesbaca/ascent/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package net.jamesbaca.ascent.demo; 2 | 3 | import android.support.v7.app.ActionBarActivity; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | import android.widget.TextView; 8 | 9 | import net.jamesbaca.ascent.Ascent; 10 | import net.jamesbaca.ascent.Font; 11 | 12 | 13 | public class MainActivity extends ActionBarActivity { 14 | 15 | @Font("Lobster.ttf") TextView mHelloWorld; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_main); 21 | mHelloWorld = (TextView)findViewById(R.id.hello_world); 22 | Ascent ascent = new Ascent(); 23 | ascent.setAssetManager(getAssets()); 24 | ascent.inject(this); 25 | } 26 | 27 | 28 | @Override 29 | public boolean onCreateOptionsMenu(Menu menu) { 30 | // Inflate the menu; this adds items to the action bar if it is present. 31 | getMenuInflater().inflate(R.menu.main, menu); 32 | return true; 33 | } 34 | 35 | @Override 36 | public boolean onOptionsItemSelected(MenuItem item) { 37 | // Handle action bar item clicks here. The action bar will 38 | // automatically handle clicks on the Home/Up button, so long 39 | // as you specify a parent activity in AndroidManifest.xml. 40 | int id = item.getItemId(); 41 | if (id == R.id.action_settings) { 42 | return true; 43 | } 44 | return super.onOptionsItemSelected(item); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | 19 | 22 | 23 | 28 | 29 | 34 | 35 | 40 | 41 | 42 |