mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1331995 - Reset text direction to locale in order to reveal text hint, r=sebastian
MozReview-Commit-ID: I1FIL7QDRSu --HG-- extra : rebase_source : 7c11f50a6fe58f2752ef2409bcbf33bfdf8b3258
This commit is contained in:
parent
b3ec4f5121
commit
e04fbca0dc
@ -26,6 +26,7 @@ import org.mozilla.gecko.toolbar.BrowserToolbarTabletBase.ForwardButtonAnimation
|
||||
import org.mozilla.gecko.Experiments;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
import org.mozilla.gecko.util.ViewUtil;
|
||||
import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
|
||||
import org.mozilla.gecko.widget.themed.ThemedTextView;
|
||||
|
||||
@ -245,6 +246,14 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout {
|
||||
void setTitle(CharSequence title) {
|
||||
mTitle.setText(title);
|
||||
|
||||
if (TextUtils.isEmpty(title)) {
|
||||
// Reset TextDirection to Locale in order to reveal text hint in correct direction
|
||||
ViewUtil.setTextDirection(mTitle, TEXT_DIRECTION_LOCALE);
|
||||
} else {
|
||||
// Otherwise, fall back to default first strong strategy
|
||||
ViewUtil.setTextDirection(mTitle, TEXT_DIRECTION_FIRST_STRONG);
|
||||
}
|
||||
|
||||
if (mTitleChangeListener != null) {
|
||||
mTitleChangeListener.onTitleChange(title);
|
||||
}
|
||||
|
@ -165,7 +165,18 @@ public class ViewUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* RTL compatibility wrapper to force set TextDirection for JB mr1 and above
|
||||
* RTL compatibility wrapper to set TextDirection
|
||||
* @param textView
|
||||
* @param textDirection
|
||||
*/
|
||||
public static void setTextDirection(TextView textView, int textDirection) {
|
||||
if(AppConstants.Versions.feature17Plus) {
|
||||
textView.setTextDirection(textDirection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RTL compatibility wrapper to force set TextDirection as RTL for JB mr1 and above
|
||||
*
|
||||
* @param textView
|
||||
* @param isRtl
|
||||
|
Loading…
Reference in New Issue
Block a user