blob: f87f8a48fa435a380b89a9f3452b13f7b2edf674 [file] [log] [blame]
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -08001/*
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.contacts;
18
Amith Yamasani8bbe2f22009-03-24 21:24:12 -070019import com.android.internal.telephony.CallerInfo;
20
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080021import android.app.ListActivity;
22import android.content.ContentResolver;
23import android.content.ContentUris;
24import android.content.Context;
25import android.content.Intent;
26import android.content.res.Resources;
27import android.database.Cursor;
28import android.net.Uri;
29import android.os.Bundle;
30import android.provider.CallLog;
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080031import android.provider.CallLog.Calls;
Flavio Lerda9cafe472011-06-08 14:06:13 +010032import android.provider.Contacts.Intents.Insert;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070033import android.provider.ContactsContract.Contacts;
34import android.provider.ContactsContract.PhoneLookup;
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080035import android.telephony.PhoneNumberUtils;
36import android.telephony.TelephonyManager;
37import android.text.TextUtils;
38import android.text.format.DateUtils;
39import android.view.KeyEvent;
40import android.view.LayoutInflater;
41import android.view.View;
42import android.view.ViewGroup;
43import android.widget.AdapterView;
44import android.widget.BaseAdapter;
45import android.widget.ImageView;
46import android.widget.TextView;
47import android.widget.Toast;
48
49import java.util.ArrayList;
50import java.util.List;
51
52/**
53 * Displays the details of a specific call log entry.
54 */
55public class CallDetailActivity extends ListActivity implements
56 AdapterView.OnItemClickListener {
57 private static final String TAG = "CallDetail";
58
Flavio Lerdaa024c3f2011-06-10 10:47:07 +010059 /** The views representing the details of a phone call. */
Flavio Lerdaafb93bb2011-07-05 14:46:10 +010060 private PhoneCallDetailsViews mPhoneCallDetailsViews;
61 private PhoneCallDetailsHelper mPhoneCallDetailsHelper;
Flavio Lerda9cafe472011-06-08 14:06:13 +010062 private TextView mCallTimeView;
63 private TextView mCallDurationView;
64 private View mCallActionView;
65 private ImageView mContactPhotoView;
66 private ImageView mContactBackgroundView;
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080067
68 private String mNumber = null;
Bai Tao09eb04f2010-09-01 15:34:16 +080069 private String mDefaultCountryIso;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070070
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080071 /* package */ LayoutInflater mInflater;
72 /* package */ Resources mResources;
Flavio Lerda9cafe472011-06-08 14:06:13 +010073 /** Helper to load contact photos. */
74 private ContactPhotoManager mContactPhotoManager;
75 /** Attached to the call action button in the UI. */
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070076
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080077 static final String[] CALL_LOG_PROJECTION = new String[] {
78 CallLog.Calls.DATE,
79 CallLog.Calls.DURATION,
80 CallLog.Calls.NUMBER,
81 CallLog.Calls.TYPE,
Bai Tao09eb04f2010-09-01 15:34:16 +080082 CallLog.Calls.COUNTRY_ISO,
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080083 };
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070084
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080085 static final int DATE_COLUMN_INDEX = 0;
86 static final int DURATION_COLUMN_INDEX = 1;
87 static final int NUMBER_COLUMN_INDEX = 2;
88 static final int CALL_TYPE_COLUMN_INDEX = 3;
Bai Tao09eb04f2010-09-01 15:34:16 +080089 static final int COUNTRY_ISO_COLUMN_INDEX = 4;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070090
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080091 static final String[] PHONES_PROJECTION = new String[] {
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -070092 PhoneLookup._ID,
93 PhoneLookup.DISPLAY_NAME,
94 PhoneLookup.TYPE,
95 PhoneLookup.LABEL,
96 PhoneLookup.NUMBER,
Bai Tao09eb04f2010-09-01 15:34:16 +080097 PhoneLookup.NORMALIZED_NUMBER,
Flavio Lerda9cafe472011-06-08 14:06:13 +010098 PhoneLookup.PHOTO_ID,
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -080099 };
100 static final int COLUMN_INDEX_ID = 0;
101 static final int COLUMN_INDEX_NAME = 1;
102 static final int COLUMN_INDEX_TYPE = 2;
103 static final int COLUMN_INDEX_LABEL = 3;
104 static final int COLUMN_INDEX_NUMBER = 4;
Bai Tao09eb04f2010-09-01 15:34:16 +0800105 static final int COLUMN_INDEX_NORMALIZED_NUMBER = 5;
Flavio Lerda9cafe472011-06-08 14:06:13 +0100106 static final int COLUMN_INDEX_PHOTO_ID = 6;
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800107
108 @Override
109 protected void onCreate(Bundle icicle) {
110 super.onCreate(icicle);
111
112 setContentView(R.layout.call_detail);
113
114 mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
115 mResources = getResources();
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700116
Flavio Lerda696e8132011-07-05 19:00:23 +0100117 mPhoneCallDetailsViews = PhoneCallDetailsViews.fromView(getWindow().getDecorView());
Flavio Lerda7d7473a2011-07-06 14:21:46 +0100118 mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(this, getResources(),
119 getVoicemailNumber(),
120 getResources().getDrawable(R.drawable.ic_call_log_list_incoming_call),
121 getResources().getDrawable(R.drawable.ic_call_log_list_outgoing_call),
122 getResources().getDrawable(R.drawable.ic_call_log_list_missed_call),
123 getResources().getDrawable(R.drawable.ic_call_log_list_voicemail));
Flavio Lerda9cafe472011-06-08 14:06:13 +0100124 mCallActionView = findViewById(R.id.call);
125 mContactPhotoView = (ImageView) findViewById(R.id.contact_photo);
126 mContactBackgroundView = (ImageView) findViewById(R.id.contact_background);
127 mCallTimeView = (TextView) findViewById(R.id.time);
128 mCallDurationView = (TextView) findViewById(R.id.duration);
Bai Tao09eb04f2010-09-01 15:34:16 +0800129 mDefaultCountryIso = ContactsUtils.getCurrentCountryIso(this);
Flavio Lerda9cafe472011-06-08 14:06:13 +0100130 mContactPhotoManager = ContactPhotoManager.getInstance(this);
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800131 getListView().setOnItemClickListener(this);
132 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700133
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800134 @Override
135 public void onResume() {
136 super.onResume();
137 updateData(getIntent().getData());
138 }
139
140 @Override
141 public boolean onKeyDown(int keyCode, KeyEvent event) {
142 switch (keyCode) {
143 case KeyEvent.KEYCODE_CALL: {
144 // Make sure phone isn't already busy before starting direct call
145 TelephonyManager tm = (TelephonyManager)
146 getSystemService(Context.TELEPHONY_SERVICE);
147 if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
148 Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
149 Uri.fromParts("tel", mNumber, null));
150 startActivity(callIntent);
151 return true;
152 }
153 }
154 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700155
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800156 return super.onKeyDown(keyCode, event);
157 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700158
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800159 /**
160 * Update user interface with details of given call.
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700161 *
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800162 * @param callUri Uri into {@link CallLog.Calls}
163 */
164 private void updateData(Uri callUri) {
165 ContentResolver resolver = getContentResolver();
166 Cursor callCursor = resolver.query(callUri, CALL_LOG_PROJECTION, null, null, null);
167 try {
168 if (callCursor != null && callCursor.moveToFirst()) {
169 // Read call log specifics
170 mNumber = callCursor.getString(NUMBER_COLUMN_INDEX);
171 long date = callCursor.getLong(DATE_COLUMN_INDEX);
172 long duration = callCursor.getLong(DURATION_COLUMN_INDEX);
173 int callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX);
Bai Tao09eb04f2010-09-01 15:34:16 +0800174 String countryIso = callCursor.getString(COUNTRY_ISO_COLUMN_INDEX);
175 if (TextUtils.isEmpty(countryIso)) {
176 countryIso = mDefaultCountryIso;
177 }
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800178 // Pull out string in format [relative], [date]
179 CharSequence dateClause = DateUtils.formatDateRange(this, date, date,
180 DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
181 DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR);
Flavio Lerda9cafe472011-06-08 14:06:13 +0100182 mCallTimeView.setText(dateClause);
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700183
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800184 // Set the duration
185 if (callType == Calls.MISSED_TYPE) {
Flavio Lerda9cafe472011-06-08 14:06:13 +0100186 mCallDurationView.setVisibility(View.GONE);
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800187 } else {
Flavio Lerda9cafe472011-06-08 14:06:13 +0100188 mCallDurationView.setVisibility(View.VISIBLE);
189 mCallDurationView.setText(formatDuration(duration));
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800190 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700191
Flavio Lerda9cafe472011-06-08 14:06:13 +0100192 long photoId = 0L;
193 CharSequence nameText = "";
Flavio Lerdaa024c3f2011-06-10 10:47:07 +0100194 final CharSequence numberText;
195 int numberType = 0;
196 CharSequence numberLabel = "";
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700197 if (mNumber.equals(CallerInfo.UNKNOWN_NUMBER) ||
198 mNumber.equals(CallerInfo.PRIVATE_NUMBER)) {
Flavio Lerdaa024c3f2011-06-10 10:47:07 +0100199 numberText = getString(mNumber.equals(CallerInfo.PRIVATE_NUMBER)
Flavio Lerda9cafe472011-06-08 14:06:13 +0100200 ? R.string.private_num : R.string.unknown);
Flavio Lerda9cafe472011-06-08 14:06:13 +0100201 mCallActionView.setVisibility(View.GONE);
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800202 } else {
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700203 // Perform a reverse-phonebook lookup to find the PERSON_ID
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700204 Uri personUri = null;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700205 Uri phoneUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
206 Uri.encode(mNumber));
Flavio Lerda9cafe472011-06-08 14:06:13 +0100207 Cursor phonesCursor = resolver.query(
208 phoneUri, PHONES_PROJECTION, null, null, null);
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700209 try {
210 if (phonesCursor != null && phonesCursor.moveToFirst()) {
211 long personId = phonesCursor.getLong(COLUMN_INDEX_ID);
212 personUri = ContentUris.withAppendedId(
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700213 Contacts.CONTENT_URI, personId);
Flavio Lerda9cafe472011-06-08 14:06:13 +0100214 nameText = phonesCursor.getString(COLUMN_INDEX_NAME);
215 photoId = phonesCursor.getLong(COLUMN_INDEX_PHOTO_ID);
Sang-il, Lee177c77f2010-03-09 20:37:19 +0900216 mNumber = PhoneNumberUtils.formatNumber(
Bai Tao09eb04f2010-09-01 15:34:16 +0800217 phonesCursor.getString(COLUMN_INDEX_NUMBER),
218 phonesCursor.getString(COLUMN_INDEX_NORMALIZED_NUMBER),
219 countryIso);
Flavio Lerdaa024c3f2011-06-10 10:47:07 +0100220 numberType = phonesCursor.getInt(COLUMN_INDEX_TYPE);
221 numberLabel = phonesCursor.getString(COLUMN_INDEX_LABEL);
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700222 } else {
Bai Tao09eb04f2010-09-01 15:34:16 +0800223 mNumber = PhoneNumberUtils.formatNumber(mNumber, countryIso);
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700224 }
225 } finally {
Flavio Lerda9cafe472011-06-08 14:06:13 +0100226 if (phonesCursor != null) phonesCursor.close();
227 }
Flavio Lerdaa024c3f2011-06-10 10:47:07 +0100228 numberText = mNumber;
Flavio Lerda9cafe472011-06-08 14:06:13 +0100229
230 mCallActionView.setVisibility(View.VISIBLE);
231 mCallActionView.setOnClickListener(new View.OnClickListener() {
232 @Override
233 public void onClick(View v) {
234 Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
235 Uri.fromParts("tel", mNumber, null));
236 startActivity(callIntent);
237 }
238 });
239
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700240 // Build list of various available actions
241 List<ViewEntry> actions = new ArrayList<ViewEntry>();
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700242
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700243 Intent smsIntent = new Intent(Intent.ACTION_SENDTO,
244 Uri.fromParts("sms", mNumber, null));
245 actions.add(new ViewEntry(R.drawable.sym_action_sms,
246 getString(R.string.menu_sendTextMessage), smsIntent));
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700247
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700248 // Let user view contact details if they exist, otherwise add option
249 // to create new contact from this number.
250 if (personUri != null) {
251 Intent viewIntent = new Intent(Intent.ACTION_VIEW, personUri);
252 actions.add(new ViewEntry(R.drawable.sym_action_view_contact,
253 getString(R.string.menu_viewContact), viewIntent));
254 } else {
255 Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700256 createIntent.setType(Contacts.CONTENT_ITEM_TYPE);
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700257 createIntent.putExtra(Insert.PHONE, mNumber);
258 actions.add(new ViewEntry(R.drawable.sym_action_add,
259 getString(R.string.recentCalls_addToContact), createIntent));
260 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700261
Amith Yamasani8bbe2f22009-03-24 21:24:12 -0700262 ViewAdapter adapter = new ViewAdapter(this, actions);
263 setListAdapter(adapter);
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800264 }
Flavio Lerdad72bf8a2011-07-05 16:00:09 +0100265 mPhoneCallDetailsHelper.setPhoneCallDetails(mPhoneCallDetailsViews, date, callType,
266 nameText, numberText, numberType, numberLabel);
Flavio Lerda9cafe472011-06-08 14:06:13 +0100267
268 loadContactPhotos(photoId);
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800269 } else {
270 // Something went wrong reading in our primary data, so we're going to
271 // bail out and show error to users.
272 Toast.makeText(this, R.string.toast_call_detail_error,
273 Toast.LENGTH_SHORT).show();
274 finish();
275 }
276 } finally {
277 if (callCursor != null) {
278 callCursor.close();
279 }
280 }
281 }
282
Flavio Lerda9cafe472011-06-08 14:06:13 +0100283 /** Load the contact photos and places them in the corresponding views. */
284 private void loadContactPhotos(final long photoId) {
285 // There seem to be a limitation in the ContactPhotoManager that does not allow requesting
286 // two photos at once.
287 // TODO: Figure out the problem with ContactPhotoManager and remove this nonsense.
288 mContactPhotoView.post(new Runnable() {
289 @Override
290 public void run() {
291 mContactPhotoManager.loadPhoto(mContactPhotoView, photoId);
292 mContactPhotoView.postDelayed(new Runnable() {
293 @Override
294 public void run() {
295 mContactPhotoManager.loadPhoto(mContactBackgroundView, photoId);
296 }
297 }, 100);
298 }
299 });
300 }
301
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800302 private String formatDuration(long elapsedSeconds) {
303 long minutes = 0;
304 long seconds = 0;
305
306 if (elapsedSeconds >= 60) {
307 minutes = elapsedSeconds / 60;
308 elapsedSeconds -= minutes * 60;
309 }
310 seconds = elapsedSeconds;
311
312 return getString(R.string.callDetailsDurationFormat, minutes, seconds);
313 }
314
Flavio Lerda696e8132011-07-05 19:00:23 +0100315 private String getVoicemailNumber() {
316 TelephonyManager telephonyManager =
317 (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
318 return telephonyManager.getVoiceMailNumber();
319 }
320
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800321 static final class ViewEntry {
322 public int icon = -1;
323 public String text = null;
324 public Intent intent = null;
325 public String label = null;
326 public String number = null;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700327
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800328 public ViewEntry(int icon, String text, Intent intent) {
329 this.icon = icon;
330 this.text = text;
331 this.intent = intent;
332 }
333 }
334
335 static final class ViewAdapter extends BaseAdapter {
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700336
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800337 private final List<ViewEntry> mActions;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700338
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800339 private final LayoutInflater mInflater;
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700340
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800341 public ViewAdapter(Context context, List<ViewEntry> actions) {
342 mActions = actions;
343 mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
344 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700345
Flavio Lerda9cafe472011-06-08 14:06:13 +0100346 @Override
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800347 public int getCount() {
348 return mActions.size();
349 }
350
Flavio Lerda9cafe472011-06-08 14:06:13 +0100351 @Override
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800352 public Object getItem(int position) {
353 return mActions.get(position);
354 }
355
Flavio Lerda9cafe472011-06-08 14:06:13 +0100356 @Override
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800357 public long getItemId(int position) {
358 return position;
359 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700360
Flavio Lerda9cafe472011-06-08 14:06:13 +0100361 @Override
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800362 public View getView(int position, View convertView, ViewGroup parent) {
363 // Make sure we have a valid convertView to start with
364 if (convertView == null) {
365 convertView = mInflater.inflate(R.layout.call_detail_list_item, parent, false);
366 }
367
368 // Fill action with icon and text.
369 ViewEntry entry = mActions.get(position);
370 convertView.setTag(entry);
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700371
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800372 ImageView icon = (ImageView) convertView.findViewById(R.id.icon);
373 TextView text = (TextView) convertView.findViewById(android.R.id.text1);
374
375 icon.setImageResource(entry.icon);
376 text.setText(entry.text);
377
378 View line2 = convertView.findViewById(R.id.line2);
379 boolean numberEmpty = TextUtils.isEmpty(entry.number);
380 boolean labelEmpty = TextUtils.isEmpty(entry.label) || numberEmpty;
381 if (labelEmpty && numberEmpty) {
382 line2.setVisibility(View.GONE);
383 } else {
384 line2.setVisibility(View.VISIBLE);
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700385
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800386 TextView label = (TextView) convertView.findViewById(R.id.label);
387 if (labelEmpty) {
388 label.setVisibility(View.GONE);
389 } else {
390 label.setText(entry.label);
391 label.setVisibility(View.VISIBLE);
392 }
393
394 TextView number = (TextView) convertView.findViewById(R.id.number);
395 number.setText(entry.number);
396 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700397
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800398 return convertView;
399 }
400 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700401
Flavio Lerda9cafe472011-06-08 14:06:13 +0100402 @Override
403 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800404 // Handle passing action off to correct handler.
405 if (view.getTag() instanceof ViewEntry) {
406 ViewEntry entry = (ViewEntry) view.getTag();
407 if (entry.intent != null) {
408 startActivity(entry.intent);
409 }
410 }
Dmitri Plotnikovd0d776d2009-08-19 17:38:04 -0700411 }
Dmitri Plotnikov8e86b752010-02-22 17:47:57 -0800412
413 @Override
414 public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
415 boolean globalSearch) {
416 if (globalSearch) {
417 super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
418 } else {
419 ContactsSearchManager.startSearch(this, initialQuery);
420 }
421 }
The Android Open Source Project7aa0e4c2009-03-03 19:32:21 -0800422}