2018-10-24 18:22:05 +02:00
/ * *
* ProjectLaogai
*
* Copyright 2018 < seil0 @mosad . xyz >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston ,
* MA 02110 - 1301 , USA .
*
* /
package org.mosad.seil0.projectlaogai
2018-10-27 14:11:47 +02:00
import android.annotation.SuppressLint
2018-10-24 18:22:05 +02:00
import android.os.Bundle
2018-10-26 00:50:37 +02:00
import androidx.fragment.app.Fragment
2018-10-24 18:22:05 +02:00
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
2018-10-27 00:39:56 +02:00
import android.widget.LinearLayout
2018-10-27 14:11:47 +02:00
import ord.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
import ord.mosad.seil0.projectlaogai.uicomponents.MenuCardView
2018-10-24 18:22:05 +02:00
/ * *
2018-10-27 14:11:47 +02:00
* The mensa controller class
* contains all needed parts to display and the mensa detail screen
2018-10-24 18:22:05 +02:00
* /
class MensaFragment : Fragment ( ) {
2018-10-27 00:39:56 +02:00
private lateinit var linLayoutMensaFragment : LinearLayout
override fun onCreateView ( inflater : LayoutInflater , container : ViewGroup ? , savedInstanceState : Bundle ? ) : View ? {
val view : View = inflater . inflate ( R . layout . fragment _mensa , container , false )
linLayoutMensaFragment = view . findViewById ( R . id . linLayout _MensaFragment )
addDay ( )
return view
}
2018-10-27 14:11:47 +02:00
@SuppressLint ( " SetTextI18n " )
2018-10-27 00:39:56 +02:00
fun addDay ( ) {
2018-10-27 14:11:47 +02:00
val cardViewMensaDay = MensaDayCardView ( context !! , null )
2018-10-27 00:39:56 +02:00
val menuViewMenu1 = MenuCardView ( context !! , null )
val menuViewMenu2 = MenuCardView ( context !! , null )
menuViewMenu1 . getTxtViewMenuHeading ( ) . text = " Essen 1 "
menuViewMenu1 . getTxtViewMenu ( ) . text = " Buntes Pfannengemüse \n Couscous \n Blattsalat "
menuViewMenu2 . getTxtViewMenuHeading ( ) . text = " Essen 2 "
menuViewMenu2 . getTxtViewMenu ( ) . text = " Riesen Currywurst \n Curryketchup \n Gitterkartoffeln \n Blattsalat "
2018-10-27 14:11:47 +02:00
cardViewMensaDay . getLinLayoutMensaDay ( ) . addView ( menuViewMenu1 )
cardViewMensaDay . getLinLayoutMensaDay ( ) . addView ( menuViewMenu2 )
linLayoutMensaFragment . addView ( cardViewMensaDay )
val cardViewMensaDay2 = MensaDayCardView ( context !! , null )
val menuViewMenu12 = MenuCardView ( context !! , null )
val menuViewMenu22 = MenuCardView ( context !! , null )
menuViewMenu12 . getTxtViewMenuHeading ( ) . text = " Essen 12 "
menuViewMenu12 . getTxtViewMenu ( ) . text = " Buntes Pfannengemüse \n Couscous \n Blattsalat "
menuViewMenu22 . getTxtViewMenuHeading ( ) . text = " Essen 22 "
menuViewMenu22 . getTxtViewMenu ( ) . text = " Riesen Currywurst \n Curryketchup \n Gitterkartoffeln \n Blattsalat "
2018-10-27 00:39:56 +02:00
2018-10-27 14:11:47 +02:00
cardViewMensaDay2 . getLinLayoutMensaDay ( ) . addView ( menuViewMenu12 )
cardViewMensaDay2 . getLinLayoutMensaDay ( ) . addView ( menuViewMenu22 )
linLayoutMensaFragment . addView ( cardViewMensaDay2 )
2018-10-27 00:39:56 +02:00
2018-10-24 18:22:05 +02:00
}
}