Add launcher backup file type to file search
This commit is contained in:
parent
500d531000
commit
5c02d722b1
@ -56,6 +56,9 @@ abstract class File(
|
|||||||
|
|
||||||
fun getFileType(context: Context): String {
|
fun getFileType(context: Context): String {
|
||||||
if (isDirectory) return context.getString(R.string.file_type_directory)
|
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) {
|
val resource = when (mimeType) {
|
||||||
"application/zip",
|
"application/zip",
|
||||||
"application/x-zip-compressed",
|
"application/x-zip-compressed",
|
||||||
@ -104,6 +107,7 @@ abstract class File(
|
|||||||
}
|
}
|
||||||
if (resource == R.string.file_type_none && label.matches(Regex(".+\\..+"))) {
|
if (resource == R.string.file_type_none && label.matches(Regex(".+\\..+"))) {
|
||||||
val extension = label.substringAfterLast(".").toUpperCase(Locale.getDefault())
|
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(R.string.file_type_generic, extension)
|
||||||
}
|
}
|
||||||
return context.getString(resource)
|
return context.getString(resource)
|
||||||
|
|||||||
@ -165,7 +165,7 @@ open class LocalFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
companion object : KoinComponent {
|
companion object {
|
||||||
internal fun getMimetypeByFileExtension(extension: String): String {
|
internal fun getMimetypeByFileExtension(extension: String): String {
|
||||||
return when (extension) {
|
return when (extension) {
|
||||||
"apk" -> "application/vnd.android.package-archive"
|
"apk" -> "application/vnd.android.package-archive"
|
||||||
@ -187,6 +187,7 @@ open class LocalFile(
|
|||||||
"ogg" -> "audio/ogg"
|
"ogg" -> "audio/ogg"
|
||||||
"wav" -> "audio/wav"
|
"wav" -> "audio/wav"
|
||||||
"mp4" -> "video/mp4"
|
"mp4" -> "video/mp4"
|
||||||
|
"kvaesitso" -> "application/vendor.de.mm20.launcher2.backup"
|
||||||
else -> "application/octet-stream"
|
else -> "application/octet-stream"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,6 +142,8 @@
|
|||||||
<string name="file_type_drawing">Drawing</string>
|
<string name="file_type_drawing">Drawing</string>
|
||||||
<!-- Google Forms file -->
|
<!-- Google Forms file -->
|
||||||
<string name="file_type_form">Form</string>
|
<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 -->
|
<!-- Generic file , %1$s is the file extension -->
|
||||||
<string name="file_type_generic">%1$s file</string>
|
<string name="file_type_generic">%1$s file</string>
|
||||||
<!-- Warning message that is shown when a user attempts to delete a directory -->
|
<!-- Warning message that is shown when a user attempts to delete a directory -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user