Home | History | Annotate | Download | only in calendar
      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 
     17 package com.android.calendar;
     18 
     19 import com.android.ex.chips.BaseRecipientAdapter;
     20 
     21 import android.accounts.Account;
     22 import android.content.Context;
     23 
     24 public class RecipientAdapter extends BaseRecipientAdapter {
     25     public RecipientAdapter(Context context) {
     26         super(context);
     27     }
     28 
     29     /**
     30      * Set the account when known. Causes the search to prioritize contacts from
     31      * that account.
     32      */
     33     public void setAccount(Account account) {
     34         if (account != null) {
     35             // TODO: figure out how to infer the contacts account
     36             // type from the email account
     37             super.setAccount(new android.accounts.Account(account.name, "unknown"));
     38         }
     39     }
     40 
     41     @Override
     42     protected int getDefaultPhotoResource() {
     43         return R.drawable.ic_contact_picture;
     44     }
     45 
     46     @Override
     47     protected int getItemLayout() {
     48         return R.layout.chips_recipient_dropdown_item;
     49     }
     50 
     51     @Override
     52     protected int getWaitingForDirectorySearchLayout() {
     53         return R.layout.chips_waiting_for_directory_search;
     54     }
     55 }
     56