Loading AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -418,6 +418,10 @@ </intent-filter> </activity> <receiver android:name=".quickcontact.QuickContactBroadcastReceiver" android:exported="false" /> <activity-alias android:name="ContactShortcut" android:targetActivity=".activities.ContactSelectionActivity" android:label="@string/shortcutContact" Loading src/com/android/contacts/list/ShortcutIntentBuilder.java +11 −3 Original line number Diff line number Diff line Loading @@ -85,6 +85,13 @@ public class ShortcutIntentBuilder { private final int mBorderWidth; private final int mBorderColor; /** * This is a hidden API of the launcher in JellyBean that allows us to disable the animation * that it would usually do, because it interferes with our own animation for QuickContact */ public static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION = "com.android.launcher.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION"; /** * Listener interface. */ Loading Loading @@ -245,9 +252,7 @@ public class ShortcutIntentBuilder { byte[] bitmapData) { Bitmap bitmap = getPhotoBitmap(bitmapData); Intent shortcutIntent; // This is a simple shortcut to view a contact. shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT); Intent shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT); // When starting from the launcher, start in a new, cleared task. // CLEAR_WHEN_TASK_RESET cannot reset the root of a task, so we Loading @@ -255,6 +260,9 @@ public class ShortcutIntentBuilder { // finish itself when launching other detail activities. shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); // Tell the launcher to not do its animation, because we are doing our own shortcutIntent.putExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true); shortcutIntent.setData(contactUri); shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE, ContactsContract.QuickContact.MODE_LARGE); Loading src/com/android/contacts/quickcontact/QuickContactActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -214,9 +214,9 @@ public class QuickContactActivity extends Activity { mLookupUri = Preconditions.checkNotNull(lookupUri, "missing lookupUri"); // Read requested parameters for displaying final Rect targetScreen = intent.getSourceBounds(); Preconditions.checkNotNull(targetScreen, "missing targetScreen"); mFloatingLayout.setChildTargetScreen(targetScreen); final Rect sourceBounds = intent.getSourceBounds(); Preconditions.checkNotNull(sourceBounds, "missing sourceBounds"); mFloatingLayout.setChildTargetScreen(sourceBounds); mExcludeMimes = intent.getStringArrayExtra(QuickContact.EXTRA_EXCLUDE_MIMES); Loading src/com/android/contacts/quickcontact/QuickContactBroadcastReceiver.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.contacts.quickcontact; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.ContactsContract.QuickContact; /** * Broadcast receiver for invoking QuickContact using the widget. The purpose of this pass-through * intent receiver is to disable the animation that RemoveViews typically do, which interfere * with our own animation */ public class QuickContactBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final Uri dataUri = intent.getData(); final Intent newIntent = new Intent(QuickContact.ACTION_QUICK_CONTACT); newIntent.setSourceBounds(intent.getSourceBounds()); newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); newIntent.setData(dataUri); context.startActivity(newIntent); } } src/com/android/contacts/socialwidget/SocialWidgetProvider.java +6 −13 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package com.android.contacts.socialwidget; import com.android.contacts.ContactLoader; import com.android.contacts.R; import com.android.contacts.list.ShortcutIntentBuilder; import com.android.contacts.model.AccountType; import com.android.contacts.model.AccountTypeManager; import com.android.contacts.quickcontact.QuickContactBroadcastReceiver; import com.android.contacts.util.ContactBadgeUtil; import com.android.contacts.util.HtmlUtils; import com.android.contacts.util.StreamItemEntry; Loading @@ -27,6 +29,7 @@ import com.android.contacts.util.StreamItemEntry; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.ContentUris; import android.content.Context; import android.content.Intent; Loading Loading @@ -145,20 +148,10 @@ public class SocialWidgetProvider extends AppWidgetProvider { // TODO: Rotate between all the stream items? // OnClick launch QuickContact final Intent intent = new Intent(QuickContact.ACTION_QUICK_CONTACT); // When starting from the launcher, start in a new, cleared task. // CLEAR_WHEN_TASK_RESET cannot reset the root of a task, so we // clear the whole thing preemptively here since QuickContactActivity will // finish itself when launching other detail activities. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); final Intent intent = new Intent(context, QuickContactBroadcastReceiver.class); intent.setData(contactData.getLookupUri()); intent.putExtra(QuickContact.EXTRA_MODE, QuickContact.MODE_SMALL); final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); final PendingIntent pendingIntent = PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); views.setOnClickPendingIntent(R.id.border, pendingIntent); setDisplayNameAndSnippet(context, views, contactData.getDisplayName(), Loading Loading
AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -418,6 +418,10 @@ </intent-filter> </activity> <receiver android:name=".quickcontact.QuickContactBroadcastReceiver" android:exported="false" /> <activity-alias android:name="ContactShortcut" android:targetActivity=".activities.ContactSelectionActivity" android:label="@string/shortcutContact" Loading
src/com/android/contacts/list/ShortcutIntentBuilder.java +11 −3 Original line number Diff line number Diff line Loading @@ -85,6 +85,13 @@ public class ShortcutIntentBuilder { private final int mBorderWidth; private final int mBorderColor; /** * This is a hidden API of the launcher in JellyBean that allows us to disable the animation * that it would usually do, because it interferes with our own animation for QuickContact */ public static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION = "com.android.launcher.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION"; /** * Listener interface. */ Loading Loading @@ -245,9 +252,7 @@ public class ShortcutIntentBuilder { byte[] bitmapData) { Bitmap bitmap = getPhotoBitmap(bitmapData); Intent shortcutIntent; // This is a simple shortcut to view a contact. shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT); Intent shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT); // When starting from the launcher, start in a new, cleared task. // CLEAR_WHEN_TASK_RESET cannot reset the root of a task, so we Loading @@ -255,6 +260,9 @@ public class ShortcutIntentBuilder { // finish itself when launching other detail activities. shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); // Tell the launcher to not do its animation, because we are doing our own shortcutIntent.putExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true); shortcutIntent.setData(contactUri); shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE, ContactsContract.QuickContact.MODE_LARGE); Loading
src/com/android/contacts/quickcontact/QuickContactActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -214,9 +214,9 @@ public class QuickContactActivity extends Activity { mLookupUri = Preconditions.checkNotNull(lookupUri, "missing lookupUri"); // Read requested parameters for displaying final Rect targetScreen = intent.getSourceBounds(); Preconditions.checkNotNull(targetScreen, "missing targetScreen"); mFloatingLayout.setChildTargetScreen(targetScreen); final Rect sourceBounds = intent.getSourceBounds(); Preconditions.checkNotNull(sourceBounds, "missing sourceBounds"); mFloatingLayout.setChildTargetScreen(sourceBounds); mExcludeMimes = intent.getStringArrayExtra(QuickContact.EXTRA_EXCLUDE_MIMES); Loading
src/com/android/contacts/quickcontact/QuickContactBroadcastReceiver.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.contacts.quickcontact; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.ContactsContract.QuickContact; /** * Broadcast receiver for invoking QuickContact using the widget. The purpose of this pass-through * intent receiver is to disable the animation that RemoveViews typically do, which interfere * with our own animation */ public class QuickContactBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final Uri dataUri = intent.getData(); final Intent newIntent = new Intent(QuickContact.ACTION_QUICK_CONTACT); newIntent.setSourceBounds(intent.getSourceBounds()); newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); newIntent.setData(dataUri); context.startActivity(newIntent); } }
src/com/android/contacts/socialwidget/SocialWidgetProvider.java +6 −13 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package com.android.contacts.socialwidget; import com.android.contacts.ContactLoader; import com.android.contacts.R; import com.android.contacts.list.ShortcutIntentBuilder; import com.android.contacts.model.AccountType; import com.android.contacts.model.AccountTypeManager; import com.android.contacts.quickcontact.QuickContactBroadcastReceiver; import com.android.contacts.util.ContactBadgeUtil; import com.android.contacts.util.HtmlUtils; import com.android.contacts.util.StreamItemEntry; Loading @@ -27,6 +29,7 @@ import com.android.contacts.util.StreamItemEntry; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.ContentUris; import android.content.Context; import android.content.Intent; Loading Loading @@ -145,20 +148,10 @@ public class SocialWidgetProvider extends AppWidgetProvider { // TODO: Rotate between all the stream items? // OnClick launch QuickContact final Intent intent = new Intent(QuickContact.ACTION_QUICK_CONTACT); // When starting from the launcher, start in a new, cleared task. // CLEAR_WHEN_TASK_RESET cannot reset the root of a task, so we // clear the whole thing preemptively here since QuickContactActivity will // finish itself when launching other detail activities. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); final Intent intent = new Intent(context, QuickContactBroadcastReceiver.class); intent.setData(contactData.getLookupUri()); intent.putExtra(QuickContact.EXTRA_MODE, QuickContact.MODE_SMALL); final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); final PendingIntent pendingIntent = PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); views.setOnClickPendingIntent(R.id.border, pendingIntent); setDisplayNameAndSnippet(context, views, contactData.getDisplayName(), Loading