diff --git a/app/src/main/java/org/mosad/teapod/ui/activity/player/fragment/LanguageSettingsDialogFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/player/fragment/LanguageSettingsDialogFragment.kt index c0a4860..a28fb77 100644 --- a/app/src/main/java/org/mosad/teapod/ui/activity/player/fragment/LanguageSettingsDialogFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/player/fragment/LanguageSettingsDialogFragment.kt @@ -25,6 +25,7 @@ class LanguageSettingsDialogFragment : DialogFragment() { private lateinit var binding: PlayerLanguageSettingsBinding private var selectedLocale = Locale.ROOT + private var selectedView: View? = null companion object { const val TAG = "LanguageSettingsDialogFragment" @@ -62,6 +63,12 @@ class LanguageSettingsDialogFragment : DialogFragment() { // initially hide the status and navigation bar 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) { @@ -82,6 +89,8 @@ class LanguageSettingsDialogFragment : DialogFragment() { setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_baseline_check_24, 0, 0, 0) compoundDrawablesRelative.getOrNull(0)?.setTint(Color.WHITE) compoundDrawablePadding = 12 + + selectedView = this } else { setTextColor(context.resources.getColor(R.color.textSecondaryDark, context.theme)) setPadding(75, 0, 0, 0) diff --git a/app/src/main/res/layout/player_language_settings.xml b/app/src/main/res/layout/player_language_settings.xml index 751ca2c..3aa30de 100644 --- a/app/src/main/res/layout/player_language_settings.xml +++ b/app/src/main/res/layout/player_language_settings.xml @@ -44,17 +44,24 @@ - + app:layout_constraintTop_toBottomOf="@+id/linear_top"> + + +