diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-26 05:52:19 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-26 05:52:19 +0000 |
commit | 5e144c6de94d4fe2233b83b3c804d101ebcbe703 (patch) | |
tree | 14273c38afda18eec84b9a135b62247331e207be /app/src/main/java/CustomView/CustomMarkwonView.java | |
parent | 4d4e6165f0e1bcd72c54fa015a9e1112103e9062 (diff) | |
download | infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar.gz infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar.bz2 infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar.lz infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar.xz infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.tar.zst infinity-for-reddit-5e144c6de94d4fe2233b83b3c804d101ebcbe703.zip |
Reimplement Markdown display due to update of Markwon library. Fixed RetryLoadingMoreCallback is null in MessageRecyclerViewAdapter.
Diffstat (limited to 'app/src/main/java/CustomView/CustomMarkwonView.java')
-rw-r--r-- | app/src/main/java/CustomView/CustomMarkwonView.java | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/app/src/main/java/CustomView/CustomMarkwonView.java b/app/src/main/java/CustomView/CustomMarkwonView.java index 940b6b76..c89ff405 100644 --- a/app/src/main/java/CustomView/CustomMarkwonView.java +++ b/app/src/main/java/CustomView/CustomMarkwonView.java @@ -1,38 +1,73 @@ package CustomView; import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.util.AttributeSet; +import android.text.Spanned; +import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import ml.docilealligator.infinityforreddit.LinkResolverActivity; -import ru.noties.markwon.SpannableConfiguration; -import ru.noties.markwon.view.MarkwonView; +import org.commonmark.node.Node; -public class CustomMarkwonView extends MarkwonView { +import java.util.List; + +import io.noties.markwon.Markwon; +import io.noties.markwon.MarkwonPlugin; + +public class CustomMarkwonView extends Markwon { + + public void setMarkdown(@Nullable String markdown, Context context) { - public CustomMarkwonView(Context context) { - super(context); } - public CustomMarkwonView(Context context, AttributeSet attrs) { - super(context, attrs); + @NonNull + @Override + public Node parse(@NonNull String input) { + return null; } - public void setMarkdown(@Nullable String markdown, Context context) { - SpannableConfiguration configuration = SpannableConfiguration.builder(context).linkResolver((view, link) -> { - Intent intent = new Intent(context, LinkResolverActivity.class); - Uri uri = Uri.parse(link); - if(uri.getScheme() == null && uri.getHost() == null) { - intent.setData(LinkResolverActivity.getRedditUriByPath(link)); - } else { - intent.setData(uri); - } - context.startActivity(intent); - }).build(); - - super.setMarkdown(configuration, markdown); + @NonNull + @Override + public Spanned render(@NonNull Node node) { + return null; + } + + @NonNull + @Override + public Spanned toMarkdown(@NonNull String input) { + return null; + } + + @Override + public void setMarkdown(@NonNull TextView textView, @NonNull String markdown) { + + } + + @Override + public void setParsedMarkdown(@NonNull TextView textView, @NonNull Spanned markdown) { + + } + + @Override + public boolean hasPlugin(@NonNull Class<? extends MarkwonPlugin> plugin) { + return false; + } + + @Nullable + @Override + public <P extends MarkwonPlugin> P getPlugin(@NonNull Class<P> type) { + return null; + } + + @NonNull + @Override + public <P extends MarkwonPlugin> P requirePlugin(@NonNull Class<P> type) { + return null; + } + + @NonNull + @Override + public List<? extends MarkwonPlugin> getPlugins() { + return null; } } |