Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1232)

Unified Diff: ui/android/java/src/org/chromium/ui/UiUtils.java

Issue 2962713002: Fix inconsistent and incorrect Roboto Medium usage (Closed)
Patch Set: Fix inconsistent and incorrect Roboto Medium usage Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/UiUtils.java
diff --git a/ui/android/java/src/org/chromium/ui/UiUtils.java b/ui/android/java/src/org/chromium/ui/UiUtils.java
index 861320dc937b182675f8b8142030c5f0f5be906f..3a55ab979b14f9f9ad497167185e9fa5d9668fcf 100644
--- a/ui/android/java/src/org/chromium/ui/UiUtils.java
+++ b/ui/android/java/src/org/chromium/ui/UiUtils.java
@@ -8,6 +8,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
+import android.graphics.Typeface;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
@@ -395,4 +396,19 @@ public class UiUtils {
if (parent == null) return;
parent.removeView(view);
}
+
+ /**
+ * Creates a {@link Typeface} that represents medium-weighted text. This function returns
+ * Roboto Medium when it is available (Lollipop and up) and Roboto Bold where it isn't.
+ *
+ * @return Typeface that can be applied to a View.
+ */
+ public static Typeface createRobotoMediumTypeface() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ // Roboto Medium, regular.
+ return Typeface.create("sans-serif-medium", Typeface.NORMAL);
+ } else {
+ return Typeface.create("sans-serif", Typeface.BOLD);
+ }
+ }
}
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698