From 2a542dbd950b098cbd3a43af681f18ccd899a27d Mon Sep 17 00:00:00 2001 From: Niedermann IT-Dienstleistungen Date: Mon, 24 May 2021 16:16:20 +0200 Subject: Fix moving note to another account (#1235) - Moving from within a note using the 3-dots-menu did not work at all because no account was passed to the chooser - Moving a note does no longer require to re-read the full content. This is already done by `MainViewModel`. The method expects the full note to be passed --- .../java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java') diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java index 78f20b17..0a2713eb 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java @@ -24,6 +24,7 @@ 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; @@ -240,7 +241,7 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego } else if (itemId == R.id.menu_move) { new Thread(() -> { AccountPickerDialogFragment - .newInstance(new ArrayList<>(), note.getAccountId()) + .newInstance(new ArrayList<>(repo.getAccounts()), note.getAccountId()) .show(requireActivity().getSupportFragmentManager(), BaseNoteFragment.class.getSimpleName()); }).start(); return true; @@ -372,7 +373,8 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego } public void moveNote(Account account) { - repo.moveNoteToAnotherAccount(account, note); + final LiveData moveLiveData = repo.moveNoteToAnotherAccount(account, note); + moveLiveData.observe(this, (v) -> moveLiveData.removeObservers(this)); listener.close(); } -- cgit v1.2.3