Improve tablet portrait and phone visuals for contact details
Bug:3171090
Bug:3158879
Change-Id: Id6e190897544882b2b7f11dd11ef5f6a34de9ed8
diff --git a/res/layout-xlarge-land/contact_detail_list_item.xml b/res/layout-xlarge-land/contact_detail_list_item.xml
new file mode 100644
index 0000000..38221be
--- /dev/null
+++ b/res/layout-xlarge-land/contact_detail_list_item.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2010, 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:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+>
+ <!-- Longer seperating line (between kinds) -->
+ <View
+ android:id="@+id/kind_divider"
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:background="@drawable/list_item_divider_holo"
+ />
+ <!-- Shorter seperating line if there was no kind-seperator -->
+ <View
+ android:id="@+id/in_kind_divider"
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:layout_marginLeft="164dip"
+ android:background="@drawable/list_item_divider_holo"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ >
+ <TextView android:id="@+id/kind"
+ android:layout_width="164dip"
+ android:layout_height="wrap_content"
+ android:paddingLeft="19dip"
+ android:textColor="#7F7F7F"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ />
+
+ <TextView android:id="@+id/data"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:paddingLeft="12dip"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ />
+
+ <TextView android:id="@+id/type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="150dip"
+ android:textColor="#999999"
+ android:gravity="right"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ />
+
+ <ImageView android:id="@+id/primary_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:paddingLeft="3dip"
+ android:src="@drawable/ic_default_number"
+ />
+
+ <TextView
+ android:id="@+id/footer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:visibility="gone" />
+
+ <ImageView android:id="@+id/presence_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="5dip"
+ android:gravity="center"
+ android:scaleType="centerInside"
+ />
+
+ <ImageView android:id="@+id/action_icon"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_marginLeft="14dip"
+ android:layout_marginRight="14dip"
+ android:gravity="center"
+ android:scaleType="centerInside"
+ />
+
+ <View android:id="@+id/divider"
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="5dip"
+ android:background="@drawable/divider_vertical_dark"
+ />
+
+ <ImageView android:id="@+id/secondary_action_button"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_centerVertical="true"
+ android:paddingLeft="14dip"
+ android:paddingRight="14dip"
+ android:gravity="center"
+ android:scaleType="center"
+ android:background="@android:drawable/list_selector_background"
+ />
+ </LinearLayout>
+ <!-- Longer seperating line (only for the last row) -->
+ <View
+ android:id="@+id/line_below_last"
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:background="@drawable/list_item_divider_holo"
+ />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/contact_detail_fragment.xml b/res/layout-xlarge/contact_detail_fragment.xml
index 33ee3fa..744b8f5 100644
--- a/res/layout-xlarge/contact_detail_fragment.xml
+++ b/res/layout-xlarge/contact_detail_fragment.xml
@@ -26,7 +26,8 @@
<!-- Header View (including social status) -->
<com.android.contacts.widget.InterpolatingLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="28dip">
<com.android.contacts.views.detail.ContactDetailHeaderView
android:id="@+id/contact_header_widget"
android:layout_width="match_parent"
@@ -51,7 +52,7 @@
android:textSize="20sp"
android:textColor="?android:attr/textColorSecondary"
ex:layout_wideParentWidth="800dip"
- ex:layout_wideLeftMargin="144dip"
+ ex:layout_wideLeftMargin="64dip"
ex:layout_narrowParentWidth="500dip"
ex:layout_narrowLeftMargin="42dip"
android:paddingTop="10dip"
@@ -68,17 +69,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
ex:layout_wideParentWidth="800dip"
- ex:layout_wideLeftMargin="80dip"
- ex:layout_wideRightMargin="64dip"
+ ex:layout_wideLeftMargin="64dip"
+ ex:layout_wideRightMargin="48dip"
ex:layout_narrowParentWidth="500dip"
ex:layout_narrowLeftMargin="32dip"
ex:layout_narrowRightMargin="0dip"
android:cacheColorHint="#00000000"
- android:divider="#ffe5e5e5"
- android:dividerHeight="1px"
+ android:divider="@android:color/transparent"
/>
</com.android.contacts.widget.InterpolatingLayout>
-
+
<!-- "Copy to my contacts"- button -->
<Button
android:id="@+id/copyLocal"
diff --git a/res/layout-xlarge/contact_detail_list_item.xml b/res/layout-xlarge/contact_detail_list_item.xml
deleted file mode 100644
index 7729973..0000000
--- a/res/layout-xlarge/contact_detail_list_item.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2010, 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:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:orientation="horizontal"
- android:paddingLeft="18dip"
- android:gravity="center_vertical"
->
- <TextView android:id="@+id/kind"
- android:layout_width="150dip"
- android:layout_height="wrap_content"
- android:textColor="#7F7F7F"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="marquee"
- />
-
- <TextView android:id="@+id/data"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:layout_marginLeft="8dip"
- android:textAppearance="?android:attr/textAppearanceLarge"
- />
-
- <TextView android:id="@+id/type"
- android:layout_width="150dip"
- android:layout_height="wrap_content"
- android:textColor="#999999"
- android:textAppearance="?android:attr/textAppearanceSmall"
- />
-
- <ImageView android:id="@+id/primary_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:paddingLeft="3dip"
- android:src="@drawable/ic_default_number"
- />
-
- <TextView
- android:id="@+id/footer"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone" />
-
- <ImageView android:id="@+id/presence_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- android:gravity="center"
- android:scaleType="centerInside"
- />
-
- <ImageView android:id="@+id/action_icon"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_marginLeft="14dip"
- android:layout_marginRight="14dip"
- android:gravity="center"
- android:scaleType="centerInside"
- />
-
- <View android:id="@+id/divider"
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="5dip"
- android:background="@drawable/divider_vertical_dark"
- />
-
- <ImageView android:id="@+id/secondary_action_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_centerVertical="true"
- android:paddingLeft="14dip"
- android:paddingRight="14dip"
- android:gravity="center"
- android:scaleType="center"
- android:background="@android:drawable/list_selector_background"
- />
-
-</LinearLayout>
diff --git a/res/layout/contact_detail_fragment.xml b/res/layout/contact_detail_fragment.xml
index a3ca198..6110ad3 100644
--- a/res/layout/contact_detail_fragment.xml
+++ b/res/layout/contact_detail_fragment.xml
@@ -19,7 +19,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
-
+
<com.android.contacts.views.detail.ContactDetailHeaderView
android:id="@+id/contact_header_widget"
android:layout_width="match_parent"
diff --git a/res/layout/contact_detail_list_item.xml b/res/layout/contact_detail_list_item.xml
index a110ec2..65d3faa 100644
--- a/res/layout/contact_detail_list_item.xml
+++ b/res/layout/contact_detail_list_item.xml
@@ -20,96 +20,136 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:orientation="horizontal"
- android:paddingLeft="9dip"
- android:gravity="center_vertical"
+ android:orientation="vertical"
>
-
- <LinearLayout
- android:layout_width="0dip"
+ <!-- Seperator that shows the kind -->
+ <LinearLayout android:id="@+id/kind_divider"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginLeft="5dip"
android:orientation="vertical"
- android:paddingTop="5dip"
- android:paddingBottom="7dip"
+ >
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:background="@drawable/list_item_divider_holo"
+ />
+ <TextView
+ android:id="@+id/kind"
+ android:gravity="center_vertical"
+ android:layout_width="match_parent"
+ android:layout_height="31dip"
+ android:paddingLeft="16dip"
+ android:background="#ffff"
+ android:textColor="#7F7F7F"
+ />
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:background="@drawable/list_item_divider_holo"
+ />
+ </LinearLayout>
+
+ <!-- Shorter seperating line if there was no kind-seperator -->
+ <ImageView
+ android:id="@+id/in_kind_divider"
+ android:layout_marginLeft="31dip"
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:background="@drawable/list_item_divider_holo"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:orientation="horizontal"
+ android:paddingLeft="31dip"
android:gravity="center_vertical"
>
-
- <TextView android:id="@+id/kind_and_type"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- />
-
<LinearLayout
- android:layout_width="wrap_content"
+ android:layout_width="0dip"
android:layout_height="wrap_content"
- android:orientation="horizontal"
+ android:layout_weight="1"
+ android:layout_marginLeft="5dip"
+ android:orientation="vertical"
+ android:paddingTop="5dip"
+ android:paddingBottom="7dip"
+ android:gravity="center_vertical"
>
-
- <TextView android:id="@+id/data"
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+
+ <TextView android:id="@+id/data"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ />
+
+ <ImageView android:id="@+id/primary_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:paddingLeft="3dip"
+ android:src="@drawable/ic_default_number"
+ />
+
+ </LinearLayout>
+
+ <TextView android:id="@+id/type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="#7F7F7F"
+ />
+
+ <TextView
+ android:id="@+id/footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceSmall"
- />
-
- <ImageView android:id="@+id/primary_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:paddingLeft="3dip"
- android:src="@drawable/ic_default_number"
- />
+ android:visibility="gone" />
</LinearLayout>
- <TextView
- android:id="@+id/footer"
+ <ImageView android:id="@+id/presence_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone" />
+ android:layout_marginLeft="5dip"
+ android:gravity="center"
+ android:scaleType="centerInside"
+ />
+ <ImageView android:id="@+id/action_icon"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_marginLeft="14dip"
+ android:layout_marginRight="14dip"
+ android:gravity="center"
+ android:scaleType="centerInside"
+ />
+
+ <View android:id="@+id/divider"
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="5dip"
+ android:background="@drawable/divider_vertical_dark"
+ />
+
+ <ImageView android:id="@+id/secondary_action_button"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_centerVertical="true"
+ android:paddingLeft="14dip"
+ android:paddingRight="14dip"
+ android:gravity="center"
+ android:scaleType="center"
+ android:background="@android:drawable/list_selector_background"
+ />
</LinearLayout>
-
- <ImageView android:id="@+id/presence_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- android:gravity="center"
- android:scaleType="centerInside"
- />
-
- <ImageView android:id="@+id/action_icon"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_marginLeft="14dip"
- android:layout_marginRight="14dip"
- android:gravity="center"
- android:scaleType="centerInside"
- />
-
- <View android:id="@+id/divider"
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="5dip"
- android:background="@drawable/divider_vertical_dark"
- />
-
- <ImageView android:id="@+id/secondary_action_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_centerVertical="true"
- android:paddingLeft="14dip"
- android:paddingRight="14dip"
- android:gravity="center"
- android:scaleType="center"
- android:background="@android:drawable/list_selector_background"
- />
-
</LinearLayout>
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index eb3e4a0..91641ea 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -98,6 +98,7 @@
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -476,9 +477,6 @@
entry.intent = imActions.getPrimaryIntent();
entry.secondaryIntent = imActions.getSecondaryIntent();
}
- if (TextUtils.isEmpty(entry.kindAndType)) {
- entry.kindAndType = mContext.getString(R.string.chat).toLowerCase();
- }
// Apply presence and status details when available
final DataStatus status = mContactData.getStatuses().get(entry.id);
@@ -574,7 +572,6 @@
}
entry.mimetype = GroupMembership.MIMETYPE;
entry.kind = mContext.getString(R.string.groupsLabel).toUpperCase();
- entry.kindAndType = entry.kind;
entry.data = sb.toString();
mGroupEntries.add(entry);
}
@@ -628,7 +625,6 @@
*/
private static class ViewEntry implements Collapsible<ViewEntry> {
public int type = -1;
- public String kindAndType;
public String kind;
public String typeString;
public String data;
@@ -664,7 +660,6 @@
entry.id = dataId;
entry.uri = ContentUris.withAppendedId(Data.CONTENT_URI, entry.id);
entry.mimetype = mimeType;
- entry.kindAndType = buildActionString(kind, values, context);
entry.kind = (kind.titleRes == -1 || kind.titleRes == 0) ? ""
: context.getString(kind.titleRes).toUpperCase();
entry.data = buildDataString(kind, values, context);
@@ -726,7 +721,6 @@
if (TypePrecedence.getTypePrecedence(mimetype, type)
> TypePrecedence.getTypePrecedence(entry.mimetype, entry.type)) {
type = entry.type;
- kindAndType = entry.kindAndType;
kind = entry.kind;
typeString = entry.typeString;
}
@@ -775,7 +769,9 @@
/** Cache of the children views of a row */
private static class ViewCache {
- public TextView kindAndType;
+ public View kindDivider;
+ public View inKindDivider;
+ public View lineBelowLast;
public TextView kind;
public TextView type;
public TextView data;
@@ -804,8 +800,10 @@
// Cache the children
viewCache = new ViewCache();
- viewCache.kindAndType = (TextView) v.findViewById(R.id.kind_and_type);
viewCache.kind = (TextView) v.findViewById(R.id.kind);
+ viewCache.kindDivider = v.findViewById(R.id.kind_divider);
+ viewCache.lineBelowLast = v.findViewById(R.id.line_below_last);
+ viewCache.inKindDivider = v.findViewById(R.id.in_kind_divider);
viewCache.type = (TextView) v.findViewById(R.id.type);
viewCache.data = (TextView) v.findViewById(R.id.data);
viewCache.footer = (TextView) v.findViewById(R.id.footer);
@@ -822,25 +820,29 @@
final ViewEntry previousEntry = position == 0 ? null : getEntry(position - 1);
final boolean isFirstOfItsKind =
previousEntry == null ? true : !previousEntry.kind.equals(entry.kind);
+ final boolean isLast = position == getCount() - 1;
// Bind the data to the view
- bindView(v, entry, isFirstOfItsKind);
+ bindView(v, entry, isFirstOfItsKind, isLast);
return v;
}
- protected void bindView(View view, ViewEntry entry, boolean isFirstOfItsKind) {
+ protected void bindView(View view, ViewEntry entry, boolean isFirstOfItsKind,
+ boolean isLast) {
final Resources resources = mContext.getResources();
ViewCache views = (ViewCache) view.getTag();
- // Set the label. This is either a combination field or separate fields for kind of type
- if (views.kindAndType != null) views.kindAndType.setText(entry.kindAndType);
- if (views.kind != null) views.kind.setText(isFirstOfItsKind ? entry.kind : "");
- if (views.type != null) {
- final String typeString = entry.typeString;
- views.type.setText(typeString);
- views.type.setVisibility(TextUtils.isEmpty(typeString) ? View.GONE : View.VISIBLE);
+ views.kind.setText(isFirstOfItsKind ? entry.kind : "");
+ views.kindDivider.setVisibility(isFirstOfItsKind ? View.VISIBLE : View.GONE);
+ views.inKindDivider.setVisibility(isFirstOfItsKind ? View.GONE : View.VISIBLE);
+ if (views.lineBelowLast != null) {
+ views.lineBelowLast.setVisibility(isLast ? View.VISIBLE : View.GONE);
}
+ views.type.setText(entry.typeString);
+ views.type.setVisibility(
+ TextUtils.isEmpty(entry.typeString) ? View.GONE : View.VISIBLE);
+
// Set the content
final TextView content = views.data;
if (content != null) {