show tomorrows meal if iths latr than 1500
This commit is contained in:
parent
3cd831e72c
commit
0607d58760
|
@ -64,11 +64,22 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add the current mensa meal to the home screens
|
* add the current mensa meal to the home screens
|
||||||
* TODO show meals of the next day if its later than 1500
|
|
||||||
*/
|
*/
|
||||||
private fun addCurrentMensaMenu() {
|
private fun addCurrentMensaMenu() {
|
||||||
doAsync {
|
doAsync {
|
||||||
val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), Calendar.getInstance().get(Calendar.DAY_OF_WEEK))
|
val dayMenus: ArrayList<Meal>
|
||||||
|
val cal = Calendar.getInstance()
|
||||||
|
|
||||||
|
// TODO needs testing
|
||||||
|
if (cal.get(Calendar.HOUR_OF_DAY) < 15) {
|
||||||
|
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK))
|
||||||
|
} else {
|
||||||
|
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1)
|
||||||
|
uiThread {
|
||||||
|
txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow)
|
||||||
|
txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uiThread {
|
uiThread {
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class MensaFragment : Fragment() {
|
||||||
Calendar.THURSDAY -> "Don"
|
Calendar.THURSDAY -> "Don"
|
||||||
Calendar.FRIDAY -> "Fre"
|
Calendar.FRIDAY -> "Fre"
|
||||||
Calendar.SATURDAY -> "Sam"
|
Calendar.SATURDAY -> "Sam"
|
||||||
else -> "TODAY" //TODO
|
else -> "TODAY" // the app will likely crash here
|
||||||
}
|
}
|
||||||
|
|
||||||
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
<string name="settings">Einstellungen</string>
|
<string name="settings">Einstellungen</string>
|
||||||
<string name="meal_1">Essen 1</string>
|
<string name="meal_1">Essen 1</string>
|
||||||
<string name="meal_2">Essen 2</string>
|
<string name="meal_2">Essen 2</string>
|
||||||
|
<string name="meal_1_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_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>
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
<string name="meal_1">Meal 1</string>
|
<string name="meal_1">Meal 1</string>
|
||||||
<string name="meal_2">Meal 2</string>
|
<string name="meal_2">Meal 2</string>
|
||||||
|
<string name="meal_1_tomorrow">Meal 1, 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_more_food">No more Food this week</string>
|
<string name="no_more_food">No more Food this week</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue