Skip to content

Commit

Permalink
Merge branch 'release/1.9.9' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wax911 committed May 2, 2022
2 parents 89f0f05 + 5062c88 commit 4d9673c
Show file tree
Hide file tree
Showing 40 changed files with 274 additions and 210 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [ :biohazard: W.I.P v2.0 :biohazard: ] AniTrend   [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/AniTrend/anitrend-app/blob/master/LICENSE.md)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/30a8f983c55541cbb504671ecc32786c)](https://www.codacy.com/app/wax911/anitrend-app?utm_source=github.com&utm_medium=referral&utm_content=wax911/anitrend-app&utm_campaign=Badge_Grade)   [![Android test](https://github.com/AniTrend/anitrend-app/actions/workflows/android-test.yaml/badge.svg)](https://github.com/AniTrend/anitrend-app/actions/workflows/android-test.yaml)   [![Discord](https://img.shields.io/discord/314442908478472203.svg?color=%237289da&label=Join%20Anitrend%21&logo=discord&logoColor=%23fff)](https://discordapp.com/invite/2wzTqnF)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/33c5d626e8e64f73a0aa8e7c2f645d7c)](https://www.codacy.com/gh/AniTrend/anitrend-app/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AniTrend/anitrend-app&utm_campaign=Badge_Grade)   [![Android test](https://github.com/AniTrend/anitrend-app/actions/workflows/android-test.yaml/badge.svg)](https://github.com/AniTrend/anitrend-app/actions/workflows/android-test.yaml)   [![Discord](https://img.shields.io/discord/314442908478472203.svg?color=%237289da&label=Join%20Anitrend%21&logo=discord&logoColor=%23fff)](https://discordapp.com/invite/2wzTqnF)

Discover anime or manga with AniTrend which is a free [AniList](https://anilist.co) android client written in java.(AniTrend does not offer streaming capabilities, but official website links such as Hulu, Chrunchyroll, Netflix will be provided if available)

Expand Down
4 changes: 2 additions & 2 deletions app/.meta/version.json
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"
}
4 changes: 3 additions & 1 deletion app/src/main/assets/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Read the **FAQ** for issues regarding NSFW and notifications. Goto **Options** -
### Enhancements
- Improve share button experience. Thanks @Luk1337
- Improve notification experience @Luk1337
- Restore legacy markdown rendering with option to enable experimental mode in settings

### Bug Fixes
- Many quality of life bug fixes. Thanks @Luk1337
- Duplicate entries for list styles in settings

### Current Issues
- Gifs may show artifacts if more than one is playing at a given moment
- Gifs may show artifacts if more than one is playing at a given moment (with experimental markdown support in settings)

## Special Thanks
> _Translators (minna arigato) & all of you lovely poeple <3_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public CommentViewHolder(AdapterCommentBinding binding) {
@Override
public void onBindViewHolder(FeedReply model) {
binding.setModel(model);
//binding.widgetStatus.setModel(model);
if (!presenter.getSettings().getExperimentalMarkdown()) {
binding.widgetStatus.setVisibility(View.VISIBLE);
binding.widgetStatus.setModel(model);
} else {
binding.widgetStatus.setVisibility(View.GONE);
}
binding.widgetMention.setVisibility(View.GONE);

binding.widgetFavourite.setRequestParams(KeyUtil.ACTIVITY_REPLY, model.getId());
Expand Down Expand Up @@ -94,7 +99,7 @@ public void onBindViewHolder(FeedReply model) {
@Override
public void onViewRecycled() {
Glide.with(getContext()).clear(binding.userAvatar);
//binding.widgetStatus.onViewRecycled();
binding.widgetStatus.onViewRecycled();
binding.widgetDelete.onViewRecycled();
binding.unbind();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ public StatusFeedViewHolder(AdapterFeedStatusBinding binding) {
@Override
public void onBindViewHolder(FeedList model) {
binding.setModel(model);
//binding.widgetStatus.setModel(model);
if (!presenter.getSettings().getExperimentalMarkdown()) {
binding.widgetStatus.setVisibility(View.VISIBLE);
binding.widgetStatus.setModel(model);
} else {
binding.widgetStatus.setVisibility(View.GONE);
}

binding.widgetFavourite.setRequestParams(KeyUtil.ACTIVITY, model.getId());
binding.widgetFavourite.setModel(model.getLikes());
Expand Down Expand Up @@ -212,7 +217,7 @@ public void onBindViewHolder(FeedList model) {
public void onViewRecycled() {
Glide.with(getContext()).clear(binding.userAvatar);
binding.widgetFavourite.onViewRecycled();
//binding.widgetStatus.onViewRecycled();
binding.widgetStatus.onViewRecycled();
binding.widgetDelete.onViewRecycled();
binding.unbind();
}
Expand Down Expand Up @@ -259,7 +264,12 @@ public MessageFeedViewHolder(AdapterFeedMessageBinding binding) {
public void onBindViewHolder(FeedList model) {
binding.setModel(model);
binding.setType(messageType);
//binding.widgetStatus.setModel(model);
if (!presenter.getSettings().getExperimentalMarkdown()) {
binding.widgetStatus.setVisibility(View.VISIBLE);
binding.widgetStatus.setModel(model);
} else {
binding.widgetStatus.setVisibility(View.GONE);
}

binding.widgetFavourite.setRequestParams(KeyUtil.ACTIVITY, model.getId());
binding.widgetFavourite.setModel(model.getLikes());
Expand Down Expand Up @@ -290,7 +300,7 @@ public void onBindViewHolder(FeedList model) {
public void onViewRecycled() {
Glide.with(getContext()).clear(binding.messengerAvatar);
Glide.with(getContext()).clear(binding.recipientAvatar);
//binding.widgetStatus.onViewRecycled();
binding.widgetStatus.onViewRecycled();
binding.widgetDelete.onViewRecycled();
binding.unbind();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.google.android.material.textview.MaterialTextView
import com.mxt.anitrend.base.interfaces.view.CustomView
import com.mxt.anitrend.binding.richMarkDown
import com.mxt.anitrend.util.DialogUtil
import com.mxt.anitrend.util.Settings
import com.mxt.anitrend.util.markdown.MarkDownUtil
import com.mxt.anitrend.util.markdown.RegexUtil
import com.mxt.anitrend.view.sheet.BottomSheetMessage
Expand All @@ -23,7 +24,8 @@ class RichMarkdownTextView @JvmOverloads constructor(
defStyleAttr: Int = 0
) : MaterialTextView(context, attrs, defStyleAttr), CustomView, KoinComponent {

private val markwon by inject<Markwon>()
val markwon by inject<Markwon>()
val settings by inject<Settings>()

init { onInit() }

Expand All @@ -44,9 +46,10 @@ class RichMarkdownTextView @JvmOverloads constructor(
}

fun setMarkDownText(markDownText: String?) {
//val strippedText = RegexUtil.removeTags(markDownText)
//val markdownSpan = MarkDownUtil.convert(strippedText)
//setText(markdownSpan, BufferType.SPANNABLE)
markwon.setMarkdown(this, markDownText ?: "**No content available**")
if (!settings.experimentalMarkdown) {
val strippedText = RegexUtil.removeTags(markDownText)
val markdownSpan = MarkDownUtil.convert(strippedText)
setText(markdownSpan, BufferType.SPANNABLE)
} else markwon.setMarkdown(this, markDownText ?: "**No content available**")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,14 @@ public void onInit() {
}

public void setModel(FeedList model) {
binding.widgetStatusText.setMarkDownText(model.getText());
findMediaAttachments(model.getText());
}

public void setModel(FeedReply model) {
binding.widgetStatusText.setMarkDownText(model.getReply());
findMediaAttachments(model.getReply());
}

public void setTextData(@Nullable String textData) {
binding.widgetStatusText.setMarkDownText(textData);
findMediaAttachments(textData);
}

Expand Down
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)
}
Loading

0 comments on commit 4d9673c

Please sign in to comment.