diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 8d3f43cdd..ec194deeb 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -87,6 +87,7 @@ import com.google.android.exoplayer2.upstream.DefaultDataSource import com.google.android.exoplayer2.upstream.DefaultHttpDataSource import com.google.android.exoplayer2.util.RepeatModeUtil import com.google.android.exoplayer2.video.VideoSize +import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/com/github/libretube/views/BottomSheetFragment.kt b/app/src/main/java/com/github/libretube/views/BottomSheetFragment.kt index 48de8f0ef..cc5817d35 100644 --- a/app/src/main/java/com/github/libretube/views/BottomSheetFragment.kt +++ b/app/src/main/java/com/github/libretube/views/BottomSheetFragment.kt @@ -6,10 +6,12 @@ import android.view.View import android.view.ViewGroup import com.github.libretube.databinding.BottomSheetBinding import com.github.libretube.interfaces.PlayerOptionsInterface +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment class BottomSheetFragment : BottomSheetDialogFragment() { - private lateinit var binding: BottomSheetBinding + lateinit var binding: BottomSheetBinding private lateinit var playerOptionsInterface: PlayerOptionsInterface override fun onCreateView( @@ -17,6 +19,15 @@ class BottomSheetFragment : BottomSheetDialogFragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { + // expand the bottom sheet on creation + dialog!!.setOnShowListener { dialog -> + val d = dialog as BottomSheetDialog + val bottomSheetInternal = + d.findViewById(com.google.android.material.R.id.design_bottom_sheet)!! + BottomSheetBehavior.from(bottomSheetInternal).state = + BottomSheetBehavior.STATE_EXPANDED + } + binding = BottomSheetBinding.inflate(layoutInflater, container, false) return binding.root }