diff options
author | Andrew Lee <anwlee@google.com> | 2014-04-18 11:33:46 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-04-18 11:36:51 -0700 |
commit | 099592e51291f9b08abf775f1e5f43dcbc95a050 (patch) | |
tree | 97b11544007437a9da96db03222073c44f642974 | |
parent | b70f8a8f6e0016bbb1876a5127f635acd4568a05 (diff) |
Add favorites/star icon to the phone favorite tile view.
Bug: 14116267
Change-Id: Id4ea8dafcfe4fa46ab0ea7677cada4f2e64aff7a
-rw-r--r-- | res/layout/phone_favorite_tile_view.xml | 67 | ||||
-rw-r--r-- | res/values/dimens.xml | 2 | ||||
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteTileView.java | 10 |
3 files changed, 48 insertions, 31 deletions
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml index c48ace35f..8a9484412 100644 --- a/res/layout/phone_favorite_tile_view.xml +++ b/res/layout/phone_favorite_tile_view.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" - android:background="@drawable/ic_contacts_tiles"> + android:background="@drawable/ic_contacts_tiles" > <com.android.contacts.common.widget.LayoutSuppressingImageView android:id="@+id/contact_tile_image" @@ -35,7 +35,7 @@ android:id="@+id/shadow_overlay" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/shadow_contact_photo"/> + android:background="@drawable/shadow_contact_photo" /> <LinearLayout android:layout_width="match_parent" @@ -47,32 +47,43 @@ android:paddingBottom="@dimen/contact_tile_text_bottom_padding" android:layout_alignParentBottom="true" android:orientation="vertical" > - <TextView - android:id="@+id/contact_tile_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:textColor="@color/contact_tile_name_color" - android:fontFamily="sans-serif" - android:singleLine="true" - android:textSize="15sp" - android:fadingEdge="horizontal" - android:fadingEdgeLength="3dip" - android:ellipsize="marquee" - android:textAlignment="viewStart" /> - <TextView - android:id="@+id/contact_tile_phone_type" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:textColor="@color/contact_tile_name_color" - android:fontFamily="sans-serif" - android:singleLine="true" - android:textSize="11sp" - android:fadingEdge="horizontal" - android:fadingEdgeLength="3dip" - android:ellipsize="marquee" - android:textAlignment="viewStart" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <TextView + android:id="@+id/contact_tile_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:textColor="@color/contact_tile_name_color" + android:fontFamily="sans-serif" + android:singleLine="true" + android:textSize="15sp" + android:fadingEdge="horizontal" + android:fadingEdgeLength="3dip" + android:ellipsize="marquee" + android:textAlignment="viewStart" /> + <ImageView + android:id="@+id/contact_star_icon" + android:layout_width="@dimen/favorites_star_icon_size" + android:layout_height="@dimen/favorites_star_icon_size" + android:src="@drawable/star_thumbnail" + android:visibility="gone" /> + </LinearLayout> + <TextView + android:id="@+id/contact_tile_phone_type" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:textColor="@color/contact_tile_name_color" + android:fontFamily="sans-serif" + android:singleLine="true" + android:textSize="11sp" + android:fadingEdge="horizontal" + android:fadingEdgeLength="3dip" + android:ellipsize="marquee" + android:textAlignment="viewStart" /> </LinearLayout> <View android:id="@+id/contact_tile_push_state" diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 7eb2ea0f8..f113ac017 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -79,6 +79,8 @@ <dimen name="favorites_row_end_padding">1dp</dimen> <dimen name="favorites_row_undo_text_side_padding">32dp</dimen> <dimen name="recent_call_log_item_padding">8dp</dimen> + <!-- Size of the star icon on the favorites tile. --> + <dimen name="favorites_star_icon_size">20dp</dimen> <!-- Padding for the tooltip --> <dimen name="dismiss_button_padding_start">20dip</dimen> diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java index 047f381ae..7fe4eaa65 100644 --- a/src/com/android/dialer/list/PhoneFavoriteTileView.java +++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java @@ -21,6 +21,7 @@ import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.MoreContactUtils; @@ -87,17 +88,20 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { @Override public void loadFromContact(ContactEntry entry) { super.loadFromContact(entry); - mPhoneNumberString = null; // ... in case we're reusing the view + // Set phone number to null in case we're reusing the view. + mPhoneNumberString = null; if (entry != null) { - // Grab the phone-number to call directly... see {@link onClick()} + // Grab the phone-number to call directly. See {@link onClick()}. mPhoneNumberString = entry.phoneNumber; // 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 + // TODO krelease: Just hide the view for now. For this to truly look like an empty row // the entire ContactTileRow needs to be hidden. if (entry == ContactEntry.BLANK_ENTRY) { setVisibility(View.INVISIBLE); } else { + final ImageView starIcon = (ImageView) findViewById(R.id.contact_star_icon); + starIcon.setVisibility(entry.isFavorite ? View.VISIBLE : View.GONE); setVisibility(View.VISIBLE); } } |