the home screen will now always show the first 2 meals
* things like a "Schneller Teller" are not shown in the home screen anymore * updated ti kotlin 1.3.10
This commit is contained in:
@ -76,6 +76,7 @@ class HomeFragment : Fragment() {
|
||||
} else {
|
||||
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1)
|
||||
uiThread {
|
||||
// TODO Mensa closed today is showing
|
||||
txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow)
|
||||
txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow)
|
||||
}
|
||||
@ -84,13 +85,21 @@ class HomeFragment : Fragment() {
|
||||
uiThread {
|
||||
|
||||
if (dayMenus.size >= 2) {
|
||||
for (part in dayMenus[0].parts) {
|
||||
txtViewMenu1.append(part)
|
||||
// get the index of the first meal, not a "Schneller Teller"
|
||||
loop@ for ((i, meal) in dayMenus.withIndex()) {
|
||||
if(meal.heading.contains("Essen")) {
|
||||
for (part in dayMenus[i].parts) {
|
||||
txtViewMenu1.append(part)
|
||||
}
|
||||
|
||||
for (part in dayMenus[i + 1].parts) {
|
||||
txtViewMenu2.append(part)
|
||||
}
|
||||
|
||||
break@loop
|
||||
}
|
||||
}
|
||||
|
||||
for (part in dayMenus[1].parts) {
|
||||
txtViewMenu2.append(part)
|
||||
}
|
||||
} else {
|
||||
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
|
||||
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
|
||||
|
Reference in New Issue
Block a user