├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── samples ├── src │ └── main │ │ ├── assets │ │ ├── Ubuntu-M.ttf │ │ └── ubuntu-font-license-1.0.txt │ │ ├── res │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── attrs.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ ├── main.xml │ │ │ └── main_frag.xml │ │ ├── java │ │ └── com │ │ │ └── madisp │ │ │ └── pretty │ │ │ └── samples │ │ │ ├── SampleActivity.java │ │ │ ├── SampleFragment.java │ │ │ └── FontDecor.java │ │ └── AndroidManifest.xml └── build.gradle ├── tests ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── madisp │ │ │ │ └── pretty │ │ │ │ ├── FragInLayoutActivity.java │ │ │ │ ├── TestFragment.java │ │ │ │ └── CreatesFragActivity.java │ │ ├── res │ │ │ ├── values │ │ │ │ ├── dimen.xml │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ ├── emty_main.xml │ │ │ │ └── fragment_test.xml │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── com │ │ └── madisp │ │ └── pretty │ │ ├── FragmentsTest.java │ │ ├── UiThreadRule.java │ │ └── SanityTest.java └── build.gradle ├── release.sh ├── LICENSE ├── pretty ├── src │ └── main │ │ └── java │ │ └── com │ │ └── madisp │ │ └── pretty │ │ ├── PrettyLayoutFactory.java │ │ ├── Decor.java │ │ ├── Pretty.java │ │ ├── PrettyLayoutInflater.java │ │ ├── LayoutFactoryWrapper.java │ │ └── AttrsDecor.java └── build.gradle ├── gradlew.bat ├── README.md └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'pretty' 2 | include ':pretty', ':samples', ':tests' 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | local.properties 3 | .idea 4 | .DS_Store 5 | build 6 | *.iml 7 | out 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madisp/pretty/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/src/main/assets/Ubuntu-M.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madisp/pretty/HEAD/samples/src/main/assets/Ubuntu-M.ttf -------------------------------------------------------------------------------- /tests/src/main/java/com/madisp/pretty/FragInLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty; 2 | 3 | public class FragInLayoutActivity { 4 | } 5 | -------------------------------------------------------------------------------- /samples/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madisp/pretty/HEAD/samples/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /tests/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | -------------------------------------------------------------------------------- /samples/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pretty samples 4 | -------------------------------------------------------------------------------- /tests/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Line 1 4 | Line 2 5 | -------------------------------------------------------------------------------- /tests/src/main/res/layout/emty_main.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 29 19:28:36 EEST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip 7 | -------------------------------------------------------------------------------- /tests/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/src/main/java/com/madisp/pretty/TestFragment.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | public class TestFragment extends Fragment { 10 | @Override 11 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 12 | return inflater.inflate(R.layout.fragment_test, container, false); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/src/main/java/com/madisp/pretty/samples/SampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty.samples; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | 6 | import com.madisp.pretty.Pretty; 7 | 8 | public class SampleActivity extends FragmentActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | Pretty.wrap(this).with(new FontDecor()); 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.main); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/src/main/java/com/madisp/pretty/samples/SampleFragment.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty.samples; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | public class SampleFragment extends Fragment { 10 | @Override 11 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 12 | return inflater.inflate(R.layout.main_frag, container, false); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/src/main/java/com/madisp/pretty/CreatesFragActivity.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | 6 | public class CreatesFragActivity extends FragmentActivity { 7 | @Override 8 | protected void onCreate(Bundle savedInstanceState) { 9 | Pretty.wrap(this); 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.emty_main); 12 | 13 | if (savedInstanceState == null) { 14 | getSupportFragmentManager().beginTransaction().add(R.id.main, new TestFragment()).commit(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:1.2.0-beta1' 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.application' 11 | 12 | repositories { 13 | mavenCentral() 14 | } 15 | 16 | dependencies { 17 | // in reality you would use something like this instead of refing the project directly: 18 | // compile 'com.madisp.pretty:pretty:0.1.0' 19 | compile project(':pretty') 20 | compile 'com.android.support:support-v4:22.0.0' 21 | } 22 | 23 | android { 24 | compileSdkVersion 22 25 | buildToolsVersion '22.0.1' 26 | 27 | defaultConfig { 28 | minSdkVersion 15 29 | targetSdkVersion 22 30 | } 31 | 32 | lintOptions { 33 | disable 'MissingPrefix' 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | KEY_UID=F4DF9A6C 4 | VERSION=0.1.0 5 | 6 | # release into local repo 7 | ./gradlew clean publishMavenJavaPublicationToDryRepository -Prelease=true 8 | 9 | echo '' 10 | echo '=== BUILD DONE, ONTO PUBLISHING ===' 11 | echo '' 12 | 13 | # move into local repo 14 | pushd pretty/build/repo 15 | 16 | # sign all the artifacts in the local repo 17 | read -s -p "GPG key passphrase: " passphrase 18 | echo 19 | for f in com/madisp/pretty/pretty/*/*.{jar,pom}; do 20 | gpg -u $KEY_UID --passphrase $passphrase --sign --detach-sign -a $f 21 | done 22 | 23 | # publish to staging 24 | pushd com/madisp/pretty/pretty/$VERSION 25 | FILES="" 26 | for f in *.{asc,jar,pom}; do 27 | FILES="$f $FILES" 28 | done 29 | FILES=${FILES%" "} 30 | jar -cvf bundle.jar $FILES 31 | popd # com/madisp/pretty/pretty/$VERSION 32 | 33 | popd # pretty/build/repo 34 | -------------------------------------------------------------------------------- /samples/src/main/java/com/madisp/pretty/samples/FontDecor.java: -------------------------------------------------------------------------------- 1 | package com.madisp.pretty.samples; 2 | 3 | import android.graphics.Typeface; 4 | import android.util.TypedValue; 5 | import android.widget.TextView; 6 | 7 | import com.madisp.pretty.AttrsDecor; 8 | 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class FontDecor extends AttrsDecor { 12 | @NotNull 13 | @Override 14 | protected int[] attrs() { 15 | return new int[] { R.attr.typeface_asset }; 16 | } 17 | 18 | @NotNull 19 | @Override 20 | protected Class clazz() { 21 | return TextView.class; 22 | } 23 | 24 | @Override 25 | protected void apply(TextView view, int attr, TypedValue value) { 26 | view.setTypeface(Typeface.createFromAsset(view.getResources().getAssets(), value.string.toString())); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/src/main/res/layout/fragment_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:1.2.0-beta1' 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.application' 11 | apply plugin: 'jacoco' 12 | 13 | repositories { 14 | mavenCentral() 15 | } 16 | 17 | dependencies { 18 | compile project(':pretty') 19 | compile 'com.android.support:support-v4:22.0.0' 20 | androidTestCompile 'com.android.support.test:testing-support-lib:0.1' 21 | androidTestCompile 'org.assertj:assertj-core:1.7.1' 22 | } 23 | 24 | android { 25 | compileSdkVersion 22 26 | buildToolsVersion '22.0.1' 27 | 28 | defaultConfig { 29 | minSdkVersion 15 30 | targetSdkVersion 22 31 | 32 | testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' 33 | } 34 | 35 | lintOptions { 36 | disable 'MissingPrefix' 37 | } 38 | 39 | packagingOptions { 40 | exclude 'LICENSE.txt' 41 | } 42 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Madis Pink 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /samples/src/main/res/layout/main_frag.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 |