reuse the ShareUri activity extension for sharing
This commit is contained in:
parent
3fa5dc5300
commit
ae97c84bd8
|
@ -256,16 +256,11 @@ class MainActivity : SimpleActivity(), MyCanvas.PathsChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shareImage() {
|
private fun shareImage() {
|
||||||
val shareTitle = resources.getString(R.string.share_via)
|
val uri = getImageUri(my_canvas.getBitmap())
|
||||||
val uri = getImageUri(my_canvas.getBitmap()) ?: return
|
if (uri != null) {
|
||||||
|
shareUri(uri, BuildConfig.APPLICATION_ID)
|
||||||
Intent().apply {
|
} else {
|
||||||
action = Intent.ACTION_SEND
|
toast(R.string.unknown_error_occurred)
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
|
||||||
setDataAndType(uri, contentResolver.getType(uri))
|
|
||||||
putExtra(Intent.EXTRA_STREAM, uri)
|
|
||||||
type = "image/*"
|
|
||||||
startActivity(Intent.createChooser(this, shareTitle))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue