Skip to content

Commit

Permalink
Merge branch 'grote:master' into fixUI-noProductInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Altonss authored Oct 11, 2024
2 parents 9149209 + 5d9e1c8 commit 13dd63e
Show file tree
Hide file tree
Showing 56 changed files with 331 additions and 163 deletions.
4 changes: 3 additions & 1 deletion .clabot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"thgoebel",
"pt2121",
"Jean-BaptisteC",
"Bnyro"
"Bnyro",
"mesinger",
"newhinton"
],
"label": "cla-signed ✔️",
"message": "Thank you for your pull request and welcome to our community! We require contributors to sign our [Contributor License Agreement](https://github.com/grote/Transportr/blob/master/CLA.md), and we don't seem to have the user {{usersWithoutCLA}} on file. In order for your code to get reviewed and merged, please explicitly state that you accept the agreement. Alternatively, you can add a commit that adds yourself to https://github.com/grote/Transportr/blob/master/.clabot"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ on:

jobs:
build:
runs-on: macos-latest # to be able to run Android emulator, see https://github.com/marketplace/actions/android-emulator-runner
runs-on: macos-13 # to be able to run Android emulator, see https://github.com/marketplace/actions/android-emulator-runner

strategy:
fail-fast: false
matrix:
api-level: [21, 29, 31]
api-level: [21, 29, 33]

steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Get AVD arch
uses: ./.github/actions/get-avd-arch
id: avd-arch
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Transportr
The public transport companion that respects your privacy and your freedom.
Transportr is a non-profit app developed by people around the world to make using public transport as easy as possible wherever you are.

[![Transportr Logo](/app/src/main/res/mipmap-xhdpi/ic_launcher.png)](https://transportr.app)
[![Transportr Logo](./app/src/main/res/mipmap-xhdpi/ic_launcher.png)](https://transportr.app)
[![Build and test](https://github.com/grote/Transportr/actions/workflows/build.yml/badge.svg)](https://github.com/grote/Transportr/actions/workflows/build.yml)

Please **[visit the website](https://transportr.app)** for more information!
Expand All @@ -18,8 +18,8 @@ The upstream repository is at: https://github.com/grote/Transportr
Get Transportr
--------------

[![Available on F-Droid](/artwork/f-droid.png)](https://f-droid.org/repository/browse/?fdid=de.grobox.liberario)
[![Available on Google Play](/artwork/google-play.png)](https://play.google.com/store/apps/details?id=de.grobox.liberario)
[![Available on F-Droid](./artwork/f-droid.png)](https://f-droid.org/repository/browse/?fdid=de.grobox.liberario)
[![Available on Google Play](./artwork/google-play.png)](https://play.google.com/store/apps/details?id=de.grobox.liberario)

Pre-releases and beta versions for advanced users are available via [a special F-Droid repository](http://grobox.de/fdroid/).

Expand Down Expand Up @@ -57,3 +57,11 @@ will. Specifically you can redistribute and/or modify it under the terms of the
[GNU General Public License](https://www.gnu.org/licenses/gpl.html) as
published by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.


Acknowledgements
----------------

<a href="https://www.jawg.io"><img src="./artwork/jawgmaps.png" height="58"/></a>

[JawgMaps](https://www.jawg.io) is a provider of online custom maps, geocoding and routing based on OpenStreetMap data. We would like to thank them for providing their vector map tile service to Transportr free of charge.
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ apply from: 'witness.gradle'
android {

defaultConfig {
versionCode 123
versionName "2.1.5"
versionCode 125
versionName "2.2.1"

applicationId "de.grobox.liberario"
minSdkVersion 21
compileSdkVersion 33
targetSdkVersion 32
compileSdk 33
targetSdkVersion 33

testInstrumentationRunner 'de.grobox.transportr.MockTestRunner'
javaCompileOptions {
Expand Down Expand Up @@ -124,7 +124,7 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation 'com.github.omadahealth:swipy:1.2.3'
implementation 'de.cketti.library.changelog:ckchangelog:1.2.2'
implementation 'com.google.android:flexbox:0.3.2'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.mikepenz:materialdrawer:6.1.1'
implementation 'com.mikepenz:aboutlibraries:6.2.0'
implementation "com.mikepenz:fastadapter:$fastadapterVersion"
Expand All @@ -142,7 +142,7 @@ dependencies {
exclude module: 'failureaccess'
exclude group: 'com.google.j2objc'
}
implementation('com.gitlab.opentransitmap:public-transport-enabler:902b26d6') {
implementation('com.gitlab.opentransitmap:public-transport-enabler:c64494b1') {
exclude group: 'com.google.guava' // included above
exclude group: 'org.json', module: 'json' // provided by Android
exclude group: 'net.sf.kxml', module: 'kxml2' // provided by Android
Expand Down
30 changes: 1 addition & 29 deletions app/src/androidTest/java/de/grobox/transportr/ScreengrabTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,13 @@ abstract class ScreengrabTest {
Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
}

val networkId: NetworkId = when(Locale.forLanguageTag(getTestLocale())) {
val networkId: NetworkId = when(Locale.forLanguageTag(getTestLocale() ?: "de")) {
Locale.FRANCE -> NetworkId.PARIS
Locale.US -> NetworkId.TLEM
Locale.forLanguageTag("pt-BR") -> NetworkId.BRAZIL
else -> NetworkId.DB
}

val departureStation = when(networkId) {
NetworkId.PARIS -> "Gare De Lyon"
NetworkId.TLEM -> "Waterloo Station"
NetworkId.BRAZIL -> "Republica"
else -> "Berlin Hbf"
}

Expand All @@ -72,18 +68,6 @@ abstract class ScreengrabTest {
2 -> WrapLocation(STATION, "stop_area:OIF:SA:8727100", 48880372, 2356597, null, "Gare Du Nord", null)
else -> throw RuntimeException()
}
NetworkId.TLEM -> when(i) {
0 -> WrapLocation(STATION, "1000119", 51503449, -152036, "London", "Hyde Park Corner", null)
1 -> getLocation("Blackfriars Pier")
2 -> getLocation("Moorgate")
else -> throw RuntimeException()
}
NetworkId.BRAZIL -> when(i) {
0 -> WrapLocation(STATION, "stop_point:OSA:SP:2600672", -23555071, -46662131, "São Paulo", "Paulista", null)
1 -> getLocation("Pinheiros")
2 -> getLocation("Vila Madalena")
else -> throw RuntimeException()
}
else -> when(i) {
0 -> WrapLocation(STATION, "8011155", 52521481, 13410962, null, "Berlin Alexanderplatz", null)
1 -> getLocation("Zoologischer Garten")
Expand All @@ -99,18 +83,6 @@ abstract class ScreengrabTest {
2 -> WrapLocation(STATION, "stop_area:OIF:SA:59290", 48866800, 2334338, "Paris", "Pyramides", null)
else -> throw RuntimeException()
}
NetworkId.TLEM -> when(i) {
0 -> WrapLocation(STATION, "1000238", 51509829, -76797, "London", "Tower Hill", null)
1 -> getLocation("Westminster")
2 -> getLocation("Temple")
else -> throw RuntimeException()
}
NetworkId.BRAZIL -> when(i) {
0 -> WrapLocation(STATION, "stop_point:OSA:SP:18876", -23543118, -46589599, "São Paulo", "Belem", null)
1 -> getLocation("Trianon Masp")
2 -> getLocation("Anhangabaú")
else -> throw RuntimeException()
}
else -> when(i) {
0 -> WrapLocation(STATION, "730874", 52507278, 13331992, null, "Checkpoint Charlie", null)
1 -> getLocation("Bundestag")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,14 @@ import java.util.concurrent.TimeUnit

@RequiresPermission(ACCESS_FINE_LOCATION)
override fun onActive() {
for (provider in LOCATION_PROVIDERS) {
for (provider in LOCATION_PROVIDERS.filter(locationManager::isProviderEnabled)) {
locationManager.requestLocationUpdates(provider, MIN_UPDATE_INTERVAL, MIN_UPDATE_DISTANCE, this, Looper.getMainLooper())
}
}

@RequiresPermission(ACCESS_FINE_LOCATION)
override fun onInactive() {
for (provider in LOCATION_PROVIDERS) {
locationManager.removeUpdates(this)
}
locationManager.removeUpdates(this)
}

override fun onLocationChanged(location: Location) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package de.grobox.transportr.networks

import android.annotation.SuppressLint
import android.util.Base64
import android.content.Context
import de.grobox.transportr.R
import de.grobox.transportr.networks.TransportNetwork.Status.ALPHA
Expand Down Expand Up @@ -83,11 +84,11 @@ private val networks = arrayOf(
factory = { BayernProvider() }
),
TransportNetwork(
id = NetworkId.AVV,
id = NetworkId.AVV_AUGSBURG,
name = R.string.np_name_avv,
description = R.string.np_desc_avv,
logo = R.drawable.network_avv_logo,
status = BETA,
factory = { AvvProvider() }
factory = { AvvAugsburgProvider("{\"type\":\"AID\",\"aid\":\"jK91AVVZU77xY5oH\"}") }
),
TransportNetwork(
id = NetworkId.MVV,
Expand Down Expand Up @@ -159,7 +160,7 @@ private val networks = arrayOf(
id = NetworkId.VVO,
description = R.string.np_desc_vvo,
logo = R.drawable.network_vvo_logo,
factory = { VvoProvider("http://efaproxy.fahrinfo.uptrade.de/standard/".toHttpUrlOrNull()) }
factory = { VvoProvider() }
),
TransportNetwork(
id = NetworkId.NASA,
Expand Down Expand Up @@ -231,6 +232,12 @@ private val networks = arrayOf(
logo = R.drawable.network_vgs_logo,
factory = { VgsProvider("{\"type\":\"AID\",\"aid\":\"51XfsVqgbdA6oXzHrx75jhlocRg6Xe\"}", "HJtlubisvxiJxss".toByteArray(Charsets.UTF_8)) }
),
TransportNetwork(
id = NetworkId.VRS,
description = R.string.np_desc_vrs,
logo = R.drawable.network_vrs_logo,
factory = { VrsProvider(VRS) }
),
TransportNetwork(
id = NetworkId.VMT,
description = R.string.np_desc_vmt,
Expand Down Expand Up @@ -281,13 +288,13 @@ private val networks = arrayOf(
logo = R.drawable.network_stv_logo,
factory = { StvProvider() }
),*/
/*TransportNetwork(
TransportNetwork(
id = NetworkId.WIEN,
name = R.string.np_name_wien,
description = R.string.np_desc_wien,
logo = R.drawable.network_wien_logo,
factory = { WienProvider() }
),*/
),
// see https://github.com/grote/Transportr/issues/817
/*TransportNetwork(
id = NetworkId.VMOBIL,
Expand All @@ -312,6 +319,13 @@ private val networks = arrayOf(
),
Country(
R.string.np_region_switzerland, flag = "🇨🇭", networks = listOf(
TransportNetwork(
id = NetworkId.SEARCHCH,
name = R.string.np_name_sbb,
description = R.string.np_desc_sbb,
logo = R.drawable.network_sbb_logo,
factory = { CHSearchProvider() }
),
TransportNetwork(
id = NetworkId.VBL,
description = R.string.np_desc_vbl,
Expand Down Expand Up @@ -412,16 +426,6 @@ private val networks = arrayOf(
)
)
),
Country(
R.string.np_region_ireland, flag = "🇮🇪", networks = listOf(
TransportNetwork(
id = NetworkId.TFI,
description = R.string.np_desc_tfi,
logo = R.drawable.network_tfi_logo,
factory = { TfiProvider() }
)
)
),
Country(
R.string.np_name_it, flag = "🇮🇹", networks = listOf(
TransportNetwork(
Expand Down Expand Up @@ -578,7 +582,10 @@ private val networks = arrayOf(

private const val NAVITIA = "87a37b95-913a-4cb4-ba52-eb0bc0b304ca"
private const val VAO = "{\"aid\":\"hf7mcf9bv3nv8g5f\",\"pw\":\"87a6f8ZbnBih32\",\"type\":\"USER\",\"user\":\"mobile\"}"

private val VRS: ByteArray = Base64.decode(
"MIILOQIBAzCCCv8GCSqGSIb3DQEHAaCCCvAEggrsMIIK6DCCBZ8GCSqGSIb3DQEHBqCCBZAwggWMAgEAMIIFhQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQITP1aoTF3ISwCAggAgIIFWBba5Nms7ssWBgCkVFboVo4EQSGNe6GvJLvlAIAPGBieMyQOeJJwDJgl422+dzIAr+wxYNTgXMBMf7ZwPpVLUyCECGcePHfbLKyAK5CqvP+zYdGYc8oHF5JcukK2wm0oCxt4sRvPKAimFjU1NWFVzX8HY8dTYia59nOF1dk7LmfA5wI8Jr2YURB71lycHLvm4KbBl23AZmEgaAGWPcHhzPFfslo8arlixKGJqc02Tq9gA0+ZY/nkvNtl7fEbVJkHXF7QP7D5O7N5T6D2THyad9rqVdS499VwQ16b5lBTgV5vWD5Ctf5riuewc4aUziGLnukBrHgWOHK8TfsAhtTOrUerAFLNVB2jF6nBKbgywBXKYOBDhKX3MdVmt3srkq0/Ta2+bxUHfwRt17EQKFzboiNuraALs2jXrbSHvuO+pV2yj0WP/sX8d6KXf3XMFejynv7Os7sD0mQTcllsN9bf2oGVUnSaHT97RAekYxaF7LX+q94rhXmhp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ylEweZX2g61jL/fJVowJIA3wXDSuIBq9YRdpEA2OhgCdpwcz69W9T5lVfuJBgKOKcFKSQgDm0sEEkcUV9WR4CWfC9lZ+haHvNcrJBsRkHg6KKsV8PwwbUs2WeXl3NvGnJ/kSQbqJOLfURPziY9w4phupuSTAqmQIc0D4MSZLEjDcXKjg3ifFi4NlGLy+iyzGBoC1YZk1OOlO3uhKxxSD8FG6ncRGHEr8OU+2Yj/qubqZMpckPLXPdWbZB24bQxPTKGeQjFGlgt95H3/aRK9FzmBLc1FOe4qnT9chzbewsAnuho+F7Rqe36hPCZHlIrND0RCOdTAw7buJg6yPIbpDA41SpvS1F/BdFuDepf4yd0NWt4N46zUHmpxavv+2zmDiAUG95ZQ7AmkAA39tc+XtQv3IhLK6Wa7joM61jtau34td3vi1RvN2fPY2jQqOvKA2/hTVw5SzWCI0Tl7le6+ol1/QeUJfpjBZl6Ai+ydgVycSXuyq+MXB/UUEWo8RmlX8R9+y2KtCGV0TQjfX/um1D77LzurRO430m2pggcxmdCiFyl4CRp+rXhw7W6nGwLqZfD2msKthh+tn2QxoNII1oGHHsF7fxE/E4wm54IGtqfLM5pV/5hrqgVfTetABMLFEbtIHrxEDms80SyvsP2/JgelFFrs90wZr9QkLVBBQtZpwmLu39u24HlGXhZflXX0fmlHT2vN1e/EH43Nl/iPgZPYTj6fGGJFdaKNm0QlLym2M0btN3MNMXHETUoLDOg17AomH3NRvSIARu92qa48rX+SeCdF0NJ3VmA2I3Fl4A47epkmMcCzF078UVPC2eQ9M2NtxIAsqQnfIFfxirTuSCdeVS06n8KbMi7PG4Luc7IUPr4W3SQ9mY8XjFgRjVl86QpExzE6P5WZ/RDrgaypcDED6BvMSUwIwYJKoZIhvcNAQkVMRYEFKkQDH5bs77hmpmQ899BQPMX5lIDMDEwITAJBgUrDgMCGgUABBSqWv+fwvAy3ohpbmU2hfBpJbEejAQIPczIVgsfvYECAggA",
Base64.DEFAULT
)
internal fun getContinentItems(context: Context): List<ContinentItem> {
return List(networks.size) { i ->
networks[i].getItem(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class SettingsFragment : PreferenceFragmentCompat() {

// Fill in current transport network if available
networkPref = findPreference("pref_key_network")!!
manager.transportNetwork.observe(this, Observer<TransportNetwork> {
manager.transportNetwork.observe(this) {
onTransportNetworkChanged(it)
})
}

networkPref.setOnPreferenceClickListener {
if (activity == null || view == null) return@setOnPreferenceClickListener false
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/de/grobox/transportr/settings/SettingsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import android.content.SharedPreferences
import android.content.res.Configuration
import android.content.res.Resources
import android.os.Build
import android.os.PowerManager
import android.preference.PreferenceManager
import androidx.appcompat.app.AppCompatDelegate.*
import androidx.core.content.ContextCompat
import de.grobox.transportr.R
import de.schildbach.pte.NetworkId
import de.schildbach.pte.NetworkProvider.Optimize
Expand Down Expand Up @@ -67,8 +69,14 @@ class SettingsManager @Inject constructor(private val context: Context) {

val isDarkTheme: Boolean
get() {
return (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES) or
(theme == MODE_NIGHT_YES)
return when(theme) {
MODE_NIGHT_YES -> true
MODE_NIGHT_NO -> false
else -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
else
ContextCompat.getSystemService(context, PowerManager::class.java)?.isPowerSaveMode ?: false
}
}

val walkSpeed: WalkSpeed
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/de/grobox/transportr/ui/TimeDateFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package de.grobox.transportr.ui

import android.app.DatePickerDialog
import android.app.DatePickerDialog.OnDateSetListener
import android.os.Build
import android.os.Bundle
import android.text.format.DateFormat.getDateFormat
import android.view.LayoutInflater
Expand Down Expand Up @@ -162,8 +163,15 @@ class TimeDateFragment : DialogFragment(), OnDateSetListener, OnTimeChangedListe

@Suppress("DEPRECATION")
private fun showTime(c: Calendar) {
timePicker.currentHour = c.get(HOUR_OF_DAY)
timePicker.currentMinute = c.get(MINUTE)
val hour = c.get(HOUR_OF_DAY)
val min = c.get(MINUTE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
timePicker.hour = hour
timePicker.minute = min
} else {
timePicker.currentHour = hour
timePicker.currentMinute = min
}
}

private fun showDate(c: Calendar) {
Expand Down
Loading

0 comments on commit 13dd63e

Please sign in to comment.