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

Commit e897162c authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

SHOW_OR_CREATE to original behavior, new FastTrack API.

We had been overriding SHOW_OR_CREATE for awhile, but as
part of http://b/2087222 we added a separate API for
triggering FastTrack.  This change returns SHOW_OR_CREATE to
its original behavior, and adds support for the new API.
parent 1e48d111
Loading
Loading
Loading
Loading
+11 −7
Original line number Original line Diff line number Diff line
@@ -239,11 +239,12 @@
            />
            />
        </activity>
        </activity>


        <!-- Used to select display and sync groups -->
        <activity android:name=".ui.DisplayGroupsActivity" android:label="@string/displayGroups" />
        <activity android:name=".ui.DisplayGroupsActivity" android:label="@string/displayGroups" />


        <activity
        <activity
            android:name="ShowOrCreateActivity"
            android:name=".ui.ShowOrCreateActivity"
            android:theme="@style/ShowOrCreateTheme">
            android:theme="@style/FullyTranslucent">


            <intent-filter>
            <intent-filter>
                <action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
                <action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
@@ -251,11 +252,17 @@
                <data android:scheme="mailto" />
                <data android:scheme="mailto" />
                <data android:scheme="tel" />
                <data android:scheme="tel" />
            </intent-filter>
            </intent-filter>
        </activity>

        <!-- Used to show FastTrack window over a translucent activity, which is a
             temporary hack until we add better framework support. -->
        <activity
            android:name=".ui.FastTrackActivity"
            android:theme="@style/FullyTranslucent">


            <intent-filter>
            <intent-filter>
                <action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
                <action android:name="com.android.contacts.action.FAST_TRACK" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/person" android:host="contacts" />
                <data android:mimeType="vnd.android.cursor.item/contact" android:host="com.android.contacts" />
                <data android:mimeType="vnd.android.cursor.item/contact" android:host="com.android.contacts" />
            </intent-filter>
            </intent-filter>
        </activity>
        </activity>
@@ -413,6 +420,3 @@


    </application>
    </application>
</manifest>
</manifest>


+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@
            android:layout_alignParentLeft="true"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="8dip"
            android:layout_marginRight="8dip"
            style="@*android:style/Widget.FasttrackBadgeWidget.WindowLarge" />
            style="@*android:style/Widget.FasttrackBadgeWidget.WindowMedium" />
        />
        />


        <TextView android:id="@+id/label"
        <TextView android:id="@+id/label"
+1 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowIsFloating">true</item>
    </style>
    </style>


    <style name="ShowOrCreateTheme" parent="android:Theme.Translucent.NoTitleBar">
    <style name="FullyTranslucent" parent="android:Theme.Translucent.NoTitleBar">
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
    </style>


+63 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2009 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.ui;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.FastTrack;

/**
 * Stub translucent activity that just shows {@link FastTrackWindow} floating
 * above the caller. This temporary hack should eventually be replaced with
 * direct framework support.
 */
public final class FastTrackActivity extends Activity implements FastTrackWindow.OnDismissListener {
    private FastTrackWindow mFastTrack;

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        // Use our local window token for now
        final Intent intent = getIntent();
        final Uri lookupUri = intent.getData();
        final Bundle extras = intent.getExtras();

        // Read requested parameters for displaying
        final Rect target = (Rect)extras.getParcelable(FastTrack.EXTRA_TARGET_RECT);
        final int mode = extras.getInt(FastTrack.EXTRA_MODE, FastTrack.MODE_MEDIUM);
        final String[] excludeMimes = extras.getStringArray(FastTrack.EXTRA_EXCLUDE_MIMES);

        mFastTrack = new FastTrackWindow(this, this);
        mFastTrack.show(lookupUri, target, mode, excludeMimes);
    }

    @Override
    protected void onStop() {
        super.onStop();
        mFastTrack.dismiss();
    }

    /** {@inheritDoc} */
    public void onDismiss(FastTrackWindow dialog) {
        // When dismissed, finish this activity
        finish();
    }
}
+7 −7
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -35,10 +36,9 @@ import android.database.Cursor;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.SocialContract;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.FastTrack;
import android.provider.ContactsContract.Intents;
import android.provider.ContactsContract.Intents;
import android.provider.ContactsContract.Presence;
import android.provider.ContactsContract.Presence;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.RawContacts;
@@ -212,13 +212,13 @@ public class FastTrackWindow implements Window.Callback,
    private View getHeaderView(int mode) {
    private View getHeaderView(int mode) {
        View header = null;
        View header = null;
        switch (mode) {
        switch (mode) {
            case Intents.MODE_SMALL:
            case FastTrack.MODE_SMALL:
                header = mWindow.findViewById(R.id.header_small);
                header = mWindow.findViewById(R.id.header_small);
                break;
                break;
            case Intents.MODE_MEDIUM:
            case FastTrack.MODE_MEDIUM:
                header = mWindow.findViewById(R.id.header_medium);
                header = mWindow.findViewById(R.id.header_medium);
                break;
                break;
            case Intents.MODE_LARGE:
            case FastTrack.MODE_LARGE:
                header = mWindow.findViewById(R.id.header_large);
                header = mWindow.findViewById(R.id.header_large);
                break;
                break;
        }
        }
@@ -390,10 +390,10 @@ public class FastTrackWindow implements Window.Callback,
     */
     */
    private synchronized void considerShowing() {
    private synchronized void considerShowing() {
        if (mHasSummary && mHasSocial && mHasActions && !mShowing) {
        if (mHasSummary && mHasSocial && mHasActions && !mShowing) {
            if (mMode == Intents.MODE_MEDIUM && !mHasValidSocial) {
            if (mMode == FastTrack.MODE_MEDIUM && !mHasValidSocial) {
                // Missing valid social, swap medium for small header
                // Missing valid social, swap medium for small header
                mHeader.setVisibility(View.GONE);
                mHeader.setVisibility(View.GONE);
                mHeader = getHeaderView(Intents.MODE_SMALL);
                mHeader = getHeaderView(FastTrack.MODE_SMALL);
            }
            }


            // All queries have returned, pull curtain
            // All queries have returned, pull curtain
Loading