Merge pull request #6 from cfogrady/dim-reader-library

Import vb-dim-reader library
This commit is contained in:
nacabaro 2025-01-05 10:50:04 +01:00 committed by GitHub
commit 82292823d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 8 deletions

View File

@ -3,9 +3,11 @@
## Developer Setup
1. Clone vb-nfc-reader (https://github.com/cfogrady/lib-vb-nfc)
2. Run vb-nfc-reader/publishToMavenLocal gradle task.
3. Create res/values/keys.xml within the app module.
4. Populate with:
2. Run vb-nfc-reader/publishToMavenLocal gradle task in the lib-vb-nfc project.
3. Clone vb-dim-reader (https://github.com/cfogrady/vb-dim-reader)
4. Run publishToMavenLocal gradle task in the vb-dim-reader project.
5. Create res/values/keys.xml within the app module.
6. Populate with:
```
<?xml version="1.0" encoding="utf-8"?>
<resources>
@ -32,5 +34,5 @@
</integer-array>
</resources>
```
5. Replace the values in the keys.xml file with those extracted from the original app.
6. Run
7. Replace the values in the keys.xml file with those extracted from the original app.
8. Run

View File

@ -43,6 +43,7 @@ android {
dependencies {
implementation(libs.androidx.room.runtime)
implementation(libs.vb.nfc.reader)
implementation(libs.dim.reader)
ksp(libs.androidx.room.compiler)
annotationProcessor(libs.androidx.room.compiler)
implementation(libs.androidx.core.ktx)

View File

@ -17,11 +17,19 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.github.cfogrady.vb.dim.card.BemCard
import com.github.cfogrady.vb.dim.card.DimCard
import com.github.cfogrady.vb.dim.card.DimReader
import com.github.cfogrady.vb.dim.sprite.SpriteData
import com.github.cfogrady.vb.dim.sprite.SpriteData.Sprite
import com.github.nacabaro.vbhelper.components.TopBanner
import java.io.File
import java.io.FileInputStream
@Composable
fun SettingsScreen(
navController: NavController
navController: NavController,
dimReader: DimReader = DimReader()
) {
Scaffold (
topBar = {
@ -48,8 +56,22 @@ fun SettingsScreen(
SettingsEntry(title = "Import transform functions", description = "Import standard vital bracelet keys") { }
SettingsEntry(title = "Import decryption key", description = "Import standard vital bracelet keys") { }
SettingsSection("DiM/BEm management")
SettingsEntry(title = "Import DiM card", description = "Import DiM card file") { }
SettingsEntry(title = "Import BEm card", description = "Import BEm card file") { }
SettingsEntry(title = "Import DiM card", description = "Import DiM card file") {
// placeholder
// val file = File("dummy_file.bin") //filePicker()
// val fileInputStream = FileInputStream(file)
// fileInputStream.use {
// val card = dimReader.readCard(fileInputStream, false)
// if (card is DimCard) {
// val logo = card.spriteData.sprites[0]
// }
// val beMemory = card as BemCard
// val logo = beMemory.spriteData.sprites[0]
// }
}
SettingsEntry(title = "Import BEm card", description = "Import BEm card file") {
// placeholder
}
SettingsSection("About and credits")
SettingsEntry(title = "Credits", description = "Credits") { }
SettingsEntry(title = "About", description = "About") { }

View File

@ -10,6 +10,7 @@ activityCompose = "1.9.3"
composeBom = "2024.04.01"
roomRuntime = "2.6.1"
vbNfcReader = "0.1.0"
dimReader = "2.1.0"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@ -29,6 +30,7 @@ androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-man
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
vb-nfc-reader = { module = "com.github.cfogrady:vb-nfc-reader", version.ref = "vbNfcReader" }
dim-reader = { module = "com.github.cfogrady:vb-dim-reader", version.ref = "dimReader" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }