mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Improve synopsis/description display on phone and emulator (#967)
This commit is contained in:
parent
81df68e137
commit
adc653943b
4 changed files with 53 additions and 38 deletions
|
@ -246,8 +246,17 @@ class EpisodeAdapter(
|
|||
episodeDescript.apply {
|
||||
text = card.description.html()
|
||||
isGone = text.isNullOrBlank()
|
||||
|
||||
var isExpanded = false
|
||||
setOnClickListener {
|
||||
if (isTrueTv) {
|
||||
clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_DESCRIPTION, card))
|
||||
} else {
|
||||
isExpanded = !isExpanded
|
||||
maxLines = if (isExpanded) {
|
||||
Integer.MAX_VALUE
|
||||
} else 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,14 +62,12 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment.updateUIEvent
|
|||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.loadCache
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.openBrowser
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialogInstant
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialogText
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
||||
import com.lagradost.cloudstream3.utils.UIHelper
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||
|
@ -688,14 +686,15 @@ open class ResultFragmentPhone : FullScreenPlayer() {
|
|||
resultNextAiringTime.setText(d.nextAiringDate)
|
||||
resultPoster.setImage(d.posterImage)
|
||||
resultPosterBackground.setImage(d.posterBackgroundImage)
|
||||
resultDescription.setTextHtml(d.plotText)
|
||||
resultDescription.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
activity.showBottomDialogText(
|
||||
d.titleText.asString(activity),
|
||||
d.plotText.asString(activity).html(),
|
||||
{}
|
||||
)
|
||||
|
||||
var isExpanded = false
|
||||
resultDescription.apply {
|
||||
setTextHtml(d.plotText)
|
||||
setOnClickListener {
|
||||
isExpanded = !isExpanded
|
||||
maxLines = if (isExpanded) {
|
||||
Integer.MAX_VALUE
|
||||
} else 10
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -901,14 +900,6 @@ open class ResultFragmentPhone : FullScreenPlayer() {
|
|||
observe(viewModel.recommendations) { recommendations ->
|
||||
setRecommendations(recommendations, null)
|
||||
}
|
||||
observe(viewModel.episodeSynopsis) { description ->
|
||||
activity?.let { activity ->
|
||||
activity.showBottomDialogText(
|
||||
activity.getString(R.string.synopsis),
|
||||
description.html()
|
||||
) { viewModel.releaseEpisodeSynopsis() }
|
||||
}
|
||||
}
|
||||
context?.let { ctx ->
|
||||
val arrayAdapter = ArrayAdapter<String>(ctx, R.layout.sort_bottom_single_choice)
|
||||
/*
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_FOCUSED
|
|||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isEmulatorSettings
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.isRtl
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.loadCache
|
||||
|
@ -754,6 +755,8 @@ class ResultFragmentTv : Fragment() {
|
|||
observe(viewModel.recommendations) { recommendations ->
|
||||
setRecommendations(recommendations, null)
|
||||
}
|
||||
|
||||
if (isTrueTvSettings()) {
|
||||
observe(viewModel.episodeSynopsis) { description ->
|
||||
view.context?.let { ctx ->
|
||||
val builder: AlertDialog.Builder =
|
||||
|
@ -766,6 +769,7 @@ class ResultFragmentTv : Fragment() {
|
|||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Used to request focus the first time the episodes are loaded.
|
||||
var hasLoadedEpisodesOnce = false
|
||||
|
@ -874,8 +878,17 @@ class ResultFragmentTv : Fragment() {
|
|||
resultNextAiring.setText(d.nextAiringEpisode)
|
||||
resultNextAiringTime.setText(d.nextAiringDate)
|
||||
resultPoster.setImage(d.posterImage)
|
||||
resultDescription.setTextHtml(d.plotText)
|
||||
resultDescription.setOnClickListener { view ->
|
||||
|
||||
var isExpanded = false
|
||||
resultDescription.apply {
|
||||
setTextHtml(d.plotText)
|
||||
setOnClickListener {
|
||||
if (context.isEmulatorSettings()) {
|
||||
isExpanded = !isExpanded
|
||||
maxLines = if (isExpanded) {
|
||||
Integer.MAX_VALUE
|
||||
} else 10
|
||||
} else {
|
||||
view.context?.let { ctx ->
|
||||
val builder: AlertDialog.Builder =
|
||||
AlertDialog.Builder(ctx, R.style.AlertDialogCustom)
|
||||
|
@ -884,6 +897,8 @@ class ResultFragmentTv : Fragment() {
|
|||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val error = listOf(
|
||||
R.drawable.profile_bg_dark_blue,
|
||||
|
|
|
@ -409,8 +409,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="10"
|
||||
android:foreground="@drawable/outline_drawable"
|
||||
android:maxLength="1000"
|
||||
android:nextFocusUp="@id/result_back"
|
||||
android:nextFocusDown="@id/result_bookmark_Button"
|
||||
android:paddingTop="5dp"
|
||||
|
|
Loading…
Reference in a new issue