diff --git a/QKSMS/build.gradle b/QKSMS/build.gradle index f6ea2733..7bf43352 100644 --- a/QKSMS/build.gradle +++ b/QKSMS/build.gradle @@ -30,7 +30,7 @@ android { defaultConfig { versionCode 116 versionName "2.2.4" - minSdkVersion 15 + minSdkVersion 16 targetSdkVersion 22 } diff --git a/QKSMS/src/main/assets/fonts/Lato-Bold.ttf b/QKSMS/src/main/assets/fonts/Lato-Bold.ttf deleted file mode 100644 index 74343694..00000000 Binary files a/QKSMS/src/main/assets/fonts/Lato-Bold.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Lato-Hairline.ttf b/QKSMS/src/main/assets/fonts/Lato-Hairline.ttf deleted file mode 100644 index 288be295..00000000 Binary files a/QKSMS/src/main/assets/fonts/Lato-Hairline.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Lato-Light.ttf b/QKSMS/src/main/assets/fonts/Lato-Light.ttf deleted file mode 100644 index a958067a..00000000 Binary files a/QKSMS/src/main/assets/fonts/Lato-Light.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Lato-Regular.ttf b/QKSMS/src/main/assets/fonts/Lato-Regular.ttf deleted file mode 100644 index 04ea8efb..00000000 Binary files a/QKSMS/src/main/assets/fonts/Lato-Regular.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Roboto-Light.ttf b/QKSMS/src/main/assets/fonts/Roboto-Light.ttf deleted file mode 100644 index aa453407..00000000 Binary files a/QKSMS/src/main/assets/fonts/Roboto-Light.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf b/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf deleted file mode 100644 index a3c1a1f1..00000000 Binary files a/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf b/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf deleted file mode 100644 index 0e58508a..00000000 Binary files a/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf b/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf deleted file mode 100644 index 8779333b..00000000 Binary files a/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf deleted file mode 100644 index 3e06c7cd..00000000 Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf deleted file mode 100644 index d4eb1980..00000000 Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf and /dev/null differ diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf deleted file mode 100644 index b9fc49c9..00000000 Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf and /dev/null differ diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/TypefaceManager.java b/QKSMS/src/main/java/com/moez/QKSMS/common/TypefaceManager.java index 968273e9..c5490779 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/TypefaceManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/TypefaceManager.java @@ -2,6 +2,7 @@ package com.moez.QKSMS.common; import android.content.Context; import android.graphics.Typeface; +import android.os.Build; import android.util.SparseArray; /** @@ -174,56 +175,52 @@ public class TypefaceManager { private static Typeface createTypeface(Context context, int typefaceValue) throws IllegalArgumentException { switch (typefaceValue) { - case Typefaces.ROBOTO_THIN: - return Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Thin.ttf"); - - case Typefaces.ROBOTO_LIGHT: - return Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf"); - - case Typefaces.ROBOTO_REGULAR: - return Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Regular.ttf"); - - case Typefaces.ROBOTO_MEDIUM: - return Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Medium.ttf"); - - case Typefaces.ROBOTO_CONDENSED_LIGHT: - return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Light.ttf"); - - case Typefaces.ROBOTO_CONDENSED_REGULAR: - return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Regular.ttf"); - - case Typefaces.ROBOTO_CONDENSED_BOLD: - return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Bold.ttf"); - case Typefaces.LATO_THIN: - return Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Hairline.ttf"); + case Typefaces.ROBOTO_THIN: + return Typeface.create("sans-serif-thin", Typeface.NORMAL); case Typefaces.LATO_LIGHT: - return Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Light.ttf"); + case Typefaces.ROBOTO_LIGHT: + return Typeface.create("sans-serif-light", Typeface.NORMAL); case Typefaces.LATO_REGULAR: - return Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Regular.ttf"); + case Typefaces.ROBOTO_REGULAR: + return Typeface.create("sans-serif", Typeface.NORMAL); case Typefaces.LATO_MEDIUM: - return Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Bold.ttf"); + case Typefaces.ROBOTO_MEDIUM: + String name = Build.VERSION.SDK_INT >= 21 ? "sans-serif-medium" : "sans-serif"; + int style = Build.VERSION.SDK_INT >= 21 ? Typeface.NORMAL : Typeface.BOLD; + return Typeface.create(name, style); + + case Typefaces.ROBOTO_CONDENSED_LIGHT: + case Typefaces.ROBOTO_CONDENSED_REGULAR: + return Typeface.create("sans-serif-condensed", Typeface.NORMAL); + + case Typefaces.ROBOTO_CONDENSED_BOLD: + return Typeface.create("sans-serif-condensed", Typeface.BOLD); default: throw new IllegalArgumentException("Unknown `typeface` attribute value " + typefaceValue); } } + // The deprecated typefaces are no longer supported. Previously the fonts were stored as assets, but were + // removed to reduce app size. Android does not have these deprecated fonts built in, but we still need + // to keep these cases so that people with older versions of the app that did support these fonts had them + // selected won't experience a crash when they upgrade to the new version that doesn't support them public class Typefaces { public final static int ROBOTO_THIN = 0; public final static int ROBOTO_LIGHT = 2; public final static int ROBOTO_REGULAR = 4; public final static int ROBOTO_MEDIUM = 6; - public final static int ROBOTO_CONDENSED_LIGHT = 12; + @Deprecated public final static int ROBOTO_CONDENSED_LIGHT = 12; public final static int ROBOTO_CONDENSED_REGULAR = 14; public final static int ROBOTO_CONDENSED_BOLD = 16; - public final static int LATO_THIN = 22; - public final static int LATO_LIGHT = 24; - public final static int LATO_REGULAR = 26; - public final static int LATO_MEDIUM = 28; + @Deprecated public final static int LATO_THIN = 22; + @Deprecated public final static int LATO_LIGHT = 24; + @Deprecated public final static int LATO_REGULAR = 26; + @Deprecated public final static int LATO_MEDIUM = 28; } public class FontFamily {