Add launcher backup file type to file search

This commit is contained in:
MM20 2022-06-13 20:59:05 +02:00
parent 500d531000
commit 5c02d722b1
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
3 changed files with 8 additions and 1 deletions

View File

@ -56,6 +56,9 @@ abstract class File(
fun getFileType(context: Context): String {
if (isDirectory) return context.getString(R.string.file_type_directory)
if (mimeType == "application/vendor.de.mm20.launcher2.backup") {
return context.getString(R.string.file_type_launcherbackup, context.getString(R.string.app_name))
}
val resource = when (mimeType) {
"application/zip",
"application/x-zip-compressed",
@ -104,6 +107,7 @@ abstract class File(
}
if (resource == R.string.file_type_none && label.matches(Regex(".+\\..+"))) {
val extension = label.substringAfterLast(".").toUpperCase(Locale.getDefault())
if (extension == "kvaesitso") return context.getString(R.string.file_type_launcherbackup, context.getString(R.string.app_name))
return context.getString(R.string.file_type_generic, extension)
}
return context.getString(resource)

View File

@ -165,7 +165,7 @@ open class LocalFile(
}
companion object : KoinComponent {
companion object {
internal fun getMimetypeByFileExtension(extension: String): String {
return when (extension) {
"apk" -> "application/vnd.android.package-archive"
@ -187,6 +187,7 @@ open class LocalFile(
"ogg" -> "audio/ogg"
"wav" -> "audio/wav"
"mp4" -> "video/mp4"
"kvaesitso" -> "application/vendor.de.mm20.launcher2.backup"
else -> "application/octet-stream"
}
}

View File

@ -142,6 +142,8 @@
<string name="file_type_drawing">Drawing</string>
<!-- Google Forms file -->
<string name="file_type_form">Form</string>
<!-- Launcher backup, %1$s: app name -->
<string name="file_type_launcherbackup">%1$s backup</string>
<!-- Generic file , %1$s is the file extension -->
<string name="file_type_generic">%1$s file</string>
<!-- Warning message that is shown when a user attempts to delete a directory -->