Use bottom dialogs for synopsis

This commit is contained in:
Luna712 2023-10-24 17:10:26 -06:00
parent c9bffef7cb
commit a00d9712ba

View file

@ -17,7 +17,6 @@ import android.view.animation.DecelerateInterpolator
import android.widget.AbsListView import android.widget.AbsListView
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.widget.NestedScrollView import androidx.core.widget.NestedScrollView
@ -59,7 +58,6 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment.updateUIEvent
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.utils.AppUtils.getNameFull 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.isCastApiAvailable
import com.lagradost.cloudstream3.utils.AppUtils.loadCache import com.lagradost.cloudstream3.utils.AppUtils.loadCache
import com.lagradost.cloudstream3.utils.AppUtils.openBrowser import com.lagradost.cloudstream3.utils.AppUtils.openBrowser
@ -681,14 +679,13 @@ open class ResultFragmentPhone : FullScreenPlayer() {
resultPoster.setImage(d.posterImage) resultPoster.setImage(d.posterImage)
resultPosterBackground.setImage(d.posterBackgroundImage) resultPosterBackground.setImage(d.posterBackgroundImage)
resultDescription.setTextHtml(d.plotText) resultDescription.setTextHtml(d.plotText)
resultDescription.setOnClickListener { view -> resultDescription.setOnClickListener {
// todo bottom view? activity?.let { activity ->
view.context?.let { ctx -> activity.showBottomDialogInstant(
val builder: AlertDialog.Builder = listOf(d.plotText.asString(activity)),
AlertDialog.Builder(ctx, R.style.AlertDialogCustom) d.titleText.asString(activity),
builder.setMessage(d.plotText.asString(ctx).html()) {}, {}
.setTitle(d.plotHeaderText.asString(ctx)) )
.show()
} }
} }
@ -879,16 +876,13 @@ open class ResultFragmentPhone : FullScreenPlayer() {
setRecommendations(recommendations, null) setRecommendations(recommendations, null)
} }
observe(viewModel.episodeSynopsis) { description -> observe(viewModel.episodeSynopsis) { description ->
// TODO bottom dialog activity?.let { activity ->
view.context?.let { ctx -> activity.showBottomDialogInstant(
val builder: AlertDialog.Builder = listOf(description ?: return@observe),
AlertDialog.Builder(ctx, R.style.AlertDialogCustom) activity.getString(R.string.synopsis),
builder.setMessage(description.html()) { viewModel.releaseEpisodeSynopsis() },
.setTitle(R.string.synopsis) {}
.setOnDismissListener { )
viewModel.releaseEpisodeSynopsis()
}
.show()
} }
} }
context?.let { ctx -> context?.let { ctx ->