Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Aug 1, 2024
1 parent 01f8994 commit b197a9f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 16 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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()
}
Expand Down
13 changes: 8 additions & 5 deletions app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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()
}
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/org/andbootmgr/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/org/andbootmgr/app/Themes.kt
Original file line number Diff line number Diff line change
@@ -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) {

}
13 changes: 8 additions & 5 deletions app/src/main/java/org/andbootmgr/app/UpdateDroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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()
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,5 @@
<string name="term_created_pt">-- Created partition layout.</string>
<string name="shop_error">Failed loading list of ROMs from Open ROM Project</string>
<string name="installer_sh">Installer shell script</string>
<string name="themes">Themes</string>
</resources>

0 comments on commit b197a9f

Please sign in to comment.