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 00:39:56 +02:00
import android.graphics.drawable.GradientDrawable
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
import android.widget.TextView
2018-10-24 18:22:05 +02:00
/ * *
* A simple [ Fragment ] subclass .
*
* /
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
}
fun addDay ( ) {
val linLayoutDay = LinearLayout ( context )
val txtViewDayHeading = TextView ( context , null , R . string . sample _date )
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 "
linLayoutDay . orientation = LinearLayout . VERTICAL
linLayoutDay . layoutParams = LinearLayout . LayoutParams ( LinearLayout . LayoutParams . MATCH _PARENT , LinearLayout . LayoutParams . WRAP _CONTENT )
linLayoutDay . addView ( txtViewDayHeading )
linLayoutDay . addView ( menuViewMenu1 )
linLayoutDay . addView ( menuViewMenu2 )
linLayoutMensaFragment . addView ( linLayoutDay )
2018-10-24 18:22:05 +02:00
}
}