summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/no_favorites_banner.pngbin0 -> 7554 bytes
-rw-r--r--res/drawable-mdpi/no_favorites_banner.pngbin0 -> 4776 bytes
-rw-r--r--res/drawable-xhdpi/no_favorites_banner.pngbin0 -> 10881 bytes
-rw-r--r--res/drawable-xxhdpi/no_favorites_banner.pngbin0 -> 15409 bytes
-rw-r--r--res/layout/dialtacts_activity.xml5
-rw-r--r--res/layout/phone_favorites_fragment.xml35
-rw-r--r--res/layout/phone_no_favorites.xml42
-rw-r--r--res/values/colors.xml5
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java74
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java14
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java23
11 files changed, 142 insertions, 56 deletions
diff --git a/res/drawable-hdpi/no_favorites_banner.png b/res/drawable-hdpi/no_favorites_banner.png
new file mode 100644
index 000000000..5ab45ab46
--- /dev/null
+++ b/res/drawable-hdpi/no_favorites_banner.png
Binary files differ
diff --git a/res/drawable-mdpi/no_favorites_banner.png b/res/drawable-mdpi/no_favorites_banner.png
new file mode 100644
index 000000000..808d573e8
--- /dev/null
+++ b/res/drawable-mdpi/no_favorites_banner.png
Binary files differ
diff --git a/res/drawable-xhdpi/no_favorites_banner.png b/res/drawable-xhdpi/no_favorites_banner.png
new file mode 100644
index 000000000..da71882c3
--- /dev/null
+++ b/res/drawable-xhdpi/no_favorites_banner.png
Binary files differ
diff --git a/res/drawable-xxhdpi/no_favorites_banner.png b/res/drawable-xxhdpi/no_favorites_banner.png
new file mode 100644
index 000000000..518e8efbd
--- /dev/null
+++ b/res/drawable-xxhdpi/no_favorites_banner.png
Binary files differ
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index 9d63514c1..fe1e644b0 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -63,6 +63,11 @@
android:contentDescription="@string/description_start_voice_search"
android:background="?android:attr/selectableItemBackground" />
</LinearLayout>
+ <View
+ android:id="@+id/searchbox_divider"
+ android:layout_height="1dp"
+ android:layout_width="match_parent"
+ android:background="@color/background_dialer_light" />
<FrameLayout
android:layout_height="0dp"
android:layout_weight="1"
diff --git a/res/layout/phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml
index 4d3abf490..f518f0b92 100644
--- a/res/layout/phone_favorites_fragment.xml
+++ b/res/layout/phone_favorites_fragment.xml
@@ -15,19 +15,23 @@
-->
<!-- Use LinearLayout + FrameLayout, just to rely on android:divider and android:showDividers -->
-<LinearLayout
+<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="end"
android:clipChildren="false"
android:background="@color/background_dialer_light">
+
<FrameLayout
+ android:id="@+id/contact_tile_frame"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true">
+
<com.android.dialer.list.PhoneFavoriteListView
android:id="@+id/contact_tile_list"
android:layout_width="match_parent"
@@ -37,19 +41,22 @@
android:fadingEdge="none"
android:divider="@null" />
- <TextView
- android:id="@+id/contact_tile_list_empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:layout_marginTop="@dimen/empty_message_top_margin"
- android:textColor="?android:attr/textColorSecondary"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
-
<ImageView
android:id="@+id/contact_tile_drag_shadow_overlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</FrameLayout>
-</LinearLayout>
+
+ <include
+ android:id="@+id/phone_no_favorites_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@id/contact_tile_frame"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentBottom="true"
+ layout="@layout/phone_no_favorites"
+ android:visibility="gone"/>
+
+</RelativeLayout>
diff --git a/res/layout/phone_no_favorites.xml b/res/layout/phone_no_favorites.xml
index 9fa5d4781..e0635de2c 100644
--- a/res/layout/phone_no_favorites.xml
+++ b/res/layout/phone_no_favorites.xml
@@ -14,21 +14,53 @@
limitations under the License.
-->
-<FrameLayout
+<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:orientation="vertical"
android:minHeight="?android:attr/listPreferredItemHeight">
+ <ImageView
+ android:id="@+id/nofavorite_image"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_gravity="center"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:paddingTop="36dp"
+ android:paddingBottom="16dp"
+ android:src="@drawable/no_favorites_banner" />
+
+ <FrameLayout
+ android:id="@+id/show_all_contact_button_in_nofav_frame"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:background="@color/background_dialer_list_items">
+
+ <include
+ android:id="@+id/show_all_contact_button_in_nofav"
+ layout="@layout/show_all_contact_button" />
+ </FrameLayout>
+
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
android:gravity="center"
- android:text="@string/listTotalAllContactsZeroStarred"
+ android:layout_below="@id/nofavorite_image"
+ android:layout_above="@id/show_all_contact_button_in_nofav_frame"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:text="@string/no_favorites"
android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="?android:attr/textColorSecondary"
+ android:textColor="@color/nofavorite_text_color"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
-</FrameLayout>
+</RelativeLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index e64ea4ca9..3c3d41f53 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -67,4 +67,9 @@
<!-- Undo dialogue color -->
<color name="undo_dialogue_text_color">#4d4d4d</color>
+
+ <!-- Background color for no favorites state -->
+ <color name="nofavorite_background_color">#ffffff</color>
+ <!-- Text color for no favorites message -->
+ <color name="nofavorite_text_color">#a9a9a9</color>
</resources>
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 32ec71c26..aa81858f3 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -17,7 +17,9 @@ package com.android.dialer.list;
import android.animation.Animator;
import android.animation.AnimatorSet;
+import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Fragment;
import android.app.LoaderManager;
@@ -26,7 +28,6 @@ import android.content.CursorLoader;
import android.content.Loader;
import android.content.SharedPreferences;
import android.database.Cursor;
-import android.database.MatrixCursor;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
@@ -42,7 +43,6 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
-import android.widget.TextView;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactTileLoaderFactory;
@@ -128,6 +128,7 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (DEBUG) Log.d(TAG, "ContactTileLoaderListener#onLoadFinished");
mContactTileAdapter.setContactCursor(data);
+ setEmptyViewVisibility(mContactTileAdapter.getCount() == 0);
}
@Override
@@ -179,9 +180,12 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
private CallLogAdapter mCallLogAdapter;
private CallLogQueryHandler mCallLogQueryHandler;
+ private View mParentView;
+
private PhoneFavoriteListView mListView;
private View mShowAllContactsButton;
+ private View mShowAllContactsInEmptyViewButton;
private final HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>();
private final HashMap<Long, Integer> mItemIdLeftMap = new HashMap<Long, Integer>();
@@ -253,10 +257,9 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- final View listLayout = inflater.inflate(
- R.layout.phone_favorites_fragment, container, false);
+ mParentView = inflater.inflate(R.layout.phone_favorites_fragment, container, false);
- mListView = (PhoneFavoriteListView) listLayout.findViewById(R.id.contact_tile_list);
+ mListView = (PhoneFavoriteListView) mParentView.findViewById(R.id.contact_tile_list);
mListView.setItemsCanFocus(true);
mListView.setOnItemClickListener(this);
mListView.setVerticalScrollBarEnabled(false);
@@ -266,10 +269,19 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mListView.setOnDragDropListener(mContactTileAdapter);
final ImageView dragShadowOverlay =
- (ImageView) listLayout.findViewById(R.id.contact_tile_drag_shadow_overlay);
+ (ImageView) mParentView.findViewById(R.id.contact_tile_drag_shadow_overlay);
mListView.setDragShadowOverlay(dragShadowOverlay);
- mEmptyView = inflater.inflate(R.layout.phone_no_favorites, mListView, false);
+ mEmptyView = mParentView.findViewById(R.id.phone_no_favorites_view);
+
+ mShowAllContactsInEmptyViewButton = mParentView.findViewById(
+ R.id.show_all_contact_button_in_nofav);
+ mShowAllContactsInEmptyViewButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showAllContacts();
+ }
+ });
mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView,
false);
@@ -280,7 +292,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
}
});
- mContactTileAdapter.setEmptyView(mEmptyView);
mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), this, mContactTileAdapter,
mCallLogAdapter, mShowAllContactsButton);
@@ -290,7 +301,7 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mListView.setFastScrollEnabled(false);
mListView.setFastScrollAlwaysVisible(false);
- return listLayout;
+ return mParentView;
}
public boolean hasFrequents() {
@@ -298,6 +309,51 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
return mContactTileAdapter.getNumFrequents() > 0;
}
+ /* package */ void setEmptyViewVisibility(final boolean visible) {
+ final int previousVisibility = mEmptyView.getVisibility();
+ final int newVisibility = visible ? View.VISIBLE : View.GONE;
+
+ if (previousVisibility != newVisibility) {
+ Integer colorFrom = visible ?
+ getResources().getColor(R.color.background_dialer_light) :
+ getResources().getColor(R.color.nofavorite_background_color);
+ Integer colorTo = visible ?
+ getResources().getColor(R.color.nofavorite_background_color) :
+ getResources().getColor(R.color.background_dialer_light);
+ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
+ colorFrom, colorTo);
+ colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animator) {
+ mParentView.setBackgroundColor((Integer)animator.getAnimatedValue());
+ }
+ });
+ colorAnimation.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animator) {
+ if (!visible) {
+ mEmptyView.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animator) {
+ if (visible) {
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animator) {}
+
+ @Override
+ public void onAnimationRepeat(Animator animator) {}
+ });
+
+ colorAnimation.start();
+ }
+ }
+
@Override
public void onStart() {
super.onStart();
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index cf2aeeee9..334743774 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -116,14 +116,12 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
}
@Override
- public boolean isEmpty() {
- // This adapter will always contain at least the all contacts button
- return false;
- }
-
- @Override
public int getCount() {
- return mContactTileAdapter.getCount() + mCallLogAdapter.getCount() + 1;
+ if (mContactTileAdapter.getCount() > 0) {
+ return mContactTileAdapter.getCount() + mCallLogAdapter.getCount() + 1;
+ } else {
+ return mCallLogAdapter.getCount();
+ }
}
@Override
@@ -198,7 +196,7 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
public View getView(int position, View convertView, ViewGroup parent) {
final int callLogAdapterCount = mCallLogAdapter.getCount();
- if (position == getCount() - 1) {
+ if ((position == getCount() - 1) && (mContactTileAdapter.getCount() > 0)) {
return mShowAllContactsButton;
}
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 882d3c633..939a1eac3 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -73,8 +73,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
private Context mContext;
private Resources mResources;
- private View mEmptyView;
-
/** Contact data stored in cache. This is used to populate the associated view. */
protected ArrayList<ContactEntry> mContactEntries = null;
/** Back up of the temporarily removed Contact during dragging. */
@@ -362,15 +360,10 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
return mNumFrequents;
}
- private boolean isEmptyView(int position) {
- return position == 0 && (mContactEntries == null || mContactEntries.isEmpty());
- }
-
@Override
public int getCount() {
if (mContactEntries == null || mContactEntries.isEmpty()) {
- // empty view
- return 1;
+ return 0;
}
int total = mContactEntries.size();
@@ -493,7 +486,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
@Override
public boolean isEnabled(int position) {
- return !isEmptyView(position);
+ return getCount() > 0;
}
@Override
@@ -512,10 +505,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
int itemViewType = getItemViewType(position);
- if (itemViewType == ViewTypes.EMPTY) {
- return mEmptyView;
- }
-
ContactTileRow contactTileRowView = (ContactTileRow) convertView;
ArrayList<ContactEntry> contactList = getItem(position);
@@ -547,7 +536,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
@Override
public int getItemViewType(int position) {
- if (isEmptyView(position)) return ViewTypes.EMPTY;
if (position < getRowCount(getMaxContactsInTiles())) {
return ViewTypes.TOP;
} else {
@@ -1164,10 +1152,9 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
}
protected static class ViewTypes {
- public static final int COUNT = 3;
public static final int FREQUENT = 0;
public static final int TOP = 1;
- public static final int EMPTY = 2;
+ public static final int COUNT = 2;
}
@Override
@@ -1216,8 +1203,4 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
setInDragging(false);
handleDrop();
}
-
- public void setEmptyView(View emptyView) {
- mEmptyView = emptyView;
- }
}