Support for local profile
Bug: 5121834 Support local profile
5086184 Account name is overlapped by number of contacts
5082317 Text is chopped on the top in contact list
1. New headers were added at the top of the contact list to
present an empty local profile.
2. Clicking the empty local profile opens the editor to allow
the user to create a local profile.
3. Profiles are shown at the top of the contacts list with the
"ME" header and the number of contatcs.
4. "Add to contacts" button and the starred button were removed
from the details view when it is a profile.
5. Fixed a problem with a header view that remained when you had
a profile or was in search mode.
6. Fixed problem with contacts count apearing in search mode
Change-Id: I45615616e03a603759888d9e7169a853b3328b14
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contacts_list_content.xml
index 92841b6..567e63d 100644
--- a/res/layout/contacts_list_content.xml
+++ b/res/layout/contacts_list_content.xml
@@ -18,68 +18,54 @@
android:layout_marginTop is ignored when used with <fragment></fragment>, which
only happens in Tablet UI since we rely on ViewPager in Phone UI.
Instead, android:layout_marginTop inside <fragment /> is effective. -->
-<FrameLayout
+
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pinned_header_list_layout"
android:paddingTop="@dimen/contact_browser_list_top_margin"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <!-- Shown only when an Account filter is set. -->
- <LinearLayout
- android:id="@+id/account_filter_header_container"
+ <!-- Shown only when an Account filter is set. -->
+ <LinearLayout
+ android:id="@+id/account_filter_header_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginLeft="@dimen/contact_browser_list_header_left_margin"
+ android:layout_marginRight="@dimen/contact_browser_list_header_right_margin"
+ android:visibility="gone">
+ <TextView
+ android:id="@+id/account_filter_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginLeft="@dimen/contact_browser_list_header_left_margin"
- android:layout_marginRight="@dimen/contact_browser_list_header_right_margin"
- android:visibility="gone">
- <TextView
- android:id="@+id/account_filter_header"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="@dimen/contact_filter_header_min_height"
- android:layout_marginLeft="8dip"
- android:singleLine="true"
- android:ellipsize="end"
- android:gravity="left"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary" />
- <View
- android:id="@+id/account_filter_header_bottom_divider"
- style="@style/SectionDivider" />
- </LinearLayout>
-
- <view
- class="com.android.contacts.list.ContactEntryListView"
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_marginLeft="@dimen/contact_browser_list_left_margin"
- android:layout_marginRight="@dimen/contact_browser_list_right_margin"
- android:fastScrollEnabled="true"
- android:layout_weight="1" />
-
- <ViewStub
- android:id="@+id/footer_stub"
- android:layout="@layout/footer_panel"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
+ android:minHeight="@dimen/contact_filter_header_min_height"
+ android:layout_marginLeft="8dip"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:gravity="left"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary" />
+ <View
+ android:id="@+id/account_filter_header_bottom_divider"
+ style="@style/SectionDivider" />
</LinearLayout>
- <TextView
- android:id="@+id/contacts_count"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="@dimen/contacts_count_right_margin"
- android:singleLine="true"
- android:ellipsize="end"
- android:gravity="right"
- android:layout_gravity="top|right"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/contact_count_text_color"
- android:background="@color/contact_browser_list_bk_color" />
-</FrameLayout>
+
+ <view
+ class="com.android.contacts.list.ContactEntryListView"
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_marginLeft="@dimen/contact_browser_list_left_margin"
+ android:layout_marginRight="@dimen/contact_browser_list_right_margin"
+ android:fastScrollEnabled="true"
+ android:layout_weight="1" />
+
+ <ViewStub
+ android:id="@+id/footer_stub"
+ android:layout="@layout/footer_panel"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/res/layout/user_profile_button.xml b/res/layout/user_profile_button.xml
new file mode 100644
index 0000000..b7b5e1d
--- /dev/null
+++ b/res/layout/user_profile_button.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+
+<Button
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground"
+ android:paddingLeft="@dimen/contact_browser_list_left_margin"
+ android:singleLine="true"
+ android:text="@string/profile_display_name"
+ android:ellipsize="end"
+ android:gravity="left|center_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
diff --git a/res/layout/user_profile_header.xml b/res/layout/user_profile_header.xml
new file mode 100644
index 0000000..ae803ba
--- /dev/null
+++ b/res/layout/user_profile_header.xml
@@ -0,0 +1,60 @@
+<?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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="@color/contact_browser_list_bk_color"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:id="@+id/profile_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/contact_browser_list_left_margin"
+ android:singleLine="true"
+ android:text="@string/user_profile_contacts_list_header"
+ android:textStyle="bold"
+ android:ellipsize="end"
+ android:gravity="left"
+ android:layout_weight="1"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/people_app_theme_color" />
+
+ <TextView
+ android:id="@+id/contacts_count"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:layout_gravity="right"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/contact_count_text_color" />
+ </LinearLayout>
+
+ <View
+ android:background="@color/people_app_theme_color"
+ android:layout_marginLeft="@dimen/contact_browser_list_left_margin"
+ android:layout_width="match_parent"
+ android:layout_height="1px" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 79d12f9..4d4050e 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -95,6 +95,7 @@
<attr name="list_item_header_height" format="dimension" />
<attr name="list_item_header_underline_height" format="dimension" />
<attr name="list_item_header_underline_color" format="color" />
+ <attr name="list_item_contacts_count_text_color" format="color" />
</declare-styleable>
<declare-styleable name="CallLog">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index abe1d01..87461d7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1598,7 +1598,7 @@
<!-- Text displayed in place of the display name for the contact that represents the user's
personal profile entry [CHAR LIMIT=64] -->
- <string name="profile_display_name">My profile</string>
+ <string name="profile_display_name">Set up my profile</string>
<!-- Label to instruct the user to type in a contact's name to add the contact as a member of the current group. [CHAR LIMIT=64] -->
<string name="enter_contact_name">Enter contact\'s name</string>
@@ -1755,4 +1755,6 @@
<!-- The string used to represent an unknown location for a phone number in the call log [CHAR LIMIT=3] -->
<string name="call_log_empty_gecode">-</string>
+ <!-- String describing the text on the header of the profile contact in the contacts list [CHAR LIMIT=20] -->
+ <string name="user_profile_contacts_list_header">ME</string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index b25f0af..423466f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -149,6 +149,7 @@
<item name="list_item_header_height">26dip</item>
<item name="list_item_header_underline_height">1px</item>
<item name="list_item_header_underline_color">@color/people_app_theme_color</item>
+ <item name="list_item_contacts_count_text_color">@color/contact_count_text_color</item>
<item name="contact_filter_popup_width">320dip</item>
<!-- Favorites -->
<item name="favorites_padding_bottom">0dip</item>