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

Commit 24ef9723 authored by Katherine Kuan's avatar Katherine Kuan Committed by Android (Google) Code Review
Browse files

Merge "Selecting "Add to my contacts" on tablet can show wrong contact" into ics-mr1

parents 3f8c0394 e1cabcd0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -910,6 +910,12 @@ public class PeopleActivity extends ContactsActivity
    private void configureContactListFragmentForRequest() {
        Uri contactUri = mRequest.getContactUri();
        if (contactUri != null) {
            // For an incoming request, explicitly require a selection if we are on 2-pane UI,
            // (i.e. even if we view the same selected contact, the contact may no longer be
            // in the list, so we must refresh the list).
            if (PhoneCapabilityTester.isUsingTwoPanes(this)) {
                mAllFragment.setSelectionRequired(true);
            }
            mAllFragment.setSelectedContactUri(contactUri);
        }

@@ -1517,6 +1523,7 @@ public class PeopleActivity extends ContactsActivity
            case SUBACTIVITY_EDIT_CONTACT: {
                if (resultCode == RESULT_OK && PhoneCapabilityTester.isUsingTwoPanes(this)) {
                    mRequest.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT);
                    mAllFragment.setSelectionRequired(true);
                    mAllFragment.reloadDataAndSetSelectedUri(data.getData());
                    // Suppress IME if in search mode
                    if (mActionBarAdapter != null) {
+1 −1
Original line number Diff line number Diff line
@@ -2007,7 +2007,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
            // should update the ui
            final Intent intent = ContactSaveService.createSaveContactIntent(getActivity(),
                    contactDeltaList, "", 0, false, getActivity().getClass(),
                    UI.LIST_ALL_CONTACTS_ACTION);
                    Intent.ACTION_VIEW);
            getActivity().startService(intent);
        }
    }
+16 −4
Original line number Diff line number Diff line
@@ -309,6 +309,19 @@ public abstract class ContactBrowseListFragment extends
        super.setQueryString(queryString, delaySelection);
    }

    /**
     * Sets whether or not a contact selection must be made.
     * @param required if true, we need to check if the selection is present in
     *            the list and if not notify the listener so that it can load a
     *            different list.
     * TODO: Figure out how to reconcile this with {@link #setSelectedContactUri},
     * without causing unnecessary loading of the list if the selected contact URI is
     * the same as before.
     */
    public void setSelectionRequired(boolean required) {
        mSelectionRequired = required;
    }

    /**
     * Sets the new contact selection.
     *
@@ -456,7 +469,7 @@ public abstract class ContactBrowseListFragment extends
        adapter.setSelectedContact(
                mSelectedContactDirectoryId, mSelectedContactLookupKey, mSelectedContactId);

        int selectedPosition = adapter.getSelectedContactPosition();
        final int selectedPosition = adapter.getSelectedContactPosition();
        if (selectedPosition != -1) {
            mLastSelectedPosition = selectedPosition;
        } else {
@@ -506,7 +519,7 @@ public abstract class ContactBrowseListFragment extends
        }

        if (mSelectionToScreenRequested) {
            requestSelectionToScreen();
            requestSelectionToScreen(selectedPosition);
        }

        getListView().invalidateViews();
@@ -554,8 +567,7 @@ public abstract class ContactBrowseListFragment extends
        setSelectedContactUri(contactUri, false, mSmoothScrollRequested, false, false);
    }

    protected void requestSelectionToScreen() {
        int selectedPosition = getAdapter().getSelectedContactPosition();
    protected void requestSelectionToScreen(int selectedPosition) {
        if (selectedPosition != -1) {
            AutoScrollListView listView = (AutoScrollListView)getListView();
            listView.requestPositionToScreen(