Implemented ability to change the fragment opened on app start; made some optimisations to DietaryPreferences.kt. BUG: tab layout mediator is annoying af

This commit is contained in:
denizk0461
2023-04-27 15:15:29 +02:00
parent 1828a4b02e
commit 9d6489f83b
11 changed files with 92 additions and 77 deletions
@@ -68,11 +68,13 @@ class CanteenOfferItemAdapter(
// Inflate a new icon holder
val img = ItemIconBinding.inflate(LayoutInflater.from(holder.binding.root.context))
val (_, drawableId) = DietaryPreferences.getData(DietaryPreferences.ERROR.ordinal)
// Set a cross icon
img.imageView.setImageDrawable(
AppCompatResources.getDrawable(
holder.binding.root.context,
DietaryPreferences.indexToDrawable[11]!!,
drawableId,
)
)
@@ -117,11 +119,13 @@ class CanteenOfferItemAdapter(
// Inflate a new icon holder
val img = ItemIconBinding.inflate(LayoutInflater.from(holder.binding.root.context))
val (_, drawableId) = DietaryPreferences.getData(index)
// Set the appropriate icon
img.imageView.setImageDrawable(
AppCompatResources.getDrawable(
holder.binding.root.context,
DietaryPreferences.indexToDrawable[index]!!,
drawableId,
)
)