From 19c97477af7eae52490ba255bc3da8ff662b2ebd Mon Sep 17 00:00:00 2001 From: Garrett Franks Date: Wed, 27 May 2015 14:32:00 -0400 Subject: [PATCH 1/6] Adding bold and italic support --- README.md | 67 +++++- .../calligraphy/CalligraphyConfig.java | 211 ++++++++++++++++++ .../CalligraphyContextWrapper.java | 10 +- .../calligraphy/CalligraphyFactory.java | 68 +++++- .../CalligraphyLayoutInflater.java | 16 +- .../calligraphy/CalligraphyUtils.java | 76 ++++++- calligraphy/src/main/res/values/attrs.xml | 3 + releases/calligraphy-release.aar | Bin 0 -> 36246 bytes 8 files changed, 428 insertions(+), 23 deletions(-) create mode 100644 releases/calligraphy-release.aar diff --git a/README.md b/README.md index 8295323..5fb2e5c 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,25 @@ Define your default font using `CalligraphyConfig`, in your `Application` class @Override public void onCreate() { super.onCreate(); + + // Customize each text style font separately CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/Roboto-RobotoRegular.ttf") + .setDefaultBoldFontPath("fonts/Roboto-RobotoBold.ttf") + .setDefaultItalicFontPath("fonts/Roboto-RobotoItalic.ttf") + .setDefaultBoldItalicFontPath("fonts/Roboto-RobotoBoldItalic.ttf") .setFontAttrId(R.attr.fontPath) .build() ); + + // Set the inherent default font path to look up Regular, Bold, Italic, and Bold-Italic fonts stored in your assets folder + // NOTE: This string will be formatted to lookup each font style. If one of the styles is not found, the default (Regular) will be used + CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() + .setInherentDefaultFontPaths("fonts/Roboto-%s.ttf") + .setFontAttrId(R.attr.fontPath) + .build() + ); + //.... } ``` @@ -70,11 +84,22 @@ _You're good to go!_ ### Custom font per TextView ```xml + + fontPath="fonts/Roboto-Regular.ttf" + boldFontPath="fonts/Roboto-Bold.ttf" + italicFontPath="fonts/Roboto-Italic.ttf" + boldItalicFontPath="fonts/Roboto-Bold-Italic.ttf"/> + + + ``` _Note: Popular IDE's (Android Studio, IntelliJ) will likely mark this as an error despite being correct. You may want to add `tools:ignore="MissingPrefix"` to either the View itself or its parent ViewGroup to avoid this. You'll need to add the tools namespace to have access to this "ignore" attribute. `xmlns:tools=" @@ -84,9 +109,19 @@ http://schemas.android.com/tools"`. See https://code.google.com/p/android/issues ```xml + + + + ``` @@ -103,8 +138,17 @@ http://schemas.android.com/tools"`. See https://code.google.com/p/android/issues ```xml + + + + ``` @@ -117,8 +161,17 @@ http://schemas.android.com/tools"`. See https://code.google.com/p/android/issues + + + ``` @@ -136,7 +189,17 @@ The `CalligraphyFactory` looks for the font in a pretty specific order, for the defined in the `Style` and a `TextAttribute` defined in the `View` the `Style` attribute is picked first! 4. `Theme` - if defined this is used. 5. `Default` - if defined in the `CalligraphyConfig` this is used of none of the above are found -**OR** if one of the above returns an invalid font. +**OR** if one of the above returns an invalid font. + +When specifying an inherent font path, we lookup each font based on these values +```java + // If we fail to find one of the fonts, we will either default to the Regular font supplied (i.e. "fonts/font-Regular.ttf") + // or the default system font if there is no Regular + String.format("fonts/font-%s.ttf", "Regular"); + String.format("fonts/font-%s.ttf", "Bold"); + String.format("fonts/font-%s.ttf", "Italic"); + String.format("fonts/font-%s.ttf", "Bold-Italic"); +``` ### Why *not* piggyback off of fontFamily attribute? diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java index c22148a..b71f058 100644 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java @@ -1,5 +1,7 @@ package uk.co.chrisjenx.calligraphy; +import android.content.Context; +import android.graphics.Typeface; import android.os.Build; import android.text.TextUtils; import android.widget.AutoCompleteTextView; @@ -70,10 +72,34 @@ public static CalligraphyConfig get() { * The default Font Path if nothing else is setup. */ private final String mFontPath; + /** + * The default Bold Font Path if nothing else is setup. + */ + private final String mBoldFontPath; + /** + * The default Italic Font Path if nothing else is setup. + */ + private final String mItalicFontPath; + /** + * The default Bold Italic Font Path if nothing else is setup. + */ + private final String mBoldItalicFontPath; /** * Default Font Path Attr Id to lookup */ private final int mAttrId; + /** + * Default Bold Font Path Attr Id to lookup + */ + private final int mBoldAttrId; + /** + * Default Italic Font Path Attr Id to lookup + */ + private final int mItalicAttrId; + /** + * Default Bold Italic Font Path Attr Id to lookup + */ + private final int mBoldItalicAttrId; /** * Use Reflection to inject the private factory. */ @@ -90,7 +116,13 @@ public static CalligraphyConfig get() { protected CalligraphyConfig(Builder builder) { mIsFontSet = builder.isFontSet; mFontPath = builder.fontAssetPath; + mBoldFontPath = builder.boldFontAssetPath; + mItalicFontPath = builder.italicFontAssetPath; + mBoldItalicFontPath = builder.boldItalicFontAssetPath; mAttrId = builder.attrId; + mBoldAttrId = builder.boldAttrId; + mItalicAttrId = builder.italicAttrId; + mBoldItalicAttrId = builder.boldItalicAttrId; mReflection = builder.reflection; mCustomViewCreation = builder.customViewCreation; final Map, Integer> tempMap = new HashMap<>(DEFAULT_STYLES); @@ -105,6 +137,27 @@ public String getFontPath() { return mFontPath; } + /** + * @return mBoldFontPath for text views might be null + */ + public String getBoldFontPath() { + return mBoldFontPath; + } + + /** + * @return mItalicFontPath for text views might be null + */ + public String getItalicFontPath() { + return mItalicFontPath; + } + + /** + * @return mBoldItalicFontPath for text views might be null + */ + public String getBoldItalicFontPath() { + return mBoldItalicFontPath; + } + /** * @return true if set, false if null|empty */ @@ -131,6 +184,27 @@ public int getAttrId() { return mAttrId; } + /** + * @return the custom boldAttrId to look for, -1 if not set. + */ + public int getBoldAttrId() { + return mBoldAttrId; + } + + /** + * @return the custom italicAttrId to look for, -1 if not set. + */ + public int getItalicAttrId() { + return mItalicAttrId; + } + + /** + * @return the custom boldItalicAttrId to look for, -1 if not set. + */ + public int getBoldItalicAttrId() { + return mBoldItalicAttrId; + } + public static class Builder { /** * Default AttrID if not set. @@ -148,6 +222,18 @@ public static class Builder { * The fontAttrId to look up the font path from. */ private int attrId = R.attr.fontPath; + /** + * The boldFontPath to look up the font path from. + */ + private int boldAttrId = R.attr.boldFontPath; + /** + * The italicFontPath to look up the font path from. + */ + private int italicAttrId = R.attr.italicFontPath; + /** + * The boldItalicFontPath to look up the font path from. + */ + private int boldItalicAttrId = R.attr.boldItalicFontPath; /** * Has the user set the default font path. */ @@ -156,6 +242,18 @@ public static class Builder { * The default fontPath */ private String fontAssetPath = null; + /** + * The default bold fontPath + */ + private String boldFontAssetPath = null; + /** + * The default italic fontPath + */ + private String italicFontAssetPath = null; + /** + * The default bold italic fontPath + */ + private String boldItalicFontAssetPath = null; /** * Additional Class Styles. Can be empty. */ @@ -172,6 +270,80 @@ public Builder setFontAttrId(int fontAssetAttrId) { return this; } + /** + * This defaults to R.attr.boldFontPath. So only override if you want to use your own attrId. + * + * @param fontAssetAttrId the custom attribute to look for fonts in assets. + * @return this builder. + */ + public Builder setBoldFontAttrId(int fontAssetAttrId) { + this.boldAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + return this; + } + + /** + * This defaults to R.attr.italicFontPath. So only override if you want to use your own attrId. + * + * @param fontAssetAttrId the custom attribute to look for fonts in assets. + * @return this builder. + */ + public Builder setItalicFontAttrId(int fontAssetAttrId) { + this.italicAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + return this; + } + + /** + * This defaults to R.attr.boldItalicFontPath. So only override if you want to use your own attrId. + * + * @param fontAssetAttrId the custom attribute to look for fonts in assets. + * @return this builder. + */ + public Builder setBoldItalicFontAttrId(int fontAssetAttrId) { + this.boldItalicAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + return this; + } + + /** + * Set the default font if you don't define one else where in your styles. + * + * @param defaultFontAssetPath an inherent path to a font family in the assets folder, e.g. "fonts/Roboto-%s.ttf", + * passing null will default to the device font-family. This will dynamically apply + * regular, bold, and italic (if available in the assets folder). + * E.g. "fonts/Roboto-%s.ttf" -> "fonts/Roboto-Regular.ttf", "fonts/Roboto-Bold.ttf", "fonts/Roboto-Italic.ttf" + * @return this builder. + */ + public Builder setInherentDefaultFontPaths(Context context, String defaultFontAssetPath) { + if (!CalligraphyUtils.isInherentFontPath(defaultFontAssetPath)) { + throw new IllegalStateException("You must pass a font path that may be formatted. e.g. fonts/font-%s.ttf"); + } + + try { + Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_REGULAR)); + setDefaultFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_REGULAR)); + } catch (Throwable t) { + // error setting regular font path + } + try { + Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD)); + setDefaultBoldFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD)); + } catch (Throwable t) { + // error setting bold font path + } + try { + Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_ITALIC)); + setDefaultItalicFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_ITALIC)); + } catch (Throwable t) { + // error setting italic font path + } + try { + Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD_ITALIC)); + setDefaultBoldItalicFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD_ITALIC)); + } catch (Throwable t) { + // error setting italic font path + } + return this; + } + /** * Set the default font if you don't define one else where in your styles. * @@ -185,6 +357,45 @@ public Builder setDefaultFontPath(String defaultFontAssetPath) { return this; } + /** + * Set the default bold font if you don't define one else where in your styles. + * + * @param defaultFontAssetPath a path to a font file in the assets folder, e.g. "fonts/Roboto-light.ttf", + * passing null will default to the device font-family. + * @return this builder. + */ + public Builder setDefaultBoldFontPath(String defaultFontAssetPath) { + this.isFontSet = !TextUtils.isEmpty(defaultFontAssetPath); + this.boldFontAssetPath = defaultFontAssetPath; + return this; + } + + /** + * Set the default italic font if you don't define one else where in your styles. + * + * @param defaultFontAssetPath a path to a font file in the assets folder, e.g. "fonts/Roboto-light.ttf", + * passing null will default to the device font-family. + * @return this builder. + */ + public Builder setDefaultItalicFontPath(String defaultFontAssetPath) { + this.isFontSet = !TextUtils.isEmpty(defaultFontAssetPath); + this.italicFontAssetPath = defaultFontAssetPath; + return this; + } + + /** + * Set the default bold italic font if you don't define one else where in your styles. + * + * @param defaultFontAssetPath a path to a font file in the assets folder, e.g. "fonts/Roboto-light.ttf", + * passing null will default to the device font-family. + * @return this builder. + */ + public Builder setDefaultBoldItalicFontPath(String defaultFontAssetPath) { + this.isFontSet = !TextUtils.isEmpty(defaultFontAssetPath); + this.boldItalicFontAssetPath = defaultFontAssetPath; + return this; + } + /** *

Turn of the use of Reflection to inject the private factory. * This has operational consequences! Please read and understand before disabling. diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java index 8650208..6b2c140 100644 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java @@ -16,6 +16,8 @@ public class CalligraphyContextWrapper extends ContextWrapper { private CalligraphyLayoutInflater mInflater; private final int mAttributeId; + private final int mBoldAttributeId; + private final int mItalicAttributeId; /** * Uses the default configuration from {@link uk.co.chrisjenx.calligraphy.CalligraphyConfig} @@ -84,6 +86,8 @@ static CalligraphyActivityFactory get(Activity activity) { CalligraphyContextWrapper(Context base) { super(base); mAttributeId = CalligraphyConfig.get().getAttrId(); + mBoldAttributeId = CalligraphyConfig.get().getBoldAttrId(); + mItalicAttributeId = CalligraphyConfig.get().getItalicAttrId(); } /** @@ -99,16 +103,18 @@ static CalligraphyActivityFactory get(Activity activity) { * @deprecated use {@link #wrap(android.content.Context)} */ @Deprecated - public CalligraphyContextWrapper(Context base, int attributeId) { + public CalligraphyContextWrapper(Context base, int attributeId, int boldAttributeId, int italicAttributeId) { super(base); mAttributeId = attributeId; + mBoldAttributeId = boldAttributeId; + mItalicAttributeId = italicAttributeId; } @Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (mInflater == null) { - mInflater = new CalligraphyLayoutInflater(LayoutInflater.from(getBaseContext()), this, mAttributeId, false); + mInflater = new CalligraphyLayoutInflater(LayoutInflater.from(getBaseContext()), this, mAttributeId, mBoldAttributeId, mItalicAttributeId, false); } return mInflater; } diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java index ca45b62..efc301f 100644 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java @@ -3,6 +3,7 @@ import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; +import android.graphics.Typeface; import android.os.Build; import android.text.TextUtils; import android.util.AttributeSet; @@ -16,6 +17,11 @@ class CalligraphyFactory { private static final String ACTION_BAR_TITLE = "action_bar_title"; private static final String ACTION_BAR_SUBTITLE = "action_bar_subtitle"; + /** + * Default AttrID if not set. + */ + public static final int INVALID_ATTR_ID = -1; + /** * Some styles are in sub styles, such as actionBarTextStyle etc.. * @@ -91,9 +97,13 @@ protected static boolean matchesResourceIdName(View view, String matches) { } private final int mAttributeId; + private final int mBoldAttributeId; + private final int mItalicAttributeId; - public CalligraphyFactory(int attributeId) { + public CalligraphyFactory(int attributeId, int boldAttributeId, int italicAttributeId) { this.mAttributeId = attributeId; + this.mBoldAttributeId = boldAttributeId; + this.mItalicAttributeId = italicAttributeId; } /** @@ -125,25 +135,61 @@ void onViewCreatedInternal(View view, final Context context, AttributeSet attrs) // Since we're not using namespace it's a little bit tricky // Try view xml attributes - String textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); + String textViewFont; + if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mBoldAttributeId); + } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mItalicAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); + } // Try view style attributes if (TextUtils.isEmpty(textViewFont)) { - textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mAttributeId); + if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mBoldAttributeId); + } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mItalicAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mAttributeId); + } } // Try View TextAppearance if (TextUtils.isEmpty(textViewFont)) { - textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mAttributeId); + if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mBoldAttributeId); + } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { + textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mItalicAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mAttributeId); + } } // Try theme attributes if (TextUtils.isEmpty(textViewFont)) { - final int[] styleForTextView = getStyleForTextView((TextView) view); - if (styleForTextView[1] != -1) - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mAttributeId); - else - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mAttributeId); + if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { + final int[] styleForTextView = getStyleForTextView((TextView) view); + if (styleForTextView[1] != -1) { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mBoldAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mBoldAttributeId); + } + } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { + final int[] styleForTextView = getStyleForTextView((TextView) view); + if (styleForTextView[1] != -1) { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mItalicAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mItalicAttributeId); + } + } else { + final int[] styleForTextView = getStyleForTextView((TextView) view); + if (styleForTextView[1] != -1) { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mAttributeId); + } + } } // Still need to defer the Native action bar, appcompat-v7:21+ uses the Toolbar underneath. But won't match these anyway. @@ -179,6 +225,4 @@ public void onGlobalLayout() { }); } } - - -} +} \ No newline at end of file diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java index 6f9cfc1..8ef3b80 100644 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java @@ -25,28 +25,34 @@ class CalligraphyLayoutInflater extends LayoutInflater implements CalligraphyAct }; private final int mAttributeId; + private final int mBoldAttributeId; + private final int mItalicAttributeId; private final CalligraphyFactory mCalligraphyFactory; // Reflection Hax private boolean mSetPrivateFactory = false; private Field mConstructorArgs = null; - protected CalligraphyLayoutInflater(Context context, int attributeId) { + protected CalligraphyLayoutInflater(Context context, int attributeId, int boldAttributeId, int italicAttributeId) { super(context); mAttributeId = attributeId; - mCalligraphyFactory = new CalligraphyFactory(attributeId); + mBoldAttributeId = boldAttributeId; + mItalicAttributeId = italicAttributeId; + mCalligraphyFactory = new CalligraphyFactory(attributeId, boldAttributeId, italicAttributeId); setUpLayoutFactories(false); } - protected CalligraphyLayoutInflater(LayoutInflater original, Context newContext, int attributeId, final boolean cloned) { + protected CalligraphyLayoutInflater(LayoutInflater original, Context newContext, int attributeId, int boldAttributeId, int italicAttributeId, final boolean cloned) { super(original, newContext); mAttributeId = attributeId; - mCalligraphyFactory = new CalligraphyFactory(attributeId); + mBoldAttributeId = boldAttributeId; + mItalicAttributeId = italicAttributeId; + mCalligraphyFactory = new CalligraphyFactory(attributeId, boldAttributeId, italicAttributeId); setUpLayoutFactories(cloned); } @Override public LayoutInflater cloneInContext(Context newContext) { - return new CalligraphyLayoutInflater(this, newContext, mAttributeId, true); + return new CalligraphyLayoutInflater(this, newContext, mAttributeId, mBoldAttributeId, mItalicAttributeId, true); } // === diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java index 11737bf..0eaae3b 100644 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java @@ -22,6 +22,11 @@ */ public final class CalligraphyUtils { + public static final String FONT_REGULAR = "Regular"; + public static final String FONT_BOLD = "Bold"; + public static final String FONT_ITALIC = "Italic"; + public static final String FONT_BOLD_ITALIC = "Bold-Italic"; + /** * Applies a custom typeface span to the text. * @@ -120,7 +125,18 @@ static void applyFontToTextView(final Context context, final TextView textView, static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config, boolean deferred) { if (context == null || textView == null || config == null) return; if (!config.isFontSet()) return; - applyFontToTextView(context, textView, config.getFontPath(), deferred); + String fontPath; + if ((textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) + && config.getBoldItalicFontPath() != null) { + fontPath = config.getItalicFontPath(); + } else if (textView.getTypeface().getStyle() == Typeface.BOLD && config.getBoldFontPath() != null) { + fontPath = config.getBoldFontPath(); + } else if (textView.getTypeface().getStyle() == Typeface.ITALIC && config.getItalicFontPath() != null) { + fontPath = config.getItalicFontPath(); + } else { + fontPath = config.getFontPath(); + } + applyFontToTextView(context, textView, fontPath, deferred); } /** @@ -138,7 +154,55 @@ public static void applyFontToTextView(final Context context, final TextView tex static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config, final String textViewFont, boolean deferred) { if (context == null || textView == null || config == null) return; - if (!TextUtils.isEmpty(textViewFont) && applyFontToTextView(context, textView, textViewFont, deferred)) { + if (!TextUtils.isEmpty(textViewFont)) { + if (isInherentFontPath(textViewFont)) { + if (textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD_ITALIC)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD_ITALIC), deferred); + } catch (Throwable t) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); + } catch (Throwable t2) { + applyFontToTextView(context, textView, config, deferred); + } + } + } else if (textView.getTypeface().getStyle() == Typeface.BOLD) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD), deferred); + } catch (Throwable t) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); + } catch (Throwable t2) { + applyFontToTextView(context, textView, config, deferred); + } + } + } else if (textView.getTypeface().getStyle() == Typeface.ITALIC) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_ITALIC)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_ITALIC), deferred); + } catch (Throwable t) { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); + } catch (Throwable t2) { + applyFontToTextView(context, textView, config, deferred); + } + } + } else { + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); + } catch (Throwable t) { + applyFontToTextView(context, textView, config, deferred); + } + } + } else { + applyFontToTextView(context, textView, textViewFont, deferred); + } return; } applyFontToTextView(context, textView, config, deferred); @@ -310,6 +374,14 @@ static String pullFontPathFromTheme(Context context, int styleAttrId, int subSty return null; } + public static String pullFontPathFromInherentFontPath(String fontPath, String fontType) { + return String.format(fontPath, fontType); + } + + public static boolean isInherentFontPath(String fontPath) { + return fontPath.contains("%s"); + } + private static Boolean sToolbarCheck = null; /** diff --git a/calligraphy/src/main/res/values/attrs.xml b/calligraphy/src/main/res/values/attrs.xml index 02c6672..5ca5fa6 100644 --- a/calligraphy/src/main/res/values/attrs.xml +++ b/calligraphy/src/main/res/values/attrs.xml @@ -1,4 +1,7 @@ + + + \ No newline at end of file diff --git a/releases/calligraphy-release.aar b/releases/calligraphy-release.aar new file mode 100644 index 0000000000000000000000000000000000000000..a1140cc6ebb3ce54d88974853fca30dbee764634 GIT binary patch literal 36246 zcmV)EK)}CHO9KQ7000OG0C7XSMjVAM49Nfh08jw{022TJ06}hKa&Kv5O<`_nW@U49 zE_iKhZIHcg!!QhlcRz)oJyPQ(tzkPu_ACLi6B1*qvVI^cf%EniTpKXZa^u~11j+V1 zyNSIpkqN%zNAbZKdKI+sL&u-_arortzG@wK^FYe1;GP=rIt8OUKIR-7DM^j!fW)c` z6`X`X);5CIKF?$HP)=VU4kyD-$3(`Ib=|I{p-9F@uziE5lZa(opM20kA-a~cGncOBrjFVB2i?fKW+}_jw08mQ< z1PTBE2nYaiL%c@!=B0{{3 zX2uRPGcz;x7iMPWbcdOlnVFfHJIv|rnR{n<{x_?c_f~7kk}VzElFP?FRW3ytFmM z-=dKIZsq>P(74#yBT=lz0g!gk_^qh*@p_2>zt6>xX zYd^v;h*zG96Kl1lzH7QroX4<=z@8xNGQR$;;7 zu2pNf&9=+RQ^EO+_|%}j*$z2>e&O3laEU|S2EeQeBX}^NrL$16q}A3RvfNuo(oQa+ zt)#Eib{|qsKC1cz^-yicAGl1P0>ECM{l530jzyWmN$*pPjOX~r=u`MfkScY(A^y{@ zfdv9lQ-AF#`q#F6{|CE@{6B3W6IUyDD_0M3BNJB#XODlG*-f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u$DkrDX2tVs6Fqel%pT9(Wa&zGTKP6Sk^l;FyoOHN=vu@MJ zq=@_|i>cfvsj;_JQ0X&`v2*S1YbSC)4+qRy&ZB16`gk`T2}UN@@!aG~Aw;C(sW^zO4tYSpXTQi~u6Gh;)uHdDVrv+3c z10|X>>_*4NX3~Q3yfYd$$d@zzIc%1`gMYIP);(g8l&Wbo>8c!gk{W)gd_i3b-NmFac9cF9y9(X^~wgm;+3m*|T%&j|tt(3!KN81XD95O?FE{xK7w zh0ysac~3KJ=j05xqj{J{uX6Vzi}RLe2K)|!hRboa(jOWE0RX`t zAa!?pPY;a!8C!RZql1^XoUa?!Euqf6QGqMW2N`}>)tDmj$QGfwatK(uiw|8`8U&Lj zEUoZc2rInuq>T8mw63VsMAa!Ia@13_7swDl{_+LQ=Ir&$YZLG5T||7BP;EuySwizC zSnna!CZWPor{g~0pA~@l?}Rx!XxuDplDQxqQmSABaRZC@q;dt`%MK609M%j`t`BZK z+E-L#86uZY=_gL|TfkkP6pfjJyVN+QP=Cpds7=HYG5%xjY70oM2t}Jw%_|*g!v{2D zZy6=Tltn%o9_`*<^hqD_-#KET`<@P7|47lV81Q$@Ra@+pe}Rg4T1WNMA^Yfg=l>o0 zjloFeqeN9#W;j>GDvh(h=H6AAH*ydrsgY`Lo`Od;?6jTsmd=}jfw)&(;l~VR`QG*x zvgHp2K5&*3Pu82A>HhLssI8vmCEDYl$Z*++n`x$@>@DAdp=8W!Rb?k0#hkey3#vc210)R}rnSV<8SC#If_x8i? z6BypV$kkBq_YPJk^P;a?0RSKj0Kk~TA9kPch3=xUjMwv$bFuZ@PTXD<{F7K<{k=wb zJB0!Hb=`fV>;TND`$v9Xh1)5=j*qblf7pG(-5-?yV~`BikH8Eue=|nl?5J&VFXy&9JD)hl=(H{T+{{t Date: Wed, 3 Jun 2015 15:42:09 +0200 Subject: [PATCH 2/6] removed unnecessary if statement in methods set{...}FontAttrId() --- .../uk/co/chrisjenx/calligraphy/CalligraphyConfig.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java old mode 100644 new mode 100755 index b71f058..2229604 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java @@ -266,7 +266,7 @@ public static class Builder { * @return this builder. */ public Builder setFontAttrId(int fontAssetAttrId) { - this.attrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + this.attrId = fontAssetAttrId; return this; } @@ -277,7 +277,7 @@ public Builder setFontAttrId(int fontAssetAttrId) { * @return this builder. */ public Builder setBoldFontAttrId(int fontAssetAttrId) { - this.boldAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + this.boldAttrId = fontAssetAttrId; return this; } @@ -288,7 +288,7 @@ public Builder setBoldFontAttrId(int fontAssetAttrId) { * @return this builder. */ public Builder setItalicFontAttrId(int fontAssetAttrId) { - this.italicAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + this.italicAttrId = fontAssetAttrId; return this; } @@ -299,7 +299,7 @@ public Builder setItalicFontAttrId(int fontAssetAttrId) { * @return this builder. */ public Builder setBoldItalicFontAttrId(int fontAssetAttrId) { - this.boldItalicAttrId = fontAssetAttrId != INVALID_ATTR_ID ? fontAssetAttrId : INVALID_ATTR_ID; + this.boldItalicAttrId = fontAssetAttrId; return this; } From ab326d9ff6d41b73ec12037822665262a71d9600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Iffl=C3=A4nder?= Date: Wed, 3 Jun 2015 15:50:40 +0200 Subject: [PATCH 3/6] CalligraphyConfig: refactored redundant code + added log message instead of skipping exception --- .../calligraphy/CalligraphyConfig.java | 52 ++++++++----------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java index 2229604..a1faa91 100755 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyConfig.java @@ -4,6 +4,7 @@ import android.graphics.Typeface; import android.os.Build; import android.text.TextUtils; +import android.util.Log; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.CheckBox; @@ -317,31 +318,20 @@ public Builder setInherentDefaultFontPaths(Context context, String defaultFontAs throw new IllegalStateException("You must pass a font path that may be formatted. e.g. fonts/font-%s.ttf"); } + loadDefaultFontPath(context, defaultFontAssetPath, CalligraphyUtils.FONT_REGULAR); + loadDefaultFontPath(context, defaultFontAssetPath, CalligraphyUtils.FONT_BOLD); + loadDefaultFontPath(context, defaultFontAssetPath, CalligraphyUtils.FONT_ITALIC); + loadDefaultFontPath(context, defaultFontAssetPath, CalligraphyUtils.FONT_BOLD_ITALIC); + return this; + } + + private void loadDefaultFontPath(Context context, String defaultFontAssetPath, String fontStyle) { try { - Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_REGULAR)); - setDefaultFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_REGULAR)); - } catch (Throwable t) { - // error setting regular font path - } - try { - Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD)); - setDefaultBoldFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD)); - } catch (Throwable t) { - // error setting bold font path - } - try { - Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_ITALIC)); - setDefaultItalicFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_ITALIC)); - } catch (Throwable t) { - // error setting italic font path - } - try { - Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD_ITALIC)); - setDefaultBoldItalicFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, CalligraphyUtils.FONT_BOLD_ITALIC)); + Typeface.createFromAsset(context.getAssets(), CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, fontStyle)); + setDefaultFontPath(CalligraphyUtils.pullFontPathFromInherentFontPath(defaultFontAssetPath, fontStyle)); } catch (Throwable t) { - // error setting italic font path + Log.e("Calligraphy", "Error setting font path", t); } - return this; } /** @@ -400,7 +390,7 @@ public Builder setDefaultBoldItalicFontPath(String defaultFontAssetPath) { *

Turn of the use of Reflection to inject the private factory. * This has operational consequences! Please read and understand before disabling. * This is already disabled on pre Honeycomb devices. (API 11)

- * + *

*

If you disable this you will need to override your {@link android.app.Activity#onCreateView(android.view.View, String, android.content.Context, android.util.AttributeSet)} * as this is set as the {@link android.view.LayoutInflater} private factory.

*
@@ -422,21 +412,21 @@ public Builder disablePrivateFactoryInjection() { * Due to the poor inflation order where custom views are created and never returned inside an * {@code onCreateView(...)} method. We have to create CustomView's at the latest point in the * overrideable injection flow. - * + *

* On HoneyComb+ this is inside the {@link android.app.Activity#onCreateView(android.view.View, String, android.content.Context, android.util.AttributeSet)} * Pre HoneyComb this is in the {@link android.view.LayoutInflater.Factory#onCreateView(String, android.util.AttributeSet)} - * + *

* We wrap base implementations, so if you LayoutInflater/Factory/Activity creates the * custom view before we get to this point, your view is used. (Such is the case with the * TintEditText etc) - * + *

* The problem is, the native methods pass there parents context to the constructor in a really * specific place. We have to mimic this in {@link uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater#createCustomViewInternal(android.view.View, android.view.View, String, android.content.Context, android.util.AttributeSet)} * To mimic this we have to use reflection as the Class constructor args are hidden to us. - * + *

* We have discussed other means of doing this but this is the only semi-clean way of doing it. * (Without having to do proxy classes etc). - * + *

* Calling this will of course speed up inflation by turning off reflection, but not by much, * But if you want Calligraphy to inject the correct typeface then you will need to make sure your CustomView's * are created before reaching the LayoutInflater onViewCreated. @@ -449,13 +439,13 @@ public Builder disableCustomViewInflation() { /** * Add a custom style to get looked up. If you use a custom class that has a parent style * which is not part of the default android styles you will need to add it here. - * + *

* The Calligraphy inflater is unaware of custom styles in your custom classes. We use * the class type to look up the style attribute in the theme resources. - * + *

* So if you had a {@code MyTextField.class} which looked up it's default style as * {@code R.attr.textFieldStyle} you would add those here. - * + *

* {@code builder.addCustomStyle(MyTextField.class,R.attr.textFieldStyle} * * @param styleClass the class that related to the parent styleResource. null is ignored. From 23913cbcbf99c0bc2e7dad2da025964e3249a545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Iffl=C3=A4nder?= Date: Fri, 5 Jun 2015 12:20:39 +0200 Subject: [PATCH 4/6] bugfix: if TextView.getTypeface() returns null there will not be a NullPointerException anymore; + refactored redundant code passages --- .../calligraphy/CalligraphyFactory.java | 99 ++++++++----------- .../calligraphy/CalligraphyUtils.java | 94 +++++++----------- 2 files changed, 78 insertions(+), 115 deletions(-) mode change 100644 => 100755 calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java mode change 100644 => 100755 calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java old mode 100644 new mode 100755 index efc301f..d340985 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java @@ -133,64 +133,7 @@ void onViewCreatedInternal(View view, final Context context, AttributeSet attrs) } // Try to get typeface attribute value // Since we're not using namespace it's a little bit tricky - - // Try view xml attributes - String textViewFont; - if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mBoldAttributeId); - } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mItalicAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); - } - - // Try view style attributes - if (TextUtils.isEmpty(textViewFont)) { - if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mBoldAttributeId); - } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mItalicAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mAttributeId); - } - } - - // Try View TextAppearance - if (TextUtils.isEmpty(textViewFont)) { - if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mBoldAttributeId); - } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { - textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mItalicAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mAttributeId); - } - } - - // Try theme attributes - if (TextUtils.isEmpty(textViewFont)) { - if (((TextView) view).getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { - final int[] styleForTextView = getStyleForTextView((TextView) view); - if (styleForTextView[1] != -1) { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mBoldAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mBoldAttributeId); - } - } else if (((TextView) view).getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { - final int[] styleForTextView = getStyleForTextView((TextView) view); - if (styleForTextView[1] != -1) { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mItalicAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mItalicAttributeId); - } - } else { - final int[] styleForTextView = getStyleForTextView((TextView) view); - if (styleForTextView[1] != -1) { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], mAttributeId); - } else { - textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], mAttributeId); - } - } - } + String textViewFont = selectFont((TextView) view, context, attrs); // Still need to defer the Native action bar, appcompat-v7:21+ uses the Toolbar underneath. But won't match these anyway. final boolean deferred = matchesResourceIdName(view, ACTION_BAR_TITLE) || matchesResourceIdName(view, ACTION_BAR_SUBTITLE); @@ -225,4 +168,44 @@ public void onGlobalLayout() { }); } } + + private String selectFont(TextView textView, Context context, AttributeSet attrs) { + String textViewFont; + + // get style: regular/bold/italic + int styleAttributeId; + if (textView.getTypeface() == null) { + styleAttributeId = mAttributeId; + } else if (textView.getTypeface().getStyle() == Typeface.BOLD && mBoldAttributeId != INVALID_ATTR_ID) { + styleAttributeId = mBoldAttributeId; + } else if (textView.getTypeface().getStyle() == Typeface.ITALIC && mItalicAttributeId != INVALID_ATTR_ID) { + styleAttributeId = mItalicAttributeId; + } else { + styleAttributeId = mAttributeId; + } + + // Try view xml attributes + textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, styleAttributeId); + + // Try view style attributes + if (TextUtils.isEmpty(textViewFont)) { + textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, styleAttributeId); + } + + // Try View TextAppearance + if (TextUtils.isEmpty(textViewFont)) { + textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, styleAttributeId); + } + + // Try theme attributes + if (TextUtils.isEmpty(textViewFont)) { + final int[] styleForTextView = getStyleForTextView(textView); + if (styleForTextView[1] != -1) { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleForTextView[1], styleAttributeId); + } else { + textViewFont = CalligraphyUtils.pullFontPathFromTheme(context, styleForTextView[0], styleAttributeId); + } + } + return textViewFont; + } } \ No newline at end of file diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java old mode 100644 new mode 100755 index 0eaae3b..b6478a2 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java @@ -62,7 +62,7 @@ public static boolean applyFontToTextView(final TextView textView, final Typefac /** * Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple * times, as this adds a TextWatcher. - * + *

* Deferring should really only be used on tricky views which get Typeface set by the system at * weird times. * @@ -126,12 +126,12 @@ static void applyFontToTextView(final Context context, final TextView textView, if (context == null || textView == null || config == null) return; if (!config.isFontSet()) return; String fontPath; - if ((textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) + if (textView.getTypeface() != null && (textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) && config.getBoldItalicFontPath() != null) { fontPath = config.getItalicFontPath(); - } else if (textView.getTypeface().getStyle() == Typeface.BOLD && config.getBoldFontPath() != null) { + } else if (textView.getTypeface() != null && textView.getTypeface().getStyle() == Typeface.BOLD && config.getBoldFontPath() != null) { fontPath = config.getBoldFontPath(); - } else if (textView.getTypeface().getStyle() == Typeface.ITALIC && config.getItalicFontPath() != null) { + } else if (textView.getTypeface() != null && textView.getTypeface().getStyle() == Typeface.ITALIC && config.getItalicFontPath() != null) { fontPath = config.getItalicFontPath(); } else { fontPath = config.getFontPath(); @@ -153,59 +153,40 @@ public static void applyFontToTextView(final Context context, final TextView tex } static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config, final String textViewFont, boolean deferred) { - if (context == null || textView == null || config == null) return; - if (!TextUtils.isEmpty(textViewFont)) { - if (isInherentFontPath(textViewFont)) { - if (textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD_ITALIC)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD_ITALIC), deferred); - } catch (Throwable t) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); - } catch (Throwable t2) { - applyFontToTextView(context, textView, config, deferred); - } - } - } else if (textView.getTypeface().getStyle() == Typeface.BOLD) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_BOLD), deferred); - } catch (Throwable t) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); - } catch (Throwable t2) { - applyFontToTextView(context, textView, config, deferred); - } - } - } else if (textView.getTypeface().getStyle() == Typeface.ITALIC) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_ITALIC)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_ITALIC), deferred); - } catch (Throwable t) { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); - } catch (Throwable t2) { - applyFontToTextView(context, textView, config, deferred); - } - } - } else { - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, FONT_REGULAR), deferred); - } catch (Throwable t) { - applyFontToTextView(context, textView, config, deferred); - } - } - } else { - applyFontToTextView(context, textView, textViewFont, deferred); - } + if (context == null || textView == null || config == null) { + return; + } + + if (TextUtils.isEmpty(textViewFont) || !isInherentFontPath(textViewFont)) { + applyFontToTextView(context, textView, config, deferred); return; } - applyFontToTextView(context, textView, config, deferred); + + String style; + if (textView.getTypeface() == null) { + style = FONT_REGULAR; + } else { + switch (textView.getTypeface().getStyle()) { + case Typeface.BOLD: + style = FONT_BOLD; + break; + case Typeface.ITALIC: + style = FONT_ITALIC; + break; + case Typeface.BOLD_ITALIC: + style = FONT_BOLD_ITALIC; + break; + default: + style = FONT_REGULAR; + } + } + + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, style)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, style), deferred); + } catch (Throwable t) { + applyFontToTextView(context, textView, config, deferred); + } } /** @@ -321,8 +302,7 @@ static String pullFontPathFromTheme(Context context, int styleAttrId, int attrib theme.resolveAttribute(styleAttrId, value, true); final TypedArray typedArray = theme.obtainStyledAttributes(value.resourceId, new int[]{attributeId}); try { - String font = typedArray.getString(0); - return font; + return typedArray.getString(0); } catch (Exception ignore) { // Failed for some reason. return null; From d0aa60eb8a79fa264b9f08734f6be4c741f59233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Iffl=C3=A4nder?= Date: Fri, 5 Jun 2015 12:42:42 +0200 Subject: [PATCH 5/6] removed non-public method without usages --- .../java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java index b6478a2..f50d406 100755 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java @@ -118,10 +118,6 @@ static boolean applyFontToTextView(final Context context, final TextView textVie return applyFontToTextView(textView, typeface, deferred); } - static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config) { - applyFontToTextView(context, textView, config, false); - } - static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config, boolean deferred) { if (context == null || textView == null || config == null) return; if (!config.isFontSet()) return; From efc44f8a4522cef25aad20acbc7820adbc4ff9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Iffl=C3=A4nder?= Date: Fri, 5 Jun 2015 12:52:28 +0200 Subject: [PATCH 6/6] refactored redundant code --- .../calligraphy/CalligraphyUtils.java | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java index f50d406..ec849af 100755 --- a/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java +++ b/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java @@ -119,22 +119,38 @@ static boolean applyFontToTextView(final Context context, final TextView textVie } static void applyFontToTextView(final Context context, final TextView textView, final CalligraphyConfig config, boolean deferred) { - if (context == null || textView == null || config == null) return; - if (!config.isFontSet()) return; - String fontPath; - if (textView.getTypeface() != null && (textView.getTypeface().getStyle() == Typeface.BOLD_ITALIC || ((textView.getTypeface().getStyle() & Typeface.BOLD) != 0 && (textView.getTypeface().getStyle() & Typeface.ITALIC) != 0)) - && config.getBoldItalicFontPath() != null) { - fontPath = config.getItalicFontPath(); - } else if (textView.getTypeface() != null && textView.getTypeface().getStyle() == Typeface.BOLD && config.getBoldFontPath() != null) { - fontPath = config.getBoldFontPath(); - } else if (textView.getTypeface() != null && textView.getTypeface().getStyle() == Typeface.ITALIC && config.getItalicFontPath() != null) { - fontPath = config.getItalicFontPath(); - } else { - fontPath = config.getFontPath(); + if (context == null || textView == null || config == null) { + return; } + if (!config.isFontSet()) { + return; + } + + String fontPath = getFontPathByStyle(textView, config); applyFontToTextView(context, textView, fontPath, deferred); } + private static String getFontPathByStyle(TextView textView, CalligraphyConfig config) { + String fontPath = null; + if (textView.getTypeface() != null) { + switch (textView.getTypeface().getStyle()) { + case Typeface.BOLD: + fontPath = config.getBoldFontPath(); + break; + case Typeface.ITALIC: + fontPath = config.getItalicFontPath(); + break; + case Typeface.BOLD_ITALIC: + fontPath = config.getBoldItalicFontPath(); + break; + } + } + if (fontPath == null) { + fontPath = config.getFontPath(); + } + return fontPath; + } + /** * Applies font to TextView. Will fall back to the default one if not set. * @@ -158,6 +174,17 @@ static void applyFontToTextView(final Context context, final TextView textView, return; } + String style = getStyleIdentifier(textView); + + try { + Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, style)); + applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, style), deferred); + } catch (Throwable t) { + applyFontToTextView(context, textView, config, deferred); + } + } + + private static String getStyleIdentifier(TextView textView) { String style; if (textView.getTypeface() == null) { style = FONT_REGULAR; @@ -176,13 +203,7 @@ static void applyFontToTextView(final Context context, final TextView textView, style = FONT_REGULAR; } } - - try { - Typeface.createFromAsset(context.getAssets(), pullFontPathFromInherentFontPath(textViewFont, style)); - applyFontToTextView(context, textView, pullFontPathFromInherentFontPath(textViewFont, style), deferred); - } catch (Throwable t) { - applyFontToTextView(context, textView, config, deferred); - } + return style; } /**