Skip to content

Add floating keyboard toggle button on the candidates strip - #1377

Open
zFitness wants to merge 6 commits into
Julow:masterfrom
zFitness:master
Open

Add floating keyboard toggle button on the candidates strip#1377
zFitness wants to merge 6 commits into
Julow:masterfrom
zFitness:master

Conversation

@zFitness

@zFitness zFitness commented Aug 5, 2026

Copy link
Copy Markdown

What

Add a toggle_float key action to switch between floating and docked keyboard modes.
Add a toggle button next to the change-language button on the candidates strip.
Persist the floating keyboard state via the floating_keyboard preference.

Changes

KeyValue.java: new toggle_float action
Keyboard2.java: wire the toggle action to the floating-mode switch
CandidatesView.java: add the toggle button and update its selected state
New drawables: btn_floating_toggle, ic_floating_toggle(_selected)
keyboard.xml / strings.xml: button placement and label

Screenshot

screen4 * setting screen5

Add a Floating keyboard setting that switches the keyboard to a movable
floating window: fixed width capped at a max, wrap height, drag handle,
remembered position, and unchanged behavior for the app behind it.
Include the OpenSpec change archive and synced specs.
Add a toggle_float key action and a button next to the change language
button in the candidates strip to switch between floating and docked
keyboard modes, persisting the state in the floating_keyboard preference.

@Julow Julow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

Comment thread scripts/fix-ndk-arm64-host.sh Outdated
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit more ? I'm not sure this should live in the repo. Instead, you should distribute it to other aarch64 users separately.

Comment thread srcs/juloo.keyboard2/KeyValue.java Outdated
case "complete_emoji": return statefulKey(Stateful.Complete_emoji);
case "hide_self": return eventKey("⊻", Event.HIDE_SELF, FLAG_SMALLER_FONT);
case "change_dictionary": return eventKey(0xE01D, Event.CHANGE_DICTIONARY, 0);
case "toggle_float": return eventKey("Float", Event.TOGGLE_FLOATING, FLAG_SMALLER_FONT);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added an icon for the button in the status bar, so the key could use it too.
Add the (original) svg to srcs/special_font and run gradle buildKeyboardFont. The next available name is 01D.svg. I can run the build if the dependencies are a problem.

Comment thread srcs/juloo.keyboard2/KeyValue.java Outdated
case "complete_emoji": return statefulKey(Stateful.Complete_emoji);
case "hide_self": return eventKey("⊻", Event.HIDE_SELF, FLAG_SMALLER_FONT);
case "change_dictionary": return eventKey(0xE01D, Event.CHANGE_DICTIONARY, 0);
case "toggle_float": return eventKey("Float", Event.TOGGLE_FLOATING, FLAG_SMALLER_FONT);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key should perhaps be called toggle_floating to be consistent with the event name. (or the opposite)

Comment thread .gitignore Outdated
# Directory _build is not used anymore
/_build
/release
/.opencode

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add these to your personal gitignore. I don't want to support dev environments in this file because it creates constant maintenance.

private int floatingWindowWidth()
{
android.util.DisplayMetrics dm = getResources().getDisplayMetrics();
return (int)Math.min(dm.widthPixels * Config.FLOATING_KEYBOARD_WIDTH_RATIO,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same computation is done in Keyboard2View too. It would be nice to share this. Or perhaps compute it in one place and store the result in Config.

private FoldStateTracker _foldStateTracker;

/** Drag state of the floating keyboard handle. */
private float _dragStartX;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if all the code that works with the floating handle be moved in an other class. Maybe it could be moved into FloatingHandleView with a callback to call back into Keyboard2.
Perhaps the code that goes in and out of floating mode could also go in a new class ?

_status_no_dict.setVisibility(View.GONE);
should_show_dictionary_switch = config.should_show_dictionary_switch;
_floating_toggle_button.setSelected(config.floating_keyboard);
_floating_toggle_button.setVisibility(View.VISIBLE);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always visible. Did you plan to remove the button in some cases ?
Does floating mode makes sense on small screens ? Perhaps the button should be removed in this case ?

Aligns the key name with the underlying Event.TOGGLE_FLOATING constant
for consistency with other key-to-event mappings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants