in TimeTableFragment each lesson has a date now
This commit is contained in:
parent
9c5eeaa20b
commit
bbde66e16c
|
@ -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…
Reference in New Issue