diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-09-28 18:01:17 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-09-28 18:26:07 -0700 |
commit | 343e11345ed496003f605e1b3bba5850d3e6cf0e (patch) | |
tree | 521369a72914531c239e08049336d5ffd84b824f | |
parent | 15bbde41dafd592b8d45a7ee6003c1f0b439cb68 (diff) | |
download | frameworks_base-343e11345ed496003f605e1b3bba5850d3e6cf0e.zip frameworks_base-343e11345ed496003f605e1b3bba5850d3e6cf0e.tar.gz frameworks_base-343e11345ed496003f605e1b3bba5850d3e6cf0e.tar.bz2 |
Fix bug #6427629 Clean up layout direction APIs
- remove onPaddingChanged(int) and fold it into onRtlPropertiesChanged(int)
Change-Id: I1d7f02d2b4538c6c991bd4285501bbc73e6aa5c3
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | core/java/android/view/View.java | 30 | ||||
-rw-r--r-- | core/java/android/widget/CheckedTextView.java | 13 | ||||
-rw-r--r-- | core/java/android/widget/SearchView.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 2 |
5 files changed, 19 insertions, 33 deletions
diff --git a/api/current.txt b/api/current.txt index ab45790..8f1427c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -25093,10 +25093,9 @@ 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 protected void onRestoreInstanceState(android.os.Parcelable); - method public void onRtlPropertiesChanged(); + method public void onRtlPropertiesChanged(int); method protected android.os.Parcelable onSaveInstanceState(); method public void onScreenStateChanged(int); 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 f9ff865..f8ebd61 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -11560,7 +11560,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } requestLayout(); invalidate(true); - onRtlPropertiesChanged(); + onRtlPropertiesChanged(getLayoutDirection()); } // Reset resolution of all RTL related properties. @@ -11622,8 +11622,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * resolved layout direction, or to inform child views that inherit their layout direction. * * The default implementation does nothing. + * + * @param layoutDirection the direction of the layout + * + * @see #LAYOUT_DIRECTION_LTR + * @see #LAYOUT_DIRECTION_RTL */ - public void onRtlPropertiesChanged() { + public void onRtlPropertiesChanged(int layoutDirection) { } /** @@ -11768,7 +11773,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, internalSetPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom); - onPaddingChanged(resolvedLayoutDirection); + onRtlPropertiesChanged(resolvedLayoutDirection); } mPrivateFlags2 |= PFLAG2_PADDING_RESOLVED; @@ -11784,19 +11789,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Resolve padding depending on the layout direction. Subclasses that care about - * padding resolution should override this method. The default implementation does - * nothing. - * - * @param layoutDirection the direction of the layout - * - * @see #LAYOUT_DIRECTION_LTR - * @see #LAYOUT_DIRECTION_RTL - */ - public void onPaddingChanged(int layoutDirection) { - } - - /** * This is called when the view is detached from a window. At this point it * no longer has a surface for drawing. * @@ -11827,7 +11819,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mCurrentAnimation = null; resetRtlProperties(); - onRtlPropertiesChanged(); + onRtlPropertiesChanged(LAYOUT_DIRECTION_DEFAULT); resetAccessibilityStateChanged(); } @@ -16618,7 +16610,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // Do resolution resolveTextDirection(); // Notify change - onRtlPropertiesChanged(); + onRtlPropertiesChanged(getLayoutDirection()); // Refresh requestLayout(); invalidate(true); @@ -16812,7 +16804,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // Do resolution resolveTextAlignment(); // Notify change - onRtlPropertiesChanged(); + onRtlPropertiesChanged(getLayoutDirection()); // Refresh requestLayout(); invalidate(true); diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index cea1fd5..17c6f1d 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -104,7 +104,7 @@ public class CheckedTextView extends TextView implements Checkable { /** * Set the checkmark to a given Drawable, identified by its resourece id. This will be drawn * when {@link #isChecked()} is true. - * + * * @param resid The Drawable to use for the checkmark. * * @see #setCheckMarkDrawable(Drawable) @@ -147,7 +147,7 @@ public class CheckedTextView extends TextView implements Checkable { d.setVisible(getVisibility() == VISIBLE, false); d.setState(CHECKED_STATE_SET); setMinHeight(d.getIntrinsicHeight()); - + mCheckMarkWidth = d.getIntrinsicWidth(); d.setState(getDrawableState()); } else { @@ -184,13 +184,8 @@ public class CheckedTextView extends TextView implements Checkable { } @Override - public void onPaddingChanged(int layoutDirection) { - updatePadding(); - } - - @Override - public void onRtlPropertiesChanged() { - super.onRtlPropertiesChanged(); + public void onRtlPropertiesChanged(int layoutDirection) { + super.onRtlPropertiesChanged(layoutDirection); updatePadding(); } diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index c838973..cd8638d 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -1354,8 +1354,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { }; @Override - public void onRtlPropertiesChanged() { - mQueryTextView.setLayoutDirection(getLayoutDirection()); + public void onRtlPropertiesChanged(int layoutDirection) { + mQueryTextView.setLayoutDirection(layoutDirection); } /** diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 2937166..410a0ca 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -5635,7 +5635,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @Override - public void onRtlPropertiesChanged() { + public void onRtlPropertiesChanged(int layoutDirection) { if (mLayoutAlignment != null) { if (mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START || mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) { |