android / nowinandroid

A fully functional Android app built entirely with Kotlin and Jetpack Compose
Apache License 2.0
16.62k stars 3.01k forks source link

Add drag feature #1557

Closed tiwiz closed 1 month ago

tiwiz commented 2 months ago

Add Drag feature to article title. This will allow for sharing the content across apps.

https://github.com/user-attachments/assets/15e6fbf2-9fe4-4def-9c5b-50748c8c6581

Jaehwa-Noh commented 2 months ago

This feature is for multi-window user, is there any way to check the window state? For just activate it when user in multi-window.

tiwiz commented 2 months ago

There is an API to detect if the app is running in [multi-window environment](https://developer.android.com/reference/android/app/Activity#isInMultiWindowMode()), but I would rather not use it: many OEMs have features (like shelves, or similar) that allow users to Drag and item to a temporary part and drop it once they change app, so only enabling this feature in multi-window would limit those use-cases as well

Jaehwa-Noh commented 2 months ago

I got a point. Thank you.

Jaehwa-Noh commented 2 months ago

Screen_recording_20240730_102043.webm

I found a bug, drag and drop works only once. Is this bug origin from drag and drop function?

tiwiz commented 2 months ago

Good catch! I think it might have something to do with scrollable container, rather than draggableSource, as I was able to init the feature multiple times. Let me investigate further

EDIT: we have a bug tracking the issue open.

danybony commented 1 month ago

Nice one! LGTM