couple changes to saving notes

This commit is contained in:
tibbi 2016-10-24 23:33:09 +02:00
parent 6bcf53b771
commit 1870033aab
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ public class Config {
} }
public int getCurrentNoteId() { public int getCurrentNoteId() {
return mPrefs.getInt(Constants.CURRENT_NOTE_ID, 0); return mPrefs.getInt(Constants.CURRENT_NOTE_ID, 1);
} }
public void setCurrentNoteId(int id) { public void setCurrentNoteId(int id) {

View File

@ -115,12 +115,12 @@ public class MainActivity extends SimpleActivity implements OpenNoteDialog.OpenN
private void updateSelectedNote(int id) { private void updateSelectedNote(int id) {
saveText(); saveText();
mCurrentNote = mDb.getNote(id); mCurrentNote = mDb.getNote(id);
if (mCurrentNote == null) mNotes = mDb.getNotes();
return; if (mCurrentNote != null) {
mConfig.setCurrentNoteId(id);
mConfig.setCurrentNoteId(id); mNotesView.setText(mCurrentNote.getValue());
mNotesView.setText(mCurrentNote.getValue()); mCurrNoteTitle.setText(mCurrentNote.getTitle());
mCurrNoteTitle.setText(mCurrentNote.getTitle()); }
mCurrNoteLabel.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE); mCurrNoteLabel.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE);
mCurrNoteTitle.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE); mCurrNoteTitle.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE);