timetable and mensa gui redesign
* the timetable and mensa screen are now the same design as the settings, much cleaner and ready for themes
This commit is contained in:
parent
cd3136715f
commit
a4eaea2918
@ -13,16 +13,15 @@ android {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 11
|
||||
versionName "0.3.96"
|
||||
versionNameSuffix "-beta"
|
||||
versionName "0.3.97"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "build_time", buildTime()
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
versionNameSuffix "-release"
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.timeta
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Meal
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.NotRetardedCalendar
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonTextView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.DayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonLinearLayout
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@ -127,50 +127,49 @@ class HomeFragment : Fragment() {
|
||||
*/
|
||||
private fun addCurrentTimeTable() {
|
||||
val dayIndex = NotRetardedCalendar().getDayOfWeekIndex()
|
||||
var helpLesson = LessonLinearLayout(context!!)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading("Heute")
|
||||
|
||||
if (timetables[0].days.isNotEmpty() && dayIndex < 6) {
|
||||
|
||||
val timeTableDay = timetables[0].days[dayIndex]
|
||||
|
||||
// for all timeslots of the day
|
||||
for ((i, timeslot) in timeTableDay.timeslots.withIndex()) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
for ((tsIndex, timeslot) in timetables[0].days[dayIndex].timeslots.withIndex()) {
|
||||
|
||||
for(lesson in timeslot) {
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setLesson(lesson)
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
// make sure no empty lesson is added
|
||||
if (lessonTxtView.text.length > 3)
|
||||
lessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
val lessonLayout = LessonLinearLayout(context!!)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
if (lesson != timeslot.last()) {
|
||||
lessonLayout.disableDivider()
|
||||
}
|
||||
|
||||
if (lessonCardView.getLinLayoutLesson().childCount > 1)
|
||||
linLayoutTimeTable.addView(lessonCardView)
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add a card if there is no lesson today
|
||||
if (linLayoutTimeTable.childCount == 0) {
|
||||
helpLesson.disableDivider()
|
||||
// if there are no lessons don't show the dayCardView
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1) {
|
||||
linLayoutTimeTable.addView(dayCardView)
|
||||
} else {
|
||||
// TODO we could display the next day with a lecture
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setText(resources.getString(R.string.no_lesson_today))
|
||||
val noLesson = DayCardView(context!!)
|
||||
noLesson.setDayHeading(resources.getString(R.string.no_lesson_today))
|
||||
|
||||
val noLessonCardView = LessonCardView(context!!, null)
|
||||
noLessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
|
||||
linLayoutTimeTable.addView(noLessonCardView)
|
||||
linLayoutTimeTable.addView(noLesson)
|
||||
}
|
||||
} else {
|
||||
if (dayIndex == 6) {
|
||||
// if that's the case it's sunday
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setText(resources.getString(R.string.no_lesson_today))
|
||||
val noLesson = DayCardView(context!!)
|
||||
noLesson.setDayHeading(resources.getString(R.string.no_lesson_today))
|
||||
|
||||
val noLessonCardView = LessonCardView(context!!, null)
|
||||
noLessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
|
||||
linLayoutTimeTable.addView(noLessonCardView)
|
||||
linLayoutTimeTable.addView(noLesson)
|
||||
} else {
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.error)
|
||||
|
@ -28,16 +28,17 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import kotlinx.android.synthetic.main.fragment_mensa.*
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cShowBuffet
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.mensaCurrentWeek
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.mensaNextWeek
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cShowBuffet
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.MensaWeek
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.NotRetardedCalendar
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MenuCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.DayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MealLinearLayout
|
||||
|
||||
/**
|
||||
* The mensa controller class
|
||||
@ -51,7 +52,7 @@ class MensaFragment : Fragment() {
|
||||
|
||||
val view: View = inflater.inflate(R.layout.fragment_mensa, container, false)
|
||||
|
||||
linLayoutMensaFragment = view.findViewById(R.id.linLayout_MensaFragment)
|
||||
linLayoutMensaFragment = view.findViewById(R.id.linLayout_Mensa)
|
||||
|
||||
// add the current week (week starts on sunday)
|
||||
val dayCurrent = if(NotRetardedCalendar().getDayOfWeekIndex() == 6) 0 else NotRetardedCalendar().getDayOfWeekIndex()
|
||||
@ -71,37 +72,34 @@ class MensaFragment : Fragment() {
|
||||
doAsync {
|
||||
|
||||
uiThread {
|
||||
|
||||
// only add the days dayStart to Fri since the mensa is closed on Sat/Sun
|
||||
for (dayIndex in dayStart..4) {
|
||||
|
||||
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
||||
var helpMeal = MealLinearLayout(context)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(menusWeek.days[dayIndex].meals[0].day)
|
||||
|
||||
for (meal in menusWeek.days[dayIndex].meals) {
|
||||
val menuViewMenu = MenuCardView(context!!, null)
|
||||
menuViewMenu.setMenuHeading(meal.heading)
|
||||
val mealLayout = MealLinearLayout(context)
|
||||
mealLayout.setMeal(meal)
|
||||
|
||||
meal.parts.forEachIndexed { partIndex, part ->
|
||||
menuViewMenu.getTxtViewMenu().append(part)
|
||||
if(partIndex < (meal.parts.size - 1))
|
||||
menuViewMenu.getTxtViewMenu().append("\n")
|
||||
if(meal.heading != "Buffet" || cShowBuffet) {
|
||||
dayCardView.getLinLayoutDay().addView(mealLayout)
|
||||
helpMeal = mealLayout
|
||||
}
|
||||
}
|
||||
|
||||
cardViewMensaDay.setDayHeading(meal.day)
|
||||
|
||||
if(meal.heading != "Buffet" || cShowBuffet)
|
||||
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu)
|
||||
}
|
||||
|
||||
if(cardViewMensaDay.getLinLayoutMensaDay().childCount > 1)
|
||||
linLayoutMensaFragment.addView(cardViewMensaDay)
|
||||
helpMeal.disableDivider()
|
||||
|
||||
if(dayCardView.getLinLayoutDay().childCount > 1)
|
||||
linLayoutMensaFragment.addView(dayCardView)
|
||||
}
|
||||
|
||||
// add a card if there are no more meals in this week
|
||||
if(linLayoutMensaFragment.childCount == 0) {
|
||||
val cardViewNoMoreFood = MensaDayCardView(context!!, null)
|
||||
cardViewNoMoreFood.setDayHeading(resources.getString(R.string.no_more_food))
|
||||
linLayoutMensaFragment.addView(cardViewNoMoreFood)
|
||||
val noFood = DayCardView(context!!)
|
||||
noFood.setDayHeading(resources.getString(R.string.no_more_food))
|
||||
linLayout_Mensa.addView(noFood)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ class MoodleFragment : Fragment() {
|
||||
webView = view.findViewById(R.id.webView)
|
||||
webView.loadUrl("https://elearning.hs-offenburg.de/moodle/")
|
||||
|
||||
webSettings = webView.getSettings()
|
||||
webSettings = webView.settings
|
||||
//webSettings.setJavaScriptEnabled(true) // Enable Javascript
|
||||
|
||||
webView.setWebViewClient(WebViewClient()) // Force links and redirects to open in the WebView instead of in a browser
|
||||
webView.webViewClient = WebViewClient() // Force links and redirects to open in the WebView instead of in a browser
|
||||
|
||||
return view
|
||||
}
|
||||
|
@ -26,17 +26,15 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import kotlinx.android.synthetic.main.fragment_timetable.*
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.timetables
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.NotRetardedCalendar
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonTextView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@ -46,16 +44,12 @@ import java.util.*
|
||||
*/
|
||||
class TimeTableFragment : Fragment() {
|
||||
|
||||
private lateinit var linLayoutTTFragment: LinearLayout
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
val view: View = inflater.inflate(R.layout.fragment_timetable, container, false)
|
||||
|
||||
linLayoutTTFragment = view.findViewById(R.id.linLayout_TTFragment)
|
||||
|
||||
if (timetables[0].days.isNotEmpty()) {
|
||||
addCurrentWeek()
|
||||
if (timetables[0].days.isNotEmpty() && timetables[1].days.isNotEmpty()) {
|
||||
addWeeks()
|
||||
} else {
|
||||
// TODO show card with error msg
|
||||
}
|
||||
@ -64,9 +58,9 @@ class TimeTableFragment : Fragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* add the remaining days of the current week to the timetable screen
|
||||
* add the all days with at least one lesson to the timetable screen
|
||||
*/
|
||||
private fun addCurrentWeek() {
|
||||
private fun addWeeks() {
|
||||
val dayIndex = NotRetardedCalendar().getDayOfWeekIndex()
|
||||
val formatter = SimpleDateFormat("E dd.MM", Locale.GERMANY) // TODO change to android call when min api is 24
|
||||
val calendar = Calendar.getInstance()
|
||||
@ -75,91 +69,76 @@ class TimeTableFragment : Fragment() {
|
||||
|
||||
uiThread {
|
||||
|
||||
// add current weeks days
|
||||
// add the current week
|
||||
for (day in dayIndex..5) {
|
||||
val cardViewTimeTableDay = MensaDayCardView(context!!, null)
|
||||
cardViewTimeTableDay.setDayHeading(formatter.format(calendar.time))
|
||||
var helpLesson = LessonLinearLayout(context)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(formatter.format(calendar.time))
|
||||
|
||||
// for each timeslot of the day
|
||||
for ((i, timeslot) in timetables[0].days[day].timeslots.withIndex()) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
|
||||
//println(timeslot)
|
||||
for ((tsIndex, timeslot) in timetables[0].days[day].timeslots.withIndex()) {
|
||||
|
||||
for(lesson in timeslot) {
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setLesson(lesson)
|
||||
|
||||
// make sure no empty lesson is added
|
||||
if (lessonTxtView.text.length > 3)
|
||||
lessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
val lessonLayout = LessonLinearLayout(context)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
if (lesson != timeslot.last()) {
|
||||
lessonLayout.disableDivider()
|
||||
}
|
||||
|
||||
// only add the lesson if it contains data
|
||||
if (lessonCardView.getLinLayoutLesson().childCount > 1)
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helpLesson.disableDivider()
|
||||
calendar.add(Calendar.DATE, 1)
|
||||
|
||||
// if the day contains no lessons add a text "No lesson today"
|
||||
if (cardViewTimeTableDay.getLinLayoutMensaDay().childCount <= 1) {
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setText(resources.getString(R.string.no_lesson_today))
|
||||
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
// if there are no lessons don't show the dayCardView
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1) {
|
||||
linLayout_Timetable.addView(dayCardView)
|
||||
}
|
||||
}
|
||||
|
||||
linLayoutTTFragment.addView(cardViewTimeTableDay)
|
||||
}
|
||||
|
||||
// add next weeks days, max number = dayIndex, if timetable was loaded
|
||||
if (timetables[1].days.isNotEmpty()) {
|
||||
calendar.add(Calendar.DATE, 1) // before this we are at a sunday (no lecture on sundays!)
|
||||
|
||||
// add the next week
|
||||
for (day in 0..(dayIndex - 1)) {
|
||||
|
||||
val cardViewTimeTableDay = MensaDayCardView(context!!, null)
|
||||
cardViewTimeTableDay.setDayHeading(formatter.format(calendar.time))
|
||||
var helpLesson = LessonLinearLayout(context!!)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(formatter.format(calendar.time))
|
||||
|
||||
// for each timeslot of the day
|
||||
for ((i, timeslot) in timetables[1].days[day].timeslots.withIndex()) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
|
||||
for ((tsIndex, timeslot) in timetables[1].days[day].timeslots.withIndex()) {
|
||||
|
||||
for(lesson in timeslot) {
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setLesson(lesson)
|
||||
|
||||
// make sure no empty lesson is added
|
||||
if (lessonTxtView.text.length > 3)
|
||||
lessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
val lessonLayout = LessonLinearLayout(context!!)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
if (lesson != timeslot.last()) {
|
||||
lessonLayout.disableDivider()
|
||||
}
|
||||
|
||||
// only add the lesson if it contains data
|
||||
if (lessonCardView.getLinLayoutLesson().childCount > 1)
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helpLesson.disableDivider()
|
||||
calendar.add(Calendar.DATE, 1)
|
||||
|
||||
// if the day contains no lessons add a text "No lesson today"
|
||||
if (cardViewTimeTableDay.getLinLayoutMensaDay().childCount <= 1) {
|
||||
val lessonTxtView = LessonTextView(context!!)
|
||||
lessonTxtView.setText(resources.getString(R.string.no_lesson_today))
|
||||
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.getLinLayoutLesson().addView(lessonTxtView)
|
||||
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
}
|
||||
|
||||
linLayoutTTFragment.addView(cardViewTimeTableDay)
|
||||
// if there are no lessons don't show the dayCardView
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1) {
|
||||
linLayout_Timetable.addView(dayCardView)
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,4 +147,5 @@ class TimeTableFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -24,32 +24,26 @@ package org.mosad.seil0.projectlaogai.uicomponents
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.cardview.widget.CardView
|
||||
import kotlinx.android.synthetic.main.cardview_day.view.*
|
||||
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
|
||||
class DayCardView(context: Context) : CardView(context) {
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.mensaday_cardview,this)
|
||||
|
||||
linLayoutMensaDay = findViewById(R.id.linLayout_MensaDay)
|
||||
txtViewDayHeading = findViewById(R.id.txtView_DayHeading)
|
||||
inflate(context, R.layout.cardview_day,this)
|
||||
|
||||
// workaround to prevent a white border
|
||||
this.setBackgroundColor(Color.TRANSPARENT)
|
||||
}
|
||||
|
||||
fun getLinLayoutMensaDay(): LinearLayout {
|
||||
return linLayoutMensaDay
|
||||
fun getLinLayoutDay() : LinearLayout {
|
||||
return linLayout_Day
|
||||
}
|
||||
|
||||
fun setDayHeading(heading: String) {
|
||||
txtViewDayHeading.text = heading
|
||||
txtView_DayHeading.text = heading
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* ProjectLaogai
|
||||
*
|
||||
* Copyright 2019 <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.uicomponents
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.cardview.widget.CardView
|
||||
import kotlinx.android.synthetic.main.linearlayout_lesson.view.*
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Lesson
|
||||
|
||||
class LessonLinearLayout(context: Context?) : LinearLayout(context) {
|
||||
|
||||
init {
|
||||
CardView.inflate(context, R.layout.linearlayout_lesson, this)
|
||||
}
|
||||
|
||||
fun setLesson(lesson: Lesson, time: String) {
|
||||
txtView_lessonTime.text = time
|
||||
txtView_lessonSubject.text = lesson.lessonSubject
|
||||
txtView_lessonTeacher.text = lesson.lessonTeacher
|
||||
txtView_lessonRoom.text = lesson.lessonRoom
|
||||
}
|
||||
|
||||
fun disableDivider() {
|
||||
divider_lesson.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package org.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
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Lesson
|
||||
|
||||
class LessonTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : TextView(context, attrs) {
|
||||
|
||||
init {
|
||||
this.setTextColor(Color.BLACK)
|
||||
this.textSize = 16F
|
||||
this.setPadding(0,6,0,0)
|
||||
}
|
||||
|
||||
fun setLesson(lesson: Lesson) {
|
||||
this.text = resources.getString(R.string.string_new_line, lesson.lessonSubject)
|
||||
this.append(lesson.lessonTeacher + "\n")
|
||||
this.append(lesson.lessonRoom)
|
||||
}
|
||||
|
||||
fun setText(text: String) {
|
||||
this.text = text
|
||||
}
|
||||
}
|
@ -23,32 +23,32 @@
|
||||
package org.mosad.seil0.projectlaogai.uicomponents
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.cardview.widget.CardView
|
||||
import kotlinx.android.synthetic.main.linearlayout_lesson.view.*
|
||||
import kotlinx.android.synthetic.main.linearlayout_meal.view.*
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Meal
|
||||
|
||||
class LessonCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){
|
||||
|
||||
private var linLayoutLesson: LinearLayout
|
||||
private var txtViewTime: TextView
|
||||
class MealLinearLayout(context: Context?): LinearLayout(context) {
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.lesson_cardview,this)
|
||||
|
||||
linLayoutLesson = findViewById(R.id.linLayout_Lesson)
|
||||
txtViewTime = findViewById(R.id.txtView_Time)
|
||||
|
||||
// workaround to prevent a white border
|
||||
this.setBackgroundColor(Color.TRANSPARENT)
|
||||
CardView.inflate(context, R.layout.linearlayout_meal, this)
|
||||
}
|
||||
|
||||
fun getLinLayoutLesson(): LinearLayout {
|
||||
return linLayoutLesson
|
||||
fun setMeal(meal: Meal) {
|
||||
txtView_MealHeading.text = meal.heading
|
||||
|
||||
meal.parts.forEachIndexed { partIndex, part ->
|
||||
txtView_Meal.append(part)
|
||||
if(partIndex < (meal.parts.size - 1))
|
||||
txtView_Meal.append("\n")
|
||||
}
|
||||
}
|
||||
|
||||
fun getTxtViewTime(): TextView {
|
||||
return txtViewTime
|
||||
fun disableDivider() {
|
||||
divider_meal.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package org.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){
|
||||
|
||||
private var txtViewMenuHeading: TextView
|
||||
private var txtViewMenu: TextView
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.menu_cardview,this)
|
||||
|
||||
txtViewMenuHeading = findViewById(R.id.txtView_MenuHeading)
|
||||
txtViewMenu = findViewById(R.id.txtView_Menu)
|
||||
|
||||
// workaround to prevent a white border
|
||||
this.setBackgroundColor(Color.TRANSPARENT)
|
||||
}
|
||||
|
||||
fun setMenuHeading(heading: String) {
|
||||
txtViewMenuHeading.text = heading
|
||||
}
|
||||
|
||||
fun getTxtViewMenu(): TextView {
|
||||
return txtViewMenu
|
||||
}
|
||||
}
|
19
app/src/main/res/layout/cardview_day.xml
Normal file
19
app/src/main/res/layout/cardview_day.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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" app:cardUseCompatPadding="true"
|
||||
app:cardElevation="5dp" app:cardBackgroundColor="@color/themeSecondary"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:id="@+id/linLayout_Day">
|
||||
<TextView
|
||||
android:text="@string/sample_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_DayHeading" android:textSize="18sp"
|
||||
android:textAlignment="center" android:textStyle="bold" android:textColor="?colorAccent"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
@ -14,9 +14,9 @@
|
||||
android:id="@+id/cardView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:clickable="false"
|
||||
android:maxHeight="125dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
@ -57,7 +57,7 @@
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView" android:elevation="5dp"
|
||||
android:layout_marginEnd="5dp" android:layout_marginStart="5dp">
|
||||
android:layout_marginEnd="3dp" android:layout_marginStart="3dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
|
@ -11,14 +11,12 @@
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:background="@android:color/background_light">
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
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"
|
||||
>
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_Mensa"
|
||||
android:background="@color/themePrimary">
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -15,7 +15,8 @@
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_TTFragment">
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_Timetable"
|
||||
android:background="@color/themePrimary">
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -1,23 +0,0 @@
|
||||
<?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"
|
||||
app:cardBackgroundColor="@android:color/background_light"
|
||||
app:cardElevation="5dp"
|
||||
app:cardUseCompatPadding="true" app:cardPreventCornerOverlap="false" app:contentPadding="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:id="@+id/linLayout_Lesson">
|
||||
<TextView
|
||||
android:id="@+id/txtView_Time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="@string/a_time"/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
35
app/src/main/res/layout/linearlayout_lesson.xml
Normal file
35
app/src/main/res/layout/linearlayout_lesson.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_lesson" android:padding="7dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_lessonSubject" android:layout_weight="1"
|
||||
android:textSize="15sp" android:textColor="@color/textPrimary"/>
|
||||
<TextView
|
||||
android:text="@string/a_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_lessonTime" android:layout_weight="1"
|
||||
android:textColor="@color/textSecondary" android:gravity="end"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_lessonTeacher" android:textSize="15sp"
|
||||
android:textColor="@color/textPrimary"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_lessonRoom"
|
||||
android:textColor="@color/textPrimary"/>
|
||||
<View
|
||||
android:id="@+id/divider_lesson"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
/>
|
||||
</LinearLayout>
|
23
app/src/main/res/layout/linearlayout_meal.xml
Normal file
23
app/src/main/res/layout/linearlayout_meal.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:id="@+id/linLayout_Meal" android:padding="7dp">
|
||||
|
||||
<TextView
|
||||
android:text="@string/meal_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_MealHeading" android:textSize="18sp"
|
||||
android:textColor="@color/textPrimary" android:textAlignment="center" android:paddingBottom="5dp"
|
||||
android:textStyle="bold"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Meal" android:textSize="15sp"
|
||||
android:textColor="@color/textPrimary" android:textAlignment="center"/>
|
||||
<View
|
||||
android:id="@+id/divider_meal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
/>
|
||||
</LinearLayout>
|
@ -1,22 +0,0 @@
|
||||
<?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" android:paddingBottom="5dp">
|
||||
<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>
|
@ -1,42 +0,0 @@
|
||||
<?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:id="@+id/cardView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:clickable="false"
|
||||
android:maxHeight="125dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:text="@string/meal_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_MenuHeading"
|
||||
android:textStyle="bold" android:textAlignment="center" android:textSize="16sp"
|
||||
android:typeface="sans" android:fontFamily="sans-serif" android:paddingBottom="5dp"/>
|
||||
<TextView
|
||||
android:id="@+id/txtView_Menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:typeface="sans"
|
||||
android:textIsSelectable="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -3,22 +3,29 @@
|
||||
<color name="colorPrimary">#000000</color>
|
||||
<color name="colorPrimaryDark">#000000</color>
|
||||
<color name="colorAccent">#3F51B5</color>
|
||||
<color name="colorMensaDay">#ebe8e9</color>
|
||||
<color name="colorMensaDay">#EBE8E9</color>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
|
||||
<color name="themePrimary">#FFFFFF</color>
|
||||
<color name="themeSecondary">#FFFFFF</color>
|
||||
<color name="themeTertiary">#FAFAFA</color> <!-- TODO find a better color -->
|
||||
|
||||
<color name="textPrimary">#000000</color>
|
||||
<color name="textSecondary">#818181</color>
|
||||
|
||||
<!--theme color section, not the working colors-->
|
||||
<color name="textPrimaryDark">#FFFFFF</color>
|
||||
<color name="textSecondaryDark">#F5F5F5</color>
|
||||
<color name="textSecondaryDark">#E0E0E0</color>
|
||||
<color name="textPrimaryLight">#000000</color>
|
||||
<color name="textSecondaryLight">#818181</color>
|
||||
|
||||
<color name="themePrimaryDark">#000000</color>
|
||||
<color name="themeSecondaryDark">#202020</color>
|
||||
<color name="themeSecondaryDark">#303030</color>
|
||||
<color name="themeTertiaryDark">#424242</color>
|
||||
|
||||
<color name="themePrimaryLight">#FFFFFF</color>
|
||||
<color name="themeSecondaryLight">#202020</color>
|
||||
<color name="themeTertiaryLight">#424242</color>
|
||||
<color name="themeSecondaryLight">#FFFFFF</color>
|
||||
<color name="themeTertiaryLight">#424242</color> <!-- TODO find a better color -->
|
||||
|
||||
<color name="test">#424242</color>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user