Skip to content

Commit fa1babd

Browse files
author
Fabrice Di Meglio
committed
Fix bug #7023040 android.widget.cts.TextViewTest#testResetTextAlignment failures
- cache the text aligment as we cannot resolve the text alignment during reset of the text direction Change-Id: I79de625e517bf8bad6313fd5e349f1181b1eaa30
1 parent d2a8df9 commit fa1babd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/java/android/widget/TextView.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ static class Drawables {
302302

303303
// The alignment to pass to Layout, or null if not resolved.
304304
private Layout.Alignment mLayoutAlignment;
305+
private int mResolvedTextAlignment;
305306

306307
private boolean mResolvedDrawables;
307308

@@ -5639,18 +5640,17 @@ private void assumeLayout() {
56395640
@Override
56405641
public void onResolvedLayoutDirectionReset() {
56415642
if (mLayoutAlignment != null) {
5642-
int resolvedTextAlignment = getResolvedTextAlignment();
5643-
if (resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START ||
5644-
resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) {
5643+
if (mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START ||
5644+
mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) {
56455645
mLayoutAlignment = null;
56465646
}
56475647
}
56485648
}
56495649

56505650
private Layout.Alignment getLayoutAlignment() {
56515651
if (mLayoutAlignment == null) {
5652-
int textAlign = getResolvedTextAlignment();
5653-
switch (textAlign) {
5652+
mResolvedTextAlignment = getResolvedTextAlignment();
5653+
switch (mResolvedTextAlignment) {
56545654
case TEXT_ALIGNMENT_GRAVITY:
56555655
switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
56565656
case Gravity.START:

0 commit comments

Comments
 (0)