Skip to content

feat: Add floating keyboard functionality to Scribe-Android (#261)#621

Open
prince-0408 wants to merge 12 commits into
scribe-org:mainfrom
prince-0408:feature/floating-keyboard-261
Open

feat: Add floating keyboard functionality to Scribe-Android (#261)#621
prince-0408 wants to merge 12 commits into
scribe-org:mainfrom
prince-0408:feature/floating-keyboard-261

Conversation

@prince-0408

Copy link
Copy Markdown
Contributor

Description

This pull request implements and refines the floating keyboard functionality for Scribe-Android. It introduces a movable, resizable, and floating keyboard layout, and resolves various styling issues across both light and dark modes.

Adding this feature solves a major point of confusion during onboarding/development where developers couldn't locate the keyboard in emulators that default to a floating state. It also greatly improves the keyboard experience in full-screen games, split-screen multitasking, and landscape layouts on tablet/phone screens.

Closes #261

Changes Made

  • Floating Keyboard Layout & Controls:
    • Integrated floating_drag_bar with visibility state tied to the floating preference.
    • Implemented real-time dragging via a customized floating_drag_handle pill.
    • Added support for scaling/resizing the keyboard dynamically using custom touch listeners on 4 corner handles (resize_handle_top_left/right and resize_handle_bottom_left/right).
  • Drag Handle Aesthetics:
    • Resized the bottom drag handle to a thicker (5dp) and wider (64dp canvas) rounded capsule.
    • Set a larger layout height (32dp) to comfortably display the updated handle.
  • Corner Resize Handles Visibility:
    • Defined a neutral, high-contrast resource resize_handle_color for both modes (#FF555555 solid medium-dark grey in light mode, and #FFB0B0B0 solid medium-light grey in dark mode).
    • This ensures they are clearly visible over light, dark, and blue backgrounds (such as the tutorial pages).
  • Docked Mode Background Leak Fix:
    • Configured keyboard_card to dynamically update its background color based on the current theme (dark_keyboard_bg_color or light_keyboard_bg_color) instead of using a static light grey.
    • This fixes the background color leak gap at the bottom of the docked keyboard.

Screenshots

SS3 SS2 SS1

@github-actions

Copy link
Copy Markdown

Thank you for the pull request! 💙🩵

The Scribe-Android team will do our best to address your contribution as soon as we can. The following are some important points:

  • Those interested in developing their skills and expanding their role in the community should read the mentorship and growth section of the contribution guide
  • If you're not already a member of our public Matrix community, please consider joining!
    • We'd suggest that you use the Element client as well as Element X for a mobile app
    • Join the General and Android rooms once you're in
  • Also consider attending our bi-weekly Saturday developer syncs!
    • Details are shared in the General room on Matrix each Wednesday before the sync
    • It would be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions

Copy link
Copy Markdown

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • Tests for changes have been written and the unit test, linting and formatting workflows within the PR checks do not indicate new errors in the files changed

    • Tests may need to be reran as they're at times not deterministic
  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis andrewtavis self-requested a review June 23, 2026 18:12
@andrewtavis

Copy link
Copy Markdown
Member

praise: Hey @prince-0408 👋 This is really cool that we're getting to this!

note: There are a few thing that are sticking out to me that I think we should rework :)

  • I don't think that the floating keyboard button should be at the top of the keyboard as it's not a Scribe command
  • Maybe we can have a key that's between the ?123 key and the , key?
    • To make the keyboard float, the key could be a move vector (ideally the Android version of this)
    • To dock the keyboard again, the icon would switch to a down arrow vector (again, the Android version)
    • Let me know on this!
  • In floating keyboard mode, maybe we want the command keys to have icons as labels rather than words?

Let me know on the comments above! If you agree, then feel free to make the changes and then we can continue with the review :)

@prince-0408

Copy link
Copy Markdown
Contributor Author

praise: Hey @prince-0408 👋 This is really cool that we're getting to this!

note: There are a few thing that are sticking out to me that I think we should rework :)

  • I don't think that the floating keyboard button should be at the top of the keyboard as it's not a Scribe command

  • Maybe we can have a key that's between the ?123 key and the , key?

    • To make the keyboard float, the key could be a move vector (ideally the Android version of this)
    • To dock the keyboard again, the icon would switch to a down arrow vector (again, the Android version)
    • Let me know on this!
  • In floating keyboard mode, maybe we want the command keys to have icons as labels rather than words?

Let me know on the comments above! If you agree, then feel free to make the changes and then we can continue with the review :)

Hey @andrewtavis 👋 Thanks for the feedback!

These suggestions make a lot of sense:

  • Relocating the toggle: I agree that the float button doesn't belong with Scribe commands, so I'll remove it from the top bar.
  • Dedicated key: I will add a toggle key between the ?123 key and the , key. It will dynamically swap icons: showing a move vector when docked, and switching to a down arrow vector when floating to dock it back.
  • Command icons: Switching the command buttons to use clean icons instead of text labels when in floating mode is a great way to handle the smaller width.

I will get these changes implemented and push them shortly!

@prince-0408

Copy link
Copy Markdown
Contributor Author

Hey @andrewtavis 👋

I've updated the branch with all your suggestions! The float button has been removed from the top command strip and reworked into a dedicated bottom-row key, command labels now swap to icons in floating mode to fit the smaller width, and orientation/resizing drawing glitches have been fixed.

Here's a summary of everything implemented in this update:


Summary of Changes

Feature / Component Previous Behavior New Behavior
Float Toggle Location Float button sat in the top suggestion/command bar, next to Plural. Dedicated bottom-row key relocated between ?123 and ,. Adjacent key widths scale dynamically to keep the row balanced.
Float Key Icon Displayed static text "Float". Dynamic vectors — shows a move icon (ic_float_keyboard) when docked, swaps to a down-arrow (ic_keyboard_dismiss) when floating to allow docking back.
Scribe Command Labels Always displayed text ("Translate", "Conjugate", "Plural"). Text → icon swap — displays text when docked, automatically switches to vector icons in floating mode to fit the narrower 320dp layout.
Docking Resize Glitch Transitioning from floating → docked left a blue background block on the right until the next touch. Immediate redraw — overrode onSizeChanged in KeyboardView to force-recreate the key drawing buffer and redraw the canvas on resize, eliminating the artifact.

Visual Comparison

Docked Mode (move icon & text labels) Floating Mode (down-arrow icon & icon labels)
Docked Mode Floating Mode

@andrewtavis

Copy link
Copy Markdown
Member

praise: Thanks for the quick reaction to the review, @prince-0408! All's looking great :)

note: One thing that would be nice to have here is the keys should be a bit wider. Specifically the comma key and the flat key seem to be too narrow. Can we reduce the size of the space bar and make sure that those keys are appropriately sized?

note: I'm discussing this with @angrezichatterbox and @henrikth93 right now, and we wanted to note that floating keyboards are normally controlled in the settings of the keyboard. We only have one keyboard setting that would need to be triggered in the keyboard UI now - this new floating keyboard - but if we were to get more, then we could switch that key to a settings key.

@andrewtavis andrewtavis mentioned this pull request Jun 26, 2026
2 tasks
@andrewtavis

Copy link
Copy Markdown
Member

note, @prince-0408: We've made #642 to add options to hide the keys for the floating keyboard and clipboard to make sure that they UI doesn't get to cluttered with keys that may not be being used. We'll get to that one once this is finalized. Please let us know if you need support with the last parts here!

@prince-0408

prince-0408 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

note, @prince-0408: We've made #642 to add options to hide the keys for the floating keyboard and clipboard to make sure that they UI doesn't get to cluttered with keys that may not be being used. We'll get to that one once this is finalized. Please let us know if you need support with the last parts here!

@andrewtavis
Noted on #642! Makes sense to handle the toggle options after this is merged.

I'm currently working on the final parts and will push an update soon. I'll definitely reach out if I need any support wrapping this up. Thanks!

@andrewtavis

Copy link
Copy Markdown
Member

Let us know when this is ready for a final review, @prince-0408! :)

@prince-0408

Copy link
Copy Markdown
Contributor Author

Hey @andrewtavis 👋

Thanks for the feedback! I've just updated the branch to address the key sizing issue you pointed out, and I've also pulled in the latest changes from main to resolve all the merge conflicts with the new clipboard features.

Everything is looking good on my end. Here's a summary of the latest updates:


Summary of Changes

Feature / Component Previous Behavior New Behavior
Key Widths (Bottom Row) The comma (,), underscore (_), and floating keyboard toggle keys were a bit too narrow (around 7.5% - 8% width). Wider keys — Increased the width of these keys to 10% each to make them more appropriately sized and easier to hit.
Space Bar Resizing The space bar took up 47.5% of the width on alphabetic layouts. Reduced width — Scaled the space bar down to 43% to seamlessly accommodate the wider comma and float toggle keys without breaking the row layout.
Upstream Sync & Conflicts Branch was conflicting with recent main updates (specifically the new clipboard UI). Resolved all conflicts — Cleanly merged the upstream clipboard changes into the floating keyboard constraint layout structure. Fixed all failing ktlint checks.

Updated Layout

Screenshot 1 Screenshot 2
Screenshot 2026-07-06 at 2 07 34 AM Screenshot_20260706_021057

Noted on the settings toggle in #642 as well! That sounds like a great plan for organizing the floating/clipboard features going forward.

Please let me know if there's anything else needed before we finalize this!

@andrewtavis

Copy link
Copy Markdown
Member

Hey @prince-0408 👋 Two comments on here, with the first being a nitpick and the second being something we need to look into here :)

  • Firstly, I think we need to get the float icon fixed for light mode (see below)
Screenshot 2026-07-05 at 23 31 44
  • Secondly, aside from the Scribe app itself the keyboard isn't able to float in other apps
    • It seems to be blocked in Google apps
    • In messages we can see the icon as in the image above, but when I click it the message input goes away
    • Could we do some research here?

@prince-0408

prince-0408 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Hey @prince-0408 👋 Two comments on here, with the first being a nitpick and the second being something we need to look into here :)

  • Firstly, I think we need to get the float icon fixed for light mode (see below)
Screenshot 2026-07-05 at 23 31 44
  • Secondly, aside from the Scribe app itself the keyboard isn't able to float in other apps
    • It seems to be blocked in Google apps
    • In messages we can see the icon as in the image above, but when I click it the message input goes away
    • Could we do some research here?

On it @andrewtavis, will update soon

@prince-0408

prince-0408 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Hey @andrewtavis 👋

Great catches on both issues! I've just pushed a few updates to address them.

Here is a summary of the fixes:

Issue / Feature Previous Behavior New Behavior / Fix
Light Mode Icon The float toggle key wasn't getting the dynamic text color tint applied to it, making it invisible in light mode. Updated KeyboardView logic so the float toggle key properly takes on the black tint in light mode and white tint in dark mode.
Floating in Google Apps Floating keyboard returned 0 for visibleTopInsets and contentTopInsets, causing Google Messages to assume the screen was covered and hide its input field. Updated insets to report inputView.height (bottom of the screen). Apps now correctly treat the floating keyboard as taking up 0 space and won't hide inputs.
Search Bar Support Float toggle button was intentionally hidden when typing in search bars to save space. Removed this restriction. The float toggle and clipboard keys can now be consistently accessed across all input fields.
Merge Conflicts colors.xml had lingering merge conflicts from recent updates. Cleanly resolved the colors.xml merge conflicts.
i18n Submodule Sync Missing string warnings were showing up in the CI checks. Pulled the latest from Scribe-i18n and ran the Gradle task to regenerate string.xml, bringing in your new clipboard and float setting strings.

Previews

The keyboard now floats perfectly in Google Messages without hiding the input field, and the float toggle key is visible in light mode.

Floating Keyboard in Google Messages Light Mode Fix

Everything should be working smoothly now. Let me know if you spot anything else!

@andrewtavis

Copy link
Copy Markdown
Member

Thanks for the further commits, @prince-0408! We'll try to get to a final review in the coming days :)

CC @angrezichatterbox 👋

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.

Add floating keyboard functionality to Scribe-Android

2 participants