mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Improvements
This commit is contained in:
parent
9d4345c2d1
commit
ef6487903e
@ -26,6 +26,14 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||||
|
|
||||||
|
<!-- Todo: Check android permissions -->
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="28" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="28" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".UpdateSettingsApp"
|
android:name=".UpdateSettingsApp"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -429,10 +429,10 @@ data class VideoRecorderSettings(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMimeType() = "video/mp4"
|
fun getMimeType() = "video/$fileExtension"
|
||||||
|
|
||||||
val fileExtension
|
val fileExtension
|
||||||
get() = "mp4"
|
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) "mp4" else "3gp"
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getDefaultInstance() = VideoRecorderSettings()
|
fun getDefaultInstance() = VideoRecorderSettings()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package app.myzel394.alibi.helpers
|
package app.myzel394.alibi.helpers
|
||||||
|
|
||||||
import android.content.ContentUris
|
import android.content.ContentUris
|
||||||
|
import android.content.ContentValues
|
||||||
import app.myzel394.alibi.ui.MEDIA_RECORDINGS_PREFIX
|
import app.myzel394.alibi.ui.MEDIA_RECORDINGS_PREFIX
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@ -31,7 +32,7 @@ abstract class BatchesFolder(
|
|||||||
abstract val mediaContentUri: Uri
|
abstract val mediaContentUri: Uri
|
||||||
|
|
||||||
val mediaPrefix
|
val mediaPrefix
|
||||||
get() = MEDIA_RECORDINGS_PREFIX + subfolderName + "-"
|
get() = MEDIA_RECORDINGS_PREFIX + subfolderName.substring(1) + "-"
|
||||||
|
|
||||||
fun initFolders() {
|
fun initFolders() {
|
||||||
when (type) {
|
when (type) {
|
||||||
@ -69,14 +70,10 @@ abstract class BatchesFolder(
|
|||||||
)!!.use { cursor ->
|
)!!.use { cursor ->
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
val rawName = cursor.getColumnIndex(Media.DISPLAY_NAME).let { id ->
|
val rawName = cursor.getColumnIndex(Media.DISPLAY_NAME).let { id ->
|
||||||
if (id == -1) "" else cursor.getString(id)
|
if (id == -1) null else cursor.getString(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawName == "" || rawName == null) {
|
if (rawName.isNullOrBlank() || !rawName.startsWith(mediaPrefix)) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rawName.startsWith(mediaPrefix)) {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,10 +82,10 @@ abstract class BatchesFolder(
|
|||||||
?: continue
|
?: continue
|
||||||
|
|
||||||
val id = cursor.getColumnIndex(Media._ID).let { id ->
|
val id = cursor.getColumnIndex(Media._ID).let { id ->
|
||||||
if (id == -1) "" else cursor.getString(id)
|
if (id == -1) null else cursor.getString(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == "" || id == null) {
|
if (id.isNullOrBlank()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +327,7 @@ abstract class BatchesFolder(
|
|||||||
return File(getInternalFolder(), "$counter.$fileExtension")
|
return File(getInternalFolder(), "$counter.$fileExtension")
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun getOrCreateMediaFile(
|
fun getOrCreateMediaFile(
|
||||||
name: String,
|
name: String,
|
||||||
mimeType: String,
|
mimeType: String,
|
||||||
relativePath: String,
|
relativePath: String,
|
||||||
@ -364,7 +361,7 @@ abstract class BatchesFolder(
|
|||||||
// Create empty output file to be able to write to it
|
// Create empty output file to be able to write to it
|
||||||
uri = context.contentResolver.insert(
|
uri = context.contentResolver.insert(
|
||||||
mediaContentUri,
|
mediaContentUri,
|
||||||
android.content.ContentValues().apply {
|
ContentValues().apply {
|
||||||
put(
|
put(
|
||||||
MediaStore.MediaColumns.DISPLAY_NAME,
|
MediaStore.MediaColumns.DISPLAY_NAME,
|
||||||
name
|
name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user