Mercurial > cgi-bin > hgweb.cgi > SimpleResizer
diff app/src/main/java/com/bartsent/simpleresizer/MainActivity.kt @ 30:aacf7a856b5f
Bug fixes, incl for getting "stuck" when file chooser backed out of.
author | David Barts <n5jrn@me.com> |
---|---|
date | Wed, 24 Feb 2021 19:14:50 -0800 |
parents | 20da616dcda0 |
children | 0023e6013dd9 |
line wrap: on
line diff
--- a/app/src/main/java/com/bartsent/simpleresizer/MainActivity.kt Wed Feb 24 18:44:47 2021 -0800 +++ b/app/src/main/java/com/bartsent/simpleresizer/MainActivity.kt Wed Feb 24 19:14:50 2021 -0800 @@ -23,14 +23,17 @@ override fun onResume() { super.onResume() - if (showChooser) { - Intent(Intent.ACTION_GET_CONTENT).run { - type = "image/*" - addCategory(Intent.CATEGORY_OPENABLE) - startActivityForResult(this, GET_IMAGE) - } - } else { + if (showChooser) + doShowChooser() + else showChooser = true + } + + fun doShowChooser(): Unit { + Intent(Intent.ACTION_GET_CONTENT).run { + type = "image/*" + addCategory(Intent.CATEGORY_OPENABLE) + startActivityForResult(this, GET_IMAGE) } } @@ -45,6 +48,7 @@ } } else { Toast.makeText(applicationContext, "Unable to get image!", Toast.LENGTH_LONG).show() + doShowChooser() } } }