mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-31 00:40:11 +02:00
properly switch to the new note after creating it
This commit is contained in:
parent
54bcd443ec
commit
fb1e766be9
@ -153,11 +153,7 @@ public class MainActivity extends SimpleActivity implements OpenNoteDialog.OpenN
|
||||
saveText();
|
||||
final Note newNote = new Note(0, title, "");
|
||||
final int id = mDb.insertNote(newNote);
|
||||
newNote.setId(id);
|
||||
mNotes = mDb.getNotes();
|
||||
|
||||
final int newNoteIndex = getNewNoteIndex(newNote);
|
||||
updateSelectedNote(newNoteIndex);
|
||||
updateSelectedNote(id);
|
||||
alertDialog.dismiss();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
@ -165,18 +161,6 @@ public class MainActivity extends SimpleActivity implements OpenNoteDialog.OpenN
|
||||
});
|
||||
}
|
||||
|
||||
private int getNewNoteIndex(Note note) {
|
||||
final int cnt = mNotes.size();
|
||||
int index = 0;
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
if (mNotes.get(i).equals(note)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private void displayDeleteNotePrompt() {
|
||||
final Resources res = getResources();
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user