1
0
Эх сурвалжийг харах

Since Roboto Medium is only available on API 21 and above, Roboto Bold is used below API 21 in place of the medium font (for action buttons and other elements). Resolves https://github.com/afollestad/material-dialogs/issues/537.

Aidan Follestad 10 жил өмнө
parent
commit
5ee80393ac

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

@@ -470,7 +470,10 @@ public class MaterialDialog extends DialogBase implements
 
 
             if (this.mediumFont == null) {
             if (this.mediumFont == null) {
                 try {
                 try {
-                    this.mediumFont = Typeface.create("sans-serif-medium", Typeface.NORMAL);
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+                        this.mediumFont = Typeface.create("sans-serif-medium", Typeface.NORMAL);
+                    else
+                        this.mediumFont = Typeface.create("sans-serif", Typeface.BOLD);
                 } catch (Throwable ignored) {
                 } catch (Throwable ignored) {
                 }
                 }
             }
             }
@@ -480,8 +483,6 @@ public class MaterialDialog extends DialogBase implements
                 } catch (Throwable ignored) {
                 } catch (Throwable ignored) {
                 }
                 }
             }
             }
-            if (this.mediumFont == null)
-                this.mediumFont = this.regularFont;
         }
         }
 
 
         private void checkSingleton() {
         private void checkSingleton() {