Add dim-reader library

Update readme to reflect
Add commented out sample code.
This commit is contained in:
Christopher O'Grady 2025-01-04 23:46:13 -05:00
parent d9e492eb0e
commit 1e73f52da5
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" }