public void setDropdownChipLayouter(DropdownChipLayouter dropdownChipLayouter) { mDropdownChipLayouter = dropdownChipLayouter; mDropdownChipLayouter.setQuery(mQueryMode); mDropdownChipLayouter.setSuggestionsListener( new ChipSuggestionsListener() { @Override public void onDeleteSuggestionRequest(RecipientEntry entry, View v) { onDeleteSuggestion(entry, new SuggestionRemoveCallback(entry, v)); } @Override public void onAddSuggestionRequest(RecipientEntry entry, View v) { onAddSuggestion(entry, new SuggestionAddCallback(entry, v)); } }); }
@Override public void bindView(View view, Context context, Cursor cursor) { int position = cursor.getPosition(); RecipientEntry entry = getRecipientEntry(position); mDropdownChipLayouter.bindView( view, null, entry, position, AdapterType.RECIPIENT_ALTERNATES, null, mDeleteDrawable); }
@Override public View getView(int position, View convertView, ViewGroup parent) { final RecipientEntry entry = getEntries().get(position); final String constraint = mCurrentConstraint == null ? null : mCurrentConstraint.toString(); return mDropdownChipLayouter.bindView( convertView, parent, entry, position, AdapterType.BASE_RECIPIENT, constraint); }
@Override public View getView(int position, View convertView, ViewGroup parent) { Cursor cursor = getCursor(); cursor.moveToPosition(position); if (convertView == null) { convertView = mDropdownChipLayouter.newView(AdapterType.RECIPIENT_ALTERNATES); } if (cursor.getLong(Queries.Query.DATA_ID) == mCurrentId) { mCheckedItemPosition = position; if (mCheckedItemChangedListener != null) { mCheckedItemChangedListener.onCheckedItemChanged(mCheckedItemPosition); } } bindView(convertView, convertView.getContext(), cursor); return convertView; }
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { return mDropdownChipLayouter.newView(AdapterType.RECIPIENT_ALTERNATES); }