summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-09-20 18:08:58 -0700
committerChristine Chen <christinech@google.com>2013-09-24 10:46:57 -0700
commit9bead9c01ab09ebfbd1c2be8555d8c8d4e3cf6bd (patch)
tree618fd13537fcd98d0ec6c585df7e22407d3e9812
parent99546e0a37b56097b9a868b638234687a9923ff6 (diff)
Adds star to indicate favorite contacts
- For squared tiles, stars will replace info icons when a contact is a favorite contact. And clicking on either star or info icon will bring up the quick contact card. Bug: 10862067 Change-Id: Ie0ad9e7e5969a70c3bafef5c2bb47fb84cd7ffdb
-rw-r--r--res/drawable-hdpi/ic_star_marked_as_fav.pngbin0 -> 1444 bytes
-rw-r--r--res/drawable-mdpi/ic_star_marked_as_fav.pngbin0 -> 964 bytes
-rw-r--r--res/drawable-xhdpi/ic_star_marked_as_fav.pngbin0 -> 1950 bytes
-rw-r--r--res/drawable-xxhdpi/ic_star_marked_as_fav.pngbin0 -> 2338 bytes
-rw-r--r--res/layout/phone_favorite_regular_row_view.xml14
-rw-r--r--res/layout/phone_favorite_tile_view.xml14
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteSquareTileView.java32
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteTileView.java6
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java6
9 files changed, 63 insertions, 9 deletions
diff --git a/res/drawable-hdpi/ic_star_marked_as_fav.png b/res/drawable-hdpi/ic_star_marked_as_fav.png
new file mode 100644
index 000000000..8a138c478
--- /dev/null
+++ b/res/drawable-hdpi/ic_star_marked_as_fav.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_star_marked_as_fav.png b/res/drawable-mdpi/ic_star_marked_as_fav.png
new file mode 100644
index 000000000..ee1b5ec1c
--- /dev/null
+++ b/res/drawable-mdpi/ic_star_marked_as_fav.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_star_marked_as_fav.png b/res/drawable-xhdpi/ic_star_marked_as_fav.png
new file mode 100644
index 000000000..372747a80
--- /dev/null
+++ b/res/drawable-xhdpi/ic_star_marked_as_fav.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_star_marked_as_fav.png b/res/drawable-xxhdpi/ic_star_marked_as_fav.png
new file mode 100644
index 000000000..3eeff4c05
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_star_marked_as_fav.png
Binary files differ
diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml
index c4c9c557a..b3c37d813 100644
--- a/res/layout/phone_favorite_regular_row_view.xml
+++ b/res/layout/phone_favorite_regular_row_view.xml
@@ -68,6 +68,20 @@
android:layout_marginStart="8dip"
android:layout_gravity="bottom" />
+ <ImageView
+ android:id="@+id/contact_favorite_star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignRight="@id/contact_tile_quick"
+ android:layout_alignEnd="@id/contact_tile_quick"
+ android:layout_alignBottom="@id/contact_tile_quick"
+ android:layout_marginRight="7dip"
+ android:layout_marginEnd="7dip"
+ android:layout_marginBottom="7dip"
+ android:layout_centerVertical="true"
+ android:src="@drawable/ic_star_marked_as_fav"
+ android:visibility="gone" />
+
</RelativeLayout>
<LinearLayout
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index 1117bdc88..1e79a109e 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -66,6 +66,20 @@
android:nextFocusRight="@+id/contact_tile_secondary_button"
android:background="?android:attr/selectableItemBackground" />
+ <ImageView
+ android:id="@+id/contact_favorite_star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignRight="@id/contact_tile_image"
+ android:layout_alignEnd="@id/contact_tile_image"
+ android:layout_alignBottom="@id/contact_tile_image"
+ android:layout_marginRight="7dip"
+ android:layout_marginEnd="7dip"
+ android:layout_marginBottom="7dip"
+ android:src="@drawable/ic_star_marked_as_fav"
+ android:visibility="gone" />
+
+
<ImageButton
android:id="@id/contact_tile_secondary_button"
android:src="@drawable/ic_contact_info"
diff --git a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
index e2548a3bf..85e721619 100644
--- a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
@@ -24,6 +24,7 @@ import android.view.View;
import android.widget.ImageButton;
import com.android.contacts.common.R;
+import com.android.contacts.common.list.ContactEntry;
import java.util.regex.Pattern;
@@ -48,12 +49,6 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
super.onFinishInflate();
mSecondaryButton = (ImageButton) findViewById(R.id.contact_tile_secondary_button);
- mSecondaryButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- launchQuickContact();
- }
- });
}
@Override
@@ -74,4 +69,29 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
if (tokens.length < 1) return name;
return tokens[0];
}
+
+ @Override
+ public void loadFromContact(ContactEntry entry) {
+ super.loadFromContact(entry);
+ if (entry != null) {
+ final boolean contactIsFavorite = entry.isFavorite;
+ mSecondaryButton.setVisibility(contactIsFavorite ? GONE : VISIBLE);
+
+ if (contactIsFavorite) {
+ mStarView.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ launchQuickContact();
+ }
+ });
+ } else {
+ mSecondaryButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ launchQuickContact();
+ }
+ });
+ }
+ }
+ }
}
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index 57d258f88..765745172 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -27,6 +27,7 @@ import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
+import android.widget.ImageView;
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.list.ContactEntry;
@@ -58,6 +59,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
private View mUndoRemovalButton;
/** The view that holds the list view row. */
protected ContactTileRow mParentRow;
+ /** The view that indicates whether the contact is a favorate. */
+ protected ImageView mStarView;
/** Users' most frequent phone number. */
private String mPhoneNumberString;
@@ -81,6 +84,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
mRemovalDialogue = findViewById(com.android.dialer.R.id.favorite_remove_dialogue);
mUndoRemovalButton = findViewById(com.android.dialer.R.id
.favorite_remove_undo_button);
+ mStarView = (ImageView) findViewById(com.android.dialer.R.id.contact_favorite_star);
mUndoRemovalButton.setOnClickListener(new OnClickListener() {
@Override
@@ -118,6 +122,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
if (entry != null) {
// Grab the phone-number to call directly... see {@link onClick()}
mPhoneNumberString = entry.phoneNumber;
+
+ mStarView.setVisibility(entry.isFavorite ? VISIBLE : GONE);
// If this is a blank entry, don't show anything.
// TODO krelease:Just hide the view for now. For this to truly look like an empty row
// the entire ContactTileRow needs to be hidden.
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 6969f6f6c..1247d35ed 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -287,6 +287,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
final String lookupKey = cursor.getString(mLookupIndex);
final int pinned = cursor.getInt(mPinnedIndex);
final String name = cursor.getString(mNameIndex);
+ final boolean isStarred = cursor.getInt(mStarredIndex) > 0;
final ContactEntry contact = new ContactEntry();
@@ -296,7 +297,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null);
contact.lookupKey = ContentUris.withAppendedId(
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
-
+ contact.isFavorite = isStarred;
// Set phone number, label and status
final int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex);
@@ -618,8 +619,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
if (changed && mDropEntryIndex < PIN_LIMIT) {
final ContentValues cv = getReflowedPinnedPositions(mContactEntries, mDraggedEntry,
mDraggedEntryIndex, mDropEntryIndex);
- final Uri pinUri = PinnedPositions.UPDATE_URI.buildUpon().appendQueryParameter(
- PinnedPositions.STAR_WHEN_PINNING, "true").build();
+ final Uri pinUri = PinnedPositions.UPDATE_URI.buildUpon().build();
// update the database here with the new pinned positions
mContext.getContentResolver().update(pinUri, cv, null, null);
}