diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000000000000000000000000000000000000..e8b4d3b6abaf9763cb998eb01d51790d5e3803ce
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,73 @@
+Changelog
+#########
+
+All notable changes to this project will be documented in this file.
+
+The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_`, using ReStructuredText instead of Markdown, and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
+
+[Unreleased]
+============
+
+Added
+-----
+
++ logging and reporting crashes
++ history of frequently searched stops
++ retry buttons
++ caching favourite
++ update info in APK releases
++ day/night setting – auto, always day, always night
++ trip planning
++ full timetable online
++ free train departures
++ searching by lines
++ city bike stations
+
+Changed
+-------
+
+* reduce flickering of search results
+* VM messages appear also in favourites (if it contains 1 stop only)
+* ‘no connectivity’ warning only when offline timetable is not present
+
+[2.1] – 2019-02-04
+==================
+
+Added
+-----
+
++ showing empty search result
++ loading in shed selection and stop screen
++ VM messages
+
+Changed
+-------
+
+* search bar
+* empty departures state
+* ‘now’ departure is ‘in a moment’ if the vehicle is not on-stop
+* sorting departures: on-stop at the top
+* sorting search results by similarity
+
+[2.0] – 2018-09-21
+==================
+
+Added
+-----
+
++ official timetable from ZTM
+
+Changed
+-------
+
+* VM can be used without offline timetable
+* offline timetable uses exact dates (instead of workdays/saturdays/holidays)
+* VM is quicker and is more reliable (as it’s computed in the same way as offline departures)
+* favourites rewritten from scratch
+* app is movable to external storage
+* new colours—grey and green—fitting new Poznań style
+
+Fixed
+-----
+
+* multiple bug fixes
diff --git a/app/build.gradle b/app/build.gradle
index 60d7ff4dd1cc7f634f2ea63bade2a44142788dd3..9e3ad74ce333488e06b01b657ce46f93ccae8062 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,15 +3,15 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
- compileSdkVersion 27
- buildToolsVersion "28.0.2"
+ compileSdkVersion 28
+ buildToolsVersion '28.0.3'
defaultConfig {
applicationId "ml.adamsprogs.bimba"
minSdkVersion 19
- targetSdkVersion 27
- versionCode 15
- versionName "2.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ targetSdkVersion 28
+ versionCode 16
+ versionName "2.1"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
@@ -24,22 +24,26 @@ }
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+ androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support:cardview-v7:27.1.1'
- implementation 'com.android.support:design:27.1.1'
- implementation 'com.android.support:support-vector-drawable:27.1.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
+
+ implementation 'com.google.android.material:material:1.1.0-alpha03'
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'com.github.arimorty:floatingsearchview:2.1.1'
- implementation 'com.google.code.gson:gson:2.8.1'
- implementation 'com.squareup.okhttp3:okhttp:3.8.1'
- implementation 'io.requery:sqlite-android:3.22.0'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.22.5'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.27.0-eap13'
+
testImplementation 'junit:junit:4.12'
+
+ implementation 'io.requery:sqlite-android:3.22.0'
+ implementation 'com.google.code.gson:gson:2.8.2'
+ implementation 'com.squareup.okhttp3:okhttp:3.10.0'
+ implementation 'com.github.mancj:MaterialSearchBar:0.8.1'
}
repositories {
maven { url "https://maven.google.com" }
diff --git a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java b/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
deleted file mode 100644
index f66a5f890feef1d0355c36fae39cced6e1446d12..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package ml.adamsprogs.bimba;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumentation test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("ml.adamsprogs.bimba", appContext.getPackageName());
- }
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e0b120550519b6a66af16dd4c18b7fe0c5606fcc..25e36bf5433aefd3a374503d0e5d22067650e1ad 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="ml.adamsprogs.bimba"
android:installLocation="auto">
@@ -7,12 +8,12 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
- android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
- android:label="@string/app_name"
android:supportsRtl="true"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activities.DashActivity" />
<service
@@ -33,15 +34,11 @@ android:name=".activities.SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName=".activities.DashActivity"
- android:theme="@style/AppTheme" >
+ android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="ml.adamsprogs.bimba.activities.DashActivity" />
</activity>
- <activity
- android:name=".activities.HelpActivity"
- android:label="@string/title_activity_help"
- android:theme="@style/AppTheme" />
<service
android:name=".datasources.VmService"
diff --git a/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt b/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
index 2acd1e1eb9dbb95db986e6907c6e07db549c9792..770ba13101e61f4ccd213248bb2af9aadc0f4874 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
@@ -24,14 +24,6 @@ }
}
}
- fun addOnConnectivityChangeListener(listener: OnConnectivityChangeListener) {
- onConnectivityChangeListeners.add(listener)
- }
-
- fun removeOnConnectivityChangeListener(listener: OnConnectivityChangeListener) {
- onConnectivityChangeListeners.remove(listener)
- }
-
interface OnConnectivityChangeListener {
fun onConnectivityChange(connected: Boolean)
}
diff --git a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
index 8ed8000409fe4705c3161668f926bb0d8d87272d..738003153a01f7d7753f888009f26268299a5f78 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
@@ -3,12 +3,12 @@
import android.app.NotificationChannel
import android.app.NotificationManager
import android.os.Build
-import android.support.annotation.RequiresApi
+import androidx.annotation.RequiresApi
class NotificationChannels {
companion object {
- val CHANNEL_UPDATES = "updates"
+ const val CHANNEL_UPDATES = "updates"
@RequiresApi(Build.VERSION_CODES.O)
fun makeChannel(id: String, name: String, manager: NotificationManager) {
diff --git a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
index 45a60fc90e45adb61e3dd09c5a5ed12bbe9b7059..99225e0e49c57da0143579fe0ecda2b31459456e 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
@@ -1,15 +1,20 @@
package ml.adamsprogs.bimba
-import android.content.*
-import kotlinx.coroutines.experimental.android.UI
-import kotlinx.coroutines.experimental.*
-import ml.adamsprogs.bimba.datasources.*
-import ml.adamsprogs.bimba.models.*
-import ml.adamsprogs.bimba.models.suggestions.*
+import android.content.Context
+import android.content.Intent
+import kotlinx.coroutines.*
+import kotlinx.coroutines.android.Main
+import ml.adamsprogs.bimba.datasources.VmClient
+import ml.adamsprogs.bimba.datasources.VmService
+import ml.adamsprogs.bimba.models.Departure
+import ml.adamsprogs.bimba.models.Plate
+import ml.adamsprogs.bimba.models.StopSegment
+import ml.adamsprogs.bimba.models.Timetable
+import ml.adamsprogs.bimba.models.suggestions.GtfsSuggestion
+import ml.adamsprogs.bimba.models.suggestions.StopSuggestion
import java.util.*
import kotlin.collections.HashMap
-//todo make singleton
class ProviderProxy(context: Context? = null) {
private val vmClient = VmClient.getVmClient()
private var timetable: Timetable = Timetable.getTimetable(context)
@@ -24,17 +29,17 @@ const val MODE_VM = "mode_vm"
}
fun getSuggestions(query: String = "", callback: (List<GtfsSuggestion>) -> Unit) {
- launch(UI) {
- val filtered = withContext(DefaultDispatcher) {
- suggestions = getStopSuggestions(query) //+ getLineSuggestions(query) //todo<p:v+1> + bike stations, train stations, &c
- filterSuggestions(query)
+ GlobalScope.launch {
+ suggestions = getStopSuggestions(query) //+ getLineSuggestions(query) //todo<p:v+1> + bike stations, train stations, &c
+ val filtered = filterSuggestions(query)
+ launch(Dispatchers.Main) {
+ callback(filtered)
}
- callback(filtered)
}
}
private suspend fun getStopSuggestions(query: String): List<StopSuggestion> {
- val vmSuggestions = withContext(DefaultDispatcher) {
+ val vmSuggestions = withContext(Dispatchers.Default) {
vmClient.getStops(query)
}
@@ -65,18 +70,27 @@ return result
}
fun getSheds(name: String, callback: (Map<String, Set<String>>) -> Unit) {
- launch(UI) {
- val sheds = withContext(DefaultDispatcher) {
- val vmSheds = vmClient.getSheds(name)
+ GlobalScope.launch {
+ val vmSheds = vmClient.getSheds(name)
- if (vmSheds.isEmpty() and !timetable.isEmpty()) {
- timetable.getHeadlinesForStop(name)
- } else {
- vmSheds
- }
+ val sheds = if (vmSheds.isEmpty() and !timetable.isEmpty()) {
+ timetable.getHeadlinesForStop(name)
+ } else {
+ vmSheds
}
- callback(sheds)
+ launch(Dispatchers.Main) {
+ callback(sheds)
+ }
+ }
+ }
+
+ fun getVmMessage(shed: String, callback: (String?) -> Unit) {
+ GlobalScope.launch {
+ val message = vmClient.getMessage(shed)
+ launch(Dispatchers.Main) {
+ callback(message)
+ }
}
}
@@ -104,7 +118,7 @@ return uuid
}
private fun constructSegmentDepartures(stopSegments: Set<StopSegment>): Deferred<Map<String, List<Departure>>> {
- return async {
+ return GlobalScope.async {
if (timetable.isEmpty())
emptyMap()
else {
@@ -161,10 +175,8 @@
}
fun fillStopSegment(stopSegment: StopSegment, callback: (StopSegment?) -> Unit) {
- launch(UI) {
- withContext(DefaultDispatcher) {
- callback(fillStopSegment(stopSegment))
- }
+ GlobalScope.launch {
+ callback(fillStopSegment(stopSegment))
}
}
@@ -179,10 +191,8 @@ timetable.getHeadlinesForStopCode(stopSegment.stop)
}
fun getStopName(stopCode: String, callback: (String?) -> Unit) {
- launch(UI) {
- withContext(DefaultDispatcher) {
- callback(getStopName(stopCode))
- }
+ GlobalScope.launch {
+ callback(getStopName(stopCode))
}
}
@@ -216,13 +226,13 @@ private var cache: Deferred