From a81773cb35b782ca836e58a94943dc3f603bd8bb Mon Sep 17 00:00:00 2001 From: ialokim Date: Fri, 11 Sep 2020 23:16:51 +0200 Subject: [PATCH] fix lint issues related to Kotlin and a deprecated method in PTE --- .../transportr/trips/detail/TripReloader.kt | 6 ++- .../trips/search/TripsRepository.kt | 44 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/de/grobox/transportr/trips/detail/TripReloader.kt b/app/src/main/java/de/grobox/transportr/trips/detail/TripReloader.kt index 7fd19d5c9..d150fcc39 100644 --- a/app/src/main/java/de/grobox/transportr/trips/detail/TripReloader.kt +++ b/app/src/main/java/de/grobox/transportr/trips/detail/TripReloader.kt @@ -28,6 +28,7 @@ import de.schildbach.pte.NetworkProvider import de.schildbach.pte.dto.QueryTripsResult import de.schildbach.pte.dto.QueryTripsResult.Status.OK import de.schildbach.pte.dto.Trip +import de.schildbach.pte.dto.TripOptions import java.util.* internal class TripReloader( @@ -46,8 +47,9 @@ internal class TripReloader( Thread { try { val queryTripsResult = networkProvider.queryTrips( - query.from.location, query.via?.location, query.to.location, newDate, true, query.products, - settingsManager.optimize, settingsManager.walkSpeed, null, null) + query.from.location, query.via?.location, query.to.location, newDate, true, + TripOptions(query.products, settingsManager.optimize, settingsManager.walkSpeed, null, null) + ) if (queryTripsResult.status == OK && queryTripsResult.trips.size > 0) { onTripReloaded(queryTripsResult) } else { diff --git a/app/src/main/java/de/grobox/transportr/trips/search/TripsRepository.kt b/app/src/main/java/de/grobox/transportr/trips/search/TripsRepository.kt index f076b5817..792b41ad6 100644 --- a/app/src/main/java/de/grobox/transportr/trips/search/TripsRepository.kt +++ b/app/src/main/java/de/grobox/transportr/trips/search/TripsRepository.kt @@ -44,6 +44,7 @@ import de.schildbach.pte.dto.QueryTripsContext import de.schildbach.pte.dto.QueryTripsResult import de.schildbach.pte.dto.QueryTripsResult.Status.* import de.schildbach.pte.dto.Trip +import de.schildbach.pte.dto.TripOptions import java.io.InterruptedIOException import java.net.SocketTimeoutException import kotlin.concurrent.thread @@ -107,9 +108,10 @@ internal class TripsRepository( private fun queryTrips(query: TripQuery) { try { val queryTripsResult = networkProvider.queryTrips( - query.from.location, if (query.via == null) null else query.via.location, query.to.location, - query.date, query.departure, query.products, settingsManager.optimize, settingsManager.walkSpeed, - null, null) + query.from.location, if (query.via == null) null else query.via.location, query.to.location, + query.date, query.departure, + TripOptions(query.products, settingsManager.optimize, settingsManager.walkSpeed, null, null) + ) if (queryTripsResult.status == OK && queryTripsResult.trips.size > 0) { // deliver result first, so UI can get updated onQueryTripsResultReceived(queryTripsResult) @@ -207,24 +209,24 @@ internal class TripsRepository( .append(": ") .append(errorShort) val body = StringBuilder() - .appendln("### Query") - .appendln("- NetworkId: `${networkProvider.id().name}`") - .appendln("- From: `${query.from.location}`") - .appendln("- Via: `${if (query.via == null) "null" else query.via.location}`") - .appendln("- To: `${query.to.location}`") - .appendln("- Date: `${query.date}`") - .appendln("- Departure: `${query.departure}`") - .appendln("- Products: `${query.products}`") - .appendln("- Optimize for: `${settingsManager.optimize}`") - .appendln("- Walk Speed: `${settingsManager.walkSpeed}`") - .appendln() - .appendln("### Error") - .appendln("```") - .appendln(error) - .appendln("```") - .appendln() - .appendln("### Additional information") - .appendln("[Please modify this part]") + .appendLine("### Query") + .appendLine("- NetworkId: `${networkProvider.id().name}`") + .appendLine("- From: `${query.from.location}`") + .appendLine("- Via: `${if (query.via == null) "null" else query.via.location}`") + .appendLine("- To: `${query.to.location}`") + .appendLine("- Date: `${query.date}`") + .appendLine("- Departure: `${query.departure}`") + .appendLine("- Products: `${query.products}`") + .appendLine("- Optimize for: `${settingsManager.optimize}`") + .appendLine("- Walk Speed: `${settingsManager.walkSpeed}`") + .appendLine() + .appendLine("### Error") + .appendLine("```") + .appendLine(error) + .appendLine("```") + .appendLine() + .appendLine("### Additional information") + .appendLine("[Please modify this part]") val uri = Uri.Builder() .scheme("https")