1d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann/*
2d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * Copyright (C) 2010 The Android Open Source Project
3d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann *
4d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * Licensed under the Apache License, Version 2.0 (the "License");
5d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * you may not use this file except in compliance with the License.
6d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * You may obtain a copy of the License at
7d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann *
8d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann *      http://www.apache.org/licenses/LICENSE-2.0
9d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann *
10d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * Unless required by applicable law or agreed to in writing, software
11d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * distributed under the License is distributed on an "AS IS" BASIS,
12d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * See the License for the specific language governing permissions and
14d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * limitations under the License.
15d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann */
16d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann
17d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannpackage com.android.contacts.quickcontact;
18d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann
19c6100ffd22ae176a3e84a1062d8cb92d955faef2Brian Attwellimport com.android.contacts.common.util.ImplicitIntentsUtil;
20c6100ffd22ae176a3e84a1062d8cb92d955faef2Brian Attwell
21d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannimport android.content.BroadcastReceiver;
22d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannimport android.content.Context;
23d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannimport android.content.Intent;
24d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannimport android.net.Uri;
25d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannimport android.provider.ContactsContract.QuickContact;
26d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann
27d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann/**
28d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * Broadcast receiver for invoking QuickContact using the widget. The purpose of this pass-through
29d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * intent receiver is to disable the animation that RemoveViews typically do, which interfere
30d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann * with our own animation
31d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann */
32d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmannpublic class QuickContactBroadcastReceiver extends BroadcastReceiver {
33d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann    @Override
34d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann    public void onReceive(Context context, Intent intent) {
35d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann        final Uri dataUri = intent.getData();
36d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann        final Intent newIntent = new Intent(QuickContact.ACTION_QUICK_CONTACT);
37d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann        newIntent.setSourceBounds(intent.getSourceBounds());
38d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann        newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
39d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann        newIntent.setData(dataUri);
40c6100ffd22ae176a3e84a1062d8cb92d955faef2Brian Attwell        ImplicitIntentsUtil.startActivityInApp(context, newIntent);
41d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann    }
42d1e501105d1ce2fb3e286635d0b2195e77e000afDaniel Lehmann}
43