소스 검색

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() {