Merge "Fix bug #8200928 ExpandableListView should be RTL-aware" into jb-mr2-dev

This commit is contained in:
Fabrice Di Meglio
2013-03-22 01:18:43 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 3 deletions

View File

@ -288,6 +288,9 @@ public class ExpandableListView extends ListView {
// Get more expandable list-related info for this item
pos = mConnector.getUnflattenedPos(childFlPos);
final boolean isLayoutRtl = isLayoutRtl();
final int width = getWidth();
// If this item type and the previous item type are different, then we need to change
// the left & right bounds
if (pos.position.type != lastItemType) {
@ -300,9 +303,18 @@ public class ExpandableListView extends ListView {
indicatorRect.left = mIndicatorLeft;
indicatorRect.right = mIndicatorRight;
}
indicatorRect.left += mPaddingLeft;
indicatorRect.right += mPaddingLeft;
if (isLayoutRtl) {
final int temp = indicatorRect.left;
indicatorRect.left = width - indicatorRect.right;
indicatorRect.right = width - temp;
indicatorRect.left -= mPaddingRight;
indicatorRect.right -= mPaddingRight;
} else {
indicatorRect.left += mPaddingLeft;
indicatorRect.right += mPaddingLeft;
}
lastItemType = pos.position.type;
}