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

Commit b5938d77 authored by Walter Jang's avatar Walter Jang Committed by Android Git Automerger
Browse files

am 55d2127f: am c90cc15b: Make saving a contact less confusing

* commit '55d2127f':
  Make saving a contact less confusing
parents 923933a5 55d2127f
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -16,9 +16,10 @@


<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
    <item
        android:id="@+id/menu_done"
        android:id="@+id/menu_save"
        android:alphabeticShortcut="\n"
        android:showAsAction="always"
        android:showAsAction="always" />
        android:icon="@drawable/ic_done_wht_24dp"
        android:title="@string/menu_save" />


    <item
    <item
        android:id="@+id/menu_split"
        android:id="@+id/menu_split"
+3 −0
Original line number Original line Diff line number Diff line
@@ -150,6 +150,9 @@
    <!-- Menu item that joins an aggregate with another aggregate -->
    <!-- Menu item that joins an aggregate with another aggregate -->
    <string name="menu_joinAggregate">Merge</string>
    <string name="menu_joinAggregate">Merge</string>


    <!-- Menu item (in the action bar) to indicate that changes should be saved [CHAR LIMIT=20] -->
    <string name="menu_save">Save</string>

    <!-- Heading of the Join Contact screen -->
    <!-- Heading of the Join Contact screen -->
    <string name="titleJoinContactDataWith">Join contacts</string>
    <string name="titleJoinContactDataWith">Join contacts</string>


+1 −1
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ public class CompactContactEditorActivity extends ContactEditorBaseActivity {
    @Override
    @Override
    public void onBackPressed() {
    public void onBackPressed() {
        if (mFragment != null) {
        if (mFragment != null) {
            mFragment.save(ContactEditor.SaveMode.CLOSE, /* backPressed =*/ true);
            mFragment.revert();
        }
        }
    }
    }
}
}
+6 −0
Original line number Original line Diff line number Diff line
@@ -161,6 +161,12 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity
         */
         */
        boolean save(int saveMode, boolean backPressed);
        boolean save(int saveMode, boolean backPressed);


        /**
         * If there are no unsaved changes, just close the editor, otherwise the user is prompted
         * before discarding unsaved changes.
         */
        boolean revert();

        /**
        /**
         * Invoked after the contact is saved.
         * Invoked after the contact is saved.
         */
         */
+10 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.util.Log;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.LinearLayout;
@@ -190,6 +191,14 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
        }
        }
    }
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            return revert();
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    @Override
    protected void bindEditors() {
    protected void bindEditors() {
        if (!isReadyToBindEditors()) {
        if (!isReadyToBindEditors()) {
@@ -347,7 +356,7 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
        if (isInsert) {
        if (isInsert) {
            // For inserts, prevent any changes from being saved when the base fragment is destroyed
            // For inserts, prevent any changes from being saved when the base fragment is destroyed
            mStatus = Status.CLOSING;
            mStatus = Status.CLOSING;
        } else if (hasPendingChanges()) {
        } else if (hasPendingRawContactChanges()) {
            // Save whatever is in the form
            // Save whatever is in the form
            save(SaveMode.CLOSE, /* backPressed =*/ false);
            save(SaveMode.CLOSE, /* backPressed =*/ false);
        }
        }
Loading