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.content.Context
import android.graphics.Color import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.TextView 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){ 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.content.Context
import android.graphics.Color import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.TextView 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){ 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.LinearLayout
import android.widget.ScrollView import android.widget.ScrollView
import android.widget.TextView import android.widget.TextView
import ord.mosad.seil0.projectlaogai.uicomponents.LessonCardView
/** /**
* The "home" controller class * The "home" controller class

View File

@ -98,6 +98,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
} }
R.id.nav_timetable -> { 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 -> { R.id.nav_moodle -> {

View File

@ -22,18 +22,19 @@
package org.mosad.seil0.projectlaogai package org.mosad.seil0.projectlaogai
import android.graphics.drawable.GradientDrawable import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout 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() { class MensaFragment : Fragment() {
@ -50,10 +51,10 @@ class MensaFragment : Fragment() {
return view return view
} }
@SuppressLint("SetTextI18n")
fun addDay() { fun addDay() {
val linLayoutDay = LinearLayout(context) val cardViewMensaDay = MensaDayCardView(context!!, null)
val txtViewDayHeading = TextView(context, null, R.string.sample_date)
val menuViewMenu1 = MenuCardView(context!!, null) val menuViewMenu1 = MenuCardView(context!!, null)
val menuViewMenu2 = MenuCardView(context!!, null) val menuViewMenu2 = MenuCardView(context!!, null)
@ -62,13 +63,23 @@ class MensaFragment : Fragment() {
menuViewMenu2.getTxtViewMenuHeading().text = "Essen 2" menuViewMenu2.getTxtViewMenuHeading().text = "Essen 2"
menuViewMenu2.getTxtViewMenu().text = "Riesen Currywurst\nCurryketchup\nGitterkartoffeln\nBlattsalat" menuViewMenu2.getTxtViewMenu().text = "Riesen Currywurst\nCurryketchup\nGitterkartoffeln\nBlattsalat"
linLayoutDay.orientation = LinearLayout.VERTICAL cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu1)
linLayoutDay.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu2)
linLayoutDay.addView(txtViewDayHeading) linLayoutMensaFragment.addView(cardViewMensaDay)
linLayoutDay.addView(menuViewMenu1)
linLayoutDay.addView(menuViewMenu2)
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"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MensaFragment"> tools:context=".MensaFragment">
@ -9,16 +9,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <ScrollView
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/linLayout_MensaFragment"> android:layout_height="match_parent">
<TextView <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" android:id="@+id/linLayout_MensaFragment"
android:text="@string/sample_date" android:id="@+id/txtView_MensaDay" android:textSize="20sp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:textAlignment="center" android:textStyle="bold" android:padding="7dp"/> app:layout_constraintTop_toTopOf="parent"
</LinearLayout> >
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>

View File

@ -18,7 +18,8 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -94,7 +95,8 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" 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> <resources>
<color name="colorPrimary">@color/design_default_color_primary</color> <color name="colorPrimary">@color/design_default_color_primary</color>
<color name="colorPrimaryDark">@color/design_default_color_primary_dark</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> </resources>

View File

@ -2,7 +2,7 @@
<string name="app_name">Project Laogai</string> <string name="app_name">Project Laogai</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close 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_subtitle">seil0@mosad.xyz</string>
<string name="nav_header_desc">Navigation header</string> <string name="nav_header_desc">Navigation header</string>
@ -31,6 +31,11 @@
<string name="select">select</string> <string name="select">select</string>
<string name="version">version 0.0.2</string> <string name="version">version 0.0.2</string>
<string name="about">about</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> <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> </resources>