Add illustrations to empty state and change string
Screenshots:
https://drive.google.com/a/google.com/folderview?id=0BwSNbQ_IWQd2eVNZa3JJTzFSdGM&usp=sharing
Bug: 20298591
Change-Id: I810a8a582477ad9abf2f6ceba91f0129d64d213d
diff --git a/res/drawable-hdpi/ic_person_black_128dp.png b/res/drawable-hdpi/ic_person_black_128dp.png
new file mode 100644
index 0000000..93b7886
--- /dev/null
+++ b/res/drawable-hdpi/ic_person_black_128dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_star_black_128dp.png b/res/drawable-hdpi/ic_star_black_128dp.png
new file mode 100644
index 0000000..a0cb1c1
--- /dev/null
+++ b/res/drawable-hdpi/ic_star_black_128dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_person_black_128dp.png b/res/drawable-mdpi/ic_person_black_128dp.png
new file mode 100644
index 0000000..4da7118
--- /dev/null
+++ b/res/drawable-mdpi/ic_person_black_128dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_star_black_128dp.png b/res/drawable-mdpi/ic_star_black_128dp.png
new file mode 100644
index 0000000..1ba2792
--- /dev/null
+++ b/res/drawable-mdpi/ic_star_black_128dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_person_black_128dp.png b/res/drawable-xhdpi/ic_person_black_128dp.png
new file mode 100644
index 0000000..04445b6
--- /dev/null
+++ b/res/drawable-xhdpi/ic_person_black_128dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_star_black_128dp.png b/res/drawable-xhdpi/ic_star_black_128dp.png
new file mode 100644
index 0000000..842ce10
--- /dev/null
+++ b/res/drawable-xhdpi/ic_star_black_128dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_person_black_128dp.png b/res/drawable-xxhdpi/ic_person_black_128dp.png
new file mode 100644
index 0000000..3c40711
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_person_black_128dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_star_black_128dp.png b/res/drawable-xxhdpi/ic_star_black_128dp.png
new file mode 100644
index 0000000..f7d0eb0
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_star_black_128dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_person_black_128dp.png b/res/drawable-xxxhdpi/ic_person_black_128dp.png
new file mode 100644
index 0000000..1d94d5f
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_person_black_128dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_star_black_128dp.png b/res/drawable-xxxhdpi/ic_star_black_128dp.png
new file mode 100644
index 0000000..49f9e8b
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_star_black_128dp.png
Binary files differ
diff --git a/res/layout-land/contacts_unavailable_fragment_content.xml b/res/layout-land/contacts_unavailable_fragment_content.xml
new file mode 100644
index 0000000..05e4919
--- /dev/null
+++ b/res/layout-land/contacts_unavailable_fragment_content.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal">
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_marginLeft="44dip"
+ android:layout_marginRight="44dip"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_marginLeft="48dip"
+ android:layout_marginRight="48dip"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/empty_image"
+ android:layout_height="128dp"
+ android:layout_width="128dp"
+ android:layout_marginTop="56dip"
+ android:alpha="0.38"
+ android:gravity="center_horizontal"/>
+
+ <TextView
+ android:id="@+id/message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="6dip"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textIsSelectable="false"/>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <Button
+ android:id="@+id/add_account_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="72dip"
+ android:layout_marginBottom="20dip"
+ android:textColor="@android:color/white"
+ android:text="@string/contacts_unavailable_add_account" />
+
+ <Button
+ android:id="@+id/import_contacts_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="15dip"
+ android:textColor="@android:color/white"
+ android:text="@string/contacts_unavailable_import_contacts" />
+
+ <ProgressBar
+ android:id="@+id/progress"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginBottom="15dip" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_marginLeft="44dip"
+ android:layout_marginRight="44dip"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
+
+</LinearLayout>
diff --git a/res/layout/contact_tile_list.xml b/res/layout/contact_tile_list.xml
index e941617..8b172d1 100644
--- a/res/layout/contact_tile_list.xml
+++ b/res/layout/contact_tile_list.xml
@@ -39,7 +39,11 @@
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_marginTop="@dimen/empty_message_top_margin"
- android:textColor="?android:attr/textColorSecondary"
+ android:textColor="@android:color/black"
+ android:drawableTop="@drawable/ic_star_black_128dp"
+ android:drawablePadding="4dp"
+ android:alpha="0.38"
+ android:paddingTop="10dp"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</FrameLayout>
diff --git a/res/layout/contacts_unavailable_fragment_content.xml b/res/layout/contacts_unavailable_fragment_content.xml
index 4f54801..32636b4 100644
--- a/res/layout/contacts_unavailable_fragment_content.xml
+++ b/res/layout/contacts_unavailable_fragment_content.xml
@@ -20,43 +20,38 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
+
+ <ImageView
+ android:id="@+id/empty_image"
+ android:layout_height="128dp"
+ android:layout_width="128dp"
+ android:layout_marginTop="56dip"
+ android:alpha="0.38"
+ android:gravity="center_horizontal" />
+
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="48dip"
+ android:layout_marginTop="6dip"
android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="?android:attr/textColorSecondary" />
-
- <TextView
- android:id="@+id/secondary_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:layout_gravity="center_horizontal"
- android:layout_marginBottom="@dimen/no_accounts_message_margin" />
+ android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginLeft="48dip"
android:layout_marginRight="48dip"
- android:layout_marginStart="48dip"
- android:layout_marginEnd="48dip"
+
android:layout_width="wrap_content"
android:layout_height="match_parent">
- <Button
- android:id="@+id/create_contact_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="15dip"
- android:text="@string/contacts_unavailable_create_contact" />
<Button
android:id="@+id/add_account_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginTop="24dip"
android:layout_marginBottom="15dip"
+ android:textColor="@android:color/white"
android:text="@string/contacts_unavailable_add_account" />
<Button
@@ -64,6 +59,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dip"
+ android:textColor="@android:color/white"
android:text="@string/contacts_unavailable_import_contacts" />
<ProgressBar
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1104a24..7c93df8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -255,7 +255,7 @@
<string name="removePhoto">Remove photo</string>
<!-- The text displayed when the contacts list is empty while displaying all contacts [CHAR LIMIT=NONE] -->
- <string name="noContacts">No contacts.</string>
+ <string name="noContacts">No contacts</string>
<!-- The text displayed when the groups list is empty while displaying all groups [CHAR LIMIT=NONE] -->
<string name="noGroups">No groups.</string>
@@ -544,7 +544,7 @@
<!-- Button shown on the main contacts screen when there are no contacts on the device.
Navigates to account setup [CHAR LIMIT=128] -->
- <string name="contacts_unavailable_add_account">Sign in to an account</string>
+ <string name="contacts_unavailable_add_account">Add account</string>
<!-- Button shown on the main contacts screen when there are no contacts on the device.
Initiates a contact import dialog [CHAR LIMIT=128] -->
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 26add9d..473ed5c 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -627,11 +627,11 @@
if (mContactsUnavailableFragment != null) {
switch (getTabPositionForTextDirection(tab)) {
case TabState.FAVORITES:
- mContactsUnavailableFragment.setMessageText(
- R.string.listTotalAllContactsZeroStarred, -1);
+ mContactsUnavailableFragment.setTabInfo(
+ R.string.listTotalAllContactsZeroStarred, TabState.FAVORITES);
break;
case TabState.ALL:
- mContactsUnavailableFragment.setMessageText(R.string.noContacts, -1);
+ mContactsUnavailableFragment.setTabInfo(R.string.noContacts, TabState.ALL);
break;
}
// When using the mContactsUnavailableFragment the ViewPager doesn't contain two views.
diff --git a/src/com/android/contacts/list/ContactsUnavailableFragment.java b/src/com/android/contacts/list/ContactsUnavailableFragment.java
index c1b2c41..bd811b2 100644
--- a/src/com/android/contacts/list/ContactsUnavailableFragment.java
+++ b/src/com/android/contacts/list/ContactsUnavailableFragment.java
@@ -16,18 +16,21 @@
package com.android.contacts.list;
import android.app.Fragment;
-import android.content.Context;
+import android.graphics.PorterDuff;
import android.os.Bundle;
import android.provider.ContactsContract.ProviderStatus;
+import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.android.contacts.activities.ActionBarAdapter.TabState;
import com.android.contacts.R;
/**
@@ -37,14 +40,13 @@
public class ContactsUnavailableFragment extends Fragment implements OnClickListener {
private View mView;
+ private ImageView mImageView;
private TextView mMessageView;
- private TextView mSecondaryMessageView;
- private Button mCreateContactButton;
private Button mAddAccountButton;
private Button mImportContactsButton;
private ProgressBar mProgress;
private int mNoContactsMsgResId = -1;
- private int mNSecNoContactsMsgResId = -1;
+ private int mLastTab = -1;
private OnContactsUnavailableActionListener mListener;
@@ -59,14 +61,18 @@
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.contacts_unavailable_fragment, null);
+
+ mImageView = (ImageView) mView.findViewById(R.id.empty_image);
+
mMessageView = (TextView) mView.findViewById(R.id.message);
- mSecondaryMessageView = (TextView) mView.findViewById(R.id.secondary_message);
- mCreateContactButton = (Button) mView.findViewById(R.id.create_contact_button);
- mCreateContactButton.setOnClickListener(this);
mAddAccountButton = (Button) mView.findViewById(R.id.add_account_button);
mAddAccountButton.setOnClickListener(this);
+ mAddAccountButton.getBackground().setColorFilter(ContextCompat.getColor(getContext(), R
+ .color.primary_color), PorterDuff.Mode.MULTIPLY);
mImportContactsButton = (Button) mView.findViewById(R.id.import_contacts_button);
mImportContactsButton.setOnClickListener(this);
+ mImportContactsButton.getBackground().setColorFilter(ContextCompat.getColor(getContext(),
+ R.color.primary_color), PorterDuff.Mode.MULTIPLY);
mProgress = (ProgressBar) mView.findViewById(R.id.progress);
if (mProviderStatus != null) {
@@ -89,10 +95,11 @@
}
switch (providerStatus) {
case ProviderStatus.STATUS_EMPTY:
- setMessageText(mNoContactsMsgResId, mNSecNoContactsMsgResId);
- mCreateContactButton.setVisibility(View.VISIBLE);
- mAddAccountButton.setVisibility(View.VISIBLE);
- mImportContactsButton.setVisibility(View.VISIBLE);
+ setTabInfo(mNoContactsMsgResId, mLastTab);
+ if (mLastTab == TabState.ALL) {
+ mAddAccountButton.setVisibility(View.VISIBLE);
+ mImportContactsButton.setVisibility(View.VISIBLE);
+ }
mProgress.setVisibility(View.GONE);
break;
@@ -100,7 +107,6 @@
mMessageView.setText(R.string.upgrade_in_progress);
mMessageView.setGravity(Gravity.CENTER_HORIZONTAL);
mMessageView.setVisibility(View.VISIBLE);
- mCreateContactButton.setVisibility(View.GONE);
mAddAccountButton.setVisibility(View.GONE);
mImportContactsButton.setVisibility(View.GONE);
mProgress.setVisibility(View.VISIBLE);
@@ -114,9 +120,6 @@
return;
}
switch (v.getId()) {
- case R.id.create_contact_button:
- mListener.onCreateNewContactAction();
- break;
case R.id.add_account_button:
mListener.onAddAccountAction();
break;
@@ -130,24 +133,26 @@
*
* @param resId - String resource ID of the message , -1 means view will not be visible
*/
- public void setMessageText(int resId, int secResId) {
+ public void setTabInfo(int resId, int callerTab) {
mNoContactsMsgResId = resId;
- mNSecNoContactsMsgResId = secResId;
+ mLastTab = callerTab;
if ((mMessageView != null) && (mProviderStatus != null) &&
(mProviderStatus.equals(ProviderStatus.STATUS_EMPTY))) {
if (resId != -1) {
mMessageView.setText(mNoContactsMsgResId);
mMessageView.setGravity(Gravity.CENTER_HORIZONTAL);
mMessageView.setVisibility(View.VISIBLE);
- if (secResId != -1) {
- mSecondaryMessageView.setText(mNSecNoContactsMsgResId);
- mSecondaryMessageView.setGravity(Gravity.CENTER_HORIZONTAL);
- mSecondaryMessageView.setVisibility(View.VISIBLE);
- } else {
- mSecondaryMessageView.setVisibility(View.INVISIBLE);
+ if (callerTab == TabState.FAVORITES) {
+ mImageView.setImageResource(R.drawable.ic_star_black_128dp);
+ mAddAccountButton.setVisibility(View.GONE);
+ mImportContactsButton.setVisibility(View.GONE);
+ mProgress.setVisibility(View.GONE);
+ } else if (callerTab == TabState.ALL) {
+ mImageView.setImageResource(R.drawable.ic_person_black_128dp);
+ mAddAccountButton.setVisibility(View.VISIBLE);
+ mImportContactsButton.setVisibility(View.VISIBLE);
}
} else {
- mSecondaryMessageView.setVisibility(View.GONE);
mMessageView.setVisibility(View.GONE);
}
}