Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c61c98fd authored by Daniel Lehmann's avatar Daniel Lehmann Committed by Android Git Automerger
Browse files

am d16f7588: Merge "DO NOT MERGE: Private API to pass the selected tab through...

am d16f7588: Merge "DO NOT MERGE: Private API to pass the selected tab through QuickContacts" into gingerbread

Merge commit 'd16f7588' into gingerbread-plus-aosp

* commit 'd16f7588':
  DO NOT MERGE: Private API to pass the selected tab through QuickContacts
parents 83ed30e5 d16f7588
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
@@ -5542,6 +5542,14 @@ public final class ContactsContract {
         */
        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
         * 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,
                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
            // assumed local density.
            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);

            // 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,
                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
            final Intent intent = new Intent(ACTION_QUICK_CONTACT);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP
@@ -5620,7 +5648,7 @@ public final class ContactsContract {
            intent.setSourceBounds(target);
            intent.putExtra(EXTRA_MODE, mode);
            intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
            context.startActivity(intent);
            return intent;
        }
    }

+17 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
    private QueryHandler mQueryHandler;
    private Drawable mBadgeBackground;
    private Drawable mNoBadgeBackground;
    private int mSelectedContactsAppTabIndex = -1;

    protected String[] mExcludeMimes = null;

@@ -133,6 +134,15 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
        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() {
        if (mContactUri == null && mContactEmail == null && mContactPhone == null) {
            if (mNoBadgeBackground == null) {
@@ -215,7 +225,13 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
    }

    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 {
+7 −0
Original line number Diff line number Diff line
@@ -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.
     */