Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F13497469
D236.1782108359.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Authored By
Unknown
Size
52 KB
Referenced Files
None
Subscribers
None
D236.1782108359.diff
View Options
diff --git a/app/src/main/java/it/reyboz/bustorino/backend/VehicleUtils.kt b/app/src/main/java/it/reyboz/bustorino/backend/VehicleUtils.kt
new file mode 100644
--- /dev/null
+++ b/app/src/main/java/it/reyboz/bustorino/backend/VehicleUtils.kt
@@ -0,0 +1,92 @@
+package it.reyboz.bustorino.backend
+
+import it.reyboz.bustorino.backend.VehicleUtils.VehicleType
+import java.util.Locale.getDefault
+
+data class VehicleClassInfo(
+ val vehClass: Int,
+ val name: String,
+ val kindString: String,
+ val type: VehicleType,
+ val matricolaStart: Int,
+ val matricolaEnd: Int,
+) {
+ constructor(vehicleClass: Int, name: String, type: String, matricolaStart: Int, matricolaEnd: Int) : this(
+ vehicleClass, name, type,VehicleType.fromString(type), matricolaStart, matricolaEnd
+ )
+}
+
+object VehicleUtils {
+ private val items = listOf(
+ VehicleClassInfo(2800, "Arancio", "Tram", 2801, 2857),
+ VehicleClassInfo(2800, "Arancio", "Tram", 2858, 2902),
+ VehicleClassInfo(5000, "5000", "Tram", 5000, 5053),
+ VehicleClassInfo(6000, "6000", "Tram", 6000, 6005),
+ VehicleClassInfo(6000, "6000", "Tram", 6006, 6054),
+ VehicleClassInfo(8000, "Hitachi", "Tram", 8000, 8099),
+ VehicleClassInfo(800, "Citelis 18m", "Bus 18m", 790, 797),
+ VehicleClassInfo(800, "Citelis 18m", "Bus 18m", 800, 869),
+ VehicleClassInfo(800, "Citelis 18m", "Bus 18m", 870, 874),
+ VehicleClassInfo(800, "Citelis 18m", "Bus 18m", 1310, 1313),
+ VehicleClassInfo(1350, "Conecto 18m", "Bus 18m", 1350, 1396),
+ VehicleClassInfo(9300, "UrbanWay 18m", "Bus 18m", 9300, 9318),
+ VehicleClassInfo(9300, "UrbanWay 18m", "Bus 18m", 9320, 9356),
+ VehicleClassInfo(30, "BYD K9", "E-Bus", 30, 49),
+ VehicleClassInfo(50, "BYD K7", "E-Bus", 50, 57),
+ VehicleClassInfo(60, "MiniBusE", "E-Bus", 60, 81),
+ VehicleClassInfo(110, "Neocity", "Bus", 110, 115),
+ VehicleClassInfo(2300, "Cityclass", "Bus", 2300, 2349),
+ VehicleClassInfo(3400, "Conecto", "Bus", 2400, 2447),
+ VehicleClassInfo(2300, "Cityclass", "Bus", 2700, 2787),
+ VehicleClassInfo(3000, "Citelis", "Bus", 3000, 3099),
+ VehicleClassInfo(3000, "Citelis", "Bus", 3300, 3380),
+ VehicleClassInfo(3400, "Conecto", "Bus", 3400, 3440),
+ VehicleClassInfo(9000, "BYD K9", "E-Bus", 9000, 9059),
+ VehicleClassInfo(9000, "BYD K9", "E-Bus", 9060, 9119),
+ VehicleClassInfo(9000, "BYD K9", "E-Bus", 9120, 9121),
+ VehicleClassInfo(9200, "Citymood", "Bus", 9200, 9251),
+ VehicleClassInfo(9200, "Citymood", "Bus", 9252, 9261),
+ VehicleClassInfo(9400, "E-Way", "E-Bus", 9400, 9599),
+ VehicleClassInfo(9600, "E-Way 18m", "E-Bus", 9600, 9699)
+ )
+
+ fun getTypeForLabel(label: String): VehicleClassInfo? {
+ try {
+ val matricola = Integer.parseInt(label)
+ for (el in items) {
+ if(matricola >= el.matricolaStart && matricola<= el.matricolaEnd) {
+ return el
+ }
+ }
+ return null
+
+ } catch (e: Exception) {
+ return null
+ }
+ }
+ enum class VehicleType {
+ BUS, TRAM, ELECTRIC_BUS;
+
+ fun getName(): String {
+ return when (this) {
+ BUS -> "Bus"
+ TRAM -> "Tram"
+ ELECTRIC_BUS -> "E-Bus"
+ }
+ }
+
+ companion object {
+ @JvmStatic
+ fun fromString(string: String): VehicleType {
+ return when (string.lowercase(getDefault())) {
+ "bus" -> BUS
+ "bus 18m" -> BUS
+ "tram" -> TRAM
+ "e-bus" -> ELECTRIC_BUS
+ "e-bus 18m" -> ELECTRIC_BUS
+ else -> throw IllegalArgumentException("Unknown vehicle type: $string")
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/it/reyboz/bustorino/backend/gtfs/GtfsUtils.java b/app/src/main/java/it/reyboz/bustorino/backend/gtfs/GtfsUtils.java
--- a/app/src/main/java/it/reyboz/bustorino/backend/gtfs/GtfsUtils.java
+++ b/app/src/main/java/it/reyboz/bustorino/backend/gtfs/GtfsUtils.java
@@ -23,10 +23,10 @@
abstract public class GtfsUtils {
- public static final String GTFSRT_URL_POSITION = "http://percorsieorari.gtt.to.it/das_gtfsrt/vehicle_position.aspx";
+ public static final String GTFSRT_URL_POSITION = "https://percorsieorari.gtt.to.it/das_gtfsrt/vehicle_position.aspx";
- public static final String GTFSRT_URL_TRIP_UPDATES ="http://percorsieorari.gtt.to.it/das_gtfsrt/trip_update.aspx";
- public static final String GTFSRT_URL_ALERTS = "http://percorsieorari.gtt.to.it/das_gtfsrt/alerts.aspx";
+ public static final String GTFSRT_URL_TRIP_UPDATES ="https://percorsieorari.gtt.to.it/das_gtfsrt/trip_update.aspx";
+ public static final String GTFSRT_URL_ALERTS = "https://percorsieorari.gtt.to.it/das_gtfsrt/alerts.aspx";
public static String stripGtfsPrefix(String routeID){
String[] explo = routeID.split(":");
diff --git a/app/src/main/java/it/reyboz/bustorino/data/GtfsAlertDBDownloadWorker.kt b/app/src/main/java/it/reyboz/bustorino/data/GtfsAlertDBDownloadWorker.kt
--- a/app/src/main/java/it/reyboz/bustorino/data/GtfsAlertDBDownloadWorker.kt
+++ b/app/src/main/java/it/reyboz/bustorino/data/GtfsAlertDBDownloadWorker.kt
@@ -3,12 +3,15 @@
import android.app.NotificationManager
import android.content.Context
import android.util.Log
+import androidx.lifecycle.LiveData
import androidx.work.BackoffPolicy
import androidx.work.CoroutineWorker
import androidx.work.Data
import androidx.work.ForegroundInfo
import androidx.work.OneTimeWorkRequest
import androidx.work.OutOfQuotaPolicy
+import androidx.work.WorkInfo
+import androidx.work.WorkManager
import androidx.work.WorkerParameters
import com.android.volley.Response
import com.android.volley.VolleyError
@@ -18,6 +21,7 @@
import it.reyboz.bustorino.backend.NetworkVolleyManager
import it.reyboz.bustorino.backend.Notifications
import it.reyboz.bustorino.backend.gtfs.GtfsRtAlertsRequest
+import it.reyboz.bustorino.data.DBUpdateWorker.Companion.WORK_NAME
import it.reyboz.bustorino.data.GtfsMaintenanceWorker.Companion.OPERATION_TYPE
import it.reyboz.bustorino.data.gtfs.GtfsAlertsActivePeriods
import it.reyboz.bustorino.data.gtfs.GtfsAlertsTranslation
@@ -48,26 +52,26 @@
val req = GtfsRtAlertsRequest(object : Response.ErrorListener {
override fun onErrorResponse(err: VolleyError) {
- Log.e(DEBUG_TAG, "Error getting alerts: ${err.message}", err)
+ Log.e(DEBUG_TAG, "Error getting alerts, message: ${err.message}", err)
}
}, future)
volleyManager.requestQueue.add(req)
try {
- resuList = future.get(10, TimeUnit.SECONDS)
+ resuList = future.get(15, TimeUnit.SECONDS)
if (resuList.isNotEmpty()){
Log.d(DEBUG_TAG, "Have no alerts, attempt $attempts")
notOK = false
}
} catch (e: InterruptedException) {
- e.printStackTrace()
- Log.e(DEBUG_TAG, e.message, e)
+ //e.printStackTrace()
+ Log.w(DEBUG_TAG, "Interrupted: ", e)
} catch (e: ExecutionException) {
- e.printStackTrace()
- Log.e(DEBUG_TAG, e.message, e)
+ //e.printStackTrace()
+ Log.w(DEBUG_TAG, e.message, e)
} catch (e: TimeoutException) {
- e.printStackTrace()
- Log.e(DEBUG_TAG, e.message, e)
+ //e.printStackTrace()
+ Log.w(DEBUG_TAG, "Timeout for download", e)
}
attempts++
@@ -109,12 +113,20 @@
private const val NOTIFICATION_ID = 271899102
private const val DEBUG_TAG = "BusTO-GTFSRTAlertsDown"
+ @JvmStatic
fun makeOneTimeRequest(tag: String): OneTimeWorkRequest {
//val data = Data.Builder().putString(OPERATION_TYPE, type).build()
return OneTimeWorkRequest.Builder(GtfsAlertDBDownloadWorker::class.java)
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
+ .setBackoffCriteria(BackoffPolicy.LINEAR, 30, TimeUnit.SECONDS)
.addTag(tag)
.build()
}
+
+ @JvmStatic
+ fun getWorkInfoLiveData(context: Context): LiveData<List<WorkInfo>> {
+ val workManager = WorkManager.getInstance(context)
+ return workManager.getWorkInfosForUniqueWorkLiveData(WORK_NAME)
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/it/reyboz/bustorino/data/gtfs/AlertsDao.kt b/app/src/main/java/it/reyboz/bustorino/data/gtfs/AlertsDao.kt
--- a/app/src/main/java/it/reyboz/bustorino/data/gtfs/AlertsDao.kt
+++ b/app/src/main/java/it/reyboz/bustorino/data/gtfs/AlertsDao.kt
@@ -110,10 +110,10 @@
@Query("""
SELECT a.* FROM gtfsrt_alerts a
INNER JOIN alerts_informed_entities ie ON ie.alertId = a.id
- WHERE ie.stopId = :stopId
+ WHERE ie.stopId = :stopGtfsId
ORDER BY a.fetchedAt DESC
""")
- fun getAlertsForStop(stopId: String): LiveData<List<AlertWithDetails>>
+ fun getAlertsForStopGtfsId(stopGtfsId: String): LiveData<List<AlertWithDetails>>
@Transaction
@Query("""
diff --git a/app/src/main/java/it/reyboz/bustorino/data/gtfs/GtfsAlertsDBConverter.kt b/app/src/main/java/it/reyboz/bustorino/data/gtfs/GtfsAlertsDBConverter.kt
--- a/app/src/main/java/it/reyboz/bustorino/data/gtfs/GtfsAlertsDBConverter.kt
+++ b/app/src/main/java/it/reyboz/bustorino/data/gtfs/GtfsAlertsDBConverter.kt
@@ -108,7 +108,7 @@
//agencyId = if (e.hasAgencyId()) e.agencyId else null,
routeId = if (e.hasRouteId()) "gtt:${e.routeId}" else null,
routeType = if (e.hasRouteType()) e.routeType else null,
- stopId = if (e.hasStopId()) e.stopId else null,
+ stopId = if (e.hasStopId()) "gtt:${e.stopId}" else null,
tripId = tripId,
tripRouteId = tripRouteId,
directionId = directionId
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/AlertsDialogFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/AlertsDialogFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/AlertsDialogFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/AlertsDialogFragment.kt
@@ -44,7 +44,7 @@
import kotlin.collections.HashMap
-class AlertsDialogFragment(private val gtfsLineShow: String) : DialogFragment() {
+class AlertsDialogFragment(private val gtfsLineShow: String, private val stopToShow: String) : DialogFragment() {
private lateinit var titleTextView: TextView
private lateinit var messageTextView: TextView
@@ -55,7 +55,7 @@
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- Log.d(DEBUG_TAG, "created DialogFragment for line ${gtfsLineShow}")
+ Log.d(DEBUG_TAG, "created DialogFragment for line ${gtfsLineShow} and/or stop ${stopToShow}")
}
override fun onCreateView(
@@ -66,13 +66,24 @@
val root = inflater.inflate(R.layout.fragment_dialog_alerts_line, container, false)
titleTextView = root.findViewById<TextView>(R.id.titleTextView)
- titleTextView.setText(getString(R.string.alert_line_fill,GtfsUtils.lineNameDisplayFromGtfsID(gtfsLineShow)))
+ val text = if (gtfsLineShow.isNotEmpty())
+ getString(R.string.alert_line_fill,GtfsUtils.lineNameDisplayFromGtfsID(gtfsLineShow))
+ else if(stopToShow.isNotEmpty()){
+ getString(R.string.alert_stop_fill,stopToShow)
+ } else{
+ throw Exception("Either text or line has to be filled")
+ }
+ titleTextView.setText(text)
recyclerView = root.findViewById(R.id.alertsRecyclerView)
recyclerView.layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
messageTextView = root.findViewById(R.id.alertMessageTextView)
statusCardView = root.findViewById(R.id.statusCard)
- alertsViewModel.alertsByRouteLiveData.observe(viewLifecycleOwner){ alerts ->
- showAlerts(alerts)
+ if(gtfsLineShow.isNotEmpty())
+ alertsViewModel.alertsByRouteLiveData.observe(viewLifecycleOwner){ alerts ->
+ showAlerts(alerts)
+ }
+ else if(stopToShow.isNotEmpty()){
+ alertsViewModel.alertsByStopLiveData.observe(viewLifecycleOwner){ alerts -> showAlerts(alerts) }
}
val btnClose = root.findViewById<ImageButton>(R.id.btnClose)
@@ -150,11 +161,14 @@
* @return A new instance of fragment LineAlertsDialogFragment.
*/
@JvmStatic
- fun newInstance(gtfsLine: String) =
- AlertsDialogFragment(gtfsLine)
+ fun newInstanceForLine(gtfsLine: String) =
+ AlertsDialogFragment(gtfsLine, "")
+ @JvmStatic
+ fun newInstanceForStop(stop: String) =
+ AlertsDialogFragment("", stop)
private const val GTFS_LINE_ARG = "gtfsLine"
private const val DEBUG_TAG = "BusTO-AlertsDialog"
}
}
\ No newline at end of file
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/AlertsFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/AlertsFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/AlertsFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/AlertsFragment.kt
@@ -30,6 +30,7 @@
import androidx.recyclerview.widget.RecyclerView
import com.google.transit.realtime.GtfsRealtime
import it.reyboz.bustorino.R
+import it.reyboz.bustorino.backend.Palina
import it.reyboz.bustorino.viewmodels.ServiceAlertsViewModel
import java.text.SimpleDateFormat
import java.util.Date
@@ -47,6 +48,7 @@
private val alertsViewModel: ServiceAlertsViewModel by activityViewModels()
private lateinit var textView: TextView
+ private lateinit var statusTextView: TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
@@ -62,20 +64,41 @@
// Inflate the layout for this fragment
val root = inflater.inflate(R.layout.fragment_alerts, container, false)
textView = root.findViewById(R.id.simpleTextView)
+ statusTextView = root.findViewById(R.id.statusTextView)
alertsViewModel.allAlertsLiveData.observe(viewLifecycleOwner, { alerts ->
- val sb = StringBuilder()
- val unixTimestamp = (System.currentTimeMillis() / 1000)
- for (x in alerts) {
- sb.append(x.longPrint())
- sb.append("----- Alert active: ").append(x.isActive(unixTimestamp)).append("\n\n")
+ if(alerts==null){
+ return@observe
}
+ if(alerts.isEmpty()){
+ textView.text = "No Alerts to show"
+ } else {
+ val sb = StringBuilder()
+ val unixTimestamp = (System.currentTimeMillis() / 1000)
+ for (x in alerts) {
+ sb.append(x.longPrint())
+ sb.append("----- Alert active: ").append(x.isActive(unixTimestamp)).append("\n\n")
+ }
- textView.text = sb.toString()
+ textView.text = sb.toString()
+ }
})
+ alertsViewModel.getDownloadStatusLiveData(requireContext()).observe(viewLifecycleOwner, { workinfos ->
+ val sb = StringBuilder()
+ var c = 1
+ if(workinfos!=null && workinfos.isNotEmpty()){
+ for (worki in workinfos){
+ sb.append("$c - state: ${worki.state}, attempt ${worki.runAttemptCount}").append("\n")
+ c++
+ }
+ }
+ statusTextView.text = sb.toString()
+ })
+
+
- alertsViewModel.setStopFilter("472")
+ //alertsViewModel.setStopFilter(Palina("472")
/*alertsViewModel.alertsForStop.observe(viewLifecycleOwner){
Log.d(DEBUG_TAG, "Got ${it.size} alerts")
it?.let {
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/ArrivalsFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/ArrivalsFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/ArrivalsFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/ArrivalsFragment.kt
@@ -25,6 +25,8 @@
import android.view.View
import android.view.ViewGroup
import android.widget.*
+import androidx.cardview.widget.CardView
+import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.loader.app.LoaderManager
import androidx.loader.content.CursorLoader
@@ -48,6 +50,7 @@
import it.reyboz.bustorino.middleware.CoroutineFavoriteAction
import it.reyboz.bustorino.util.LinesNameSorter
import it.reyboz.bustorino.viewmodels.ArrivalsViewModel
+import it.reyboz.bustorino.viewmodels.ServiceAlertsViewModel
import java.util.*
@@ -79,6 +82,7 @@
private lateinit var howDoesItWorkTextView: TextView
private lateinit var hideHintButton: Button
+ private lateinit var alertsCardView : CardView
//private NestedScrollView theScrollView;
protected lateinit var noArrivalsRecyclerView: RecyclerView
@@ -89,7 +93,7 @@
//private View canaryEndView;
private var fetchers: List<ArrivalsFetcher?> = ArrayList()
private val arrivalsViewModel : ArrivalsViewModel by viewModels()
-
+ private val alertsViewModel: ServiceAlertsViewModel by activityViewModels()
private var reloadOnResume = true
private var routesNoPassages = listOf<Route>()
@@ -179,6 +183,7 @@
resultsLayout = root.findViewById(R.id.resultsLayout)
loadingMessageTextView = root.findViewById(R.id.loadingMessageTextView)
progressBar = root.findViewById(R.id.circularProgressBar)
+ alertsCardView = root.findViewById(R.id.alertsCardView)
hideHintButton.setOnClickListener { v: View? -> this.onHideHint(v) }
@@ -335,6 +340,17 @@
arrivalsViewModel.stopInFavorites.observe(viewLifecycleOwner, { isFavorite ->
updateStarIcon(isFavorite)
})
+
+ alertsViewModel.alertsByStopLiveData.observe(viewLifecycleOwner) { alerts ->
+ if(alerts!=null && alerts.isNotEmpty()){
+ alertsCardView.visibility = View.VISIBLE
+ alertsCardView.setOnClickListener {
+ AlertsDialogFragment.newInstanceForStop(stopID).show(parentFragmentManager, "AlertsDialogStop$stopID")
+ }
+ } else{
+ alertsCardView.visibility = View.GONE
+ }
+ }
}
private fun showShortToast(id: Int) = showToastMessage(id,true)
@@ -432,6 +448,8 @@
if (needUpdateOnAttach) {
updateFragmentData(null)
needUpdateOnAttach = false
+ } else{
+ updateFragmentData(lastUpdatedPalina ?: Palina(stopID))
}
}
@@ -494,7 +512,16 @@
* @param p the full Palina
*/
fun updateFragmentData(p: Palina?) {
- if (p != null) lastUpdatedPalina = p
+ if (p != null) {
+ lastUpdatedPalina = p
+ //set the gtfsID for the alerts
+ if(isAdded){
+ //alertsViewModel.setStopFilter(p)
+ } else{
+ Log.w(DEBUG_TAG, "Cannot filter alerts for palina $p, the fragment is not added")
+ }
+ }
+
if (!isAdded) {
//defer update at next show
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/GeneralMapLibreFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/GeneralMapLibreFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/GeneralMapLibreFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/GeneralMapLibreFragment.kt
@@ -41,6 +41,7 @@
import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.contract.ActivityResultContracts
import androidx.cardview.widget.CardView
+import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.ViewCompat
@@ -55,6 +56,7 @@
import it.reyboz.bustorino.backend.LivePositionTripPattern
import it.reyboz.bustorino.backend.LivePositionsServiceStatus
import it.reyboz.bustorino.backend.Stop
+import it.reyboz.bustorino.backend.VehicleUtils
import it.reyboz.bustorino.backend.gtfs.GtfsUtils
import it.reyboz.bustorino.backend.gtfs.LivePositionUpdate
import it.reyboz.bustorino.backend.utils
@@ -114,7 +116,7 @@
protected lateinit var selectedBusSource: GeoJsonSource //= GeoJsonSource(SEL_BUS_SOURCE)
protected lateinit var sharedPreferences: SharedPreferences
- protected lateinit var bottomSheetBehavior: BottomSheetBehavior<RelativeLayout>
+ protected lateinit var bottomSheetBehavior: BottomSheetBehavior<ConstraintLayout>
protected var locationEngine: MapLibreLocationEngine? = null
protected lateinit var locationProvider: FusedNativeLocationProvider
@@ -161,7 +163,7 @@
}
)
//Bottom sheet behavior in GeneralMapLibreFragment
- protected var bottomLayout: RelativeLayout? = null
+ protected var bottomLayout: ConstraintLayout? = null
protected lateinit var stopTitleTextView: TextView
protected lateinit var stopNumberTextView: TextView
protected lateinit var linesPassingTextView: TextView
@@ -171,6 +173,7 @@
protected lateinit var bottomrightImage: ImageView
protected lateinit var locationComponent: LocationComponent
protected lateinit var busPositionsIconButton: ImageButton
+ protected lateinit var vehicleIcon: ImageView
protected var lastLocation : Location? = null
@@ -255,22 +258,29 @@
return super.onCreateView(inflater, container, savedInstanceState)
}
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
-
- //init bottom sheet
- val bottomSheet = view.findViewById<RelativeLayout>(R.id.bottom_sheet)
+ protected fun initBottomSheet(view: View){
+ val bottomSheet = view.findViewById<ConstraintLayout>(R.id.bottom_sheet)
bottomLayout = bottomSheet
stopTitleTextView = view.findViewById(R.id.stopTitleTextView)
stopNumberTextView = view.findViewById(R.id.stopNumberTextView)
- linesPassingTextView = view.findViewById(R.id.linesPassingTextView)
+ linesPassingTextView = view.findViewById(R.id.descriptionTextView)
arrivalsCard = view.findViewById(R.id.arrivalsCardButton)
directionsCard = view.findViewById(R.id.directionsCardButton)
- bottomrightImage = view.findViewById(R.id.rightmostImageView)
+ vehicleIcon = view.findViewById(R.id.vehicleIcon)
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
+ bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
+
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ //init bottom sheet
+ initBottomSheet(view)
+
+ bottomrightImage = view.findViewById(R.id.rightmostImageView)
extraBottomTextView = view.findViewById(R.id.extraBottomTextView)
- bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
override fun onResume() {
@@ -662,6 +672,7 @@
bottomrightImage.setImageDrawable(
ResourcesCompat.getDrawable(resources, R.drawable.ic_magnifying_glass, activity?.theme)
)
+ // if you change this, remember to change the color of the vehicleIcon
val colorBlue = ResourcesCompat.getColor(resources, R.color.blue_500, activity?.theme)
ViewCompat.setBackgroundTintList(directionsCard, ColorStateList.valueOf(colorBlue))
linesPassingTextView.text = getString(R.string.vehicle_fill, data.posUpdate.vehicle)
@@ -669,6 +680,25 @@
extraBottomTextView.text = getString(R.string.updated_fill, utils.unixTimestampToLocalTime(data.posUpdate.timestamp))
extraBottomTextView.visibility = View.VISIBLE
+ val update = data.posUpdate
+ val vehInfo = VehicleUtils.getTypeForLabel(update.vehicle)
+ if(vehInfo == null){
+ vehicleIcon.visibility = View.GONE
+ } else{
+ val ico = when(vehInfo.type){
+ VehicleUtils.VehicleType.BUS -> R.drawable.ic_bus_small
+ VehicleUtils.VehicleType.ELECTRIC_BUS -> R.drawable.ic_bus_electric_small
+ VehicleUtils.VehicleType.TRAM -> R.drawable.ic_tram_24
+ }
+ vehicleIcon.setImageDrawable(ResourcesCompat.getDrawable(resources, ico, activity?.theme))
+ vehicleIcon.visibility = View.VISIBLE
+
+ vehicleIcon.setOnClickListener {
+ val print = "${vehInfo.type.getName()} ${vehInfo.name}"
+ makeToast(print)
+ }
+ }
+
}
vehShowing = veh
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
@@ -822,6 +852,8 @@
bottomrightImage.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.navigation_right, activity?.theme))
+ vehicleIcon.visibility = View.GONE
+
}
//add stop marker
if (stop.latitude!=null && stop.longitude!=null) {
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/LinesDetailFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/LinesDetailFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/LinesDetailFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/LinesDetailFragment.kt
@@ -283,7 +283,7 @@
//set
lineInfoButton.setOnClickListener {
- AlertsDialogFragment(lineID).show(parentFragmentManager, "Alerts-Line$lineID")
+ AlertsDialogFragment.newInstanceForLine(lineID).show(parentFragmentManager, "Alerts-Line$lineID")
}
/*
@@ -426,6 +426,9 @@
} else
lineInfoButton.visibility = View.GONE
}
+ lineInfoButton.setOnClickListener {
+ AlertsDialogFragment.newInstanceForLine(lineID).show(parentFragmentManager, "Alerts-Line$lineID")
+ }
}
// ------------- UI switch stuff ---------
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/MapLibreFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/MapLibreFragment.kt
--- a/app/src/main/java/it/reyboz/bustorino/fragments/MapLibreFragment.kt
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/MapLibreFragment.kt
@@ -137,13 +137,7 @@
mapView!!.getMapAsync(this)
//init bottom sheet
- val bottomSheet = rootView.findViewById<RelativeLayout>(R.id.bottom_sheet)
- bottomLayout = bottomSheet
- stopTitleTextView = bottomSheet.findViewById(R.id.stopTitleTextView)
- stopNumberTextView = bottomSheet.findViewById(R.id.stopNumberTextView)
- linesPassingTextView = bottomSheet.findViewById(R.id.linesPassingTextView)
- arrivalsCard = bottomSheet.findViewById(R.id.arrivalsCardButton)
- directionsCard = bottomSheet.findViewById(R.id.directionsCardButton)
+ initBottomSheet(rootView)
userLocationButton = rootView.findViewById(R.id.locationEnableIcon)
userLocationButton.setOnClickListener(this::switchUserLocationStatus)
@@ -153,8 +147,6 @@
busPositionsIconButton.setOnClickListener {
LivePositionsDialogFragment().show(parentFragmentManager, "LivePositionsDialog")
}
- bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
- bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
arrivalsCard.setOnClickListener {
if(context!=null){
diff --git a/app/src/main/java/it/reyboz/bustorino/viewmodels/ServiceAlertsViewModel.kt b/app/src/main/java/it/reyboz/bustorino/viewmodels/ServiceAlertsViewModel.kt
--- a/app/src/main/java/it/reyboz/bustorino/viewmodels/ServiceAlertsViewModel.kt
+++ b/app/src/main/java/it/reyboz/bustorino/viewmodels/ServiceAlertsViewModel.kt
@@ -18,17 +18,21 @@
package it.reyboz.bustorino.viewmodels
import android.app.Application
+import android.content.Context
import android.util.Log
import androidx.lifecycle.AndroidViewModel
+import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map
import androidx.lifecycle.switchMap
import androidx.lifecycle.viewModelScope
import androidx.room.concurrent.AtomicBoolean
import androidx.work.ExistingWorkPolicy
+import androidx.work.WorkInfo
import androidx.work.WorkManager
import com.google.transit.realtime.GtfsRealtime.Alert
import it.reyboz.bustorino.backend.NetworkVolleyManager
+import it.reyboz.bustorino.backend.Stop
import it.reyboz.bustorino.data.GtfsAlertDBDownloadWorker
import it.reyboz.bustorino.data.GtfsRepository
import it.reyboz.bustorino.data.gtfs.GtfsDatabase
@@ -48,7 +52,7 @@
//val alertsLiveData = MutableLiveData<ArrayList<Alert>>(ArrayList())
- private val stopToFilter = MutableLiveData("")
+ private val stopGtfsIdToFilter = MutableLiveData<Stop>()
private val routeToFilter = MutableLiveData("")
val lastTimeRunningDownload = MutableLiveData(0L)
@@ -64,8 +68,8 @@
gtfsRepo.getAlertsByRouteID(it).map{ l -> l.filter { al->al.isActive(unixTimestamp) }}
}
- val alertsByStopLiveData = stopToFilter.switchMap {
- gtfsRepo.alertsDao.getAlertsForStop(it)
+ val alertsByStopLiveData = stopGtfsIdToFilter.switchMap {
+ if(it.gtfsID!=null) gtfsRepo.alertsDao.getAlertsForStopGtfsId(it.gtfsID!!) else MutableLiveData()
}
val allAlertsLiveData = gtfsRepo.alertsDao.getAllAlertsLiveData()
@@ -94,9 +98,15 @@
}
*/
- fun setStopFilter(stopId: String) {
- stopToFilter.value = stopId
+ /// WE DO NOT KNOW HOW TO GET THE GTFS STOP ID, the one given by MaTO is the same as the stop CODE
+ /// but we need the ID from the stops.txt table of GTT GTFS data
+ /// DISABLING THIS FUNCTION
+ /*fun setStopFilter(stop: Stop) {
+ Log.d(DEBUG_TAG, "Setting stop to filter: ${stop.ID} - ${stop.stopDisplayName}, gtfsID: ${stop.gtfsID}")
+ stopGtfsIdToFilter.value = stop
}
+
+ */
fun setGtfsLineFilter(routeId: String) {
routeToFilter.value = routeId
}
@@ -111,7 +121,7 @@
currentTime > lastTimeRunningDownload.value!! + MINUTES_CHECK*60*1000){
//actually enqueue request
Log.d(DEBUG_TAG, "Launching request to download alerts")
- val req = GtfsAlertDBDownloadWorker.makeOneTimeRequest("alertsrn")
+ val req = GtfsAlertDBDownloadWorker.makeOneTimeRequest(WORK_TAG)
workManager.enqueueUniqueWork("AlertsDownloadsRun", ExistingWorkPolicy.KEEP, req)
lastTimeRunningDownload.postValue(System.currentTimeMillis())
}
@@ -129,7 +139,10 @@
downloadWorkIfTimePassed()
}
-
+ fun getDownloadStatusLiveData(context: Context): LiveData<List<WorkInfo>>{
+ val workManager = WorkManager.getInstance(context)
+ return workManager.getWorkInfosByTagLiveData(WORK_TAG)
+ }
private fun filterAlertsForStop(stopId: String, alerts: ArrayList<Alert>) : ArrayList<Alert>{
@@ -191,6 +204,7 @@
companion object{
private const val DEBUG_TAG = "BusTO-GTFSRTAlerts"
+ public const val WORK_TAG = "AlertsDownloadWorker"
}
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bus_marker.xml b/app/src/main/res/drawable/bus_marker.xml
deleted file mode 100644
--- a/app/src/main/res/drawable/bus_marker.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<!-- drawable/bus_marker.xml -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="24dp"
- android:width="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:strokeWidth="1"
- android:strokeColor="#FFF"
- android:fillColor="@color/metro_red"
- android:pathData="M12 2C7.58 2 4 2.5 4 6V16A3 3 0 0 0 5 18.22V20A1 1 0 0 0 6 21H7A1 1 0 0 0 8 20V19H14A8 8 0 0 1 13 15.5A5.55 5.55 0 0 1 15.38 11H6V6H18V10A4.07 4.07 0 0 1 18.5 10A5.34 5.34 0 0 1 20 10.22V6C20 2.5 16.42 2 12 2M7.5 14A1.5 1.5 0 1 1 6 15.5A1.5 1.5 0 0 1 7.5 14M18.5 12A3.54 3.54 0 0 0 15 15.5C15 18.1 18.5 22 18.5 22S22 18.1 22 15.5A3.54 3.54 0 0 0 18.5 12M18.5 16.8A1.2 1.2 0 1 1 18.5 14.4A1.29 1.29 0 0 1 19.7 15.6A1.15 1.15 0 0 1 18.5 16.8Z" />
-</vector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_bus_electric_small.xml b/app/src/main/res/drawable/ic_bus_electric_small.xml
new file mode 100644
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bus_electric_small.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="30dp"
+ android:height="24dp"
+ android:viewportWidth="1200"
+ android:viewportHeight="960">
+ <path
+ android:pathData="m240,840q-17,0 -28.5,-11.5Q200,817 200,800v-82q-18,-20 -29,-44.5 -11,-24.5 -11,-53.5v-380q0,-83 77,-121.5 77,-38.5 243,-38.5 172,0 246,37 74,37 74,123v380q0,29 -11,53.5 -11,24.5 -29,44.5v82q0,17 -11.5,28.5Q737,840 720,840h-40q-17,0 -28.5,-11.5Q640,817 640,800v-40L320,760v40q0,17 -11.5,28.5Q297,840 280,840ZM482,200L706,200 258,200ZM640,480L240,480 720,480ZM240,400L720,400L720,280L240,280ZM382.5,622.5Q400,605 400,580 400,555 382.5,537.5 365,520 340,520q-25,0 -42.5,17.5 -17.5,17.5 -17.5,42.5 0,25 17.5,42.5 17.5,17.5 42.5,17.5 25,0 42.5,-17.5zM662.5,622.5Q680,605 680,580 680,555 662.5,537.5 645,520 620,520q-25,0 -42.5,17.5 -17.5,17.5 -17.5,42.5 0,25 17.5,42.5 17.5,17.5 42.5,17.5 25,0 42.5,-17.5zM258,200L706,200Q691,183 641.5,171.5 592,160 482,160 375,160 325.5,172.5 276,185 258,200ZM320,680h320q33,0 56.5,-23.5Q720,633 720,600L720,480L240,480v120q0,33 23.5,56.5 23.5,23.5 56.5,23.5z"
+ android:fillColor="?colorAccent"/>
+ <path
+ android:pathData="m1000.4,226.7v186.7h93.3l-140,280v-186.7h-93.3z"
+ android:strokeWidth="46.6668"
+ android:fillColor="?colorAccent"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_bus_small.xml b/app/src/main/res/drawable/ic_bus_small.xml
new file mode 100644
--- /dev/null
+++ b/app/src/main/res/drawable/ic_bus_small.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:pathData="M240,840q-17,0 -28.5,-11.5T200,800v-82q-18,-20 -29,-44.5T160,620v-380q0,-83 77,-121.5T480,80q172,0 246,37t74,123v380q0,29 -11,53.5T760,718v82q0,17 -11.5,28.5T720,840h-40q-17,0 -28.5,-11.5T640,800v-40L320,760v40q0,17 -11.5,28.5T280,840h-40ZM482,200h224,-448 224ZM640,480L240,480h480,-80ZM240,400h480v-120L240,280v120ZM382.5,622.5Q400,605 400,580t-17.5,-42.5Q365,520 340,520t-42.5,17.5Q280,555 280,580t17.5,42.5Q315,640 340,640t42.5,-17.5ZM662.5,622.5Q680,605 680,580t-17.5,-42.5Q645,520 620,520t-42.5,17.5Q560,555 560,580t17.5,42.5Q595,640 620,640t42.5,-17.5ZM258,200h448q-15,-17 -64.5,-28.5T482,160q-107,0 -156.5,12.5T258,200ZM320,680h320q33,0 56.5,-23.5T720,600v-120L240,480v120q0,33 23.5,56.5T320,680Z"
+ android:fillColor="?colorAccent"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_tram_24.xml b/app/src/main/res/drawable/ic_tram_24.xml
new file mode 100644
--- /dev/null
+++ b/app/src/main/res/drawable/ic_tram_24.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:pathData="M160,700v-380q0,-97 85,-127t195,-33l30,-60L280,100v-60h400v60L550,100l-30,60q119,3 199.5,32.5T800,320v380q0,59 -40.5,99.5T660,840l60,60v20h-80l-80,-80L400,840l-80,80h-80v-20l60,-60q-59,0 -99.5,-40.5T160,700ZM660,560L240,560h480,-60ZM522.5,702.5Q540,685 540,660t-17.5,-42.5Q505,600 480,600t-42.5,17.5Q420,635 420,660t17.5,42.5Q455,720 480,720t42.5,-17.5ZM478,280h228,-450 222ZM240,480h480v-120L240,360v120ZM300,760h360q26,0 43,-17t17,-43v-140L240,560v140q0,26 17,43t43,17ZM478,240q-134,0 -172,14.5T256,280h450q-12,-14 -52,-27t-176,-13Z"
+ android:fillColor="#1f1f1f"/>
+</vector>
diff --git a/app/src/main/res/layout/fragment_alerts.xml b/app/src/main/res/layout/fragment_alerts.xml
--- a/app/src/main/res/layout/fragment_alerts.xml
+++ b/app/src/main/res/layout/fragment_alerts.xml
@@ -7,15 +7,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.AlertsFragment">
-
- <!-- TODO: Update blank fragment layout -->
+ <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:gravity="center" android:id="@+id/statusTextView"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/scrollView"
+ android:layout_margin="10dp"
+ app:layout_constraintVertical_bias="0.0"/>
<androidx.core.widget.NestedScrollView
+ android:id="@+id/scrollView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/statusTextView"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="0dp"
+ android:layout_margin="10dp"
+ >
<TextView
android:layout_margin="10dp"
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/fragment_arrivals.xml b/app/src/main/res/layout/fragment_arrivals.xml
--- a/app/src/main/res/layout/fragment_arrivals.xml
+++ b/app/src/main/res/layout/fragment_arrivals.xml
@@ -127,7 +127,10 @@
>
<LinearLayout
android:orientation="vertical"
- android:layout_width="match_parent" android:layout_height="wrap_content">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <!--
+ -->
<TextView
android:id="@+id/howDoesItWorkTextView"
android:layout_width="wrap_content"
@@ -141,6 +144,7 @@
android:textColor="@color/blue_500"
android:visibility="gone"
/>
+
<Button
android:id="@+id/hideHintButton"
style="?android:attr/buttonStyleSmall"
@@ -156,6 +160,72 @@
android:textColor="@color/grey_100"
android:textSize="19sp"
android:visibility="gone" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/alertsCardView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:cardCornerRadius="5dp"
+ app:cardElevation="0dp"
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="10dp"
+ android:layout_marginTop="5sp"
+ android:layout_marginBottom="2sp"
+ android:backgroundTint="@color/alerts_color_button"
+ android:foreground="?attr/selectableItemBackground"
+ android:visibility="gone"
+ >
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:padding="5dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingEnd="10dp"
+ >
+ <View android:layout_width="1dp"
+ android:layout_height="20dp"
+ android:id="@+id/uselessView"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/bubbleImageView"
+ />
+ <ImageView
+ android:layout_width="35dp"
+ android:layout_height="35dp"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/uselessView"
+ app:layout_constraintEnd_toStartOf="@id/alertShowingTextView"
+ android:src="@drawable/chat_bubble_warning_solid"
+ android:id="@+id/bubbleImageView"
+ android:layout_marginStart="10dp"
+ android:layout_marginTop="5dp"
+ android:layout_marginBottom="5dp"
+ app:tint="@color/white"
+ app:layout_constraintHorizontal_bias="0.0"
+
+
+ />
+ <TextView
+ android:id="@+id/alertShowingTextView"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/bubbleImageView"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:fontFamily="@font/lato_regular"
+ android:text="Ci sono avvisi"
+ android:textColor="@color/white"
+ app:layout_constraintEnd_toEndOf="parent"
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="10dp"
+ android:textSize="18sp"
+ app:layout_constraintHorizontal_bias="0.0"
+
+ />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ </androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/arrivalsRecyclerView"
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/include_map_bottom_sheet.xml b/app/src/main/res/layout/include_map_bottom_sheet.xml
--- a/app/src/main/res/layout/include_map_bottom_sheet.xml
+++ b/app/src/main/res/layout/include_map_bottom_sheet.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottom_sheet"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
@@ -21,56 +21,80 @@
<TextView
android:id="@+id/stopNumberTextView"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="17sp"
- android:layout_alignParentTop="true"
- android:layout_alignParentStart="true"
- android:layout_toStartOf="@id/arrivalsCardButton"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/arrivalsCardButton"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
- android:layout_marginBottom="4dp"
android:fontFamily="@font/lato_regular"
/>
<TextView
android:id="@+id/stopTitleTextView"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="19sp"
- android:layout_below="@id/stopNumberTextView"
- android:layout_alignParentStart="true"
- android:layout_toStartOf="@id/arrivalsCardButton"
- android:layout_marginBottom="6dp"
+ app:layout_constraintTop_toBottomOf="@id/stopNumberTextView"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/arrivalsCardButton"
+ android:layout_marginTop="4dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:fontFamily="@font/lato_bold"
/>
<TextView
- android:id="@+id/linesPassingTextView"
- android:layout_width="match_parent"
+ android:id="@+id/descriptionTextView"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:minHeight="22dp"
android:textSize="15sp"
- android:layout_below="@id/stopTitleTextView"
- android:layout_alignParentStart="true"
- android:layout_toStartOf="@id/arrivalsCardButton"
- android:layout_marginBottom="5dp"
+ android:gravity="center_vertical"
+ app:layout_constraintTop_toBottomOf="@id/stopTitleTextView"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/vehicleIcon"
+ android:layout_marginTop="6dp"
android:layout_marginStart="10dp"
- android:layout_marginEnd="10dp"
+ android:layout_marginEnd="1dp"
android:fontFamily="@font/lato_regular"
+ app:layout_constraintHorizontal_chainStyle="packed"
+ app:layout_constraintHorizontal_bias="0.0"
+
+ />
+ <ImageView
+ android:layout_width="33dp"
+ android:layout_height="24dp"
+ android:id="@+id/vehicleIcon"
+ android:layout_marginTop="6dp"
+ android:layout_marginEnd="10dp"
+ android:layout_marginStart="0dp"
+ android:src="@drawable/ic_bus_electric_small"
+ app:tint="@color/blue_700"
+ app:layout_constraintTop_toBottomOf="@id/stopTitleTextView"
+ app:layout_constraintStart_toEndOf="@id/descriptionTextView"
+ app:layout_constraintEnd_toStartOf="@id/arrivalsCardButton"
+ />
+
+ <androidx.constraintlayout.widget.Barrier
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/belowTextBarrier"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="vehicleIcon,descriptionTextView"
/>
<TextView
android:id="@+id/extraBottomTextView"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="13sp"
- android:layout_below="@id/linesPassingTextView"
- android:layout_alignParentStart="true"
- android:layout_toStartOf="@id/arrivalsCardButton"
- android:layout_marginBottom="5dp"
+ app:layout_constraintTop_toBottomOf="@id/belowTextBarrier"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/arrivalsCardButton"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
- android:layout_marginTop="2dp"
+ android:layout_marginTop="5dp"
android:text="Updated at "
android:fontFamily="@font/lato_regular"
android:visibility="gone"
@@ -80,12 +104,13 @@
android:layout_width="50sp"
android:layout_height="50sp"
android:layout_marginStart="5sp"
- android:layout_marginEnd="5sp"
+ android:layout_marginEnd="6sp"
app:cardCornerRadius="25sp"
app:cardElevation="2dp"
android:clickable="true"
android:focusable="true"
- android:layout_alignParentTop="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/directionsCardButton"
android:layout_toStartOf="@id/directionsCardButton"
android:backgroundTint="?android:attr/colorAccent"
android:foreground="?selectableItemBackground">
@@ -109,8 +134,8 @@
app:cardElevation="2dp"
android:clickable="true"
android:focusable="true"
- android:layout_alignParentTop="true"
- android:layout_alignParentEnd="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
android:foreground="?selectableItemBackground"
android:backgroundTint="?android:attr/colorAccent"
>
@@ -138,8 +163,20 @@
android:layout_marginBottom="5dp"
android:layout_marginStart="10dp"
android:layout_below="@id/directionsCardButton"
+ app:layout_constraintTop_toBottomOf="@id/directionsCardButton"
android:layout_alignParentEnd="true"
+ app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
android:foreground="?selectableItemBackground"
+ app:layout_constraintBottom_toTopOf="@id/bottomBarrier"
/>
-</RelativeLayout>
\ No newline at end of file
+ <androidx.constraintlayout.widget.Barrier
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/bottomBarrier"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="btnClose,extraBottomTextView"
+ app:layout_constraintBottom_toBottomOf="parent"
+ />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -4,6 +4,8 @@
<color name="orange_500">#ff9800</color>
<color name="orange_600">#E77D13</color>
<color name="orange_700">#F57C00</color>
+ <color name="orange_750">#f57200</color>
+ <color name="orange_750_l45">#e66b00</color>
<color name="orange_700_40light">#cc6600</color>
<color name="orange_700_30light">#994d00</color>
<color name="blue_500">#2196F3</color>
@@ -71,4 +73,5 @@
<color name="metro_bg">@color/metro_red</color>
<color name="map_icon_background_active">@color/orange_icons_10light</color>
<color name="map_icon_background_inactive">@color/grey_400</color>
+ <color name="alerts_color_button">@color/orange_750_l45</color>
</resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -398,6 +398,7 @@
<string name="updated_fill">Updated: %1$s</string>
<string name="alert_line_fill">Alerts for line %1$s:</string>
+ <string name="alert_stop_fill">Alerts for stop %1$s:</string>
<string name="no_alerts_in_your_language_fill">No alerts in your language, showing in %1$s</string>
<string name="italian">Italian</string>
<string name="english">English</string>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 22, 08:06 (22 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1973157
Default Alt Text
D236.1782108359.diff (52 KB)
Attached To
Mode
D236: Restore GTFS realtime, show type of vehicle in the map
Attached
Detach File
Event Timeline