summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-09-24 14:27:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-24 14:27:58 +0000
commit99546e0a37b56097b9a868b638234687a9923ff6 (patch)
tree6e4d58c1cb01014a0da97e84820d7f070f20bb03
parent86ae214b357826f7e13ed9f93970e1fb2a628f44 (diff)
parent791082e22b50db98de6749bb5ef878d3ec483e28 (diff)
Merge "Add number type label to favorites list" into klp-dev
-rw-r--r--res/layout/phone_favorite_regular_row_view.xml15
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteRegularRowView.java4
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java39
3 files changed, 27 insertions, 31 deletions
diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml
index bf63642e6..c4c9c557a 100644
--- a/res/layout/phone_favorite_regular_row_view.xml
+++ b/res/layout/phone_favorite_regular_row_view.xml
@@ -53,6 +53,21 @@
android:ellipsize="marquee"
android:textAlignment="viewStart" />
+ <TextView
+ android:id="@+id/contact_tile_phone_type"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_below="@id/contact_tile_name"
+ android:layout_toRightOf="@id/contact_tile_quick"
+ android:layout_toEndOf="@id/contact_tile_quick"
+ android:textSize="12sp"
+ android:ellipsize="marquee"
+ android:singleLine="true"
+ android:textColor="@color/dialtacts_secondary_text_color"
+ android:layout_marginLeft="8dip"
+ android:layout_marginStart="8dip"
+ android:layout_gravity="bottom" />
+
</RelativeLayout>
<LinearLayout
diff --git a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
index b4ad78467..91b09d7d6 100644
--- a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
@@ -18,15 +18,11 @@ package com.android.dialer.list;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
-import android.view.GestureDetector;
import android.view.View;
import com.android.contacts.common.util.ViewUtil;
import com.android.dialer.R;
-import com.android.dialer.list.PhoneFavoritesTileAdapter.ContactTileRow;
-
-
public class PhoneFavoriteRegularRowView extends PhoneFavoriteTileView {
private static final String TAG = PhoneFavoriteRegularRowView.class.getSimpleName();
private static final boolean DEBUG = false;
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 2b232e869..6969f6f6c 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -106,16 +106,11 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
protected int mPresenceIndex;
protected int mStatusIndex;
- /**
- * Only valid when {@link DisplayType#STREQUENT_PHONE_ONLY} is true
- *
- * TODO krelease: Remove entirely if not needed
- */
private int mPhoneNumberIndex;
private int mPhoneNumberTypeIndex;
private int mPhoneNumberLabelIndex;
protected int mPinnedIndex;
- protected int mContactIdForFrequentIndex;
+ protected int mContactIdIndex;
private final int mPaddingInPixels;
@@ -209,7 +204,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
mPhoneNumberTypeIndex = ContactTileLoaderFactory.PHONE_NUMBER_TYPE;
mPhoneNumberLabelIndex = ContactTileLoaderFactory.PHONE_NUMBER_LABEL;
mPinnedIndex = ContactTileLoaderFactory.PINNED;
- mContactIdForFrequentIndex = ContactTileLoaderFactory.CONTACT_ID_FOR_FREQUENT;
+ mContactIdIndex = ContactTileLoaderFactory.CONTACT_ID_FOR_DATA;
}
/**
@@ -274,14 +269,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
final int starred = cursor.getInt(mStarredIndex);
final long id;
- if (starred > 0) {
- id = cursor.getLong(mIdIndex);
- } else if (counter >= TILES_SOFT_LIMIT) {
+ // We display a maximum of TILES_SOFT_LIMIT contacts, or the total number of starred
+ // whichever is greater.
+ if (starred < 1 && counter >= TILES_SOFT_LIMIT) {
break;
} else {
- // The contact id for frequent contacts is stored in the .contact_id field rather
- // than the _id field
- id = cursor.getLong(mContactIdForFrequentIndex);
+ id = cursor.getLong(mContactIdIndex);
}
if (duplicates.get(id) == null) {
@@ -305,20 +298,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
- // TODO krelease: These columns are temporarily unused for now so that
- // the contact tiles will be treated like favorites since they don't have a phone
- // number. Depending on how the final UX goes we will either remove or enable
- // them again.
-
- /*
- // Set phone number, label and status
- final int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex);
- final String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex);
- contact.phoneLabel = (String) Phone.getTypeLabel(mResources, phoneNumberType,
- phoneNumberCustomLabel);
- contact.phoneNumber = cursor.getString(mPhoneNumberIndex);
- contact.status = cursor.getString(mStatusIndex);
- */
+ // Set phone number, label and status
+ final int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex);
+ final String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex);
+ contact.phoneLabel = (String) Phone.getTypeLabel(mResources, phoneNumberType,
+ phoneNumberCustomLabel);
+ contact.phoneNumber = cursor.getString(mPhoneNumberIndex);
contact.pinned = pinned;
mContactEntries.add(contact);