Skip to content

Commit

Permalink
Disable dragging on bottom sheets on ChromeOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Pomepuy committed Sep 30, 2024
1 parent d7f9e28 commit b5777a3
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.videolan.vlc.gui.dialogs

import android.app.Dialog
import android.content.DialogInterface
import android.content.res.Configuration
import android.os.Bundle
Expand All @@ -14,6 +15,7 @@ import androidx.annotation.LayoutRes
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.lifecycleScope
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -93,6 +95,17 @@ abstract class VLCBottomSheetDialogFragment : BottomSheetDialogFragment() {

}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
if (AndroidDevices.isChromeBook) bottomSheetDialog.setOnShowListener {
bottomSheetDialog.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
?.let { bottomSheet ->
BottomSheetBehavior.from(bottomSheet).isDraggable = false
}
}
return bottomSheetDialog
}

private fun simulateKeyPress(key: Int) {
view?.let {
val inputConnection = BaseInputConnection(
Expand Down

0 comments on commit b5777a3

Please sign in to comment.