comparison app/src/main/java/com/bartsent/simpleresizer/EditImage.kt @ 29:eec88eba58e9

Fix receiving from another app.
author David Barts <n5jrn@me.com>
date Wed, 24 Feb 2021 18:44:47 -0800
parents 648908f492c0
children aacf7a856b5f
comparison
equal deleted inserted replaced
28:cf9621e88d2d 29:eec88eba58e9
92 } 92 }
93 93
94 override fun onResume() { 94 override fun onResume() {
95 super.onResume() 95 super.onResume()
96 96
97 Log.d("EditImage", "intent action = ${intent?.action ?: "(none)"}")
97 // Read the URI, die if we can't. 98 // Read the URI, die if we can't.
98 val imageUri = intent?.data 99 val imageUri = intent?.data ?: intent?.extras?.get(Intent.EXTRA_STREAM) as? Uri
99 if (imageUri == null) { 100 if (imageUri == null) {
100 if (State.bitmap == null) 101 if (State.bitmap == null)
101 showFatalError(getString(R.string.error_no_uri)) 102 showFatalError(getString(R.string.error_no_uri))
102 else 103 else
103 setImage(State.bitmap!!) 104 setImage(State.bitmap!!)