1
+ /*
2
+ * Copyright 2024 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1
17
package com.example.compose.snippets.draganddrop
2
18
3
19
import android.content.ClipData
@@ -45,7 +61,8 @@ fun DragAndDropSnippet() {
45
61
DragAndDropTransferData (
46
62
ClipData .newPlainText(
47
63
" image Url" , url
48
- ), flags = View .DRAG_FLAG_GLOBAL
64
+ ),
65
+ flags = View .DRAG_FLAG_GLOBAL
49
66
)
50
67
)
51
68
})
@@ -74,22 +91,22 @@ fun DragAndDropSnippet() {
74
91
// [START android_compose_drag_and_drop_5]
75
92
object : DragAndDropTarget {
76
93
override fun onStarted (event : DragAndDropEvent ) {
77
- // When the drag event starts
94
+ // When the drag event starts
78
95
}
79
96
80
97
override fun onEntered (event : DragAndDropEvent ) {
81
- // When the dragged object enters the target surface
98
+ // When the dragged object enters the target surface
82
99
}
83
100
84
101
override fun onEnded (event : DragAndDropEvent ) {
85
- // When the drag event stops
102
+ // When the drag event stops
86
103
}
87
104
88
105
override fun onExited (event : DragAndDropEvent ) {
89
- // When the dragged object exits the target surface
106
+ // When the dragged object exits the target surface
90
107
}
91
108
92
109
override fun onDrop (event : DragAndDropEvent ): Boolean = true
93
110
}
94
111
// [END android_compose_drag_and_drop_5]
95
- }
112
+ }
0 commit comments