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

Commit afb025cf authored by Brian Attwell's avatar Brian Attwell Committed by Android (Google) Code Review
Browse files

Merge "In editor, use Up button instead of Save button" into lmp-mr1-dev

parents 99c0c851 2b24602f
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
@@ -1125,6 +1125,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: