-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDropTargetCallback.kt
More file actions
35 lines (29 loc) · 1005 Bytes
/
DropTargetCallback.kt
File metadata and controls
35 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.itsaky.androidide.dnd
import android.view.DragEvent
import android.view.View
/**
* Callback interface for handling routed drag-and-drop events on a specific target view.
*/
interface DropTargetCallback {
/**
* Determines whether the current [event] contains data that this target can handle.
*/
fun canAcceptDrop(event: DragEvent): Boolean
/**
* Called when a drag operation begins. Useful for applying initial visual cues.
*/
fun onDragStarted(view: View) {}
/**
* Called when a valid dragged item enters the bounds of the target [view].
*/
fun onDragEntered(view: View)
/**
* Called when a dragged item exits the target [view], or when the drag operation ends/is canceled.
*/
fun onDragExited(view: View)
/**
* Called when the user successfully drops a valid item on the target.
* @return True if the drop was successfully consumed and handled.
*/
fun onDrop(event: DragEvent): Boolean
}