add ScrollView to player language/subtitles selection
This commit is contained in:
parent
71d5c58653
commit
777c6e0212
|
@ -25,6 +25,7 @@ class LanguageSettingsDialogFragment : DialogFragment() {
|
||||||
private lateinit var binding: PlayerLanguageSettingsBinding
|
private lateinit var binding: PlayerLanguageSettingsBinding
|
||||||
|
|
||||||
private var selectedLocale = Locale.ROOT
|
private var selectedLocale = Locale.ROOT
|
||||||
|
private var selectedView: View? = null
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "LanguageSettingsDialogFragment"
|
const val TAG = "LanguageSettingsDialogFragment"
|
||||||
|
@ -62,6 +63,12 @@ class LanguageSettingsDialogFragment : DialogFragment() {
|
||||||
|
|
||||||
// initially hide the status and navigation bar
|
// initially hide the status and navigation bar
|
||||||
hideBars(requireDialog().window, binding.root)
|
hideBars(requireDialog().window, binding.root)
|
||||||
|
|
||||||
|
// scroll to the position of the view, if it's the selected language
|
||||||
|
binding.scrollLanguages.post {
|
||||||
|
println("top: ${selectedView?.top}")
|
||||||
|
binding.scrollLanguages.scrollTo(0, selectedView?.top ?: 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDismiss(dialog: DialogInterface) {
|
override fun onDismiss(dialog: DialogInterface) {
|
||||||
|
@ -82,6 +89,8 @@ class LanguageSettingsDialogFragment : DialogFragment() {
|
||||||
setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_baseline_check_24, 0, 0, 0)
|
setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_baseline_check_24, 0, 0, 0)
|
||||||
compoundDrawablesRelative.getOrNull(0)?.setTint(Color.WHITE)
|
compoundDrawablesRelative.getOrNull(0)?.setTint(Color.WHITE)
|
||||||
compoundDrawablePadding = 12
|
compoundDrawablePadding = 12
|
||||||
|
|
||||||
|
selectedView = this
|
||||||
} else {
|
} else {
|
||||||
setTextColor(context.resources.getColor(R.color.textSecondaryDark, context.theme))
|
setTextColor(context.resources.getColor(R.color.textSecondaryDark, context.theme))
|
||||||
setPadding(75, 0, 0, 0)
|
setPadding(75, 0, 0, 0)
|
||||||
|
|
|
@ -44,17 +44,24 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:id="@+id/linear_languages"
|
android:id="@+id/scroll_languages"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="56dp"
|
android:contentDescription="@string/language"
|
||||||
android:layout_marginEnd="56dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/linear_bottom"
|
app:layout_constraintBottom_toTopOf="@+id/linear_bottom"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/linear_top" />
|
app:layout_constraintTop_toBottomOf="@+id/linear_top">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_languages"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="56dp"
|
||||||
|
android:layout_marginEnd="56dp"
|
||||||
|
android:orientation="vertical" />
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linear_bottom"
|
android:id="@+id/linear_bottom"
|
||||||
|
|
Loading…
Reference in New Issue