blob: 181e9b768ed55fb77cb977f72fa79f729efefef4 [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
19import com.android.contacts.list.CallOrSmsInitiator;
20
21import android.app.Activity;
22import android.content.DialogInterface;
23import android.content.Intent;
24import android.content.DialogInterface.OnDismissListener;
25import android.net.Uri;
26import android.os.Bundle;
27import android.provider.ContactsContract.Contacts;
28
29/**
30 * An interstitial activity used when the user selects a QSB search suggestion using
31 * a call button.
32 */
33public class CallContactActivity extends Activity implements OnDismissListener {
34
35 @Override
36 protected void onCreate(Bundle savedInstanceState) {
37 super.onCreate(savedInstanceState);
38
39 Uri data = getIntent().getData();
40 if (data == null) {
41 finish();
42 }
43
44 if (Contacts.CONTENT_ITEM_TYPE.equals(getContentResolver().getType(data))) {
45 CallOrSmsInitiator initiator = new CallOrSmsInitiator(this);
46 initiator.setOnDismissListener(this);
47 initiator.initiateCall(data);
48 } else {
49 startActivity(new Intent(Intent.ACTION_CALL_PRIVILEGED, data));
50 finish();
51 }
52 }
53
54 public void onDismiss(DialogInterface dialog) {
55 finish();
56 }
57}