HeliBoard icon indicating copy to clipboard operation
HeliBoard copied to clipboard

Add separate height and padding scale for foldables?

Open voxvargr opened this issue 1 year ago • 37 comments

Basically on the smaller outer screen I like the height to be a little higher but when opened it can be A LOT shorter. I like my cover screen set to 120% but when opened the keyboard takes a bit more than 3/4 the screen but looks good when set to 85%, so 2 options would be good and you don't have to make it foldable specific, it could easily be a toolbar toggle imho

voxvargr avatar Aug 23 '24 21:08 voxvargr

This needs to be done by someone who actually has such a phone.

Not sure how detection works, but it could also be done using the display size.

Helium314 avatar Aug 25 '24 19:08 Helium314

I have the same issue. But i think it can be tied Tod split keyboard settings. In the Liter screen it is not spielt, only in opened. So if there would be an additional size Option for split layout it could solve it already

WhiteBahamut avatar Oct 25 '24 19:10 WhiteBahamut

I just added additional settings for foldable phones to the newest beta. It works on my Fold 6. I'm not sure how to go about contributing what I did (I read the guidelines)

stevenrobday avatar Apr 26 '25 14:04 stevenrobday

I just added additional settings for foldable phones to the newest beta. It works on my Fold 6. I'm not sure how to go about contributing what I did (I read the guidelines)

If you have questions I'd start with tagging the owner @Helium314

And secondly are the changes on your github in a way I could download the apk and use it as an update to heliboard?

voxvargr avatar Apr 27 '25 01:04 voxvargr

I just added additional settings for foldable phones to the newest beta. It works on my Fold 6. I'm not sure how to go about contributing what I did (I read the guidelines)

If you have questions I'd start with tagging the owner @Helium314

And secondly are the changes on your github in a way I could download the apk and use it as an update to heliboard?

I'll fork it there, likely tomorrow. I have to put in the padding and font scale settings first (I've only done height scale and split so far). I'll let you know when it's up.

stevenrobday avatar Apr 27 '25 05:04 stevenrobday

@spart0n654 @Helium314 @WhiteBahamut

fork for foldable phones here:

https://github.com/stevenrobday/HeliBoard-for-Foldables/releases/tag/v3.0-beta2-foldables-debug

stevenrobday avatar Apr 27 '25 23:04 stevenrobday

I LOVE YOU THANK YOU!

voxvargr avatar Apr 27 '25 23:04 voxvargr

I LOVE YOU THANK YOU!

Cool. It's working for you?

stevenrobday avatar Apr 27 '25 23:04 stevenrobday

Screenshot_20250427_182639_Textra.jpg

Screenshot_20250427_182645_Textra.jpg

Instead of the keyboard taking over half the screen

voxvargr avatar Apr 27 '25 23:04 voxvargr

@stevenrobday so essentially you're duplicating a bunch of settings, and decide which variants are used depending on a setting and on the display size? Do you know of any way to actually detect whether a device is foldable?

You can do a pull request, but I'll probably request some changes for readability and less duplicate code.

Helium314 avatar Apr 28 '25 20:04 Helium314

Foldables can be detected by the hinge sensor in newer models. WindowManager can detect if the screen is folded or flat. I'll clean up SettingsValues and AppearanceScreen. Also, I don't know of a better way than using additional settings, you need to have separate values for the outside and inside screen.

stevenrobday avatar Apr 28 '25 22:04 stevenrobday

Awsome, thanks for looking into this!

WhiteBahamut avatar Apr 29 '25 07:04 WhiteBahamut

@stevenrobday separate settings are fine and I think necessary, but copy / paste code is a pain to maintain (it's already not nice in the appearance settings). I'm sure we can find a better solution for this.

The folded / flat & portrait / landscape thiungs should be rearranged in both appearance screen and settings values. But I can do this if you don't feel confident on this or aren't willing to spend the time.

Ideally users wouldn't even be aware of the foldable settings if the device isn't foldable. If the hinge sensor isn't available on all foldables, we unfortunately can't use absence to hide those settings. Does the WindowManager simply detect all non-foldable screens as flat?

Helium314 avatar Apr 29 '25 14:04 Helium314

@stevenrobday separate settings are fine and I think necessary, but copy / paste code is a pain to maintain (it's already not nice in the appearance settings). I'm sure we can find a better solution for this.

The folded / flat & portrait / landscape thiungs should be rearranged in both appearance screen and settings values. But I can do this if you don't feel confident on this or aren't willing to spend the time.

Ideally users wouldn't even be aware of the foldable settings if the device isn't foldable. If the hinge sensor isn't available on all foldables, we unfortunately can't use absence to hide those settings. Does the WindowManager simply detect all non-foldable screens as flat?

I know its not a perfect solution but maybe just a collapsible setting tab at the bottom that says foldable settings only and the default for the setting to have the tab closed so if you have a foldable you know the settings are there and if you don't then its not expanded by default anyway for users to play with

voxvargr avatar Apr 29 '25 23:04 voxvargr

@Helium314 It wasn't the best way to do it, and it'll run into problems eventually, maybe starting with the Fold 7 having a larger front screen.

Detecting foldables by hinge sensor is done with Project Manager's hasSystemFeature.

Jetpack WindowManager is able to grab a phone's "FoldableFeatures" through a coroutine. This will come back as null if it's not a foldable, empty if it's closed, flat state when it's fully opened, or half-opened. That'll work with all foldables. I'm still figuring it out, but I want to do it..

stevenrobday avatar Apr 30 '25 02:04 stevenrobday

@spart0n654 a setting for everyone is the current approach from how I read the code. I'm not 100% happy with this, but it would certainly be acceptable if the alternative requires a lot of work or some heavy dependency.

starting with the Fold 7 having a larger front screen.

It should still be far away from 600 dp smallest width I guess. That's already what AOSP keyboard & Heliboard internally classify as tablet.

Detecting foldables by hinge sensor is done with Project Manager's hasSystemFeature.

Just detecting FEATURE_SENSOR_HINGE_ANGLE would be great. Do you have some overview which foldabled don't have that feature? I assume all new foldables have one, so we could query hinge sensor, and add a list of device models to cover old models.

Jetpack WindowManager

Ah, now I understand why I didn't find that stuff in "normal" (Android) WindowManager. If it's just for detecting folded state, maybe we can avoid yet another (apparently not so small) dependency and only extract the related code.

Helium314 avatar May 02 '25 15:05 Helium314

@Helium314 I just updated the fork, including rearranging the settings and it should be cleaner now. Let me know..

I read that FEATURE_SENSOR_HINGE_ANGLE may not work on older foldables, but I couldn't find a list. Samsung Fold 1 has it. I went with doing it this way over Jetpack WindowManager, as that relies on getting all the information in a coroutine and the layout changes are supposed to happen there.

stevenrobday avatar May 03 '25 00:05 stevenrobday

The cleanup definitely helps for readability!

I think the related settings should be rearranged (internally and visually) now that we not only have portrait / landscape, but also folded / unfolded. Some ideas:

  • use categories
    • so instead of having bottom padding and then bottom padding (landscape), we'd have a "normal" (portrait?) category, then a "landscape" category, ...
    • means we have the each setting 4 times (e.g. bottom padding for normal / landscape / unfolded / unfolded landscape)
  • use a dialog
    • so on selecting bottom padding, you first open a selector dialog for the normal / landscape / unfolded / unfolded landscape category, and then get to the slider
    • means it's not so simple to show the currently selected value below the setting name

Helium314 avatar May 03 '25 10:05 Helium314

By categories, do you mean instead of grouping everything under Miscellaneous, group them by portrait, landscape, unfolded portrait, unfolded landscape?

stevenrobday avatar May 03 '25 13:05 stevenrobday

By categories, do you mean instead of grouping everything under Miscellaneous, group them by portrait, landscape, unfolded portrait, unfolded landscape?

Yes

Helium314 avatar May 03 '25 13:05 Helium314

I may have found a bug in this debug version but wasn't for sure. The emoji section is half the size of normal even when folded Ive attached screenshotsScreenshot_20250503_151936_Textra.jpg

Screenshot_20250503_151932_Textra.jpg

Screenshot_20250503_151947_Textra.jpg

voxvargr avatar May 03 '25 20:05 voxvargr

@spart0n654

There's a setting for unfolded emoji font scale. If you don't have it, try the newest debug version

@Helium314 I thought doing the settings in their own dialog would be much neater. Then what I tried caused the app to crash. So I went with the categories route. I added settings for landscape/unfolded landscape settings that only existed for portrait/unfolded portrait before. Narrow key gaps only works in portrait, not sure why.

stevenrobday avatar May 08 '25 02:05 stevenrobday

I thought doing the settings in their own dialog would be much neater. Then what I tried caused the app to crash

I'll try adding this dialog to the app, then you would only need to add more entries to the dialog.

Helium314 avatar May 09 '25 04:05 Helium314

How about something like this? Image

I'm thinking about some checkbox users could use to hide the "landscape" and / or "folded" sliders. This would help against the dialog blowing up in case another dimension like "split keyboard" is added.

Helium314 avatar May 16 '25 20:05 Helium314

That looks great! It should be "unfolded" though. For split keyboard, you could put the toggle to the right of the orientation/unfolded

stevenrobday avatar May 16 '25 20:05 stevenrobday

#1580 should be ready soon. @stevenrobday currently you have the follwing settings for folded / unfolded:

  • split keyboard (needs a dialog with multiple switches, but that's simple)
  • split distance
  • height scale
  • bottom padding scale
  • side padding scale
  • font scale
  • emoji font scale
  • narrow key gaps

Not sure about how useful it is to have a narrow key gaps setting for the (currently) 4 different modes. Would anyone really use it?

The what about one-handed mode (not in settings UI) and background image? Here I can imagine users might want it separate for folded / unfolded.

Helium314 avatar May 25 '25 10:05 Helium314

@stevenrobday the new slider dialog is now merged.

Helium314 avatar Jun 02 '25 18:06 Helium314

Here is a test (debug) version using the fold branch: HeliBoard_3.5-beta1-debug.zip

This is using existence of the hinge sensor to detect whether a device is foldable, and reads the hinge angle sensor for detection of folded state. I don't have a foldable device, so I can't test it. Sensor readout might have issues, if it doesn't work we might need to use a different method for detection of folded state.

Helium314 avatar Oct 16 '25 01:10 Helium314

on my Fold7, enabling split keyboard (with landscape disabled) splits when the phone is closed (so on the front screen). Happy to test if I need to set specific settings.

DaveHenning avatar Oct 17 '25 18:10 DaveHenning

@DaveHenning does the "normal" setting apply to both folded and unfolded, or is it inverted, i.e. folded applies when the phone is open?

Helium314 avatar Oct 18 '25 05:10 Helium314