Merge "Fix bug #8629386 FastScroller is on the wrong side when switching to Hebrew in a RTL enabled app" into jb-mr2-dev

This commit is contained in:
Fabrice Di Meglio
2013-04-16 23:15:17 +00:00
committed by Android (Google) Code Review
2 changed files with 44 additions and 5 deletions

View File

@@ -2699,6 +2699,15 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mLastTouchMode = touchMode;
}
@Override
public void onRtlPropertiesChanged(int layoutDirection) {
super.onRtlPropertiesChanged(layoutDirection);
if (mFastScroller != null) {
mFastScroller.setScrollbarPosition(getVerticalScrollbarPosition());
}
}
/**
* Creates the ContextMenuInfo returned from {@link #getContextMenuInfo()}. This
* methods knows the view, position and ID of the item that received the

View File

@@ -216,8 +216,22 @@ class FastScroller {
mHandler.removeCallbacks(mScrollFade);
break;
case STATE_EXIT:
int viewWidth = mList.getWidth();
mList.invalidate(viewWidth - mThumbW, mThumbY, viewWidth, mThumbY + mThumbH);
final int viewWidth = mList.getWidth();
final int top = mThumbY;
final int bottom = mThumbY + mThumbH;
final int left;
final int right;
switch (mList.getLayoutDirection()) {
case View.LAYOUT_DIRECTION_RTL:
left = 0;
right = mThumbW;
break;
case View.LAYOUT_DIRECTION_LTR:
default:
left = viewWidth - mThumbW;
right = viewWidth;
}
mList.invalidate(left, top, right, bottom);
break;
}
mState = state;
@@ -398,10 +412,26 @@ class FastScroller {
} else if (mState == STATE_EXIT) {
if (alpha == 0) { // Done with exit
setState(STATE_NONE);
} else if (mTrackDrawable != null) {
mList.invalidate(viewWidth - mThumbW, 0, viewWidth, mList.getHeight());
} else {
mList.invalidate(viewWidth - mThumbW, y, viewWidth, y + mThumbH);
final int left, right, top, bottom;
if (mTrackDrawable != null) {
top = 0;
bottom = mList.getHeight();
} else {
top = y;
bottom = y + mThumbH;
}
switch (mList.getLayoutDirection()) {
case View.LAYOUT_DIRECTION_RTL:
left = 0;
right = mThumbW;
break;
case View.LAYOUT_DIRECTION_LTR:
default:
left = viewWidth - mThumbW;
right = viewWidth;
}
mList.invalidate(left, top, right, bottom);
}
}
}