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
Instead of using a BottomSheetDialog, which can be buggy (#816) and modifies the UI more then we need to, which is just a little bit of poor UI, this way it just expands the description/synopsis if it is clicked, which is nicer UI. It only only this for phone and emulator layouts though, on TV having the same popup is nicer so it puts the text in a bit bigger view also. This method is also nice, because if there is nothing to expand it doesn't created an unneeded dialog or do anything at all, and if you accidentally click it it doesn't end up getting in your way. showBottomDialogText in SingleSelectionHelper could probably be removed after this if you want as it is now unused again, however I decided to leave it as I figured maybe it would be useful in the future but not sure if you want to or not...
This commit is contained in:
parent
809a38507b
commit
8c2f4b7e17
3 changed files with 61 additions and 35 deletions
|
@ -246,8 +246,20 @@ class EpisodeAdapter(
|
||||||
episodeDescript.apply {
|
episodeDescript.apply {
|
||||||
text = card.description.html()
|
text = card.description.html()
|
||||||
isGone = text.isNullOrBlank()
|
isGone = text.isNullOrBlank()
|
||||||
|
|
||||||
|
var isExpanded = false
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_DESCRIPTION, card))
|
if (isTrueTv) {
|
||||||
|
clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_DESCRIPTION, card))
|
||||||
|
} else {
|
||||||
|
isExpanded = !isExpanded
|
||||||
|
|
||||||
|
maxLines = if (isExpanded) {
|
||||||
|
Integer.MAX_VALUE
|
||||||
|
} else {
|
||||||
|
4
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.graphics.Rect
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
|
import android.text.InputFilter
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -688,14 +689,17 @@ open class ResultFragmentPhone : FullScreenPlayer() {
|
||||||
resultNextAiringTime.setText(d.nextAiringDate)
|
resultNextAiringTime.setText(d.nextAiringDate)
|
||||||
resultPoster.setImage(d.posterImage)
|
resultPoster.setImage(d.posterImage)
|
||||||
resultPosterBackground.setImage(d.posterBackgroundImage)
|
resultPosterBackground.setImage(d.posterBackgroundImage)
|
||||||
resultDescription.setTextHtml(d.plotText)
|
|
||||||
resultDescription.setOnClickListener {
|
var isExpanded = false
|
||||||
activity?.let { activity ->
|
resultDescription.apply {
|
||||||
activity.showBottomDialogText(
|
setTextHtml(d.plotText)
|
||||||
d.titleText.asString(activity),
|
setOnClickListener {
|
||||||
d.plotText.asString(activity).html(),
|
isExpanded = !isExpanded
|
||||||
{}
|
filters = if (isExpanded) {
|
||||||
)
|
arrayOf(InputFilter.LengthFilter(Integer.MAX_VALUE))
|
||||||
|
} else {
|
||||||
|
arrayOf(InputFilter.LengthFilter(1000))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,14 +905,6 @@ open class ResultFragmentPhone : FullScreenPlayer() {
|
||||||
observe(viewModel.recommendations) { recommendations ->
|
observe(viewModel.recommendations) { recommendations ->
|
||||||
setRecommendations(recommendations, null)
|
setRecommendations(recommendations, null)
|
||||||
}
|
}
|
||||||
observe(viewModel.episodeSynopsis) { description ->
|
|
||||||
activity?.let { activity ->
|
|
||||||
activity.showBottomDialogText(
|
|
||||||
activity.getString(R.string.synopsis),
|
|
||||||
description.html()
|
|
||||||
) { viewModel.releaseEpisodeSynopsis() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
context?.let { ctx ->
|
context?.let { ctx ->
|
||||||
val arrayAdapter = ArrayAdapter<String>(ctx, R.layout.sort_bottom_single_choice)
|
val arrayAdapter = ArrayAdapter<String>(ctx, R.layout.sort_bottom_single_choice)
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.animation.Animator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.InputFilter
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -39,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.SearchAdapter
|
||||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isEmulatorSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isEmulatorSettings
|
||||||
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
|
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
import com.lagradost.cloudstream3.utils.AppUtils.html
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isRtl
|
import com.lagradost.cloudstream3.utils.AppUtils.isRtl
|
||||||
|
@ -720,16 +722,19 @@ class ResultFragmentTv : Fragment() {
|
||||||
observe(viewModel.recommendations) { recommendations ->
|
observe(viewModel.recommendations) { recommendations ->
|
||||||
setRecommendations(recommendations, null)
|
setRecommendations(recommendations, null)
|
||||||
}
|
}
|
||||||
observe(viewModel.episodeSynopsis) { description ->
|
|
||||||
view.context?.let { ctx ->
|
if (isTrueTvSettings()) {
|
||||||
val builder: AlertDialog.Builder =
|
observe(viewModel.episodeSynopsis) { description ->
|
||||||
AlertDialog.Builder(ctx, R.style.AlertDialogCustom)
|
view.context?.let { ctx ->
|
||||||
builder.setMessage(description.html())
|
val builder: AlertDialog.Builder =
|
||||||
.setTitle(R.string.synopsis)
|
AlertDialog.Builder(ctx, R.style.AlertDialogCustom)
|
||||||
.setOnDismissListener {
|
builder.setMessage(description.html())
|
||||||
viewModel.releaseEpisodeSynopsis()
|
.setTitle(R.string.synopsis)
|
||||||
}
|
.setOnDismissListener {
|
||||||
.show()
|
viewModel.releaseEpisodeSynopsis()
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,14 +836,27 @@ class ResultFragmentTv : Fragment() {
|
||||||
resultNextAiring.setText(d.nextAiringEpisode)
|
resultNextAiring.setText(d.nextAiringEpisode)
|
||||||
resultNextAiringTime.setText(d.nextAiringDate)
|
resultNextAiringTime.setText(d.nextAiringDate)
|
||||||
resultPoster.setImage(d.posterImage)
|
resultPoster.setImage(d.posterImage)
|
||||||
resultDescription.setTextHtml(d.plotText)
|
|
||||||
resultDescription.setOnClickListener { view ->
|
var isExpanded = false
|
||||||
view.context?.let { ctx ->
|
resultDescription.apply {
|
||||||
val builder: AlertDialog.Builder =
|
setTextHtml(d.plotText)
|
||||||
AlertDialog.Builder(ctx, R.style.AlertDialogCustom)
|
setOnClickListener {
|
||||||
builder.setMessage(d.plotText.asString(ctx).html())
|
if (context.isEmulatorSettings()) {
|
||||||
.setTitle(d.plotHeaderText.asString(ctx))
|
isExpanded = !isExpanded
|
||||||
.show()
|
filters = if (isExpanded) {
|
||||||
|
arrayOf(InputFilter.LengthFilter(Integer.MAX_VALUE))
|
||||||
|
} else {
|
||||||
|
arrayOf(InputFilter.LengthFilter(1000))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
view.context?.let { ctx ->
|
||||||
|
val builder: AlertDialog.Builder =
|
||||||
|
AlertDialog.Builder(ctx, R.style.AlertDialogCustom)
|
||||||
|
builder.setMessage(d.plotText.asString(ctx).html())
|
||||||
|
.setTitle(d.plotHeaderText.asString(ctx))
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue