blob: c4b4dc740dad29703415cc852119c0c146c3c7e5 [file] [log] [blame]
Dmitri Plotnikov884e3932010-05-13 19:13:51 -07001/*
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
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070019import android.content.DialogInterface;
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070020import android.content.DialogInterface.OnDismissListener;
21import android.net.Uri;
22import android.os.Bundle;
23import android.provider.ContactsContract.Contacts;
24
Chiao Chenge0b2f1e2012-06-12 13:07:56 -070025import com.android.contacts.interactions.PhoneNumberInteraction;
26
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070027/**
28 * An interstitial activity used when the user selects a QSB search suggestion using
29 * a call button.
30 */
Dmitri Plotnikov6f667b52011-01-09 12:53:13 -080031public class CallContactActivity extends ContactsActivity implements OnDismissListener {
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070032
33 @Override
34 protected void onCreate(Bundle savedInstanceState) {
35 super.onCreate(savedInstanceState);
36
Dmitri Plotnikovb4e88862010-06-30 21:24:35 -070037 Uri contactUri = getIntent().getData();
38 if (contactUri == null) {
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070039 finish();
40 }
41
John Evans06feeb52011-02-24 16:14:54 -080042 // If this method is being invoked with a saved state, rely on Activity
43 // to restore it
Dmitri Plotnikovb4e88862010-06-30 21:24:35 -070044 if (savedInstanceState != null) {
45 return;
46 }
47
48 if (Contacts.CONTENT_ITEM_TYPE.equals(getContentResolver().getType(contactUri))) {
Daisuke Miyakawab1f0e5e2011-06-21 17:42:49 -070049 PhoneNumberInteraction.startInteractionForPhoneCall(this, contactUri);
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070050 } else {
Daisuke Miyakawafadd5e12011-12-01 17:34:18 -080051 startActivity(ContactsUtils.getCallIntent(contactUri));
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070052 finish();
53 }
54 }
55
John Evans06feeb52011-02-24 16:14:54 -080056 @Override
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070057 public void onDismiss(DialogInterface dialog) {
Dmitri Plotnikovb4e88862010-06-30 21:24:35 -070058 if (!isChangingConfigurations()) {
59 finish();
60 }
61 }
Dmitri Plotnikov884e3932010-05-13 19:13:51 -070062}