Page MenuHomeGitPull.it

D236.1789762474.diff
No OneTemporary

Authored By
Unknown
Size
29 KB
Referenced Files
None
Subscribers
None

D236.1789762474.diff

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/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,7 +426,11 @@
} else
lineInfoButton.visibility = View.GONE
}
+ lineInfoButton.setOnClickListener {
+ AlertsDialogFragment.newInstanceForLine(lineID).show(parentFragmentManager, "Alerts-Line$lineID")
+ }
}
+
// ------------- UI switch stuff ---------
private fun hideMapAndShowStopList(){
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/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/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

Mime Type
text/plain
Expires
Fri, Sep 18, 22:14 (1 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2163280
Default Alt Text
D236.1789762474.diff (29 KB)

Event Timeline