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:
Jannik 2018-11-16 14:19:24 +01:00
parent 8fa0d496c6
commit f6f652ffb6
3 changed files with 17 additions and 8 deletions

View File

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

View File

@ -76,6 +76,7 @@ class HomeFragment : Fragment() {
} else { } else {
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1) dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1)
uiThread { uiThread {
// TODO Mensa closed today is showing
txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow) txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow)
txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow) txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow)
} }
@ -84,13 +85,21 @@ class HomeFragment : Fragment() {
uiThread { uiThread {
if (dayMenus.size >= 2) { if (dayMenus.size >= 2) {
for (part in dayMenus[0].parts) { // get the index of the first meal, not a "Schneller Teller"
txtViewMenu1.append(part) 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 { } else {
txtViewMenu1.text = resources.getString(R.string.no_meal_today) txtViewMenu1.text = resources.getString(R.string.no_meal_today)
txtViewMenu2.text = resources.getString(R.string.no_meal_today) txtViewMenu2.text = resources.getString(R.string.no_meal_today)

View File

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