├── libs └── android-support-v4.jar ├── res ├── values │ ├── strings.xml │ ├── ezcv_attrs.xml │ └── styles.xml ├── values-v11 │ └── styles.xml └── values-v14 │ └── styles.xml ├── AndroidManifest.xml ├── .gitignore ├── README.md ├── src └── com │ └── iheanyiekechukwu │ └── android │ └── ezcv │ ├── EasyCustomView.java │ ├── EasyCustomButton.java │ └── EasyCustomTextView.java ├── project.properties └── proguard-project.txt /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheanyi/EasyCustomView/master/libs/android-support-v4.jar -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WizardListView 4 | 5 | 6 | -------------------------------------------------------------------------------- /res/values/ezcv_attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | You got the following widgets: 2 | 3 | EasyCustomTextView 4 | EasyCustomButton 5 | 6 | Define them in the XML as you would any other widget, so 7 | 8 | Then you can set the typeface by declaring the following as such, "escv:typefaceName="Roboto-Light"", and that will set the typeface up for you. Hope this helps and makes things easier! -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/com/iheanyiekechukwu/android/ezcv/EasyCustomView.java: -------------------------------------------------------------------------------- 1 | package com.iheanyiekechukwu.android.ezcv; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | public class EasyCustomView extends View { 8 | 9 | public EasyCustomView(Context context, AttributeSet attrs) { 10 | super(context, attrs); 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | android.library=true 16 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /src/com/iheanyiekechukwu/android/ezcv/EasyCustomButton.java: -------------------------------------------------------------------------------- 1 | package com.iheanyiekechukwu.android.ezcv; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Color; 6 | import android.graphics.Typeface; 7 | import android.util.AttributeSet; 8 | import android.widget.Button; 9 | 10 | public class EasyCustomButton extends Button{ 11 | private Typeface mTypeface; 12 | private String mTypePath; 13 | 14 | public EasyCustomButton(Context context, AttributeSet attrs, int defStyle) { 15 | super(context, attrs, defStyle); 16 | // TODO Auto-generated constructor stub 17 | 18 | if(!isInEditMode()) { 19 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.EasyCustomTextView, 0, 0); 20 | 21 | mTypePath = a.getString(R.styleable.EasyCustomTextView_typefaceName); 22 | 23 | String fullPath = "fonts/" + mTypePath + ".ttf"; 24 | 25 | try { 26 | mTypeface = Typeface.createFromAsset(context.getAssets(), fullPath); 27 | this.setTypeface(mTypeface); 28 | 29 | } catch(Exception e) { 30 | e.printStackTrace(); 31 | } 32 | 33 | this.setBackgroundColor(Color.BLUE); 34 | 35 | a.recycle(); 36 | } 37 | } 38 | 39 | public EasyCustomButton(Context context, AttributeSet attrs) { 40 | this(context, attrs, 0); 41 | // TODO Auto-generated constructor stub 42 | } 43 | 44 | public EasyCustomButton(Context context) { 45 | super(context); 46 | // TODO Auto-generated constructor stub 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/com/iheanyiekechukwu/android/ezcv/EasyCustomTextView.java: -------------------------------------------------------------------------------- 1 | package com.iheanyiekechukwu.android.ezcv; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Typeface; 6 | import android.util.AttributeSet; 7 | import android.widget.TextView; 8 | 9 | 10 | public class EasyCustomTextView extends TextView { 11 | 12 | private Typeface mTypeface; 13 | private String mTypePath; 14 | 15 | 16 | public EasyCustomTextView(Context context, AttributeSet attrs, int defStyle) { 17 | super(context, attrs, defStyle); 18 | 19 | if(!isInEditMode()) { 20 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.EasyCustomTextView, 0, 0); 21 | 22 | mTypePath = a.getString(R.styleable.EasyCustomTextView_typefaceName); 23 | 24 | if(mTypePath == null || mTypePath == "") { 25 | mTypePath = "Roboto-Light"; 26 | } 27 | 28 | String fullPath = "fonts/" + mTypePath + ".ttf"; 29 | 30 | try { 31 | mTypeface = Typeface.createFromAsset(context.getAssets(), fullPath); 32 | this.setTypeface(mTypeface); 33 | 34 | } catch(Exception e) { 35 | //mTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf"); 36 | //this.setTypeface(mTypeface); 37 | e.printStackTrace(); 38 | } 39 | 40 | } 41 | } 42 | 43 | public EasyCustomTextView(Context context, AttributeSet attrs) { 44 | super(context, attrs, 0); 45 | // TODO Auto-generated constructor stub 46 | } 47 | 48 | public EasyCustomTextView(Context context) { 49 | super(context); 50 | //This fallbacks to the default TextView without applying any custom fonts 51 | } 52 | 53 | } 54 | --------------------------------------------------------------------------------