am d16f7588: Merge "DO NOT MERGE: Private API to pass the selected tab through QuickContacts" into gingerbread
Merge commit 'd16f7588a88ba98c6c466ee31bb96bc1f9562a98' into gingerbread-plus-aosp * commit 'd16f7588a88ba98c6c466ee31bb96bc1f9562a98': DO NOT MERGE: Private API to pass the selected tab through QuickContacts
This commit is contained in:
@@ -5542,6 +5542,14 @@ public final class ContactsContract {
|
|||||||
*/
|
*/
|
||||||
public static final int MODE_LARGE = 3;
|
public static final int MODE_LARGE = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra used to specify the last selected tab index of the Contacts app.
|
||||||
|
* If this is not given or -1
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String EXTRA_SELECTED_CONTACTS_APP_TAB_INDEX =
|
||||||
|
"SELECTED_TAB_INDEX";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a dialog that lists the various methods of interacting with
|
* Trigger a dialog that lists the various methods of interacting with
|
||||||
* the requested {@link Contacts} entry. This may be based on available
|
* the requested {@link Contacts} entry. This may be based on available
|
||||||
@@ -5567,6 +5575,16 @@ public final class ContactsContract {
|
|||||||
*/
|
*/
|
||||||
public static void showQuickContact(Context context, View target, Uri lookupUri, int mode,
|
public static void showQuickContact(Context context, View target, Uri lookupUri, int mode,
|
||||||
String[] excludeMimes) {
|
String[] excludeMimes) {
|
||||||
|
context.startActivity(getQuickContactIntent(context, target, lookupUri, mode,
|
||||||
|
excludeMimes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the Intent to launch Quick Contacts
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static Intent getQuickContactIntent(Context context, View target, Uri lookupUri,
|
||||||
|
int mode, String[] excludeMimes) {
|
||||||
// Find location and bounds of target view, adjusting based on the
|
// Find location and bounds of target view, adjusting based on the
|
||||||
// assumed local density.
|
// assumed local density.
|
||||||
final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
|
final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
|
||||||
@@ -5580,7 +5598,7 @@ public final class ContactsContract {
|
|||||||
rect.bottom = (int) ((pos[1] + target.getHeight()) * appScale + 0.5f);
|
rect.bottom = (int) ((pos[1] + target.getHeight()) * appScale + 0.5f);
|
||||||
|
|
||||||
// Trigger with obtained rectangle
|
// Trigger with obtained rectangle
|
||||||
showQuickContact(context, rect, lookupUri, mode, excludeMimes);
|
return getQuickContactIntent(context, rect, lookupUri, mode, excludeMimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5611,6 +5629,16 @@ public final class ContactsContract {
|
|||||||
*/
|
*/
|
||||||
public static void showQuickContact(Context context, Rect target, Uri lookupUri, int mode,
|
public static void showQuickContact(Context context, Rect target, Uri lookupUri, int mode,
|
||||||
String[] excludeMimes) {
|
String[] excludeMimes) {
|
||||||
|
context.startActivity(getQuickContactIntent(context, target, lookupUri, mode,
|
||||||
|
excludeMimes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the Intent to launch Quick Contacts
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static Intent getQuickContactIntent(Context context, Rect target, Uri lookupUri,
|
||||||
|
int mode, String[] excludeMimes) {
|
||||||
// Launch pivot dialog through intent for now
|
// Launch pivot dialog through intent for now
|
||||||
final Intent intent = new Intent(ACTION_QUICK_CONTACT);
|
final Intent intent = new Intent(ACTION_QUICK_CONTACT);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||||
@@ -5620,7 +5648,7 @@ public final class ContactsContract {
|
|||||||
intent.setSourceBounds(target);
|
intent.setSourceBounds(target);
|
||||||
intent.putExtra(EXTRA_MODE, mode);
|
intent.putExtra(EXTRA_MODE, mode);
|
||||||
intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
|
intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
|
||||||
context.startActivity(intent);
|
return intent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
|||||||
private QueryHandler mQueryHandler;
|
private QueryHandler mQueryHandler;
|
||||||
private Drawable mBadgeBackground;
|
private Drawable mBadgeBackground;
|
||||||
private Drawable mNoBadgeBackground;
|
private Drawable mNoBadgeBackground;
|
||||||
|
private int mSelectedContactsAppTabIndex = -1;
|
||||||
|
|
||||||
protected String[] mExcludeMimes = null;
|
protected String[] mExcludeMimes = null;
|
||||||
|
|
||||||
@@ -133,6 +134,15 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
|||||||
onContactUriChanged();
|
onContactUriChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the currently selected tab of the Contacts application. If not set, this is -1
|
||||||
|
* and therefore does not save a tab selection when a phone call is being made
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setSelectedContactsAppTabIndex(int value) {
|
||||||
|
mSelectedContactsAppTabIndex = value;
|
||||||
|
}
|
||||||
|
|
||||||
private void onContactUriChanged() {
|
private void onContactUriChanged() {
|
||||||
if (mContactUri == null && mContactEmail == null && mContactPhone == null) {
|
if (mContactUri == null && mContactEmail == null && mContactPhone == null) {
|
||||||
if (mNoBadgeBackground == null) {
|
if (mNoBadgeBackground == null) {
|
||||||
@@ -215,7 +225,13 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void trigger(Uri lookupUri) {
|
private void trigger(Uri lookupUri) {
|
||||||
QuickContact.showQuickContact(getContext(), this, lookupUri, mMode, mExcludeMimes);
|
final Intent intent = QuickContact.getQuickContactIntent(getContext(), this, lookupUri,
|
||||||
|
mMode, mExcludeMimes);
|
||||||
|
if (mSelectedContactsAppTabIndex != -1) {
|
||||||
|
intent.putExtra(QuickContact.EXTRA_SELECTED_CONTACTS_APP_TAB_INDEX,
|
||||||
|
mSelectedContactsAppTabIndex);
|
||||||
|
}
|
||||||
|
getContext().startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QueryHandler extends AsyncQueryHandler {
|
private class QueryHandler extends AsyncQueryHandler {
|
||||||
|
|||||||
@@ -331,6 +331,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setSelectedContactsAppTabIndex(int value) {
|
||||||
|
mPhotoView.setSelectedContactsAppTabIndex(value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on/off showing of the aggregate badge element.
|
* Turn on/off showing of the aggregate badge element.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user