Fix photo + basic contact info header on tablet
- Fix these cases:
* On tablet landscape, for a contact with social updates, the name
has to be displayed to the right of the photo.
* On tablet landscape, for a contact without social updates, the
photo must be static and the name should scroll with the list of
details
- In order to support these cases, specify the header of the list
in XML in the case with and without social updates, otherwise there will
be a lot of boolean flags and unnecessary views inflated
- There still needs to be a flag in the tablet landscape view
because the ContactDetailFragment is reused for both cases where the
contact does and does not have social updates. The static photo
must be explicitly hidden in the case of the contact with social
updates because it will appear in the scrolling header. This flag
must be set outside the ContactDetailFragment b/t the phone
landscape view has a static photo that is shown regardless
of whether the contact has social updates or not.
Bug: 4689488
Change-Id: Ifea16c48496b8552b313a05cbb8ade80ae117069
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml b/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
new file mode 100644
index 0000000..9dd3690
--- /dev/null
+++ b/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
@@ -0,0 +1,65 @@
+<?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"
+ xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+ android:id="@+id/contact_detail"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/panel_content">
+
+ <!-- Placeholder for empty list -->
+ <include
+ android:id="@android:id/empty"
+ layout="@layout/contact_detail_empty"
+ android:visibility="gone" />
+
+ <!-- Real list -->
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ImageView android:id="@+id/photo"
+ android:scaleType="centerCrop"
+ android:layout_width="@dimen/detail_contact_photo_size"
+ android:layout_height="@dimen/detail_contact_photo_size"
+ android:layout_marginLeft="@dimen/detail_contact_photo_margin"
+ android:layout_marginRight="@dimen/detail_contact_photo_margin"
+ android:layout_marginTop="@dimen/detail_contact_photo_margin"
+ android:layout_marginBottom="@dimen/detail_contact_photo_margin"/>
+
+ <ListView android:id="@android:id/list"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:divider="@null"/>
+
+ </LinearLayout>
+
+ <!-- "QuickFix"- button (Copy to local contact, add to group) -->
+ <Button
+ android:id="@+id/contact_quick_fix"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ android:layout_gravity="right"
+ android:layout_marginRight="40dip"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_header_view.xml b/res/layout-sw580dp-w1000dp/contact_detail_header_view.xml
deleted file mode 100644
index 82432a0..0000000
--- a/res/layout-sw580dp-w1000dp/contact_detail_header_view.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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:id="@+id/banner"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="28dip">
-
- <TextView
- android:id="@+id/attribution"
- android:layout_width="match_parent"
- android:layout_height="@dimen/detail_header_attribution_height"
- android:paddingRight="16dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorTertiary"
- android:gravity="right|center_vertical"
- android:singleLine="true" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <ImageView
- android:id="@+id/photo"
- android:layout_marginLeft="-1dip"
- android:layout_width="96dip"
- android:layout_height="96dip" />
-
- <LinearLayout
- android:layout_width="0px"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_gravity="top"
- android:orientation="vertical">
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:background="@color/contact_detail_header_divider_color" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="16dip"
- android:layout_marginLeft="@dimen/detail_header_view_margin">
-
- <!-- Star -->
- <CheckBox
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dip"
- android:layout_gravity="top"
- android:contentDescription="@string/description_star"
- android:visibility="invisible"
- style="?android:attr/starStyle" />
-
- <!-- Name, PhoneticName, Directory -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/detail_header_view_margin"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/name"
- style="@style/ContactDetailHeaderTextView"
- android:textSize="@dimen/contact_name_text_size" />
-
- <TextView
- android:id="@+id/phonetic_name"
- style="@style/ContactDetailHeaderTextView"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_marginTop="-2dip"
- android:visibility="gone" />
-
- <TextView
- android:id="@+id/organization"
- style="@style/ContactDetailHeaderTextView"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorTertiary" />
- </LinearLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <!-- Status info -->
- <LinearLayout
- android:id="@+id/status_container"
- android:layout_width="0px"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:background="@drawable/statusbox_landscape_holo_light"
- android:layout_marginLeft="10dip"
- android:layout_marginTop="30dip"
- android:paddingLeft="52dip"
- android:paddingTop="12dip"
- android:paddingRight="16dip"
- android:paddingBottom="12dip"
- android:visibility="gone">
-
- <TextView
- android:id="@+id/status"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:maxLines="3"
- android:ellipsize="end"
- android:visibility="gone" />
-
- <TextView
- android:id="@+id/status_date"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorTertiary"
- android:gravity="right"
- android:visibility="gone" />
- </LinearLayout>
- </LinearLayout>
- </LinearLayout>
- </LinearLayout>
-</LinearLayout>
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml b/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
new file mode 100644
index 0000000..1a1a3bb
--- /dev/null
+++ b/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
@@ -0,0 +1,68 @@
+<?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.
+-->
+
+<!--
+ This is a header entry in the contact details list for when the contact has social updates. The
+ entry shows the contact's basic info and maintains vertical padding to ensure that the first
+ contact detail is visible (and below the tab carousel). The photo is not displayed here
+ because it will be shown in the tab carousel.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:padding="20dip">
+
+ <ImageView
+ android:id="@+id/photo"
+ android:scaleType="centerCrop"
+ android:layout_width="@dimen/detail_contact_photo_size"
+ android:layout_height="@dimen/detail_contact_photo_size" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="10dip"
+ android:paddingRight="10dip">
+
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/detail_header_name_text_size" />
+
+ <TextView
+ android:id="@+id/company"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <CheckBox
+ android:id="@+id/star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:contentDescription="@string/description_star"
+ style="?android:attr/starStyle" />
+
+ </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml b/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
new file mode 100644
index 0000000..415bbbf
--- /dev/null
+++ b/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<!--
+ This is a header entry in the contact details list for when the contact does not have social
+ updates, which means that the contact's basic info will scroll with the list of details. The
+ photo is not included because it will be displayed in a static place elsewhere.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="20dip">
+
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/detail_header_name_text_size" />
+
+ <TextView
+ android:id="@+id/company"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <CheckBox
+ android:id="@+id/star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top"
+ android:contentDescription="@string/description_star"
+ style="?android:attr/starStyle" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp/contact_detail_header_view.xml b/res/layout-sw580dp/contact_detail_header_view.xml
deleted file mode 100644
index 95a5617..0000000
--- a/res/layout-sw580dp/contact_detail_header_view.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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:id="@+id/banner"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="28dip">
-
- <TextView
- android:id="@+id/attribution"
- android:layout_width="match_parent"
- android:layout_height="@dimen/detail_header_attribution_height"
- android:paddingRight="24dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorTertiary"
- android:gravity="right|center_vertical"
- android:singleLine="true" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <ImageView
- android:id="@+id/photo"
- android:layout_marginLeft="@dimen/detail_header_view_margin"
- android:layout_width="96dip"
- android:layout_height="96dip" />
-
- <LinearLayout
- android:layout_width="0px"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
- android:layout_gravity="top">
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:background="@color/contact_detail_header_divider_color" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="16dip"
- android:layout_marginLeft="@dimen/detail_header_view_margin">>
-
- <!-- Star -->
- <CheckBox
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dip"
- android:layout_gravity="top"
- android:contentDescription="@string/description_star"
- android:visibility="invisible"
- style="?android:attr/starStyle" />
-
- <!-- Name, PhoneticName, Directory -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/detail_header_view_margin"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/name"
- style="@style/ContactDetailHeaderTextView"
- android:textSize="@dimen/contact_name_text_size" />
-
- <TextView
- android:id="@+id/phonetic_name"
- style="@style/ContactDetailHeaderTextView"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_marginTop="-2dip"
- android:visibility="gone" />
-
- <TextView
- android:id="@+id/organization"
- style="@style/ContactDetailHeaderTextView"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorTertiary" />
- </LinearLayout>
- </LinearLayout>
- </LinearLayout>
- </LinearLayout>
-
- <!-- Status info -->
- <LinearLayout
- android:id="@+id/status_container"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:background="@drawable/statusbox_portrait_holo_light"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="24dip"
- android:layout_marginTop="10dip"
- android:paddingLeft="12dip"
- android:paddingTop="36dip"
- android:paddingRight="16dip"
- android:paddingBottom="12dip"
- android:visibility="gone">
-
- <TextView
- android:id="@+id/status"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:maxLines="3"
- android:ellipsize="end"
- android:visibility="gone" />
-
- <TextView
- android:id="@+id/status_date"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorTertiary"
- android:gravity="right"
- android:visibility="gone" />
- </LinearLayout>
-</LinearLayout>
diff --git a/res/layout-sw580dp/detail_header_contact_with_updates.xml b/res/layout-sw580dp/detail_header_contact_with_updates.xml
new file mode 100644
index 0000000..e909434
--- /dev/null
+++ b/res/layout-sw580dp/detail_header_contact_with_updates.xml
@@ -0,0 +1,52 @@
+<?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.
+-->
+
+<!--
+ This is a header entry in the contact details list for when the contact has social updates. The
+ entry shows the contact's basic info and maintains vertical padding to ensure that the first
+ contact detail is visible (and below the tab carousel). The photo is not displayed here
+ because it will be shown in the tab carousel.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/detail_tab_carousel_height"
+ android:layout_marginTop="20dip">
+
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/detail_header_name_text_size" />
+
+ <TextView
+ android:id="@+id/company"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <CheckBox
+ android:id="@+id/star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top"
+ android:contentDescription="@string/description_star"
+ style="?android:attr/starStyle" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp/detail_header_contact_without_updates.xml b/res/layout-sw580dp/detail_header_contact_without_updates.xml
new file mode 100644
index 0000000..4ae31c8
--- /dev/null
+++ b/res/layout-sw580dp/detail_header_contact_without_updates.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<!--
+ This is a header entry in the contact details list for when the contact does not have social
+ updates, which means that the contact's photo and basic info will scroll with the list of details.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="20dip">
+
+ <ImageView
+ android:id="@+id/photo"
+ android:scaleType="centerCrop"
+ android:layout_width="@dimen/detail_contact_photo_size"
+ android:layout_height="@dimen/detail_contact_photo_size" />
+
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/detail_header_name_text_size" />
+
+ <TextView
+ android:id="@+id/company"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <CheckBox
+ android:id="@+id/star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top"
+ android:contentDescription="@string/description_star"
+ style="?android:attr/starStyle" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/simple_contact_detail_header_view_list_item.xml b/res/layout-w470dp/detail_header_contact_with_updates.xml
similarity index 74%
copy from res/layout/simple_contact_detail_header_view_list_item.xml
copy to res/layout-w470dp/detail_header_contact_with_updates.xml
index eea4ac4..588957e 100644
--- a/res/layout/simple_contact_detail_header_view_list_item.xml
+++ b/res/layout-w470dp/detail_header_contact_with_updates.xml
@@ -14,15 +14,11 @@
limitations under the License.
-->
+<!--
+ This is a header entry in the contact details list for when the contact has social updates.
+ This is empty because all the information will be displayed elsewhere.
+-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:id="@+id/photo"
- android:scaleType="centerCrop"
- android:layout_width="match_parent"
- android:layout_height="@dimen/detail_tab_carousel_height" />
-
-</FrameLayout>
\ No newline at end of file
+ android:layout_height="0dip"/>
\ No newline at end of file
diff --git a/res/layout/simple_contact_detail_header_view_list_item.xml b/res/layout-w470dp/detail_header_contact_without_updates.xml
similarity index 74%
copy from res/layout/simple_contact_detail_header_view_list_item.xml
copy to res/layout-w470dp/detail_header_contact_without_updates.xml
index eea4ac4..44ea04c 100644
--- a/res/layout/simple_contact_detail_header_view_list_item.xml
+++ b/res/layout-w470dp/detail_header_contact_without_updates.xml
@@ -14,15 +14,11 @@
limitations under the License.
-->
+<!--
+ This is a header entry in the contact details list for when the contact does not have social
+ updates. This is empty because all the information will be displayed elsewhere.
+-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:id="@+id/photo"
- android:scaleType="centerCrop"
- android:layout_width="match_parent"
- android:layout_height="@dimen/detail_tab_carousel_height" />
-
-</FrameLayout>
\ No newline at end of file
+ android:layout_height="0dip"/>
\ No newline at end of file
diff --git a/res/layout/contact_detail_header_view.xml b/res/layout/contact_detail_header_view.xml
deleted file mode 100644
index 328a5ff..0000000
--- a/res/layout/contact_detail_header_view.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/banner"
- android:layout_width="match_parent"
- android:layout_height="150dip">
-
- <ImageView android:id="@+id/photo"
- android:scaleType="centerCrop"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- />
-
- <!-- Transparent view to overlay on the contact's photo
- (to allow white text to appear over a white photo). -->
- <View
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:background="#000000"
- android:alpha=".25"
- />
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="10dip"
- android:orientation="vertical" >
-
- <TextView android:id="@+id/name"
- android:layout_width="wrap_content"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:singleLine="true"
- android:ellipsize="end"
- android:gravity="bottom"
- android:textSize="@dimen/detail_header_name_text_size"
- android:textColor="@color/detail_header_view_text_color"
- />
-
- <TextView android:id="@+id/phonetic_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/detail_header_view_text_color"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/organization"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/detail_header_view_text_color"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/attribution"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/detail_header_view_text_color"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
- <TextView android:id="@+id/status_date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textSize="12sp"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
- </LinearLayout>
-
- <CheckBox
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dip"
- android:layout_marginRight="10dip"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- android:layout_gravity="center_vertical"
- android:contentDescription="@string/description_star"
- android:visibility="invisible"
- style="?android:attr/starStyle"
- />
-</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/simple_contact_detail_header_view_list_item.xml b/res/layout/detail_header_contact_with_updates.xml
similarity index 69%
copy from res/layout/simple_contact_detail_header_view_list_item.xml
copy to res/layout/detail_header_contact_with_updates.xml
index eea4ac4..00d1b76 100644
--- a/res/layout/simple_contact_detail_header_view_list_item.xml
+++ b/res/layout/detail_header_contact_with_updates.xml
@@ -14,15 +14,12 @@
limitations under the License.
-->
+<!--
+ This is a header entry in the contact details list for when the contact has social updates. The
+ entry maintains vertical padding to ensure that the first contact detail is visible (and below
+ the tab carousel). No information has to be displayed in this header.
+-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:id="@+id/photo"
- android:scaleType="centerCrop"
- android:layout_width="match_parent"
- android:layout_height="@dimen/detail_tab_carousel_height" />
-
-</FrameLayout>
\ No newline at end of file
+ android:layout_height="@dimen/detail_tab_carousel_height"/>
\ No newline at end of file
diff --git a/res/layout/simple_contact_detail_header_view_list_item.xml b/res/layout/detail_header_contact_without_updates.xml
similarity index 84%
rename from res/layout/simple_contact_detail_header_view_list_item.xml
rename to res/layout/detail_header_contact_without_updates.xml
index eea4ac4..a5d4687 100644
--- a/res/layout/simple_contact_detail_header_view_list_item.xml
+++ b/res/layout/detail_header_contact_without_updates.xml
@@ -14,6 +14,10 @@
limitations under the License.
-->
+<!--
+ This is a header entry in the contact details list for when the contact does not have social
+ updates, which means that the contact's photo will scroll with the list of details.
+-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2bba6ac..18b86be 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -144,7 +144,7 @@
<dimen name="detail_network_icon_size">32dip</dimen>
<!-- Font size for the display name in header of the contact detail page -->
- <dimen name="detail_header_name_text_size">30sp</dimen>
+ <dimen name="detail_header_name_text_size">36sp</dimen>
<!-- Padding to be used between a visible scrollbar and the contact list -->
<dimen name="list_visible_scrollbar_padding">40dip</dimen>
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
index 4d04ac2..b26c8ae 100644
--- a/src/com/android/contacts/activities/ContactDetailActivity.java
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -161,11 +161,6 @@
mDetailFragment.setListener(mFragmentListener);
mDetailFragment.setVerticalScrollListener(mVerticalScrollListener);
mDetailFragment.setData(mLookupUri, mContactData);
- // If the contact has social updates, then the photo should be shown in the tab
- // carousel, so don't show the photo again in the scrolling list of contact details.
- // We also don't want to show the photo if there is a fragment carousel because then
- // the picture will already be on the left of the list of contact details.
- mDetailFragment.setShowPhotoInHeader(!mContactHasUpdates && mFragmentCarousel == null);
} else if (fragment instanceof ContactDetailUpdatesFragment) {
mUpdatesFragment = (ContactDetailUpdatesFragment) fragment;
mUpdatesFragment.setData(mLookupUri, mContactData);
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index 9709480..7b70028 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -129,7 +129,7 @@
private ContactLoader.Result mContactData;
private ViewGroup mHeaderView;
- private ImageView mPhotoView;
+ private ImageView mStaticPhotoView;
private ListView mListView;
private ViewAdapter mAdapter;
private Uri mPrimaryPhoneUri = null;
@@ -140,8 +140,8 @@
private final ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
private int mNumPhoneNumbers = 0;
private String mDefaultCountryIso;
- private boolean mContactDataDisplayed;
- private boolean mContactPhotoDisplayedInHeader = true;
+ private boolean mContactHasSocialUpdates;
+ private boolean mShowStaticPhoto = true;
private final QuickFix[] mPotentialQuickFixes = new QuickFix[] {
new MakeLocalCopyQuickFix(),
@@ -248,7 +248,7 @@
mInflater = inflater;
- mPhotoView = (ImageView) mView.findViewById(R.id.photo);
+ mStaticPhotoView = (ImageView) mView.findViewById(R.id.photo);
mListView = (ListView) mView.findViewById(android.R.id.list);
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
@@ -336,11 +336,11 @@
}
/**
- * Sets whether or not the contact photo should be shown in the list of contact details in this
- * {@link Fragment}.
+ * Sets whether the static contact photo (that is not in a scrolling region), should be shown
+ * or not.
*/
- public void setShowPhotoInHeader(boolean showPhoto) {
- mContactPhotoDisplayedInHeader = showPhoto;
+ public void setShowStaticPhoto(boolean showPhoto) {
+ mShowStaticPhoto = showPhoto;
}
public void setData(Uri lookupUri, ContactLoader.Result result) {
@@ -371,9 +371,21 @@
// Clear old header
mHeaderView = null;
+ // Figure out if the contact has social updates or not
+ mContactHasSocialUpdates = !mContactData.getStreamItems().isEmpty();
+
// Setup the photo if applicable
- if (mPhotoView != null) {
- ContactDetailDisplayUtils.setPhoto(mContext, mContactData, mPhotoView);
+ if (mStaticPhotoView != null) {
+ // The presence of a static photo view is not sufficient to determine whether or not
+ // we should show the photo. Check the mShowStaticPhoto flag which can be set by an
+ // outside class depending on screen size, layout, and whether the contact has social
+ // updates or not.
+ if (mShowStaticPhoto) {
+ mStaticPhotoView.setVisibility(View.VISIBLE);
+ ContactDetailDisplayUtils.setPhoto(mContext, mContactData, mStaticPhotoView);
+ } else {
+ mStaticPhotoView.setVisibility(View.GONE);
+ }
}
// Build up the contact entries
@@ -1261,26 +1273,21 @@
return mHeaderView;
}
- mHeaderView = (ViewGroup) inflate(
- R.layout.simple_contact_detail_header_view_list_item, parent, false);
+ int resourceId = mContactHasSocialUpdates ?
+ R.layout.detail_header_contact_with_updates :
+ R.layout.detail_header_contact_without_updates;
+ mHeaderView = (ViewGroup) inflate(resourceId, parent, false);
TextView displayNameView = (TextView) mHeaderView.findViewById(R.id.name);
TextView companyView = (TextView) mHeaderView.findViewById(R.id.company);
- TextView phoneticNameView = (TextView) mHeaderView.findViewById(R.id.phonetic_name);
- TextView attributionView = (TextView) mHeaderView.findViewById(R.id.attribution);
ImageView photoView = (ImageView) mHeaderView.findViewById(R.id.photo);
ContactDetailDisplayUtils.setDisplayName(mContext, mContactData, displayNameView);
ContactDetailDisplayUtils.setCompanyName(mContext, mContactData, companyView);
- ContactDetailDisplayUtils.setPhoneticName(mContext, mContactData, phoneticNameView);
- ContactDetailDisplayUtils.setAttribution(mContext, mContactData, attributionView);
// Set the photo if it should be displayed
- if (mContactPhotoDisplayedInHeader) {
+ if (photoView != null) {
ContactDetailDisplayUtils.setPhoto(mContext, mContactData, photoView);
- } else {
- // Otherwise hide the view
- photoView.setVisibility(View.INVISIBLE);
}
// Set the starred state if it should be displayed
diff --git a/src/com/android/contacts/detail/ContactDetailLayoutController.java b/src/com/android/contacts/detail/ContactDetailLayoutController.java
index d93edea..d912670 100644
--- a/src/com/android/contacts/detail/ContactDetailLayoutController.java
+++ b/src/com/android/contacts/detail/ContactDetailLayoutController.java
@@ -137,7 +137,9 @@
switch (mLayoutMode) {
case TWO_COLUMN: {
- // Set the contact data
+ // Set the contact data (hide the static photo because the photo will already be in
+ // the header that scrolls with contact details).
+ mContactDetailFragment.setShowStaticPhoto(false);
mContactDetailFragment.setData(mContactData.getLookupUri(), mContactData);
mContactDetailUpdatesFragment.setData(mContactData.getLookupUri(), mContactData);
@@ -175,6 +177,7 @@
switch (mLayoutMode) {
case TWO_COLUMN:
+ mContactDetailFragment.setShowStaticPhoto(true);
mContactDetailFragment.setData(mContactData.getLookupUri(), mContactData);
ft.hide(mContactDetailUpdatesFragment);
break;
@@ -227,7 +230,6 @@
}
mPagerContactDetailFragment.setListener(mContactDetailFragmentListener);
mPagerContactDetailFragment.setVerticalScrollListener(mVerticalScrollListener);
- mPagerContactDetailFragment.setShowPhotoInHeader(false);
return mPagerContactDetailFragment;
case 1:
mPagerContactDetailUpdatesFragment = new ContactDetailUpdatesFragment();