Merge pull request #13655 from JosJuice/android-always-expand-sheets

Android: Expand bottom sheets on devices with touch too
This commit is contained in:
JosJuice 2025-11-01 12:22:45 +01:00 committed by GitHub
commit 249f999c6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 21 deletions

View File

@ -10,7 +10,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.divider.MaterialDividerItemDecoration
import org.dolphinemu.dolphinemu.R
import org.dolphinemu.dolphinemu.databinding.DialogInputProfilesBinding
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag
import org.dolphinemu.dolphinemu.utils.SerializableHelper.serializable
@ -45,11 +44,8 @@ class ProfileDialog : BottomSheetDialogFragment() {
divider.isLastItemDecorated = false
binding.profileList.addItemDecoration(divider)
// You can't expand a bottom sheet with a controller/remote/other non-touch devices
val behavior: BottomSheetBehavior<View> = BottomSheetBehavior.from(view.parent as View)
if (!resources.getBoolean(R.bool.hasTouch)) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
BottomSheetBehavior.from<View>(view.parent as View).state =
BottomSheetBehavior.STATE_EXPANDED
}
override fun onDestroyView() {

View File

@ -38,10 +38,8 @@ class AboutDialogFragment : BottomSheetDialogFragment() {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
if (!resources.getBoolean(R.bool.hasTouch)) {
BottomSheetBehavior.from<View>(view.parent as View).state =
BottomSheetBehavior.STATE_EXPANDED
}
val wark = resources.getString(R.string.wark)
val branch = String.format(

View File

@ -10,7 +10,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting
import android.widget.CompoundButton
import androidx.appcompat.app.AppCompatActivity
import org.dolphinemu.dolphinemu.R
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsBinding
import org.dolphinemu.dolphinemu.databinding.FragmentGridOptionsTvBinding
import org.dolphinemu.dolphinemu.features.settings.model.NativeConfig
@ -44,11 +43,9 @@ class GridOptionDialogFragment : BottomSheetDialogFragment() {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// Pins fragment to the top of the dialog ensures the dialog is expanded in landscape by default
if (!resources.getBoolean(R.bool.hasTouch)) {
// Ensure the dialog is expanded in landscape by default
BottomSheetBehavior.from<View>(view.parent as View).state =
BottomSheetBehavior.STATE_EXPANDED
}
if (activity is AppCompatActivity) {
setUpCoverButtons()

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="hasTouch">false</bool>
</resources>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="hasTouch">true</bool>
<bool name="enableDocumentProvider">false</bool>
</resources>