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

Commit 2b24602f authored by Brian Attwell's avatar Brian Attwell
Browse files

In editor, use Up button instead of Save button

We can't yet delete the assets from editor_custom_action_bar
since they are used inside the group editor. And we aren't 100%
certain we want to delete all the groups.

Bug: 18004959
Change-Id: Id60515d2e5bbaab98498162707581730baca2d8b
parent 94457c0d
Loading
Loading
Loading
Loading
+4 −20
Original line number Diff line number Diff line
@@ -95,31 +95,15 @@ public class ContactEditorActivity extends ContactsActivity

        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            // Inflate a custom action bar that contains the "done" button for saving changes
            // to the contact
            LayoutInflater inflater = (LayoutInflater) getSystemService
                    (Context.LAYOUT_INFLATER_SERVICE);
            View customActionBarView = inflater.inflate(R.layout.editor_custom_action_bar, null);
            View saveMenuItem = customActionBarView.findViewById(R.id.save_menu_item);
            saveMenuItem.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mFragment.doSaveAction();
                }
            });
            TextView title = (TextView) customActionBarView.findViewById(R.id.title);
            if (Intent.ACTION_EDIT.equals(action)) {
                title.setText(getResources().getString(
                actionBar.setTitle(getResources().getString(
                        R.string.contact_editor_title_existing_contact));
            } else {
                title.setText(getResources().getString(
                actionBar.setTitle(getResources().getString(
                        R.string.contact_editor_title_new_contact));
            }
            // Show the custom action bar but hide the home icon and title
            actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
                    ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME |
                    ActionBar.DISPLAY_SHOW_TITLE);
            actionBar.setCustomView(customActionBarView);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

        mFragment = (ContactEditorFragment) getFragmentManager().findFragmentById(
+1 −0
Original line number Diff line number Diff line
@@ -1100,6 +1100,7 @@ public class ContactEditorFragment extends Fragment implements
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
            case R.id.menu_done:
                return save(SaveMode.CLOSE);
            case R.id.menu_discard: