Last active
June 14, 2019 12:02
-
-
Save deepakkumardk/63cbf0335847cf365ecaf5a420815e3d to your computer and use it in GitHub Desktop.
Identifying the source of image and handling it
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
private fun handleSendImage(intent: Intent) { | |
val imageUri = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM) | |
if (imageUri.toString().contains("com.google.android.apps.docs")) { //From Google Drive | |
// show the progress bar until the you get the file | |
this.createTempFile(imageUri, DriveTempFileCallback { | |
// hide the progress bar | |
// file -- handle the file as you want | |
}) | |
} else { //From gallery intent | |
// handle signle image from gallary intent | |
} | |
} | |
private fun handleSendMultipleImages(intent: Intent) { | |
val imageUris = intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM) | |
if (imageUris.size > 1 && imageUris[0].toString().contains("com.google.android.apps.docs")) { | |
// show the progress bar until the you get the URI list | |
this.getUriListFromTempFile(imageUris, DriveImageCallback { | |
// hide the progress bar | |
// list -- handle the arrayList of Uri | |
}) | |
} else { | |
// handle multiple images from gallary intent | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment