Last active
December 16, 2021 16:42
-
-
Save pflammertsma/941ce0e283fb2d792715bd46ebef0d66 to your computer and use it in GitHub Desktop.
Sample of DropHelper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2021 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
DropHelper.configureView( | |
// Activity that will handle the drop | |
this, | |
// Target drop view to be highlighted | |
outerDropTarget, | |
// Supported MIME types | |
arrayOf(MIMETYPE_TEXT_PLAIN, "image/*"), | |
// Options for configuring drop targets | |
DropHelper.Options.Builder() | |
// To ensure proper drop target highlighting, all EditText elements in | |
// the drop target view hierarchy must be included in a call to this | |
// method. Otherwise, an EditText within the target, rather than the | |
// target view itself, acquires focus during the drag and drop operation. | |
.addInnerEditTexts(innerEditText) | |
.build() | |
) { _, payload -> | |
// Process the payload here, returning any content that should be delegated to | |
// the platform. | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment