Ejemplo n.º 1
0
  protected void returnAndSave() {
    NoteDB.editNoteText(noteIndex, noteText.getText().toString());
    if (desiredTitle != null) {
      NoteDB.editNoteTitle(noteIndex, desiredTitle);
    }

    NoteDB.saveNotes();

    InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(this.saveButton.getWindowToken(), 0);

    Intent returnToNoteHubActivity = new Intent(EditNote.this, NoteHubActivity.class);
    setResult(1, returnToNoteHubActivity);
    overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right);
    finish();
  }
Ejemplo n.º 2
0
  public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getExtras();
    this.noteIndex = bundle.getInt("noteIndex");

    NoteDB.loadNotes();
    this.currentNote = NoteDB.getList().get(this.noteIndex);

    initLayout();
    initListeners();

    if (savedInstanceState != null) {
      this.noteText.setText(savedInstanceState.getString(EditNote.savedText));
    }
  }