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

* commit '36fb0166a3d92cd55514126d07cabefe3f90b8f7':
  Fix bug #8200928 ExpandableListView should be RTL-aware
This commit is contained in:
Fabrice Di Meglio
2013-03-22 01:25:27 +00:00
committed by Android Git Automerger
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;
}

View File

@@ -21,4 +21,5 @@
android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
android:textAppearance="?android:attr/textAppearanceListItem"
android:gravity="center_vertical"
android:textAlignment="viewStart"
/>

View File

@@ -28,6 +28,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="6dip"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textAlignment="viewStart"
/>
<TextView android:id="@android:id/text2"
@@ -36,6 +37,7 @@
android:layout_below="@android:id/text1"
android:layout_alignStart="@android:id/text1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
/>
</TwoLineListItem>