diff --git a/app/src/main/java/ru/panorobot/fc/MainActivity.kt b/app/src/main/java/ru/panorobot/fc/MainActivity.kt index 33b59cf..ab984e0 100644 --- a/app/src/main/java/ru/panorobot/fc/MainActivity.kt +++ b/app/src/main/java/ru/panorobot/fc/MainActivity.kt @@ -31,10 +31,6 @@ class MainActivity : AppCompatActivity() { var runnable = object:Runnable{ override fun run() { cameraSource.stop() -// val alert = builder.create() -// alert.show() -// startActivity(Intent(this@MainActivity, Photo::class.java)) - taskHandler.removeCallbacksAndMessages(null) } } @@ -80,9 +76,11 @@ class MainActivity : AppCompatActivity() { override fun surfaceCreated(holder: SurfaceHolder?) { print("4") if (ContextCompat.checkSelfPermission(this@MainActivity, android.Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) -// && (ContextCompat.checkSelfPermission(this@MainActivity, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) == PackageManager.PERMISSION_GRANTED)) cameraSource.start(svBarcode.holder) - else ActivityCompat.requestPermissions(this@MainActivity, arrayOf(android.Manifest.permission.CAMERA), 321) + else { + cameraSource.stop() + ActivityCompat.requestPermissions(this@MainActivity, arrayOf(android.Manifest.permission.CAMERA), 123) + } } }) @@ -96,11 +94,6 @@ class MainActivity : AppCompatActivity() { cameraSource.start(svBarcode.holder) else Toast.makeText(this, "scanner", Toast.LENGTH_SHORT).show() } - if (requestCode == 321) { - if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) -// cameraSource.start(svBarcode.holder) - else Toast.makeText(this, "scanner", Toast.LENGTH_SHORT).show() - } } override fun onDestroy() { diff --git a/app/src/main/java/ru/panorobot/fc/Photo.kt b/app/src/main/java/ru/panorobot/fc/Photo.kt index b511ab0..37427af 100644 --- a/app/src/main/java/ru/panorobot/fc/Photo.kt +++ b/app/src/main/java/ru/panorobot/fc/Photo.kt @@ -25,10 +25,6 @@ class Photo : AppCompatActivity() { startActivity(intent) } - - - - if (ContextCompat.checkSelfPermission( this@Photo, android.Manifest.permission.READ_EXTERNAL_STORAGE @@ -39,7 +35,6 @@ class Photo : AppCompatActivity() { arrayOf(android.Manifest.permission.READ_EXTERNAL_STORAGE), 123 ) - // TODO: 26.06.2020 Добавить коллбэк } else { getPhoto() } @@ -69,8 +64,5 @@ class Photo : AppCompatActivity() { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) getPhoto() else Toast.makeText(this, "Необходим доступ для показа фото", Toast.LENGTH_SHORT).show() - -// super.onRequestPermissionsResult(requestCode, permissions, grantResults) - // } } \ No newline at end of file