ContactSuggestionView.java revision 66ee1cc883f77fee930587503ecdcd8d18f12b23
1/* 2 * Copyright (C) 2009 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.quicksearchbox.ui; 18 19import com.android.quicksearchbox.R; 20import com.android.quicksearchbox.SuggestionCursor; 21 22import android.content.Context; 23import android.net.Uri; 24import android.util.AttributeSet; 25import android.widget.QuickContactBadge; 26 27/** 28 * View for contacts appearing in the suggestions list. 29 */ 30public class ContactSuggestionView extends DefaultSuggestionView { 31 32 private QuickContactBadge mQuickContact; 33 34 public ContactSuggestionView(Context context, AttributeSet attrs, int defStyle) { 35 super(context, attrs, defStyle); 36 } 37 38 public ContactSuggestionView(Context context, AttributeSet attrs) { 39 super(context, attrs); 40 } 41 42 public ContactSuggestionView(Context context) { 43 super(context); 44 } 45 46 @Override 47 protected void onFinishInflate() { 48 super.onFinishInflate(); 49 mQuickContact = (QuickContactBadge) findViewById(R.id.icon1); 50 } 51 52 @Override 53 public void bindAsSuggestion(SuggestionCursor suggestion, SuggestionClickListener onClick) { 54 super.bindAsSuggestion(suggestion, onClick); 55 mQuickContact.assignContactUri(Uri.parse(suggestion.getSuggestionIntentDataString())); 56 } 57}