|
|
|
@ -43,7 +43,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
|
|
|
|
|
ensureWritePermission()
|
|
|
|
|
|
|
|
|
|
findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { _ ->
|
|
|
|
|
findViewById<FloatingActionButton>(R.id.fab).setOnClickListener {
|
|
|
|
|
if (hasWritePermission) {
|
|
|
|
|
openCamera()
|
|
|
|
|
} else {
|
|
|
|
@ -294,8 +294,8 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
return false
|
|
|
|
|
val currentFile = File(currentVideoPath)
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
|
|
|
val store = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
|
|
|
|
|
val videoDetails = ContentValues();
|
|
|
|
|
val store = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
|
|
|
|
|
val videoDetails = ContentValues()
|
|
|
|
|
videoDetails.put(MediaStore.Video.Media.IS_PENDING, 1)
|
|
|
|
|
val uri = contentResolver.insert(store, videoDetails)
|
|
|
|
|
?: return false .also { toast("Could not put video to media store.") }
|
|
|
|
@ -309,7 +309,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
videoDetails.clear()
|
|
|
|
|
videoDetails.put(MediaStore.Video.Media.IS_PENDING, 0)
|
|
|
|
|
contentResolver.update(uri, videoDetails, null, null)
|
|
|
|
|
currentVideoUri = uri;
|
|
|
|
|
currentVideoUri = uri
|
|
|
|
|
toast("Video saved to media store!")
|
|
|
|
|
} else {
|
|
|
|
|
val externalDir = File(
|
|
|
|
|