Use maxLines for description

Looks nicer in UI and is more reliable
This commit is contained in:
Luna712 2024-03-07 15:24:45 -07:00 committed by GitHub
parent 8c2f4b7e17
commit 0d38b4b601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 19 deletions

View file

@ -253,12 +253,9 @@ class EpisodeAdapter(
clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_DESCRIPTION, card)) clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_DESCRIPTION, card))
} else { } else {
isExpanded = !isExpanded isExpanded = !isExpanded
maxLines = if (isExpanded) { maxLines = if (isExpanded) {
Integer.MAX_VALUE Integer.MAX_VALUE
} else { } else 4
4
}
} }
} }
} }

View file

@ -11,7 +11,6 @@ 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
@ -63,14 +62,12 @@ 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
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialogInstant 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.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.UIHelper import com.lagradost.cloudstream3.utils.UIHelper
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
@ -695,11 +692,9 @@ open class ResultFragmentPhone : FullScreenPlayer() {
setTextHtml(d.plotText) setTextHtml(d.plotText)
setOnClickListener { setOnClickListener {
isExpanded = !isExpanded isExpanded = !isExpanded
filters = if (isExpanded) { maxLines = if (isExpanded) {
arrayOf(InputFilter.LengthFilter(Integer.MAX_VALUE)) Integer.MAX_VALUE
} else { } else 10
arrayOf(InputFilter.LengthFilter(1000))
}
} }
} }

View file

@ -4,7 +4,6 @@ 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
@ -843,11 +842,9 @@ class ResultFragmentTv : Fragment() {
setOnClickListener { setOnClickListener {
if (context.isEmulatorSettings()) { if (context.isEmulatorSettings()) {
isExpanded = !isExpanded isExpanded = !isExpanded
filters = if (isExpanded) { maxLines = if (isExpanded) {
arrayOf(InputFilter.LengthFilter(Integer.MAX_VALUE)) Integer.MAX_VALUE
} else { } else 10
arrayOf(InputFilter.LengthFilter(1000))
}
} else { } else {
view.context?.let { ctx -> view.context?.let { ctx ->
val builder: AlertDialog.Builder = val builder: AlertDialog.Builder =

View file

@ -409,8 +409,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="10"
android:foreground="@drawable/outline_drawable" android:foreground="@drawable/outline_drawable"
android:maxLength="1000"
android:nextFocusUp="@id/result_back" android:nextFocusUp="@id/result_back"
android:nextFocusDown="@id/result_bookmark_button" android:nextFocusDown="@id/result_bookmark_button"
android:paddingTop="5dp" android:paddingTop="5dp"