Skip to content

Commit

Permalink
fix getting the font
Browse files Browse the repository at this point in the history
  • Loading branch information
medyo committed Feb 27, 2019
1 parent a1d78a7 commit a82a08f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Icons, Borders, Radius ... for Android buttons

### Changelog

- 1.9.1
- Fix getting the font

- 1.9.0
- Add support for font resources (For text font only)
- Increase min API level to 14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Outline;
Expand All @@ -16,6 +17,7 @@
import android.support.annotation.FontRes;
import android.support.v4.content.res.ResourcesCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewOutlineProvider;
Expand Down Expand Up @@ -382,8 +384,8 @@ private Typeface getTypeface(TypedArray ta) {
if (fontId != 0) {
try {
return ResourcesCompat.getFont(getContext(), fontId);
} catch (Resources.NotFoundException exception) {
Log.d("getTypeface", exception.getMessage());
} catch (Exception exception) {
Log.e("getTypeface", exception.getMessage());
}
}
}
Expand All @@ -392,8 +394,8 @@ private Typeface getTypeface(TypedArray ta) {
if (fontId != 0)
try {
return ResourcesCompat.getFont(getContext(), fontId);
} catch (Resources.NotFoundException exception) {
Log.d("getTypeface", exception.getMessage());
} catch (Exception exception) {
Log.e("getTypeface", exception.getMessage());
}
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION_CODE=25
VERSION_CODE=26
ANDROID_BUILD_MIN_SDK_VERSION=14
ANDROID_BUILD_TARGET_SDK_VERSION=27
ANDROID_BUILD_TOOLS_VERSION=27.0.3
ANDROID_BUILD_SDK_VERSION=27
VERSION_NAME=1.9.0
VERSION_NAME=1.9.1

0 comments on commit a82a08f

Please sign in to comment.