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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java

Issue 2626333002: (Android) make ContextMenu for links / images more clear and organized (Closed)
Patch Set: Created 3 years, 11 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
Index: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java
index 2cef7608b9aa226d8f5133ffae0d963dae3112f0..3205da00f677aec47e4e230489fc4d069adcdf44 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java
@@ -5,6 +5,9 @@
package org.chromium.chrome.browser.contextmenu;
import android.content.Context;
+import android.os.Build;
+import android.text.Html;
+import android.text.Spanned;
import android.text.TextUtils;
import android.widget.ScrollView;
import android.widget.TextView;
@@ -40,13 +43,21 @@ public class ContextMenuTitleView extends ScrollView {
sb.append(ELLIPSIS);
title = sb.toString();
}
- titleView.setText(title);
+ titleView.setText(convertFromHtml(title));
titleView.setTextColor(ApiCompatibilityUtils.getColor(getResources(),
R.color.default_text_color));
- titleView.setPadding(0, 0, 0, padding);
addView(titleView);
}
+ @SuppressWarnings("deprecation")
+ private Spanned convertFromHtml(String txt) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ return Html.fromHtml(txt, Html.FROM_HTML_MODE_LEGACY);
+ } else {
+ return Html.fromHtml(txt);
+ }
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int maxHeight = (int) (MAX_HEIGHT_DP * mDpToPx);

Powered by Google App Engine
This is Rietveld 408576698