summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2013-05-04 00:48:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-05-04 00:48:12 +0000
commit8c2e3a412aaee8359a48265a101ca27e7b67301c (patch)
tree23cc679a29f875b9ed5e553607f4bcb60bc08ed1 /core/java/android
parentfaa47b526fc35be01b1bc46a78679adde87f6701 (diff)
parent09ecb255a6d37567c8ce43dcd01bfb7ed7488a5d (diff)
Merge "Optimize RTL properties resolution" into jb-mr2-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/View.java8
-rw-r--r--core/java/android/view/ViewGroup.java18
2 files changed, 17 insertions, 9 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0938bb3e88d2..c47e111ad44f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -11749,10 +11749,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Resolve all RTL related properties.
*
+ * @return true if resolution of RTL properties has been done
+ *
* @hide
*/
- public void resolveRtlPropertiesIfNeeded() {
- if (!needRtlPropertiesResolution()) return;
+ public boolean resolveRtlPropertiesIfNeeded() {
+ if (!needRtlPropertiesResolution()) return false;
// Order is important here: LayoutDirection MUST be resolved first
if (!isLayoutDirectionResolved()) {
@@ -11773,6 +11775,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
resolveDrawables();
}
onRtlPropertiesChanged(getLayoutDirection());
+ return true;
}
/**
@@ -11825,6 +11828,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* @return true if RTL properties need resolution.
+ *
*/
private boolean needRtlPropertiesResolution() {
return (mPrivateFlags2 & ALL_RTL_PROPERTIES_RESOLVED) != ALL_RTL_PROPERTIES_RESOLVED;
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index c7ce99955e5d..58c30e9d5f6e 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5453,15 +5453,19 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* @hide
*/
@Override
- public void resolveRtlPropertiesIfNeeded() {
- super.resolveRtlPropertiesIfNeeded();
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.isLayoutDirectionInherited()) {
- child.resolveRtlPropertiesIfNeeded();
+ public boolean resolveRtlPropertiesIfNeeded() {
+ final boolean result = super.resolveRtlPropertiesIfNeeded();
+ // We dont need to resolve the children RTL properties if nothing has changed for the parent
+ if (result) {
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resolveRtlPropertiesIfNeeded();
+ }
}
}
+ return result;
}
/**