RecipientAdapter.java revision d5109cf7f08a76efca11e81dfb5f08fcf54c4233
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.email;
18
19import com.android.ex.chips.BaseRecipientAdapter;
20import com.android.ex.chips.RecipientEditTextView;
21
22import android.accounts.Account;
23import android.content.Context;
24
25public class RecipientAdapter extends BaseRecipientAdapter {
26    public RecipientAdapter(Context context, RecipientEditTextView list) {
27        super(context);
28    }
29
30    /**
31     * Set the account when known. Causes the search to prioritize contacts from
32     * that account.
33     */
34    public void setAccount(Account account) {
35        if (account != null) {
36            // TODO: figure out how to infer the contacts account
37            // type from the email account
38            super.setAccount(new android.accounts.Account(account.name, "unknown"));
39        }
40    }
41}
42