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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java

Issue 1988553002: Android omnibox: Force paragraph direction to LTR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ApiCompatibilityUtils version of setTextDirection|Alignment. Created 4 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
index 9eb3dfa7c61c12e436eee46a6448780c575e6504..b0cf8de06c0eecb7ac96ca736e0b0d6d88bb968b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
@@ -332,9 +332,7 @@ class SuggestionView extends ViewGroup {
setSuggestedQuery(suggestionItem, false, false, false);
if ((suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_ENTITY)
|| (suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_PROFILE)) {
- showDescriptionLine(
- SpannableString.valueOf(mSuggestion.getDescription()),
- getStandardFontColor());
+ showDescriptionLine(SpannableString.valueOf(mSuggestion.getDescription()), false);
} else {
mContentsView.mTextLine2.setVisibility(INVISIBLE);
}
@@ -398,7 +396,7 @@ class SuggestionView extends ViewGroup {
Spannable str = SpannableString.valueOf(suggestion.getDisplayText());
boolean hasMatch = applyHighlightToMatchRegions(
str, suggestion.getDisplayTextClassifications());
- showDescriptionLine(str, URL_COLOR);
+ showDescriptionLine(str, true);
return hasMatch;
}
@@ -432,13 +430,23 @@ class SuggestionView extends ViewGroup {
* Sets a description line for the omnibox suggestion.
*
* @param str The description text.
+ * @param isUrl Whether this text is a URL (as opposed to a normal string).
*/
- private void showDescriptionLine(Spannable str, int textColor) {
- if (mContentsView.mTextLine2.getVisibility() != VISIBLE) {
- mContentsView.mTextLine2.setVisibility(VISIBLE);
+ private void showDescriptionLine(Spannable str, boolean isUrl) {
+ TextView textLine = mContentsView.mTextLine2;
+ if (textLine.getVisibility() != VISIBLE) {
+ textLine.setVisibility(VISIBLE);
+ }
+ textLine.setText(str, BufferType.SPANNABLE);
+
+ // Force left-to-right rendering for URLs. See UrlBar constructor for details.
+ if (isUrl) {
+ textLine.setTextColor(URL_COLOR);
+ ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
+ } else {
+ textLine.setTextColor(getStandardFontColor());
+ ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
}
- mContentsView.mTextLine2.setTextColor(textColor);
- mContentsView.mTextLine2.setText(str, BufferType.SPANNABLE);
}
/**
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698