From 5e832a545a1a08e7a6ffd45ca46c2934870ab360 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 13:48:00 -0700 Subject: [PATCH 01/11] wip fixing build for modern android --- build.gradle | 31 +++++++++++----------- dependencies.gradle | 16 ++++++------ farebot-app/build.gradle | 33 +++++++++++------------- farebot-base/build.gradle | 15 ++++++----- gradle.properties | 5 ---- gradle/wrapper/gradle-wrapper.properties | 3 ++- 6 files changed, 50 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index cdd056e0f..a4d517cc6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,29 +1,33 @@ buildscript { + ext { + kotlin_version = '2.0.10' + } repositories { mavenLocal() - jcenter() + mavenCentral() + maven { url "https://jitpack.io" } maven { url 'https://maven.google.com' } - maven { url 'https://maven.fabric.io/public' } google() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0-alpha13' - classpath 'io.fabric.tools:gradle:1.28.1' - classpath 'com.squareup.sqldelight:gradle-plugin:1.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31" + classpath 'com.android.tools.build:gradle:8.5.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'app.cash.sqldelight:gradle-plugin:2.0.2' } } plugins { + id 'com.google.devtools.ksp' version '2.0.10-1.0.24' apply false id 'com.github.ben-manes.versions' version '0.21.0' } allprojects { repositories { mavenLocal() - jcenter() - maven { url "https://maven.google.com" } - maven { url 'https://maven.fabric.io/public' } + mavenCentral() + maven { url "https://jitpack.io" } + maven { url 'https://maven.google.com' } + google() } } @@ -39,7 +43,7 @@ subprojects { afterEvaluate {project -> if (project.name.contains('farebot')) { check.dependsOn 'checkstyle' - task checkstyle(type: Checkstyle) { + tasks.register('checkstyle', Checkstyle) { configFile file('config/checkstyle/checkstyle.xml') source 'src' include '**/*.java' @@ -54,6 +58,7 @@ subprojects { } if (project.hasProperty("android")) { android { + namespace "dev.meh.farebot" compileSdkVersion vers.compileSdkVersion defaultConfig { @@ -70,10 +75,6 @@ subprojects { abortOnError true disable 'InvalidPackage','MissingTranslation' } - - dexOptions { - dexInProcess = true - } } } } @@ -100,7 +101,7 @@ dependencies { ktlint 'com.github.shyiko:ktlint:0.31.0' } -task lintKotlin(type: JavaExec) { +tasks.register('lintKotlin', JavaExec) { main = "com.github.shyiko.ktlint.Main" classpath = configurations.ktlint args "*/src/**/*.kt" diff --git a/dependencies.gradle b/dependencies.gradle index 387e6d1c7..ce02a5996 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,10 +6,10 @@ ext { ] def autoDisposeVersion = '0.8.0' - def autoValueGsonVersion = '0.8.0' - def autoValueVersion = '1.6.5' - def daggerVersion = '2.22.1' - def groupieVersion = '2.3.0' + def autoValueGsonVersion = '1.3.1' + def autoValueVersion = '1.11.0' + def daggerVersion = '2.25' + def groupieVersion = '2.8.1' def kotlinVersion = '1.3.31' def magellanVersion = '1.1.0' def roomVersion = '2.1.0-alpha07' @@ -21,14 +21,14 @@ ext { autoDisposeKotlin: "com.uber.autodispose:autodispose-kotlin:${autoDisposeVersion}", autoValue: "com.google.auto.value:auto-value:${autoValueVersion}", autoValueAnnotations: "com.google.auto.value:auto-value-annotations:${autoValueVersion}", - autoValueGson: "com.ryanharter.auto.value:auto-value-gson:${autoValueGsonVersion}", - autoValueGsonAnnotations: "com.ryanharter.auto.value:auto-value-gson-annotations:${autoValueGsonVersion}", + autoValueGson: "com.ryanharter.auto.value:auto-value-gson:1.3.1", + autoValueGsonAnnotations: "com.ryanharter.auto.value:auto-value-gson-annotations:0.8.0", checkstyle: 'com.puppycrawl.tools:checkstyle:8.20', crashlytics: 'com.crashlytics.sdk.android:crashlytics:2.10.0', dagger: "com.google.dagger:dagger:${daggerVersion}", daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}", - groupie: "com.xwray:groupie:${groupieVersion}", - groupieDatabinding: "com.xwray:groupie-databinding:${groupieVersion}", + groupie: "com.github.lisawray.groupie:groupie:${groupieVersion}", + groupieDatabinding: "com.github.lisawray.groupie:groupie-databinding:${groupieVersion}", gson: 'com.google.code.gson:gson:2.8.5', guava: 'com.google.guava:guava:27.1-android', kotlinStdlib: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}", diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index df5263f40..d92e50cc8 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -20,11 +20,11 @@ * along with this program. If not, see . */ +plugins { + id 'com.google.devtools.ksp' +} + apply plugin: 'com.android.application' -apply plugin: 'io.fabric' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' dependencies { implementation project(':farebot-base') @@ -71,13 +71,14 @@ dependencies { implementation libs.supportV4 implementation libs.supportV7CardView implementation libs.supportV7RecyclerView +// +// implementation(libs.crashlytics) { +// transitive = true +// } - implementation(libs.crashlytics) { - transitive = true - } - - implementation libs.dagger - kapt libs.daggerCompiler + implementation 'com.google.dagger:dagger:2.28.3' + implementation 'androidx.core:core-ktx:1.13.1' + ksp 'com.google.dagger:dagger-compiler' } static def askPassword() { @@ -92,11 +93,6 @@ gradle.taskGraph.whenReady { taskGraph -> } } -kapt { - useBuildCache = true - mapDiagnosticLocations = true -} - android { defaultConfig { versionCode 29 @@ -127,9 +123,10 @@ android { signingConfig signingConfigs.release } } - packagingOptions { - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/NOTICE.txt' + resources { + excludes += ['META-INF/LICENSE.txt', 'META-INF/NOTICE.txt'] + } } + } diff --git a/farebot-base/build.gradle b/farebot-base/build.gradle index b63719d3c..108ada771 100644 --- a/farebot-base/build.gradle +++ b/farebot-base/build.gradle @@ -1,15 +1,18 @@ +plugins { + id 'com.google.devtools.ksp' +} + apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' dependencies { - implementation libs.guava - implementation libs.supportV4 - implementation libs.kotlinStdlib + implementation(libs.guava) + implementation(libs.supportV4) + implementation(libs.kotlinStdlib) - compileOnly libs.autoValueAnnotations + compileOnly(libs.autoValueAnnotations) - kapt libs.autoValue + ksp(libs.autoValue) } diff --git a/gradle.properties b/gradle.properties index 21cece27c..cdaf81e19 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,11 +7,6 @@ org.gradle.caching=true org.gradle.configureondemand=false android.builder.sdkDownload=true -android.enableBuildCache=true -android.enableD8.desugaring=true - -# Still in preview -android.enableR8=false kotlin.incremental.usePreciseJavaTracking=true android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ee69dd68d..c8c8f994c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Aug 21 12:44:52 PDT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 8a0ecd7c6f42fba17a3debfcc07aac26825c97bd Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 15:37:19 -0700 Subject: [PATCH 02/11] namespacing and dependency fixes --- build.gradle | 7 +++---- dependencies.gradle | 7 +++---- farebot-app-persist/build.gradle | 6 +++++- farebot-app-persist/src/main/AndroidManifest.xml | 3 +-- farebot-app/build.gradle | 7 +++++-- farebot-app/src/main/AndroidManifest.xml | 5 +++-- farebot-base/build.gradle | 8 +++++--- farebot-base/src/main/AndroidManifest.xml | 3 +-- farebot-card-cepas/build.gradle | 1 + farebot-card-cepas/src/main/AndroidManifest.xml | 3 +-- farebot-card-classic/build.gradle | 1 + farebot-card-classic/src/main/AndroidManifest.xml | 3 +-- farebot-card-desfire/build.gradle | 1 + farebot-card-desfire/src/main/AndroidManifest.xml | 3 +-- farebot-card-felica/build.gradle | 1 + farebot-card-felica/src/main/AndroidManifest.xml | 3 +-- farebot-card-ultralight/build.gradle | 2 +- farebot-card-ultralight/src/main/AndroidManifest.xml | 3 +-- farebot-card/build.gradle | 4 +++- farebot-card/src/main/AndroidManifest.xml | 3 +-- farebot-transit-bilhete/build.gradle | 4 +++- farebot-transit-bilhete/src/main/AndroidManifest.xml | 3 +-- farebot-transit-clipper/build.gradle | 4 +++- farebot-transit-clipper/src/main/AndroidManifest.xml | 3 +-- farebot-transit-easycard/build.gradle | 1 + farebot-transit-easycard/src/main/AndroidManifest.xml | 5 +---- farebot-transit-edy/build.gradle | 4 +++- farebot-transit-edy/src/main/AndroidManifest.xml | 3 +-- farebot-transit-ezlink/build.gradle | 4 +++- farebot-transit-ezlink/src/main/AndroidManifest.xml | 3 +-- farebot-transit-hsl/build.gradle | 4 +++- farebot-transit-hsl/src/main/AndroidManifest.xml | 3 +-- farebot-transit-kmt/build.gradle | 4 +++- farebot-transit-kmt/src/main/AndroidManifest.xml | 3 +-- .../codebutler/farebot/transit/kmt/KMTTransitInfo.java | 1 - .../java/com/codebutler/farebot/transit/kmt/KMTTrip.java | 1 - farebot-transit-manly/build.gradle | 4 +++- farebot-transit-manly/src/main/AndroidManifest.xml | 3 +-- farebot-transit-myki/build.gradle | 1 + farebot-transit-myki/src/main/AndroidManifest.xml | 3 +-- farebot-transit-octopus/build.gradle | 1 + farebot-transit-octopus/src/main/AndroidManifest.xml | 3 +-- farebot-transit-opal/build.gradle | 1 + farebot-transit-opal/src/main/AndroidManifest.xml | 3 +-- farebot-transit-orca/build.gradle | 1 + farebot-transit-orca/src/main/AndroidManifest.xml | 3 +-- farebot-transit-ovc/build.gradle | 1 + farebot-transit-ovc/src/main/AndroidManifest.xml | 3 +-- farebot-transit-seqgo/build.gradle | 1 + farebot-transit-seqgo/src/main/AndroidManifest.xml | 3 +-- farebot-transit-stub/build.gradle | 1 + farebot-transit-stub/src/main/AndroidManifest.xml | 3 +-- farebot-transit-suica/build.gradle | 1 + farebot-transit-suica/src/main/AndroidManifest.xml | 3 +-- farebot-transit/build.gradle | 4 +++- farebot-transit/src/main/AndroidManifest.xml | 3 +-- 56 files changed, 90 insertions(+), 80 deletions(-) diff --git a/build.gradle b/build.gradle index a4d517cc6..6debe1cca 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ buildscript { } plugins { - id 'com.google.devtools.ksp' version '2.0.10-1.0.24' apply false id 'com.github.ben-manes.versions' version '0.21.0' + id "org.jetbrains.kotlin.kapt" version "2.0.10" } allprojects { @@ -58,7 +58,6 @@ subprojects { } if (project.hasProperty("android")) { android { - namespace "dev.meh.farebot" compileSdkVersion vers.compileSdkVersion defaultConfig { @@ -67,8 +66,8 @@ subprojects { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } lintOptions { diff --git a/dependencies.gradle b/dependencies.gradle index ce02a5996..aeb2a0e36 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,14 +1,13 @@ ext { vers = [ - compileSdkVersion: 28, - targetSdkVersion: 28, + compileSdkVersion: 34, + targetSdkVersion: 34, minSdkVersion: 21 ] def autoDisposeVersion = '0.8.0' - def autoValueGsonVersion = '1.3.1' def autoValueVersion = '1.11.0' - def daggerVersion = '2.25' + def daggerVersion = '2.28.3' def groupieVersion = '2.8.1' def kotlinVersion = '1.3.31' def magellanVersion = '1.1.0' diff --git a/farebot-app-persist/build.gradle b/farebot-app-persist/build.gradle index c937344b8..7e0e57b75 100644 --- a/farebot-app-persist/build.gradle +++ b/farebot-app-persist/build.gradle @@ -1,6 +1,9 @@ +plugins { + id "org.jetbrains.kotlin.kapt" version "2.0.10" +} + apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' dependencies { implementation libs.supportV4 @@ -15,6 +18,7 @@ dependencies { } android { + namespace "com.codebutler.farebot.persist" defaultConfig { kapt { arguments { diff --git a/farebot-app-persist/src/main/AndroidManifest.xml b/farebot-app-persist/src/main/AndroidManifest.xml index c195e65c0..e285ed300 100644 --- a/farebot-app-persist/src/main/AndroidManifest.xml +++ b/farebot-app-persist/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index d92e50cc8..b244cf2ea 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -21,10 +21,11 @@ */ plugins { - id 'com.google.devtools.ksp' + id "org.jetbrains.kotlin.kapt" version "2.0.10" } apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' dependencies { implementation project(':farebot-base') @@ -78,7 +79,8 @@ dependencies { implementation 'com.google.dagger:dagger:2.28.3' implementation 'androidx.core:core-ktx:1.13.1' - ksp 'com.google.dagger:dagger-compiler' + + kapt 'com.google.dagger:dagger-compiler:2.28.3' } static def askPassword() { @@ -94,6 +96,7 @@ gradle.taskGraph.whenReady { taskGraph -> } android { + namespace "com.codebutler.farebot.app" defaultConfig { versionCode 29 versionName '3.1.1' diff --git a/farebot-app/src/main/AndroidManifest.xml b/farebot-app/src/main/AndroidManifest.xml index a214f5514..1268a02b3 100644 --- a/farebot-app/src/main/AndroidManifest.xml +++ b/farebot-app/src/main/AndroidManifest.xml @@ -22,8 +22,7 @@ --> + xmlns:android="http://schemas.android.com/apk/res/android"> @@ -55,6 +54,7 @@ @@ -71,6 +71,7 @@ diff --git a/farebot-base/build.gradle b/farebot-base/build.gradle index 108ada771..da38016d0 100644 --- a/farebot-base/build.gradle +++ b/farebot-base/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.google.devtools.ksp' + id "org.jetbrains.kotlin.kapt" version "2.0.10" } apply plugin: 'com.android.library' @@ -12,8 +12,10 @@ dependencies { compileOnly(libs.autoValueAnnotations) - ksp(libs.autoValue) + kapt(libs.autoValue) } -android { } +android { + namespace "com.codebutler.farebot.util" +} diff --git a/farebot-base/src/main/AndroidManifest.xml b/farebot-base/src/main/AndroidManifest.xml index acd47ac15..e285ed300 100644 --- a/farebot-base/src/main/AndroidManifest.xml +++ b/farebot-base/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-card-cepas/build.gradle b/farebot-card-cepas/build.gradle index 4e83163c9..cc11160e1 100644 --- a/farebot-card-cepas/build.gradle +++ b/farebot-card-cepas/build.gradle @@ -16,5 +16,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.card.cepas" resourcePrefix 'cepas_' } diff --git a/farebot-card-cepas/src/main/AndroidManifest.xml b/farebot-card-cepas/src/main/AndroidManifest.xml index 35c62b375..e2302144a 100644 --- a/farebot-card-cepas/src/main/AndroidManifest.xml +++ b/farebot-card-cepas/src/main/AndroidManifest.xml @@ -22,8 +22,7 @@ --> + xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/farebot-card-classic/build.gradle b/farebot-card-classic/build.gradle index 26154f9bf..776decae1 100644 --- a/farebot-card-classic/build.gradle +++ b/farebot-card-classic/build.gradle @@ -16,5 +16,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.card.classic" resourcePrefix 'classic_' } diff --git a/farebot-card-classic/src/main/AndroidManifest.xml b/farebot-card-classic/src/main/AndroidManifest.xml index 2909eeb71..15e6bac46 100644 --- a/farebot-card-classic/src/main/AndroidManifest.xml +++ b/farebot-card-classic/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-card-desfire/build.gradle b/farebot-card-desfire/build.gradle index 61ad4d235..63fc5eee1 100644 --- a/farebot-card-desfire/build.gradle +++ b/farebot-card-desfire/build.gradle @@ -16,5 +16,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.card.desfire" resourcePrefix 'desfire_' } diff --git a/farebot-card-desfire/src/main/AndroidManifest.xml b/farebot-card-desfire/src/main/AndroidManifest.xml index 8e4d3b7f2..e2302144a 100644 --- a/farebot-card-desfire/src/main/AndroidManifest.xml +++ b/farebot-card-desfire/src/main/AndroidManifest.xml @@ -22,8 +22,7 @@ --> + xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/farebot-card-felica/build.gradle b/farebot-card-felica/build.gradle index c87ef40d8..772263fff 100644 --- a/farebot-card-felica/build.gradle +++ b/farebot-card-felica/build.gradle @@ -16,5 +16,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.card.felica" resourcePrefix 'felica_' } diff --git a/farebot-card-felica/src/main/AndroidManifest.xml b/farebot-card-felica/src/main/AndroidManifest.xml index 1bb8fa039..e285ed300 100644 --- a/farebot-card-felica/src/main/AndroidManifest.xml +++ b/farebot-card-felica/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-card-ultralight/build.gradle b/farebot-card-ultralight/build.gradle index 5438c0110..e89986318 100644 --- a/farebot-card-ultralight/build.gradle +++ b/farebot-card-ultralight/build.gradle @@ -14,5 +14,5 @@ dependencies { } android { - resourcePrefix 'ultralight_' + namespace "com.codebutler.farebot.card.ultralight" } diff --git a/farebot-card-ultralight/src/main/AndroidManifest.xml b/farebot-card-ultralight/src/main/AndroidManifest.xml index a7fdbf3a2..15e6bac46 100644 --- a/farebot-card-ultralight/src/main/AndroidManifest.xml +++ b/farebot-card-ultralight/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-card/build.gradle b/farebot-card/build.gradle index 623797019..ebfdcdbac 100644 --- a/farebot-card/build.gradle +++ b/farebot-card/build.gradle @@ -13,4 +13,6 @@ dependencies { annotationProcessor libs.autoValue } -android { } +android { + namespace "com.codebutler.farebot.card" +} diff --git a/farebot-card/src/main/AndroidManifest.xml b/farebot-card/src/main/AndroidManifest.xml index 18e9bb138..e2302144a 100644 --- a/farebot-card/src/main/AndroidManifest.xml +++ b/farebot-card/src/main/AndroidManifest.xml @@ -22,8 +22,7 @@ --> + xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/farebot-transit-bilhete/build.gradle b/farebot-transit-bilhete/build.gradle index 12e7aa562..d2987d64c 100644 --- a/farebot-transit-bilhete/build.gradle +++ b/farebot-transit-bilhete/build.gradle @@ -14,4 +14,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.bilhete_unico" +} diff --git a/farebot-transit-bilhete/src/main/AndroidManifest.xml b/farebot-transit-bilhete/src/main/AndroidManifest.xml index 43ef19e75..e285ed300 100644 --- a/farebot-transit-bilhete/src/main/AndroidManifest.xml +++ b/farebot-transit-bilhete/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-clipper/build.gradle b/farebot-transit-clipper/build.gradle index 158cec8b4..02cf935ee 100644 --- a/farebot-transit-clipper/build.gradle +++ b/farebot-transit-clipper/build.gradle @@ -16,4 +16,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.clipper" +} diff --git a/farebot-transit-clipper/src/main/AndroidManifest.xml b/farebot-transit-clipper/src/main/AndroidManifest.xml index ef9a65c3d..e285ed300 100644 --- a/farebot-transit-clipper/src/main/AndroidManifest.xml +++ b/farebot-transit-clipper/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-easycard/build.gradle b/farebot-transit-easycard/build.gradle index db0c03ad5..fc35606a3 100644 --- a/farebot-transit-easycard/build.gradle +++ b/farebot-transit-easycard/build.gradle @@ -10,5 +10,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.easycard" resourcePrefix 'easycard_' } diff --git a/farebot-transit-easycard/src/main/AndroidManifest.xml b/farebot-transit-easycard/src/main/AndroidManifest.xml index 178841a85..e285ed300 100644 --- a/farebot-transit-easycard/src/main/AndroidManifest.xml +++ b/farebot-transit-easycard/src/main/AndroidManifest.xml @@ -21,7 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-edy/build.gradle b/farebot-transit-edy/build.gradle index 9a6b5c770..c4925414f 100644 --- a/farebot-transit-edy/build.gradle +++ b/farebot-transit-edy/build.gradle @@ -14,4 +14,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.edy" +} diff --git a/farebot-transit-edy/src/main/AndroidManifest.xml b/farebot-transit-edy/src/main/AndroidManifest.xml index 3f86006bc..15e6bac46 100644 --- a/farebot-transit-edy/src/main/AndroidManifest.xml +++ b/farebot-transit-edy/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-ezlink/build.gradle b/farebot-transit-ezlink/build.gradle index ce4b7cc91..5b90efa13 100644 --- a/farebot-transit-ezlink/build.gradle +++ b/farebot-transit-ezlink/build.gradle @@ -16,4 +16,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.ezlink" +} diff --git a/farebot-transit-ezlink/src/main/AndroidManifest.xml b/farebot-transit-ezlink/src/main/AndroidManifest.xml index bf72b65de..15e6bac46 100644 --- a/farebot-transit-ezlink/src/main/AndroidManifest.xml +++ b/farebot-transit-ezlink/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-hsl/build.gradle b/farebot-transit-hsl/build.gradle index 158cec8b4..0bb5416de 100644 --- a/farebot-transit-hsl/build.gradle +++ b/farebot-transit-hsl/build.gradle @@ -16,4 +16,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.hsl" +} diff --git a/farebot-transit-hsl/src/main/AndroidManifest.xml b/farebot-transit-hsl/src/main/AndroidManifest.xml index 2c7decb76..15e6bac46 100644 --- a/farebot-transit-hsl/src/main/AndroidManifest.xml +++ b/farebot-transit-hsl/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-kmt/build.gradle b/farebot-transit-kmt/build.gradle index 6465e7b2e..b9a86aa89 100644 --- a/farebot-transit-kmt/build.gradle +++ b/farebot-transit-kmt/build.gradle @@ -16,4 +16,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.kmt" +} diff --git a/farebot-transit-kmt/src/main/AndroidManifest.xml b/farebot-transit-kmt/src/main/AndroidManifest.xml index fa0880698..cc947c567 100644 --- a/farebot-transit-kmt/src/main/AndroidManifest.xml +++ b/farebot-transit-kmt/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTransitInfo.java b/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTransitInfo.java index 3eda60a93..395cef99a 100644 --- a/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTransitInfo.java +++ b/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTransitInfo.java @@ -25,7 +25,6 @@ import androidx.annotation.Nullable; import com.codebutler.farebot.base.util.ByteArray; -import com.codebutler.farebot.kmt.R; import com.codebutler.farebot.transit.Refill; import com.codebutler.farebot.transit.Subscription; import com.codebutler.farebot.transit.TransitInfo; diff --git a/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTrip.java b/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTrip.java index 25f3ee438..2390470cb 100644 --- a/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTrip.java +++ b/farebot-transit-kmt/src/main/java/com/codebutler/farebot/transit/kmt/KMTTrip.java @@ -24,7 +24,6 @@ import androidx.annotation.NonNull; import com.codebutler.farebot.card.felica.FelicaBlock; -import com.codebutler.farebot.kmt.R; import com.codebutler.farebot.transit.Station; import com.codebutler.farebot.transit.Trip; import com.google.auto.value.AutoValue; diff --git a/farebot-transit-manly/build.gradle b/farebot-transit-manly/build.gradle index 12e7aa562..3fad3e244 100644 --- a/farebot-transit-manly/build.gradle +++ b/farebot-transit-manly/build.gradle @@ -14,4 +14,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit.manly_fast_ferry" +} diff --git a/farebot-transit-manly/src/main/AndroidManifest.xml b/farebot-transit-manly/src/main/AndroidManifest.xml index cfe459562..15e6bac46 100644 --- a/farebot-transit-manly/src/main/AndroidManifest.xml +++ b/farebot-transit-manly/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-myki/build.gradle b/farebot-transit-myki/build.gradle index e11f3e00d..edaa2cfe9 100644 --- a/farebot-transit-myki/build.gradle +++ b/farebot-transit-myki/build.gradle @@ -15,5 +15,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.myki" resourcePrefix 'myki_' } diff --git a/farebot-transit-myki/src/main/AndroidManifest.xml b/farebot-transit-myki/src/main/AndroidManifest.xml index 5b4b2a0bc..e285ed300 100644 --- a/farebot-transit-myki/src/main/AndroidManifest.xml +++ b/farebot-transit-myki/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-octopus/build.gradle b/farebot-transit-octopus/build.gradle index 3c1799744..dd7ee6405 100644 --- a/farebot-transit-octopus/build.gradle +++ b/farebot-transit-octopus/build.gradle @@ -14,5 +14,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.octopus" resourcePrefix 'octopus_' } diff --git a/farebot-transit-octopus/src/main/AndroidManifest.xml b/farebot-transit-octopus/src/main/AndroidManifest.xml index 2beb05f00..e285ed300 100644 --- a/farebot-transit-octopus/src/main/AndroidManifest.xml +++ b/farebot-transit-octopus/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-opal/build.gradle b/farebot-transit-opal/build.gradle index ccd45c927..18db69ceb 100644 --- a/farebot-transit-opal/build.gradle +++ b/farebot-transit-opal/build.gradle @@ -17,5 +17,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.opal" resourcePrefix 'opal_' } diff --git a/farebot-transit-opal/src/main/AndroidManifest.xml b/farebot-transit-opal/src/main/AndroidManifest.xml index 67bf6fea8..15e6bac46 100644 --- a/farebot-transit-opal/src/main/AndroidManifest.xml +++ b/farebot-transit-opal/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-orca/build.gradle b/farebot-transit-orca/build.gradle index fdbc9d202..cdd4279fc 100644 --- a/farebot-transit-orca/build.gradle +++ b/farebot-transit-orca/build.gradle @@ -17,5 +17,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.orca" resourcePrefix 'transit_orca_' } diff --git a/farebot-transit-orca/src/main/AndroidManifest.xml b/farebot-transit-orca/src/main/AndroidManifest.xml index 010c70b0b..e285ed300 100644 --- a/farebot-transit-orca/src/main/AndroidManifest.xml +++ b/farebot-transit-orca/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + diff --git a/farebot-transit-ovc/build.gradle b/farebot-transit-ovc/build.gradle index 2715123af..da3481be9 100644 --- a/farebot-transit-ovc/build.gradle +++ b/farebot-transit-ovc/build.gradle @@ -16,5 +16,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.ovc" resourcePrefix 'ovc_' } diff --git a/farebot-transit-ovc/src/main/AndroidManifest.xml b/farebot-transit-ovc/src/main/AndroidManifest.xml index 6f060bbbd..15e6bac46 100644 --- a/farebot-transit-ovc/src/main/AndroidManifest.xml +++ b/farebot-transit-ovc/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-seqgo/build.gradle b/farebot-transit-seqgo/build.gradle index a33c9b01e..3cb439464 100644 --- a/farebot-transit-seqgo/build.gradle +++ b/farebot-transit-seqgo/build.gradle @@ -17,5 +17,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.ovc" resourcePrefix 'seqgo_' } diff --git a/farebot-transit-seqgo/src/main/AndroidManifest.xml b/farebot-transit-seqgo/src/main/AndroidManifest.xml index 511369ff1..15e6bac46 100644 --- a/farebot-transit-seqgo/src/main/AndroidManifest.xml +++ b/farebot-transit-seqgo/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-stub/build.gradle b/farebot-transit-stub/build.gradle index 56cf10695..6a3ad9916 100644 --- a/farebot-transit-stub/build.gradle +++ b/farebot-transit-stub/build.gradle @@ -17,5 +17,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.stub" resourcePrefix 'stub_' } diff --git a/farebot-transit-stub/src/main/AndroidManifest.xml b/farebot-transit-stub/src/main/AndroidManifest.xml index 231dbd848..15e6bac46 100644 --- a/farebot-transit-stub/src/main/AndroidManifest.xml +++ b/farebot-transit-stub/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit-suica/build.gradle b/farebot-transit-suica/build.gradle index 084189c42..4afeeb2ee 100644 --- a/farebot-transit-suica/build.gradle +++ b/farebot-transit-suica/build.gradle @@ -17,5 +17,6 @@ dependencies { } android { + namespace "com.codebutler.farebot.transit.suica" resourcePrefix 'suica_' } diff --git a/farebot-transit-suica/src/main/AndroidManifest.xml b/farebot-transit-suica/src/main/AndroidManifest.xml index 156098780..15e6bac46 100644 --- a/farebot-transit-suica/src/main/AndroidManifest.xml +++ b/farebot-transit-suica/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + \ No newline at end of file diff --git a/farebot-transit/build.gradle b/farebot-transit/build.gradle index d629609a8..0fc2727cc 100644 --- a/farebot-transit/build.gradle +++ b/farebot-transit/build.gradle @@ -14,4 +14,6 @@ dependencies { annotationProcessor libs.autoValueGson } -android { } +android { + namespace "com.codebutler.farebot.transit" +} diff --git a/farebot-transit/src/main/AndroidManifest.xml b/farebot-transit/src/main/AndroidManifest.xml index 3bdfeaa5f..e285ed300 100644 --- a/farebot-transit/src/main/AndroidManifest.xml +++ b/farebot-transit/src/main/AndroidManifest.xml @@ -21,5 +21,4 @@ along with this program. If not, see . --> - - + From c25684f636cad9905646326c5a3a0c63b2c9695d Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 15:48:24 -0700 Subject: [PATCH 03/11] fix resource errors --- farebot-app/build.gradle | 23 ++--- .../src/main/res/values/strings.xml | 2 + farebot-transit-seqgo/build.gradle | 2 +- .../farebot/transit/suica/SuicaUtil.java | 92 +++++++++---------- 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index b244cf2ea..59febede0 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -83,17 +83,18 @@ dependencies { kapt 'com.google.dagger:dagger-compiler:2.28.3' } -static def askPassword() { - return 'security -q find-generic-password -w -g -l farebot-release'.execute().text.trim() -} - -gradle.taskGraph.whenReady { taskGraph -> - if(taskGraph.hasTask(':farebot-app:packageRelease')) { - def password = askPassword() - android.signingConfigs.release.storePassword = password - android.signingConfigs.release.keyPassword = password - } -} +// TODO: Fixme for release +//static def askPassword() { +// return 'security -q find-generic-password -w -g -l farebot-release'.execute().text.trim() +//} +// +//gradle.taskGraph.whenReady { taskGraph -> +// if(taskGraph.hasTask(':farebot-app:packageRelease')) { +// def password = askPassword() +// android.signingConfigs.release.storePassword = password +// android.signingConfigs.release.keyPassword = password +// } +//} android { namespace "com.codebutler.farebot.app" diff --git a/farebot-transit-edy/src/main/res/values/strings.xml b/farebot-transit-edy/src/main/res/values/strings.xml index e7159aaef..59c2fecd7 100644 --- a/farebot-transit-edy/src/main/res/values/strings.xml +++ b/farebot-transit-edy/src/main/res/values/strings.xml @@ -1,4 +1,6 @@ # + + diff --git a/farebot-transit-seqgo/build.gradle b/farebot-transit-seqgo/build.gradle index 3cb439464..c885d7f85 100644 --- a/farebot-transit-seqgo/build.gradle +++ b/farebot-transit-seqgo/build.gradle @@ -17,6 +17,6 @@ dependencies { } android { - namespace "com.codebutler.farebot.transit.ovc" + namespace "com.codebutler.farebot.transit.seq_go" resourcePrefix 'seqgo_' } diff --git a/farebot-transit-suica/src/main/java/com/codebutler/farebot/transit/suica/SuicaUtil.java b/farebot-transit-suica/src/main/java/com/codebutler/farebot/transit/suica/SuicaUtil.java index 4f171312b..ba91e7272 100644 --- a/farebot-transit-suica/src/main/java/com/codebutler/farebot/transit/suica/SuicaUtil.java +++ b/farebot-transit-suica/src/main/java/com/codebutler/farebot/transit/suica/SuicaUtil.java @@ -103,51 +103,51 @@ static Date extractDate(boolean isProductSale, byte[] data) { static String getConsoleTypeName(@NonNull Resources resources, int cType) { switch (cType & 0xff) { case 0x03: - return resources.getString(R.string.felica_terminal_fare_adjustment); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_fare_adjustment); case 0x04: - return resources.getString(R.string.felica_terminal_portable); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_portable); case 0x05: - return resources.getString(R.string.felica_terminal_vehicle); // bus + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_vehicle); // bus case 0x07: - return resources.getString(R.string.felica_terminal_ticket); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_ticket); case 0x08: - return resources.getString(R.string.felica_terminal_ticket); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_ticket); case 0x09: - return resources.getString(R.string.felica_terminal_deposit_quick_charge); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_deposit_quick_charge); case 0x12: - return resources.getString(R.string.felica_terminal_tvm_tokyo_monorail); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_tvm_tokyo_monorail); case 0x13: - return resources.getString(R.string.felica_terminal_tvm_etc); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_tvm_etc); case 0x14: - return resources.getString(R.string.felica_terminal_tvm_etc); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_tvm_etc); case 0x15: - return resources.getString(R.string.felica_terminal_tvm_etc); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_tvm_etc); case 0x16: - return resources.getString(R.string.felica_terminal_ticket_gate); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_ticket_gate); case 0x17: - return resources.getString(R.string.felica_terminal_simple_ticket_gate); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_simple_ticket_gate); case 0x18: - return resources.getString(R.string.felica_terminal_booth); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_booth); case 0x19: - return resources.getString(R.string.felica_terminal_booth_green); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_booth_green); case 0x1a: - return resources.getString(R.string.felica_terminal_ticket_gate_terminal); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_ticket_gate_terminal); case 0x1b: - return resources.getString(R.string.felica_terminal_mobile_phone); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_mobile_phone); case 0x1c: - return resources.getString(R.string.felica_terminal_connection_adjustment); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_connection_adjustment); case 0x1d: - return resources.getString(R.string.felica_terminal_transfer_adjustment); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_transfer_adjustment); case 0x1f: - return resources.getString(R.string.felica_terminal_simple_deposit); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_simple_deposit); case 0x46: return "VIEW ALTTE"; case 0x48: return "VIEW ALTTE"; case 0xc7: - return resources.getString(R.string.felica_terminal_pos); // sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_pos); // sales case 0xc8: - return resources.getString(R.string.felica_terminal_vending); // sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_terminal_vending); // sales default: return String.format("Console 0x%s", Integer.toHexString(cType)); } @@ -163,55 +163,55 @@ static String getConsoleTypeName(@NonNull Resources resources, int cType) { static String getProcessTypeName(@NonNull Resources resources, int proc) { switch (proc & 0xff) { case 0x01: - return resources.getString(R.string.felica_process_fare_exit_gate); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_fare_exit_gate); case 0x02: - return resources.getString(R.string.felica_process_charge); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_charge); case 0x03: - return resources.getString(R.string.felica_process_purchase_magnetic); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_purchase_magnetic); case 0x04: - return resources.getString(R.string.felica_process_fare_adjustment); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_fare_adjustment); case 0x05: - return resources.getString(R.string.felica_process_admission_payment); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_admission_payment); case 0x06: - return resources.getString(R.string.felica_process_booth_exit); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_booth_exit); case 0x07: - return resources.getString(R.string.felica_process_issue_new); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_issue_new); case 0x08: - return resources.getString(R.string.felica_process_booth_deduction); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_booth_deduction); case 0x0d: - return resources.getString(R.string.felica_process_bus_pitapa); // Bus + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_bus_pitapa); // Bus case 0x0f: - return resources.getString(R.string.felica_process_bus_iruca); // Bus + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_bus_iruca); // Bus case 0x11: - return resources.getString(R.string.felica_process_reissue); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_reissue); case 0x13: - return resources.getString(R.string.felica_process_payment_shinkansen); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_payment_shinkansen); case 0x14: - return resources.getString(R.string.felica_process_entry_a_autocharge); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_entry_a_autocharge); case 0x15: - return resources.getString(R.string.felica_process_exit_a_autocharge); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_exit_a_autocharge); case 0x1f: - return resources.getString(R.string.felica_process_deposit_bus); // Bus + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_deposit_bus); // Bus case 0x23: - return resources.getString(R.string.felica_process_purchase_special_ticket); // Bus + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_purchase_special_ticket); // Bus case 0x46: - return resources.getString(R.string.felica_process_merchandise_purchase); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_merchandise_purchase); // Sales case 0x48: - return resources.getString(R.string.felica_process_bonus_charge); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_bonus_charge); case 0x49: - return resources.getString(R.string.felica_process_register_deposit); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_register_deposit); // Sales case 0x4a: - return resources.getString(R.string.felica_process_merchandise_cancel); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_merchandise_cancel); // Sales case 0x4b: - return resources.getString(R.string.felica_process_merchandise_admission); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_merchandise_admission); // Sales case 0xc6: - return resources.getString(R.string.felica_process_merchandise_purchase_cash); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_merchandise_purchase_cash); // Sales case 0xcb: - return resources.getString(R.string.felica_process_merchandise_admission_cash); // Sales + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_merchandise_admission_cash); // Sales case 0x84: - return resources.getString(R.string.felica_process_payment_thirdparty); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_payment_thirdparty); case 0x85: - return resources.getString(R.string.felica_process_admission_thirdparty); + return resources.getString(com.codebutler.farebot.card.felica.R.string.felica_process_admission_thirdparty); default: return String.format("Process0x%s", Integer.toHexString(proc)); } From 598952f931cfafabd55397d1fe08c6299c7fa804 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 15:49:58 -0700 Subject: [PATCH 04/11] fix kotlin version mismatch --- .gitignore | 1 + dependencies.gradle | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2cb544944..bd90f6a3f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ release.keystore com_crashlytics_export_strings.xml crashlytics-build.properties crashlytics.properties +.kotlin/ \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index aeb2a0e36..1e07d3004 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -9,7 +9,7 @@ ext { def autoValueVersion = '1.11.0' def daggerVersion = '2.28.3' def groupieVersion = '2.8.1' - def kotlinVersion = '1.3.31' + def kotlinVersion = '2.0.10' def magellanVersion = '1.1.0' def roomVersion = '2.1.0-alpha07' From e05d74707d4e149946c720b6bb1ce3a9ad753703 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 16:08:39 -0700 Subject: [PATCH 05/11] fix other conflicts, java errors resolved, now working on kotlin errors --- build.gradle | 6 +++--- dependencies.gradle | 2 +- farebot-app-persist/build.gradle | 2 +- farebot-app/build.gradle | 29 +++++++++++++++-------------- farebot-base/build.gradle | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 6debe1cca..41c7e5867 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - kotlin_version = '2.0.10' + kotlin_version = '1.9.25' } repositories { mavenLocal() @@ -17,8 +17,8 @@ buildscript { } plugins { - id 'com.github.ben-manes.versions' version '0.21.0' - id "org.jetbrains.kotlin.kapt" version "2.0.10" + id 'com.github.ben-manes.versions' version '0.51.0' + id "org.jetbrains.kotlin.kapt" version "1.9.25" } allprojects { diff --git a/dependencies.gradle b/dependencies.gradle index 1e07d3004..76ab2a686 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -9,7 +9,7 @@ ext { def autoValueVersion = '1.11.0' def daggerVersion = '2.28.3' def groupieVersion = '2.8.1' - def kotlinVersion = '2.0.10' + def kotlinVersion = '1.9.25' def magellanVersion = '1.1.0' def roomVersion = '2.1.0-alpha07' diff --git a/farebot-app-persist/build.gradle b/farebot-app-persist/build.gradle index 7e0e57b75..25091ff8e 100644 --- a/farebot-app-persist/build.gradle +++ b/farebot-app-persist/build.gradle @@ -1,5 +1,5 @@ plugins { - id "org.jetbrains.kotlin.kapt" version "2.0.10" + id "org.jetbrains.kotlin.kapt" version "1.9.25" } apply plugin: 'com.android.library' diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index 59febede0..362211409 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -21,7 +21,7 @@ */ plugins { - id "org.jetbrains.kotlin.kapt" version "2.0.10" + id "org.jetbrains.kotlin.kapt" version "1.9.25" } apply plugin: 'com.android.application' @@ -104,17 +104,17 @@ android { multiDexEnabled true } - signingConfigs { - debug { - storeFile file('../debug.keystore') - } - release { - storeFile file('../release.keystore') - keyAlias 'ericbutler' - storePassword '' - keyPassword '' - } - } +// signingConfigs { +// debug { +// storeFile file('../debug.keystore') +// } +// release { +// storeFile file('../release.keystore') +// keyAlias 'ericbutler' +// storePassword '' +// keyPassword '' +// } +// } buildTypes { debug { @@ -124,7 +124,7 @@ android { shrinkResources false minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), '../config/proguard/proguard-rules.pro' - signingConfig signingConfigs.release +// signingConfig signingConfigs.release } } packagingOptions { @@ -132,5 +132,6 @@ android { excludes += ['META-INF/LICENSE.txt', 'META-INF/NOTICE.txt'] } } - + compileSdk 34 + buildToolsVersion '35.0.0' } diff --git a/farebot-base/build.gradle b/farebot-base/build.gradle index da38016d0..b9dcb6cbf 100644 --- a/farebot-base/build.gradle +++ b/farebot-base/build.gradle @@ -1,5 +1,5 @@ plugins { - id "org.jetbrains.kotlin.kapt" version "2.0.10" + id "org.jetbrains.kotlin.kapt" version "1.9.25" } apply plugin: 'com.android.library' From 4a393ab2536217fdba3489ec7182e3129e675872 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 16:09:04 -0700 Subject: [PATCH 06/11] fix dagger --- dependencies.gradle | 2 +- farebot-app/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 76ab2a686..678e4e2a7 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -7,7 +7,7 @@ ext { def autoDisposeVersion = '0.8.0' def autoValueVersion = '1.11.0' - def daggerVersion = '2.28.3' + def daggerVersion = '2.52' def groupieVersion = '2.8.1' def kotlinVersion = '1.9.25' def magellanVersion = '1.1.0' diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index 362211409..63c630ac1 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -77,10 +77,10 @@ dependencies { // transitive = true // } - implementation 'com.google.dagger:dagger:2.28.3' + implementation 'com.google.dagger:dagger:2.52' implementation 'androidx.core:core-ktx:1.13.1' - kapt 'com.google.dagger:dagger-compiler:2.28.3' + kapt 'com.google.dagger:dagger-compiler:2.52' } // TODO: Fixme for release From cba1d132b26804caa0ad29ce44f058aa1577f303 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 17:46:21 -0700 Subject: [PATCH 07/11] fix many issues with change in sdks and other dependencies --- dependencies.gradle | 1 - farebot-app/build.gradle | 1 + farebot-app/src/main/AndroidManifest.xml | 2 +- .../farebot/app/core/analytics/Analytics.kt | 6 ++---- .../app/core/app/FareBotApplication.kt | 18 ++++-------------- .../app/core/app/FareBotApplicationModule.kt | 2 +- .../farebot/app/core/kotlin/KotterKnife.kt | 2 +- .../farebot/app/core/nfc/NfcStream.kt | 2 +- .../app/core/ui/FareBotCrossfadeTransition.kt | 2 +- .../farebot/app/core/util/ExportHelper.kt | 2 +- .../app/feature/bg/BackgroundTagActivity.kt | 2 +- .../farebot/app/feature/card/CardScreen.kt | 5 ++++- .../app/feature/card/CardScreenView.kt | 5 ++--- .../app/feature/card/TransactionAdapter.kt | 9 ++++----- .../app/feature/card/TransactionViewModel.kt | 2 +- .../card/advanced/CardAdvancedAdapter.kt | 2 +- .../card/advanced/CardAdvancedScreen.kt | 2 +- .../card/advanced/CardAdvancedScreenView.kt | 2 +- .../card/advanced/CardAdvancedTabView.kt | 12 ++++++------ .../app/feature/card/map/TripMapScreen.kt | 2 +- .../app/feature/card/map/TripMapScreenView.kt | 2 +- .../farebot/app/feature/help/HelpScreen.kt | 2 +- .../app/feature/help/HelpScreenView.kt | 14 +++++++------- .../app/feature/history/HistoryAdapter.kt | 2 +- .../app/feature/history/HistoryScreen.kt | 19 ++++++++----------- .../app/feature/history/HistoryScreenView.kt | 2 +- .../farebot/app/feature/home/CardStream.kt | 2 +- .../farebot/app/feature/home/HomeScreen.kt | 5 ++--- .../app/feature/home/HomeScreenView.kt | 12 ++++++------ .../farebot/app/feature/keys/KeysAdapter.kt | 2 +- .../farebot/app/feature/keys/KeysScreen.kt | 2 +- .../app/feature/keys/KeysScreenView.kt | 2 +- .../app/feature/keys/add/AddKeyScreen.kt | 5 +++-- .../app/feature/keys/add/AddKeyScreenView.kt | 2 +- .../farebot/app/feature/main/MainActivity.kt | 4 ++-- .../prefs/FareBotPreferenceActivity.kt | 2 +- 36 files changed, 73 insertions(+), 87 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 678e4e2a7..33cc8520e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -23,7 +23,6 @@ ext { autoValueGson: "com.ryanharter.auto.value:auto-value-gson:1.3.1", autoValueGsonAnnotations: "com.ryanharter.auto.value:auto-value-gson-annotations:0.8.0", checkstyle: 'com.puppycrawl.tools:checkstyle:8.20', - crashlytics: 'com.crashlytics.sdk.android:crashlytics:2.10.0', dagger: "com.google.dagger:dagger:${daggerVersion}", daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}", groupie: "com.github.lisawray.groupie:groupie:${groupieVersion}", diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index 63c630ac1..f31eaf39c 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -79,6 +79,7 @@ dependencies { implementation 'com.google.dagger:dagger:2.52' implementation 'androidx.core:core-ktx:1.13.1' + implementation 'androidx.preference:preference-ktx:1.2.1' kapt 'com.google.dagger:dagger-compiler:2.52' } diff --git a/farebot-app/src/main/AndroidManifest.xml b/farebot-app/src/main/AndroidManifest.xml index 1268a02b3..5d9cd85d8 100644 --- a/farebot-app/src/main/AndroidManifest.xml +++ b/farebot-app/src/main/AndroidManifest.xml @@ -69,7 +69,7 @@ android:theme="@style/FareBot.Theme.Prefs"/> View? private val SupportDialogFragment.viewFinder: SupportDialogFragment.(Int) -> View? get() = { dialog?.findViewById(it) ?: view?.findViewById(it) } private val Fragment.viewFinder: Fragment.(Int) -> View? - get() = { view.findViewById(it) } + get() = { view?.findViewById(it) } private val SupportFragment.viewFinder: SupportFragment.(Int) -> View? get() = { view!!.findViewById(it) } private val ViewHolder.viewFinder: ViewHolder.(Int) -> View? diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt index c08c6456f..6bcaeb59f 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt @@ -64,7 +64,7 @@ class NfcStream(private val activity: Activity) { val intent = Intent(ACTION) intent.`package` = activity.packageName - val pendingIntent = PendingIntent.getBroadcast(activity, 0, intent, 0) + val pendingIntent = PendingIntent.getBroadcast(activity, 0, intent, PendingIntent.FLAG_MUTABLE) val nfcAdapter = NfcAdapter.getDefaultAdapter(activity) nfcAdapter?.enableForegroundDispatch(activity, pendingIntent, null, TECH_LISTS) } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/ui/FareBotCrossfadeTransition.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/ui/FareBotCrossfadeTransition.kt index 93bdd4b4c..219fbd96a 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/ui/FareBotCrossfadeTransition.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/ui/FareBotCrossfadeTransition.kt @@ -54,7 +54,7 @@ class FareBotCrossfadeTransition(context: Context) : Transition { .alpha(0f) .setDuration(shortAnimationDuration) .setListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator?) { + override fun onAnimationEnd(animation: Animator) { viewFrom.visibility = View.GONE callback.onAnimationEnd() } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/util/ExportHelper.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/util/ExportHelper.kt index b50ddae07..f0614f7dc 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/util/ExportHelper.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/util/ExportHelper.kt @@ -22,12 +22,12 @@ package com.codebutler.farebot.app.core.util -import com.codebutler.farebot.BuildConfig import com.codebutler.farebot.card.RawCard import com.codebutler.farebot.card.serialize.CardSerializer import com.codebutler.farebot.persist.CardPersister import com.codebutler.farebot.persist.db.model.SavedCard import com.google.gson.Gson +import com.xwray.groupie.BuildConfig class ExportHelper( private val cardPersister: CardPersister, diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/bg/BackgroundTagActivity.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/bg/BackgroundTagActivity.kt index dceb0f92d..d38923a2a 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/bg/BackgroundTagActivity.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/bg/BackgroundTagActivity.kt @@ -33,7 +33,7 @@ class BackgroundTagActivity : Activity() { startActivity(Intent(this, MainActivity::class.java).apply { action = intent.action - putExtras(intent.extras) + intent.extras?.let { putExtras(it) } }) finish() diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreen.kt index cf060c15b..5b65f5fc8 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreen.kt @@ -25,7 +25,7 @@ package com.codebutler.farebot.app.feature.card import android.content.Context import androidx.appcompat.app.AppCompatActivity import android.view.Menu -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.analytics.AnalyticsEventName import com.codebutler.farebot.app.core.analytics.logAnalyticsEvent @@ -117,6 +117,9 @@ class CardScreen(private val rawCard: RawCard<*>) : FareBotScreen TODO() + is TransactionViewModel.SubscriptionViewModel -> TODO() } } } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreenView.kt index e515c3700..94d300894 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/CardScreenView.kt @@ -28,12 +28,11 @@ import androidx.recyclerview.widget.RecyclerView import android.view.View import android.widget.LinearLayout import android.widget.TextView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.transit.TransitInfo import com.jakewharton.rxrelay2.PublishRelay import com.wealthfront.magellan.BaseScreenView -import com.xwray.groupie.GroupAdapter import io.reactivex.Observable class CardScreenView(context: Context) : BaseScreenView(context) { @@ -59,7 +58,7 @@ class CardScreenView(context: Context) : BaseScreenView(context) { } else { balanceTextView.text = balance if (viewModels.isNotEmpty()) { - recycler.adapter = GroupAdapter() +// recycler.adapter = GroupAdapter() recycler.adapter = TransactionAdapter(viewModels, clicksRelay) } else { recycler.visibility = View.GONE diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt index 69eeee54c..83ec3e196 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt @@ -22,21 +22,20 @@ package com.codebutler.farebot.app.feature.card -import androidx.annotation.LayoutRes -import androidx.recyclerview.widget.RecyclerView import android.text.format.DateFormat import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView -import com.codebutler.farebot.R +import androidx.annotation.LayoutRes +import androidx.recyclerview.widget.RecyclerView +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.app.core.kotlin.inflate import com.codebutler.farebot.app.feature.card.TransactionAdapter.TransactionViewHolder.RefillViewHolder import com.codebutler.farebot.app.feature.card.TransactionAdapter.TransactionViewHolder.SubscriptionViewHolder import com.codebutler.farebot.app.feature.card.TransactionAdapter.TransactionViewHolder.TripViewHolder import com.jakewharton.rxrelay2.PublishRelay -import com.xwray.groupie.ViewHolder import java.util.Calendar import java.util.Date @@ -77,7 +76,7 @@ class TransactionAdapter( is TransactionViewModel.SubscriptionViewModel -> TYPE_SUBSCRIPTION } - sealed class TransactionViewHolder(itemView: View) : ViewHolder(itemView) { + sealed class TransactionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { companion object { fun wrapLayout(parent: ViewGroup, @LayoutRes layoutId: Int): View = diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionViewModel.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionViewModel.kt index 112f33cdf..aae8ce46b 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionViewModel.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionViewModel.kt @@ -24,7 +24,7 @@ package com.codebutler.farebot.app.feature.card import android.content.Context import androidx.annotation.DrawableRes -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.transit.Refill import com.codebutler.farebot.transit.Subscription import com.codebutler.farebot.transit.Trip diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedAdapter.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedAdapter.kt index 644452b53..56bf3f304 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedAdapter.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedAdapter.kt @@ -26,7 +26,7 @@ import androidx.recyclerview.widget.RecyclerView import android.view.View import android.view.ViewGroup import android.widget.TextView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.inflate import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.base.ui.FareBotUiTree diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreen.kt index 814b9122f..a340d3c09 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreen.kt @@ -23,7 +23,7 @@ package com.codebutler.farebot.app.feature.card.advanced import android.content.Context -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.ui.ActionBarOptions import com.codebutler.farebot.app.core.ui.FareBotScreen diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreenView.kt index 183a32b52..92af99947 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedScreenView.kt @@ -25,7 +25,7 @@ package com.codebutler.farebot.app.feature.card.advanced import android.content.Context import android.view.ViewGroup import android.widget.TabHost -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.inflate import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.base.ui.FareBotUiTree diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedTabView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedTabView.kt index d88a4642a..9e9a62edb 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedTabView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/advanced/CardAdvancedTabView.kt @@ -29,7 +29,7 @@ import android.util.AttributeSet import android.widget.FrameLayout import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.base.ui.FareBotUiTree @@ -37,17 +37,17 @@ class CardAdvancedTabView : FrameLayout { private val recyclerView: RecyclerView by bindView(R.id.recycler) - constructor(context: Context?) : + constructor(context: Context) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) @Suppress("unused") - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) fun setAdvancedUi(fareBotUiTree: FareBotUiTree) { @@ -59,7 +59,7 @@ class CardAdvancedTabView : FrameLayout { init { val attrs = intArrayOf(android.R.attr.listDivider) val ta = context.applicationContext.obtainStyledAttributes(attrs) - divider = ta.getDrawable(0) + divider = ta.getDrawable(0)!! ta.recycle() } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreen.kt index 647704bdf..46257baca 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreen.kt @@ -25,7 +25,7 @@ package com.codebutler.farebot.app.feature.card.map import android.content.Context import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.kotlin.compact import com.codebutler.farebot.app.core.ui.ActionBarOptions diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreenView.kt index 53a8babfc..1013a603c 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/map/TripMapScreenView.kt @@ -26,7 +26,7 @@ import android.annotation.SuppressLint import android.content.Context import android.os.Bundle import androidx.annotation.DrawableRes -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.transit.Station import com.codebutler.farebot.transit.Trip diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreen.kt index cdc6e3add..d2d6f04e9 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreen.kt @@ -23,7 +23,7 @@ package com.codebutler.farebot.app.feature.help import android.content.Context -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.ui.ActionBarOptions import com.codebutler.farebot.app.core.ui.FareBotScreen diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreenView.kt index 745241f59..c83cd6572 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/help/HelpScreenView.kt @@ -34,7 +34,7 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import android.widget.Toast -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.card.CardType import com.codebutler.farebot.transit.manly_fast_ferry.ManlyFastFerryTransitInfo @@ -90,7 +90,7 @@ class HelpScreenView(context: Context) : BaseScreenView(context) { name = "EZ-Link", locationResId = R.string.location_singapore, cardType = CardType.CEPAS, - extraNoteResId = R.string.ezlink_card_note + extraNoteResId = com.codebutler.farebot.transit.ezlink.R.string.ezlink_card_note ), SupportedCard( imageResId = R.drawable.octopus_card, @@ -111,7 +111,7 @@ class HelpScreenView(context: Context) : BaseScreenView(context) { cardType = CardType.MifareClassic, keysRequired = true, preview = true, - extraNoteResId = R.string.seqgo_card_note + extraNoteResId = com.codebutler.farebot.transit.seq_go.R.string.seqgo_card_note ), SupportedCard( imageResId = R.drawable.hsl_card, @@ -133,7 +133,7 @@ class HelpScreenView(context: Context) : BaseScreenView(context) { cardType = CardType.MifareDesfire, keysRequired = false, preview = false, - extraNoteResId = R.string.myki_card_note + extraNoteResId = com.codebutler.farebot.transit.myki.R.string.myki_card_note ), SupportedCard( imageResId = R.drawable.nets_card, @@ -157,10 +157,10 @@ class HelpScreenView(context: Context) : BaseScreenView(context) { SupportedCard( imageResId = R.drawable.easycard, name = "EasyCard", - locationResId = R.string.easycard_card_location, + locationResId = com.codebutler.farebot.transit.easycard.R.string.easycard_card_location, cardType = CardType.MifareClassic, keysRequired = true, - extraNoteResId = R.string.easycard_card_note + extraNoteResId = com.codebutler.farebot.transit.easycard.R.string.easycard_card_note ), SupportedCard( imageResId = R.drawable.kmt_card, @@ -168,7 +168,7 @@ class HelpScreenView(context: Context) : BaseScreenView(context) { locationResId = R.string.location_jakarta, cardType = CardType.FeliCa, keysRequired = false, - extraNoteResId = R.string.kmt_notes + extraNoteResId = com.codebutler.farebot.transit.kmt.R.string.kmt_notes ) ) diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryAdapter.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryAdapter.kt index ea6329716..0b2450a76 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryAdapter.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryAdapter.kt @@ -27,7 +27,7 @@ import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.app.core.kotlin.inflate import com.jakewharton.rxrelay2.PublishRelay diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreen.kt index 4e74d905a..8c1909b1e 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreen.kt @@ -37,7 +37,7 @@ import android.view.Menu import android.widget.Toast import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.kotlin.Optional @@ -119,7 +119,7 @@ class HistoryScreen : FareBotScreen { val exportClip = ClipData.newPlainText(null, exportHelper.exportCards()) - clipboardManager.primaryClip = exportClip + clipboardManager.setPrimaryClip(exportClip); Toast.makeText(activity, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show() } R.id.share -> { @@ -256,16 +256,13 @@ class HistoryScreen : FareBotScreen onCardsImported(cards) } } @ScreenScope diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreenView.kt index 135a8c22a..b7de5f43d 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/history/HistoryScreenView.kt @@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView import android.view.Menu import android.view.MenuItem import android.view.View -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.kotlin.bindView import com.jakewharton.rxrelay2.PublishRelay diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/CardStream.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/CardStream.kt index 99917dbf4..257b4ccc7 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/CardStream.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/CardStream.kt @@ -106,7 +106,7 @@ class CardStream( } class CardUnauthorizedException : Throwable() { - override val message: String? + override val message: String get() = "Unauthorized" } } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreen.kt index de2375f28..edf06c4ff 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreen.kt @@ -30,7 +30,7 @@ import android.nfc.TagLostException import android.provider.Settings import androidx.appcompat.app.AlertDialog import android.view.Menu -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.analytics.AnalyticsEventName import com.codebutler.farebot.app.core.analytics.logAnalyticsEvent @@ -44,7 +44,6 @@ import com.codebutler.farebot.app.feature.history.HistoryScreen import com.codebutler.farebot.app.feature.keys.KeysScreen import com.codebutler.farebot.app.feature.main.MainActivity.MainActivityComponent import com.codebutler.farebot.app.feature.prefs.FareBotPreferenceActivity -import com.crashlytics.android.Crashlytics import com.uber.autodispose.kotlin.autoDisposable import dagger.Component import io.reactivex.android.schedulers.AndroidSchedulers @@ -124,7 +123,7 @@ class HomeScreen : FareBotScreen(), .setPositiveButton(android.R.string.ok, null) .show() else -> { - Crashlytics.logException(ex) +// Crashlytics.logException(ex) ErrorUtils.showErrorAlert(activity, ex) } } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreenView.kt index c0acff447..fb806302e 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/home/HomeScreenView.kt @@ -32,10 +32,10 @@ import android.view.ViewPropertyAnimator import android.widget.ImageView import android.widget.ProgressBar import android.widget.TextView -import com.codebutler.farebot.BuildConfig -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.wealthfront.magellan.BaseScreenView +import com.xwray.groupie.BuildConfig @SuppressLint("ViewConstructor") class HomeScreenView internal constructor(ctx: Context, private val listener: Listener) : @@ -80,7 +80,7 @@ class HomeScreenView internal constructor(ctx: Context, private val listener: Li .alpha(0f) .setDuration(shortAnimationDuration) .setListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator?) { + override fun onAnimationEnd(animation: Animator) { viewFadeOut.visibility = View.GONE } }) @@ -92,15 +92,15 @@ class HomeScreenView internal constructor(ctx: Context, private val listener: Li return } when (error) { - HomeScreenView.NfcError.DISABLED -> { + NfcError.DISABLED -> { errorTextView.setText(R.string.nfc_off_error) errorButton.visibility = View.VISIBLE } - HomeScreenView.NfcError.UNAVAILABLE -> { + NfcError.UNAVAILABLE -> { errorTextView.setText(R.string.nfc_unavailable) errorButton.visibility = View.GONE } - HomeScreenView.NfcError.NONE -> { /* Unreachable */ } + NfcError.NONE -> { /* Unreachable */ } } errorViewGroup.visibility = View.VISIBLE } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysAdapter.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysAdapter.kt index fb7e57d0b..5b66ffed9 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysAdapter.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysAdapter.kt @@ -26,7 +26,7 @@ import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.app.core.kotlin.inflate import com.jakewharton.rxrelay2.PublishRelay diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreen.kt index d9004a80b..91441a3ae 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreen.kt @@ -24,7 +24,7 @@ package com.codebutler.farebot.app.feature.keys import android.content.Context import android.view.Menu -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.ui.ActionBarOptions diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreenView.kt index 2c6c2b1e5..0957c218b 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/KeysScreenView.kt @@ -29,7 +29,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import android.view.Menu import android.view.MenuItem -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.kotlin.bindView import com.jakewharton.rxrelay2.PublishRelay diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreen.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreen.kt index c037d103a..ae7118d82 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreen.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreen.kt @@ -29,7 +29,7 @@ import android.net.Uri import android.nfc.Tag import android.os.Environment import androidx.appcompat.app.AlertDialog -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.inject.ScreenScope import com.codebutler.farebot.app.core.nfc.NfcStream @@ -93,7 +93,8 @@ class AddKeyScreen : FareBotScreen { if (resultCode == Activity.RESULT_OK && dataIntent != null) { - setKey(activity.contentResolver.openInputStream(dataIntent.data).readBytes()) + dataIntent.data?.let { activity.contentResolver.openInputStream(it)?.readBytes() } + ?.let { setKey(it) } } } } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreenView.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreenView.kt index e91e7c987..c63579dc2 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreenView.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/keys/add/AddKeyScreenView.kt @@ -27,7 +27,7 @@ import android.content.Context import android.view.View import android.widget.Button import android.widget.TextView -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.kotlin.bindView import com.codebutler.farebot.base.util.ByteUtils import com.wealthfront.magellan.BaseScreenView diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/main/MainActivity.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/main/MainActivity.kt index 7df8b0ac5..86faac441 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/main/MainActivity.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/main/MainActivity.kt @@ -37,7 +37,7 @@ import androidx.appcompat.widget.Toolbar import android.view.Menu import android.view.MenuItem import android.view.View -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.core.activity.ActivityOperations import com.codebutler.farebot.app.core.activity.ActivityResult import com.codebutler.farebot.app.core.activity.RequestPermissionsResult @@ -123,7 +123,7 @@ class MainActivity : AppCompatActivity(), navigator.onCreate(this, savedInstanceState) } - override fun onSaveInstanceState(outState: Bundle?) { + override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) navigator.onSaveInstanceState(outState) } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/prefs/FareBotPreferenceActivity.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/prefs/FareBotPreferenceActivity.kt index 440af0e0b..8a37c3125 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/prefs/FareBotPreferenceActivity.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/prefs/FareBotPreferenceActivity.kt @@ -33,7 +33,7 @@ import android.preference.CheckBoxPreference import android.preference.Preference import android.preference.PreferenceActivity import android.view.MenuItem -import com.codebutler.farebot.R +import com.codebutler.farebot.app.R import com.codebutler.farebot.app.feature.bg.BackgroundTagActivity @Suppress("DEPRECATION") From ba44be92096bd9ef2acbc504b46b1deca36413b6 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 17:47:05 -0700 Subject: [PATCH 08/11] fix minor issue --- .../codebutler/farebot/app/feature/card/TransactionAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt index 83ec3e196..73b4f7433 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/feature/card/TransactionAdapter.kt @@ -94,7 +94,7 @@ class TransactionAdapter( if (item is TransactionViewModel.SubscriptionViewModel) { header.text = header.context.getString(R.string.subscriptions) } else { - header.text = DateFormat.getLongDateFormat(header.context).format(item.date) + header.text = item.date?.let { DateFormat.getLongDateFormat(header.context).format(it) } } } } From eb2e0b96570b9b97cc6f988ca65fb699e6b539f6 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 17:52:57 -0700 Subject: [PATCH 09/11] squash disk read errors --- .../farebot/app/core/app/FareBotApplicationModule.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/app/FareBotApplicationModule.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/app/FareBotApplicationModule.kt index c6edea667..a2886fff2 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/app/FareBotApplicationModule.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/app/FareBotApplicationModule.kt @@ -23,6 +23,7 @@ package com.codebutler.farebot.app.core.app import android.content.SharedPreferences +import android.os.StrictMode import androidx.preference.PreferenceManager import com.codebutler.farebot.app.core.nfc.TagReaderFactory import com.codebutler.farebot.app.core.serialize.CardKeysSerializer @@ -58,8 +59,15 @@ import java.util.Date class FareBotApplicationModule { @Provides - fun provideSharedPreferences(application: FareBotApplication): SharedPreferences = - PreferenceManager.getDefaultSharedPreferences(application) + fun provideSharedPreferences(application: FareBotApplication): SharedPreferences { + val oldPolicy = StrictMode.allowThreadDiskReads(); + try { + return PreferenceManager.getDefaultSharedPreferences(application) + } finally { + StrictMode.setThreadPolicy(oldPolicy) + } + } + @Provides fun provideGson(): Gson = GsonBuilder() From cc85bb4553e7752f0bb596b6be0f2afb808705dc Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 18:05:29 -0700 Subject: [PATCH 10/11] remove incompatible rxBroadcast and update related rx libs --- README.md | 1 - dependencies.gradle | 11 +++---- .../farebot/persist/db/FareBotDb.kt | 26 +++++++-------- farebot-app/build.gradle | 1 - .../farebot/app/core/nfc/NfcStream.kt | 32 ++++++++++++++++--- .../farebot/app/core/rx/LastValueRelay.kt | 4 +-- 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index f7ce8c658..b8f2fdbb4 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,6 @@ FareBot uses the following open-source libraries: * [Guava](https://github.com/google/guava) * [Kotlin](https://kotlinlang.org/) * [Magellan](https://github.com/wealthfront/magellan/) -* [RxBroadcast](https://github.com/cantrowitz/RxBroadcast) * [RxJava](https://github.com/ReactiveX/RxJava) * [RxRelay](https://github.com/JakeWharton/RxRelay) diff --git a/dependencies.gradle b/dependencies.gradle index 33cc8520e..4bc6ce4b5 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -11,7 +11,7 @@ ext { def groupieVersion = '2.8.1' def kotlinVersion = '1.9.25' def magellanVersion = '1.1.0' - def roomVersion = '2.1.0-alpha07' + def roomVersion = '2.6.1' libs = [ autoDispose: "com.uber.autodispose:autodispose:${autoDisposeVersion}", @@ -34,12 +34,11 @@ ext { playServicesMaps: 'com.google.android.gms:play-services-maps:16.1.0', roomRuntime: "androidx.room:room-runtime:${roomVersion}", roomCompiler: "androidx.room:room-compiler:${roomVersion}", - rxBroadcast: 'com.cantrowitz:rxbroadcast:2.0.0', - rxJava2: 'io.reactivex.rxjava2:rxjava:2.2.8', - rxRelay2: 'com.jakewharton.rxrelay2:rxrelay:2.1.0', - supportDesign: "com.google.android.material:material:1.0.0", + rxJava2: 'io.reactivex.rxjava2:rxjava:2.2.21', + rxRelay2: 'com.jakewharton.rxrelay2:rxrelay:2.1.1', + supportDesign: "com.google.android.material:material:1.12.0", supportV4: "androidx.legacy:legacy-support-v4:1.0.0", supportV7CardView: "androidx.cardview:cardview:1.0.0", - supportV7RecyclerView: "androidx.recyclerview:recyclerview:1.0.0" + supportV7RecyclerView: "androidx.recyclerview:recyclerview:1.3.2" ] } diff --git a/farebot-app-persist/src/main/java/com/codebutler/farebot/persist/db/FareBotDb.kt b/farebot-app-persist/src/main/java/com/codebutler/farebot/persist/db/FareBotDb.kt index a2570a04f..019e0216f 100644 --- a/farebot-app-persist/src/main/java/com/codebutler/farebot/persist/db/FareBotDb.kt +++ b/farebot-app-persist/src/main/java/com/codebutler/farebot/persist/db/FareBotDb.kt @@ -30,16 +30,16 @@ abstract class FareBotDb : RoomDatabase() { private fun buildDatabase(context: Context): FareBotDb = Room.databaseBuilder(context, FareBotDb::class.java, DATABASE_NAME) .addMigrations(object : Migration(1, 2) { - override fun migrate(database: SupportSQLiteDatabase) { + override fun migrate(db: SupportSQLiteDatabase) { // Migration from Sqldelight to Room. Nothing to change. } }) .addMigrations(object : Migration(2, 3) { - override fun migrate(database: SupportSQLiteDatabase) { + override fun migrate(db: SupportSQLiteDatabase) { // Re-create tables with new NOT NULL `id` column. - database.beginTransaction() + db.beginTransaction() try { - database.execSQL(""" + db.execSQL(""" CREATE TABLE `cards_new` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `type` TEXT NOT NULL, @@ -49,7 +49,7 @@ abstract class FareBotDb : RoomDatabase() { ); """.trimIndent()) - database.execSQL(""" + db.execSQL(""" CREATE TABLE `keys_new` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `card_id` TEXT NOT NULL, @@ -59,25 +59,25 @@ abstract class FareBotDb : RoomDatabase() { ); """.trimIndent()) - database.execSQL(""" + db.execSQL(""" INSERT INTO `cards_new` (type, serial, data, scanned_at) SELECT type, serial, data, scanned_at FROM cards; """.trimIndent()) - database.execSQL(""" + db.execSQL(""" INSERT INTO `keys_new` (card_id, card_type, key_data, created_at) SELECT card_id, card_type, key_data, created_at FROM keys; """.trimIndent()) - database.execSQL("DROP TABLE `cards`;") - database.execSQL("DROP TABLE `keys`;") + db.execSQL("DROP TABLE `cards`;") + db.execSQL("DROP TABLE `keys`;") - database.execSQL("ALTER TABLE `cards_new` RENAME TO `cards`;") - database.execSQL("ALTER TABLE `keys_new` RENAME TO `keys`;") + db.execSQL("ALTER TABLE `cards_new` RENAME TO `cards`;") + db.execSQL("ALTER TABLE `keys_new` RENAME TO `keys`;") - database.setTransactionSuccessful() + db.setTransactionSuccessful() } finally { - database.endTransaction() + db.endTransaction() } } }) diff --git a/farebot-app/build.gradle b/farebot-app/build.gradle index f31eaf39c..1b075ef1c 100644 --- a/farebot-app/build.gradle +++ b/farebot-app/build.gradle @@ -65,7 +65,6 @@ dependencies { implementation libs.kotlinStdlib implementation libs.magellan implementation libs.playServicesMaps - implementation libs.rxBroadcast implementation libs.rxJava2 implementation libs.rxRelay2 implementation libs.supportDesign diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt index 6bcaeb59f..03d9e3407 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/nfc/NfcStream.kt @@ -24,6 +24,8 @@ package com.codebutler.farebot.app.core.nfc import android.app.Activity import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context import android.content.Intent import android.content.IntentFilter import android.nfc.NfcAdapter @@ -32,10 +34,12 @@ import android.nfc.tech.IsoDep import android.nfc.tech.MifareClassic import android.nfc.tech.MifareUltralight import android.nfc.tech.NfcF +import android.os.Build import android.os.Bundle -import com.cantrowitz.rxbroadcast.RxBroadcast +import androidx.annotation.RequiresApi import com.codebutler.farebot.app.core.rx.LastValueRelay import io.reactivex.Observable +import io.reactivex.subjects.PublishSubject class NfcStream(private val activity: Activity) { @@ -74,9 +78,29 @@ class NfcStream(private val activity: Activity) { nfcAdapter?.disableForegroundDispatch(activity) } + @RequiresApi(Build.VERSION_CODES.TIRAMISU) fun observe(): Observable { - val broadcastIntents = RxBroadcast.fromBroadcast(activity, IntentFilter(ACTION)) - .map { it.getParcelableExtra(INTENT_EXTRA_TAG) } - return Observable.merge(relay, broadcastIntents) + // Create a PublishSubject to emit broadcast events + val broadcastSubject = PublishSubject.create() + + // Register the BroadcastReceiver manually + val broadcastReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + val tag = intent.getParcelableExtra(INTENT_EXTRA_TAG) + if (tag != null) { + broadcastSubject.onNext(tag) + } + } + } + + // Register the receiver with the IntentFilter + activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION), Context.RECEIVER_NOT_EXPORTED) + + // Return an observable that merges the relay and the broadcastSubject + return Observable.merge(relay, broadcastSubject) + .doOnDispose { + // Unregister the receiver when the observable is disposed to avoid leaks + activity.unregisterReceiver(broadcastReceiver) + } } } diff --git a/farebot-app/src/main/java/com/codebutler/farebot/app/core/rx/LastValueRelay.kt b/farebot-app/src/main/java/com/codebutler/farebot/app/core/rx/LastValueRelay.kt index b7fa89287..35952af62 100644 --- a/farebot-app/src/main/java/com/codebutler/farebot/app/core/rx/LastValueRelay.kt +++ b/farebot-app/src/main/java/com/codebutler/farebot/app/core/rx/LastValueRelay.kt @@ -27,13 +27,13 @@ import com.jakewharton.rxrelay2.Relay import io.reactivex.Observer import java.util.concurrent.atomic.AtomicReference -class LastValueRelay private constructor() : Relay() { +class LastValueRelay private constructor() : Relay() { private val relay = PublishRelay.create() private val lastValue: AtomicReference = AtomicReference() companion object { - fun create(): LastValueRelay = LastValueRelay() + fun create(): LastValueRelay = LastValueRelay() } override fun accept(value: T) { From 48115d2c3aaba8b271e801ae6e4738d53353f4c2 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Aug 2024 18:35:46 -0700 Subject: [PATCH 11/11] update gitmodule --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 96a0adfcf..34839bbd6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "third_party/nfc-felica-lib"] path = third_party/nfc-felica-lib - url = https://github.com/codebutler/nfc-felica-lib.git + url = https://github.com/jspaetzel/nfc-felica-lib.git