├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── NOTICE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── pixplicity │ │ └── fontview │ │ └── ApplicationTest.java │ ├── debug │ └── AndroidManifest.xml │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── fonts │ │ ├── Action_Man.ttf │ │ ├── Action_Man_Bold.ttf │ │ ├── Action_Man_Bold_Italic.ttf │ │ ├── Action_Man_Italic.ttf │ │ └── Iconian Fonts License.txt │ ├── java │ └── com │ │ └── pixplicity │ │ └── fontview │ │ └── sample │ │ └── MainActivity.java │ └── res │ ├── layout │ └── main_activity.xml │ ├── menu │ └── menu.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v17 │ ├── style.xml │ └── theme.xml │ ├── values-v21 │ └── theme.xml │ └── values │ ├── strings.xml │ ├── styles.xml │ └── theme.xml ├── bintray_upload.gradle ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── pixplicity │ │ └── fontview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── pixplicity │ │ └── fontview │ │ ├── FontAppCompatAutoCompleteTextView.java │ │ ├── FontAppCompatButton.java │ │ ├── FontAppCompatCheckBox.java │ │ ├── FontAppCompatCheckedTextView.java │ │ ├── FontAppCompatEditText.java │ │ ├── FontAppCompatMultiAutoCompleteTextView.java │ │ ├── FontAppCompatRadioButton.java │ │ ├── FontAppCompatTextView.java │ │ ├── FontAutoCompleteTextView.java │ │ ├── FontButton.java │ │ ├── FontCheckBox.java │ │ ├── FontCheckedTextView.java │ │ ├── FontCompoundButton.java │ │ ├── FontEditText.java │ │ ├── FontMultiAutoCompleteTextView.java │ │ ├── FontRadioButton.java │ │ ├── FontTextView.java │ │ ├── FontToggleButton.java │ │ └── utils │ │ ├── FontSpan.java │ │ ├── FontSpinnerAdapter.java │ │ └── FontUtil.java │ └── res │ ├── layout │ └── li_spinner.xml │ └── values │ └── attrs.xml ├── raw └── sample.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea/ 3 | .DS_Store 4 | /build 5 | /captures 6 | *.iml 7 | # Built application files 8 | *.apk 9 | *.ap_ 10 | 11 | # Files for the Dalvik VM 12 | *.dex 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | /*/build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | /captures -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | jdk: oraclejdk8 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | android: 10 | components: 11 | # Uncomment the lines below if you want to 12 | # use the latest revision of Android SDK Tools 13 | # - platform-tools 14 | # - tools 15 | 16 | # The BuildTools version used by your project 17 | - build-tools-22.0.1 18 | 19 | # The SDK version used to compile your project 20 | - android-22 21 | 22 | # Additional components 23 | - extra-google-google_play_services 24 | - extra-google-m2repository 25 | - extra-android-m2repository 26 | - addon-google_apis-google-22 27 | 28 | script: 29 | - TERM=dumb ./gradlew clean assemble -PdisablePreDex 30 | 31 | notifications: 32 | email: false 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | Version 1.0 *(2015-07-10)* 5 | ---------------------------- 6 | * initial library commit and release -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Letter Press 2 | Copyright 2014 Pixplicity 3 | 4 | This product includes software developed at 5 | Pixplicity (http://www.pixplicity.com) 6 | 7 | ========================================================================= 8 | == NOTICE file corresponding to the section 4 d of == 9 | == the Apache License, Version 2.0, == 10 | == in this case for the Android-specific code. == 11 | ========================================================================= 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Letter Press 2 | ============== 3 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Letter%20Press-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2120) 4 | [![Build Status](https://travis-ci.org/Pixplicity/letterpress.svg)](https://travis-ci.org/Pixplicity/letterpress) 5 | [![Download](https://api.bintray.com/packages/pixplicity/android/letterpress/images/download.svg) ](https://bintray.com/pixplicity/android/letterpress/_latestVersion) 6 | 7 | Custom typefaces without a single line of code! 8 | 9 | 10 | 11 | With Letter Press, adding custom fonts to your app means not a single line of code is needed; simply add the fonts to your app, replace your views with their Font counterparts, and specify the fonts through attributes, styles and themes. 12 | 13 | All fonts are referenced into (subdirectories of) the app's `assets` folder. 14 | 15 | ## Sample 16 | 17 | You can apply your custom fonts in a few ways: by using the theme, by specifying a specific style per view, or on the view explicitly using view attributes `pix_font`, `pix_fontBold`,`pix_fontItalic` or `pix_fontBoldItalic`. 18 | 19 | [Check out the sample app](https://github.com/Pixplicity/letterpress/tree/master/app) to see how easy it is to set up. 20 | 21 | ### Basic sample 22 | 23 | The easiest example is to set a typeface through layout attributes. In your layouts, replace Android widgets with the Font counterparts. For instance, use `FontTextView` instead of `TextView` and it will use the *Action Man* font. 24 | 25 | ```XML 26 | 31 | ``` 32 | 33 | ### Style sample 34 | 35 | Through a style, you can provide the same style to multiple views. By overriding the default parent style, it's easy enough to swap out existing styles (but is not required). 36 | 37 | ```XML 38 | 39 | 45 | 46 | ``` 47 | 48 | Define the style once, and you can reference it in multiple views, for instance: 49 | 50 | ```XML 51 | 56 | ``` 57 | 58 | ### Theme sample 59 | 60 | The most scalable way to set a common typeface is through providing a custom theme: 61 | 62 | ```XML 63 | 64 | 65 | 80 | 82 | 83 | ``` 84 | 85 | Now, your FontTextView doesn't need any attributes or styles at all, and inherits the attributes from the default style: 86 | 87 | ```XML 88 | 92 | ``` 93 | 94 | # Download 95 | 96 | Download the latest [AAR](https://bintray.com/pixplicity/android/letterpress) or grab via Maven: 97 | 98 | ```XML 99 | 100 | com.pixplicity.letterpress 101 | library 102 | (insert latest version) 103 | aar 104 | 105 | ``` 106 | 107 | Provide the dependency in Gradle: 108 | ```Groovy 109 | compile 'com.pixplicity.letterpress:library:(insert latest version)' 110 | ``` 111 | 112 | # License 113 | ``` 114 | Copyright 2014 Pixplicity (http://pixplicity.com) 115 | 116 | Licensed under the Apache License, Version 2.0 (the "License"); 117 | you may not use this file except in compliance with the License. 118 | You may obtain a copy of the License at 119 | 120 | http://www.apache.org/licenses/LICENSE-2.0 121 | 122 | Unless required by applicable law or agreed to in writing, software 123 | distributed under the License is distributed on an "AS IS" BASIS, 124 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125 | See the License for the specific language governing permissions and 126 | limitations under the License. 127 | ``` 128 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | *.iml -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion Integer.parseInt(ANDROID_COMPILE_SDK_VERSION) 5 | buildToolsVersion ANDROID_BUILD_TOOLS_VERSION 6 | 7 | defaultConfig { 8 | applicationId GROUP + '.fontview.sample' 9 | minSdkVersion 9 10 | targetSdkVersion Integer.parseInt(ANDROID_TARGET_SDK) 11 | versionCode Integer.parseInt(VERSION_CODE) 12 | versionName VERSION_NAME 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_7 24 | targetCompatibility JavaVersion.VERSION_1_7 25 | } 26 | 27 | lintOptions { 28 | abortOnError false 29 | } 30 | } 31 | 32 | dependencies { 33 | compile 'com.android.support:appcompat-v7:25.3.1' 34 | compile project(':library') 35 | } 36 | -------------------------------------------------------------------------------- /app/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 /home/dylan/opt/android-sdk-linux/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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/pixplicity/fontview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 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 | } -------------------------------------------------------------------------------- /app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Action_Man.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/assets/fonts/Action_Man.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Action_Man_Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/assets/fonts/Action_Man_Bold.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Action_Man_Bold_Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/assets/fonts/Action_Man_Bold_Italic.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Action_Man_Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/assets/fonts/Action_Man_Italic.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Iconian Fonts License.txt: -------------------------------------------------------------------------------- 1 | By downloading this font package you agree to the following terms 2 | of use: 3 | 4 | - This FONT PACKAGE is FREEWARE and may be distributed ONLY via the 5 | Internet for FREE. Under NO circumstances may this FONT PACKAGE 6 | be sold for a profit nor be included as part of another product or 7 | CD-ROM compilation. If you wish to include this FONT PACKAGE for 8 | FREE distribution on your Web Site, please include all of the fonts 9 | and original documentation supplied with this FONT PACKAGE. 10 | 11 | - You may install and use this FONT PACKAGE on an unlimited 12 | amount of machines. 13 | 14 | - You may NOT rename, edit, or create any alternate variations of 15 | the fonts included in this FONT PACKAGE. 16 | 17 | - This FONT PACKAGE comes "as is" with NO warranty whatsoever. 18 | SHYFONTS accepts NO responsibility for any damages or loss of 19 | any kind due to the use of this FONT PACKAGE. The use of this 20 | FONT PACKAGE is solely your responsibility -- you use this FONT 21 | PACKAGE at your own risk. 22 | 23 | Thank you for downloading this font package and enjoy! -------------------------------------------------------------------------------- /app/src/main/java/com/pixplicity/fontview/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview.sample; 2 | 3 | import android.graphics.Typeface; 4 | import android.os.Bundle; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.PopupMenu; 8 | import android.support.v7.widget.Toolbar; 9 | import android.view.Menu; 10 | import android.view.MenuInflater; 11 | import android.view.MenuItem; 12 | import android.view.View; 13 | import android.widget.Spinner; 14 | 15 | import com.pixplicity.fontview.utils.FontSpinnerAdapter; 16 | import com.pixplicity.fontview.utils.FontUtil; 17 | 18 | public class MainActivity extends AppCompatActivity { 19 | 20 | private Typeface mTypeface; 21 | 22 | @Override 23 | public void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.main_activity); 26 | 27 | // Configure toolbar 28 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 29 | setSupportActionBar(toolbar); 30 | final ActionBar supportActionBar = getSupportActionBar(); 31 | if (supportActionBar != null) { 32 | supportActionBar.setDisplayShowTitleEnabled(false); 33 | } 34 | 35 | // Load font manually 36 | mTypeface = FontUtil.getTypeface(this, "fonts/Action_Man.ttf"); 37 | 38 | // Apply font to popup menu 39 | findViewById(R.id.bt_popup).setOnClickListener(new View.OnClickListener() { 40 | 41 | @Override 42 | public void onClick(View v) { 43 | showPopupMenu(v); 44 | } 45 | }); 46 | 47 | // Apply font to Spinner 48 | final Spinner spinner = (Spinner) findViewById(R.id.spinner); 49 | spinner.setAdapter(new FontSpinnerAdapter(this, mTypeface, R.array.spinner_list)); 50 | } 51 | 52 | private void showPopupMenu(View anchorView) { 53 | PopupMenu popup = new PopupMenu(MainActivity.this, anchorView); 54 | popup.getMenuInflater().inflate(R.menu.menu, popup.getMenu()); 55 | popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { 56 | public boolean onMenuItemClick(MenuItem item) { 57 | // ... 58 | return true; 59 | } 60 | }); 61 | 62 | // Apply custom font to popup menu 63 | FontUtil.applyTypeface(popup.getMenu(), mTypeface); 64 | popup.show(); 65 | } 66 | 67 | @Override 68 | public boolean onCreateOptionsMenu(Menu menu) { 69 | MenuInflater inflater = getMenuInflater(); 70 | inflater.inflate(R.menu.menu, menu); 71 | return true; 72 | } 73 | 74 | @Override 75 | public boolean onPrepareOptionsMenu(Menu menu) { 76 | 77 | // Apply custom font to overflow menu 78 | FontUtil.applyTypeface(menu, mTypeface); 79 | return super.onPrepareOptionsMenu(menu); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 28 | 29 | 35 | 36 | 41 | 42 | 46 | 47 | 52 | 53 | 58 | 59 | 66 | 67 | 73 | 74 | 80 | 81 | 88 | 89 | 93 | 94 | 98 | 99 | 103 | 104 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v17/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-v17/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FontView Sample 3 | FontView Leaks Sample 4 | 5 | 6 | One 7 | Two 8 | Three 9 | Four 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | 18 | 19 | 26 | 27 | 33 | 34 | 40 | 41 | 47 | 48 | 54 | 55 | 61 | 62 | 68 | 69 | 75 | 76 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /app/src/main/res/values/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | 28 | 30 | 31 | -------------------------------------------------------------------------------- /bintray_upload.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | apply plugin: "com.jfrog.bintray" 3 | 4 | group = GROUP 5 | version = VERSION_NAME 6 | 7 | bintray { 8 | user = project.hasProperty("bintray.user") ? project.getProperty("bintray.user") : "empty" 9 | key = project.hasProperty("bintray.apikey") ? project.getProperty("bintray.apikey") : "empty" 10 | 11 | configurations = ['archives'] //When uploading configuration files 12 | pkg { 13 | repo = 'android' 14 | userOrg = 'pixplicity' 15 | name = ARTIFACT_ID 16 | desc = POM_DESCRIPTION 17 | issueTrackerUrl = POM_ISSUE_URL 18 | vcsUrl = POM_URL 19 | licenses = ['Apache-2.0'] 20 | labels = ['aar', 'android', 'font'] 21 | publicDownloadNumbers = true 22 | dryRun = false //Whether to run this as dry-run, without deploying 23 | publish = true //If version should be auto published after an bintray_upload 24 | } 25 | } 26 | 27 | install { 28 | repositories.mavenInstaller { 29 | pom { 30 | project { 31 | packaging 'aar' 32 | name project.name 33 | url POM_URL 34 | description POM_DESCRIPTION 35 | licenses { 36 | license { 37 | name POM_LICENCE_NAME 38 | url POM_LICENCE_URL 39 | distribution POM_LICENCE_DIST 40 | } 41 | } 42 | developers { 43 | developer { 44 | id POM_DEVELOPER_ID_0 45 | name POM_DEVELOPER_NAME_0 46 | email POM_DEVELOPER_EMAIL_0 47 | } 48 | developer { 49 | id POM_DEVELOPER_ID_1 50 | name POM_DEVELOPER_NAME_1 51 | email POM_DEVELOPER_EMAIL_1 52 | } 53 | } 54 | scm { 55 | connection POM_SCM_CONNECTION 56 | developerConnection POM_SCM_DEV_CONNECTION 57 | url POM_URL 58 | 59 | } 60 | } 61 | } 62 | } 63 | } 64 | 65 | task sourcesJar(type: Jar) { 66 | from android.sourceSets.main.java.srcDirs 67 | classifier = 'sources' 68 | } 69 | 70 | task javadoc(type: Javadoc) { 71 | source = android.sourceSets.main.java.srcDirs 72 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 73 | } 74 | 75 | task javadocJar(type: Jar, dependsOn: javadoc) { 76 | classifier = 'javadoc' 77 | from javadoc.destinationDir 78 | } 79 | 80 | artifacts { 81 | archives javadocJar 82 | archives sourcesJar 83 | } 84 | 85 | task findConventions << { 86 | println project.getConvention() 87 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.1' 9 | classpath 'com.noveogroup.android:check:1.1.2' 10 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' 11 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task wrapper(type: Wrapper) { 22 | gradleVersion = '2.5' 23 | } 24 | 25 | project.ext.preDexLibs = !project.hasProperty('disablePreDex') 26 | 27 | subprojects { 28 | project.plugins.whenPluginAdded { plugin -> 29 | if ("com.android.build.gradle.AppPlugin" == plugin.class.name) { 30 | project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs 31 | } else if ("com.android.build.gradle.LibraryPlugin" == plugin.class.name) { 32 | project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /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 19 | # 20 | # Set Gradle settings which apply to all modules here. 21 | org.gradle.parallel=true 22 | org.gradle.daemon=true 23 | org.gradle.configureondemand=true 24 | # 25 | VERSION_NAME=1.2 26 | VERSION_CODE=4 27 | GROUP=com.pixplicity.letterpress 28 | ARTIFACT_ID=letterpress 29 | # 30 | POM_DESCRIPTION=Custom fonts on all views 31 | POM_URL=https://github.com/Pixplicity/letterpress 32 | POM_SCM_URL=https://github.com/Pixplicity/letterpress 33 | POM_ISSUE_URL=https://github.com/Pixplicity/letterpress/issues 34 | POM_SCM_CONNECTION=scm:git@github.com:Pixplicity/letterpress.git 35 | POM_SCM_DEV_CONNECTION=scm:git@github.com:Pixplicity/letterpress.git 36 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 37 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 38 | POM_LICENCE_DIST=repo 39 | POM_DEVELOPER_ID_0=pflammertsma 40 | POM_DEVELOPER_NAME_0=Paul Lammerstma 41 | POM_DEVELOPER_EMAIL_0=paul@pixplicity.com 42 | POM_DEVELOPER_ID_1=mlagerberg 43 | POM_DEVELOPER_NAME_1=Mathijs Lagerberg 44 | POM_DEVELOPER_EMAIL_1=mathijs@pixplicity.com 45 | # 46 | ANDROID_BUILD_TOOLS_VERSION=25.0.2 47 | ANDROID_COMPILE_SDK_VERSION=25 48 | ANDROID_TARGET_SDK=25 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 10 16:55:25 CEST 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | *.iml -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.noveogroup.android.check' 3 | 4 | android { 5 | compileSdkVersion 25 6 | buildToolsVersion ANDROID_BUILD_TOOLS_VERSION 7 | 8 | defaultConfig { 9 | minSdkVersion 9 10 | targetSdkVersion Integer.parseInt(ANDROID_TARGET_SDK) 11 | versionCode Integer.parseInt(VERSION_CODE) 12 | versionName VERSION_NAME 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_7 24 | targetCompatibility JavaVersion.VERSION_1_7 25 | } 26 | 27 | lintOptions { 28 | abortOnError false 29 | } 30 | } 31 | 32 | check { 33 | abortOnError false 34 | 35 | checkstyle { 36 | abortOnError false 37 | } 38 | 39 | pmd { 40 | skip false 41 | abortOnError false 42 | config easy() 43 | } 44 | } 45 | dependencies { 46 | compile 'com.android.support:appcompat-v7:25.3.1' 47 | } 48 | 49 | apply from: new File('../bintray_upload.gradle') 50 | -------------------------------------------------------------------------------- /library/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 /home/dylan/opt/android-sdk-linux/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 | -------------------------------------------------------------------------------- /library/src/androidTest/java/com/pixplicity/fontview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 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 | } -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatAutoCompleteTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatAutoCompleteTextView; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatAutoCompleteTextView extends AppCompatAutoCompleteTextView { 12 | 13 | public FontAppCompatAutoCompleteTextView(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatAutoCompleteTextView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, R.attr.autoCompleteTextViewStyle); 20 | } 21 | 22 | public FontAppCompatAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatButton; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatButton extends AppCompatButton { 12 | 13 | public FontAppCompatButton(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatButton(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, R.attr.buttonStyle); 20 | } 21 | 22 | public FontAppCompatButton(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | public void setCustomTypeface(String font) { 27 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 28 | setCustomTypeface(tf); 29 | } 30 | 31 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 32 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 33 | setCustomTypeface(tf); 34 | } 35 | 36 | private void setCustomTypeface(Typeface tf) { 37 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 38 | setTypeface(tf); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatCheckBox.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatCheckBox; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatCheckBox extends AppCompatCheckBox { 12 | 13 | public FontAppCompatCheckBox(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatCheckBox(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, R.attr.checkboxStyle); 20 | } 21 | 22 | public FontAppCompatCheckBox(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatCheckedTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.os.Build; 8 | import android.support.v7.widget.AppCompatCheckedTextView; 9 | import android.util.AttributeSet; 10 | 11 | import com.pixplicity.fontview.utils.FontUtil; 12 | 13 | public class FontAppCompatCheckedTextView extends AppCompatCheckedTextView { 14 | 15 | public FontAppCompatCheckedTextView(Context context) { 16 | super(context); 17 | } 18 | 19 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) 20 | public FontAppCompatCheckedTextView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 23 | setCustomTypeface(attrs, R.attr.checkedTextViewStyle); 24 | } else { 25 | setCustomTypeface(attrs, android.R.attr.textStyle); 26 | } 27 | } 28 | 29 | public FontAppCompatCheckedTextView(Context context, AttributeSet attrs, int defStyle) { 30 | super(context, attrs, defStyle); 31 | setCustomTypeface(attrs, defStyle); 32 | } 33 | 34 | public void setCustomTypeface(String font) { 35 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 36 | setCustomTypeface(tf); 37 | } 38 | 39 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 40 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 41 | setCustomTypeface(tf); 42 | } 43 | 44 | private void setCustomTypeface(Typeface tf) { 45 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 46 | setTypeface(tf); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatEditText.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatEditText; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatEditText extends AppCompatEditText { 12 | 13 | public FontAppCompatEditText(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatEditText(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, R.attr.editTextStyle); 20 | } 21 | 22 | public FontAppCompatEditText(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | public void setCustomTypeface(String font) { 27 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 28 | setCustomTypeface(tf); 29 | } 30 | 31 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 32 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 33 | setCustomTypeface(tf); 34 | } 35 | 36 | private void setCustomTypeface(Typeface tf) { 37 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 38 | setTypeface(tf); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatMultiAutoCompleteTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatMultiAutoCompleteTextView; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatMultiAutoCompleteTextView extends AppCompatMultiAutoCompleteTextView { 12 | 13 | public FontAppCompatMultiAutoCompleteTextView(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatMultiAutoCompleteTextView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, R.attr.autoCompleteTextViewStyle); 20 | } 21 | 22 | public FontAppCompatMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatRadioButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatRadioButton; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatRadioButton extends AppCompatRadioButton { 12 | public FontAppCompatRadioButton(Context context) { 13 | super(context); 14 | } 15 | 16 | public FontAppCompatRadioButton(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | setCustomTypeface(attrs, R.attr.radioButtonStyle); 19 | } 20 | 21 | public FontAppCompatRadioButton(Context context, AttributeSet attrs, int defStyle) { 22 | super(context, attrs, defStyle); 23 | setCustomTypeface(attrs, defStyle); 24 | } 25 | 26 | public void setCustomTypeface(String font) { 27 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 28 | setCustomTypeface(tf); 29 | } 30 | 31 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 32 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 33 | setCustomTypeface(tf); 34 | } 35 | 36 | private void setCustomTypeface(Typeface tf) { 37 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 38 | setTypeface(tf); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAppCompatTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v7.widget.AppCompatTextView; 7 | import android.util.AttributeSet; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontAppCompatTextView extends AppCompatTextView { 12 | 13 | public FontAppCompatTextView(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontAppCompatTextView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, android.R.attr.textViewStyle); 20 | } 21 | 22 | public FontAppCompatTextView(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontAutoCompleteTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.AutoCompleteTextView; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | /** 13 | * Extension of {@link AutoCompleteTextView} to cope with custom typefaces. Specify the desired font 14 | * using the {@code font="myfont.ttf"} attribute, or specify it directly using 15 | * {@link #setCustomTypeface(String)}. 16 | *

17 | * Typeface management is regulated through {@link FontUtil}. 18 | *

19 | * 20 | * @author Pixplicity 21 | */ 22 | @TargetApi(3) 23 | public class FontAutoCompleteTextView extends AutoCompleteTextView { 24 | 25 | public FontAutoCompleteTextView(Context context) { 26 | super(context); 27 | } 28 | 29 | public FontAutoCompleteTextView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | setCustomTypeface(attrs, android.R.attr.autoCompleteTextViewStyle); 32 | } 33 | 34 | public FontAutoCompleteTextView(Context context, AttributeSet attrs, 35 | int defStyle) { 36 | super(context, attrs, defStyle); 37 | setCustomTypeface(attrs, defStyle); 38 | } 39 | public void setCustomTypeface(String font) { 40 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 41 | setCustomTypeface(tf); 42 | } 43 | 44 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 45 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 46 | setCustomTypeface(tf); 47 | } 48 | 49 | private void setCustomTypeface(Typeface tf) { 50 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 51 | setTypeface(tf); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.Button; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | 13 | /** 14 | * Extension of {@link Button} to cope with custom typefaces. Specify the desired 15 | * font using the 16 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 17 | *

18 | * Typeface management is regulated through {@link FontUtil}. 19 | *

20 | * 21 | * @author Pixplicity 22 | */ 23 | @TargetApi(3) 24 | public class FontButton extends Button { 25 | 26 | public FontButton(Context context) { 27 | super(context); 28 | } 29 | 30 | public FontButton(Context context, AttributeSet attrs) { 31 | super(context, attrs); 32 | setCustomTypeface(attrs, android.R.attr.buttonStyle); 33 | } 34 | 35 | public FontButton(Context context, AttributeSet attrs, int defStyle) { 36 | super(context, attrs, defStyle); 37 | setCustomTypeface(attrs, defStyle); 38 | } 39 | 40 | public void setCustomTypeface(String font) { 41 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 42 | setCustomTypeface(tf); 43 | } 44 | 45 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 46 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 47 | setCustomTypeface(tf); 48 | } 49 | 50 | private void setCustomTypeface(Typeface tf) { 51 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 52 | setTypeface(tf); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontCheckBox.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.CheckBox; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | 13 | /** 14 | * Extension of {@link CheckBox} to cope with custom typefaces. Specify the desired 15 | * font using the 16 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 17 | *

18 | * Typeface management is regulated through {@link FontUtil}. 19 | *

20 | * 21 | * @author Pixplicity 22 | */ 23 | @TargetApi(3) 24 | public class FontCheckBox extends CheckBox { 25 | 26 | public FontCheckBox(Context context) { 27 | super(context, null, 0); 28 | } 29 | 30 | public FontCheckBox(Context context, AttributeSet attrs) { 31 | super(context, attrs); 32 | setCustomTypeface(attrs, android.R.attr.checkboxStyle); 33 | } 34 | 35 | public FontCheckBox(Context context, AttributeSet attrs, int defStyle) { 36 | super(context, attrs, defStyle); 37 | setCustomTypeface(attrs, defStyle); 38 | } 39 | 40 | public void setCustomTypeface(String font) { 41 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 42 | setCustomTypeface(tf); 43 | } 44 | 45 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 46 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 47 | setCustomTypeface(tf); 48 | } 49 | 50 | private void setCustomTypeface(Typeface tf) { 51 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 52 | setTypeface(tf); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontCheckedTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.CheckedTextView; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | 13 | /** 14 | * Extension of {@link CheckedTextView} to cope with custom typefaces. Specify the desired font using the 15 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 16 | *

17 | * Typeface management is regulated through {@link FontUtil}. 18 | *

19 | * 20 | * @author Pixplicity 21 | */ 22 | @TargetApi(3) 23 | public class FontCheckedTextView extends CheckedTextView { 24 | 25 | public FontCheckedTextView(Context context) { 26 | super(context); 27 | } 28 | 29 | public FontCheckedTextView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | setCustomTypeface(attrs, R.attr.checkedTextViewStyle); 32 | } 33 | 34 | public FontCheckedTextView(Context context, AttributeSet attrs, int defStyle) { 35 | super(context, attrs, defStyle); 36 | setCustomTypeface(attrs, defStyle); 37 | } 38 | 39 | public void setCustomTypeface(String font) { 40 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 41 | setCustomTypeface(tf); 42 | } 43 | 44 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 45 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 46 | setCustomTypeface(tf); 47 | } 48 | 49 | private void setCustomTypeface(Typeface tf) { 50 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 51 | setTypeface(tf); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontCompoundButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.util.AttributeSet; 7 | import android.widget.CompoundButton; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontCompoundButton extends CompoundButton { 12 | 13 | public FontCompoundButton(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontCompoundButton(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomFont(attrs, android.R.attr.buttonStyle); 20 | } 21 | 22 | public FontCompoundButton(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | private void setCustomFont(AttributeSet attrs, int defStyle) { 28 | FontUtil.getTypeface(getContext(), attrs, defStyle); 29 | } 30 | 31 | public void setCustomTypeface(String font) { 32 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 33 | setCustomTypeface(tf); 34 | } 35 | 36 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 37 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 38 | setCustomTypeface(tf); 39 | } 40 | 41 | private void setCustomTypeface(Typeface tf) { 42 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 43 | setTypeface(tf); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontEditText.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.EditText; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | /** 13 | * Extension of {@link EditText} to cope with custom typefaces. Specify the desired 14 | * font using the 15 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 16 | *

17 | * Typeface management is regulated through {@link FontUtil}. 18 | *

19 | * 20 | * @author Pixplicity 21 | */ 22 | @TargetApi(3) 23 | public class FontEditText extends EditText { 24 | 25 | public FontEditText(Context context) { 26 | super(context, null, 0); 27 | } 28 | 29 | public FontEditText(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | setCustomTypeface(attrs, android.R.attr.editTextStyle); 32 | } 33 | 34 | public FontEditText(Context context, AttributeSet attrs, int defStyle) { 35 | super(context, attrs, defStyle); 36 | setCustomTypeface(attrs, defStyle); 37 | } 38 | 39 | public void setCustomTypeface(String font) { 40 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 41 | setCustomTypeface(tf); 42 | } 43 | 44 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 45 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 46 | setCustomTypeface(tf); 47 | } 48 | 49 | private void setCustomTypeface(Typeface tf) { 50 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 51 | setTypeface(tf); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontMultiAutoCompleteTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.util.AttributeSet; 7 | import android.widget.MultiAutoCompleteTextView; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontMultiAutoCompleteTextView extends MultiAutoCompleteTextView { 12 | 13 | public FontMultiAutoCompleteTextView(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontMultiAutoCompleteTextView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, android.R.attr.autoCompleteTextViewStyle); 20 | } 21 | 22 | public FontMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontRadioButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.RadioButton; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | /** 13 | * Extension of {@link android.widget.CheckBox} to cope with custom typefaces. Specify the desired 14 | * font using the 15 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 16 | *

17 | * Typeface management is regulated through {@link FontUtil}. 18 | *

19 | * 20 | * @author Pixplicity 21 | */ 22 | @TargetApi(3) 23 | public class FontRadioButton extends RadioButton { 24 | 25 | public FontRadioButton(Context context) { 26 | super(context); 27 | } 28 | 29 | public FontRadioButton(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | setCustomTypeface(attrs, android.R.attr.radioButtonStyle); 32 | } 33 | 34 | public FontRadioButton(Context context, AttributeSet attrs, int defStyle) { 35 | super(context, attrs, defStyle); 36 | setCustomTypeface(attrs, defStyle); 37 | } 38 | 39 | public void setCustomTypeface(String font) { 40 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 41 | setCustomTypeface(tf); 42 | } 43 | 44 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 45 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 46 | setCustomTypeface(tf); 47 | } 48 | 49 | private void setCustomTypeface(Typeface tf) { 50 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 51 | setTypeface(tf); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontTextView.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Paint; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.TextView; 9 | 10 | import com.pixplicity.fontview.utils.FontUtil; 11 | 12 | /** 13 | * Extension of {@link TextView} to cope with custom typefaces. Specify the desired font using the 14 | * {@code font="myfont.ttf"} attribute, or specify it directly using {@link #setCustomTypeface(String)}. 15 | *

16 | * Typeface management is regulated through {@link FontUtil}. 17 | *

18 | * 19 | * @author Pixplicity 20 | */ 21 | @TargetApi(3) 22 | public class FontTextView extends TextView { 23 | 24 | public FontTextView(Context context) { 25 | super(context); 26 | } 27 | 28 | public FontTextView(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | setCustomTypeface(attrs, android.R.attr.textViewStyle); 31 | } 32 | 33 | public FontTextView(Context context, AttributeSet attrs, int defStyle) { 34 | super(context, attrs, defStyle); 35 | setCustomTypeface(attrs, defStyle); 36 | } 37 | 38 | public void setCustomTypeface(String font) { 39 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 40 | setCustomTypeface(tf); 41 | } 42 | 43 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 44 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 45 | setCustomTypeface(tf); 46 | } 47 | 48 | private void setCustomTypeface(Typeface tf) { 49 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 50 | setTypeface(tf); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/FontToggleButton.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.util.AttributeSet; 7 | import android.widget.ToggleButton; 8 | 9 | import com.pixplicity.fontview.utils.FontUtil; 10 | 11 | public class FontToggleButton extends ToggleButton { 12 | 13 | public FontToggleButton(Context context) { 14 | super(context); 15 | } 16 | 17 | public FontToggleButton(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | setCustomTypeface(attrs, android.R.attr.buttonStyleToggle); 20 | } 21 | 22 | public FontToggleButton(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | setCustomTypeface(attrs, defStyle); 25 | } 26 | 27 | public void setCustomTypeface(String font) { 28 | final Typeface tf = FontUtil.getTypeface(getContext(), font); 29 | setCustomTypeface(tf); 30 | } 31 | 32 | private void setCustomTypeface(AttributeSet attrs, int defStyle) { 33 | final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle); 34 | setCustomTypeface(tf); 35 | } 36 | 37 | private void setCustomTypeface(Typeface tf) { 38 | setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); 39 | setTypeface(tf); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/utils/FontSpan.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview.utils; 2 | 3 | import android.graphics.Paint; 4 | import android.graphics.Typeface; 5 | import android.text.TextPaint; 6 | import android.text.style.MetricAffectingSpan; 7 | 8 | /** 9 | * Span that applies a Typeface to a String 10 | */ 11 | public class FontSpan extends MetricAffectingSpan { 12 | 13 | private final Typeface typeface; 14 | 15 | public FontSpan(final Typeface typeface) { 16 | this.typeface = typeface; 17 | } 18 | 19 | @Override 20 | public void updateDrawState(final TextPaint drawState) { 21 | apply(drawState); 22 | } 23 | 24 | @Override 25 | public void updateMeasureState(final TextPaint paint) { 26 | apply(paint); 27 | } 28 | 29 | private void apply(final Paint paint) { 30 | final Typeface oldTypeface = paint.getTypeface(); 31 | final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0; 32 | final int fakeStyle = oldStyle & ~typeface.getStyle(); 33 | 34 | if ((fakeStyle & Typeface.BOLD) != 0) { 35 | paint.setFakeBoldText(true); 36 | } 37 | 38 | if ((fakeStyle & Typeface.ITALIC) != 0) { 39 | paint.setTextSkewX(-0.25f); 40 | } 41 | 42 | paint.setTypeface(typeface); 43 | } 44 | } -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/utils/FontSpinnerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.support.annotation.ArrayRes; 6 | import android.support.annotation.LayoutRes; 7 | import android.support.annotation.NonNull; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.TextView; 12 | 13 | import com.pixplicity.fontview.R; 14 | 15 | /** 16 | * A simple ArrayAdapter meant to apply the default typeface to Spinners 17 | */ 18 | public class FontSpinnerAdapter extends ArrayAdapter { 19 | 20 | private final Typeface mTypeface; 21 | 22 | public FontSpinnerAdapter(@NonNull Context context, @NonNull Typeface typeface, 23 | @ArrayRes int strArray) { 24 | this(context, typeface, R.layout.li_spinner, strArray); 25 | } 26 | 27 | public FontSpinnerAdapter(@NonNull Context context, @NonNull Typeface typeface, 28 | @LayoutRes int listItem, @ArrayRes int strArray) { 29 | super(context, listItem, context.getResources().getStringArray(strArray)); 30 | mTypeface = typeface; 31 | } 32 | 33 | // Affects default (closed) state of the spinner 34 | @NonNull 35 | @Override 36 | public View getView(int position, View convertView, @NonNull ViewGroup parent) { 37 | TextView view = (TextView) super.getView(position, convertView, parent); 38 | FontUtil.applyTypeface(view, mTypeface); 39 | return view; 40 | } 41 | 42 | // Affects opened state of the spinner 43 | @NonNull 44 | @Override 45 | public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) { 46 | TextView view = (TextView) super.getDropDownView(position, convertView, parent); 47 | FontUtil.applyTypeface(view, mTypeface); 48 | return view; 49 | } 50 | } -------------------------------------------------------------------------------- /library/src/main/java/com/pixplicity/fontview/utils/FontUtil.java: -------------------------------------------------------------------------------- 1 | package com.pixplicity.fontview.utils; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Typeface; 6 | import android.support.annotation.NonNull; 7 | import android.text.Spannable; 8 | import android.text.SpannableString; 9 | import android.text.TextUtils; 10 | import android.util.AttributeSet; 11 | import android.view.Menu; 12 | import android.view.MenuItem; 13 | import android.widget.TextView; 14 | 15 | import com.pixplicity.fontview.R; 16 | 17 | import java.security.InvalidParameterException; 18 | import java.util.Hashtable; 19 | 20 | public final class FontUtil { 21 | 22 | private static final Hashtable TYPEFACES = new Hashtable<>(); 23 | 24 | private static String getFontFromAttributes(@NonNull Context context, @NonNull AttributeSet attrs, int defStyle) { 25 | String fontName = ""; 26 | // Look up any layout-defined attributes 27 | // First obtain the textStyle 28 | TypedArray a = context.obtainStyledAttributes(attrs, new int[]{ 29 | android.R.attr.textStyle 30 | }); 31 | int fontStyle = 0; 32 | for (int i = 0; i < a.getIndexCount(); i++) { 33 | int attr = a.getIndex(i); 34 | switch (attr) { 35 | case 0: 36 | fontStyle = a.getInt(attr, 0); 37 | break; 38 | } 39 | } 40 | 41 | a.recycle(); 42 | // Do the same for our custom attribute set 43 | a = context.obtainStyledAttributes( 44 | attrs, R.styleable.FontTextView, defStyle, 0); 45 | 46 | for (int i = 0; i < a.getIndexCount(); i++) { 47 | final int attr = a.getIndex(i); 48 | if (attr == R.styleable.FontTextView_pix_font) { 49 | if (TextUtils.isEmpty(fontName)) { 50 | fontName = a.getString(attr); 51 | } 52 | } else if (attr == R.styleable.FontTextView_pix_fontBold) { 53 | if (TextUtils.isEmpty(fontName) 54 | || ((fontStyle & Typeface.BOLD) != 0 55 | && (fontStyle & Typeface.ITALIC) == 0)) { 56 | fontName = a.getString(attr); 57 | } 58 | } else if (attr == R.styleable.FontTextView_pix_fontItalic) { 59 | if (TextUtils.isEmpty(fontName) 60 | || ((fontStyle & Typeface.BOLD) == 0 61 | && (fontStyle & Typeface.ITALIC) != 0)) { 62 | fontName = a.getString(attr); 63 | } 64 | } else if (attr == R.styleable.FontTextView_pix_fontBoldItalic) { 65 | if (TextUtils.isEmpty(fontName) 66 | || ((fontStyle & Typeface.BOLD) != 0 67 | && (fontStyle & Typeface.ITALIC) != 0)) { 68 | fontName = a.getString(attr); 69 | } 70 | } 71 | } 72 | a.recycle(); 73 | return fontName; 74 | } 75 | 76 | public static Typeface getTypeface(@NonNull Context context, @NonNull AttributeSet attrs, int defStyle) { 77 | return getTypeface(context, getFontFromAttributes(context, attrs, defStyle)); 78 | } 79 | 80 | public static Typeface getTypeface(@NonNull Context context, @NonNull String fontName) { 81 | Typeface tf = TYPEFACES.get(fontName); 82 | if (tf == null) { 83 | try { 84 | tf = Typeface.createFromAsset(context.getAssets(), fontName); 85 | } catch (Exception e) { 86 | return null; 87 | } 88 | TYPEFACES.put(fontName, tf); 89 | } 90 | return tf; 91 | } 92 | 93 | public static void applyTypeface(@NonNull TextView view, @NonNull Typeface typeface) { 94 | view.setTypeface(typeface); 95 | } 96 | 97 | public static void applyTypeface(@NonNull TextView view, @NonNull String fontName) { 98 | final Typeface typeface = getTypeface(view.getContext(), fontName); 99 | view.setTypeface(typeface); 100 | } 101 | 102 | @NonNull 103 | public static SpannableString applyTypeface(@NonNull String text, @NonNull Context 104 | context, @NonNull String fontName) { 105 | final Typeface typeface = getTypeface(context, fontName); 106 | if (typeface == null) { 107 | throw new InvalidParameterException("Font '" + fontName + "' not found"); 108 | } 109 | return applyTypeface(text, typeface); 110 | } 111 | 112 | @NonNull 113 | public static SpannableString applyTypeface(final @NonNull String text, final @NonNull Typeface 114 | typeface) { 115 | SpannableString spannableString = new SpannableString(text); 116 | FontSpan span = new FontSpan(typeface); 117 | spannableString.setSpan(span, 0, spannableString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 118 | return spannableString; 119 | } 120 | 121 | /** 122 | * Applies a Typeface onto an overflow or popup menu 123 | * 124 | * @param menu The menu to typefacesize 125 | */ 126 | public static void applyTypeface(@NonNull Menu menu, final @NonNull Typeface typeface) { 127 | for (int i = 0; i < menu.size(); i++) { 128 | MenuItem item = menu.getItem(i); 129 | item.setTitle(applyTypeface(item.getTitle().toString(), typeface)); 130 | } 131 | } 132 | 133 | private FontUtil() { 134 | // Forbid class creation 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /library/src/main/res/layout/li_spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /raw/sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pixplicity/letterpress/ce10d0b029184cc6b9b9217302628a5beaab9f3e/raw/sample.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | rootProject.name = 'letterpress' 3 | --------------------------------------------------------------------------------