Fixed colours for icons to tell the user that canteen offers are hidden or that they have no events; added tooltips to buttons in canteen fragment; edited README.md to use new iamge paths

This commit is contained in:
denizk0461
2023-05-20 19:12:03 +02:00
parent 1c31d422fa
commit cbea5f124d
9 changed files with 37 additions and 25 deletions
@@ -116,7 +116,7 @@ class CanteenOfferItemAdapter(
val img = ItemIconBinding.inflate(LayoutInflater.from(context))
// Retrieve data for the dietary preference
val (_, drawableId, colourId) = DietaryPreferences.getData(
val (drawableTextDesc, drawableId, colourId) = DietaryPreferences.getData(
DietaryPreferences.ERROR.ordinal,
)
@@ -128,6 +128,9 @@ class CanteenOfferItemAdapter(
)
)
// Set content description for the icon
img.imageView.contentDescription = context.getString(drawableTextDesc)
// Set tint of the icon; themed to the preference, if the user has the option enabled
img.imageView.imageTintList = ColorStateList.valueOf(
context.theme.getThemedColor(
@@ -181,7 +184,7 @@ class CanteenOfferItemAdapter(
val img = ItemIconBinding.inflate(LayoutInflater.from(context))
// Retrieve data for the dietary preference
val (_, drawableId, colourId) = DietaryPreferences.getData(index)
val (drawableTextDesc, drawableId, colourId) = DietaryPreferences.getData(index)
// Set the appropriate icon
img.imageView.setImageDrawable(
@@ -191,6 +194,9 @@ class CanteenOfferItemAdapter(
)
)
// Set content description for the icon
img.imageView.contentDescription = context.getString(drawableTextDesc)
// Set tint of the icon
img.imageView.imageTintList = ColorStateList.valueOf(
context.theme.getThemedColor(
+7 -7
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/snackbar_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -56,7 +57,9 @@
app:layout_constraintTop_toTopOf="@id/app_title_bar"
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
app:layout_constraintEnd_toStartOf="@id/button_notifications"
app:iconTint="?attr/colorOnSurfaceVariant"/>
app:iconTint="?attr/colorOnSurfaceVariant"
tools:ignore="UnusedAttribute"
android:tooltipText="@string/canteen_button_opening_hours_hint"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.IconButton.Outlined"
@@ -70,7 +73,9 @@
app:layout_constraintTop_toTopOf="@id/app_title_bar"
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
app:layout_constraintEnd_toEndOf="parent"
app:iconTint="?attr/colorOnSurfaceVariant"/>
app:iconTint="?attr/colorOnSurfaceVariant"
tools:ignore="UnusedAttribute"
android:tooltipText="@string/canteen_button_notifications_hint"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -245,11 +250,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="TEST TEST TEST TEST ABC 123 !!!"/>-->
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
+4 -3
View File
@@ -54,13 +54,14 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginHorizontal="4dp"
android:scaleType="centerInside"
app:tint="?attr/colorText"
android:src="@drawable/visibility_off"/>
android:tint="?attr/colorText"
android:src="@drawable/visibility_off"
android:importantForAccessibility="no"/>
<TextView
android:id="@+id/text_difference"
+4 -4
View File
@@ -2,7 +2,6 @@
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingHorizontal="8dp"
android:paddingVertical="4dp"
android:orientation="vertical">
@@ -62,13 +61,14 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginHorizontal="4dp"
android:scaleType="centerInside"
app:tint="?attr/colorText"
android:src="@drawable/edit_off"/>
android:tint="?attr/colorText"
android:src="@drawable/edit_off"
android:importantForAccessibility="no"/>
<TextView
android:id="@+id/text_no_events"
+2 -3
View File
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="20dp"
android:layout_height="20dp">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerInside"
app:tint="?attr/colorOnSurfaceVariant" />
android:tint="?attr/colorOnSurfaceVariant"/>
</androidx.appcompat.widget.LinearLayoutCompat>
@@ -2,16 +2,16 @@
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/preference_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerInside"
app:tint="?attr/colorOnSurfaceVariant"
android:layout_marginEnd="8dp"/>
android:tint="?attr/colorOnSurfaceVariant"
android:layout_marginEnd="8dp"
android:importantForAccessibility="no"/>
<TextView
android:id="@+id/preference_text"
+3
View File
@@ -73,6 +73,9 @@
<string name="sheet_schedule_update_time_dialog_start_hint">Startzeit der Veranstaltung</string>
<string name="sheet_schedule_update_time_dialog_end_hint">Schlusszeit der Veranstaltung</string>
<string name="canteen_button_opening_hours_hint">Siehe Öffnungszeiten der Mensa</string>
<string name="canteen_button_notifications_hint">Siehe Neuigkeiten der Mensa</string>
<string name="canteen_no_offer_header">Kein Angebot</string>
<string name="canteen_no_offer_desc">Für diesen Tag sind keine Angebote vorhanden</string>
<string name="canteen_news_sheet_title">Neuigkeiten für diese Mensa</string>
+3
View File
@@ -75,6 +75,9 @@
<string name="sheet_schedule_update_time_dialog_start_hint">Event start time</string>
<string name="sheet_schedule_update_time_dialog_end_hint">Event end time</string>
<string name="canteen_button_opening_hours_hint">View canteen opening hours</string>
<string name="canteen_button_notifications_hint">View canteen notifications</string>
<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_news_sheet_title">News for this canteen</string>