chrisboyle / sgtpuzzles

Android port of Simon Tatham's Puzzles
https://chris.boyle.name/puzzles
Other
586 stars 167 forks source link

Keep buttons on screen with keyboard-like devices connected, and add preference #563

Open geajack opened 1 year ago

geajack commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Checkout main and open it in Android Studio. (I'm on Android Studio 2021.2.1)
  2. Build the project and run it in the emulator (I'm using the "Google Pixel" device).
  3. Play any game.

Expected behavior The control buttons should appear at the bottom of the screen, but they don't. For example, in this screenshot, I would expect to see buttons for the numbers 1 through 6 just above the Undo/Redo buttons.

Screenshots

chrisboyle commented 1 year ago

@geajack What does Build.MODEL return on that emulator image? Here's the logic for whether the keyboard is shown - "We show data-entry if we either don't have a real hardware keyboard (we usually don't), or we're on the Android SDK's emulator" - so it looks like Build.MODEL does not start with "sdk_" and we'll need to add a case to detect whatever emulator image you're running, as long as there's an unambiguous way to do so.

geajack commented 1 year ago

I stepped through in the debugger and got to isProbablyEmulator() and indeed it's returning false. Build.Model is Android SDK built for x86.

Formedras commented 1 year ago

This bug occurs for me on real hardware, on a custom ROM. OnePlus 7T running (the admittedly outdated) Paranoid Android Sapphire Alpha 3. (It is Android 12, but the current version is Beta 2.) Puzzles version number: Version 2022-05-21-1809-c43a34fb Screenshot_20220910-105058_Puzzles

EDIT: UGH. Wait a sec. I think I figured out why it's happening to me. The "smart" watch I'm using identifies itself as a keyboard even though it doesn't do any keyboard stuff. In which case, my reporting a bug that doesn't exist becomes a feature request: add an option to show buttons even if a physical keyboard is connected.

myersjustinc commented 11 months ago

Seconding this:

my reporting a bug that doesn't exist becomes a feature request: add an option to show buttons even if a physical keyboard is connected.

I recently lost buttons in the app in a similar manner on my Pixel 3, and this ticket helped me realize it was because I recently started keeping a YubiKey 5C Nano connected in the charging port—which, among other things, identifies as a physical keyboard.

chrisboyle commented 4 months ago

Re-titling to reflect what still needs to be done, since I mostly fixed emulators already with the linked commit. I think it still makes sense to hide the buttons when a full real keyboard is present (which these days mostly means on Chromebooks) but the tricky part is telling the difference between that and these headphones/Yubikey/smartwatch/other devices. Plus it makes sense to have a preference anyway, e.g. in case a Chromebook user just prefers the buttons.