CanteenFragment.kt: replaced buttons for opening hours and canteen switch embedded in the app bar with floating action buttons; implemented a possible fix for the app crashing after refreshing the canteen plan. This may have been caused by accessing the view/context of the fragment to let the user know that the refresh succeeded or encountered an error. Reference will be null by the time the fragment is inactive, causing a NullPointerException

This commit is contained in:
denizk0461
2023-05-04 15:09:10 +02:00
parent 5ca5788899
commit e17a81e604
14 changed files with 165 additions and 142 deletions
+3
View File
@@ -59,6 +59,8 @@
<string name="canteen_no_offer_header">No offers</string>
<string name="canteen_no_offer_desc">There are no offers available for this day</string>
<string name="canteen_fab_opening_hours_content_desc">Show opening hours</string>
<string name="canteen_fab_switch_canteen_content_desc">Switch canteen</string>
<string name="canteen_fab_refresh_content_desc">Refresh offers</string>
<string name="sheet_licences_header">Licences</string>
@@ -66,6 +68,7 @@
<string name="title_schedule">Your Schedule</string>
<string name="title_food">Canteen Offers</string>
<string name="title_canteen_template">%s Offers</string>
<string name="title_settings">App Settings</string>
<string name="canteen_opening_hours">%s Opening Hours</string>
-15
View File
@@ -80,8 +80,6 @@
<item name="colorOnPrimaryGame">@color/game_light_onPrimary</item>
<item name="colorContainerGame">@color/game_light_container</item>
<item name="colorOnContainerGame">@color/game_light_onContainer</item>
<item name="materialTimePickerTheme">@style/TimeDialogTheme</item> <!-- TimePicker dialog -->
</style>
<style name="Theme.StudIPTimetable" parent="Base.Theme.StudIPTimetable" />
@@ -94,17 +92,4 @@
<item name="checkedIconEnabled">false</item>
<item name="checkedIcon">@null</item>
</style>
<style name="TimeDialogTheme" parent="ThemeOverlay.MaterialComponents.TimePicker">
<item name="android:colorAccent">@color/md_theme_light_primary</item>
<item name="android:colorPrimary">@color/md_theme_light_primary</item>
<item name="android:colorPrimaryDark">@color/md_theme_light_secondary</item>
<item name="buttonBarPositiveButtonStyle">@style/TextButton</item>
<item name="buttonBarNegativeButtonStyle">@style/TextButton</item>
</style>
<style name="TextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/md_theme_light_primary</item>
<item name="backgroundTint">@color/md_theme_light_primary</item>
</style>
</resources>