diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-11-22 12:59:35 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-11-22 12:59:35 +0300 |
commit | e3e74d98e63268b0e7716e72470485ab6ba0ad72 (patch) | |
tree | 39bbca1edb237b84962d62dfc31f59dec4828589 /app/src/main/java/it/niedermann | |
parent | 0449cd54c4b8e1aa57993a935a725d1780c938a6 (diff) |
Implement MarkwonMarkdownViewer
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann')
3 files changed, 8 insertions, 8 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/comments/ItemCommentViewHolder.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/comments/ItemCommentViewHolder.java index cb0a484b7..4ee74d3a7 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/comments/ItemCommentViewHolder.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/comments/ItemCommentViewHolder.java @@ -15,7 +15,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; -import it.niedermann.android.markdown.MarkdownViewer; +import it.niedermann.android.markdown.MarkdownEditor; import it.niedermann.android.util.ClipboardUtil; import it.niedermann.android.util.DimensionUtil; import it.niedermann.nextcloud.deck.R; @@ -30,7 +30,7 @@ import static it.niedermann.nextcloud.deck.util.ViewUtil.setupMentions; public class ItemCommentViewHolder extends RecyclerView.ViewHolder { private final ItemCommentBinding binding; - private final MarkdownViewer markdownViewer; + private final MarkdownEditor markdownViewer; private final DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); @SuppressWarnings("WeakerAccess") @@ -42,7 +42,7 @@ public class ItemCommentViewHolder extends RecyclerView.ViewHolder { public void bind(@NonNull FullDeckComment comment, @NonNull Account account, @ColorInt int mainColor, @NonNull MenuInflater inflater, @NonNull CommentDeletedListener deletedListener, @NonNull CommentSelectAsReplyListener selectAsReplyListener, @NonNull FragmentManager fragmentManager) { ViewUtil.addAvatar(binding.avatar, account.getUrl(), comment.getComment().getActorId(), DimensionUtil.INSTANCE.dpToPx(binding.avatar.getContext(), R.dimen.icon_size_details), R.drawable.ic_person_grey600_24dp); - this.markdownViewer.setText(comment.getComment().getMessage()); + this.markdownViewer.setMarkdownString(comment.getComment().getMessage()); binding.actorDisplayName.setText(comment.getComment().getActorDisplayName()); binding.creationDateTime.setText(DateUtil.getRelativeDateTimeString(binding.creationDateTime.getContext(), comment.getComment().getCreationDateTime().toEpochMilli())); itemView.setOnClickListener(View::showContextMenu); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java index 99e5b9dc5..c82ed654a 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java @@ -113,7 +113,7 @@ public class CardDetailsFragment extends BrandedFragment implements OnDateSetLis setupDueDate(); setupDescription(); setupProjects(); - description.setText(viewModel.getFullCard().getCard().getDescription()); + description.setMarkdownString(viewModel.getFullCard().getCard().getDescription()); return binding.getRoot(); } diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java index 4d4b1b04b..c7870ddd7 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java @@ -29,7 +29,7 @@ import com.bumptech.glide.request.transition.Transition; import java.time.LocalDate; import java.util.List; -import it.niedermann.android.markdown.MarkdownViewer; +import it.niedermann.android.markdown.MarkdownEditor; import it.niedermann.android.util.DimensionUtil; import it.niedermann.nextcloud.deck.R; import it.niedermann.nextcloud.deck.model.Account; @@ -100,7 +100,7 @@ public final class ViewUtil { * @param mentions {@link List} of all mentions that should be substituted * @param textView target {@link TextView} */ - public static void setupMentions(@NonNull Account account, @NonNull List<Mention> mentions, MarkdownViewer textView) { + public static void setupMentions(@NonNull Account account, @NonNull List<Mention> mentions, MarkdownEditor textView) { Context context = textView.getContext(); SpannableStringBuilder messageBuilder = new SpannableStringBuilder(textView.getText()); @@ -116,7 +116,7 @@ public final class ViewUtil { index = messageBuilder.toString().substring(0, index).lastIndexOf(mentionId); } } - textView.setText(messageBuilder); + textView.setMarkdownString(messageBuilder); // Step 2 // Replace avatar icons with real avatars @@ -142,7 +142,7 @@ public final class ViewUtil { } }); } - textView.setText(messageBuilder); + textView.setMarkdownString(messageBuilder); } public static void setImageColor(@NonNull Context context, @NonNull ImageView imageView, @ColorRes int colorRes) { |