version 0.1.2
* fixed a crash that occurred if there was no meal for the current day * added a card if there's no more meals this week * added a card if there's no lesson at the current day
This commit is contained in:
@ -156,4 +156,5 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||
timeTableWeek = timeTableParser.getTimeTable("https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0")
|
||||
}.get()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,12 +71,18 @@ class HomeFragment : Fragment() {
|
||||
val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(currentMenus, Calendar.getInstance().get(Calendar.DAY_OF_WEEK))
|
||||
|
||||
uiThread {
|
||||
for(part in dayMenus[0].parts) {
|
||||
txtViewMenu1.append(part)
|
||||
}
|
||||
|
||||
for(part in dayMenus[1].parts) {
|
||||
txtViewMenu2.append(part)
|
||||
if (dayMenus.size >= 2) {
|
||||
for(part in dayMenus[0].parts) {
|
||||
txtViewMenu1.append(part)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,6 +103,14 @@ class HomeFragment : Fragment() {
|
||||
if(lessonCardView.getTxtViewLesson().text.length > 2)
|
||||
linLayoutTimeTable.addView(lessonCardView)
|
||||
}
|
||||
|
||||
// add a card if there is no lesson today
|
||||
if (linLayoutTimeTable.childCount == 0) {
|
||||
// TODO we could display the next day with a lecture
|
||||
val noLessonCardView = LessonCardView(context!!, null)
|
||||
noLessonCardView.getTxtViewLesson().text = resources.getString(R.string.no_lesson_today) + "\n"
|
||||
linLayoutTimeTable.addView(noLessonCardView)
|
||||
}
|
||||
}
|
||||
|
||||
fun setCurrentMenu(weekMenus: ArrayList<Meal>){
|
||||
|
@ -99,6 +99,13 @@ class MensaFragment : Fragment() {
|
||||
if(add)
|
||||
linLayoutMensaFragment.addView(cardViewMensaDay)
|
||||
}
|
||||
|
||||
// add a card if there are no more meals in this week
|
||||
if(linLayoutMensaFragment.childCount == 0) {
|
||||
val cardViewNoMoreFood = MensaDayCardView(context!!, null)
|
||||
cardViewNoMoreFood.setDayHeading(resources.getString(R.string.no_more_food))
|
||||
linLayoutMensaFragment.addView(cardViewNoMoreFood)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,9 +72,8 @@ class MensaParser {
|
||||
}
|
||||
|
||||
for (meal in mealList) {
|
||||
if (meal.day.contains(strDay)) {
|
||||
if (meal.day.contains(strDay))
|
||||
dayMenus.add(meal)
|
||||
}
|
||||
}
|
||||
return dayMenus
|
||||
}
|
||||
|
Reference in New Issue
Block a user