diff options
author | Jin Cao <jinyan@google.com> | 2014-07-31 17:31:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-29 21:36:00 +0000 |
commit | fae9b8831eaa8a05943018fa40ceb1b95e4ec28b (patch) | |
tree | 032c595c5050e9fb0e90176d279b629887db9bd6 | |
parent | 5ee2110250911c3fa98a3edb49348b67145e6043 (diff) | |
parent | 4db8cccf3332ad7c6fb1915f9f0f169953c3953a (diff) | |
download | android_frameworks_opt_chips-fae9b8831eaa8a05943018fa40ceb1b95e4ec28b.tar.gz android_frameworks_opt_chips-fae9b8831eaa8a05943018fa40ceb1b95e4ec28b.tar.bz2 android_frameworks_opt_chips-fae9b8831eaa8a05943018fa40ceb1b95e4ec28b.zip |
Merge "[Quantum chips] add delete button in dropdown" into ub-chips-cranbrook
-rw-r--r-- | res/layout/chips_autocomplete_recipient_dropdown_item.xml | 18 | ||||
-rw-r--r-- | res/layout/chips_recipient_dropdown_item.xml | 18 | ||||
-rw-r--r-- | res/values-v17/styles.xml | 22 | ||||
-rw-r--r-- | res/values/styles.xml | 38 | ||||
-rw-r--r-- | src/com/android/ex/chips/CircularImageView.java | 17 | ||||
-rw-r--r-- | src/com/android/ex/chips/DropdownChipLayouter.java | 73 | ||||
-rw-r--r-- | src/com/android/ex/chips/RecipientAlternatesAdapter.java | 12 | ||||
-rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 42 | ||||
-rw-r--r-- | src/com/android/ex/chips/SingleRecipientArrayAdapter.java | 12 |
9 files changed, 172 insertions, 80 deletions
diff --git a/res/layout/chips_autocomplete_recipient_dropdown_item.xml b/res/layout/chips_autocomplete_recipient_dropdown_item.xml index 4f8427d..d3d0c8f 100644 --- a/res/layout/chips_autocomplete_recipient_dropdown_item.xml +++ b/res/layout/chips_autocomplete_recipient_dropdown_item.xml @@ -14,16 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/chip_dropdown_height" android:background="@drawable/chips_dropdown_background" style="@style/ChipAutocompleteWrapperStyle"> - <com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" /> + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:orientation="vertical"> + + <TextView style="@style/ChipTitleStyle" /> - <TextView style="@style/ChipTitleEndIconStyle" /> + <TextView style="@style/ChipSubtitleStyle" /> - <TextView style="@style/ChipSubtitleEndIconStyle" /> + </LinearLayout> + + <com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" /> -</RelativeLayout>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/chips_recipient_dropdown_item.xml b/res/layout/chips_recipient_dropdown_item.xml index ec0740b..8587baa 100644 --- a/res/layout/chips_recipient_dropdown_item.xml +++ b/res/layout/chips_recipient_dropdown_item.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/chip_dropdown_height" android:background="@drawable/chips_dropdown_background" @@ -22,8 +22,18 @@ <com.android.ex.chips.CircularImageView style="@style/ChipStartIconStyle" /> - <TextView style="@style/ChipTitleStartIconStyle" /> + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:orientation="vertical"> - <TextView style="@style/ChipSubtitleStartIconStyle" /> + <TextView style="@style/ChipTitleStyle" /> -</RelativeLayout>
\ No newline at end of file + <TextView style="@style/ChipSubtitleStyle" /> + + </LinearLayout> + + <com.android.ex.chips.CircularImageView style="@style/ChipDeleteIconStyle" /> + +</LinearLayout>
\ No newline at end of file diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml index 7674bad..f7b2477 100644 --- a/res/values-v17/styles.xml +++ b/res/values-v17/styles.xml @@ -21,29 +21,15 @@ <item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item> </style> - <style name="ChipTitleStartIconStyle" parent="@style/ChipTitleBaseStyle"> - <item name="android:layout_toEndOf">@android:id/icon</item> - </style> - - <style name="ChipTitleEndIconStyle" parent="@style/ChipTitleBaseStyle"> - <item name="android:layout_toStartOf">@android:id/icon</item> - </style> - - <style name="ChipSubtitleStartIconStyle" parent="@style/ChipSubtitleBaseStyle"> - <item name="android:layout_toEndOf">@android:id/icon</item> - </style> - - <style name="ChipSubtitleEndIconStyle" parent="@style/ChipSubtitleBaseStyle"> - <item name="android:layout_toStartOf">@android:id/icon</item> - </style> - <style name="ChipStartIconStyle" parent="@style/ChipIconBaseStyle"> <item name="android:layout_marginEnd">@dimen/chip_icon_margin_end</item> - <item name="android:layout_alignParentStart">true</item> </style> <style name="ChipEndIconStyle" parent="@style/ChipIconBaseStyle"> <item name="android:layout_marginStart">@dimen/chip_icon_margin_end</item> - <item name="android:layout_alignParentEnd">true</item> + </style> + + <style name="ChipDeleteIconStyle" parent="@style/ChipDeleteIconBaseStyle"> + <item name="android:paddingStart">20dp</item> </style> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 8b671d1..bdee911 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -39,46 +39,28 @@ <item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item> </style> - <style name="ChipTitleBaseStyle"> + <style name="ChipTitleStyle"> <item name="android:id">@android:id/title</item> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_gravity">center_vertical</item> <item name="android:ellipsize">middle</item> - <item name="android:paddingTop">1dp</item> <item name="android:singleLine">true</item> <item name="android:textColor">@color/chips_dropdown_title_text</item> <item name="android:textSize">16sp</item> </style> - <style name="ChipTitleStartIconStyle" parent="@style/ChipTitleBaseStyle"> - <item name="android:layout_toRightOf">@android:id/icon</item> - </style> - - <style name="ChipTitleEndIconStyle" parent="@style/ChipTitleBaseStyle"> - <item name="android:layout_toLeftOf">@android:id/icon</item> - </style> - - <style name="ChipSubtitleBaseStyle"> + <style name="ChipSubtitleStyle"> <item name="android:id">@android:id/text1</item> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> - <item name="android:layout_alignParentBottom">true</item> + <item name="android:layout_gravity">center_vertical</item> <item name="android:ellipsize">middle</item> - <item name="android:paddingBottom">1dp</item> <item name="android:singleLine">true</item> <item name="android:textColor">@color/chips_dropdown_subtitle_text</item> <item name="android:textSize">14sp</item> </style> - <style name="ChipSubtitleStartIconStyle" parent="@style/ChipSubtitleBaseStyle"> - <item name="android:layout_toRightOf">@android:id/icon</item> - </style> - - <style name="ChipSubtitleEndIconStyle" parent="@style/ChipSubtitleBaseStyle"> - <item name="android:layout_toLeftOf">@android:id/icon</item> - </style> - <style name="ChipIconBaseStyle"> <item name="android:id">@android:id/icon</item> <item name="android:layout_width">40dp</item> @@ -88,11 +70,21 @@ <style name="ChipStartIconStyle" parent="@style/ChipIconBaseStyle"> <item name="android:layout_marginRight">@dimen/chip_icon_margin_end</item> - <item name="android:layout_alignParentLeft">true</item> </style> <style name="ChipEndIconStyle" parent="@style/ChipIconBaseStyle"> <item name="android:layout_marginLeft">@dimen/chip_icon_margin_end</item> - <item name="android:layout_alignParentRight">true</item> + </style> + + <style name="ChipDeleteIconBaseStyle"> + <item name="android:id">@android:id/icon1</item> + <item name="android:layout_width">40dp</item> + <item name="android:layout_height">40dp</item> + <item name="android:paddingTop">10dp</item> + <item name="android:paddingBottom">10dp</item> + </style> + + <style name="ChipDeleteIconStyle" parent="@style/ChipDeleteIconBaseStyle"> + <item name="android:paddingLeft">20dp</item> </style> </resources> diff --git a/src/com/android/ex/chips/CircularImageView.java b/src/com/android/ex/chips/CircularImageView.java index 6f4d9f5..246cc96 100644 --- a/src/com/android/ex/chips/CircularImageView.java +++ b/src/com/android/ex/chips/CircularImageView.java @@ -10,6 +10,8 @@ import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.StateListDrawable; import android.util.AttributeSet; import android.widget.ImageView; @@ -55,7 +57,17 @@ public class CircularImageView extends ImageView { @Override protected void onDraw(Canvas canvas) { - BitmapDrawable bitmapDrawable = (BitmapDrawable) getDrawable(); + Drawable drawable = getDrawable(); + BitmapDrawable bitmapDrawable = null; + // support state list drawable by getting the current state + if (drawable instanceof StateListDrawable) { + if (((StateListDrawable) drawable).getCurrent() != null) { + bitmapDrawable = (BitmapDrawable) drawable.getCurrent(); + } + } else { + bitmapDrawable = (BitmapDrawable) drawable; + } + if (bitmapDrawable == null) { return; } @@ -65,7 +77,8 @@ public class CircularImageView extends ImageView { } source.set(0, 0, bitmap.getWidth(), bitmap.getHeight()); - destination.set(0, 0, getWidth(), getHeight()); + destination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), + getHeight() - getPaddingBottom()); drawBitmapWithCircleOnCanvas(bitmap, canvas, source, destination); } diff --git a/src/com/android/ex/chips/DropdownChipLayouter.java b/src/com/android/ex/chips/DropdownChipLayouter.java index afa25f8..3327833 100644 --- a/src/com/android/ex/chips/DropdownChipLayouter.java +++ b/src/com/android/ex/chips/DropdownChipLayouter.java @@ -3,7 +3,10 @@ package com.android.ex.chips; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.drawable.StateListDrawable; import android.net.Uri; +import android.support.annotation.DrawableRes; +import android.support.annotation.IdRes; import android.support.annotation.LayoutRes; import android.text.TextUtils; import android.text.util.Rfc822Tokenizer; @@ -29,19 +32,34 @@ public class DropdownChipLayouter { SINGLE_RECIPIENT } + public interface ChipDeleteListener { + void onChipDelete(); + } + private final LayoutInflater mInflater; private final Context mContext; + private ChipDeleteListener mDeleteListener; private Query mQuery; public DropdownChipLayouter(LayoutInflater inflater, Context context) { + this(inflater, context, null); + } + + public DropdownChipLayouter(LayoutInflater inflater, Context context, + ChipDeleteListener deleteListener) { mInflater = inflater; mContext = context; + mDeleteListener = deleteListener; } public void setQuery(Query query) { mQuery = query; } + public void setDeleteListener(ChipDeleteListener listener) { + mDeleteListener = listener; + } + /** * Layouts and binds recipient information to the view. If convertView is null, inflates a new @@ -58,18 +76,21 @@ public class DropdownChipLayouter { */ public View bindView(View convertView, ViewGroup parent, RecipientEntry entry, int position, AdapterType type, String constraint) { + return bindView(convertView, parent, entry, position, type, constraint, null); + } + + /** + * See {@link #bindView(View, ViewGroup, RecipientEntry, int, AdapterType, String)} + * @param deleteDrawable + */ + public View bindView(View convertView, ViewGroup parent, RecipientEntry entry, int position, + AdapterType type, String constraint, StateListDrawable deleteDrawable) { // Default to show all the information String displayName = entry.getDisplayName(); String destination = entry.getDestination(); boolean showImage = true; CharSequence destinationType = getDestinationType(entry); - // If we don't have name but have destination, show destination as the main entry. - if (displayName == null && destination != null) { - displayName = destination; - destination = null; - } - final View itemView = reuseOrInflateView(convertView, parent, type); final ViewHolder viewHolder = new ViewHolder(itemView); @@ -108,6 +129,7 @@ public class DropdownChipLayouter { bindTextToView(destination, viewHolder.destinationView); bindTextToView(destinationType, viewHolder.destinationTypeView); bindIconToView(showImage, entry, viewHolder.imageView, type); + bindDrawableToDeleteView(deleteDrawable, viewHolder.deleteView); return itemView; } @@ -193,6 +215,27 @@ public class DropdownChipLayouter { } } + protected void bindDrawableToDeleteView(final StateListDrawable drawable, ImageView view) { + if (view == null) { + return; + } + if (drawable == null) { + view.setVisibility(View.GONE); + } + + view.setImageDrawable(drawable); + if (mDeleteListener != null) { + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (drawable.getCurrent() != null) { + mDeleteListener.onChipDelete(); + } + } + }); + } + } + protected CharSequence getDestinationType(RecipientEntry entry) { return mQuery.getTypeLabel(mContext.getResources(), entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase(); @@ -238,7 +281,7 @@ public class DropdownChipLayouter { * Returns a resource ID representing an image which should be shown when ther's no relevant * photo is available. */ - protected int getDefaultPhotoResId() { + protected @DrawableRes int getDefaultPhotoResId() { return R.drawable.ic_contact_picture; } @@ -246,7 +289,7 @@ public class DropdownChipLayouter { * Returns an id for TextView in an item View for showing a display name. By default * {@link android.R.id#title} is returned. */ - protected int getDisplayNameResId() { + protected @IdRes int getDisplayNameResId() { return android.R.id.title; } @@ -255,7 +298,7 @@ public class DropdownChipLayouter { * (an email address or a phone number). * By default {@link android.R.id#text1} is returned. */ - protected int getDestinationResId() { + protected @IdRes int getDestinationResId() { return android.R.id.text1; } @@ -263,7 +306,7 @@ public class DropdownChipLayouter { * Returns an id for TextView in an item View for showing the type of the destination. * By default {@link android.R.id#text2} is returned. */ - protected int getDestinationTypeResId() { + protected @IdRes int getDestinationTypeResId() { return android.R.id.text2; } @@ -271,11 +314,17 @@ public class DropdownChipLayouter { * Returns an id for ImageView in an item View for showing photo image for a person. In default * {@link android.R.id#icon} is returned. */ - protected int getPhotoResId() { + protected @IdRes int getPhotoResId() { return android.R.id.icon; } /** + * Returns an id for ImageView in an item View for showing the delete button. In default + * {@link android.R.id#icon1} is returned. + */ + protected @IdRes int getDeleteResId() { return android.R.id.icon1; } + + /** * A holder class the view. Uses the getters in DropdownChipLayouter to find the id of the * corresponding views. */ @@ -284,12 +333,14 @@ public class DropdownChipLayouter { public final TextView destinationView; public final TextView destinationTypeView; public final ImageView imageView; + public final ImageView deleteView; public ViewHolder(View view) { displayNameView = (TextView) view.findViewById(getDisplayNameResId()); destinationView = (TextView) view.findViewById(getDestinationResId()); destinationTypeView = (TextView) view.findViewById(getDestinationTypeResId()); imageView = (ImageView) view.findViewById(getPhotoResId()); + deleteView = (ImageView) view.findViewById(getDeleteResId()); } } } diff --git a/src/com/android/ex/chips/RecipientAlternatesAdapter.java b/src/com/android/ex/chips/RecipientAlternatesAdapter.java index 10502b1..6569d36 100644 --- a/src/com/android/ex/chips/RecipientAlternatesAdapter.java +++ b/src/com/android/ex/chips/RecipientAlternatesAdapter.java @@ -21,6 +21,7 @@ import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; +import android.graphics.drawable.StateListDrawable; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; @@ -63,6 +64,7 @@ public class RecipientAlternatesAdapter extends CursorAdapter { public static final int QUERY_TYPE_PHONE = 1; private final Long mDirectoryId; private DropdownChipLayouter mDropdownChipLayouter; + private final StateListDrawable mDeleteDrawable; private static final Map<String, String> sCorrectedPhotoUris = new HashMap<String, String>(); @@ -359,6 +361,13 @@ public class RecipientAlternatesAdapter extends CursorAdapter { public RecipientAlternatesAdapter(Context context, long contactId, Long directoryId, String lookupKey, long currentId, int queryMode, OnCheckedItemChangedListener listener, DropdownChipLayouter dropdownChipLayouter) { + this(context, contactId, directoryId, lookupKey, currentId, queryMode, listener, + dropdownChipLayouter, null); + } + + public RecipientAlternatesAdapter(Context context, long contactId, Long directoryId, + String lookupKey, long currentId, int queryMode, OnCheckedItemChangedListener listener, + DropdownChipLayouter dropdownChipLayouter, StateListDrawable deleteDrawable) { super(context, getCursorForConstruction(context, contactId, directoryId, lookupKey, queryMode), 0); mCurrentId = currentId; @@ -366,6 +375,7 @@ public class RecipientAlternatesAdapter extends CursorAdapter { mCheckedItemChangedListener = listener; mDropdownChipLayouter = dropdownChipLayouter; + mDeleteDrawable = deleteDrawable; } private static Cursor getCursorForConstruction(Context context, long contactId, @@ -586,7 +596,7 @@ public class RecipientAlternatesAdapter extends CursorAdapter { RecipientEntry entry = getRecipientEntry(position); mDropdownChipLayouter.bindView(view, null, entry, position, - AdapterType.RECIPIENT_ALTERNATES, null); + AdapterType.RECIPIENT_ALTERNATES, null, mDeleteDrawable); } @Override diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java index fb8e81c..cad895a 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -40,6 +40,7 @@ import android.graphics.RectF; import android.graphics.Shader.TileMode; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.StateListDrawable; import android.os.AsyncTask; import android.os.Build; import android.os.Handler; @@ -110,7 +111,7 @@ import java.util.regex.Pattern; public class RecipientEditTextView extends MultiAutoCompleteTextView implements OnItemClickListener, Callback, RecipientAlternatesAdapter.OnCheckedItemChangedListener, GestureDetector.OnGestureListener, OnDismissListener, OnClickListener, - TextView.OnEditorActionListener { + TextView.OnEditorActionListener, DropdownChipLayouter.ChipDeleteListener { private static final char COMMIT_CHAR_COMMA = ','; @@ -329,7 +330,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements mGestureDetector = new GestureDetector(context, this); setOnEditorActionListener(this); - setDropdownChipLayouter(new DropdownChipLayouter(LayoutInflater.from(context), context)); + setDropdownChipLayouter(new DropdownChipLayouter(LayoutInflater.from(context), context, + this)); } private int calculateTextHeight() { @@ -640,12 +642,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements mChipBackgroundPressed); if (bitmapContainer.loadIcon) { - if (mDisableDelete) { - // Show the avatar instead if we don't want to delete - loadAvatarIcon(contact, bitmapContainer, paint); - } else { - drawIcon(bitmapContainer, ((BitmapDrawable) mChipDelete).getBitmap(), paint); - } + loadAvatarIcon(contact, bitmapContainer, paint); } return bitmapContainer.bitmap; @@ -1745,12 +1742,21 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private ListAdapter createAlternatesAdapter(DrawableRecipientChip chip) { return new RecipientAlternatesAdapter(getContext(), chip.getContactId(), chip.getDirectoryId(), chip.getLookupKey(), chip.getDataId(), - getAdapter().getQueryType(), this, mDropdownChipLayouter); + getAdapter().getQueryType(), this, mDropdownChipLayouter, + constructStateListDeleteDrawable()); } private ListAdapter createSingleAddressAdapter(DrawableRecipientChip currentChip) { return new SingleRecipientArrayAdapter(getContext(), currentChip.getEntry(), - mDropdownChipLayouter); + mDropdownChipLayouter, constructStateListDeleteDrawable()); + } + + private StateListDrawable constructStateListDeleteDrawable() { + // Construct the StateListDrawable from deleteDrawable + StateListDrawable deleteDrawable = new StateListDrawable(); + deleteDrawable.addState(new int[] { android.R.attr.state_activated }, mChipDelete); + deleteDrawable.addState(new int[0], null); + return deleteDrawable; } @Override @@ -1873,14 +1879,13 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements } private CharSequence createChip(RecipientEntry entry, boolean pressed) { - String displayText = createAddressText(entry); + final String displayText = createAddressText(entry); if (TextUtils.isEmpty(displayText)) { return null; } - SpannableString chipText = null; // Always leave a blank space at the end of a chip. - int textLength = displayText.length() - 1; - chipText = new SpannableString(displayText); + final int textLength = displayText.length() - 1; + final SpannableString chipText = new SpannableString(displayText); if (!mNoChips) { try { DrawableRecipientChip chip = constructChipSpan(entry, pressed); @@ -2333,6 +2338,15 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements (mAvatarPosition != AVATAR_POSITION_END && offset == getChipStart(chip))); } + @Override + public void onChipDelete() { + if (mSelectedChip != null) { + removeChip(mSelectedChip); + mAddressPopup.dismiss(); + mAlternatesPopup.dismiss(); + } + } + /** * Remove the chip and any text associated with it from the RecipientEditTextView. */ diff --git a/src/com/android/ex/chips/SingleRecipientArrayAdapter.java b/src/com/android/ex/chips/SingleRecipientArrayAdapter.java index 192aa20..f08746e 100644 --- a/src/com/android/ex/chips/SingleRecipientArrayAdapter.java +++ b/src/com/android/ex/chips/SingleRecipientArrayAdapter.java @@ -17,6 +17,7 @@ package com.android.ex.chips; import android.content.Context; +import android.graphics.drawable.StateListDrawable; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; @@ -25,19 +26,26 @@ import com.android.ex.chips.DropdownChipLayouter.AdapterType; class SingleRecipientArrayAdapter extends ArrayAdapter<RecipientEntry> { private final DropdownChipLayouter mDropdownChipLayouter; + private final StateListDrawable mDeleteDrawable; public SingleRecipientArrayAdapter(Context context, RecipientEntry entry, - DropdownChipLayouter dropdownChipLayouter) { + DropdownChipLayouter dropdownChipLayouter) { + this(context, entry, dropdownChipLayouter, null); + } + + public SingleRecipientArrayAdapter(Context context, RecipientEntry entry, + DropdownChipLayouter dropdownChipLayouter, StateListDrawable deleteDrawable) { super(context, dropdownChipLayouter.getAlternateItemLayoutResId(AdapterType.SINGLE_RECIPIENT), new RecipientEntry[] { entry }); mDropdownChipLayouter = dropdownChipLayouter; + mDeleteDrawable = deleteDrawable; } @Override public View getView(int position, View convertView, ViewGroup parent) { return mDropdownChipLayouter.bindView(convertView, parent, getItem(position), position, - AdapterType.SINGLE_RECIPIENT, null); + AdapterType.SINGLE_RECIPIENT, null, mDeleteDrawable); } } |