Add empty state to group detail page
Bug: 5160342
Change-Id: I1061fae0366285f601cfb7964f74da2eb4e5855b
diff --git a/res/layout-sw580dp-w1000dp/group_detail_fragment.xml b/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
index 45419a8..3011d69 100644
--- a/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
+++ b/res/layout-sw580dp-w1000dp/group_detail_fragment.xml
@@ -81,4 +81,7 @@
android:fadingEdge="none"
android:divider="@null" />
+ <include
+ layout="@layout/group_detail_fragment_empty_view"/>
+
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw580dp/group_detail_fragment.xml b/res/layout-sw580dp/group_detail_fragment.xml
index fbe695b..ec65582 100644
--- a/res/layout-sw580dp/group_detail_fragment.xml
+++ b/res/layout-sw580dp/group_detail_fragment.xml
@@ -61,4 +61,7 @@
android:fadingEdge="none"
android:divider="@null" />
+ <include
+ layout="@layout/group_detail_fragment_empty_view"/>
+
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/group_detail_fragment.xml b/res/layout/group_detail_fragment.xml
index 2b020c9..735b29d 100644
--- a/res/layout/group_detail_fragment.xml
+++ b/res/layout/group_detail_fragment.xml
@@ -43,6 +43,9 @@
android:scrollbarStyle="outsideOverlay"
android:divider="@null"/>
+ <include
+ layout="@layout/group_detail_fragment_empty_view"/>
+
<!--
Shadow overlay over the list of group members (since we have a fake stacked
action bar)
diff --git a/res/layout/group_detail_fragment_empty_view.xml b/res/layout/group_detail_fragment_empty_view.xml
new file mode 100644
index 0000000..89a6cf8
--- /dev/null
+++ b/res/layout/group_detail_fragment_empty_view.xml
@@ -0,0 +1,41 @@
+<?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:id="@android:id/empty"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingTop="24dip"
+ android:visibility="gone">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/emptyGroup"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/addPeopleToGroup"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index accab64..a5e125d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -269,6 +269,12 @@
<!-- The text displayed when the contacts list is empty while displaying only contacts that have phone numbers -->
<string name="noContactsWithPhoneNumbers">No contacts with phone numbers.</string>
+ <!-- The text displayed when there are no members in the group while displaying the group detail page [CHAR LIMIT=40] -->
+ <string name="emptyGroup">No people in this group.</string>
+
+ <!-- The text displayed to instruct users to add members to a group (when viewing a group detail page for a group with no members) [CHAR LIMIT=50] -->
+ <string name="addPeopleToGroup">To add some, edit the group.</string>
+
<!-- Displayed in a spinner dialog after the user creates a contact and it's being saved to the database -->
<string name="savingContact">Saving contact\u2026</string>
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index d4f6e29..b3472ab 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -98,6 +98,7 @@
private TextView mGroupTitle;
private TextView mGroupSize;
private ListView mMemberListView;
+ private View mEmptyView;
private Listener mListener;
@@ -149,6 +150,7 @@
mGroupSize = (TextView) mRootView.findViewById(R.id.group_size);
mGroupSourceViewContainer = (ViewGroup) mRootView.findViewById(
R.id.group_source_view_container);
+ mEmptyView = mRootView.findViewById(android.R.id.empty);
mMemberListView = (ListView) mRootView.findViewById(android.R.id.list);
mMemberListView.setAdapter(mAdapter);
@@ -258,6 +260,7 @@
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
updateSize(data.getCount());
mAdapter.setContactCursor(data);
+ mMemberListView.setEmptyView(mEmptyView);
}
@Override