-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.9.9' into develop
- Loading branch information
Showing
40 changed files
with
274 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"code": 1090800, | ||
"code": 1090900, | ||
"migration": false, | ||
"minSdk": 17, | ||
"releaseNotes": "", | ||
"version": "1.9.8", | ||
"version": "1.9.9", | ||
"appId": "com.mxt.anitrend" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 30 additions & 20 deletions
50
app/src/main/java/com/mxt/anitrend/binding/RichMarkdownExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,56 @@ | ||
package com.mxt.anitrend.binding | ||
|
||
import android.text.Html | ||
import android.widget.TextView | ||
import androidx.annotation.StringRes | ||
import androidx.databinding.BindingAdapter | ||
import com.mxt.anitrend.base.custom.view.text.RichMarkdownTextView | ||
import com.mxt.anitrend.util.markdown.MarkDownUtil | ||
import com.mxt.anitrend.util.markdown.RegexUtil | ||
import io.noties.markwon.utils.NoCopySpannableFactory | ||
|
||
@BindingAdapter("markDown") | ||
fun RichMarkdownTextView.markDown(markdown: String?) { | ||
/*val strippedText = RegexUtil.removeTags(markdown) | ||
val markdownSpan = MarkDownUtil.convert(strippedText) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE)*/ | ||
richMarkDown(markdown) | ||
if (!settings.experimentalMarkdown) { | ||
val strippedText = RegexUtil.removeTags(markdown) | ||
val markdownSpan = MarkDownUtil.convert(strippedText) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE) | ||
} else richMarkDown(markdown) | ||
} | ||
|
||
@BindingAdapter("textHtml") | ||
fun RichMarkdownTextView.htmlText(html: String?) { | ||
/*val markdownSpan = MarkDownUtil.convert(html) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE)*/ | ||
richMarkDown(html) | ||
if (!settings.experimentalMarkdown) { | ||
val markdownSpan = MarkDownUtil.convert(html) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE) | ||
} else richMarkDown(html) | ||
} | ||
|
||
@BindingAdapter("basicHtml") | ||
fun RichMarkdownTextView.basicText(html: String?) { | ||
/*val htmlSpan = Html.fromHtml(html) | ||
setText(htmlSpan, TextView.BufferType.SPANNABLE)*/ | ||
richMarkDown(html) | ||
if (!settings.experimentalMarkdown) { | ||
val htmlSpan = Html.fromHtml(html) | ||
setText(htmlSpan, TextView.BufferType.SPANNABLE) | ||
} else richMarkDown(html) | ||
} | ||
|
||
@BindingAdapter("textHtml") | ||
fun RichMarkdownTextView.htmlText(@StringRes resId: Int) { | ||
/*val text = context.getString(resId) | ||
val markdownSpan = MarkDownUtil.convert(text) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE)*/ | ||
richMarkDown(context.getString(resId)) | ||
if (!settings.experimentalMarkdown) { | ||
val text = context.getString(resId) | ||
val markdownSpan = MarkDownUtil.convert(text) | ||
setText(markdownSpan, TextView.BufferType.SPANNABLE) | ||
} else richMarkDown(context.getString(resId)) | ||
} | ||
|
||
@BindingAdapter("richMarkDown") | ||
fun RichMarkdownTextView.richMarkDown(markdown: String?) { | ||
// call after inflation and before setting markdown | ||
/*setSpannableFactory(NoCopySpannableFactory.getInstance()) | ||
val tagsStripped = RegexUtil.removeTags(markdown) | ||
val userTagsConverted = RegexUtil.findUserTags(tagsStripped) | ||
val standardMarkdown = RegexUtil.convertToStandardMarkdown(userTagsConverted) | ||
markwon.setMarkdown(this, standardMarkdown)*/ | ||
setMarkDownText(markdown) | ||
if (!settings.experimentalMarkdown) { | ||
setSpannableFactory(NoCopySpannableFactory.getInstance()) | ||
val tagsStripped = RegexUtil.removeTags(markdown) | ||
//val userTagsConverted = RegexUtil.findUserTags(tagsStripped) | ||
val standardMarkdown = RegexUtil.convertToStandardMarkdown(tagsStripped) | ||
markwon.setMarkdown(this, standardMarkdown) | ||
} else setMarkDownText(markdown) | ||
} |
Oops, something went wrong.