diff --git a/app/src/main/java/it/reyboz/bustorino/adapters/RouteAdapter.kt b/app/src/main/java/it/reyboz/bustorino/adapters/RouteAdapter.kt --- a/app/src/main/java/it/reyboz/bustorino/adapters/RouteAdapter.kt +++ b/app/src/main/java/it/reyboz/bustorino/adapters/RouteAdapter.kt @@ -12,7 +12,7 @@ class RouteAdapter(val routes: List<GtfsRoute>, click: ItemClicker, - private val layoutId: Int = R.layout.line_title_header) : + private val layoutId: Int = R.layout.entry_line_num_descr) : RecyclerView.Adapter<RouteAdapter.ViewHolder>() { val clickreference: WeakReference<ItemClicker> diff --git a/app/src/main/java/it/reyboz/bustorino/backend/Notifications.java b/app/src/main/java/it/reyboz/bustorino/backend/Notifications.java --- a/app/src/main/java/it/reyboz/bustorino/backend/Notifications.java +++ b/app/src/main/java/it/reyboz/bustorino/backend/Notifications.java @@ -63,7 +63,7 @@ .build(); } public static Notification makeMatoDownloadNotification(Context context){ - return makeMatoDownloadNotification(context, "Downloading data from MaTO"); + return makeMatoDownloadNotification(context, context.getString(R.string.downloading_data_mato)); } public static void createDBNotificationChannel(Context context){ 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 @@ -88,19 +88,20 @@ private var favoritesButton: ImageButton? = null private var isLineInFavorite = false + private var appContext: Context? = null private val lineSharedPrefMonitor = SharedPreferences.OnSharedPreferenceChangeListener { pref, keychanged -> if(keychanged!=PreferencesHolder.PREF_FAVORITE_LINES || lineID.isEmpty()) return@OnSharedPreferenceChangeListener val newFavorites = pref.getStringSet(PreferencesHolder.PREF_FAVORITE_LINES, HashSet()) - newFavorites?.let { - isLineInFavorite = it.contains(lineID) + newFavorites?.let {favorites-> + isLineInFavorite = favorites.contains(lineID) //if the button has been intialized, change the icon accordingly favoritesButton?.let { button-> if(isLineInFavorite) { button.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_star_filled, null)) - Toast.makeText(context,R.string.favorites_line_add,Toast.LENGTH_SHORT).show() + appContext?.let { Toast.makeText(it,R.string.favorites_line_add,Toast.LENGTH_SHORT).show()} } else { button.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_star_outline, null)) - Toast.makeText(context,R.string.favorites_line_remove,Toast.LENGTH_SHORT).show() + appContext?.let {Toast.makeText(it,R.string.favorites_line_remove,Toast.LENGTH_SHORT).show()} } @@ -187,6 +188,7 @@ favoritesButton?.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_star_filled, null)) isLineInFavorite = true } + appContext = requireContext().applicationContext preferences.registerOnSharedPreferenceChangeListener(lineSharedPrefMonitor) patternsSpinner = rootView.findViewById(R.id.patternsSpinner) diff --git a/app/src/main/java/it/reyboz/bustorino/map/BusInfoWindow.kt b/app/src/main/java/it/reyboz/bustorino/map/BusInfoWindow.kt --- a/app/src/main/java/it/reyboz/bustorino/map/BusInfoWindow.kt +++ b/app/src/main/java/it/reyboz/bustorino/map/BusInfoWindow.kt @@ -73,6 +73,7 @@ titleView.text = (mView.resources.getString(R.string.line_fill, routeName) ) subdescrView.text = vehicleLabel + //mView.resources.getString(R.string.vehicle_fill, vehicleLabel) if(pattern!=null){ diff --git a/app/src/main/res/layout/activity_intro.xml b/app/src/main/res/layout/activity_intro.xml --- a/app/src/main/res/layout/activity_intro.xml +++ b/app/src/main/res/layout/activity_intro.xml @@ -43,6 +43,7 @@ android:id="@+id/viewPager" app:layout_constraintBottom_toTopOf="@+id/btnPrevious" android:layout_marginBottom="8dp" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"/> <com.google.android.material.tabs.TabLayout android:id="@+id/tab_layout" diff --git a/app/src/main/res/layout/bus_info_window.xml b/app/src/main/res/layout/bus_info_window.xml --- a/app/src/main/res/layout/bus_info_window.xml +++ b/app/src/main/res/layout/bus_info_window.xml @@ -20,7 +20,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:textColor="@color/bus_marker_color" - android:textSize="16sp" + android:textSize="17sp" android:maxWidth="130sp" android:text="BALABALA" android:textAlignment="center" @@ -31,6 +31,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintHorizontal_bias="0.5" + android:fontFamily="@font/nevermind_compact" app:layout_constraintBottom_toTopOf="@+id/businfo_description" android:layout_marginRight="5dp"/> <ImageView android:layout_width="wrap_content" @@ -56,7 +57,7 @@ android:layout_height="wrap_content" android:textSize="15sp" android:maxWidth="120sp" - android:textColor="@color/grey_600" + android:textColor="@color/grey_700" app:layout_constraintTop_toBottomOf="@id/businfo_title" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" diff --git a/app/src/main/res/layout/line_title_header.xml b/app/src/main/res/layout/entry_line_num_descr.xml rename from app/src/main/res/layout/line_title_header.xml rename to app/src/main/res/layout/entry_line_num_descr.xml --- a/app/src/main/res/layout/line_title_header.xml +++ b/app/src/main/res/layout/entry_line_num_descr.xml @@ -15,7 +15,7 @@ android:layout_height="wrap_content" android:id="@+id/innerCardView" android:background="@color/orange_500" - app:cardCornerRadius="54sp" + app:cardCornerRadius="26sp" app:cardElevation="0sp" android:layout_gravity="center_vertical" android:layout_margin="5dp" @@ -28,8 +28,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - android:minHeight="54sp" - android:minWidth="54sp" + android:minHeight="52sp" + android:minWidth="52sp" > <TextView android:id="@+id/lineShortNameTextView" @@ -39,10 +39,10 @@ android:textColor="@color/grey_100" android:textSize="21sp" android:text="231" - android:paddingStart="4sp" - android:paddingLeft="4sp" - android:paddingRight="4sp" - android:paddingEnd="4sp" + android:paddingStart="4dp" + android:paddingLeft="4dp" + android:paddingRight="4dp" + android:paddingEnd="4dp" > </TextView> </RelativeLayout> diff --git a/app/src/main/res/layout/fragment_intro.xml b/app/src/main/res/layout/fragment_intro.xml --- a/app/src/main/res/layout/fragment_intro.xml +++ b/app/src/main/res/layout/fragment_intro.xml @@ -1,45 +1,58 @@ <?xml version="1.0" encoding="utf-8"?> -<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:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".fragments.IntroFragment"> +<RelativeLayout 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:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".fragments.IntroFragment"> + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + > + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="15dp" + > - <ImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/image_tutorial" - app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toTopOf="@+id/tutorialTextView" - app:layout_constraintVertical_chainStyle="packed"/> - <TextView - android:text="Blabla" - android:layout_width="wrap_content" - android:layout_height="wrap_content" android:id="@+id/tutorialTextView" - app:layout_constraintTop_toBottomOf="@+id/image_tutorial" - android:layout_marginTop="30dp" - android:maxWidth="280dp" - android:textSize="18sp" - android:textAlignment="center" - android:textColor="@color/grey_900" - android:fontFamily="@font/pitagon_medium" - app:layout_constraintBottom_toTopOf="@id/closeAllButton" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent"/> - <Button - android:text="@string/close_tutorial" - android:layout_width="wrap_content" - android:visibility="gone" - android:layout_height="wrap_content" android:id="@+id/closeAllButton" - app:layout_constraintTop_toBottomOf="@id/tutorialTextView" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="@id/tutorialTextView" - android:backgroundTint="?colorPrimaryDark" - android:fontFamily="@font/pitagon_semibold" - android:textColor="@color/white" - app:layout_constraintEnd_toEndOf="@id/tutorialTextView" - android:layout_marginTop="18dp"/> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/image_tutorial" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toTopOf="@+id/tutorialTextView" + app:layout_constraintVertical_chainStyle="packed"/> + <TextView + android:text="Blabla" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:id="@+id/tutorialTextView" + app:layout_constraintTop_toBottomOf="@+id/image_tutorial" + android:layout_marginTop="30dp" + android:maxWidth="280dp" + android:textSize="18sp" + android:textAlignment="center" + android:textColor="@color/grey_900" + android:fontFamily="@font/pitagon_medium" + app:layout_constraintBottom_toTopOf="@id/closeAllButton" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"/> + <Button + android:text="@string/close_tutorial" + android:layout_width="wrap_content" + android:visibility="gone" + android:layout_height="wrap_content" android:id="@+id/closeAllButton" + app:layout_constraintTop_toBottomOf="@id/tutorialTextView" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@id/tutorialTextView" + android:backgroundTint="?colorPrimaryDark" + android:textColor="@color/white" + app:layout_constraintEnd_toEndOf="@id/tutorialTextView" + android:layout_marginTop="18dp" + android:layout_marginBottom="5dp" + /> -</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.core.widget.NestedScrollView> +</RelativeLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_lines_detail.xml b/app/src/main/res/layout/fragment_lines_detail.xml --- a/app/src/main/res/layout/fragment_lines_detail.xml +++ b/app/src/main/res/layout/fragment_lines_detail.xml @@ -53,9 +53,9 @@ android:text="DCCII" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/lineDescripTextView" - app:layout_constraintTop_toBottomOf="@id/titleTextView" - app:layout_constraintLeft_toLeftOf="@id/titleTextView" - app:layout_constraintRight_toRightOf="@id/titleTextView" + app:layout_constraintTop_toBottomOf="@id/switchImageButton" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" android:textColor="@color/grey_700" android:textSize="16sp" android:maxWidth="300sp" diff --git a/app/src/main/res/layout/round_line_header.xml b/app/src/main/res/layout/round_line_header.xml --- a/app/src/main/res/layout/round_line_header.xml +++ b/app/src/main/res/layout/round_line_header.xml @@ -5,7 +5,7 @@ android:layout_height="wrap_content" android:background="@color/orange_500" - app:cardCornerRadius="54sp" + app:cardCornerRadius="26sp" app:cardElevation="0sp" android:layout_gravity="center_vertical" android:layout_margin="5dp" @@ -16,8 +16,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - android:minHeight="54sp" - android:minWidth="54sp" + android:minHeight="52sp" + android:minWidth="52sp" > <TextView android:id="@+id/routeBallID" @@ -27,11 +27,11 @@ android:textColor="@color/grey_100" android:textSize="21sp" android:text="231" - android:paddingStart="4sp" - android:paddingLeft="4sp" - android:paddingRight="4sp" - android:paddingEnd="4sp" + android:paddingStart="4dp" + android:paddingLeft="4dp" + android:paddingRight="4dp" + android:paddingEnd="4dp" > </TextView> </RelativeLayout> </androidx.cardview.widget.CardView> \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -196,6 +196,7 @@ <!-- Preferences --> <string name="requesting_db_update">Richiesto aggiornamento del database</string> + <string name="downloading_data_mato">Download dati dal server MaTO</string> 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 @@ -221,7 +221,7 @@ <string name="map">Map</string> <string name="stop_search_view_title">Search by stop</string> <string name="requesting_db_update">Launching database update</string> - + <string name="downloading_data_mato">Downloading data from MaTO server</string> <!-- preferences --> <string name="pref_directions_capitalize">Capitalize directions</string> @@ -241,6 +241,7 @@ <string name="pref_lines_click_msg">Show arrivals touching on stop</string> <string name="pref_experimental_msg">Enable experiments</string> + <!-- lines --> <string name="long_press_stop_4_options">Long press the stop for options</string>