Browse Source

show tomorrows meal if iths latr than 1500

pull/20/head
Jannik 4 years ago
parent
commit
0607d58760
  1. 15
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  2. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  3. 2
      app/src/main/res/values-de-rDE/strings.xml
  4. 2
      app/src/main/res/values/strings.xml

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

@ -64,11 +64,22 @@ class HomeFragment : Fragment() {
/**
* add the current mensa meal to the home screens
* TODO show meals of the next day if its later than 1500
*/
private fun addCurrentMensaMenu() {
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 {

2
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

@ -71,7 +71,7 @@ class MensaFragment : Fragment() {
Calendar.THURSDAY -> "Don"
Calendar.FRIDAY -> "Fre"
Calendar.SATURDAY -> "Sam"
else -> "TODAY" //TODO
else -> "TODAY" // the app will likely crash here
}
val cardViewMensaDay = MensaDayCardView(context!!, null)

2
app/src/main/res/values-de-rDE/strings.xml

@ -8,6 +8,8 @@
<string name="settings">Einstellungen</string>
<string name="meal_1">Essen 1</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_more_food">Diese Woche keine weitere Essensausgabe</string>
<string name="no_lesson_today">heute keine Vorlesung</string>

2
app/src/main/res/values/strings.xml

@ -15,6 +15,8 @@
<string name="meal_1">Meal 1</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_more_food">No more Food this week</string>

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close