Browse Source

in TimeTableFragment each lesson has a date now

pull/20/head
Jannik 4 years ago
parent
commit
bbde66e16c
  1. 23
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt

23
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/TimeTableFragment.kt

@ -36,6 +36,7 @@ import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
import org.mosad.seil0.projectlaogai.uicomponents.LessonCardView
import org.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
import java.text.SimpleDateFormat
import java.util.*
/**
@ -58,18 +59,23 @@ class TimeTableFragment : Fragment() {
return view
}
/**
* add the remaining days of the current week to the timetable screen
*/
private fun addCurrentWeek() {
doAsync {
uiThread {
for(day in Calendar.getInstance().get(Calendar.DAY_OF_WEEK)..7) {
println("Day index: " + (day - 2))
val formatter = SimpleDateFormat("E dd.MM", Locale.GERMANY) // TODO change to android call when min api is 24
val calendar = Calendar.getInstance()
calendar.firstDayOfWeek = Calendar.MONDAY
calendar.add(Calendar.DATE,day - 3)
val cardViewTimeTableDay = MensaDayCardView(context!!, null)
cardViewTimeTableDay.setDayHeading((day - 1).toString())
cardViewTimeTableDay.setDayHeading(formatter.format(calendar.time))
// for each lessen of the day
for((i, lesson) in mainActivity.getCurrentTimeTableWeek()[day - 2].withIndex()) {
@ -83,19 +89,13 @@ class TimeTableFragment : Fragment() {
if(lessonCardView.getTxtViewLesson().text.length > 2)
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
}
// TODO if there is no lesson at one day , show a no lesson card
linLayoutTTFragment.addView(cardViewTimeTableDay)
}
// 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)
//}
}
}
@ -105,5 +105,4 @@ class TimeTableFragment : Fragment() {
this.mainActivity = mainActivity
}
}

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