Skip to content

Add Swipe to Delete, Swipe to Restore, and Interactive Gesture Onboarding Tutorial #622

@prince-0408

Description

@prince-0408

Terms

Description

Summary

Scribe Keyboard currently has no gesture-based text editing. Users must tap the
backspace key repeatedly to delete text, with no quick way to undo accidental
deletions. This issue proposes adding swipe gestures for delete and undo, along
with an interactive onboarding tutorial to introduce the feature on first use.


Problem

  • Deleting text is slow — requires repeated taps on backspace
  • There is no undo gesture or quick way to recover accidentally deleted text
  • New gesture features have no discoverability mechanism for existing or new users

Proposed solution

Add two horizontal swipe gestures to the keyboard surface:

  • Swipe left — deletes the previous word or character (user-configurable).
    Haptic tick feedback fires on each deletion step.
  • Swipe right — restores the most recently deleted block from a history stack,
    in sequence.

On first launch after the feature ships, show a one-time interactive tutorial
overlay that walks the user through both gestures with live practice.


Gesture behaviour

  • Swipe threshold: 80px horizontal travel to register a gesture
  • Step increment: 45px per deletion/restoration tick
  • The history stack clears automatically when the cursor moves or the user
    types normally, preventing incorrect restoration context

Tutorial flow

The overlay is non-blocking — touches pass through so users practice on the
real keyboard. Controlled by a swipe_tutorial_shown preference flag.

Step Instruction Advances when
1 Swipe left to delete "Scribe " Word successfully deleted
2 Swipe right to restore "Scribe " Word successfully restored
Tap Got it! to finish Preference saved, overlay closed

A Skip button is available during steps 1 and 2 to dismiss immediately.


Visual design

The tutorial overlay uses a dark-slate translucent background with minimalist
illustrations of three keyboard keys and gesture trails:

  • 🔵 Swipe left — indigo/blue sweep line
  • 🟢 Swipe right — emerald green sweep line
  • Success — emerald green checkmark over the key outline

Proposed implementation scope

Logic changes

File Work required
KeyboardView.kt Add onSwipeLeft() / onSwipeRight() to action listener interface. Track horizontal gesture travel in onModifiedTouchEvent(). Abort default click handling during swipe. Fire haptic feedback.
BackspaceHandler.kt Implement deletedChunksStack (java.util.Stack). Add performSwipeDelete() (push + delete) and performSwipeRestore() (pop + insert). Clear stack on cursor change or normal key input.
GeneralKeyboardIME.kt Declare SwipeTutorialState enum (NOT_ACTIVE, SWIPE_LEFT_STEP, SWIPE_RIGHT_STEP, COMPLETED). Route gesture events. Drive tutorial step progression. Auto-insert "Scribe " at tutorial start.

Layout & assets

File Work required
input_method_view.xml Set android:clickable="false" and android:focusable="false" on overlay for touch pass-through. Redesign to show one instruction + one illustration + one action button at a time.
ic_swipe_left.xml Three-key outline with indigo/blue gesture trail
ic_swipe_right.xml Three-key outline with emerald green gesture trail
ic_swipe_success.xml (New file) Three-key outline with emerald green checkmark

Tests

File Work required
BackspaceHandlerTest.kt JUnit/Robolectric tests for stack push/pop, deletion offsets, character vs. word-by-word modes, and automatic stack clearing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions