mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 20:15:05 +01:00
Material spinner view now defaults to max lines
This commit is contained in:
parent
746468ee8d
commit
611ecbb552
@ -59,7 +59,11 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
}
|
||||
}
|
||||
|
||||
private val binding = MaterialSpinnerViewBinding.inflate(LayoutInflater.from(context), this, false)
|
||||
private val binding = MaterialSpinnerViewBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
this,
|
||||
false
|
||||
)
|
||||
|
||||
init {
|
||||
addView(binding.root)
|
||||
@ -71,7 +75,7 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
val entries = (a.getTextArray(R.styleable.MaterialSpinnerView_android_entries) ?: emptyArray()).map { it.toString() }
|
||||
this.entries = entries
|
||||
|
||||
val maxLines = a.getInt(R.styleable.MaterialSpinnerView_android_maxLines, 1)
|
||||
val maxLines = a.getInt(R.styleable.MaterialSpinnerView_android_maxLines, Int.MAX_VALUE)
|
||||
binding.titleView.maxLines = maxLines
|
||||
this.entries = entries
|
||||
|
||||
@ -142,7 +146,11 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
}
|
||||
}
|
||||
|
||||
fun bindToIntPreference(pref: Preference<Int>, @ArrayRes intValuesResource: Int, block: ((Int) -> Unit)? = null) {
|
||||
fun bindToIntPreference(
|
||||
pref: Preference<Int>,
|
||||
@ArrayRes intValuesResource: Int,
|
||||
block: ((Int) -> Unit)? = null
|
||||
) {
|
||||
this.pref = pref
|
||||
prefOffset = 0
|
||||
val intValues = resources.getStringArray(intValuesResource).map { it.toIntOrNull() }
|
||||
@ -173,7 +181,11 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
return popup
|
||||
}
|
||||
|
||||
private fun makeSettingsPopup(preference: Preference<Int>, intValues: List<Int?>, block: ((Int) -> Unit)? = null): PopupMenu {
|
||||
private fun makeSettingsPopup(
|
||||
preference: Preference<Int>,
|
||||
intValues: List<Int?>,
|
||||
block: ((Int) -> Unit)? = null
|
||||
): PopupMenu {
|
||||
val popup = popup()
|
||||
// Set a listener so we are notified if a menu item is clicked
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
@ -185,7 +197,11 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
return popup
|
||||
}
|
||||
|
||||
private fun makeSettingsPopup(preference: Preference<Int>, offset: Int = 0, block: ((Int) -> Unit)? = null): PopupMenu {
|
||||
private fun makeSettingsPopup(
|
||||
preference: Preference<Int>,
|
||||
offset: Int = 0,
|
||||
block: ((Int) -> Unit)? = null
|
||||
): PopupMenu {
|
||||
val popup = popup()
|
||||
// Set a listener so we are notified if a menu item is clicked
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
|
@ -15,7 +15,6 @@
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/halfway_point"
|
||||
@ -37,7 +36,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
tools:text="Details dsfdsfsdfs df sfs dfsf er sd" />
|
||||
tools:text="Details that are so long we need to" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dropdown_caret"
|
||||
|
Loading…
Reference in New Issue
Block a user