SingleRecipientArrayAdapter.java revision 4ddcdaed9ef5ea83910a0513e87538130270e2e4
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.ex.chips; 18 19import android.content.Context; 20import android.view.View; 21import android.view.ViewGroup; 22import android.widget.ArrayAdapter; 23 24import com.android.ex.chips.DropdownChipLayouter.AdapterType; 25 26class SingleRecipientArrayAdapter extends ArrayAdapter<RecipientEntry> { 27 private final DropdownChipLayouter mDropdownChipLayouter; 28 29 public SingleRecipientArrayAdapter(Context context, RecipientEntry entry, 30 DropdownChipLayouter dropdownChipLayouter) { 31 super(context, 32 dropdownChipLayouter.getAlternateItemLayoutResId(AdapterType.SINGLE_RECIPIENT), 33 new RecipientEntry[] { entry }); 34 35 mDropdownChipLayouter = dropdownChipLayouter; 36 } 37 38 @Override 39 public View getView(int position, View convertView, ViewGroup parent) { 40 return mDropdownChipLayouter.bindView(convertView, parent, getItem(position), position, 41 AdapterType.SINGLE_RECIPIENT, null); 42 } 43} 44