Aidan Follestad 10 years ago
parent
commit
66bf6645cf

+ 20 - 14
README.md

@@ -24,7 +24,7 @@ Easily reference the library in your Android projects using this dependency in y
 
 ```Gradle
 dependencies {
-    compile 'com.afollestad:material-dialogs:0.7.2.8'
+    compile 'com.afollestad:material-dialogs:0.7.3.0'
 }
 ```
 
@@ -377,20 +377,14 @@ View view = dialog.getCustomView();
 
 # Typefaces
 
-By default, Material Dialogs will use the `Roboto Medium` font for the dialog title and action buttons,
-and `Roboto Regular` for content, list items, etc. This is done so using the font assets included in this library,
-so these fonts will be used even on Samsung devices that by default use weird handwriting typefaces.
-
-If you want this default behavior to be avoided, you can make a call to `disableDefaultFonts()` when
-using the `Builder`. This will result in the library not applying Roboto and Roboto Medium fonts,
-and everything will use the regular system font.
-
-If you want to explicitly use custom fonts, you can make a call to `typeface(String, String)` when
-using the `Builder`. This will pull fonts from TTF files in your project's `assets` folder. For example,
-if you had `Roboto.ttf` and `Roboto-Light.ttf` in `/src/main/assets/fonts`, you would call `typeface("Roboto", "Roboto-Light")`.
+If you want to use custom fonts, you can make a call to `typeface(String, String)` when
+using the `Builder`. This will pull fonts from files in your project's `assets/fonts` folder. For example,
+if you had `Roboto.ttf` and `Roboto-Light.ttf` in `/src/main/assets/fonts`, you would call `typeface("Roboto.ttf", "Roboto-Light.ttf")`.
 Note that no extension is used in the name. This method will also handle recycling Typefaces via the `TypefaceHelper` which
-you can use in your own project to avoid duplicate allocations. If you want to load other Typeface files that
-aren't ttf files, you can use the `typeface(Typeface, Typeface)` Builder method.
+you can use in your own project to avoid duplicate allocations.
+
+There's a global theming attribute available to automatically apply fonts to every Material Dialog in
+your app, also.
 
 ---
 
@@ -679,6 +673,18 @@ you show from an Activity which has a theme containing any of these attributes:
     -->
     <item name="md_btnstacked_gravity">end</item>
 
+    <!--
+        The name of font in assets/fonts used on titles and action buttons
+        (null uses device default). E.g. [your-project]/app/main/assets/fonts/[medium]
+    -->
+    <item name="md_medium_font">Roboto-Medium.ttf</item>
+
+    <!--
+        The name of font in assets/fonts used everywhere else, like content and list items
+        (null uses device default). E.g. [your-project]/app/main/assets/fonts/[regular]
+    -->
+    <item name="md_regular_font">Roboto-Medium.ttf</item>
+
 </style>
 ```
 

+ 2 - 2
library/build.gradle

@@ -9,7 +9,7 @@ android {
         minSdkVersion 8
         targetSdkVersion 22
         versionCode 1
-        versionName "0.7.2.8"
+        versionName "0.7.3.0"
     }
     lintOptions {
         abortOnError false
@@ -29,7 +29,7 @@ publish {
     userOrg = 'drummer-aidan'
     groupId = 'com.afollestad'
     artifactId = 'material-dialogs'
-    version = '0.7.2.8'
+    version = '0.7.3.0'
     description = 'A library for implementing Material design styled dialogs across all versions of Android.'
     website = 'https://github.com/afollestad/material-dialogs'
     issueTracker = "${website}/issues"

+ 4 - 4
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -562,20 +562,20 @@ public class MaterialDialog extends DialogBase implements
          * Sets the fonts used in the dialog, by file names. This also uses TypefaceHelper in order
          * to avoid any un-needed allocations (it recycles typefaces for you).
          *
-         * @param medium  The name of font in assets/fonts, minus the extension (null uses device default). E.g. [your-project]/app/main/assets/fonts/[medium].ttf
-         * @param regular The name of font in assets/fonts, minus the extension (null uses device default). E.g. [your-project]/app/main/assets/fonts/[regular].ttf
+         * @param medium  The name of font in assets/fonts used on titles and action buttons (null uses device default). E.g. [your-project]/app/main/assets/fonts/[medium]
+         * @param regular The name of font in assets/fonts used everywhere else, like content and list items (null uses device default). E.g. [your-project]/app/main/assets/fonts/[regular]
          * @return The Builder instance so you can chain calls to it.
          */
         public Builder typeface(String medium, String regular) {
             if (medium != null) {
                 this.mediumFont = TypefaceHelper.get(this.context, medium);
                 if (this.mediumFont == null)
-                    throw new RuntimeException("No font asset found for " + medium);
+                    throw new IllegalArgumentException("No font asset found for " + medium);
             }
             if (regular != null) {
                 this.regularFont = TypefaceHelper.get(this.context, regular);
                 if (this.regularFont == null)
-                    throw new RuntimeException("No font asset found for " + regular);
+                    throw new IllegalArgumentException("No font asset found for " + regular);
             }
             return this;
         }

+ 2 - 2
sample/build.gradle

@@ -17,8 +17,8 @@ android {
         applicationId "com.afollestad.materialdialogssample"
         minSdkVersion 9
         targetSdkVersion 22
-        versionCode 117
-        versionName "0.7.2.8"
+        versionCode 118
+        versionName "0.7.3.0"
     }
     lintOptions {
         abortOnError false

BIN
sample/sample.apk


BIN
sample/src/main/assets/fonts/GoodDog.otf