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