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

Commit ecf91cf1 authored by Stefan Niedermann's avatar Stefan Niedermann
Browse files

Fix additional "New note" when adding a new note

parent ae507baf
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.LiveData;

import com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountNotFoundException;
import com.nextcloud.android.sso.exceptions.NoCurrentAccountSelectedException;
@@ -127,16 +126,10 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego
                                requireActivity().invalidateOptionsMenu();
                            }
                        } else {
                            requireActivity().runOnUiThread(() -> {
                                final LiveData<Note> createLiveData$ = db.addNoteAndSync(localAccount, cloudNote);
                                createLiveData$.observe(requireActivity(), (createdNote) -> {
                                    note = createdNote;
                            note = db.addNote(localAccount.getId(), cloudNote);
                            originalNote = null;
                            requireActivity().runOnUiThread(() -> onNoteLoaded(note));
                            requireActivity().invalidateOptionsMenu();
                                    createLiveData$.removeObservers(requireActivity());
                                });
                            });
                        }
                    }
                } else {
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public abstract class NotesDatabase extends RoomDatabase {
     */
    @NonNull
    @WorkerThread
    Note addNote(long accountId, Note note) {
    public Note addNote(long accountId, Note note) {
        Note entity = new Note();
        if (note.getId() > 0) {
            entity.setId(note.getId());