From feec5efbf60c0632716ffced974da353f3cd3b65 Mon Sep 17 00:00:00 2001 From: nift4 Date: Mon, 2 Oct 2023 18:05:27 +0200 Subject: [PATCH] support local abm json --- .gitignore | 34 +- .idea/assetWizardSettings.xml | 351 ------------------ .idea/codeStyles/Project.xml | 134 ------- .idea/inspectionProfiles/Project_Default.xml | 41 -- .idea/kotlinc.xml | 6 - .idea/misc.xml | 96 ----- .idea/navEditor.xml | 79 ---- .idea/vcs.xml | 8 - .settings/org.eclipse.buildship.core.prefs | 13 - .vscode/launch.json | 5 - .../java/org/andbootmgr/app/CreatePartFlow.kt | 7 +- 11 files changed, 7 insertions(+), 767 deletions(-) delete mode 100644 .idea/assetWizardSettings.xml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/kotlinc.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/navEditor.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .settings/org.eclipse.buildship.core.prefs delete mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index d8b8e38e..44889a42 100644 --- a/.gitignore +++ b/.gitignore @@ -3,39 +3,7 @@ app/build .gradle/* local.properties # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries -.idea/misc.xml - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -.idea/artifacts -.idea/compiler.xml -.idea/jarRepositories.xml -.idea/modules.xml -.idea/*.iml -.idea/modules +.idea *.iml *.ipr diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml deleted file mode 100644 index d100ad2d..00000000 --- a/.idea/assetWizardSettings.xml +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 0d156937..00000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
-
-
\ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 44ca2d9b..00000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 4515aa32..00000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 2ba8b293..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/navEditor.xml b/.idea/navEditor.xml deleted file mode 100644 index 9de0d024..00000000 --- a/.idea/navEditor.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 0741626e..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 2b6d83b9..00000000 --- a/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home=/usr/lib/jvm/java-11-openjdk-amd64 -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index b634c028..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - ] -} \ No newline at end of file diff --git a/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt b/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt index 4e60f7cd..c8f6c700 100644 --- a/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt +++ b/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt @@ -38,6 +38,7 @@ import java.math.BigDecimal import java.util.concurrent.TimeUnit import org.json.JSONObject import org.json.JSONTokener +import java.io.FileNotFoundException import java.net.URL class CreatePartWizardPageFactory(private val vm: WizardActivityState) { @@ -352,12 +353,16 @@ private fun Start(c: CreatePartDataHolder) { private fun Shop(c: CreatePartDataHolder) { var json: JSONObject? by remember { mutableStateOf(null) } var error by remember { mutableStateOf(false) } + val ctx = LocalContext.current LaunchedEffect(Unit) { c.run { Thread { try { - val jsonText = + val jsonText = try { + ctx.assets.open("abm.json").readBytes().toString(Charsets.UTF_8) + } catch (e: FileNotFoundException) { URL("https://raw.githubusercontent.com/Android-Boot-Manager/ABM-json/master/devices/" + c.vm.codename + ".json").readText() + } json = JSONTokener(jsonText).nextValue() as JSONObject //Log.i("ABM shop:", jsonText) } catch (e: Exception) {