Skip to content

Commit

Permalink
M3K WoA Helper 1.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rxuglr committed Mar 24, 2024
1 parent 4a6bd9e commit 35709be
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdk = 29
targetSdk = 34
versionCode = 8
versionName = "1.3.4"
versionName = "1.3.5"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/rxuglr/m3kwoahelper/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -237,7 +238,7 @@ class MainActivity : ComponentActivity() {
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 5.dp),
text = "Version: 1.3.4",
text = "Version: 1.3.5",
textAlign = TextAlign.Center
)
}
Expand Down Expand Up @@ -492,7 +493,7 @@ class MainActivity : ComponentActivity() {
) {
InfoCard(Modifier
.height(200.dp)
.width((pxtodp(625f)).dp))
.width((pxtodp(625f)).dp), LocalUriHandler.current)
DeviceImage(Modifier.width((pxtodp(625f)).dp))
}
Column(
Expand Down Expand Up @@ -529,7 +530,7 @@ class MainActivity : ComponentActivity() {
else {
Row(horizontalArrangement = Arrangement.spacedBy(if (codename == "nabu") { 10.dp } else 0.dp)) {
DeviceImage(Modifier.width((pxtodp(625f)).dp))
InfoCard(Modifier.height((pxtodp(743f)).dp))
InfoCard(Modifier.height((pxtodp(743f)).dp), LocalUriHandler.current)
}
Buttons.BackupButton()
Buttons.MountButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.AssistChip
import androidx.compose.material3.Card
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -52,7 +52,7 @@ object Buttons {
) {
val showDialog = remember { mutableStateOf(false) }
val showSpinner = remember { mutableStateOf(false) }
Card(
ElevatedCard(
onClick = { showDialog.value = true },
Modifier
.fillMaxWidth(),
Expand Down Expand Up @@ -83,7 +83,7 @@ object Buttons {
Thread {
showDialog.value = false
showSpinner.value = true
run { command }
command()
showSpinner.value = false
}.start()
})
Expand Down Expand Up @@ -126,7 +126,7 @@ object Buttons {
fun BackupButton() {
val showBackupDialog = remember { mutableStateOf(false) }
val showBackupSpinner = remember { mutableStateOf(false) }
Card(
ElevatedCard(
onClick = { showBackupDialog.value = true },
Modifier
.fillMaxWidth(),
Expand Down Expand Up @@ -271,7 +271,7 @@ object Buttons {
@Composable
fun MountButton() {
val showMountDialog = remember { mutableStateOf(false) }
Card(
ElevatedCard(
onClick = { showMountDialog.value = true },
Modifier
.fillMaxWidth(),
Expand Down Expand Up @@ -350,7 +350,7 @@ object Buttons {
fun UEFIButton() {
val showUEFIDialog = remember { mutableStateOf(false) }
val showUEFISpinner = remember { mutableStateOf(false) }
Card(
ElevatedCard(
onClick = {
if (!uefilist.contains(99)) {
showUEFIDialog.value = true
Expand Down Expand Up @@ -540,7 +540,7 @@ object Buttons {
if (!uefilist.contains(99)) {
val showQuickBootDialog = remember { mutableStateOf(false) }
val showQuickBootSpinner = remember { mutableStateOf(false) }
Card(
ElevatedCard(
onClick = { showQuickBootDialog.value = true },
Modifier
.fillMaxWidth(),
Expand Down
89 changes: 42 additions & 47 deletions app/src/main/java/com/rxuglr/m3kwoahelper/ui/templates/Cards.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ 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.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Message
import androidx.compose.material.icons.filled.Book
import androidx.compose.material3.AssistChip
import androidx.compose.material3.AssistChipDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -26,6 +27,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.UriHandler
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
Expand All @@ -47,15 +49,16 @@ object Cards {
}

@Composable
fun InfoCard(modifier: Modifier) {
Card(
fun InfoCard(modifier: Modifier, localUriHandler: UriHandler) {
ElevatedCard(
modifier =
if (codename == "nabu") {
modifier
} else {
Modifier
.height(200.dp)
},
shape = RoundedCornerShape(8.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(
12.dp
Expand Down Expand Up @@ -113,7 +116,7 @@ object Cards {
Modifier.align(Alignment.CenterHorizontally),
horizontalArrangement = Arrangement.spacedBy(5.dp)
) {
if (codename != "cepheus") {
if ((codename != "cepheus") && (name != "Unknown")) {
AssistChip(
leadingIcon = {
Icon(
Expand All @@ -124,18 +127,13 @@ object Cards {
)
},
onClick = {
woahApp.startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(
when (codename) {
codenames[0], codenames[1] -> "https://github.com/woa-vayu/Port-Windows-11-Poco-X3-pro"
codenames[2] -> "https://github.com/erdilS/Port-Windows-11-Xiaomi-Pad-5"
codenames[3], codenames[4], codenames[6] -> "https://github.com/graphiks/woa-raphael"
else -> "Unknown"
}
)
)
localUriHandler.openUri(
when (codename) {
codenames[0], codenames[1] -> "https://github.com/woa-vayu/Port-Windows-11-Poco-X3-pro"
codenames[2] -> "https://github.com/erdilS/Port-Windows-11-Xiaomi-Pad-5"
codenames[3], codenames[4], codenames[6] -> "https://github.com/graphiks/woa-raphael"
else -> ""
}
)
},
label = {
Expand All @@ -146,38 +144,35 @@ object Cards {
}
)
}
AssistChip(
leadingIcon = {
Icon(
Icons.AutoMirrored.Filled.Message,
contentDescription = null,
Modifier.size(AssistChipDefaults.IconSize),
tint = MaterialTheme.colorScheme.primary
)
},
onClick = {
woahApp.startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(
when (codename) {
codenames[0], codenames[1] -> "https://t.me/winonvayualt"
codenames[2] -> "https://t.me/nabuwoa"
codenames[3], codenames[4], codenames[6] -> "https://t.me/woaraphael"
codenames[5] -> "https://t.me/WinOnMi9/"
else -> "Unknown"
}
)
if (name != "Unknown") {
AssistChip(
leadingIcon = {
Icon(
Icons.AutoMirrored.Filled.Message,
contentDescription = null,
Modifier.size(AssistChipDefaults.IconSize),
tint = MaterialTheme.colorScheme.primary
)
)
},
label = {
Text(
LocalContext.current.getString(R.string.group),
fontWeight = FontWeight.Bold,
)
}
)
},
onClick = {
localUriHandler.openUri(
when (codename) {
codenames[0], codenames[1] -> "https://t.me/winonvayualt"
codenames[2] -> "https://t.me/nabuwoa"
codenames[3], codenames[4], codenames[6] -> "https://t.me/woaraphael"
codenames[5] -> "https://t.me/WinOnMi9/"
else -> ""
}
)
},
label = {
Text(
LocalContext.current.getString(R.string.group),
fontWeight = FontWeight.Bold,
)
}
)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.2.2"
agp = "8.3.1"
kotlin = "1.9.22"
ksp = "1.9.22-1.0.17"
compose-bom = "2024.02.01"
Expand Down

0 comments on commit 35709be

Please sign in to comment.