Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java34
1 files changed, 23 insertions, 11 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java
index 84c40788..8b2e49fd 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java
@@ -39,16 +39,7 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment implements O
private String changedText;
- private FragmentNotePreviewBinding binding;
-
- public static NotePreviewFragment newInstance(long accountId, long noteId) {
- NotePreviewFragment f = new NotePreviewFragment();
- Bundle b = new Bundle();
- b.putLong(PARAM_NOTE_ID, noteId);
- b.putLong(PARAM_ACCOUNT_ID, accountId);
- f.setArguments(b);
- return f;
- }
+ protected FragmentNotePreviewBinding binding;
@Override
public void onPrepareOptionsMenu(@NonNull Menu menu) {
@@ -89,10 +80,22 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment implements O
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
+// .setOnLinkClickCallback((view, link) -> {
+// if (NoteLinksUtils.isNoteLink(link)) {
+// long noteRemoteId = NoteLinksUtils.extractNoteRemoteId(link);
+// long noteLocalId = db.getLocalIdByRemoteId(this.note.getAccountId(), noteRemoteId);
+// Intent intent = new Intent(requireActivity().getApplicationContext(), EditNoteActivity.class);
+// intent.putExtra(EditNoteActivity.PARAM_NOTE_ID, noteLocalId);
+// startActivity(intent);
+// } else {
+// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
+// startActivity(browserIntent);
+// }
+// })
final TextProcessorChain chain = defaultTextProcessorChain(note);
binding.singleNoteContent.setMarkdownString(chain.apply(note.getContent()));
- changedText = note.getContent();
binding.singleNoteContent.setMovementMethod(LinkMovementMethod.getInstance());
+ changedText = note.getContent();
db = NotesDatabase.getInstance(requireContext());
binding.swiperefreshlayout.setOnRefreshListener(this);
@@ -156,4 +159,13 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment implements O
chain.add(new NoteLinksProcessor(db.getRemoteIds(note.getAccountId())));
return chain;
}
+
+ public static BaseNoteFragment newInstance(long accountId, long noteId) {
+ final BaseNoteFragment fragment = new NotePreviewFragment();
+ final Bundle args = new Bundle();
+ args.putLong(PARAM_NOTE_ID, noteId);
+ args.putLong(PARAM_ACCOUNT_ID, accountId);
+ fragment.setArguments(args);
+ return fragment;
+ }
}