diff --git a/app/src/main/java/com/denizk0461/studip/activity/ImageActivity.kt b/app/src/main/java/com/denizk0461/studip/activity/ImageActivity.kt index 67c8178..4e99c54 100644 --- a/app/src/main/java/com/denizk0461/studip/activity/ImageActivity.kt +++ b/app/src/main/java/com/denizk0461/studip/activity/ImageActivity.kt @@ -26,6 +26,7 @@ class ImageActivity : AppCompatActivity() { binding.imageView.setImageResource(when (intent.extras?.getString("img") ?: "") { "bojack" -> { R.drawable.man } "garbage" -> { R.drawable.garbage } + "bcells" -> { R.drawable.bcells } else -> { R.drawable.engineering } }) } diff --git a/app/src/main/java/com/denizk0461/studip/adapter/StudIPEventItemAdapter.kt b/app/src/main/java/com/denizk0461/studip/adapter/StudIPEventItemAdapter.kt index 6677d8f..ec05aaf 100644 --- a/app/src/main/java/com/denizk0461/studip/adapter/StudIPEventItemAdapter.kt +++ b/app/src/main/java/com/denizk0461/studip/adapter/StudIPEventItemAdapter.kt @@ -3,6 +3,7 @@ package com.denizk0461.studip.adapter import android.content.res.ColorStateList import android.view.LayoutInflater import android.view.ViewGroup +import androidx.appcompat.content.res.AppCompatResources.getDrawable import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView import com.denizk0461.studip.data.AppDiffUtilCallback @@ -88,33 +89,49 @@ class StudIPEventItemAdapter( holder.binding.cardBackground.apply { // Set the card's background colour to a desaturated shade of the primary colour - backgroundTintList = ColorStateList.valueOf(theme.getThemedColor(R.attr.colorSecondaryContainer)) + backgroundTintList = + ColorStateList.valueOf(theme.getThemedColor(R.attr.colorSecondaryContainer)) // Hide card stroke strokeColor = context.getColor(android.R.color.transparent) } // Set the divider colour to the text colour - holder.binding.divider.dividerColor = theme.getThemedColor(com.denizk0461.studip.R.attr.colorText) + holder.binding.divider.dividerColor = + theme.getThemedColor(com.denizk0461.studip.R.attr.colorText) + + // Set ripple colour + holder.binding.linearLayout.background = getDrawable( + holder.binding.root.context, + com.denizk0461.studip.R.drawable.selectable_item_background_highlighted, + ) + // Otherwise, apply colours to ensure that the item will not be highlighted } else { holder.binding.cardBackground.apply { // Set the card's background colour to its default value - backgroundTintList = ColorStateList.valueOf(theme.getThemedColor(R.attr.colorSurface)) + backgroundTintList = + ColorStateList.valueOf(theme.getThemedColor(R.attr.colorSurface)) // Set the card's stroke to its default colour strokeColor = theme.getThemedColor(R.attr.colorOutline) } // Set the divider colour to its default value holder.binding.divider.dividerColor = theme.getThemedColor(R.attr.colorOutlineVariant) + + // Set ripple colour + holder.binding.linearLayout.background = getDrawable( + holder.binding.root.context, + com.denizk0461.studip.R.drawable.selectable_item_background, + ) } // Set up single click listener - holder.binding.cardBackground.setOnClickListener { + holder.binding.linearLayout.setOnClickListener { onClickListener.onClick(currentItem) } // Set up long press listener - holder.binding.cardBackground.setOnLongClickListener { + holder.binding.linearLayout.setOnLongClickListener { onClickListener.onLongClick(currentItem) } } @@ -151,7 +168,9 @@ class StudIPEventItemAdapter( */ private fun StudIPEvent.isCurrentCourse(calendar: Calendar): Boolean = (calendar.get(Calendar.DAY_OF_WEEK) == this.day.toCalendarDay()) && - ((calendar.get(Calendar.MINUTE) + calendar.get(Calendar.HOUR_OF_DAY) * 60) < this.timeslotEnd.parseToMinutes()) + ((calendar.get(Calendar.MINUTE) + calendar.get( + Calendar.HOUR_OF_DAY + ) * 60) < this.timeslotEnd.parseToMinutes()) /** * Converts a numeric value as defined in StudIPEvent.kt to a calendar day. Used to convert from 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 7036732..3c4f173 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/AllergenConfigSheet.kt @@ -3,6 +3,7 @@ package com.denizk0461.studip.sheet import android.os.Bundle import android.view.View import com.denizk0461.studip.R +import com.denizk0461.studip.data.showToast import com.denizk0461.studip.data.viewBinding import com.denizk0461.studip.databinding.SheetAllergenConfigBinding import com.denizk0461.studip.model.AllergenPreferences @@ -100,6 +101,9 @@ class AllergenConfigSheet( ) } + // Tell the user that saving was successful + showToast(context, getString(R.string.allergens_config_confirmation)) + // Close the sheet dismiss() } 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 2984e16..0cd0803 100644 --- a/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt +++ b/app/src/main/java/com/denizk0461/studip/sheet/DevCodeSheet.kt @@ -73,6 +73,13 @@ class DevCodeSheet( intent.putExtras(bundle) }) } + "QkNFTExT".d64 -> { + startActivity(Intent(context, ImageActivity::class.java).also { intent -> + val bundle = Bundle() + bundle.putString("img", "bcells") + intent.putExtras(bundle) + }) + } "NEVENT" -> { // nuke events nukeEvents() showToast(context, "Nuked all events") @@ -97,7 +104,6 @@ class DevCodeSheet( nukeEverything() showToast(context, "Nuked everything") } - "HACK()" -> showToast(context, "Hack attempt unsuccessful") else -> showToast(context, "Code is invalid") } dismiss() diff --git a/app/src/main/res/drawable/bcells.png b/app/src/main/res/drawable/bcells.png new file mode 100644 index 0000000..ffb6a14 Binary files /dev/null and b/app/src/main/res/drawable/bcells.png differ diff --git a/app/src/main/res/drawable/selectable_item_background.xml b/app/src/main/res/drawable/selectable_item_background.xml new file mode 100644 index 0000000..f1644cb --- /dev/null +++ b/app/src/main/res/drawable/selectable_item_background.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selectable_item_background_highlighted.xml b/app/src/main/res/drawable/selectable_item_background_highlighted.xml new file mode 100644 index 0000000..6f45015 --- /dev/null +++ b/app/src/main/res/drawable/selectable_item_background_highlighted.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selectable_item_ripple.xml b/app/src/main/res/drawable/selectable_item_ripple.xml new file mode 100644 index 0000000..f96dabb --- /dev/null +++ b/app/src/main/res/drawable/selectable_item_ripple.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selectable_item_ripple_highlighted.xml b/app/src/main/res/drawable/selectable_item_ripple_highlighted.xml new file mode 100644 index 0000000..0a04277 --- /dev/null +++ b/app/src/main/res/drawable/selectable_item_ripple_highlighted.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 4959953..e4ae48c 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -70,7 +70,7 @@ android:id="@+id/button_refresh_schedule" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:clickable="true" android:focusable="true" android:orientation="vertical" @@ -174,7 +174,7 @@ android:id="@+id/button_allergens_config" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:clickable="true" android:focusable="true" android:orientation="vertical" @@ -407,7 +407,7 @@ android:id="@+id/button_data_handling" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:clickable="true" android:focusable="true" android:orientation="vertical" @@ -434,7 +434,7 @@ android:id="@+id/button_licences" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:clickable="true" android:focusable="true" android:orientation="vertical" @@ -462,7 +462,7 @@ android:id="@+id/button_app_version" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:clickable="true" android:focusable="true" android:orientation="vertical" diff --git a/app/src/main/res/layout/item_canteen_line.xml b/app/src/main/res/layout/item_canteen_line.xml index f90fc54..9611954 100644 --- a/app/src/main/res/layout/item_canteen_line.xml +++ b/app/src/main/res/layout/item_canteen_line.xml @@ -6,7 +6,7 @@ android:orientation="horizontal" android:clickable="true" android:focusable="true" - android:background="?android:attr/selectableItemBackground" + android:background="@drawable/selectable_item_background" android:paddingHorizontal="16dp" android:paddingVertical="2dp"> diff --git a/app/src/main/res/layout/item_event.xml b/app/src/main/res/layout/item_event.xml index 6e3a42e..ea87337 100644 --- a/app/src/main/res/layout/item_event.xml +++ b/app/src/main/res/layout/item_event.xml @@ -14,9 +14,12 @@ style="@style/Widget.Material3.CardView.Outlined"> + android:layout_marginBottom="2dp" + android:paddingHorizontal="24dp"/> + android:layout_marginBottom="8dp" + android:paddingHorizontal="24dp"/> - - - - - - + android:scrollbars="vertical"> - - + - + - + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/sheet_schedule_update.xml b/app/src/main/res/layout/sheet_schedule_update.xml index 873ffbc..d835eb5 100644 --- a/app/src/main/res/layout/sheet_schedule_update.xml +++ b/app/src/main/res/layout/sheet_schedule_update.xml @@ -5,8 +5,6 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" - android:paddingBottom="16dp" - android:paddingHorizontal="24dp" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> + android:layout_gravity="start|center_vertical" + android:paddingHorizontal="24dp"/> + app:iconTint="?attr/colorOnSurfaceVariant" + android:paddingHorizontal="24dp"/> - + android:scrollbars="vertical"> - - - - - - - - + android:orientation="vertical" + android:paddingBottom="16dp" + android:paddingHorizontal="24dp"> - + android:layout_marginBottom="8dp" + android:hint="@string/sheet_schedule_update_title_hint" + app:boxStrokeColor="@color/selector_text_input" + app:hintTextColor="@color/selector_text_input"> - + - - + - + android:orientation="horizontal" + android:layout_marginBottom="8dp"> - + + - + - + - + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 6165fec..cd54551 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -130,13 +130,14 @@ Aktualisiere Deinen Stud.IP-Stundenplan Dies wird alle Anpassungen löschen! - Markiere meinen nächsten Kurs - Funktioniert nur wenn Kurse sich nicht überschneiden! + Markiere den nächsten Kurs + Funktioniert nur, wenn Kurse sich nicht überschneiden! Verstecke Angebote mit bestimmten Allergenen Angebote mit ausgeschlossenen Allergenen werden Dir nicht angezeigt - Stelle ein, welche Allergene Du vermeiden möchtest + 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. + Deine Allergene wurden gespeichert. Markiere Angebote mit Allergenen mit einem Stern* Wird auch für Zusatzstoffe genutzt diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b63801..5b3be1c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -140,14 +140,15 @@ Hide offers containing certain allergens Offers with excluded allergens won\'t be shown to you - Set which allergens you\'d like to avoid + 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. + Your allergen settings have been saved. Mark offers with allergens with a star* Also applies to additives Colour dietary preferences - This colours the icons similar to the website + This colours the icons similar to how they look the website Show canteen plan on app launch Otherwise your schedule will be shown at launch