101382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira/* 201382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * Copyright (C) 2011 The Android Open Source Project 301382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * 401382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * Licensed under the Apache License, Version 2.0 (the "License"); 501382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * you may not use this file except in compliance with the License. 601382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * You may obtain a copy of the License at 701382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * 801382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * http://www.apache.org/licenses/LICENSE-2.0 901382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * 1001382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * Unless required by applicable law or agreed to in writing, software 1101382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * distributed under the License is distributed on an "AS IS" BASIS, 1201382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1301382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * See the License for the specific language governing permissions and 1401382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira * limitations under the License. 1501382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira */ 1601382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 1701382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereirapackage com.android.ex.chips; 1801382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 1901382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereiraimport android.content.Context; 204db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Caoimport android.graphics.drawable.StateListDrawable; 2101382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereiraimport android.view.View; 2201382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereiraimport android.view.ViewGroup; 2301382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereiraimport android.widget.ArrayAdapter; 2401382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 25b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Linimport com.android.ex.chips.DropdownChipLayouter.AdapterType; 2601382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 27b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Linclass SingleRecipientArrayAdapter extends ArrayAdapter<RecipientEntry> { 28b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Lin private final DropdownChipLayouter mDropdownChipLayouter; 294db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao private final StateListDrawable mDeleteDrawable; 3001382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 31b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Lin public SingleRecipientArrayAdapter(Context context, RecipientEntry entry, 324db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao DropdownChipLayouter dropdownChipLayouter) { 334db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao this(context, entry, dropdownChipLayouter, null); 344db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao } 354db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao 364db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao public SingleRecipientArrayAdapter(Context context, RecipientEntry entry, 374db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao DropdownChipLayouter dropdownChipLayouter, StateListDrawable deleteDrawable) { 384ddcdaed9ef5ea83910a0513e87538130270e2e4Jin Cao super(context, 394ddcdaed9ef5ea83910a0513e87538130270e2e4Jin Cao dropdownChipLayouter.getAlternateItemLayoutResId(AdapterType.SINGLE_RECIPIENT), 404ddcdaed9ef5ea83910a0513e87538130270e2e4Jin Cao new RecipientEntry[] { entry }); 41b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Lin 42b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Lin mDropdownChipLayouter = dropdownChipLayouter; 434db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao mDeleteDrawable = deleteDrawable; 4401382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira } 4501382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira 4601382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira @Override 4701382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira public View getView(int position, View convertView, ViewGroup parent) { 48b10d1c652d0416c284d9792fc9a0a92b3acd51caKevin Lin return mDropdownChipLayouter.bindView(convertView, parent, getItem(position), position, 494db8cccf3332ad7c6fb1915f9f0f169953c3953aJin Cao AdapterType.SINGLE_RECIPIENT, null, mDeleteDrawable); 5001382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira } 5101382d764d2cbfbb4d2c1b554fe5c1ce1575dd26Mindy Pereira} 52