make OS icon a public fun
This commit is contained in:
@@ -47,30 +47,6 @@ import sh.sar.isodroid.ui.theme.MountedGreen
|
|||||||
import sh.sar.isodroid.ui.theme.UnmountedGray
|
import sh.sar.isodroid.ui.theme.UnmountedGray
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds a matching OS icon filename for a given file by dynamically checking available icons.
|
|
||||||
*/
|
|
||||||
private fun findOsIcon(context: android.content.Context, filename: String): String? {
|
|
||||||
return try {
|
|
||||||
val availableIcons = context.assets.list("osicons")
|
|
||||||
?.filter { it.endsWith(".svg", ignoreCase = true) }
|
|
||||||
?.map { it.removeSuffix(".svg").lowercase() }
|
|
||||||
?: emptyList()
|
|
||||||
|
|
||||||
val lowerFilename = filename.lowercase()
|
|
||||||
|
|
||||||
availableIcons
|
|
||||||
.filter { lowerFilename.contains(it) }
|
|
||||||
.maxWithOrNull(compareBy(
|
|
||||||
{ it.length },
|
|
||||||
{ -lowerFilename.indexOf(it) }
|
|
||||||
))
|
|
||||||
?.let { "$it.svg" }
|
|
||||||
} catch (e: Exception) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun StatusCard(
|
fun StatusCard(
|
||||||
mountStatus: MountStatus,
|
mountStatus: MountStatus,
|
||||||
|
|||||||
Reference in New Issue
Block a user