Fix for bug #8146846 Phone App should be mirrored for RTL languages
- add start/end aside left/right properties
- make default PhotoPosition depends on Locale layout direction
- add mirrored version of Drawables
- use android:textAlignment="viewStart" when needed on TextView
Change-Id: I0bf2fb83d94a3748d26d1825387b9b16830830a5
diff --git a/res/drawable-ldrtl-hdpi/badge_action_call.png b/res/drawable-ldrtl-hdpi/badge_action_call.png
new file mode 100644
index 0000000..05a77f6
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/badge_action_call.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/badge_action_sms.png b/res/drawable-ldrtl-hdpi/badge_action_sms.png
new file mode 100644
index 0000000..7c6e445
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/badge_action_sms.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_add_contact_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_add_contact_holo_dark.png
new file mode 100644
index 0000000..f08df0f
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_dark.png
new file mode 100644
index 0000000..95b4b4b
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_light.png b/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 0000000..b166a7f
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_dark.png
new file mode 100644
index 0000000..a62c569
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_light.png b/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 0000000..659d723
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_contacts_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_contacts_holo_dark.png
new file mode 100644
index 0000000..76a96be
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_menu_settings_holo_light.png b/res/drawable-ldrtl-hdpi/ic_menu_settings_holo_light.png
new file mode 100644
index 0000000..c3d86ca
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_menu_settings_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_text_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_text_holo_dark.png
new file mode 100644
index 0000000..667e961
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_text_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_text_holo_light.png b/res/drawable-ldrtl-hdpi/ic_text_holo_light.png
new file mode 100644
index 0000000..0f2e9f4
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_text_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/list_background_holo.9.png b/res/drawable-ldrtl-hdpi/list_background_holo.9.png
new file mode 100644
index 0000000..0d80482
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/list_background_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/list_focused_holo.9.png b/res/drawable-ldrtl-hdpi/list_focused_holo.9.png
new file mode 100644
index 0000000..4139942
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/list_focused_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/list_section_divider_holo_custom.9.png b/res/drawable-ldrtl-hdpi/list_section_divider_holo_custom.9.png
new file mode 100644
index 0000000..db386b4
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/list_section_divider_holo_custom.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/list_title_holo.9.png b/res/drawable-ldrtl-hdpi/list_title_holo.9.png
new file mode 100644
index 0000000..5ec4c96
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/list_title_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/badge_action_call.png b/res/drawable-ldrtl-mdpi/badge_action_call.png
new file mode 100644
index 0000000..cdbff01
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/badge_action_call.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/badge_action_sms.png b/res/drawable-ldrtl-mdpi/badge_action_sms.png
new file mode 100644
index 0000000..8ab36ba
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/badge_action_sms.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_add_contact_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_add_contact_holo_dark.png
new file mode 100644
index 0000000..ab5e9da
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_dark.png
new file mode 100644
index 0000000..01d70de
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_light.png b/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 0000000..a759f36
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_dark.png
new file mode 100644
index 0000000..644158e
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_light.png b/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 0000000..b39b768
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_contacts_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_contacts_holo_dark.png
new file mode 100644
index 0000000..5af33b8
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_menu_settings_holo_light.png b/res/drawable-ldrtl-mdpi/ic_menu_settings_holo_light.png
new file mode 100644
index 0000000..ac172b2
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_menu_settings_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_text_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_text_holo_dark.png
new file mode 100644
index 0000000..4429d02
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_text_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_text_holo_light.png b/res/drawable-ldrtl-mdpi/ic_text_holo_light.png
new file mode 100644
index 0000000..33e4ba5
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_text_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/list_background_holo.9.png b/res/drawable-ldrtl-mdpi/list_background_holo.9.png
new file mode 100644
index 0000000..d86d611
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/list_background_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/list_focused_holo.9.png b/res/drawable-ldrtl-mdpi/list_focused_holo.9.png
new file mode 100644
index 0000000..4139942
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/list_focused_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/list_section_divider_holo_custom.9.png b/res/drawable-ldrtl-mdpi/list_section_divider_holo_custom.9.png
new file mode 100644
index 0000000..9236a42
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/list_section_divider_holo_custom.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/list_title_holo.9.png b/res/drawable-ldrtl-mdpi/list_title_holo.9.png
new file mode 100644
index 0000000..013d5e7
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/list_title_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-sw580dp-hdpi/list_activated_holo.9.png b/res/drawable-ldrtl-sw580dp-hdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..947f03c
--- /dev/null
+++ b/res/drawable-ldrtl-sw580dp-hdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-sw580dp-mdpi/list_activated_holo.9.png b/res/drawable-ldrtl-sw580dp-mdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..6d09d72
--- /dev/null
+++ b/res/drawable-ldrtl-sw580dp-mdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-sw580dp-xhdpi/list_activated_holo.9.png b/res/drawable-ldrtl-sw580dp-xhdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..63c7456
--- /dev/null
+++ b/res/drawable-ldrtl-sw580dp-xhdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/badge_action_call.png b/res/drawable-ldrtl-xhdpi/badge_action_call.png
new file mode 100644
index 0000000..b8e1a9c
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/badge_action_call.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/badge_action_sms.png b/res/drawable-ldrtl-xhdpi/badge_action_sms.png
new file mode 100644
index 0000000..a8dcf8b
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/badge_action_sms.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_add_contact_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_add_contact_holo_dark.png
new file mode 100644
index 0000000..fced256
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_add_contact_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_dark.png
new file mode 100644
index 0000000..a9b1ce7
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_light.png b/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 0000000..5bc334a
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_dark.png
new file mode 100644
index 0000000..9478e7b
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_light.png b/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 0000000..9ca02f3
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_contacts_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_contacts_holo_dark.png
new file mode 100644
index 0000000..a29f989
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_contacts_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_menu_settings_holo_light.png b/res/drawable-ldrtl-xhdpi/ic_menu_settings_holo_light.png
new file mode 100644
index 0000000..2b7ebf7
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_menu_settings_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_text_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_text_holo_dark.png
new file mode 100644
index 0000000..2a28bab
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_text_holo_dark.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_text_holo_light.png b/res/drawable-ldrtl-xhdpi/ic_text_holo_light.png
new file mode 100644
index 0000000..78df192
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_text_holo_light.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/list_background_holo.9.png b/res/drawable-ldrtl-xhdpi/list_background_holo.9.png
new file mode 100644
index 0000000..f709f2c
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/list_background_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/list_focused_holo.9.png b/res/drawable-ldrtl-xhdpi/list_focused_holo.9.png
new file mode 100644
index 0000000..4139942
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/list_focused_holo.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/list_section_divider_holo_custom.9.png b/res/drawable-ldrtl-xhdpi/list_section_divider_holo_custom.9.png
new file mode 100644
index 0000000..cd7bc0d
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/list_section_divider_holo_custom.9.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/list_title_holo.9.png b/res/drawable-ldrtl-xhdpi/list_title_holo.9.png
new file mode 100644
index 0000000..cb801ac
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/list_title_holo.9.png
Binary files differ
diff --git a/res/layout/account_filter_header.xml b/res/layout/account_filter_header.xml
index 0ffb7e1..268a17e 100644
--- a/res/layout/account_filter_header.xml
+++ b/res/layout/account_filter_header.xml
@@ -26,10 +26,13 @@
android:paddingTop="@dimen/list_header_extra_top_padding"
android:layout_marginLeft="@dimen/contact_browser_list_header_left_margin"
android:layout_marginRight="@dimen/contact_browser_list_header_right_margin"
+ android:layout_marginStart="@dimen/contact_browser_list_header_left_margin"
+ android:layout_marginEnd="@dimen/contact_browser_list_header_right_margin"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone">
<TextView
android:id="@+id/account_filter_header"
style="@style/ContactListSeparatorTextViewStyle"
- android:paddingLeft="@dimen/contact_browser_list_item_text_indent" />
+ android:paddingLeft="@dimen/contact_browser_list_item_text_indent"
+ android:paddingStart="@dimen/contact_browser_list_item_text_indent" />
</LinearLayout>
diff --git a/res/layout/account_selector_list_item.xml b/res/layout/account_selector_list_item.xml
index 4cba3e9..076cc88 100644
--- a/res/layout/account_selector_list_item.xml
+++ b/res/layout/account_selector_list_item.xml
@@ -35,6 +35,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dip"
+ android:layout_marginEnd="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:singleLine="true"
android:ellipsize="end"/>
@@ -43,6 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dip"
+ android:layout_marginEnd="8dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
diff --git a/res/layout/contact_list_content.xml b/res/layout/contact_list_content.xml
index 94681d6..3a8ad7d 100644
--- a/res/layout/contact_list_content.xml
+++ b/res/layout/contact_list_content.xml
@@ -44,6 +44,8 @@
android:layout_height="match_parent"
android:layout_marginLeft="?attr/contact_browser_list_padding_left"
android:layout_marginRight="?attr/contact_browser_list_padding_right"
+ android:layout_marginStart="?attr/contact_browser_list_padding_left"
+ android:layout_marginEnd="?attr/contact_browser_list_padding_right"
android:fastScrollEnabled="true"
android:fadingEdge="none" />
<ProgressBar
diff --git a/res/layout/contact_list_filter.xml b/res/layout/contact_list_filter.xml
index f47d309..d419c7e 100644
--- a/res/layout/contact_list_filter.xml
+++ b/res/layout/contact_list_filter.xml
@@ -28,12 +28,16 @@
android:layout_height="0dip"
android:layout_weight="1"
android:layout_marginLeft="@dimen/contact_filter_left_margin"
- android:layout_marginRight="@dimen/contact_filter_right_margin" />
+ android:layout_marginRight="@dimen/contact_filter_right_margin"
+ android:layout_marginStart="@dimen/contact_filter_left_margin"
+ android:layout_marginEnd="@dimen/contact_filter_right_margin" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
+ android:layout_marginStart="16dip"
+ android:layout_marginEnd="16dip"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
diff --git a/res/layout/contact_list_filter_custom.xml b/res/layout/contact_list_filter_custom.xml
index 78318bc..b6d9229 100644
--- a/res/layout/contact_list_filter_custom.xml
+++ b/res/layout/contact_list_filter_custom.xml
@@ -27,6 +27,8 @@
android:layout_weight="1"
android:layout_marginLeft="@dimen/contact_filter_left_margin"
android:layout_marginRight="@dimen/contact_filter_right_margin"
+ android:layout_marginStart="@dimen/contact_filter_left_margin"
+ android:layout_marginEnd="@dimen/contact_filter_right_margin"
android:overScrollMode="always" />
<View
@@ -34,6 +36,8 @@
android:layout_height="1dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
+ android:layout_marginStart="16dip"
+ android:layout_marginEnd="16dip"
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
diff --git a/res/layout/contact_list_filter_item.xml b/res/layout/contact_list_filter_item.xml
index ec6a45e..09bbe55 100644
--- a/res/layout/contact_list_filter_item.xml
+++ b/res/layout/contact_list_filter_item.xml
@@ -34,7 +34,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
- android:layout_marginLeft="8dip">
+ android:layout_marginLeft="8dip"
+ android:layout_marginStart="8dip">
<TextView
android:id="@+id/accountType"
@@ -61,6 +62,6 @@
android:layout_marginTop="1dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="right|center_vertical" />
+ android:layout_gravity="end|center_vertical" />
</view>
diff --git a/res/layout/contact_tile_frequent.xml b/res/layout/contact_tile_frequent.xml
index 0355929..404b2fe 100644
--- a/res/layout/contact_tile_frequent.xml
+++ b/res/layout/contact_tile_frequent.xml
@@ -38,8 +38,10 @@
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:gravity="center_vertical"
- android:paddingEnd="80dip"
- android:paddingStart="8dip">
+ android:paddingLeft="8dip"
+ android:paddingRight="80dip"
+ android:paddingStart="8dip"
+ android:paddingEnd="80dip">
<TextView
android:id="@+id/contact_tile_name"
@@ -50,7 +52,8 @@
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
- android:ellipsize="marquee" />
+ android:ellipsize="marquee"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/contact_tile_status"
diff --git a/res/layout/contact_tile_frequent_phone.xml b/res/layout/contact_tile_frequent_phone.xml
index 3a84b5a..f87dff7 100644
--- a/res/layout/contact_tile_frequent_phone.xml
+++ b/res/layout/contact_tile_frequent_phone.xml
@@ -32,6 +32,7 @@
android:layout_width="64dip"
android:layout_height="64dip"
android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:nextFocusRight="@id/contact_tile_frequent_phone"
android:scaleType="centerCrop"
android:focusable="true" />
@@ -41,13 +42,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
+ android:layout_marginStart="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="8dip"
android:layout_toRightOf="@id/contact_tile_quick"
+ android:layout_toEndOf="@id/contact_tile_quick"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
- android:ellipsize="marquee" />
+ android:ellipsize="marquee"
+ android:textAlignment="viewStart" />
<LinearLayout
android:orientation="horizontal"
@@ -55,6 +59,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/contact_tile_name"
android:layout_toRightOf="@id/contact_tile_quick"
+ android:layout_toEndOf="@id/contact_tile_quick"
android:gravity="center_vertical">
<TextView
@@ -66,8 +71,11 @@
android:ellipsize="marquee"
android:textColor="@color/dialtacts_secondary_text_color"
android:layout_marginLeft="8dip"
+ android:layout_marginStart="8dip"
android:singleLine="true"
- android:layout_gravity="bottom" />
+ android:layout_gravity="bottom"
+ android:textDirection="ltr"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/contact_tile_phone_type"
@@ -80,7 +88,8 @@
android:textAllCaps="true"
android:textColor="@color/dialtacts_secondary_text_color"
android:layout_marginLeft="8dip"
- android:gravity="right"
+ android:layout_marginStart="8dip"
+ android:gravity="end"
android:layout_gravity="bottom" />
</LinearLayout>
diff --git a/res/layout/contact_tile_phone_starred.xml b/res/layout/contact_tile_phone_starred.xml
index 9959c82..e1e4970 100644
--- a/res/layout/contact_tile_phone_starred.xml
+++ b/res/layout/contact_tile_phone_starred.xml
@@ -18,6 +18,7 @@
android:background="@null"
android:paddingBottom="1dip"
android:paddingRight="1dip"
+ android:paddingEnd="1dip"
class="com.android.contacts.common.list.ContactTilePhoneStarredView" >
<RelativeLayout
@@ -45,7 +46,11 @@
android:layout_alignParentBottom="true"
android:paddingLeft="8dip"
android:paddingRight="47dip"
- android:drawableRight="@drawable/ic_divider_dashed_holo_dark" />
+ android:paddingStart="8dip"
+ android:paddingEnd="47dip"
+ android:drawableRight="@drawable/ic_divider_dashed_holo_dark"
+ android:drawableEnd="@drawable/ic_divider_dashed_holo_dark"
+ android:textAlignment="viewStart" />
<View
android:id="@+id/contact_tile_push_state"
@@ -61,10 +66,13 @@
android:background="?android:attr/selectableItemBackground"
android:layout_height="@dimen/contact_tile_shadowbox_height"
android:layout_width="48dip"
- android:paddingRight="8dip"
android:paddingLeft="8dip"
+ android:paddingRight="8dip"
+ android:paddingStart="8dip"
+ android:paddingEnd="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
android:contentDescription="@string/description_view_contact_detail" />
</RelativeLayout>
diff --git a/res/layout/contact_tile_starred.xml b/res/layout/contact_tile_starred.xml
index 06852a6..e363747 100644
--- a/res/layout/contact_tile_starred.xml
+++ b/res/layout/contact_tile_starred.xml
@@ -18,6 +18,7 @@
android:background="@null"
android:paddingBottom="1dip"
android:paddingRight="1dip"
+ android:paddingEnd="1dip"
class="com.android.contacts.common.list.ContactTileStarredView" >
<RelativeLayout
@@ -38,8 +39,10 @@
android:background="@color/contact_tile_shadow_box_color"
android:layout_alignParentBottom="true"
android:gravity="center_vertical"
+ android:paddingLeft="8dip"
android:paddingRight="8dip"
- android:paddingLeft="8dip">
+ android:paddingStart="8dip"
+ android:paddingEnd="8dip">
<TextView
android:id="@+id/contact_tile_name"
@@ -50,7 +53,8 @@
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
- android:ellipsize="marquee" />
+ android:ellipsize="marquee"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/contact_tile_status"
diff --git a/res/layout/contact_tile_starred_quick_contact.xml b/res/layout/contact_tile_starred_quick_contact.xml
index 87a6e65..ecbe583 100644
--- a/res/layout/contact_tile_starred_quick_contact.xml
+++ b/res/layout/contact_tile_starred_quick_contact.xml
@@ -17,6 +17,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingBottom="1dip"
android:paddingRight="1dip"
+ android:paddingEnd="1dip"
android:background="@null"
class="com.android.contacts.common.list.ContactTileStarredView" >
@@ -37,8 +38,10 @@
android:background="@color/contact_tile_shadow_box_color"
android:layout_alignParentBottom="true"
android:gravity="center_vertical"
+ android:paddingLeft="8dip"
android:paddingRight="8dip"
- android:paddingLeft="8dip">
+ android:paddingStart="8dip"
+ android:paddingEnd="8dip">
<TextView
android:id="@+id/contact_tile_name"
@@ -49,7 +52,8 @@
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
- android:ellipsize="marquee" />
+ android:ellipsize="marquee"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/contact_tile_status"
diff --git a/res/layout/custom_contact_list_filter_account.xml b/res/layout/custom_contact_list_filter_account.xml
index 6b25fed..b1f3f2b 100644
--- a/res/layout/custom_contact_list_filter_account.xml
+++ b/res/layout/custom_contact_list_filter_account.xml
@@ -20,12 +20,15 @@
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
- android:paddingRight="?android:attr/scrollbarSize">
+ android:paddingRight="?android:attr/scrollbarSize"
+ android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/scrollbarSize">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
+ android:layout_marginEnd="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1"
@@ -46,6 +49,7 @@
android:layout_height="wrap_content"
android:layout_below="@android:id/text1"
android:layout_alignLeft="@android:id/text1"
+ android:layout_alignStart="@android:id/text1"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorTertiary"
diff --git a/res/layout/custom_contact_list_filter_group.xml b/res/layout/custom_contact_list_filter_group.xml
index a9de606..bd8c604 100644
--- a/res/layout/custom_contact_list_filter_group.xml
+++ b/res/layout/custom_contact_list_filter_group.xml
@@ -21,12 +21,15 @@
android:gravity="center_vertical"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:paddingRight="?android:attr/scrollbarSize"
+ android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/scrollbarSize"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
+ android:layout_marginEnd="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1"
@@ -49,6 +52,7 @@
android:layout_height="wrap_content"
android:layout_below="@android:id/text1"
android:layout_alignLeft="@android:id/text1"
+ android:layout_alignStart="@android:id/text1"
android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:duplicateParentState="true"
@@ -61,6 +65,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
+ android:layout_marginEnd="4dip"
android:focusable="false"
android:clickable="false"
android:gravity="center_vertical"
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
index fcd255e..51b9d05 100644
--- a/res/layout/directory_header.xml
+++ b/res/layout/directory_header.xml
@@ -21,6 +21,8 @@
android:id="@+id/directory_header"
android:paddingLeft="?attr/list_item_padding_left"
android:paddingRight="?attr/list_item_padding_right"
+ android:paddingStart="?attr/list_item_padding_left"
+ android:paddingEnd="?attr/list_item_padding_right"
android:minHeight="@dimen/list_section_divider_min_height"
android:layout_marginTop="@dimen/list_header_extra_top_padding"
android:layout_width="match_parent"
@@ -37,29 +39,34 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
+ android:layout_marginStart="8dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/people_app_theme_color"
android:singleLine="true"
android:textStyle="bold"
- android:textAllCaps="true" />
+ android:textAllCaps="true"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
+ android:layout_marginStart="8dip"
+ android:layout_marginEnd="8dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/people_app_theme_color"
android:singleLine="true"
android:textStyle="bold"
- android:textAllCaps="true" />
+ android:textAllCaps="true"
+ android:textAlignment="viewStart" />
<TextView
android:id="@+id/count"
android:paddingTop="1dip"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:gravity="right"
+ android:gravity="end"
android:singleLine="true"
android:textSize="12sp"
android:textColor="@color/contact_count_text_color" />
diff --git a/res/layout/list_separator.xml b/res/layout/list_separator.xml
index d94e18c..4553d48 100644
--- a/res/layout/list_separator.xml
+++ b/res/layout/list_separator.xml
@@ -20,10 +20,14 @@
android:layout_height="wrap_content"
android:paddingLeft="16dip"
android:paddingRight="16dip"
+ android:paddingStart="16dip"
+ android:paddingEnd="16dip"
android:focusable="false">
<TextView
android:id="@+id/title"
style="@style/ContactListSeparatorTextViewStyle"
android:paddingLeft="8dip"
- android:paddingRight="8dip" />
+ android:paddingRight="8dip"
+ android:paddingStart="8dip"
+ android:paddingEnd="8dip" />
</FrameLayout>
diff --git a/res/layout/select_dialog_item.xml b/res/layout/select_dialog_item.xml
index d49ae10..de495f6 100644
--- a/res/layout/select_dialog_item.xml
+++ b/res/layout/select_dialog_item.xml
@@ -29,5 +29,7 @@
android:gravity="center_vertical"
android:paddingLeft="14dip"
android:paddingRight="15dip"
+ android:paddingStart="14dip"
+ android:paddingEnd="15dip"
android:ellipsize="marquee"
/>
diff --git a/res/values/ids.xml b/res/values/ids.xml
index 058020d..9a73195 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -34,4 +34,10 @@
<item type="id" name="dialog_export_confirmation"/>
<item type="id" name="dialog_exporting_vcard"/>
<item type="id" name="dialog_fail_to_export_with_reason"/>
+
+ <!-- For Debug Purpose -->
+ <item type="id" name="cliv_name_textview"/>
+ <item type="id" name="cliv_phoneticname_textview"/>
+ <item type="id" name="cliv_label_textview"/>
+ <item type="id" name="cliv_data_view"/>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 77831b2..f47940b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -36,6 +36,7 @@
<item name="android:textColor">@color/people_app_theme_color</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingLeft">8dip</item>
+ <item name="android:paddingStart">8dip</item>
<item name="android:ellipsize">end</item>
<item name="android:singleLine">true</item>
<item name="android:textAllCaps">true</item>
diff --git a/src/com/android/contacts/common/list/ContactEntryListFragment.java b/src/com/android/contacts/common/list/ContactEntryListFragment.java
index a6692b8..a8066b8 100644
--- a/src/com/android/contacts/common/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/common/list/ContactEntryListFragment.java
@@ -49,6 +49,8 @@
import com.android.contacts.common.R;
import com.android.contacts.common.preference.ContactsPreferences;
+import java.util.Locale;
+
/**
* Common base class for various contact-related list fragments.
*/
@@ -93,7 +95,7 @@
private boolean mIncludeProfile;
private boolean mSearchMode;
private boolean mVisibleScrollbarEnabled;
- private int mVerticalScrollbarPosition = View.SCROLLBAR_POSITION_RIGHT;
+ private int mVerticalScrollbarPosition = getDefaultVerticalScrollbarPosition();
private String mQueryString;
private int mDirectorySearchMode = DirectoryListLoader.SEARCH_MODE_NONE;
private boolean mSelectionVisible;
@@ -147,6 +149,7 @@
}
}
};
+ private int defaultVerticalScrollbarPosition;
protected abstract View inflateView(LayoutInflater inflater, ViewGroup container);
protected abstract T createListAdapter();
@@ -852,4 +855,16 @@
reloadData();
}
};
+
+ private int getDefaultVerticalScrollbarPosition() {
+ final Locale locale = Locale.getDefault();
+ final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale);
+ switch (layoutDirection) {
+ case View.LAYOUT_DIRECTION_RTL:
+ return View.SCROLLBAR_POSITION_LEFT;
+ case View.LAYOUT_DIRECTION_LTR:
+ default:
+ return View.SCROLLBAR_POSITION_RIGHT;
+ }
+ }
}
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index 67d8030..c65a766 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -53,6 +53,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -111,13 +112,27 @@
/**
* Where to put contact photo. This affects the other Views' layout or look-and-feel.
+ *
+ * TODO: replace enum with int constants
*/
public enum PhotoPosition {
LEFT,
RIGHT
}
- public static final PhotoPosition DEFAULT_PHOTO_POSITION = PhotoPosition.RIGHT;
- private PhotoPosition mPhotoPosition = DEFAULT_PHOTO_POSITION;
+
+ static public final PhotoPosition getDefaultPhotoPosition(boolean opposite) {
+ final Locale locale = Locale.getDefault();
+ final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale);
+ switch (layoutDirection) {
+ case View.LAYOUT_DIRECTION_RTL:
+ return (opposite ? PhotoPosition.RIGHT : PhotoPosition.LEFT);
+ case View.LAYOUT_DIRECTION_LTR:
+ default:
+ return (opposite ? PhotoPosition.LEFT : PhotoPosition.RIGHT);
+ }
+ }
+
+ private PhotoPosition mPhotoPosition = getDefaultPhotoPosition(false /* normal/non opposite */);
// Header layout data
private boolean mHeaderVisible;
@@ -259,7 +274,7 @@
R.styleable.ContactListItemView_list_item_label_width_weight,
mLabelViewWidthWeight);
- setPadding(
+ setPaddingRelative(
a.getDimensionPixelOffset(
R.styleable.ContactListItemView_list_item_padding_left, 0),
a.getDimensionPixelOffset(
@@ -436,12 +451,14 @@
// Add the height of the header if visible
if (mHeaderVisible) {
+ final int headerWidth = specWidth -
+ getPaddingLeft() - getPaddingRight() - mHeaderTextIndent;
mHeaderTextView.measure(
- MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(headerWidth, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mHeaderBackgroundHeight, MeasureSpec.EXACTLY));
if (mCountView != null) {
mCountView.measure(
- MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.AT_MOST),
+ MeasureSpec.makeMeasureSpec(headerWidth, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(mHeaderBackgroundHeight, MeasureSpec.EXACTLY));
}
mHeaderBackgroundHeight = Math.max(mHeaderBackgroundHeight,
@@ -463,15 +480,13 @@
int leftBound = getPaddingLeft();
int rightBound = width - getPaddingRight();
- if (isLayoutRtl()) {
- mPhotoPosition = PhotoPosition.LEFT;
- }
+ final boolean isLayoutRtl = isLayoutRtl();
// Put the header in the top of the contact view (Text + underline view)
if (mHeaderVisible) {
- mHeaderTextView.layout(leftBound + mHeaderTextIndent,
+ mHeaderTextView.layout(isLayoutRtl ? leftBound : leftBound + mHeaderTextIndent,
0,
- rightBound,
+ isLayoutRtl ? rightBound - mHeaderTextIndent : rightBound,
mHeaderBackgroundHeight);
if (mCountView != null) {
mCountView.layout(rightBound - mCountView.getMeasuredWidth(),
@@ -529,6 +544,9 @@
rightBound,
photoTop + mPhotoViewHeight);
rightBound -= (mPhotoViewWidth + mGapBetweenImageAndText);
+ } else if (mKeepHorizontalPaddingForPhotoView) {
+ // Draw nothing but keep the padding.
+ rightBound -= (mPhotoViewWidth + mGapBetweenImageAndText);
}
// Add indent between left-most padding and texts.
@@ -551,22 +569,42 @@
}
// Presence and status
- int statusLeftBound = leftBound;
- if (isVisible(mPresenceIcon)) {
- int iconWidth = mPresenceIcon.getMeasuredWidth();
- mPresenceIcon.layout(
- leftBound,
- textTopBound,
- leftBound + iconWidth,
- textTopBound + mStatusTextViewHeight);
- statusLeftBound += (iconWidth + mPresenceIconMargin);
- }
+ if (isLayoutRtl) {
+ int statusRightBound = rightBound;
+ if (isVisible(mPresenceIcon)) {
+ int iconWidth = mPresenceIcon.getMeasuredWidth();
+ mPresenceIcon.layout(
+ rightBound - iconWidth,
+ textTopBound,
+ rightBound,
+ textTopBound + mStatusTextViewHeight);
+ statusRightBound -= (iconWidth + mPresenceIconMargin);
+ }
- if (isVisible(mStatusView)) {
- mStatusView.layout(statusLeftBound,
- textTopBound,
- rightBound,
- textTopBound + mStatusTextViewHeight);
+ if (isVisible(mStatusView)) {
+ mStatusView.layout(leftBound,
+ textTopBound,
+ statusRightBound,
+ textTopBound + mStatusTextViewHeight);
+ }
+ } else {
+ int statusLeftBound = leftBound;
+ if (isVisible(mPresenceIcon)) {
+ int iconWidth = mPresenceIcon.getMeasuredWidth();
+ mPresenceIcon.layout(
+ leftBound,
+ textTopBound,
+ leftBound + iconWidth,
+ textTopBound + mStatusTextViewHeight);
+ statusLeftBound += (iconWidth + mPresenceIconMargin);
+ }
+
+ if (isVisible(mStatusView)) {
+ mStatusView.layout(statusLeftBound,
+ textTopBound,
+ rightBound,
+ textTopBound + mStatusTextViewHeight);
+ }
}
if (isVisible(mStatusView) || isVisible(mPresenceIcon)) {
@@ -724,6 +762,7 @@
mHeaderTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mHeaderTextSize);
mHeaderTextView.setTypeface(mHeaderTextView.getTypeface(), Typeface.BOLD);
mHeaderTextView.setGravity(Gravity.CENTER_VERTICAL);
+ mHeaderTextView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
addView(mHeaderTextView);
}
if (mHeaderDivider == null) {
@@ -835,6 +874,8 @@
// setActivated() call toward this whole item view.
mNameTextView.setActivated(isActivated());
mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
+ mNameTextView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
+ mNameTextView.setId(R.id.cliv_name_textview);
addView(mNameTextView);
}
return mNameTextView;
@@ -866,6 +907,7 @@
mPhoneticNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mPhoneticNameTextView.setTypeface(mPhoneticNameTextView.getTypeface(), Typeface.BOLD);
mPhoneticNameTextView.setActivated(isActivated());
+ mPhoneticNameTextView.setId(R.id.cliv_phoneticname_textview);
addView(mPhoneticNameTextView);
}
return mPhoneticNameTextView;
@@ -898,11 +940,12 @@
if (mPhotoPosition == PhotoPosition.LEFT) {
mLabelView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mCountViewTextSize);
mLabelView.setAllCaps(true);
- mLabelView.setGravity(Gravity.RIGHT);
+ mLabelView.setGravity(Gravity.END);
} else {
mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
}
mLabelView.setActivated(isActivated());
+ mLabelView.setId(R.id.cliv_label_textview);
addView(mLabelView);
}
return mLabelView;
@@ -911,7 +954,7 @@
/**
* Adds or updates a text view for the data element.
*/
- public void setData(char[] text, int size) {
+ public void setData(char[] text, int size, int dataColumnIndex) {
if (text == null || size == 0) {
if (mDataView != null) {
mDataView.setVisibility(View.GONE);
@@ -920,6 +963,14 @@
getDataView();
setMarqueeText(mDataView, text, size);
mDataView.setVisibility(VISIBLE);
+ // Check if this is a phone number. This code works also for the legacy phone number
+ // coming from LegacyPhoneNumberListAdapter.PHONE_NUMBER_COLUMN_INDEX because they are
+ // the exact same constant value (3)
+ if (dataColumnIndex == PhoneNumberListAdapter.PhoneQuery.PHONE_NUMBER) {
+ // We have a phone number as "mDataView" so make it always LTR and VIEW_START
+ mDataView.setTextDirection(View.TEXT_DIRECTION_LTR);
+ mDataView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
+ }
}
}
@@ -954,6 +1005,7 @@
mDataView.setEllipsize(getTextEllipsis());
mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mDataView.setActivated(isActivated());
+ mDataView.setId(R.id.cliv_data_view);
addView(mDataView);
}
return mDataView;
@@ -1000,6 +1052,7 @@
mStatusView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mStatusView.setTextColor(mSecondaryTextColor);
mStatusView.setActivated(isActivated());
+ mStatusView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
addView(mStatusView);
}
return mStatusView;
@@ -1336,7 +1389,7 @@
*/
public void showData(Cursor cursor, int dataColumnIndex) {
cursor.copyStringToBuffer(dataColumnIndex, mDataBuffer);
- setData(mDataBuffer.data, mDataBuffer.sizeCopied);
+ setData(mDataBuffer.data, mDataBuffer.sizeCopied, dataColumnIndex);
}
public void setActivatedStateSupported(boolean flag) {
diff --git a/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java b/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
index 9aa9a9b..bdefd4c 100644
--- a/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
+++ b/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
@@ -87,6 +87,7 @@
mHeaderTextView.setTypeface(mHeaderTextView.getTypeface(), Typeface.BOLD);
mHeaderTextView.setGravity(Gravity.CENTER_VERTICAL);
mHeaderTextView.setAllCaps(true);
+ mHeaderTextView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
addView(mHeaderTextView);
mHeaderDivider = new View(mContext);
mHeaderDivider.setBackgroundColor(mHeaderUnderlineColor);
@@ -115,17 +116,40 @@
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int width = right - left;
+ final int leftHeaderTextView;
+ final int rightHeaderTextView;
+ final int topTextView = 0;
+ final int bottomTextView = mHeaderBackgroundHeight;
+
+ int leftCountTextView = 0;
+ int rightCountTextView = 0;
+
+ if (isLayoutRtl()) {
+ rightHeaderTextView = width - mPaddingRight - mHeaderTextIndent;
+ leftHeaderTextView = rightHeaderTextView - mHeaderTextView.getMeasuredWidth();
+
+ leftCountTextView = mHeaderTextIndent + mPaddingLeft;
+ rightCountTextView = mCountTextView.getMeasuredWidth() + leftCountTextView;
+ } else {
+ leftHeaderTextView = mHeaderTextIndent + mPaddingLeft;
+ rightHeaderTextView = mHeaderTextView.getMeasuredWidth() + leftHeaderTextView;
+
+ // Order of statements matters
+ rightCountTextView = width - mPaddingRight;
+ leftCountTextView = rightCountTextView - mCountTextView.getMeasuredWidth();
+ }
+
// Take into account left and right padding when laying out the below views.
- mHeaderTextView.layout(mHeaderTextIndent + mPaddingLeft,
- 0,
- mHeaderTextView.getMeasuredWidth() + mHeaderTextIndent + mPaddingLeft,
- mHeaderBackgroundHeight);
+ mHeaderTextView.layout(leftHeaderTextView,
+ topTextView,
+ rightHeaderTextView,
+ bottomTextView);
if (isViewMeasurable(mCountTextView)) {
- mCountTextView.layout(width - mPaddingRight - mCountTextView.getMeasuredWidth(),
- 0,
- width - mPaddingRight,
- mHeaderBackgroundHeight);
+ mCountTextView.layout(leftCountTextView,
+ topTextView,
+ rightCountTextView,
+ bottomTextView);
}
mHeaderDivider.layout(mPaddingLeft,
diff --git a/src/com/android/contacts/common/list/ContactTileAdapter.java b/src/com/android/contacts/common/list/ContactTileAdapter.java
index 16dd604..557ebff 100644
--- a/src/com/android/contacts/common/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/common/list/ContactTileAdapter.java
@@ -556,7 +556,7 @@
case ViewTypes.STARRED_PHONE:
case ViewTypes.STARRED:
// Setting divider visibilities
- contactTile.setPadding(0, 0,
+ contactTile.setPaddingRelative(0, 0,
childIndex >= mColumnCount - 1 ? 0 : mPaddingInPixels,
isLastRow ? 0 : mPaddingInPixels);
break;
diff --git a/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
index ec0eee9..4f99e62 100644
--- a/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
+++ b/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
@@ -62,7 +62,7 @@
private boolean mUseCallableUri;
private ContactListItemView.PhotoPosition mPhotoPosition =
- ContactListItemView.DEFAULT_PHOTO_POSITION;
+ ContactListItemView.getDefaultPhotoPosition(false /* normal/non opposite */);
private class FilterHeaderClickListener implements OnClickListener {
@Override
diff --git a/src/com/android/contacts/common/list/PinnedHeaderListView.java b/src/com/android/contacts/common/list/PinnedHeaderListView.java
index d006f4b..3f207a5 100644
--- a/src/com/android/contacts/common/list/PinnedHeaderListView.java
+++ b/src/com/android/contacts/common/list/PinnedHeaderListView.java
@@ -103,7 +103,7 @@
private int mAnimationDuration = DEFAULT_ANIMATION_DURATION;
private boolean mAnimating;
private long mAnimationTargetTime;
- private int mHeaderPaddingLeft;
+ private int mHeaderPaddingStart;
private int mHeaderWidth;
public PinnedHeaderListView(Context context) {
@@ -123,8 +123,8 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
- mHeaderPaddingLeft = getPaddingLeft();
- mHeaderWidth = r - l - mHeaderPaddingLeft - getPaddingRight();
+ mHeaderPaddingStart = getPaddingStart();
+ mHeaderWidth = r - l - mHeaderPaddingStart - getPaddingEnd();
}
public void setPinnedHeaderAnimationDuration(int duration) {
@@ -170,6 +170,7 @@
mHeaders[i] = new PinnedHeader();
}
mHeaders[i].view = mAdapter.getPinnedHeaderView(i, mHeaders[i].view, this);
+ mHeaders[i].view.setLayoutDirection(getLayoutDirection());
}
mAnimationTargetTime = System.currentTimeMillis() + mAnimationDuration;
@@ -511,7 +512,9 @@
if (header.visible) {
View view = header.view;
int saveCount = canvas.save();
- canvas.translate(mHeaderPaddingLeft, header.y);
+ canvas.translate(isLayoutRtl() ?
+ getWidth() - mHeaderPaddingStart - mHeaderWidth : mHeaderPaddingStart,
+ header.y);
if (header.state == FADING) {
mBounds.set(0, 0, mHeaderWidth, view.getHeight());
canvas.saveLayerAlpha(mBounds, header.alpha, Canvas.ALL_SAVE_FLAG);