Skip to content

Allow copying the context menu title by long-pressing the header#25372

Open
MiMoHo wants to merge 1 commit into
osmandapp:masterfrom
MiMoHo:fix-context-menu-copy-title
Open

Allow copying the context menu title by long-pressing the header#25372
MiMoHo wants to merge 1 commit into
osmandapp:masterfrom
MiMoHo:fix-context-menu-copy-title

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 4, 2026

Copy link
Copy Markdown

Summary

Place names and OSM note texts shown as the context menu title are often needed elsewhere — a typical case is copying an OSM note text into a translator before answering it, since notes are frequently written in the local language. Info and description rows of the menu already support copy on long-press; the title did not.

Implementation

A plain OnLongClickListener on the title TextView never receives events because the menu header consumes all touches for the slide gestures (InterceptorLinearLayout + slideTouchListener) — verified on an emulator, where the long-press fell through to the map and selected a new point. The long-press is therefore detected by a GestureDetector inside the existing slideTouchListener, in the same header-area branch that already handles tap-to-expand, and copies menu.getTitleStr() via the existing ShareMenu.copyToClipboardWithToast(). Movement cancels the long-press through the detector's built-in touch-slop handling, so the slide gestures are unaffected.

Testing

Verified on an Android 15 (API 35) emulator with a debug build of this branch:

  • long-press on the title → toast "Copied to clipboard: Testbakery Three" and the Android system clipboard overlay confirming the copied text;
  • single tap on the header still expands the menu to half screen;
  • dragging the header still slides the menu up/down.

🤖 Generated with Claude Code — model: Claude Fable 5, reasoning effort: xhigh

Place names and OSM note texts are often needed elsewhere, e.g. for
translating a note before answering it; info and description rows were
already copyable this way. The header consumes all touch events for
the menu slide gestures, so the long press is detected by a gesture
detector inside that touch listener.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant