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

Commit a69f58fc authored by Walter Jang's avatar Walter Jang
Browse files

Don't add compact editor fragment if it's already there

Bug 20040887

Change-Id: Ib968203e0340cd442e5652376a9e2aa7347994b1
parent 511561dd
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -16,13 +16,7 @@
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment android:id="@+id/compact_contact_editor_fragment"
        class="com.android.contacts.editor.CompactContactEditorFragment"
    android:id="@+id/compact_contact_editor_fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</FrameLayout>
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
-->

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/compact_contact_editor_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background_primary"
+7 −0
Original line number Diff line number Diff line
@@ -36,6 +36,13 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity {

        mFragment = (CompactContactEditorFragment) getFragmentManager().findFragmentById(
                R.id.compact_contact_editor_fragment);
        if (mFragment == null) {
            mFragment = new CompactContactEditorFragment();
            getFragmentManager().beginTransaction()
                    .add(R.id.compact_contact_editor_fragment_container,
                            (CompactContactEditorFragment) mFragment)
                    .commit();
        }
        mFragment.setListener(mFragmentListener);

        final String action = getIntent().getAction();
+5 −1
Original line number Diff line number Diff line
@@ -647,7 +647,9 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
            case REQUEST_CODE_ACCOUNTS_CHANGED: {
                // Bail if the account selector was not successful.
                if (resultCode != Activity.RESULT_OK) {
                    if (mListener != null) {
                        mListener.onReverted();
                    }
                    return;
                }
                // If there's an account specified, use it.
@@ -993,6 +995,8 @@ abstract public class ContactEditorBaseFragment extends Fragment implements
        // prompt the user again, then launch the account prompt.
        if (mEditorUtils.shouldShowAccountChangedNotification()) {
            Intent intent = new Intent(mContext, ContactEditorAccountsChangedActivity.class);
            // Prevent a second instance from being started on rotates
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            mStatus = Status.SUB_ACTIVITY;
            startActivityForResult(intent, REQUEST_CODE_ACCOUNTS_CHANGED);
        } else {
+3 −1
Original line number Diff line number Diff line
@@ -124,8 +124,10 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements

    @Override
    public void onExternalEditorRequest(AccountWithDataSet account, Uri uri) {
        if (mListener != null) {
            mListener.onCustomEditContactActivityRequested(account, uri, null, false);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {