From b197a9f498cb7855a5507bcdca0020e969362004 Mon Sep 17 00:00:00 2001 From: nift4 Date: Thu, 1 Aug 2024 11:54:47 +0200 Subject: [PATCH] bugfixes --- .../java/org/andbootmgr/app/DroidBootFlow.kt | 12 ++++---- .../org/andbootmgr/app/FixDroidBootFlow.kt | 13 +++++---- .../java/org/andbootmgr/app/MainActivity.kt | 16 ++++++++++- .../main/java/org/andbootmgr/app/Themes.kt | 28 +++++++++++++++++++ .../org/andbootmgr/app/UpdateDroidBootFlow.kt | 13 +++++---- app/src/main/res/values/strings.xml | 1 + 6 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 app/src/main/java/org/andbootmgr/app/Themes.kt diff --git a/app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt b/app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt index cf44477f..5e91a97f 100644 --- a/app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt +++ b/app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt @@ -304,10 +304,15 @@ private fun Flash(vm: WizardActivityState) { return@Terminal } } + val tmpFile = if (vm.deviceInfo.postInstallScript) { + val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) + vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) + tmpFile.setExecutable(true) + tmpFile + } else null terminal.add(vm.activity.getString(R.string.term_building_cfg)) val db = ConfigFile() - // TODO was this ever used? is it used by vbm maybe? db["default"] = "Entry 01" db["timeout"] = "5" db.exportToFile(File(vm.logic.abmDb, "db.conf")) @@ -342,12 +347,9 @@ private fun Flash(vm: WizardActivityState) { } if (vm.deviceInfo.postInstallScript) { terminal.add(vm.activity.getString(R.string.term_device_setup)) - val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) - vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) - tmpFile.setExecutable(true) vm.logic.runShFileWithArgs( "BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " + - "${tmpFile.absolutePath} real" + "${tmpFile!!.absolutePath} real" ).to(terminal).exec() tmpFile.delete() } diff --git a/app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt b/app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt index e5d333e9..346ac1d9 100644 --- a/app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt +++ b/app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt @@ -55,8 +55,14 @@ private fun Start(vm: WizardActivityState) { private fun Flash(vm: WizardActivityState) { val flashType = "DroidBootFlashType" Terminal(vm, logFile = "blfix_${System.currentTimeMillis()}.txt") { terminal -> + val tmpFile = if (vm.deviceInfo.postInstallScript) { + val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) + vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) + tmpFile.setExecutable(true) + tmpFile + } else null terminal.add(vm.activity.getString(R.string.term_flashing_droidboot)) - val f = SuFile.open(vm.deviceInfo!!.blBlock) + val f = SuFile.open(vm.deviceInfo.blBlock) if (!f.canWrite()) terminal.add(vm.activity.getString(R.string.term_cant_write_bl)) vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), File(vm.logic.fileDir, "backup_lk.img")) @@ -70,12 +76,9 @@ private fun Flash(vm: WizardActivityState) { } if (vm.deviceInfo.postInstallScript) { terminal.add(vm.activity.getString(R.string.term_device_setup)) - val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) - vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) - tmpFile.setExecutable(true) vm.logic.runShFileWithArgs( "BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " + - "${tmpFile.absolutePath} real" + "${tmpFile!!.absolutePath} real" ).to(terminal).exec() tmpFile.delete() } diff --git a/app/src/main/java/org/andbootmgr/app/MainActivity.kt b/app/src/main/java/org/andbootmgr/app/MainActivity.kt index 4235f10b..af1b176d 100644 --- a/app/src/main/java/org/andbootmgr/app/MainActivity.kt +++ b/app/src/main/java/org/andbootmgr/app/MainActivity.kt @@ -44,7 +44,6 @@ import org.andbootmgr.app.util.ConfigFile import org.andbootmgr.app.util.SDUtils import org.andbootmgr.app.util.Toolkit import java.io.File -import java.util.stream.Collectors class MainActivityState { fun startFlow(flow: String) { @@ -242,6 +241,17 @@ private fun AppContent(vm: MainActivityState, view: @Composable (PaddingValues) modifier = Modifier.padding(start = 8.dp, end = 8.dp, top = 8.dp) ) if (vm.isOk) { + NavigationDrawerItem( + label = { Text(stringResource(R.string.themes)) }, + selected = vm.currentNav == "themes", + onClick = { + scope.launch { + vm.navController!!.navigate("themes") + drawerState.close() + } + }, + modifier = Modifier.padding(start = 8.dp, end = 8.dp, top = 8.dp) + ) NavigationDrawerItem( label = { Text(stringResource(R.string.settings)) }, selected = vm.currentNav == "settings", @@ -294,6 +304,10 @@ private fun NavGraph(vm: MainActivityState, it: PaddingValues) { vm.currentNav = "start" Start(vm) } + composable("themes") { + vm.currentNav = "themes" + Themes(vm) + } composable("settings") { vm.currentNav = "settings" Settings(vm) diff --git a/app/src/main/java/org/andbootmgr/app/Themes.kt b/app/src/main/java/org/andbootmgr/app/Themes.kt new file mode 100644 index 00000000..7a41dded --- /dev/null +++ b/app/src/main/java/org/andbootmgr/app/Themes.kt @@ -0,0 +1,28 @@ +package org.andbootmgr.app + +import androidx.compose.runtime.Composable + +/* + uint32_t win_bg_color; + uint8_t win_radius; + uint8_t win_border_width; + uint32_t win_border_color; + uint32_t global_font_size; + char* global_font_name; + uint32_t button_unselected_color; + uint32_t button_unselected_size; + uint32_t button_unselected_text_color; + uint32_t button_selected_color; + uint32_t button_selected_size; + uint32_t button_selected_text_color; + uint8_t button_radius; + bool button_grow_default; + uint8_t button_border_unselected_width; + uint32_t button_border_unselected_color; + uint8_t button_border_selected_width; + uint32_t button_border_selected_color; + */ +@Composable +fun Themes(vm: MainActivityState) { + +} \ No newline at end of file diff --git a/app/src/main/java/org/andbootmgr/app/UpdateDroidBootFlow.kt b/app/src/main/java/org/andbootmgr/app/UpdateDroidBootFlow.kt index 6906cb40..6ddd138d 100644 --- a/app/src/main/java/org/andbootmgr/app/UpdateDroidBootFlow.kt +++ b/app/src/main/java/org/andbootmgr/app/UpdateDroidBootFlow.kt @@ -55,8 +55,14 @@ private fun Start(vm: WizardActivityState) { private fun Flash(vm: WizardActivityState) { val flashType = "DroidBootFlashType" Terminal(vm, logFile = "blup_${System.currentTimeMillis()}.txt") { terminal -> + val tmpFile = if (vm.deviceInfo.postInstallScript) { + val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) + vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) + tmpFile.setExecutable(true) + tmpFile + } else null terminal.add(vm.activity.getString(R.string.term_flashing_droidboot)) - val f = SuFile.open(vm.deviceInfo!!.blBlock) + val f = SuFile.open(vm.deviceInfo.blBlock) if (!f.canWrite()) terminal.add(vm.activity.getString(R.string.term_cant_write_bl)) vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), File(vm.logic.fileDir, "backup2_lk.img")) @@ -70,12 +76,9 @@ private fun Flash(vm: WizardActivityState) { } if (vm.deviceInfo.postInstallScript) { terminal.add(vm.activity.getString(R.string.term_device_setup)) - val tmpFile = createTempFileSu("abm", ".sh", vm.logic.rootTmpDir) - vm.copyPriv(vm.flashStream("InstallShFlashType"), tmpFile) - tmpFile.setExecutable(true) vm.logic.runShFileWithArgs( "BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=false " + - "${tmpFile.absolutePath} real" + "${tmpFile!!.absolutePath} real" ).to(terminal).exec() tmpFile.delete() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea0e8e09..59e92b58 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -230,4 +230,5 @@ -- Created partition layout. Failed loading list of ROMs from Open ROM Project Installer shell script + Themes