Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jul 27, 2024
1 parent c16e90b commit a000483
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private fun Start(c: CreatePartDataHolder) {
}, isError = eu, label = {
Text(stringResource(R.string.end_sector))
})
RangeSlider(modifier = Modifier.fillMaxWidth(), value = lu, onValueChange = {
RangeSlider(modifier = Modifier.fillMaxWidth(), value = lu, onValueChange = {
l = it.start.toLong().toString()
u = it.endInclusive.toLong().toString()
el = !l.matches(Regex("\\d+"))
Expand Down Expand Up @@ -308,7 +308,7 @@ private fun Start(c: CreatePartDataHolder) {
c.l = l
c.u = u
c.t = t
c.f = c.p.size - c.u.toLong()
c.f = (c.p.size - c.u.toLong()).coerceAtLeast(0) // TODO fix range slider inaccuracies instead
c.vm.navigate("flash")
}) {
Text(stringResource(id = R.string.create))
Expand All @@ -333,7 +333,7 @@ private fun Start(c: CreatePartDataHolder) {
c.l = l
c.u = u
c.t = null
c.f = c.p.size - c.u.toLong()
c.f = (c.p.size - c.u.toLong()).coerceAtLeast(0) // TODO fix range slider inaccuracies instead
c.vm.navigate("shop")
}) {
Text(stringResource(R.string.cont))
Expand Down Expand Up @@ -994,6 +994,7 @@ private fun Flash(c: CreatePartDataHolder) {
} else /*percent*/ {
(BigDecimal(c.p.size - (offset + c.f)).multiply(BigDecimal(b).divide(BigDecimal(100)))).toLong()
}
terminal.add("c.p.size=${c.p.size} offset=$offset c.f=${c.f} b=$b k=$k logSectorSizeBytes=${c.meta!!.logicalSectorSizeBytes}")

vm.logic.unmount(vm.deviceInfo!!)
val r = Shell.cmd(SDUtils.umsd(c.meta!!) + " && " + c.p.create(offset, offset + k, code, "")).to(terminal).exec()
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/java/org/andbootmgr/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.HorizontalAlignmentLine
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -92,7 +91,6 @@ class MainActivityState {
var isReady = false
var name by mutableStateOf("") /* default value moved to onCreate() */
var navController: NavHostController? = null
@OptIn(ExperimentalMaterial3Api::class)
var drawerState: DrawerState? = null
var scope: CoroutineScope? = null
var root = false
Expand All @@ -103,7 +101,6 @@ class MainActivityState {

class MainActivity : ComponentActivity() {

@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val vm = MainActivityState()
Expand Down Expand Up @@ -429,7 +426,6 @@ private fun Start(vm: MainActivityState) {
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun PartTool(vm: MainActivityState) {
var filterUnifiedView by remember { mutableStateOf(true) }
Expand Down Expand Up @@ -973,7 +969,7 @@ private fun PartTool(vm: MainActivityState) {
}
}
)
} else if (editEntryID != null && filterUnifiedView) {
} else if (editEntryID != null) {
val e = editEntryID!!
AlertDialog(
onDismissRequest = {
Expand Down Expand Up @@ -1111,7 +1107,6 @@ private fun PartTool(vm: MainActivityState) {
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun Settings(vm: MainActivityState) {
val ctx = LocalContext.current
Expand Down

0 comments on commit a000483

Please sign in to comment.