Browse Source

cleanup, mensa detail view and timetbale fragment

pull/20/head
Jannik 4 years ago
parent
commit
5fd9db182a
  1. 3
      app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/LessonCardView.kt
  2. 28
      app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/MensDayCardView.kt
  3. 3
      app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/MenuCardView.kt
  4. 1
      app/src/main/java/org/mosad/seil0/projectlaogai/HomeFragment.kt
  5. 5
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  6. 35
      app/src/main/java/org/mosad/seil0/projectlaogai/MensaFragment.kt
  7. 25
      app/src/main/java/org/mosad/seil0/projectlaogai/TimeTableFragment.kt
  8. 20
      app/src/main/res/layout/fragment_mensa.xml
  9. 6
      app/src/main/res/layout/fragment_settings.xml
  10. 13
      app/src/main/res/layout/fragment_time_table.xml
  11. 22
      app/src/main/res/layout/mensaday_cardview.xml
  12. 3
      app/src/main/res/values/colors.xml
  13. 9
      app/src/main/res/values/strings.xml

3
app/src/main/java/org/mosad/seil0/projectlaogai/LessonCardView.kt → app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/LessonCardView.kt

@ -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){

28
app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/MensDayCardView.kt

@ -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
}
}

3
app/src/main/java/org/mosad/seil0/projectlaogai/MenuCardView.kt → app/src/main/java/ord/mosad/seil0/projectlaogai/uicomponents/MenuCardView.kt

@ -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){

1
app/src/main/java/org/mosad/seil0/projectlaogai/HomeFragment.kt

@ -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

5
app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt

@ -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 -> {

35
app/src/main/java/org/mosad/seil0/projectlaogai/MensaFragment.kt

@ -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)
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"
linLayoutMensaFragment.addView(linLayoutDay)
cardViewMensaDay2.getLinLayoutMensaDay().addView(menuViewMenu12)
cardViewMensaDay2.getLinLayoutMensaDay().addView(menuViewMenu22)
linLayoutMensaFragment.addView(cardViewMensaDay2)
}

25
app/src/main/java/org/mosad/seil0/projectlaogai/TimeTableFragment.kt

@ -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
}
}

20
app/src/main/res/layout/fragment_mensa.xml

@ -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>

6
app/src/main/res/layout/fragment_settings.xml

@ -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"

13
app/src/main/res/layout/fragment_time_table.xml

@ -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>

22
app/src/main/res/layout/mensaday_cardview.xml

@ -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>

3
app/src/main/res/values/colors.xml

@ -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>

9
app/src/main/res/values/strings.xml

@ -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>

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close