Skip to content

Commit

Permalink
more kotlin update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jul 27, 2024
1 parent 6509367 commit dc1eaa2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ android {
defaultConfig {
applicationId = "org.andbootmgr.app"
minSdk = 26
//noinspection ExpiredTargetSdkVersion
targetSdk = 32
versionCode = 3001
versionName = "0.3.0-m0"
Expand Down Expand Up @@ -93,8 +94,8 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = "1.1.1"
}
applicationVariants.forEach {
tasks["merge${it.name.replaceFirstChar(Char::titlecase)}Assets"].dependsOn(tasks["setAssetTs"])
applicationVariants.configureEach {
tasks["merge${name.replaceFirstChar(Char::titlecase)}Assets"].dependsOn(tasks["setAssetTs"])
}
}

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.andbootmgr.app

import android.content.Intent
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.widget.Toast
import androidx.compose.foundation.layout.*
Expand Down Expand Up @@ -147,7 +149,9 @@ fun SelectDroidBoot(vm: WizardActivityState) {
vm.flashes[flashType] = Uri.parse(url)
nextButtonAvailable.value = true
} catch (e: Exception) {
Toast.makeText(ctx, R.string.dl_error, Toast.LENGTH_LONG).show()
Handler(Looper.getMainLooper()).post {
Toast.makeText(ctx, R.string.dl_error, Toast.LENGTH_LONG).show()
}
Log.e("ABM droidboot json", Log.getStackTraceString(e))
}
}.start()
Expand Down
50 changes: 27 additions & 23 deletions app/src/main/java/org/andbootmgr/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.FlowColumnScopeInstance.align
import androidx.compose.foundation.layout.FlowRowScopeInstance.alignBy
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -238,27 +236,33 @@ private fun AppContent(vm: MainActivityState, view: @Composable (PaddingValues)
// A surface container using the 'background' color from the theme
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
ModalNavigationDrawer(drawerContent = {
Button(
modifier = Modifier
.align()
.padding(top = 16.dp),
onClick = { scope.launch {
vm.navController!!.navigate("start")
drawerState.close()
} },
content = { Text(stringResource(R.string.home)) }
)
Button(
modifier = Modifier
//.align(Alignment.CenterHorizontally)
.padding(top = 16.dp),
onClick = { if (vm.isOk) scope.launch {
vm.navController!!.navigate("settings")
drawerState.close()
} },
enabled = vm.isOk,
content = { Text(stringResource(R.string.settings)) }
)
Box {
Button(
modifier = Modifier
.align(Alignment.Center)
.padding(top = 16.dp),
onClick = {
scope.launch {
vm.navController!!.navigate("start")
drawerState.close()
}
},
content = { Text(stringResource(R.string.home)) }
)
Button(
modifier = Modifier
.align(Alignment.Center)
.padding(top = 16.dp),
onClick = {
if (vm.isOk) scope.launch {
vm.navController!!.navigate("settings")
drawerState.close()
}
},
enabled = vm.isOk,
content = { Text(stringResource(R.string.settings)) }
)
}
},
drawerState = drawerState,
content = {
Expand Down

0 comments on commit dc1eaa2

Please sign in to comment.