summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheng Fu <zhengfu@google.com>2014-08-26 14:26:58 -0700
committerZheng Fu <zhengfu@google.com>2014-08-27 16:46:19 -0700
commit0300386156602aa5c93ca5abd8c7c0e20eb5ee9b (patch)
tree404ae07ce8f55c9c411169c871bbd7e1a6b2e844
parent4fdb649778cf79d84ae9d59ce05c52de802337eb (diff)
downloadandroid_packages_apps_Contacts-0300386156602aa5c93ca5abd8c7c0e20eb5ee9b.tar.gz
android_packages_apps_Contacts-0300386156602aa5c93ca5abd8c7c0e20eb5ee9b.tar.bz2
android_packages_apps_Contacts-0300386156602aa5c93ca5abd8c7c0e20eb5ee9b.zip
Add padding to join contact list view
Several changes are involved: 1. Add padding to all the contact list views of ContactSelectionActivity so they can be contained in a centered card in sw600dp-land and sw720dp mode. 2. Make the tab indicator thicker on tablets. 3. Make tab text size, frequently contacted title text size, list item text size and list item line space bigger on tablet. Bug:16553819 Bug:17132856 Bug:17157006 Change-Id: I5f5a53e33f8ea090573edb1c7f23ebac7260190d
-rw-r--r--res/layout-sw600dp/contact_list_content.xml76
-rw-r--r--res/layout-sw600dp/contact_tile_list.xml64
-rw-r--r--res/layout-sw600dp/contacts_unavailable_fragment.xml49
-rw-r--r--res/layout/contact_picker_content.xml2
-rw-r--r--res/layout/contact_tile_list.xml5
-rw-r--r--res/layout/contacts_unavailable_fragment.xml21
-rw-r--r--res/layout/join_contact_picker_list_content.xml1
-rw-r--r--res/values-sw600dp-land/bools.xml20
-rw-r--r--res/values-sw600dp-land/integers.xml8
-rw-r--r--res/values-sw600dp/bools.xml20
-rw-r--r--res/values-sw600dp/dimens.xml11
-rw-r--r--res/values-sw600dp/integers.xml8
-rw-r--r--res/values-sw720dp-land/dimens.xml3
-rw-r--r--res/values-sw720dp-land/integers.xml2
-rw-r--r--res/values-sw720dp/dimens.xml2
-rw-r--r--res/values-sw720dp/integers.xml9
-rw-r--r--res/values/colors.xml6
-rw-r--r--res/values/dimens.xml1
-rw-r--r--src/com/android/contacts/list/ContactTileListFragment.java50
-rw-r--r--src/com/android/contacts/list/DefaultContactBrowseListFragment.java28
20 files changed, 79 insertions, 307 deletions
diff --git a/res/layout-sw600dp/contact_list_content.xml b/res/layout-sw600dp/contact_list_content.xml
deleted file mode 100644
index 1b52068a3..000000000
--- a/res/layout-sw600dp/contact_list_content.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/pinned_header_list_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:background="@color/contact_all_list_background_color"
- android:layout_weight="@integer/people_activity_list_view_layout_weight"
- android:elevation="@dimen/people_activity_card_elevation"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- </LinearLayout>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <!-- Shown only when an Account filter is set.
- - paddingTop should be here to show "shade" effect correctly. -->
- <include
- android:id="@+id/account_filter_header_container"
- layout="@layout/account_filter_header" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" >
- <view
- class="com.android.contacts.common.list.PinnedHeaderListView"
- android:id="@android:id/list"
- android:layout_width="match_parent"
- 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
- android:id="@+id/search_progress"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:visibility="gone" />
- </FrameLayout>
- </LinearLayout>
-</FrameLayout>
diff --git a/res/layout-sw600dp/contact_tile_list.xml b/res/layout-sw600dp/contact_tile_list.xml
deleted file mode 100644
index 102a58d2f..000000000
--- a/res/layout-sw600dp/contact_tile_list.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="?attr/favorites_padding_bottom">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:background="@color/contact_favorites_list_background_color"
- android:layout_weight="@integer/people_activity_list_view_layout_weight"
- android:elevation="@dimen/people_activity_card_elevation"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- </LinearLayout>
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ListView
- android:id="@+id/contact_tile_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="@dimen/contact_tile_list_padding_top"
- android:clipToPadding="false"
- android:fadingEdge="none"
- android:divider="@null"
- android:scrollbarStyle="outsideOverlay"/>
- <TextView
- android:id="@+id/contact_tile_list_empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal"
- android:layout_marginTop="@dimen/empty_message_top_margin"
- android:textColor="?android:attr/textColorSecondary"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
- </FrameLayout>
-</FrameLayout>
diff --git a/res/layout-sw600dp/contacts_unavailable_fragment.xml b/res/layout-sw600dp/contacts_unavailable_fragment.xml
deleted file mode 100644
index 8727359e5..000000000
--- a/res/layout-sw600dp/contacts_unavailable_fragment.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="?attr/favorites_padding_bottom">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:background="@color/contact_favorites_list_background_color"
- android:layout_weight="@integer/people_activity_list_view_layout_weight"
- android:elevation="@dimen/people_activity_card_elevation"/>
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/people_activity_space_layout_weight"
- android:background="@color/background_primary"/>
- </LinearLayout>
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
- <include layout="@layout/contacts_unavailable_fragment_content"/>
- </ScrollView>
-</FrameLayout>
diff --git a/res/layout/contact_picker_content.xml b/res/layout/contact_picker_content.xml
index 0d92b3f09..c71314e5d 100644
--- a/res/layout/contact_picker_content.xml
+++ b/res/layout/contact_picker_content.xml
@@ -18,6 +18,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <include layout="@layout/contact_list_card"/>
+
<view
class="com.android.contacts.common.list.PinnedHeaderListView"
android:id="@android:id/list"
diff --git a/res/layout/contact_tile_list.xml b/res/layout/contact_tile_list.xml
index 1b5ec9d86..e941617a8 100644
--- a/res/layout/contact_tile_list.xml
+++ b/res/layout/contact_tile_list.xml
@@ -21,6 +21,8 @@
android:paddingBottom="?attr/favorites_padding_bottom"
android:background="@color/background_primary">
+ <include layout="@layout/contact_list_card"/>
+
<ListView
android:id="@+id/contact_tile_list"
android:layout_width="match_parent"
@@ -28,7 +30,8 @@
android:paddingTop="@dimen/contact_tile_list_padding_top"
android:clipToPadding="false"
android:fadingEdge="none"
- android:divider="@null" />
+ android:divider="@null"
+ android:scrollbarStyle="outsideOverlay"/>
<TextView
android:id="@+id/contact_tile_list_empty"
diff --git a/res/layout/contacts_unavailable_fragment.xml b/res/layout/contacts_unavailable_fragment.xml
index 239693c60..300921f77 100644
--- a/res/layout/contacts_unavailable_fragment.xml
+++ b/res/layout/contacts_unavailable_fragment.xml
@@ -13,11 +13,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
-<ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:fillViewport="true"
- android:background="@color/background_primary">
- <include layout="@layout/contacts_unavailable_fragment_content"/>
-</ScrollView>
+ <include layout="@layout/contact_list_card"/>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:background="@color/background_primary">
+ <include layout="@layout/contacts_unavailable_fragment_content"/>
+ </ScrollView>
+</FrameLayout>
diff --git a/res/layout/join_contact_picker_list_content.xml b/res/layout/join_contact_picker_list_content.xml
index a051c6009..5bde8956a 100644
--- a/res/layout/join_contact_picker_list_content.xml
+++ b/res/layout/join_contact_picker_list_content.xml
@@ -40,6 +40,7 @@
android:id="@+id/pinned_header_list_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <include layout="@layout/contact_list_card"/>
<view
class="com.android.contacts.common.list.PinnedHeaderListView"
android:id="@android:id/list"
diff --git a/res/values-sw600dp-land/bools.xml b/res/values-sw600dp-land/bools.xml
deleted file mode 100644
index 2ef703c0b..000000000
--- a/res/values-sw600dp-land/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources>
-
- <bool name="contact_all_list_show_card_frame">true</bool>
-
-</resources>
diff --git a/res/values-sw600dp-land/integers.xml b/res/values-sw600dp-land/integers.xml
index 4bf44c030..08aab2da9 100644
--- a/res/values-sw600dp-land/integers.xml
+++ b/res/values-sw600dp-land/integers.xml
@@ -15,14 +15,14 @@
-->
<resources>
<!-- Determines the number of columns in a ContactTileRow in the favorites tab -->
- <integer name="contact_tile_column_count_in_favorites">4</integer>
+ <integer name="contact_tile_column_count_in_favorites">5</integer>
<integer name="contact_tile_column_count">3</integer>
<!-- Layout weight of space elements in PeopleActivity for favorites list and all
- contacts list-->
- <integer name="people_activity_space_layout_weight">1</integer>
+ contacts list-->
+ <integer name="contact_list_space_layout_weight">1</integer>
<!-- Layout weight of ListViews in PeopleActivityfor tile favorites list and all
contacts list in PeopleActivity -->
- <integer name="people_activity_list_view_layout_weight">3</integer>
+ <integer name="contact_list_card_layout_weight">6</integer>
</resources>
diff --git a/res/values-sw600dp/bools.xml b/res/values-sw600dp/bools.xml
deleted file mode 100644
index 2ef703c0b..000000000
--- a/res/values-sw600dp/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources>
-
- <bool name="contact_all_list_show_card_frame">true</bool>
-
-</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index e99dccf2f..a001a6309 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -25,12 +25,20 @@
<dimen name="list_section_height">37dip</dimen>
<dimen name="group_detail_border_padding">16dip</dimen>
<dimen name="search_view_width">400dip</dimen>
- <dimen name="contact_tile_list_padding_top">16dip</dimen>
+ <dimen name="contact_tile_list_padding_top">18dip</dimen>
+ <dimen name="contact_browser_list_item_text_size">18sp</dimen>
+ <dimen name="contact_browser_list_item_photo_size">50dp</dimen>
+ <dimen name="contact_browser_list_item_gap_between_image_and_text">15dp</dimen>
+ <dimen name="contact_browser_list_top_margin">18dp</dimen>
<!-- Contact list (vertical scroll bar comes left) -->
<dimen name="list_visible_scrollbar_padding">32dip</dimen>
<dimen name="list_header_extra_top_padding">@dimen/contact_browser_list_top_margin</dimen>
<dimen name="quick_contact_photo_container_height">360dip</dimen>
+ <!-- Height of the selection indicator of a tab. -->
+ <dimen name="tab_selected_underline_height">3dp</dimen>
+ <!-- Size of text in tabs. -->
+ <dimen name="tab_text_size">16sp</dimen>
<!-- Because the "join" screen has the vertical scroll bar on right,
we cannot use @dimen/contact_browser_list_header_left_margin as is. -->
@@ -50,4 +58,5 @@
<!-- Left padding of the auto complete field to line hint text up with member list -->
<dimen name="group_editor_autocomplete_left_padding">16dip</dimen>
<dimen name="contact_detail_list_top_padding">8dip</dimen>
+ <dimen name="frequently_contacted_title_text_size">24sp</dimen>
</resources>
diff --git a/res/values-sw600dp/integers.xml b/res/values-sw600dp/integers.xml
index ab2a52de9..19e2ec60a 100644
--- a/res/values-sw600dp/integers.xml
+++ b/res/values-sw600dp/integers.xml
@@ -15,10 +15,6 @@
-->
<resources>
<integer name="contact_tile_column_count">2</integer>
- <!-- Layout weight of space elements in PeopleActivity for favorites list and all
- contacts list-->
- <integer name="people_activity_space_layout_weight">1</integer>
- <!-- Layout weight of ListViews in PeopleActivityfor tile favorites list and all
- contacts list in PeopleActivity -->
- <integer name="people_activity_list_view_layout_weight">5</integer>
+ <!-- Determines the number of columns in a ContactTileRow in the favorites tab -->
+ <integer name="contact_tile_column_count_in_favorites">4</integer>
</resources>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 6a2d1ccbb..9dfb96ac2 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -20,4 +20,7 @@
<dimen name="contact_tile_list_padding_top">32dip</dimen>
<dimen name="list_visible_scrollbar_padding">48dip</dimen>
<dimen name="detail_contact_photo_size">256dip</dimen>
+ <!-- Right margin of the floating action button -->
+ <dimen name="floating_action_button_margin_right">32dp</dimen>
+ <dimen name="people_activity_landscape_tabs_text_size">16dp</dimen>
</resources>
diff --git a/res/values-sw720dp-land/integers.xml b/res/values-sw720dp-land/integers.xml
index d247e463e..2ebb10033 100644
--- a/res/values-sw720dp-land/integers.xml
+++ b/res/values-sw720dp-land/integers.xml
@@ -15,4 +15,6 @@
-->
<resources>
<integer name="contact_tile_column_count">4</integer>
+ <!-- Determines the number of columns in a ContactTileRow in the favorites tab -->
+ <integer name="contact_tile_column_count_in_favorites">5</integer>
</resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 827c71b59..1ce9a6f90 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -26,4 +26,6 @@
<dimen name="quickcontact_title_initial_margin">32dp</dimen>
<!-- Initial size of QuickContact's title size -->
<dimen name="quickcontact_maximum_title_size">64dp</dimen>
+ <!-- Right margin of the floating action button -->
+ <dimen name="floating_action_button_margin_right">100dp</dimen>
</resources>
diff --git a/res/values-sw720dp/integers.xml b/res/values-sw720dp/integers.xml
index 7c94a1432..de13e46da 100644
--- a/res/values-sw720dp/integers.xml
+++ b/res/values-sw720dp/integers.xml
@@ -15,7 +15,14 @@
-->
<resources>
<!-- Determines the number of columns in a ContactTileRow in the favorites tab -->
- <integer name="contact_tile_column_count_in_favorites">3</integer>
+ <integer name="contact_tile_column_count_in_favorites">4</integer>
<integer name="contact_tile_column_count">2</integer>
+
+ <!-- Layout weight of space elements in PeopleActivity for favorites list and all
+ contacts list-->
+ <integer name="contact_list_space_layout_weight">11</integer>
+ <!-- Layout weight of ListViews in PeopleActivityfor tile favorites list and all
+ contacts list in PeopleActivity -->
+ <integer name="contact_list_card_layout_weight">81</integer>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2a53896ed..6cd9c141a 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -19,9 +19,6 @@
<color name="quickcontact_entry_sub_header_text_color">#737373</color>
<color name="quickcontact_entry_header_text_color">#202020</color>
- <!-- Color of the background of the contact detail and editor pages -->
- <color name="background_primary">#f5f5f5</color>
-
<color name="background_social_updates">#ffeeeeee</color>
<!-- TODO: remove these colors once we delete the group code (b/16522929) -->
@@ -55,9 +52,6 @@
<color name="call_arrow_green">#2aad6f</color>
<color name="call_arrow_red">#ff2e58</color>
- <color name="contact_all_list_background_color">#FFFFFF</color>
- <color name="contact_favorites_list_background_color">#FFFFFF</color>
-
<!-- Background color of pinned header items. -->
<color name="list_item_pinned_header_color">#f5f5f5</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d422627f7..c44d89996 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -183,7 +183,6 @@
<dimen name="expanding_entry_card_item_header_only_margin_bottom">2dp</dimen>
<dimen name="expanding_entry_card_item_no_icon_margin_top">6dp</dimen>
- <dimen name="people_activity_card_elevation">2dp</dimen>
<!-- The width the that the tabs occupy in the ActionBar when in landscape mode.
426dp is the height of a "small" screen. We should leave 240dp for
the title and menu items -->
diff --git a/src/com/android/contacts/list/ContactTileListFragment.java b/src/com/android/contacts/list/ContactTileListFragment.java
index bce7bfe7a..7e4398a46 100644
--- a/src/com/android/contacts/list/ContactTileListFragment.java
+++ b/src/com/android/contacts/list/ContactTileListFragment.java
@@ -30,17 +30,16 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.widget.ListView;
import android.widget.TextView;
-
import com.android.contacts.R;
-import com.android.contacts.util.SchedulingUtils;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactTileLoaderFactory;
import com.android.contacts.common.list.ContactTileAdapter;
-import com.android.contacts.common.list.ContactTileView;
import com.android.contacts.common.list.ContactTileAdapter.DisplayType;
+import com.android.contacts.common.list.ContactTileView;
+import com.android.contacts.common.util.ContactListViewUtils;
+import com.android.contacts.common.util.SchedulingUtils;
/**
* Fragment containing a list of starred contacts followed by a list of frequently contacted.
@@ -64,7 +63,6 @@ public class ContactTileListFragment extends Fragment {
private TextView mEmptyView;
private ListView mListView;
- private boolean mContactAllListShowCardFrame;
private boolean mOptionsMenuHasFrequents;
@Override
@@ -73,7 +71,6 @@ public class ContactTileListFragment extends Fragment {
Resources res = getResources();
int columnCount = res.getInteger(R.integer.contact_tile_column_count_in_favorites);
- mContactAllListShowCardFrame = res.getBoolean(R.bool.contact_all_list_show_card_frame);
mAdapter = new ContactTileAdapter(activity, mAdapterListener,
columnCount, mDisplayType);
@@ -97,24 +94,31 @@ public class ContactTileListFragment extends Fragment {
mListView.setItemsCanFocus(true);
mListView.setAdapter(mAdapter);
- // If the device is in the sw600dp class, set a padding on the list
- // view so it appears in the center of the card in the layout.
- if (mContactAllListShowCardFrame) {
+ // Set a padding on the list view so it appears in the center of the card
+ // in the layout if required.
+ Resources resources = getResources();
+ final int listSpaceWeight = resources.getInteger(
+ R.integer.contact_list_space_layout_weight);
+ final int listViewWeight = resources.getInteger(
+ R.integer.contact_list_card_layout_weight);
+ if (listSpaceWeight > 0 && listViewWeight > 0) {
+ listLayout.setBackgroundResource(0);
+ // Set the card view visible
+ View mCardView = listLayout.findViewById(R.id.list_card);
+ if (mCardView == null) {
+ throw new RuntimeException(
+ "Your content must have a list card view who can be turned visible " +
+ "whenever it is necessary.");
+ }
+ mCardView.setVisibility(View.VISIBLE);
+ // Add extra padding to the list view to make them appear in the center of the card.
SchedulingUtils.doOnPreDraw(mListView, true, new Runnable() {
- @Override
- public void run() {
- Resources res = getResources();
- int listSpaceWeight = res.getInteger(R.integer
- .people_activity_space_layout_weight);
- int listViewWeight = res.getInteger(R.integer
- .people_activity_list_view_layout_weight);
- double paddingPercent = (double) listSpaceWeight / (double)
- (listSpaceWeight * 2 + listViewWeight);
- int width = mListView.getWidth();
- mListView.setPadding((int) (width * paddingPercent), mListView.getPaddingTop(),
- (int)(width * paddingPercent), mListView.getPaddingBottom());
- }
- });
+ @Override
+ public void run() {
+ ContactListViewUtils.addPaddingToView(
+ mListView, listSpaceWeight, listViewWeight);
+ }
+ });
}
return listLayout;
}
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 335a564a9..bf1bdcab5 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -18,17 +18,13 @@ package com.android.contacts.list;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Intent;
-import android.database.Cursor;
-import android.graphics.Color;
import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
import android.util.Log;
-import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Button;
import android.widget.FrameLayout;
@@ -36,14 +32,12 @@ import android.widget.ListView;
import android.widget.TextView;
import com.android.contacts.R;
-import com.android.contacts.util.SchedulingUtils;
import com.android.contacts.common.list.ContactListAdapter;
import com.android.contacts.common.list.ContactListFilter;
import com.android.contacts.common.list.ContactListFilterController;
import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.DefaultContactListAdapter;
import com.android.contacts.common.list.ProfileAndContactsLoader;
-import com.android.contacts.common.util.ViewUtil;
import com.android.contacts.editor.ContactEditorFragment;
import com.android.contacts.common.util.AccountFilterUtil;
@@ -64,7 +58,6 @@ public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
private TextView mProfileTitle;
private View mSearchProgress;
private TextView mSearchProgressText;
- private boolean mContactAllListShowCardFrame;
private class FilterHeaderClickListener implements OnClickListener {
@Override
@@ -100,8 +93,6 @@ public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
protected ContactListAdapter createListAdapter() {
DefaultContactListAdapter adapter = new DefaultContactListAdapter(getContext());
adapter.setSectionHeaderDisplayEnabled(isSectionHeaderDisplayEnabled());
- mContactAllListShowCardFrame = getResources().getBoolean(
- R.bool.contact_all_list_show_card_frame);
adapter.setDisplayPhotos(true);
adapter.setPhotoPosition(
ContactListItemView.getDefaultPhotoPosition(/* opposite = */ false));
@@ -133,25 +124,6 @@ public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
getListView().addHeaderView(headerContainer, null, false);
checkHeaderViewVisibility();
- // If the device is in the sw600dp class and in landscape mode, set a padding on the list
- // view so it appears in the center of the card in the layout.
- if (mContactAllListShowCardFrame) {
- SchedulingUtils.doOnPreDraw(getListView(), true, new Runnable() {
- @Override
- public void run() {
- final ListView listView = getListView();
- final int width = listView.getWidth();
- listView.setPadding(width / 4, listView.getPaddingTop(),
- width / 4, listView.getPaddingBottom());
- mAccountFilterHeader.setPadding(
- mAccountFilterHeader.getPaddingLeft() + width / 4,
- mAccountFilterHeader.getPaddingTop(),
- mAccountFilterHeader.getPaddingRight() + width / 4,
- mAccountFilterHeader.getPaddingBottom());
- }
- });
- }
-
mSearchProgress = getView().findViewById(R.id.search_progress);
mSearchProgressText = (TextView) mSearchHeaderView.findViewById(R.id.totalContactsText);
}