Example #1
0
        public override bool onOptionsItemSelected(IMenuItem item)
        {
            switch (item.getItemId()) {
                case android.Resource.Id.home:
                    // app icon in action bar clicked; go home
                    Intent intent = new Intent(this, typeof(Tomdroid));
                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    StartActivity(intent);
                    return true;
                case Resource.Id.menuPrefs:
                    StartActivity(new Intent(this, typeof(PreferencesActivity)));
                    return true;
                case Resource.Id.edit_note_save:
                    saveNote();
                    return true;
                case Resource.Id.edit_note_discard:
                    discardNoteContent();
                    return true;
            /*			case Resource.Id.edit_note_xml:
                    if(!xmlOn) {
                        item.setTitle(GetString(Resource.String.text));
                        item.setIcon(Resource.Drawable.text);
                        xmlOn = true;
                        StringBuilder newNoteContent = (StringBuilder) content.getText();

                        // store changed note content
                        string newXmlContent = new NoteXMLContentBuilder().setCaller(noteXMLWriteHandler).setInputSource(newNoteContent).build();
                        // Since 0.5 EditNote expects the redundant title being removed from the note content, but we still may need this for debugging:
                        //note.setXmlContent("<note-content version=\"0.1\">"+note.getTitle()+"\n\n"+newXmlContent+"</note-content>");
                        TLog.d(TAG, "new xml content: {0}", newXmlContent);
                        note.setXmlContent(newXmlContent);
                        formatBarShell.setVisibility(View.GONE);
                        content.SetText(note.getXmlContent());
                    }
                    else {
                        item.setTitle(GetString(Resource.String.xml));
                        item.setIcon(Resource.Drawable.xml);
                        xmlOn = false;
                        updateNoteContent(true);  // update based on xml that we are switching FROM
                        if(content.isFocused())
                            formatBarShell.setVisibility(View.VISIBLE);
                    }
                    return true;*/
            }
            return base.onOptionsItemSelected(item);
        }