diff options
| author | JosJuice <josjuice@gmail.com> | 2025-05-12 22:51:06 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2025-10-30 21:22:41 +0100 |
| commit | 1b8a54024c6be2453345d57064ae73647e7a1e44 (patch) | |
| tree | 79c204518eeb3808ea83f4717e7c5e4996504da1 /Source/Android/app/src/main/java | |
| parent | f8ebd27766fb87bb657ff86db92c36bffa8e13a4 (diff) | |
Android: Expand bottom sheets on devices with touch too
In a few places in Dolphin, we're using BottomSheetDialogFragments.
These unhelpfully tend to start out in a "collapsed" state when in
landscape mode (presumably depending on factors like screen size). The
user then has to manually expand them before they can meaningfully
interact with them.
We've been automatically setting BottomSheetDialogFragments to the
expanded state if the device Dolphin is running on doesn't support
touch, since with d-pad navigation it's impossible to expand these
sheets. But I think we should set them to expanded on devices that
support touch too. I haven't encountered a single case where you can do
anything useful with any of Dolphin's BottomSheetDialogFragments while
they're collapsed, so the user always has to expand sheets manually if
they start out collapsed. And just because a device supports touch
doesn't necessarily mean you're interacting with it through the touch
screen right now - you could be using a gamepad, for instance.
Diffstat (limited to 'Source/Android/app/src/main/java')
3 files changed, 7 insertions, 16 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialog.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialog.kt index 4ef3dae51f..daa2178960 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialog.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialog.kt @@ -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() { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt index 059442ae98..a8ef454fc1 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/AboutDialogFragment.kt @@ -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 - } + BottomSheetBehavior.from<View>(view.parent as View).state = + BottomSheetBehavior.STATE_EXPANDED val wark = resources.getString(R.string.wark) val branch = String.format( diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/GridOptionDialogFragment.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/GridOptionDialogFragment.kt index 16a526bb2a..9760bdcd71 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/GridOptionDialogFragment.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/GridOptionDialogFragment.kt @@ -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)) { - BottomSheetBehavior.from<View>(view.parent as View).state = - BottomSheetBehavior.STATE_EXPANDED - } + // 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() |
