diff options
| -rw-r--r-- | api/current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 52 | ||||
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/CheckedTextView.java | 2 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 2 |
5 files changed, 45 insertions, 25 deletions
diff --git a/api/current.txt b/api/current.txt index 4a607cb69d71..d683da1f1500 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23344,10 +23344,12 @@ package android.view { method protected void onLayout(boolean, int, int, int, int); method protected void onMeasure(int, int); method protected void onOverScrolled(int, int, boolean, boolean); + method public void onPaddingChanged(int); method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); - method public void onResetResolvedTextDirection(); - method public void onResolvePadding(int); - method public void onResolveTextDirection(); + method public void onResolvedLayoutDirectionChanged(); + method public void onResolvedLayoutDirectionReset(); + method public void onResolvedTextDirectionChanged(); + method public void onResolvedTextDirectionReset(); method protected void onRestoreInstanceState(android.os.Parcelable); method protected android.os.Parcelable onSaveInstanceState(); method protected void onScrollChanged(int, int, int, int); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 740ea1265914..1e6bca5c11a5 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -9598,10 +9598,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // Set to resolved mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED; + onResolvedLayoutDirectionChanged(); } /** - * Force padding depending on layout direction. + * Called when layout direction has been resolved. + * + * The default implementation does nothing. + */ + public void onResolvedLayoutDirectionChanged() { + } + + /** + * Resolve padding depending on layout direction. */ public void resolvePadding() { // If the user specified the absolute padding (either with android:padding or @@ -9645,7 +9654,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom; recomputePadding(); - onResolvePadding(resolvedLayoutDirection); + onPaddingChanged(resolvedLayoutDirection); } /** @@ -9656,7 +9665,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param layoutDirection the direction of the layout * */ - public void onResolvePadding(int layoutDirection) { + public void onPaddingChanged(int layoutDirection) { } /** @@ -9674,20 +9683,29 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** - * Reset the resolved layout direction. - * - * Subclasses need to override this method to clear cached information that depends on the - * resolved layout direction, or to inform child views that inherit their layout direction. - * Overrides must also call the superclass implementation at the start of their implementation. + * Reset the resolved layout direction. Will call {@link View#onResolvedLayoutDirectionReset} + * when reset is done. */ public void resetResolvedLayoutDirection() { // Reset the current View resolution mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED; + onResolvedLayoutDirectionReset(); // Reset also the text direction resetResolvedTextDirection(); } /** + * Called during reset of resolved layout direction. + * + * Subclasses need to override this method to clear cached information that depends on the + * resolved layout direction, or to inform child views that inherit their layout direction. + * + * The default implementation does nothing. + */ + public void onResolvedLayoutDirectionReset() { + } + + /** * Check if a Locale uses an RTL script. * * @param locale Locale to check @@ -14137,8 +14155,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** - * Resolve the text direction. Will call {@link View#onResolveTextDirection()} when resolution - * is done. + * Resolve the text direction. Will call {@link View#onResolvedTextDirectionChanged} when + * resolution is done. */ public void resolveTextDirection() { if (mResolvedTextDirection != TEXT_DIRECTION_INHERIT) { @@ -14152,24 +14170,26 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } else { mResolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG; } - onResolveTextDirection(); + onResolvedTextDirectionChanged(); } /** * Called when text direction has been resolved. Subclasses that care about text direction - * resolution should override this method. The default implementation does nothing. + * resolution should override this method. + * + * The default implementation does nothing. */ - public void onResolveTextDirection() { + public void onResolvedTextDirectionChanged() { } /** * Reset resolved text direction. Text direction can be resolved with a call to - * getResolvedTextDirection(). Will call {@link View#onResetResolvedTextDirection()} when + * getResolvedTextDirection(). Will call {@link View#onResolvedTextDirectionReset} when * reset is done. */ public void resetResolvedTextDirection() { mResolvedTextDirection = TEXT_DIRECTION_INHERIT; - onResetResolvedTextDirection(); + onResolvedTextDirectionReset(); } /** @@ -14177,7 +14197,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * override this method and do a reset of the text direction of their children. The default * implementation does nothing. */ - public void onResetResolvedTextDirection() { + public void onResolvedTextDirectionReset() { } // diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 7d96a190cbc2..0c63286d9ad3 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4920,9 +4920,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override - public void resetResolvedLayoutDirection() { - super.resetResolvedLayoutDirection(); - + public void onResolvedLayoutDirectionReset() { // Take care of resetting the children resolution too final int count = getChildCount(); for (int i = 0; i < count; i++) { @@ -4934,7 +4932,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override - public void onResetResolvedTextDirection() { + public void onResolvedTextDirectionReset() { // Take care of resetting the children resolution too final int count = getChildCount(); for (int i = 0; i < count; i++) { diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index dd5332586b3d..603cea1cdef9 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -143,7 +143,7 @@ public class CheckedTextView extends TextView implements Checkable { } @Override - public void onResolvePadding(int layoutDirection) { + public void onPaddingChanged(int layoutDirection) { int newPadding = (mCheckMarkDrawable != null) ? mCheckMarkWidth + mBasePadding : mBasePadding; mNeedRequestlayout |= (mPaddingRight != newPadding); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 385c7c790ca9..56a0d1eff442 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8715,7 +8715,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @Override - public void onResolveTextDirection() { + public void onResolvedTextDirectionChanged() { if (hasPasswordTransformationMethod()) { // TODO: take care of the content direction to show the password text and dots justified // to the left or to the right |