categorize os
This commit is contained in:
@@ -2,13 +2,13 @@ package sh.sar.isodroid.ui.screens
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
@@ -46,7 +46,7 @@ data class OsDownload(
|
||||
val icon: String? = null
|
||||
)
|
||||
|
||||
private val osDownloads = listOf(
|
||||
private val linuxDownloads = listOf(
|
||||
OsDownload(
|
||||
name = "Ubuntu",
|
||||
description = "",
|
||||
@@ -71,30 +71,6 @@ private val osDownloads = listOf(
|
||||
url = "https://nixos.org/download/#nixos-iso",
|
||||
icon = "nixos.svg"
|
||||
),
|
||||
OsDownload(
|
||||
name = "OPNsense",
|
||||
description = "OPNsense® is an open source, feature rich firewall and routing platform, offering cutting-edge network protection.",
|
||||
url = "https://opnsense.org/download/",
|
||||
icon = "opnsense.svg"
|
||||
),
|
||||
OsDownload(
|
||||
name = "Windows 11",
|
||||
description = "",
|
||||
url = "https://www.microsoft.com/en-us/software-download/windows11",
|
||||
icon = null
|
||||
),
|
||||
OsDownload(
|
||||
name = "Hiren's BootCD PE",
|
||||
description = "Hiren's BootCD PE (Preinstallation Environment) is a restored edition of Hiren's BootCD based on Windows PE",
|
||||
url = "https://www.hirensbootcd.org/download/",
|
||||
icon = null
|
||||
),
|
||||
OsDownload(
|
||||
name = "FreeBSD",
|
||||
description = "FreeBSD is an operating system for a variety of platforms which focuses on features, speed, and stability.",
|
||||
url = "https://www.freebsd.org/where/",
|
||||
icon = "freebsd.svg"
|
||||
),
|
||||
OsDownload(
|
||||
name = "Linux Mint",
|
||||
description = "Linux Mint is an operating system for desktop and laptop computers. It is designed to work 'out of the box' and comes fully equipped with the apps most people need.",
|
||||
@@ -121,6 +97,39 @@ private val osDownloads = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
private val bsdDownloads = listOf(
|
||||
OsDownload(
|
||||
name = "FreeBSD",
|
||||
description = "FreeBSD is an operating system for a variety of platforms which focuses on features, speed, and stability.",
|
||||
url = "https://www.freebsd.org/where/",
|
||||
icon = "freebsd.svg"
|
||||
),
|
||||
OsDownload(
|
||||
name = "OPNsense",
|
||||
description = "OPNsense® is an open source, feature rich firewall and routing platform, offering cutting-edge network protection.",
|
||||
url = "https://opnsense.org/download/",
|
||||
icon = "opnsense.svg"
|
||||
)
|
||||
)
|
||||
|
||||
private val windowsDownloads = listOf(
|
||||
OsDownload(
|
||||
name = "Windows 11",
|
||||
description = "",
|
||||
url = "https://www.microsoft.com/en-us/software-download/windows11",
|
||||
icon = null
|
||||
)
|
||||
)
|
||||
|
||||
private val recoveryDownloads = listOf(
|
||||
OsDownload(
|
||||
name = "Hiren's BootCD PE",
|
||||
description = "Hiren's BootCD PE (Preinstallation Environment) is a restored edition of Hiren's BootCD based on Windows PE",
|
||||
url = "https://www.hirensbootcd.org/download/",
|
||||
icon = null
|
||||
)
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DownloadsScreen(
|
||||
@@ -158,36 +167,39 @@ fun DownloadsScreen(
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
Text(
|
||||
text = "Operating Systems",
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||
// Linux
|
||||
DownloadCategory(
|
||||
title = "Linux",
|
||||
downloads = linuxDownloads,
|
||||
onItemClick = { openUrl(it.url) }
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
||||
)
|
||||
) {
|
||||
Column {
|
||||
osDownloads.forEachIndexed { index, os ->
|
||||
DownloadItem(
|
||||
os = os,
|
||||
onClick = { openUrl(os.url) }
|
||||
)
|
||||
if (index < osDownloads.lastIndex) {
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
color = MaterialTheme.colorScheme.outline.copy(alpha = 0.3f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// BSD
|
||||
DownloadCategory(
|
||||
title = "BSD",
|
||||
downloads = bsdDownloads,
|
||||
onItemClick = { openUrl(it.url) }
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Windows
|
||||
DownloadCategory(
|
||||
title = "Windows",
|
||||
downloads = windowsDownloads,
|
||||
onItemClick = { openUrl(it.url) }
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Recovery
|
||||
DownloadCategory(
|
||||
title = "Recovery",
|
||||
downloads = recoveryDownloads,
|
||||
onItemClick = { openUrl(it.url) }
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Tap to open download page in browser",
|
||||
@@ -199,6 +211,44 @@ fun DownloadsScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DownloadCategory(
|
||||
title: String,
|
||||
downloads: List<OsDownload>,
|
||||
onItemClick: (OsDownload) -> Unit
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
||||
)
|
||||
) {
|
||||
Column {
|
||||
downloads.forEachIndexed { index, os ->
|
||||
DownloadItem(
|
||||
os = os,
|
||||
onClick = { onItemClick(os) }
|
||||
)
|
||||
if (index < downloads.lastIndex) {
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
color = MaterialTheme.colorScheme.outline.copy(alpha = 0.3f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DownloadItem(
|
||||
os: OsDownload,
|
||||
|
||||
Reference in New Issue
Block a user