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

Commit 8ca93ed0 authored by Adam Powell's avatar Adam Powell
Browse files

Navigation adjustment for updated design guidelines and QuickContact cards

Bug 6362611

Change QuickContactActivity to task affinity "" to keep it from starting
orphaned/confused tasks.

Launch ContactDetailActivity in the same task from QuickContactActivity.

Launch app-supplied intents from QuickContactActivity in the same task.

Clear the QuickContactActivity task when launching it from a launcher
shortcut or widget. This prevents activities launched from the
finished QuickContactActivity from hanging around as the root and
failing to be reset.

Remove app-specific Up navigation code from ContactDetailActivity and
let the JB framework handle it automatically.

Change-Id: I4abebcb135b2d3269039b3307a49115c13528295
parent cda48e8c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@
            android:launchMode="singleTop"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:taskAffinity="android.task.quickcontact"
            android:taskAffinity=""
            android:windowSoftInputMode="stateUnchanged">

            <intent-filter>
@@ -474,7 +474,8 @@
        <!-- Views the details of a single contact -->
        <activity android:name=".activities.ContactDetailActivity"
            android:label="@string/viewContactTitle"
            android:theme="@style/DetailActivityTheme">
            android:theme="@style/DetailActivityTheme"
            android:parentActivityName=".activities.PeopleActivity">

            <intent-filter android:label="@string/viewContactDesription">
                <action android:name="android.intent.action.VIEW" />
+0 −32
Original line number Diff line number Diff line
@@ -57,17 +57,8 @@ public class ContactDetailActivity extends ContactsActivity {
    /** Shows a toogle button for hiding/showing updates. Don't submit with true */
    private static final boolean DEBUG_TRANSITIONS = false;

    /**
     * Boolean intent key that specifies whether pressing the "up" affordance in this activity
     * should cause it to finish itself or launch an intent to bring the user back to a specific
     * parent activity - the {@link PeopleActivity}.
     */
    public static final String INTENT_KEY_FINISH_ACTIVITY_ON_UP_SELECTED =
            "finishActivityOnUpSelected";

    private ContactLoader.Result mContactData;
    private Uri mLookupUri;
    private boolean mFinishActivityOnUpSelected;

    private ContactDetailLayoutController mContactDetailLayoutController;
    private ContactLoaderFragment mLoaderFragment;
@@ -94,9 +85,6 @@ public class ContactDetailActivity extends ContactsActivity {
            return;
        }

        mFinishActivityOnUpSelected = getIntent().getBooleanExtra(
                INTENT_KEY_FINISH_ACTIVITY_ON_UP_SELECTED, false);

        setContentView(R.layout.contact_detail_activity);

        mContactDetailLayoutController = new ContactDetailLayoutController(this, savedState,
@@ -309,24 +297,4 @@ public class ContactDetailActivity extends ContactsActivity {
         */
        public boolean handleKeyDown(int keyCode);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case android.R.id.home:
                if (mFinishActivityOnUpSelected) {
                    finish();
                    return true;
                }
                Intent intent = new Intent(this, PeopleActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                finish();
                return true;
            default:
                break;
        }
        return super.onOptionsItemSelected(item);
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ public class GroupDetailActivity extends ContactsActivity {
        @Override
        public void onContactSelected(Uri contactUri) {
            Intent intent = new Intent(Intent.ACTION_VIEW, contactUri);
            intent.putExtra(ContactDetailActivity.INTENT_KEY_FINISH_ACTIVITY_ON_UP_SELECTED, true);
            startActivity(intent);
        }

+0 −6
Original line number Diff line number Diff line
@@ -1056,12 +1056,6 @@ public class PeopleActivity extends ContactsActivity
                setupContactDetailFragment(contactLookupUri);
            } else {
                Intent intent = new Intent(Intent.ACTION_VIEW, contactLookupUri);
                // In search mode, the "up" affordance in the contact detail page should return the
                // user to the search results, so finish the activity when that button is selected.
                if (mActionBarAdapter.isSearchMode()) {
                    intent.putExtra(
                            ContactDetailActivity.INTENT_KEY_FINISH_ACTIVITY_ON_UP_SELECTED, true);
                }
                startActivity(intent);
            }
        }
+6 −3
Original line number Diff line number Diff line
@@ -248,15 +248,18 @@ public class ShortcutIntentBuilder {
        Intent shortcutIntent;
        // This is a simple shortcut to view a contact.
        shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
        shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);

        // 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.
        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

        shortcutIntent.setData(contactUri);
        shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,
                ContactsContract.QuickContact.MODE_LARGE);
        shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,
                (String[]) null);
        shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        final Bitmap icon = generateQuickContactIcon(bitmap);

Loading