File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
app/src/main/kotlin/de/markusfisch/android/binaryeye/activity Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import android.graphics.Matrix
99import android.graphics.Rect
1010import android.hardware.Camera
1111import android.net.Uri
12+ import android.os.Build
1213import android.os.Bundle
1314import android.support.design.widget.FloatingActionButton
1415import android.support.v7.app.AppCompatActivity
@@ -356,16 +357,23 @@ class CameraActivity : AppCompatActivity() {
356357 return
357358 }
358359
359- // Read text from file
360- val textUri = intent.getParcelableExtra(Intent .EXTRA_STREAM ) as Uri ?
361- if (textUri != null ) {
360+ // Read text from file.
361+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .TIRAMISU ) {
362+ @Suppress(" DEPRECATION" )
363+ intent.getParcelableExtra(Intent .EXTRA_STREAM ) as Uri ?
364+ } else {
365+ intent.getParcelableExtra(Intent .EXTRA_STREAM , Uri ::class .java)
366+ }?.let { textUri ->
362367 val file = contentResolver.openFileDescriptor(textUri, " r" )
363368 if (file != null ) {
364369 val fs = FileInputStream (file.fileDescriptor)
365370 val scn = Scanner (fs).useDelimiter(" \\ A" )
366371 if (scn.hasNext()) {
367- val fText = scn.next()
368- startActivity(MainActivity .getEncodeIntent(this , fText, true ))
372+ startActivity(
373+ MainActivity .getEncodeIntent(
374+ this , scn.next(), true
375+ )
376+ )
369377 finish()
370378 }
371379 file.close()
You can’t perform that action at this time.
0 commit comments