Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Coming soon:
- [TripInfo Request](https://opentransportdata.swiss/en/cookbook/ojptripinforequest/)

## Requirements
Compatible with Android 7+
Compatible with Android 8+

## Integration
To integrate the SDK you have to add following dependency:
Expand All @@ -23,18 +23,6 @@ dependencies {
implementation 'io.github.opentdatach:ojp-android:1.3.4'
}
```
Additionally you may need to enable coreLibraryDesugaring to use Java8 features below API 26 (we use LocalDateTime for parsing)
```
compileOptions {
isCoreLibraryDesugaringEnabled = true
...
}

dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
...
}
```

## Usage
### Initializing
Expand Down
6 changes: 1 addition & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {

defaultConfig {
applicationId = "ch.opentransportdata"
minSdk = 25
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "1.0"
Expand All @@ -34,7 +34,6 @@ android {
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Expand All @@ -55,9 +54,6 @@ android {
}

dependencies {

coreLibraryDesugaring(libs.desugar.jdk.libs)

implementation(project(":sdk"))
implementation(libs.core.ktx)
implementation(libs.lifecycle.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import java.time.Duration
* Created by Deniz Kalem on 12.09.2024
*/
fun Duration.toFormattedString(): String {
val totalMinutes = this.toMinutes()
val hours = (totalMinutes / 60)
val minutes = (totalMinutes % 60)
return when {
toHoursPart() == 0 -> "${this.toMinutesPart()}min"
else -> "${this.toHoursPart()}h ${this.toMinutesPart()}min"
hours <= 0 -> "${minutes}min"
else -> "${hours}h ${minutes}min"
}
}
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[versions]
agp = "8.13.0"
assertk = "0.28.1"
desugar_jdk_libs = "2.1.5"
kotlin = "2.2.0"
coreKtx = "1.15.0"
junit = "4.13.2"
Expand All @@ -26,7 +25,6 @@ playServices = "21.3.0"
assertk = { module = "com.willowtreeapps.assertk:assertk", version.ref = "assertk" }
converter-kotlinx-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit2" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "extJunit" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesTest" }
Expand Down
5 changes: 1 addition & 4 deletions sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
compileSdk = 35

defaultConfig {
minSdk = 25
minSdk = 26
lint.targetSdk = 35
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -55,7 +55,6 @@ android {
}

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Expand All @@ -81,8 +80,6 @@ android {
}

dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)

implementation(libs.core.ktx)
implementation(libs.timber)
implementation(libs.koin.android)
Expand Down
Loading