Author: Adam Evyčędo <git@apiote.xyz>
update dependecies
%!v(PANIC=String method: strings: negative Repeat count)
diff --git a/app/build.gradle b/app/build.gradle index d8678df448f795c22513c41b198dc7245d6f9a36..a674573a993fc81cfccef8e34bfc7936c5e15c60 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,6 @@ defaultConfig { applicationId "xyz.apiote.bimba.czwek" minSdk 21 - //noinspection EditedTargetSdkVersion targetSdk 34 versionCode 23 versionName "3.1.1" @@ -30,8 +29,8 @@ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { - sourceCompatibility = 18 - targetCompatibility = 18 + sourceCompatibility = 17 + targetCompatibility = 17 coreLibraryDesugaringEnabled true } buildFeatures { @@ -42,27 +41,27 @@ buildToolsVersion = '34.0.0' } dependencies { - implementation 'androidx.core:core-ktx:1.10.1' + implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' + implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' - implementation 'androidx.navigation:navigation-fragment-ktx:2.7.1' - implementation 'androidx.navigation:navigation-ui-ktx:2.7.1' + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0' + implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7' + implementation 'androidx.navigation:navigation-ui-ktx:2.7.7' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.core:core-splashscreen:1.0.1' implementation 'com.google.openlocationcode:openlocationcode:1.0.4' implementation 'org.osmdroid:osmdroid-android:6.1.16' implementation 'org.yaml:snakeyaml:2.2' - implementation 'androidx.activity:activity-ktx:1.7.2' + implementation 'androidx.activity:activity-ktx:1.8.2' implementation 'com.google.openlocationcode:openlocationcode:1.0.4' implementation 'com.otaliastudios:zoomlayout:1.9.0' implementation 'dev.bandb.graphview:graphview:0.8.1' implementation project(path: ':fruchtfleisch') - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/api/Responses.kt b/app/src/main/java/xyz/apiote/bimba/czwek/api/Responses.kt deleted file mode 100644 index 18eab3d10e2d0b467214a33c747b09b481985c05..0000000000000000000000000000000000000000 --- a/app/src/main/java/xyz/apiote/bimba/czwek/api/Responses.kt +++ /dev/null @@ -1,361 +0,0 @@ -package xyz.apiote.bimba.czwek.api - -import xyz.apiote.fruchtfleisch.Reader -import java.io.InputStream - -class UnknownResponseVersion(resource: String, version: ULong) : - Exception("Unknown resource $resource in version $version") - -interface LineResponse { - companion object { - fun unmarshal(stream: InputStream): LineResponse { - val reader = Reader(stream) - return when (val v = reader.readUInt().toULong()) { - 0UL -> LineResponseDev.unmarshal(stream) - 1UL -> LineResponseV1.unmarshal(stream) - else -> throw UnknownResponseVersion("Line", v) - } - } - } -} - -data class LineResponseDev( - val line: LineV2 -) : LineResponse { - companion object { - fun unmarshal(stream: InputStream): LineResponseDev { - return LineResponseDev(LineV2.unmarshal(stream)) - } - } -} - -data class LineResponseV1( - val line: LineV1 -) : LineResponse { - companion object { - fun unmarshal(stream: InputStream): LineResponseV1 { - return LineResponseV1(LineV1.unmarshal(stream)) - } - } -} - -interface DeparturesResponse { - companion object { - fun unmarshal(stream: InputStream): DeparturesResponse { - val reader = Reader(stream) - return when (val v = reader.readUInt().toULong()) { - 0UL -> DeparturesResponseDev.unmarshal(stream) - 1UL -> DeparturesResponseV1.unmarshal(stream) - 2UL -> DeparturesResponseV2.unmarshal(stream) - else -> throw UnknownResponseVersion("Departures", v) - } - } - } -} - -data class DeparturesResponseDev( - val alerts: List<AlertV1>, - val departures: List<DepartureV3>, - val stop: StopV2 -) : DeparturesResponse { - companion object { - fun unmarshal(stream: InputStream): DeparturesResponseDev { - val alerts = mutableListOf<AlertV1>() - val departures = mutableListOf<DepartureV3>() - - val reader = Reader(stream) - val alertsNum = reader.readUInt().toULong() - for (i in 0UL until alertsNum) { - val alert = AlertV1.unmarshal(stream) - alerts.add(alert) - } - val departuresNum = reader.readUInt().toULong() - for (i in 0UL until departuresNum) { - val departure = DepartureV3.unmarshal(stream) - departures.add(departure) - } - - return DeparturesResponseDev(alerts, departures, StopV2.unmarshal(stream)) - } - } -} - -data class DeparturesResponseV1( - val alerts: List<AlertV1>, - val departures: List<DepartureV1>, - val stop: StopV1 -) : DeparturesResponse { - companion object { - fun unmarshal(stream: InputStream): DeparturesResponseV1 { - val alerts = mutableListOf<AlertV1>() - val departures = mutableListOf<DepartureV1>() - - val reader = Reader(stream) - val alertsNum = reader.readUInt().toULong() - for (i in 0UL until alertsNum) { - val alert = AlertV1.unmarshal(stream) - alerts.add(alert) - } - val departuresNum = reader.readUInt().toULong() - for (i in 0UL until departuresNum) { - val departure = DepartureV1.unmarshal(stream) - departures.add(departure) - } - - return DeparturesResponseV1(alerts, departures, StopV1.unmarshal(stream)) - } - } -} - -data class DeparturesResponseV2( - val alerts: List<AlertV1>, - val departures: List<DepartureV2>, - val stop: StopV2 -) : DeparturesResponse { - companion object { - fun unmarshal(stream: InputStream): DeparturesResponseV2 { - val alerts = mutableListOf<AlertV1>() - val departures = mutableListOf<DepartureV2>() - - val reader = Reader(stream) - val alertsNum = reader.readUInt().toULong() - for (i in 0UL until alertsNum) { - val alert = AlertV1.unmarshal(stream) - alerts.add(alert) - } - val departuresNum = reader.readUInt().toULong() - for (i in 0UL until departuresNum) { - val departure = DepartureV2.unmarshal(stream) - departures.add(departure) - } - - return DeparturesResponseV2(alerts, departures, StopV2.unmarshal(stream)) - } - } -} - -interface QueryablesResponse { - companion object { - fun unmarshal(stream: InputStream): QueryablesResponse { - val reader = Reader(stream) - return when (val v = reader.readUInt().toULong()) { - 0UL -> QueryablesResponseDev.unmarshal(stream) - 1UL -> QueryablesResponseV1.unmarshal(stream) - 2UL -> QueryablesResponseV2.unmarshal(stream) - else -> throw UnknownResponseVersion("Queryables", v) - } - } - } -} - -data class QueryablesResponseDev(val queryables: List<QueryableV3>) : QueryablesResponse { - companion object { - fun unmarshal(stream: InputStream): QueryablesResponseDev { - val queryables = mutableListOf<QueryableV3>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> { - queryables.add(StopV2.unmarshal(stream)) - } - - 1UL -> { - queryables.add(LineV2.unmarshal(stream)) - } - - else -> { - throw UnknownResourceVersionException("Queryable/$r", 0u) - } - } - } - return QueryablesResponseDev(queryables) - } - } -} - -data class QueryablesResponseV1(val queryables: List<QueryableV1>) : QueryablesResponse { - companion object { - fun unmarshal(stream: InputStream): QueryablesResponseV1 { - val queryables = mutableListOf<QueryableV1>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> { - queryables.add(StopV1.unmarshal(stream)) - } - - else -> { - throw UnknownResourceVersionException("Queryable/$r", 1u) - } - } - } - return QueryablesResponseV1(queryables) - } - } -} - -data class QueryablesResponseV2(val queryables: List<QueryableV2>) : QueryablesResponse { - companion object { - fun unmarshal(stream: InputStream): QueryablesResponseV2 { - val queryables = mutableListOf<QueryableV2>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> { - queryables.add(StopV2.unmarshal(stream)) - } - - 1UL -> { - queryables.add(LineV1.unmarshal(stream)) - } - - else -> { - throw UnknownResourceVersionException("Queryable/$r", 2u) - } - } - } - return QueryablesResponseV2(queryables) - } - } -} - -interface FeedsResponse { - companion object { - fun unmarshal(stream: InputStream): FeedsResponse { - val reader = Reader(stream) - return when (val v = reader.readUInt().toULong()) { - 0UL -> FeedsResponseDev.unmarshal(stream) - 1UL -> FeedsResponseV1.unmarshal(stream) - else -> throw UnknownResponseVersion("Feeds", v) - } - } - } -} - -data class FeedsResponseDev( - val feeds: List<FeedInfoV1> -) : FeedsResponse { - companion object { - fun unmarshal(stream: InputStream): FeedsResponseDev { - val feeds = mutableListOf<FeedInfoV1>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - feeds.add(FeedInfoV1.unmarshal(stream)) - } - return FeedsResponseDev(feeds) - } - } -} - -data class FeedsResponseV1( - val feeds: List<FeedInfoV1> -) : FeedsResponse { - companion object { - fun unmarshal(stream: InputStream): FeedsResponseV1 { - val feeds = mutableListOf<FeedInfoV1>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - feeds.add(FeedInfoV1.unmarshal(stream)) - } - return FeedsResponseV1(feeds) - } - } -} - -interface LocatablesResponse { - companion object { - fun unmarshal(stream: InputStream): LocatablesResponse { - val reader = Reader(stream) - return when (val v = reader.readUInt().toULong()) { - 0UL -> LocatablesResponseDev.unmarshal(stream) - 1UL -> LocatablesResponseV1.unmarshal(stream) - 2UL -> LocatablesResponseV2.unmarshal(stream) - else -> throw UnknownResponseVersion("Locatables", v) - } - } - } -} - -data class LocatablesResponseDev(val locatables: List<LocatableV3>) : LocatablesResponse { - companion object { - fun unmarshal(stream: InputStream): LocatablesResponseDev { - val locatables = mutableListOf<LocatableV3>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> { - locatables.add(StopV2.unmarshal(stream)) - } - - 1UL -> { - locatables.add(VehicleV3.unmarshal(stream)) - } - - else -> { - throw UnknownResourceVersionException("Locatable/$r", 0u) - } - } - } - return LocatablesResponseDev(locatables) - } - } -} - -data class LocatablesResponseV1(val locatables: List<LocatableV1>) : LocatablesResponse { - companion object { - fun unmarshal(stream: InputStream): LocatablesResponseV1 { - val locatables = mutableListOf<LocatableV1>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> { - locatables.add(StopV1.unmarshal(stream)) - } - - 1UL -> { - locatables.add(VehicleV1.unmarshal(stream)) - } - - else -> { - throw UnknownResourceVersionException("Locatable/$r", 1u) - } - } - } - return LocatablesResponseV1(locatables) - } - } -} - -data class LocatablesResponseV2(val locatables: List<LocatableV2>) : LocatablesResponse { - companion object { - fun unmarshal(stream: InputStream): LocatablesResponseV2 { - val locatables = mutableListOf<LocatableV2>() - val reader = Reader(stream) - val n = reader.readUInt().toULong() - for (i in 0UL until n) { - when (val r = reader.readUInt().toULong()) { - 0UL -> locatables.add(StopV2.unmarshal(stream)) - 1UL -> locatables.add(VehicleV2.unmarshal(stream)) - else -> throw UnknownResourceVersionException("Locatable/$r", 2u) - } - } - return LocatablesResponseV2(locatables) - } - } -} - -data class ErrorResponse(val field: String, val message: String) { - companion object { - fun unmarshal(stream: InputStream): ErrorResponse { - val reader = Reader(stream) - return ErrorResponse(reader.readString(), reader.readString()) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/api/responses/UnknownResponseVersion.kt b/app/src/main/java/xyz/apiote/bimba/czwek/api/responses/UnknownResponseVersion.kt new file mode 100644 index 0000000000000000000000000000000000000000..69c025fe2fd34428e9fc83e19518143de890e22a --- /dev/null +++ b/app/src/main/java/xyz/apiote/bimba/czwek/api/responses/UnknownResponseVersion.kt @@ -0,0 +1,17 @@ +package xyz.apiote.bimba.czwek.api + +import xyz.apiote.fruchtfleisch.Reader +import java.io.InputStream + +class UnknownResponseVersion(resource: String, version: ULong) : + Exception("Unknown resource $resource in version $version") + + +data class ErrorResponse(val field: String, val message: String) { + companion object { + fun unmarshal(stream: InputStream): ErrorResponse { + val reader = Reader(stream) + return ErrorResponse(reader.readString(), reader.readString()) + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 070cb764ec8c65806a092f48ad58e780cbec291c..4239a9290d24113fc0783528fd3c5a7dad94ff70 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.1.1' apply false - id 'com.android.library' version '8.1.1' apply false + id 'com.android.application' version '8.2.2' apply false + id 'com.android.library' version '8.2.2' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false id 'org.jetbrains.kotlin.jvm' version '1.7.20' apply false id "org.jetbrains.kotlin.plugin.parcelize" version "1.8.20" apply false diff --git a/fruchtfleisch/build.gradle b/fruchtfleisch/build.gradle index aaf4d52189cd87072a7cdef5902538afee6fcb81..730e890c34aca32c1cf7c79d430c86a9f204929a 100644 --- a/fruchtfleisch/build.gradle +++ b/fruchtfleisch/build.gradle @@ -7,6 +7,6 @@ dependencies { //implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.10' } java { - sourceCompatibility = JavaVersion.VERSION_18 - targetCompatibility = JavaVersion.VERSION_18 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 42fc8d468a93cc5dcfef291ae05846be0aec1eea..db5c9160a04a3fc27a8eebe690dd68492633dc6c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Aug 09 15:48:25 CEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME