cleanup, mensa detail view and timetbale fragment

This commit is contained in:
Jannik 2018-10-27 14:11:47 +02:00
parent c77e535817
commit 5fd9db182a
13 changed files with 145 additions and 28 deletions

View File

@ -20,12 +20,13 @@
*
*/
package org.mosad.seil0.projectlaogai
package ord.mosad.seil0.projectlaogai.uicomponents
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.widget.TextView
import org.mosad.seil0.projectlaogai.R
class LessonCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){

View File

@ -0,0 +1,28 @@
package ord.mosad.seil0.projectlaogai.uicomponents
import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
import android.widget.TextView
import org.mosad.seil0.projectlaogai.R
class MensaDayCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){
private var linLayoutMensaDay: LinearLayout
private var txtViewDayHeading: TextView
init {
inflate(context, R.layout.mensaday_cardview,this)
linLayoutMensaDay = findViewById(R.id.linLayout_MensaDay)
txtViewDayHeading = findViewById(R.id.txtView_DayHeading)
// workaround to prevent a white border
//this.setBackgroundColor(Color.TRANSPARENT)
}
fun getLinLayoutMensaDay(): LinearLayout {
return linLayoutMensaDay
}
}

View File

@ -1,9 +1,10 @@
package org.mosad.seil0.projectlaogai
package ord.mosad.seil0.projectlaogai.uicomponents
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.widget.TextView
import org.mosad.seil0.projectlaogai.R
class MenuCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){

View File

@ -32,6 +32,7 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.ScrollView
import android.widget.TextView
import ord.mosad.seil0.projectlaogai.uicomponents.LessonCardView
/**
* The "home" controller class

View File

@ -98,6 +98,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
R.id.nav_timetable -> {
val timeTableFragment = TimeTableFragment()
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.fragment_container, timeTableFragment)
fragmentTransaction.commit()
}
R.id.nav_moodle -> {

View File

@ -22,18 +22,19 @@
package org.mosad.seil0.projectlaogai
import android.graphics.drawable.GradientDrawable
import android.annotation.SuppressLint
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
import ord.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
import ord.mosad.seil0.projectlaogai.uicomponents.MenuCardView
/**
* A simple [Fragment] subclass.
*
* The mensa controller class
* contains all needed parts to display and the mensa detail screen
*/
class MensaFragment : Fragment() {
@ -50,10 +51,10 @@ class MensaFragment : Fragment() {
return view
}
@SuppressLint("SetTextI18n")
fun addDay() {
val linLayoutDay = LinearLayout(context)
val txtViewDayHeading = TextView(context, null, R.string.sample_date)
val cardViewMensaDay = MensaDayCardView(context!!, null)
val menuViewMenu1 = MenuCardView(context!!, null)
val menuViewMenu2 = MenuCardView(context!!, null)
@ -62,13 +63,23 @@ class MensaFragment : Fragment() {
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)
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu1)
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu2)
linLayoutMensaFragment.addView(cardViewMensaDay)
linLayoutMensaFragment.addView(linLayoutDay)
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\nCouscous\nBlattsalat"
menuViewMenu22.getTxtViewMenuHeading().text = "Essen 22"
menuViewMenu22.getTxtViewMenu().text = "Riesen Currywurst\nCurryketchup\nGitterkartoffeln\nBlattsalat"
cardViewMensaDay2.getLinLayoutMensaDay().addView(menuViewMenu12)
cardViewMensaDay2.getLinLayoutMensaDay().addView(menuViewMenu22)
linLayoutMensaFragment.addView(cardViewMensaDay2)
}

View File

@ -0,0 +1,25 @@
package org.mosad.seil0.projectlaogai
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/**
* The timetable controller class
* contains all needed parts to display and the timetable detail screen
*/
class TimeTableFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view: View = inflater.inflate(R.layout.fragment_time_table, container, false)
return view
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MensaFragment">
@ -9,16 +9,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/linLayout_MensaFragment">
<TextView
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sample_date" android:id="@+id/txtView_MensaDay" android:textSize="20sp"
android:textAlignment="center" android:textStyle="bold" android:padding="7dp"/>
</LinearLayout>
android:layout_height="wrap_content" android:id="@+id/linLayout_MensaFragment"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

View File

@ -18,7 +18,8 @@
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp" android:id="@+id/cardView_Info">
android:layout_marginTop="9dp" android:id="@+id/cardView_Info" app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
@ -94,7 +95,8 @@
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp" android:id="@+id/cardView_Settings">
android:id="@+id/cardView_Settings" app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TimeTableFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment"/>
</FrameLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
app:cardElevation="5dp"
app:cardBackgroundColor="@color/colorMensaDay"
app:cardUseCompatPadding="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/linLayout_MensaDay">
<TextView
android:text="@string/sample_date"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_DayHeading" android:textAlignment="center"
android:textSize="20sp" android:textStyle="bold" android:typeface="sans" android:paddingBottom="5dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -2,5 +2,6 @@
<resources>
<color name="colorPrimary">@color/design_default_color_primary</color>
<color name="colorPrimaryDark">@color/design_default_color_primary_dark</color>
<color name="colorAccent">#D81B60</color>
<color name="colorAccent">#d81b60</color>
<color name="colorMensaDay">#ebe8e9</color>
</resources>

View File

@ -2,7 +2,7 @@
<string name="app_name">Project Laogai</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">hso App 0.0.2</string>
<string name="nav_header_title">hso App 0.0.3</string>
<string name="nav_header_subtitle">seil0@mosad.xyz</string>
<string name="nav_header_desc">Navigation header</string>
@ -31,6 +31,11 @@
<string name="select">select</string>
<string name="version">version 0.0.2</string>
<string name="about">about</string>
<string name="about_text">This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit https://git.mosad.xyz/Seil0/ProjectLaogai\n\n(c) 2018 seil0@mosad.xyz</string>
<string name="about_text">This software is made by @Seil0 and is published under the terms and conditions of GPL 3.
For further information visit https://git.mosad.xyz/Seil0/ProjectLaogai\n\n(c) 2018 seil0@mosad.xyz
</string>
<string name="about_txtView">hso App by @Seil0</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>