Browse Source

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
pull/20/head 0.2.3
Jannik 3 years ago
parent
commit
f6f652ffb6
  1. 4
      app/build.gradle
  2. 19
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  3. 2
      build.gradle

4
app/build.gradle

@ -12,8 +12,8 @@ android {
applicationId "org.mosad.seil0.projectlaogai"
minSdkVersion 21
targetSdkVersion 28
versionCode 6
versionName "0.2.2"
versionCode 7
versionName "0.2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

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

@ -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)

2
build.gradle

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.0'
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()

Loading…
Cancel
Save