Home | History | Annotate | Download | only in ui
      1 /*
      2  * Copyright (C) 2012 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.mms.ui;
     18 
     19 import android.content.Context;
     20 
     21 import com.android.ex.chips.BaseRecipientAdapter;
     22 import com.android.mms.R;
     23 
     24 public class ChipsRecipientAdapter extends BaseRecipientAdapter {
     25     private static final int DEFAULT_PREFERRED_MAX_RESULT_COUNT = 10;
     26 
     27     public ChipsRecipientAdapter(Context context) {
     28         // The Chips UI is email-centric by default. By setting QUERY_TYPE_PHONE, the chips UI
     29         // will operate with phone numbers instead of emails.
     30         super(context, DEFAULT_PREFERRED_MAX_RESULT_COUNT, QUERY_TYPE_PHONE);
     31     }
     32 
     33     /**
     34      * Returns a layout id for each item inside auto-complete list.
     35      *
     36      * Each View must contain two TextViews (for display name and destination) and one ImageView
     37      * (for photo). Ids for those should be available via {@link #getDisplayNameId()},
     38      * {@link #getDestinationId()}, and {@link #getPhotoId()}.
     39      */
     40     @Override
     41     protected int getItemLayout() {
     42         return R.layout.mms_chips_recipient_dropdown_item;
     43     }
     44 
     45 }
     46