toga icon indicating copy to clipboard operation
toga copied to clipboard

Android DetailedList doesn't respond to left/right swipes

Open freakboy3742 opened this issue 4 months ago • 2 comments

Describe the bug

The documentation for DetailedList currently says:

On platforms that use swipe interactions, the primary action will be associated with “swipe left”, and the secondary action will be associated with “swipe right”. Other platforms may implement the primary and secondary actions using a different UI interaction (e.g., a right-click context menu). The primary and secondary actions will only be enabled in the DetailedList UI if a handler has been provided.

While technically correct, this is somewhat misleading for Android. Most people would say that Android is a "platform that uses swipe interactions"; but Android implements actions as a pop up menu.

Steps to reproduce

See the documentation for DetailedList.

Expected behavior

  1. As an immediate bugfix, the documentation should be updated to better describe which platforms use which UI interaction
  2. Longer term, we should investigate if swipe-based interactions can (or even should) be implemented on Android.

Screenshots

No response

Environment

  • Operating System: Android
  • Python version: All
  • Software versions:
    • Toga: 0.5.2

Logs


Additional context

It's not clear to me from the Material3 guidelines if swipe interactions on a DetailedList would be idiomatic on Android. If it's not, the "enhancement" portion of this ticket can be ignored.

From a quick API search, it definitely isn't a feature that is easily exposed as an "on_fling" handler (or similar) - it looks like it would need a whole RecyclerView infrastructure piece.

freakboy3742 avatar Aug 27 '25 22:08 freakboy3742

can i try this ???

rovertrack avatar Aug 28 '25 15:08 rovertrack

If you want to clarify the documentation, then you're welcome to create a PR.

If you want to change the implementation, then please first post a comment describing how you would change it, and your reasoning for doing it that way.

mhsmith avatar Aug 28 '25 16:08 mhsmith

Just my 2 cents, maybe it clarifies things a bit:

I just found that swipe did not work for me on Android.

My expectation was that I can swipe the DetailedList entry from left to right (or vice versa) since the term "swipe" is mentioned in the Toga documentation and "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" has to be added to the Gradle dependencies for Android.

My expectation was wrong. DetailedList on Android does not support swiping.

Thanks to this issue I found that I needed to long-press a DetailedList item. When I do it, a dialog with "Delete" and "Action" opens which correspond to the primary_action_handler and secondary_action_handler.

cjaone avatar Nov 16 '25 21:11 cjaone