diff options
author | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2021-05-24 17:16:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 17:16:20 +0300 |
commit | 2a542dbd950b098cbd3a43af681f18ccd899a27d (patch) | |
tree | b9d61ab6a1ef2e3759f521be7e87e39df22b6d74 /app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java | |
parent | 695dbf280ddd746538598ac94d7d3c9aa44c107d (diff) |
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
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java')
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java | 6 |
1 files changed, 4 insertions, 2 deletions
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<Note> moveLiveData = repo.moveNoteToAnotherAccount(account, note); + moveLiveData.observe(this, (v) -> moveLiveData.removeObservers(this)); listener.close(); } |