mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
description formatting fix
This commit is contained in:
parent
6bef5587b7
commit
b05f396704
@ -19,6 +19,7 @@ import com.github.libretube.adapters.ChannelAdapter
|
||||
import com.github.libretube.obj.Subscribe
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.squareup.picasso.Picasso
|
||||
import org.chromium.base.ThreadUtils.runOnUiThread
|
||||
import java.io.IOException
|
||||
import retrofit2.HttpException
|
||||
|
||||
@ -206,10 +207,11 @@ class ChannelFragment : Fragment() {
|
||||
response.subscriberCount.formatShort()
|
||||
)
|
||||
val channelDescription = view.findViewById<TextView>(R.id.channel_description)
|
||||
if (response.description?.trim() == "")
|
||||
if (response.description?.trim() == "") {
|
||||
channelDescription.visibility = View.GONE
|
||||
else
|
||||
} else {
|
||||
channelDescription.text = response.description?.trim()
|
||||
}
|
||||
val bannerImage = view.findViewById<ImageView>(R.id.channel_banner)
|
||||
val channelImage = view.findViewById<ImageView>(R.id.channel_image)
|
||||
Picasso.get().load(response.bannerUrl).into(bannerImage)
|
||||
|
@ -69,6 +69,7 @@ import com.google.android.exoplayer2.util.RepeatModeUtil
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.squareup.picasso.Picasso
|
||||
import org.chromium.base.ThreadUtils.runOnUiThread
|
||||
import java.io.IOException
|
||||
import java.net.URLEncoder
|
||||
import java.util.concurrent.Executors
|
||||
@ -654,13 +655,21 @@ class PlayerFragment : Fragment() {
|
||||
response.relatedStreams!!,
|
||||
childFragmentManager
|
||||
)
|
||||
|
||||
val description = response.description!!
|
||||
view.findViewById<TextView>(R.id.player_description).text =
|
||||
// detect whether the description is html formatted
|
||||
if (description.contains("<") && description.contains(">")) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Html.fromHtml(response.description, Html.FROM_HTML_MODE_COMPACT).trim()
|
||||
Html.fromHtml(description, Html.FROM_HTML_MODE_COMPACT)
|
||||
.trim()
|
||||
} else {
|
||||
Html.fromHtml(response.description).trim()
|
||||
Html.fromHtml(description).trim()
|
||||
}
|
||||
}
|
||||
else {
|
||||
description
|
||||
}
|
||||
|
||||
view.findViewById<TextView>(R.id.player_views_info).text =
|
||||
response.views.formatShort() + " views • " + response.uploadDate
|
||||
view.findViewById<TextView>(R.id.textLike).text = response.likes.formatShort()
|
||||
|
@ -96,6 +96,7 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:autoLink="web"
|
||||
android:text="" />
|
||||
|
||||
<RelativeLayout
|
||||
|
Loading…
x
Reference in New Issue
Block a user