diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2013-05-03 16:51:55 -0700 |
|---|---|---|
| committer | Fabrice Di Meglio <fdimeglio@google.com> | 2013-05-03 17:33:31 -0700 |
| commit | 09ecb255a6d37567c8ce43dcd01bfb7ed7488a5d (patch) | |
| tree | 8105f16cb74c10ebf9ffc2d8999e6fc4c163bc97 /core/java/android/view/ViewGroup.java | |
| parent | e648fd619abac066914c5ebd13c4f21f9859a44a (diff) | |
Optimize RTL properties resolution
- dont bother children about resolving RTL properties if the ViewGroup parent
has not done anything
Change-Id: Iedf8a337097e04e1ab0054d59fc347e06b347ea7
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 18 |
1 files changed, 11 insertions, 7 deletions
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; } /** |
