Skip to content

Commit 7f42190

Browse files
committed
Bug Fix: Modifying Note Save
When saving an existing note it will now update note immediately instead of requiring app reboot
1 parent d1d4e89 commit 7f42190

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/src/main/java/com/btn/pronotes/MainActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,18 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
142142
}
143143
}
144144
//Saving Note
145-
else if (requestCode==102){
146-
if (resultCode==Activity.RESULT_OK){
147-
Notes new_notes = (Notes) data.getSerializableExtra("note");
145+
else if (requestCode==102 | resultCode==Activity.RESULT_OK){
146+
assert data != null;
147+
Notes new_notes = (Notes) data.getSerializableExtra("note");
148148
database.mainDAO().update(new_notes.getID(), new_notes.getTitle(), new_notes.getNotes());
149149
notes.clear();
150150
notes.addAll(database.mainDAO().getAll());
151151
notesListAdapter.notifyDataSetChanged();
152-
Toast.makeText(MainActivity.this, "Note Saved!", Toast.LENGTH_SHORT).show();
152+
updateRecycler(notes);
153+
Toast.makeText(MainActivity.this, "Note Saved!", Toast.LENGTH_SHORT).show();
153154

154155
}
155156
}
156-
}
157157

158158
private void updateRecycler(List<Notes> notes) {
159159
recyclerView.setHasFixedSize(true);

local.properties

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
## This file is automatically generated by Android Studio.
2-
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3-
#
4-
# This file should *NOT* be checked into Version Control Systems,
1+
## This file must *NOT* be checked into Version Control Systems,
52
# as it contains information specific to your local configuration.
63
#
74
# Location of the SDK. This is only used by Gradle.
85
# For customization when using a Version Control System, please read the
96
# header note.
10-
sdk.dir=C\:\\Users\\Brett Hudson\\AppData\\Local\\Android\\Sdk
7+
#Thu Oct 13 10:16:29 EDT 2022
8+
sdk.dir=C\:\\Users\\Brett\\AppData\\Local\\Android\\Sdk

0 commit comments

Comments
 (0)