diff options
Diffstat (limited to 'java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java')
-rw-r--r-- | java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java index 537f488d5..fc0bd3ccf 100644 --- a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java +++ b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java @@ -19,6 +19,8 @@ package com.android.dialer.app.list; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; +import android.graphics.drawable.Drawable; +import android.support.v4.content.ContextCompat; import android.telephony.PhoneNumberUtils; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; @@ -29,7 +31,6 @@ import com.android.contacts.common.list.PhoneNumberListAdapter; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.app.R; import com.android.dialer.location.GeoUtil; -import com.android.dialer.util.CallUtil; /** * {@link PhoneNumberListAdapter} with the following added shortcuts, that are displayed as list @@ -50,7 +51,6 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT]; private final BidiFormatter mBidiFormatter = BidiFormatter.getInstance(); - private final boolean mVideoCallingEnabled; private final String mCountryIso; private String mFormattedQueryString; @@ -59,7 +59,6 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { super(context); mCountryIso = GeoUtil.getCurrentCountryIso(context); - mVideoCallingEnabled = CallUtil.isVideoEnabled(context); } @Override @@ -110,8 +109,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { return convertView; } else { final ContactListItemView v = - new ContactListItemView( - getContext(), null, mVideoCallingEnabled, isCallAndShareEnabled()); + new ContactListItemView(getContext(), null, mIsImsVideoEnabled); assignShortcutToView(v, shortcutType); return v; } @@ -125,8 +123,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { Context context, int partition, Cursor cursor, int position, ViewGroup parent) { final ContactListItemView view = super.newView(context, partition, cursor, position, parent); - view.setSupportVideoCallIcon(mVideoCallingEnabled); - view.setSupportCallAndShareIcon(isCallAndShareEnabled()); + view.setSupportVideoCallIcon(mIsImsVideoEnabled); return view; } @@ -171,7 +168,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { private void assignShortcutToView(ContactListItemView v, int shortcutType) { final CharSequence text; - final int drawableId; + final Drawable drawable; final Resources resources = getContext().getResources(); final String number = getFormattedQueryString(); switch (shortcutType) { @@ -181,34 +178,39 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { resources, R.string.search_shortcut_call_number, mBidiFormatter.unicodeWrap(number, TextDirectionHeuristics.LTR)); - drawableId = R.drawable.ic_search_phone; + drawable = ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_call_vd_theme_24); break; case SHORTCUT_CREATE_NEW_CONTACT: text = resources.getString(R.string.search_shortcut_create_new_contact); - drawableId = R.drawable.ic_search_add_contact; + drawable = + ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_person_add_vd_theme_24); + drawable.setAutoMirrored(true); break; case SHORTCUT_ADD_TO_EXISTING_CONTACT: text = resources.getString(R.string.search_shortcut_add_to_contact); - drawableId = R.drawable.quantum_ic_person_white_24; + drawable = + ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_person_add_vd_theme_24); break; case SHORTCUT_SEND_SMS_MESSAGE: text = resources.getString(R.string.search_shortcut_send_sms_message); - drawableId = R.drawable.quantum_ic_message_white_24; + drawable = + ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_message_vd_theme_24); break; case SHORTCUT_MAKE_VIDEO_CALL: text = resources.getString(R.string.search_shortcut_make_video_call); - drawableId = R.drawable.quantum_ic_videocam_white_24; + drawable = + ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_videocam_vd_theme_24); break; case SHORTCUT_BLOCK_NUMBER: text = resources.getString(R.string.search_shortcut_block_number); - drawableId = R.drawable.ic_not_interested_googblue_24dp; + drawable = + ContextCompat.getDrawable(getContext(), R.drawable.ic_not_interested_googblue_24dp); break; default: throw new IllegalArgumentException("Invalid shortcut type"); } - v.setDrawableResource(drawableId); + v.setDrawable(drawable); v.setDisplayName(text); - v.setPhotoPosition(super.getPhotoPosition()); v.setAdjustSelectionBoundsEnabled(false); } |