Bug 1331995 - Reset text direction to locale in order to reveal text hint, r=sebastian draft
authormaliu <max@mxli.us>
Wed, 01 Mar 2017 14:04:52 +0800
changeset 490790 7d18fa187f831c68435bdbe006af065cd7a625cb
parent 490433 1bc2ad020aee2830e0a7941f10958dbec108c254
child 547374 65962f4dd9f326ee423a0e088112be3f70e33e6f
push id47224
push userbmo:max@mxli.us
push dateWed, 01 Mar 2017 09:07:30 +0000
reviewerssebastian
bugs1331995
milestone54.0a1
Bug 1331995 - Reset text direction to locale in order to reveal text hint, r=sebastian MozReview-Commit-ID: I1FIL7QDRSu
mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -240,16 +240,24 @@ public class ToolbarDisplayLayout extend
         if (flags.contains(UpdateFlags.PRIVATE_MODE)) {
             mTitle.setPrivateMode(tab.isPrivate());
         }
     }
 
     void setTitle(CharSequence title) {
         mTitle.setText(title);
 
+        if (TextUtils.isEmpty(title)) {
+            //  Reset TextDirection to Locale in order to reveal text hint in correct direction
+            mTitle.setTextDirection(TEXT_DIRECTION_LOCALE);
+        } else {
+            //  Otherwise, fall back to default first strong strategy
+            mTitle.setTextDirection(TEXT_DIRECTION_FIRST_STRONG);
+        }
+
         if (mTitleChangeListener != null) {
             mTitleChangeListener.onTitleChange(title);
         }
     }
 
     private void updateTitle(@NonNull Tab tab) {
         // Keep the title unchanged if there's no selected tab,
         // or if the tab is entering reader mode.