Browse Source

fixed menu formatting

pull/20/head
Jannik 2 years ago
parent
commit
953185425b
  1. 10
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  2. 4
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

10
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt

@ -41,6 +41,7 @@ import org.mosad.seil0.projectlaogai.hsoparser.NotRetardedCalendar
import org.mosad.seil0.projectlaogai.uicomponents.LessonCardView
import org.mosad.seil0.projectlaogai.uicomponents.LessonTextView
import java.util.*
import kotlin.collections.ArrayList
/**
* The "home" controller class
@ -90,15 +91,16 @@ class HomeFragment : Fragment() {
// get the index of the first meal, not a "Schneller Teller"
loop@ for ((i, meal) in dayMeals.withIndex()) {
if (meal.heading.contains("Essen")) {
for ((j, part) in dayMeals[i].parts.withIndex()) {
dayMeals[i].parts.forEachIndexed { index, part ->
txtViewMenu1.append(part)
if (j < (dayMeals[i].parts.size - 2))
if (index < (dayMeals[i].parts.size - 1))
txtViewMenu1.append("\n")
}
for ((j, part) in dayMeals[i + 1].parts.withIndex()) {
dayMeals[i + 1].parts.forEachIndexed { index, part ->
txtViewMenu2.append(part)
if (j < (dayMeals[i + 1].parts.size - 2))
if (index < (dayMeals[i + 1].parts.size - 1))
txtViewMenu2.append("\n")
}

4
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

@ -82,7 +82,7 @@ class MensaFragment : Fragment() {
meal.parts.forEachIndexed { partIndex, part ->
menuViewMenu.getTxtViewMenu().append(part)
if(partIndex < (meal.parts.size - 2))
if(partIndex < (meal.parts.size - 1))
menuViewMenu.getTxtViewMenu().append("\n")
}
@ -92,8 +92,6 @@ class MensaFragment : Fragment() {
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu)
}
println("$dayIndex:" + cardViewMensaDay.getLinLayoutMensaDay().childCount) // remove
if(cardViewMensaDay.getLinLayoutMensaDay().childCount > 1)
linLayoutMensaFragment.addView(cardViewMensaDay)

Loading…
Cancel
Save