summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fabrice Di Meglio <fdimeglio@google.com> 2011-07-01 14:39:57 -0700
committer Fabrice Di Meglio <fdimeglio@google.com> 2011-07-01 14:44:29 -0700
commit0b28c757adfec4302b144d8230c01c04ae00ca2b (patch)
tree7db1c7e1d6d2311a595e10533ad0d1fa78d307e2
parent8f5026562f26dcde43ee9d9182b309c3204dc1ad (diff)
Fix default TextView textDirection heuristic
- use "first strong" instead of "locale" - optimize "any rtl" heuristic too - fix a few wording issues too Change-Id: I239a11a49a7a6a6d45165f593c96e8b6b84f0661
-rw-r--r--core/java/android/view/ViewGroup.java7
-rw-r--r--core/java/android/widget/TextView.java1
-rwxr-xr-xcore/res/res/values/attrs.xml2
3 files changed, 5 insertions, 5 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 25ca42178417..5ebe4e5c64ed 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5030,10 +5030,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (mParent != null && mParent instanceof ViewGroup) {
resolvedTextDirection = ((ViewGroup) mParent).getResolvedTextDirection();
} else {
- // We reached the top of the View hierarchy, so get the direction from
- // the Locale
- resolvedTextDirection = isLayoutDirectionRtl(Locale.getDefault()) ?
- TEXT_DIRECTION_RTL : TEXT_DIRECTION_LTR;
+ // We reached the top of the View hierarchy, so set the text direction
+ // heuristic to "first strong"
+ resolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG;
}
break;
// Pass down the hierarchy the following text direction values
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 04b79c5ef8e6..f6b71f8b9415 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -10112,6 +10112,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
foundStrongLtr = true;
} else if (isStrongRtlChar(dir)) {
foundStrongRtl = true;
+ break;
}
}
if (foundStrongRtl) {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 65f58421c9b3..4ff8fafdfccd 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1978,7 +1978,7 @@
<!-- Default -->
<enum name="inherit" value="0" />
<!-- Default for the root view. The first strong directional character determines the
- paragraph direction. If there is o strong directional character, the paragraph
+ paragraph direction. If there is no strong directional character, the paragraph
direction is the view’s resolved layout direction. -->
<enum name="firstStrong" value="1" />
<!-- The paragraph direction is RTL if it contains any strong RTL character, otherwise