/** * ProjectLaogai * * Copyright 2018 * * 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 import android.graphics.drawable.GradientDrawable import android.os.Bundle import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.LinearLayout import android.widget.TextView /** * A simple [Fragment] subclass. * */ class MensaFragment : Fragment() { 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\nCouscous\nBlattsalat" menuViewMenu2.getTxtViewMenuHeading().text = "Essen 2" menuViewMenu2.getTxtViewMenu().text = "Riesen Currywurst\nCurryketchup\nGitterkartoffeln\nBlattsalat" 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) } }