ContactsSource.java revision 5229b06f00d20aac76cd8519b37f2a579d61c54f
15229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood/* 25229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Copyright (C) 2010 The Android Open Source Project 35229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 45229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Licensed under the Apache License, Version 2.0 (the "License"); 55229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * you may not use this file except in compliance with the License. 65229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * You may obtain a copy of the License at 75229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 85229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * http://www.apache.org/licenses/LICENSE-2.0 95229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 105229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Unless required by applicable law or agreed to in writing, software 115229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * distributed under the License is distributed on an "AS IS" BASIS, 125229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * See the License for the specific language governing permissions and 145229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * limitations under the License. 155229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood */ 165229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodpackage com.android.quicksearchbox; 175229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 185229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport com.android.quicksearchbox.ui.ContactSuggestionView; 195229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport com.android.quicksearchbox.ui.SuggestionViewFactory; 205229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport com.android.quicksearchbox.ui.SuggestionViewInflater; 215229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 225229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport android.app.SearchableInfo; 235229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport android.content.Context; 245229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport android.content.pm.PackageManager.NameNotFoundException; 255229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 265229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood/** 275229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Special case SearchableSource for contacts to provide the custom contacts suggestion view. 285229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood */ 295229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodpublic class ContactsSource extends SearchableSource { 305229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 315229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood public ContactsSource(Context context, SearchableInfo searchable) throws NameNotFoundException { 325229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood super(context, searchable); 335229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 345229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 355229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood @Override 365229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood public SuggestionViewFactory createSuggestionViewFactory() { 375229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood return new SuggestionViewInflater(ContactSuggestionView.VIEW_ID, 385229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood ContactSuggestionView.class, R.layout.contact_suggestion, getContext()); 395229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 405229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 415229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood} 42