Преглед на файлове

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 години
родител
ревизия
5ee80393ac
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

+ 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) {
                 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) {
                 }
             }
@@ -480,8 +483,6 @@ public class MaterialDialog extends DialogBase implements
                 } catch (Throwable ignored) {
                 }
             }
-            if (this.mediumFont == null)
-                this.mediumFont = this.regularFont;
         }
 
         private void checkSingleton() {