Skip to content

Commit f2e5cf4

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug #6427629 Clean up layout direction APIs" into jb-mr1-dev
2 parents ce803d8 + 343e113 commit f2e5cf4

File tree

5 files changed

+19
-33
lines changed

5 files changed

+19
-33
lines changed

api/current.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25093,10 +25093,9 @@ package android.view {
2509325093
method protected void onLayout(boolean, int, int, int, int);
2509425094
method protected void onMeasure(int, int);
2509525095
method protected void onOverScrolled(int, int, boolean, boolean);
25096-
method public void onPaddingChanged(int);
2509725096
method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
2509825097
method protected void onRestoreInstanceState(android.os.Parcelable);
25099-
method public void onRtlPropertiesChanged();
25098+
method public void onRtlPropertiesChanged(int);
2510025099
method protected android.os.Parcelable onSaveInstanceState();
2510125100
method public void onScreenStateChanged(int);
2510225101
method protected void onScrollChanged(int, int, int, int);

core/java/android/view/View.java

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11560,7 +11560,7 @@ void resolveRtlPropertiesIfNeeded() {
1156011560
}
1156111561
requestLayout();
1156211562
invalidate(true);
11563-
onRtlPropertiesChanged();
11563+
onRtlPropertiesChanged(getLayoutDirection());
1156411564
}
1156511565

1156611566
// Reset resolution of all RTL related properties.
@@ -11622,8 +11622,13 @@ private boolean needRtlPropertiesResolution() {
1162211622
* resolved layout direction, or to inform child views that inherit their layout direction.
1162311623
*
1162411624
* The default implementation does nothing.
11625+
*
11626+
* @param layoutDirection the direction of the layout
11627+
*
11628+
* @see #LAYOUT_DIRECTION_LTR
11629+
* @see #LAYOUT_DIRECTION_RTL
1162511630
*/
11626-
public void onRtlPropertiesChanged() {
11631+
public void onRtlPropertiesChanged(int layoutDirection) {
1162711632
}
1162811633

1162911634
/**
@@ -11768,7 +11773,7 @@ public void resolvePadding() {
1176811773

1176911774
internalSetPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight,
1177011775
mUserPaddingBottom);
11771-
onPaddingChanged(resolvedLayoutDirection);
11776+
onRtlPropertiesChanged(resolvedLayoutDirection);
1177211777
}
1177311778

1177411779
mPrivateFlags2 |= PFLAG2_PADDING_RESOLVED;
@@ -11783,19 +11788,6 @@ public void resetResolvedPadding() {
1178311788
mPrivateFlags2 &= ~PFLAG2_PADDING_RESOLVED;
1178411789
}
1178511790

11786-
/**
11787-
* Resolve padding depending on the layout direction. Subclasses that care about
11788-
* padding resolution should override this method. The default implementation does
11789-
* nothing.
11790-
*
11791-
* @param layoutDirection the direction of the layout
11792-
*
11793-
* @see #LAYOUT_DIRECTION_LTR
11794-
* @see #LAYOUT_DIRECTION_RTL
11795-
*/
11796-
public void onPaddingChanged(int layoutDirection) {
11797-
}
11798-
1179911791
/**
1180011792
* This is called when the view is detached from a window. At this point it
1180111793
* no longer has a surface for drawing.
@@ -11827,7 +11819,7 @@ protected void onDetachedFromWindow() {
1182711819
mCurrentAnimation = null;
1182811820

1182911821
resetRtlProperties();
11830-
onRtlPropertiesChanged();
11822+
onRtlPropertiesChanged(LAYOUT_DIRECTION_DEFAULT);
1183111823
resetAccessibilityStateChanged();
1183211824
}
1183311825

@@ -16618,7 +16610,7 @@ public void setTextDirection(int textDirection) {
1661816610
// Do resolution
1661916611
resolveTextDirection();
1662016612
// Notify change
16621-
onRtlPropertiesChanged();
16613+
onRtlPropertiesChanged(getLayoutDirection());
1662216614
// Refresh
1662316615
requestLayout();
1662416616
invalidate(true);
@@ -16812,7 +16804,7 @@ public void setTextAlignment(int textAlignment) {
1681216804
// Do resolution
1681316805
resolveTextAlignment();
1681416806
// Notify change
16815-
onRtlPropertiesChanged();
16807+
onRtlPropertiesChanged(getLayoutDirection());
1681616808
// Refresh
1681716809
requestLayout();
1681816810
invalidate(true);

core/java/android/widget/CheckedTextView.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void setChecked(boolean checked) {
104104
/**
105105
* Set the checkmark to a given Drawable, identified by its resourece id. This will be drawn
106106
* when {@link #isChecked()} is true.
107-
*
107+
*
108108
* @param resid The Drawable to use for the checkmark.
109109
*
110110
* @see #setCheckMarkDrawable(Drawable)
@@ -147,7 +147,7 @@ public void setCheckMarkDrawable(Drawable d) {
147147
d.setVisible(getVisibility() == VISIBLE, false);
148148
d.setState(CHECKED_STATE_SET);
149149
setMinHeight(d.getIntrinsicHeight());
150-
150+
151151
mCheckMarkWidth = d.getIntrinsicWidth();
152152
d.setState(getDrawableState());
153153
} else {
@@ -184,13 +184,8 @@ protected void internalSetPadding(int left, int top, int right, int bottom) {
184184
}
185185

186186
@Override
187-
public void onPaddingChanged(int layoutDirection) {
188-
updatePadding();
189-
}
190-
191-
@Override
192-
public void onRtlPropertiesChanged() {
193-
super.onRtlPropertiesChanged();
187+
public void onRtlPropertiesChanged(int layoutDirection) {
188+
super.onRtlPropertiesChanged(layoutDirection);
194189
updatePadding();
195190
}
196191

core/java/android/widget/SearchView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,8 @@ public void onNothingSelected(AdapterView<?> parent) {
13541354
};
13551355

13561356
@Override
1357-
public void onRtlPropertiesChanged() {
1358-
mQueryTextView.setLayoutDirection(getLayoutDirection());
1357+
public void onRtlPropertiesChanged(int layoutDirection) {
1358+
mQueryTextView.setLayoutDirection(layoutDirection);
13591359
}
13601360

13611361
/**

core/java/android/widget/TextView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5635,7 +5635,7 @@ private void assumeLayout() {
56355635
}
56365636

56375637
@Override
5638-
public void onRtlPropertiesChanged() {
5638+
public void onRtlPropertiesChanged(int layoutDirection) {
56395639
if (mLayoutAlignment != null) {
56405640
if (mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START ||
56415641
mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) {

0 commit comments

Comments
 (0)