Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a94a55dd authored by korelstar's avatar korelstar Committed by Niedermann IT-Dienstleistungen
Browse files

only save if something changed

parent 053bd571
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -174,9 +174,14 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
     */
    protected void saveNote(@Nullable ICallback callback) {
        Log.d(getClass().getSimpleName(), "saveData()");
        note = db.updateNoteAndSync(note, getContent(), callback);
        String newContent = getContent();
        if(note.getContent().equals(newContent)) {
            Log.v(getClass().getSimpleName(), "... not saving, since nothing has changed");
        } else {
            note = db.updateNoteAndSync(note, newContent, callback);
            listener.onNoteUpdated(note);
        }
    }

    protected abstract String getContent();