diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-09-15 09:24:48 +0800 |
---|---|---|
committer | Xiaojing Zhang <zhangx@codeaurora.org> | 2014-11-04 20:34:20 -0800 |
commit | fdfad210c5ea382e43bbe89ee7e7b1c4a2b2fc6c (patch) | |
tree | cd7d730082b380df5179e2866a79038033318daf | |
parent | 89422d5b6c903a2b0dfb13e4515f42633228e8a0 (diff) | |
download | android_packages_apps_ContactsCommon-fdfad210c5ea382e43bbe89ee7e7b1c4a2b2fc6c.tar.gz android_packages_apps_ContactsCommon-fdfad210c5ea382e43bbe89ee7e7b1c4a2b2fc6c.tar.bz2 android_packages_apps_ContactsCommon-fdfad210c5ea382e43bbe89ee7e7b1c4a2b2fc6c.zip |
ContactsCommon: Reginal requirement for RTL
Fix RTL bugs for ContactListItemView, ContactTileAdapter.
Change-Id: I9eb67cf55b3fa920959af97d397911192369cc6c
-rw-r--r-- | res/layout/search_bar_expanded.xml | 2 | ||||
-rw-r--r-- | src/com/android/contacts/common/list/ContactListItemView.java | 2 | ||||
-rw-r--r-- | src/com/android/contacts/common/list/ContactTileAdapter.java | 17 |
3 files changed, 17 insertions, 4 deletions
diff --git a/res/layout/search_bar_expanded.xml b/res/layout/search_bar_expanded.xml index 3c71b508..ff7c3227 100644 --- a/res/layout/search_bar_expanded.xml +++ b/res/layout/search_bar_expanded.xml @@ -37,7 +37,7 @@ android:layout_width="0dp" android:layout_height="@dimen/search_box_icon_size" android:layout_weight="1" - android:layout_marginLeft="@dimen/search_box_text_left_margin" + android:layout_marginStart="@dimen/search_box_text_left_margin" android:textSize="@dimen/search_text_size" android:fontFamily="@string/search_font_family" android:textColor="@color/searchbox_text_color" diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java index e5de1f46..fb007c4c 100644 --- a/src/com/android/contacts/common/list/ContactListItemView.java +++ b/src/com/android/contacts/common/list/ContactListItemView.java @@ -135,7 +135,7 @@ public class ContactListItemView extends ViewGroup final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale); switch (layoutDirection) { case View.LAYOUT_DIRECTION_RTL: - return (opposite ? PhotoPosition.LEFT : PhotoPosition.RIGHT); + return (PhotoPosition.RIGHT); case View.LAYOUT_DIRECTION_LTR: default: return (opposite ? PhotoPosition.RIGHT : PhotoPosition.LEFT); diff --git a/src/com/android/contacts/common/list/ContactTileAdapter.java b/src/com/android/contacts/common/list/ContactTileAdapter.java index 643c63f8..70bdebf2 100644 --- a/src/com/android/contacts/common/list/ContactTileAdapter.java +++ b/src/com/android/contacts/common/list/ContactTileAdapter.java @@ -54,6 +54,11 @@ public class ContactTileAdapter extends BaseAdapter { protected int mNumFrequents; /** + * Get the layout width. + */ + private int nRTLWidth = 0; + + /** * Index of the first NON starred contact in the {@link Cursor} * Only valid when {@link DisplayType#STREQUENT} is true */ @@ -561,6 +566,7 @@ public class ContactTileAdapter extends BaseAdapter { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { switch (mItemViewType) { case ViewTypes.STARRED: + nRTLWidth = right -left; onLayoutForTiles(); return; default: @@ -581,8 +587,15 @@ public class ContactTileAdapter extends BaseAdapter { // Note MeasuredWidth includes the padding. final int childWidth = child.getMeasuredWidth(); - child.layout(childLeft, 0, childLeft + childWidth, child.getMeasuredHeight()); - childLeft += childWidth; + + // Layout for RTL + if (child.isLayoutRtl()) { + child.layout(nRTLWidth -childWidth, 0, nRTLWidth, child.getMeasuredHeight()); + nRTLWidth -= childWidth; + }else{ + child.layout(childLeft, 0, childLeft + childWidth, child.getMeasuredHeight()); + childLeft += childWidth; + } } } |