updated some libs, meal tomorrow shows correct string if there's no meal

This commit is contained in:
Jannik 2018-12-02 00:05:23 +01:00
parent 70059b4b0c
commit b49d16b1a1
5 changed files with 15 additions and 9 deletions

View File

@ -35,8 +35,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'org.jsoup:jsoup:1.11.3' implementation 'org.jsoup:jsoup:1.11.3'
implementation 'org.jetbrains.anko:anko-commons:0.10.8' implementation 'org.jetbrains.anko:anko-commons:0.10.8'
implementation 'com.afollestad.material-dialogs:core:2.0.0-rc1' implementation 'com.afollestad.material-dialogs:core:2.0.0-rc3'
implementation 'com.afollestad.material-dialogs:color:2.0.0-rc1' implementation 'com.afollestad.material-dialogs:color:2.0.0-rc3'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

View File

@ -75,7 +75,6 @@ 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)
} }
@ -86,16 +85,16 @@ class HomeFragment : Fragment() {
if (dayMenus.size >= 2) { if (dayMenus.size >= 2) {
// get the index of the first meal, not a "Schneller Teller" // get the index of the first meal, not a "Schneller Teller"
loop@ for ((i, meal) in dayMenus.withIndex()) { loop@ for ((i, meal) in dayMenus.withIndex()) {
if(meal.heading.contains("Essen")) { if (meal.heading.contains("Essen")) {
for ((j, part) in dayMenus[i].parts.withIndex()) { for ((j, part) in dayMenus[i].parts.withIndex()) {
txtViewMenu1.append(part) txtViewMenu1.append(part)
if(j < (dayMenus[i].parts.size - 2)) if (j < (dayMenus[i].parts.size - 2))
txtViewMenu1.append("\n") txtViewMenu1.append("\n")
} }
for ((j, part) in dayMenus[i + 1].parts.withIndex()) { for ((j, part) in dayMenus[i + 1].parts.withIndex()) {
txtViewMenu2.append(part) txtViewMenu2.append(part)
if(j < (dayMenus[i + 1].parts.size - 2)) if (j < (dayMenus[i + 1].parts.size - 2))
txtViewMenu2.append("\n") txtViewMenu2.append("\n")
} }
@ -104,8 +103,13 @@ class HomeFragment : Fragment() {
} }
} else { } else {
txtViewMenu1.text = resources.getString(R.string.no_meal_today) if (txtView_Menu1Heading.text == resources.getString(R.string.meal_1_tomorrow)) {
txtViewMenu2.text = resources.getString(R.string.no_meal_today) txtViewMenu1.text = resources.getString(R.string.no_meal_tomorrow)
txtViewMenu2.text = resources.getString(R.string.no_meal_tomorrow)
} else {
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
}
} }
} }
} }

View File

@ -90,7 +90,7 @@ class MensaFragment : Fragment() {
menuViewMenu.getTxtViewMenu().append("\n") menuViewMenu.getTxtViewMenu().append("\n")
} }
cardViewMensaDay.setDayHeading(meal.day) //TODO move this out of the first for loop, performance!! cardViewMensaDay.setDayHeading(meal.day)
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu) cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu)
add = true add = true
} }

View File

@ -10,6 +10,7 @@
<string name="meal_1_tomorrow">Essen 1, Morgen</string> <string name="meal_1_tomorrow">Essen 1, Morgen</string>
<string name="meal_2_tomorrow">Essen 1, Morgen</string> <string name="meal_2_tomorrow">Essen 1, Morgen</string>
<string name="no_meal_today">heute keine Essensausgabe</string> <string name="no_meal_today">heute keine Essensausgabe</string>
<string name="no_meal_tomorrow">morgen keine Essensausgabe</string>
<string name="no_more_food">Diese Woche keine weitere Essensausgabe</string> <string name="no_more_food">Diese Woche keine weitere Essensausgabe</string>
<string name="no_lesson_today">heute keine Vorlesung</string> <string name="no_lesson_today">heute keine Vorlesung</string>
<string name="error">Fehler</string> <string name="error">Fehler</string>

View File

@ -17,6 +17,7 @@
<string name="meal_1_tomorrow">Meal 1, tomorrow</string> <string name="meal_1_tomorrow">Meal 1, tomorrow</string>
<string name="meal_2_tomorrow">Meal 2, tomorrow</string> <string name="meal_2_tomorrow">Meal 2, tomorrow</string>
<string name="no_meal_today">Mensa closed today</string> <string name="no_meal_today">Mensa closed today</string>
<string name="no_meal_tomorrow">Mensa closed tomorrow</string>
<string name="no_more_food">No more Food this week</string> <string name="no_more_food">No more Food this week</string>
<string name="no_lesson_today">"no lecture today "</string> <string name="no_lesson_today">"no lecture today "</string>