From 9e5277a5f6bcd706b592fb94d79414955e824491 Mon Sep 17 00:00:00 2001 From: denizk0461 Date: Wed, 3 May 2023 21:49:18 +0200 Subject: [PATCH] All sheets now have a button to dismiss the sheet --- .../studip/fragment/SettingsFragment.kt | 28 ++++++++++++- .../studip/sheet/AllergenConfigSheet.kt | 6 +++ .../denizk0461/studip/sheet/AllergenSheet.kt | 6 +++ .../denizk0461/studip/sheet/DevCodeSheet.kt | 13 +++---- .../studip/sheet/ScheduleUpdateSheet.kt | 11 ++++-- .../com/denizk0461/studip/sheet/TextSheet.kt | 6 +++ app/src/main/res/layout/fragment_canteen.xml | 3 +- app/src/main/res/layout/fragment_event.xml | 5 ++- app/src/main/res/layout/sheet_allergen.xml | 35 ++++++++++++++--- .../main/res/layout/sheet_allergen_config.xml | 39 +++++++++++++++---- app/src/main/res/layout/sheet_dev_code.xml | 36 +++++++++++++---- .../main/res/layout/sheet_schedule_update.xml | 27 ++++++++----- app/src/main/res/layout/sheet_text.xml | 37 ++++++++++++++---- app/src/main/res/values-de/strings.xml | 8 ++-- app/src/main/res/values/strings.xml | 11 +++--- 15 files changed, 210 insertions(+), 61 deletions(-) diff --git a/app/src/main/java/com/denizk0461/studip/fragment/SettingsFragment.kt b/app/src/main/java/com/denizk0461/studip/fragment/SettingsFragment.kt index 88b1d83..b6da944 100644 --- a/app/src/main/java/com/denizk0461/studip/fragment/SettingsFragment.kt +++ b/app/src/main/java/com/denizk0461/studip/fragment/SettingsFragment.kt @@ -131,6 +131,12 @@ class SettingsFragment : AppFragment() { true } + val cheesyWisdoms: MutableList = resources + .getStringArray(R.array.cheesy_wisdoms) + .toList() + .shuffled() + .toMutableList() + // Set click listener for the app version button binding.buttonAppVersion.setOnClickListener { when (appVersionClick) { @@ -152,10 +158,30 @@ class SettingsFragment : AppFragment() { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(mysteryLink))) } 238 -> { // after 222 has been reached, this loops every 16 clicks - showToast(context, resources.getStringArray(R.array.cheesy).random()) + // Show the next cheesy wisdom + showToast(context, cheesyWisdoms[0]) + + // Remove the cheesy wisdom from the list + cheesyWisdoms.removeAt(0) + + // Get new cheesy wisdoms if cheesy wisdoms have run out + if (cheesyWisdoms.isEmpty()) { + cheesyWisdoms.addAll(resources + .getStringArray(R.array.cheesy_wisdoms) + .toList() + .shuffled() + ) + } + + /* + * Reset to 222 to make the user click 16 times again before the next cheesy + * wisdom is shown. + */ appVersionClick = 222 } } + + // Increment click counter appVersionClick += 1 } diff --git a/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt b/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt index 67a9acc..52a6cda 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt @@ -64,6 +64,12 @@ class AllergenConfigSheet : AppSheet(R.layout.sheet_allergen_config) { binding.buttonSave.setOnClickListener { saveAllergenPrefs() } + + // Set up close button + binding.buttonCancel.setOnClickListener { + // Do nothing and dismiss the sheet + dismiss() + } } /** diff --git a/app/src/main/java/com/denizk0461/studip/sheet/AllergenSheet.kt b/app/src/main/java/com/denizk0461/studip/sheet/AllergenSheet.kt index 96d042a..2b178e9 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/AllergenSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/AllergenSheet.kt @@ -95,6 +95,12 @@ class AllergenSheet : AppSheet(R.layout.sheet_allergen) { textPrice.text = offer.price } } + + // Set up close button + binding.buttonCancel.setOnClickListener { + // Do nothing and dismiss the sheet + dismiss() + } } catch (e: ParcelNotFoundException) { // Tell the user that something went wrong when retrieving Parcelable showToast(context, getString(R.string.canteen_page_allergen_sheet_error)) diff --git a/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt b/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt index 1c6eead..ce13ef9 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt @@ -99,6 +99,12 @@ class DevCodeSheet : AppSheet(R.layout.sheet_dev_code) { } dismiss() } + + // Set up close button + binding.buttonCancel.setOnClickListener { + // Do nothing and dismiss the sheet + dismiss() + } } /** @@ -114,13 +120,6 @@ class DevCodeSheet : AppSheet(R.layout.sheet_dev_code) { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(link))) } - /** - * Encodes a string to Base64. - * - * @return the encoded string - */ - private val String.e64: String get() = Base64.encodeToString(this.toByteArray(), Base64.DEFAULT) - /** * Decodes Base64 to a regular string. diff --git a/app/src/main/java/com/denizk0461/studip/sheet/ScheduleUpdateSheet.kt b/app/src/main/java/com/denizk0461/studip/sheet/ScheduleUpdateSheet.kt index 1501f3c..39fa3df 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/ScheduleUpdateSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/ScheduleUpdateSheet.kt @@ -203,8 +203,11 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker else -> Pair(0, R.string.monday) // assume Monday } + // Store the new day selectedDay = newDay + // Prepare layout animation + TransitionManager.beginDelayedTransition(binding.sheet.parent as ViewGroup) // Set newly selected day to the button binding.buttonDay.text = getString(newDayId) @@ -277,7 +280,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker }.show((context as FragmentActivity).supportFragmentManager, "timePicker") } - // Prepare cancel button + // Set up close button binding.buttonCancel.setOnClickListener { // Do nothing and dismiss the sheet dismiss() @@ -334,7 +337,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker // Check if the title field is blank if (binding.editTextTitle.text.toString().isBlank()) { // Set an error on the title field - binding.editTextTitle.error = + binding.textLayoutTitle.error = getString(R.string.sheet_schedule_update_text_field_empty_error) // Set that the action must not be executed @@ -344,7 +347,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker // Check if the lecturer field is blank if (binding.editTextLecturers.text.toString().isBlank()) { // Set an error on the lecturer field - binding.editTextLecturers.error = + binding.textLayoutLecturers.error = getString(R.string.sheet_schedule_update_text_field_empty_error) // Set that the action must not be executed @@ -354,7 +357,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker // Check if the room field is blank if (binding.editTextRoom.text.toString().isBlank()) { // Set an error on the room field - binding.editTextRoom.error = + binding.textLayoutRoom.error = getString(R.string.sheet_schedule_update_text_field_empty_error) // Set that the action must not be executed diff --git a/app/src/main/java/com/denizk0461/studip/sheet/TextSheet.kt b/app/src/main/java/com/denizk0461/studip/sheet/TextSheet.kt index 823d8de..38f0d70 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/TextSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/TextSheet.kt @@ -28,5 +28,11 @@ class TextSheet : AppSheet(R.layout.sheet_text) { textHeader.text = header textContent.text = content } + + // Set up close button + binding.buttonCancel.setOnClickListener { + // Do nothing and dismiss the sheet + dismiss() + } } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_canteen.xml b/app/src/main/res/layout/fragment_canteen.xml index a0cece9..8db101b 100644 --- a/app/src/main/res/layout/fragment_canteen.xml +++ b/app/src/main/res/layout/fragment_canteen.xml @@ -230,7 +230,8 @@ android:contentDescription="@string/canteen_fab_refresh_content_desc" android:layout_gravity="bottom|end" android:layout_marginEnd="@dimen/fab_margin" - android:layout_marginBottom="@dimen/fab_margin"/> + android:layout_marginBottom="@dimen/fab_margin" + app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"/> diff --git a/app/src/main/res/layout/fragment_event.xml b/app/src/main/res/layout/fragment_event.xml index 199d5f4..76a0378 100644 --- a/app/src/main/res/layout/fragment_event.xml +++ b/app/src/main/res/layout/fragment_event.xml @@ -14,7 +14,7 @@ + android:layout_marginBottom="@dimen/fab_margin" + app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"/> \ No newline at end of file diff --git a/app/src/main/res/layout/sheet_allergen.xml b/app/src/main/res/layout/sheet_allergen.xml index c70b273..e5f0a4b 100644 --- a/app/src/main/res/layout/sheet_allergen.xml +++ b/app/src/main/res/layout/sheet_allergen.xml @@ -12,14 +12,37 @@ android:layout_height="wrap_content" android:layout_gravity="center"/> - + android:paddingHorizontal="24dp"> + + + + + + - + android:layout_marginBottom="8dp" + android:paddingHorizontal="24dp"> + + + + + + - + android:paddingHorizontal="24dp"> + + + + + + - + android:layout_marginBottom="8dp" + android:paddingHorizontal="24dp"> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/button_cancel"/> + android:layout_marginStart="16dp"/> - + + android:layout_gravity="end" + app:strokeColor="?attr/colorOutlineVariant"/> - + android:layout_marginBottom="8dp" + android:paddingHorizontal="24dp"> + + + + + + Sicher? Abbrechen Bestätigen - Veranstaltung bearbeiten - Veranstaltung hinzufügen + Bestehende Veranstaltung bearbeiten + Neue Veranstaltung hinzufügen Veranstaltungstitel Dozierende(r) Raum @@ -156,7 +156,7 @@ Verstecke Angebote mit bestimmten Allergenen Angebote mit ausgeschlossenen Allergenen werden Dir nicht angezeigt Wähle, welche Allergene Du vermeiden möchtest - Achtung: bitte verlasse Dich nicht vollständig auf diese Funktion. Stelle immer in der Mensa, die Du besuchst, sicher, dass die Stoffe, auf die Du allergisch reagierst, nicht in deren Angeboten vorhanden sind. + Achtung: bitte verlasse Dich nicht vollständig auf diese Funktion. Stelle immer in der Mensa, die Du besuchst, sicher, dass die Stoffe, auf die Du allergisch reagierst, nicht in deren Angeboten vorhanden sind. Die Allergen-Hinweise einiger Mensen sind online leider unvollständig. Deine Allergene wurden gespeichert. Markiere Angebote mit Allergenen mit einem Stern* @@ -174,7 +174,7 @@ Was passiert mit meinen Daten? Stiehlst du meinen Stud.IP-Login? TL;DR: nein, aber Google könnte mir Bescheid geben, falls die App mal abstürzt. - Die App funktioniert standalone, was bedeutet, dass sie sich niemals mit einem Server verbindet, der mir gehört. Sie ist ein Web-Scraper, also ein Programm, welches eine Internetseite öffnet und dann all die Informationen dieser Webseite herunterlädt und analysiert. In diesem Fall sind es die Webseiten der Mensen und Cafeterien des Studierendenwerks Bremen (stw-bremen.de) sowie die Stud.IP-Seite (elearning.uni-bremen.de).\n\nDies funktioniert relativ einfach für die Essenspläne, da diese Pläne öffentlich zugänglich sind. Um jedoch Deinen persönlichen Stud.IP-Stundenplan herunterzuladen, braucht die App Zugriff auf diese Webseite während Dein Account eingeloggt ist. Dies erfolgt, indem die App Dich mit deinem Account einloggen lässt - dies geschieht, wenn Du den Knopf zum Aktualisieren des Plans drückst und die App Dir die Login-Seite zeigt - und Du dann den Knopf klickst, um den Inhalt, den HTML-Quellcode, herunterzuladen. Der HTML-Quellcode beinhält Informationen darüber, was auf einer Webseite angezeigt wird und wie es aussehen soll, aber er kann niemals persönliche Details beinhalten, wie zum Beispiel Passwörter oder andere Daten, die auf Deinem Gerät vorhanden sind.\n\nDer Quellcode wird dann lokal, also auf Deinem Gerät, zu den Karten verarbeitet, die Du dann in der App sehen kannst, ohne, dass jegliche Daten irgendwohin geschickt werden müssten.\n\nEinige Daten könnten jedoch dennoch nach außen geschickt werden. Diese App nutzt \"Crashlytics\" von Google. Dies ist ein Tool, welches Absturzreporte an Google-Server schickt, wenn in der App etwas schief läuft. Diese werden genutzt, um Probleme in der App zu lösen.\n\nDies ist jedoch gemäß europäischer Datenschutz-Grundverordnung Opt-In, was bedeutet, dass Du zustimmen musst, bevor Daten nach außen geschickt werden. Du wurdest danach gefragt, als Du die App zum ersten Mal gestartet hast, und du kannst jederzeit deine Meinung ändern, indem Du den Schalter hierfür in den Einstellungen umstellst. Solltest Du dich entscheiden, keine Daten verschicken zu lassen, wird auch nichts mit Google (und mir) geteilt.\n\nSolltest du dich versichern wollen, dass wirklich keine Daten an irgendwelche Server verschickt wird (abgesehen von den Absturzreports an Google), kannst Du jederzeit das Projekt erkunden, da es Open-Source und auf meinen GitHub-Profil öffentlich zugänglich ist:\nhttps://github.com/denizk0461/studip-timetable/\n\nSchreib mir ansonsten gerne eine E-Mail:\ndenizk0461@gmail.com + Die App funktioniert standalone, was bedeutet, dass sie sich niemals mit einem Server verbindet, der mir gehört. Sie ist ein Web-Scraper, also ein Programm, welches eine Internetseite öffnet und dann all die Informationen dieser Webseite herunterlädt und analysiert. In diesem Fall sind es die Webseiten der Mensen und Cafeterien des Studierendenwerks Bremen (stw-bremen.de) sowie die Stud.IP-Seite (elearning.uni-bremen.de).\n\nDies funktioniert relativ einfach für die Essenspläne, da diese Pläne öffentlich zugänglich sind. Um jedoch Deinen persönlichen Stud.IP-Stundenplan herunterzuladen, braucht die App Zugriff auf diese Webseite während Dein Account eingeloggt ist. Dies erfolgt, indem die App Dich mit deinem Account einloggen lässt - dies geschieht, wenn Du den Knopf zum Aktualisieren des Plans drückst und die App Dir die Login-Seite zeigt - und Du dann den Knopf klickst, um den Inhalt, den HTML-Quellcode, herunterzuladen. Der HTML-Quellcode beinhält Informationen darüber, was auf einer Webseite angezeigt wird und wie es aussehen soll, aber er kann niemals persönliche Details beinhalten, wie zum Beispiel Passwörter oder andere Daten, die auf Deinem Gerät vorhanden sind.\n\nDer Quellcode wird dann lokal, also auf Deinem Gerät, zu den Daten verarbeitet, die Du dann in der App sehen kannst, ohne, dass jegliche Daten irgendwohin geschickt werden müssten.\n\nEinige Daten – welche nichts mit Deinen Stud.IP-Daten zu tun haben – könnten jedoch dennoch nach außen geschickt werden. Diese App nutzt \"Crashlytics\" von Google. Dies ist ein Tool, welches Absturzreporte an Google-Server schickt, wenn in der App etwas schief läuft. Diese werden genutzt, um Probleme in der App zu lösen.\n\nDies ist jedoch gemäß europäischer Datenschutz-Grundverordnung Opt-In, was bedeutet, dass Du zustimmen musst, bevor Daten nach außen geschickt werden. Du wurdest danach gefragt, als Du die App zum ersten Mal gestartet hast, und du kannst jederzeit deine Meinung ändern, indem Du den Schalter hierfür in den Einstellungen umstellst. Solltest Du dich entscheiden, keine Daten verschicken zu lassen, wird auch nichts mit Google (und mir) geteilt.\n\nSolltest du dich versichern wollen, dass wirklich keine Daten an irgendwelche Server verschickt wird (abgesehen von den Absturzreports an Google), kannst Du jederzeit das Projekt erkunden, da es Open-Source und auf meinen GitHub-Profil öffentlich zugänglich ist:\nhttps://github.com/denizk0461/studip-timetable/\n\nSchreib mir ansonsten gerne eine E-Mail:\ndenizk0461@gmail.com Siehe Lizenzen Ressourcen, die diese App möglich gemacht haben diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bdea1e4..4b6a051 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -43,8 +43,8 @@ Sure? Cancel Confirm - Edit event - Add event + Edit existing event + Add new event Event title Lecturer(s) Room @@ -160,7 +160,7 @@ Hide offers containing certain allergens Offers with excluded allergens won\'t be shown to you Select which allergens you\'d like to avoid - Note: please don\'t entirely rely on this. Always check the notices displayed at the canteen you\'re visiting to confirm substances you may be allergic against are not present in their offerings. + Note: please don\'t entirely rely on this. Always check the notices displayed at the canteen you\'re visiting to confirm substances you may be allergic against are not present in their offerings. Some canteens unfortunately don\'t provide full allergen information online. Your allergen settings have been saved. Mark offers with allergens with a star* @@ -178,7 +178,7 @@ What happens with my data? Will you steal my Stud.IP login? TL;DR: no, but Google may let me know if the app crashes on your device. - This app works standalone, which is to say, it doesn\'t ever connect to a server I own. Instead, it is a web scraper, which means that it opens a website and then downloads and analyses all the data from that website by itself. In this case, those websites are the canteen websites of the Studierendenwerk Bremen (stw-bremen.de) and the Stud.IP page (elearning.uni-bremen.de).\n\nThis works fairly easily for the canteen offers, since the plans are public and anyone can access them. However, to access your personal Stud.IP schedule, the app needs access to that website, with your account logged in. This is done by letting you log into the website by yourself (which happens when you click the button to refresh the schedule and the app opens the login page) and then clicking a button to download the content, the HTML source code, of the website. The HTML source code contains information about which elements are shown on the website and how they look, but it can never contain your personal details such as passwords, or any other sensitive data you may store on your device.\n\nThe HTML source is then processed locally on your device, which means that your device will handle converting the HTML source to the cards you will be shown in the app by itself, without needing to send any data anywhere.\n\nHowever, some data may still be sent outside of your device. This app uses \"Crashlytics\" by Google, which is a tool that sends crash reports to Google servers if something breaks. These are used to fix problems that occur in the app.\n\nThis, in compliance with the European General Data Protection Regulation, is of course opt-in, which means that you need to accept this before any data is sent outside of your device. You have been prompted for this when you first started the app, and you can always change your mind in the app settings by clicking the corresponding switch. Should you choose to not share crash data with Google (and me), no data will be sent outside of your device.\n\nShould you want to reassure yourself that no data is sent to any servers (outside of the crash reports from Google), feel free to explore the project, since it is open-source and documented on my GitHub profile:\nhttps://github.com/denizk0461/studip-timetable/\n\nYou\'re also welcome to send me an email:\ndenizk0461@gmail.com + This app works standalone, which is to say, it doesn\'t ever connect to a server I own. Instead, it is a web scraper, which means that it opens a website and then downloads and analyses all the data from that website by itself. In this case, those websites are the canteen websites of the Studierendenwerk Bremen (stw-bremen.de) and the Stud.IP page (elearning.uni-bremen.de).\n\nThis works fairly easily for the canteen offers, since the plans are public and anyone can access them. However, to access your personal Stud.IP schedule, the app needs access to that website, with your account logged in. This is done by letting you log into the website by yourself (which happens when you click the button to refresh the schedule and the app opens the login page) and then clicking a button to download the content, the HTML source code, of the website. The HTML source code contains information about which elements are shown on the website and how they look, but it can never contain your personal details such as passwords, or any other sensitive data you may store on your device.\n\nThe HTML source is then processed locally on your device, which means that your device will handle converting the HTML source to the data you will be shown in the app by itself, without needing to send any data anywhere.\n\nHowever, some data – which has nothing to do with your Stud.IP data – may still be sent outside of your device. This app uses \"Crashlytics\" by Google, which is a tool that sends crash reports to Google servers if something breaks. These are used to fix problems that occur in the app.\n\nThis, in compliance with the European General Data Protection Regulation, is of course opt-in, which means that you need to accept this before any data is sent outside of your device. You have been prompted for this when you first started the app, and you can always change your mind in the app settings by clicking the corresponding switch. Should you choose to not share crash data with Google (and me), no data will be sent outside of your device.\n\nShould you want to reassure yourself that no data is sent to any servers (outside of the crash reports from Google), feel free to explore the project, since it is open-source and documented on my GitHub profile:\nhttps://github.com/denizk0461/studip-timetable/\n\nYou\'re also welcome to send me an email:\ndenizk0461@gmail.com View licences Resources that made this app possible @@ -197,10 +197,11 @@ with ♡️ from Bremen-Osterholz\nmade by denizk0461 \\__* - + it\'s only real when it hurts can\'t go back in time, every second is a new one if we only had one more day, what is the last thing you\'d say? love with your heart, use your head for everything else + trans rights are human rights 🏳️‍⚧️ \ No newline at end of file