Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
4971d0b1b8 | |||
a87e57c80e | |||
ee388bf5a5 | |||
8aaf8e3647 | |||
d645d75bbf | |||
f97491addd | |||
e08790aaa4 | |||
750a808fbe | |||
e51a80b78d | |||
a4eaea2918 | |||
cd3136715f | |||
15f1386b6e | |||
3bace6c155 | |||
61716f8eb4 | |||
a1410f7b80 | |||
953185425b | |||
a6d14044c2 | |||
f3b7ff066d | |||
040eb26dcf | |||
1a5d2b6561 | |||
92b60d660c | |||
a4eceeddc9 | |||
3e3a80442e | |||
5a1a07cd42 | |||
dbfdaffe99 | |||
58eb217ab7 | |||
24f920c05f | |||
6301308d76 | |||
8e205fa889 | |||
e9bdcee443 | |||
b214cfccb2 | |||
404ddd58b8 | |||
137ff7df0c | |||
b4071d7456 | |||
5e6e6cfde6 | |||
ffeb09a37f |
18
README.md
@ -1,12 +1,16 @@
|
||||
# ProjectLaogai "hso App"
|
||||
Some info about the app ...
|
||||
|
||||
ProjectLaogai is a app to access the timetable and the mensa menu of Hochschule Offenburg.
|
||||
## Features
|
||||
* look up what you can eat in the mensa
|
||||
* check your timetable
|
||||
* probably many many bugs
|
||||
* check out the mensa menu of this and next week
|
||||
* access your timetable
|
||||
* open moodle
|
||||
* probably some funny bugs
|
||||
|
||||
## Screenshots
|
||||
[<img src="https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project_Laogai/ProjectLaogai_HomeScreen.png" width=180>](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project_Laogai/ProjectLaogai_HomeScreen.png)
|
||||
[<img src="https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project_Laogai/ProjectLaogai_Mensa.png" width=180>](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project_Laogai/ProjectLaogai_Mensa.png)
|
||||
[<img src="https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project_Laogai/ProjectLaogai_Timetable.png" width=180>](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project_Laogai/ProjectLaogai_Timetable.png)
|
||||
[<img src="https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project_Laogai/ProjectLaogai_Settings.png" width=180>](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project_Laogai/ProjectLaogai_Settings.png)
|
||||
[<img src="https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project_Laogai/ProjectLaogai_NavDrawer.png" width=180>](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project_Laogai/ProjectLaogai_NavDrawer.png)
|
||||
|
||||
|
||||
ProjectLaogai © 2018 mosad www.mosad.xyz, Project by [@Seil0](https://git.mosad.xyz/Seil0)
|
||||
ProjectLaogai © 2019 mosad [www.mosad.xyz](http://www.mosad.xyz), Project by [@Seil0](https://git.mosad.xyz/Seil0)
|
@ -12,15 +12,20 @@ android {
|
||||
applicationId "org.mosad.seil0.projectlaogai"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 9
|
||||
versionName "0.3.1"
|
||||
versionCode 12
|
||||
versionName "0.4.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "build_time", buildTime()
|
||||
setProperty("archivesBaseName", "projectlaogai-$versionName")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
}
|
||||
@ -29,17 +34,22 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation 'org.jetbrains.anko:anko-commons:0.10.8'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
|
||||
implementation 'org.jsoup:jsoup:1.11.3'
|
||||
implementation 'org.jetbrains.anko:anko-commons:0.10.8'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation 'com.afollestad:aesthetic:1.0.0-beta05'
|
||||
implementation 'com.afollestad.material-dialogs:core:2.0.0-rc5'
|
||||
implementation 'com.afollestad.material-dialogs:color:2.0.0-rc5'
|
||||
implementation 'com.afollestad.material-dialogs:core:2.6.0'
|
||||
implementation 'com.afollestad.material-dialogs:color:2.6.0'
|
||||
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
}
|
||||
|
||||
static def buildTime() {
|
||||
return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
|
||||
}
|
@ -29,30 +29,29 @@ import android.view.MenuItem
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.afollestad.aesthetic.Aesthetic
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.app_bar_main.*
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorAccent
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorPrimary
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cCourse
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.coursesCacheTime
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.mensaCacheTime
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.timetableCacheTime
|
||||
import org.mosad.seil0.projectlaogai.controller.TCoRAPIController
|
||||
import org.mosad.seil0.projectlaogai.fragments.*
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.*
|
||||
import java.sql.Date
|
||||
import java.util.*
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
private val mensaParser = MensaParser()
|
||||
private val timeTableParser = TimeTableParser()
|
||||
|
||||
private var weekMenus = ArrayList<Meal>()
|
||||
private var courseTTLinkList = ArrayList<CourseTTLink>()
|
||||
private var timeTableCurrentWeek = arrayOf<Array<Lesson>>()
|
||||
private var timeTableNextWeek = arrayOf<Array<Lesson>>()
|
||||
|
||||
private lateinit var course: CourseTTLink
|
||||
private var color: Int = Color.BLACK
|
||||
private var activeFragment: Fragment = HomeFragment() // the currently active fragment, home at the start
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Aesthetic.attach(this)
|
||||
@ -69,21 +68,23 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||
Aesthetic.config {
|
||||
colorPrimary(Color.BLACK)
|
||||
colorPrimaryDark(Color.BLACK)
|
||||
colorAccent(Color.parseColor("#FF1744"))
|
||||
apply()
|
||||
}
|
||||
|
||||
SettingsFragment().selectCourse(this)
|
||||
} else {
|
||||
Aesthetic.config {
|
||||
colorPrimary(color)
|
||||
colorPrimaryDark(color)
|
||||
colorPrimary(cColorPrimary)
|
||||
colorPrimaryDark(cColorPrimary)
|
||||
colorAccent(cColorAccent)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
|
||||
//init home fragment TODO make a abstract fragment class
|
||||
val homeFragment = HomeFragment()
|
||||
homeFragment.setMainActivity(this)
|
||||
//init home fragment
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, homeFragment)
|
||||
fragmentTransaction.replace(R.id.fragment_container, activeFragment)
|
||||
fragmentTransaction.commit()
|
||||
|
||||
val toggle = ActionBarDrawerToggle(
|
||||
@ -133,164 +134,85 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||
// Handle navigation view item clicks here.
|
||||
when (item.itemId) {
|
||||
R.id.nav_home -> {
|
||||
val homeFragment = HomeFragment()
|
||||
homeFragment.setMainActivity(this)
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, homeFragment)
|
||||
fragmentTransaction.commit()
|
||||
activeFragment = HomeFragment()
|
||||
}
|
||||
R.id.nav_mensa -> {
|
||||
val mensaFragment = MensaFragment()
|
||||
mensaFragment.setMainActivity(this)
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, mensaFragment)
|
||||
fragmentTransaction.commit()
|
||||
activeFragment = MensaFragment()
|
||||
}
|
||||
R.id.nav_timetable -> {
|
||||
val timeTableFragment = TimeTableFragment()
|
||||
timeTableFragment.setMainActivity(this)
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, timeTableFragment)
|
||||
fragmentTransaction.commit()
|
||||
|
||||
activeFragment = TimeTableFragment()
|
||||
}
|
||||
R.id.nav_moodle -> {
|
||||
val moodleFragment = MoodleFragment()
|
||||
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, moodleFragment)
|
||||
fragmentTransaction.commit()
|
||||
activeFragment = MoodleFragment()
|
||||
}
|
||||
R.id.nav_settings -> {
|
||||
val settingsFragment = SettingsFragment()
|
||||
settingsFragment.setMainActivity(this)
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, settingsFragment)
|
||||
fragmentTransaction.commit()
|
||||
activeFragment = SettingsFragment()
|
||||
}
|
||||
}
|
||||
|
||||
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, activeFragment)
|
||||
fragmentTransaction.commit()
|
||||
|
||||
drawer_layout.closeDrawer(GravityCompat.START)
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* update the gui with the data of the new selected course
|
||||
* save selected course and courseTTLink
|
||||
*/
|
||||
fun updateCourse(course: CourseTTLink) {
|
||||
println(course.course)
|
||||
println(course.courseTTLink)
|
||||
|
||||
this.course = course
|
||||
// save new selected course
|
||||
val sharedPref = getPreferences(MODE_PRIVATE) ?: return
|
||||
with (sharedPref.edit()) {
|
||||
putString(getString(R.string.save_key_course), course.course)
|
||||
putString(getString(R.string.save_key_courseTTLink), course.courseTTLink.replace("http", "https"))
|
||||
apply()
|
||||
}
|
||||
|
||||
timeTableCurrentWeek = timeTableParser.getTimeTable(course.courseTTLink.replace("http", "https"))
|
||||
}
|
||||
|
||||
/**
|
||||
* save the primary color
|
||||
*/
|
||||
fun saveColorPrimary(color : Int) {
|
||||
val sharedPref = getPreferences(MODE_PRIVATE) ?: return
|
||||
with (sharedPref.edit()) {
|
||||
putInt(getString(R.string.save_key_colorPrimary), color)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* load the mensa menus of the current week
|
||||
*/
|
||||
private fun load() {
|
||||
// load the settings
|
||||
PreferencesController.load(this) // this must be finished before doing anything else
|
||||
|
||||
// load saved course
|
||||
val sharedPref = getPreferences(MODE_PRIVATE) ?: return
|
||||
course = CourseTTLink(
|
||||
sharedPref.getString(getString(R.string.save_key_courseTTLink),
|
||||
"https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0")!!,
|
||||
sharedPref.getString(getString(R.string.save_key_course), "AI3")!!
|
||||
)
|
||||
val startupTime = measureTimeMillis {
|
||||
val tcor = TCoRAPIController(this)
|
||||
val currentTime = System.currentTimeMillis() / 1000
|
||||
val currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK)
|
||||
val cal = Calendar.getInstance()
|
||||
|
||||
// load saved color
|
||||
color = sharedPref.getInt(getString(R.string.save_key_colorPrimary), Color.BLACK)
|
||||
// timetable sunday workaround
|
||||
cal.time = Date(timetableCacheTime * 1000)
|
||||
val timetableCacheDay = cal.get(Calendar.DAY_OF_WEEK)
|
||||
|
||||
/**
|
||||
* load mensa, course timetable and courselist from the swfr/hso website
|
||||
* TODO make an API see https://git.mosad.xyz/Seil0/TheCitadelofRicks
|
||||
*/
|
||||
val time = measureTimeMillis {
|
||||
// TODO this sill backfire if someone has to update before the server finished updating the timetable at 0001/0101
|
||||
// update blocking if a) it`s monday and the last cache was not on a monday or b) the cache is older than 6 days
|
||||
if((currentDay == Calendar.MONDAY && timetableCacheDay != Calendar.MONDAY) || (System.currentTimeMillis() / 1000) - timetableCacheTime > 518400) {
|
||||
println("updating timetable after sunday!")
|
||||
val jobA = tcor.getTimetable(cCourse.courseName, 0)
|
||||
val jobB = tcor.getTimetable(cCourse.courseName, 1)
|
||||
|
||||
/* getting the course list should be faster than the timetable,
|
||||
* we need have time until the user opens the dialog
|
||||
*/
|
||||
doAsync {
|
||||
courseTTLinkList = timeTableParser.getCourseTTLinks()
|
||||
jobA.get()
|
||||
jobB.get()
|
||||
}
|
||||
|
||||
val jobMenus = doAsync {
|
||||
weekMenus = mensaParser.getMensaMenu()
|
||||
// mensa sunday workaround
|
||||
cal.time = Date(System.currentTimeMillis()) // reset to current time
|
||||
|
||||
// update blocking if it's sunday after 1500
|
||||
// TODO and the last update was before 1500
|
||||
if(currentDay == Calendar.SUNDAY && cal.get(Calendar.HOUR_OF_DAY) >= 15) {
|
||||
val jobA = tcor.getMensa()
|
||||
jobA.get()
|
||||
}
|
||||
|
||||
val jobTTCurrentWeek = doAsync {
|
||||
try {
|
||||
timeTableCurrentWeek = timeTableParser.getTimeTable(course.courseTTLink)
|
||||
} catch (e: Exception) {
|
||||
// get the cached files
|
||||
val cache = CacheController(this)
|
||||
cache.readStartCache(cCourse.courseName)
|
||||
|
||||
uiThread {
|
||||
MaterialDialog(this@MainActivity)
|
||||
.title(R.string.error)
|
||||
.message(R.string.no_tt_error)
|
||||
.show()
|
||||
}
|
||||
// check if an update is necessary
|
||||
if(currentTime - coursesCacheTime > 86400)
|
||||
tcor.getCoursesList()
|
||||
|
||||
e.stackTrace
|
||||
}
|
||||
if(currentTime - mensaCacheTime > 10800)
|
||||
tcor.getMensa()
|
||||
|
||||
if(currentTime - timetableCacheTime > 10800) {
|
||||
tcor.getTimetable(cCourse.courseName, 0)
|
||||
tcor.getTimetable(cCourse.courseName, 1)
|
||||
}
|
||||
|
||||
val jobTTNextWeek = doAsync {
|
||||
try {
|
||||
timeTableNextWeek = timeTableParser.getTimeTable(course.courseTTLink.replace("week=0","week=1"))
|
||||
} catch (e: Exception) {
|
||||
e.stackTrace
|
||||
}
|
||||
}
|
||||
|
||||
jobMenus.get()
|
||||
jobTTCurrentWeek.get()
|
||||
jobTTNextWeek.get()
|
||||
}
|
||||
println("Completed in $time ms")
|
||||
}
|
||||
|
||||
fun getCourseTTLinkList(): ArrayList<CourseTTLink>{
|
||||
return courseTTLinkList
|
||||
}
|
||||
|
||||
fun getTimeTableCurrentWeek(): Array<Array<Lesson>> {
|
||||
return timeTableCurrentWeek
|
||||
}
|
||||
|
||||
fun getTimeTableNextWeek(): Array<Array<Lesson>> {
|
||||
return timeTableNextWeek
|
||||
}
|
||||
|
||||
fun getWeekMenu(): ArrayList<Meal>{
|
||||
return weekMenus
|
||||
}
|
||||
|
||||
fun getCourse(): CourseTTLink {
|
||||
return course
|
||||
}
|
||||
|
||||
fun getColorPrimary(): Int {
|
||||
return color
|
||||
println("Completed in $startupTime ms")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* 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.controller
|
||||
|
||||
import android.content.Context
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonParser
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Course
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.MensaWeek
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.TimetableWeek
|
||||
import java.io.BufferedReader
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
class CacheController(cont: Context) {
|
||||
|
||||
private val context = cont
|
||||
|
||||
companion object {
|
||||
var coursesList = ArrayList<Course>()
|
||||
var mensaCurrentWeek = MensaWeek()
|
||||
var mensaNextWeek = MensaWeek()
|
||||
var timetables = ArrayList<TimetableWeek>()
|
||||
}
|
||||
|
||||
/**
|
||||
* read coursesList, mensa (current and next week), timetable (current and next week)
|
||||
* @param courseName the course name (e.g AI1)
|
||||
*/
|
||||
fun readStartCache(courseName: String) {
|
||||
readCoursesList()
|
||||
readMensa()
|
||||
readTimetable(courseName, 0)
|
||||
readTimetable(courseName, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* read the courses list from the cached file
|
||||
* add them to the coursesList object
|
||||
*/
|
||||
fun readCoursesList() {
|
||||
val file = File(context.filesDir, "courses.json")
|
||||
|
||||
// make sure the file exists
|
||||
if (!file.exists())
|
||||
TCoRAPIController(context).getCoursesList().get()
|
||||
|
||||
val fileReader = FileReader(file)
|
||||
val bufferedReader = BufferedReader(fileReader)
|
||||
val coursesObject = JsonParser().parse(bufferedReader.readLine()).asJsonObject
|
||||
|
||||
coursesList = Gson().fromJson(coursesObject.getAsJsonArray("courses"), object : TypeToken<List<Course>>() {}.type)
|
||||
}
|
||||
|
||||
/**
|
||||
* read current and next weeks mensa menus from the cached file
|
||||
*/
|
||||
fun readMensa() {
|
||||
val file = File(context.filesDir, "mensa.json")
|
||||
|
||||
// make sure the file exists
|
||||
if (!file.exists()) {
|
||||
TCoRAPIController(context).getMensa().get()
|
||||
}
|
||||
|
||||
|
||||
val fileReader = FileReader(file)
|
||||
val bufferedReader = BufferedReader(fileReader)
|
||||
val mensaObject = JsonParser().parse(bufferedReader.readLine()).asJsonObject
|
||||
|
||||
val currentWeek = mensaObject.getAsJsonObject("currentWeek")
|
||||
val nextWeek = mensaObject.getAsJsonObject("nextWeek")
|
||||
|
||||
mensaCurrentWeek = Gson().fromJson(currentWeek, MensaWeek().javaClass)
|
||||
mensaNextWeek = Gson().fromJson(nextWeek, MensaWeek().javaClass)
|
||||
}
|
||||
|
||||
/**
|
||||
* read the weeks timetable from the cached file
|
||||
* @param courseName the course name (e.g AI1)
|
||||
* @param week the week to read (0 for the current and so on)
|
||||
*/
|
||||
fun readTimetable(courseName: String, week: Int) {
|
||||
val file = File(context.filesDir, "timetable-$courseName-$week.json")
|
||||
|
||||
// make sure the file exists
|
||||
if (!file.exists())
|
||||
TCoRAPIController(context).getTimetable(courseName, week).get()
|
||||
|
||||
val fileReader = FileReader(file)
|
||||
val bufferedReader = BufferedReader(fileReader)
|
||||
val timetableObject = JsonParser().parse(bufferedReader.readLine()).asJsonObject
|
||||
|
||||
// make sure you add the single weeks in the exact order!
|
||||
if (timetables.size == week) {
|
||||
timetables.add(Gson().fromJson(timetableObject.getAsJsonObject("timetable"), TimetableWeek().javaClass))
|
||||
} else if (timetables.size >= week) {
|
||||
timetables[week] = Gson().fromJson(timetableObject.getAsJsonObject("timetable"), TimetableWeek().javaClass)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/**
|
||||
* 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.controller
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import org.jetbrains.anko.defaultSharedPreferences
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Course
|
||||
|
||||
/**
|
||||
* The PreferencesController class
|
||||
* contains all preferences and global variables that exist in this app
|
||||
*/
|
||||
class PreferencesController {
|
||||
|
||||
companion object {
|
||||
var coursesCacheTime: Long = 0
|
||||
var mensaCacheTime: Long = 0
|
||||
var timetableCacheTime: Long = 0
|
||||
var cColorPrimary: Int = Color.BLACK
|
||||
var cColorAccent: Int = Color.parseColor("#3F51B5")
|
||||
var cCourse = Course("https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0", "AI3")
|
||||
var cShowBuffet = true
|
||||
|
||||
// the save function
|
||||
fun save(context: Context) {
|
||||
val sharedPref = context.defaultSharedPreferences
|
||||
|
||||
// save the update times (cache)
|
||||
with (sharedPref.edit()) {
|
||||
putLong(context.getString(R.string.save_key_coursesCacheTime),
|
||||
coursesCacheTime
|
||||
)
|
||||
putLong(context.getString(R.string.save_key_mensaCacheTime),
|
||||
mensaCacheTime
|
||||
)
|
||||
putLong(context.getString(R.string.save_key_timetableCacheTime),
|
||||
timetableCacheTime
|
||||
)
|
||||
apply()
|
||||
}
|
||||
|
||||
// save the course
|
||||
with (sharedPref.edit()) {
|
||||
putString(context.getString(R.string.save_key_course), cCourse.courseName)
|
||||
putString(context.getString(R.string.save_key_courseTTLink), cCourse.courseLink)
|
||||
apply()
|
||||
}
|
||||
|
||||
// save the primary color
|
||||
with (sharedPref.edit()) {
|
||||
putInt(context.getString(R.string.save_key_colorPrimary),
|
||||
cColorPrimary
|
||||
)
|
||||
apply()
|
||||
}
|
||||
|
||||
// save the accent color
|
||||
with (sharedPref.edit()) {
|
||||
putInt(context.getString(R.string.save_key_colorAccent),
|
||||
cColorAccent
|
||||
)
|
||||
apply()
|
||||
}
|
||||
|
||||
// save showBuffet
|
||||
with (sharedPref.edit()) {
|
||||
putBoolean(context.getString(R.string.save_key_showBuffet),
|
||||
cShowBuffet
|
||||
)
|
||||
apply()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// the load function
|
||||
fun load(context: Context) {
|
||||
val sharedPref = context.defaultSharedPreferences
|
||||
|
||||
// load the update times (cache)
|
||||
coursesCacheTime = sharedPref.getLong(context.getString(
|
||||
R.string.save_key_coursesCacheTime
|
||||
), 0)
|
||||
mensaCacheTime = sharedPref.getLong(context.getString(
|
||||
R.string.save_key_mensaCacheTime
|
||||
), 0)
|
||||
timetableCacheTime = sharedPref.getLong(context.getString(
|
||||
R.string.save_key_timetableCacheTime
|
||||
), 0)
|
||||
|
||||
// load saved course
|
||||
cCourse = Course(
|
||||
sharedPref.getString(context.getString(R.string.save_key_courseTTLink), "https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0")!!,
|
||||
sharedPref.getString(context.getString(R.string.save_key_course), "AI3")!!
|
||||
)
|
||||
|
||||
// load saved colors
|
||||
cColorPrimary = sharedPref.getInt(context.getString(
|
||||
R.string.save_key_colorPrimary
|
||||
), Color.BLACK)
|
||||
cColorAccent = sharedPref.getInt(context.getString(
|
||||
R.string.save_key_colorAccent
|
||||
), Color.parseColor("#3F51B5"))
|
||||
|
||||
// load showBuffet
|
||||
cShowBuffet = sharedPref.getBoolean(context.getString(
|
||||
R.string.save_key_showBuffet
|
||||
), true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* 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.controller
|
||||
|
||||
import android.content.Context
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.json.JSONObject
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.coursesCacheTime
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.mensaCacheTime
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.timetableCacheTime
|
||||
import java.io.*
|
||||
import java.net.URL
|
||||
|
||||
class TCoRAPIController(cont: Context) {
|
||||
private val context = cont
|
||||
|
||||
/**
|
||||
* get the json object from tcor api and write it as file (cache)
|
||||
*/
|
||||
fun getCoursesList() = doAsync {
|
||||
val url = URL("https://tcor.mosad.xyz/courses")
|
||||
val file = File(context.filesDir, "courses.json")
|
||||
|
||||
// read data from the API
|
||||
val coursesObject = JSONObject(url.readText()) //JSONObject(inReader.readLine())
|
||||
|
||||
// write the json object to a file
|
||||
val writer = BufferedWriter(FileWriter(file))
|
||||
writer.write(coursesObject.toString())
|
||||
writer.close()
|
||||
|
||||
// update cache time
|
||||
coursesCacheTime = System.currentTimeMillis() / 1000
|
||||
PreferencesController.save(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* get the json object from tcor api and write it as file (cache)
|
||||
*/
|
||||
fun getMensa() = doAsync {
|
||||
val url = URL("https://tcor.mosad.xyz/mensamenu")
|
||||
val file = File(context.filesDir, "mensa.json")
|
||||
|
||||
// read data from the API
|
||||
val mensaObject = JSONObject(url.readText()) //JSONObject(inReader.readLine())
|
||||
|
||||
// write the json object to a file
|
||||
val writer = BufferedWriter(FileWriter(file))
|
||||
writer.write(mensaObject.toString())
|
||||
writer.close()
|
||||
|
||||
// update cache time
|
||||
mensaCacheTime = System.currentTimeMillis() / 1000
|
||||
PreferencesController.save(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* get the json object from tcor api and write it as file (cache)
|
||||
*/
|
||||
fun getTimetable(courseName: String, week: Int) = doAsync {
|
||||
val url = URL("https://tcor.mosad.xyz/timetable?courseName=$courseName&week=$week")
|
||||
val file = File(context.filesDir, "timetable-$courseName-$week.json")
|
||||
|
||||
// read data from the API
|
||||
val mensaObject = JSONObject(url.readText()) //JSONObject(inReader.readLine())
|
||||
|
||||
// write the json object to a file
|
||||
val writer = BufferedWriter(FileWriter(file))
|
||||
writer.write(mensaObject.toString())
|
||||
writer.close()
|
||||
|
||||
// update cache time
|
||||
timetableCacheTime = System.currentTimeMillis() / 1000
|
||||
PreferencesController.save(context)
|
||||
}
|
||||
}
|
@ -22,20 +22,29 @@
|
||||
|
||||
package org.mosad.seil0.projectlaogai.fragments
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import kotlinx.android.synthetic.main.fragment_home.*
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
import org.mosad.seil0.projectlaogai.MainActivity
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.*
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonCardView
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.mensaCurrentWeek
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.timetables
|
||||
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.hsoparser.TimetableDay
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.DayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.LessonLinearLayout
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MealLinearLayout
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@ -44,19 +53,14 @@ import java.util.*
|
||||
*/
|
||||
class HomeFragment : Fragment() {
|
||||
|
||||
private lateinit var linLayoutTimeTable: LinearLayout
|
||||
private var mainActivity = MainActivity()
|
||||
private val formatter = SimpleDateFormat("E dd.MM", Locale.getDefault())
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
val view: View = inflater.inflate(R.layout.fragment_home, container, false)
|
||||
|
||||
// init UI elements
|
||||
linLayoutTimeTable = view.findViewById(R.id.linLayoutTimeTable)
|
||||
|
||||
//setText()
|
||||
addCurrentMensaMenu()
|
||||
addCurrentTimeTable()
|
||||
addMensaMenu().get()
|
||||
addTimeTable()
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
return view
|
||||
@ -65,53 +69,46 @@ class HomeFragment : Fragment() {
|
||||
/**
|
||||
* add the current mensa meal to the home screens
|
||||
*/
|
||||
private fun addCurrentMensaMenu() {
|
||||
doAsync {
|
||||
val dayMenus: ArrayList<Meal>
|
||||
val cal = Calendar.getInstance()
|
||||
private fun addMensaMenu() = doAsync {
|
||||
|
||||
var dayMeals: ArrayList<Meal>
|
||||
val cal = Calendar.getInstance()
|
||||
val mensaCardView = DayCardView(context!!)
|
||||
|
||||
uiThread {
|
||||
|
||||
if (cal.get(Calendar.HOUR_OF_DAY) < 15) {
|
||||
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK))
|
||||
dayMeals = mensaCurrentWeek.days[NotRetardedCalendar().getDayOfWeekIndex()].meals
|
||||
mensaCardView.setDayHeading(resources.getString(R.string.today_date, formatter.format(cal.time)))
|
||||
} else {
|
||||
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1)
|
||||
uiThread {
|
||||
txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow)
|
||||
txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow)
|
||||
}
|
||||
dayMeals = mensaCurrentWeek.days[NotRetardedCalendar().getTomorrowWeekIndex()].meals
|
||||
cal.add(Calendar.DATE, 1)
|
||||
mensaCardView.setDayHeading(resources.getString(R.string.tomorrow_date, formatter.format(cal.time)))
|
||||
}
|
||||
|
||||
uiThread {
|
||||
if (dayMeals.size >= 2) {
|
||||
// get the index of the first meal, not a "Schneller Teller"
|
||||
loop@ for ((i, meal) in dayMeals.withIndex()) {
|
||||
if (meal.heading.contains("Essen")) {
|
||||
|
||||
if (dayMenus.size >= 2) {
|
||||
// get the index of the first meal, not a "Schneller Teller"
|
||||
loop@ for ((i, meal) in dayMenus.withIndex()) {
|
||||
if (meal.heading.contains("Essen")) {
|
||||
for ((j, part) in dayMenus[i].parts.withIndex()) {
|
||||
txtViewMenu1.append(part)
|
||||
if (j < (dayMenus[i].parts.size - 2))
|
||||
txtViewMenu1.append("\n")
|
||||
}
|
||||
val meal1Layout = MealLinearLayout(context)
|
||||
meal1Layout.setMeal(dayMeals[i])
|
||||
mensaCardView.getLinLayoutDay().addView(meal1Layout)
|
||||
|
||||
for ((j, part) in dayMenus[i + 1].parts.withIndex()) {
|
||||
txtViewMenu2.append(part)
|
||||
if (j < (dayMenus[i + 1].parts.size - 2))
|
||||
txtViewMenu2.append("\n")
|
||||
}
|
||||
val meal2Layout = MealLinearLayout(context)
|
||||
meal2Layout.setMeal(dayMeals[i + 1])
|
||||
meal2Layout.disableDivider()
|
||||
mensaCardView.getLinLayoutDay().addView(meal2Layout)
|
||||
|
||||
break@loop
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (txtView_Menu1Heading.text == resources.getString(R.string.meal_1_tomorrow)) {
|
||||
txtViewMenu1.text = resources.getString(R.string.no_meal_tomorrow)
|
||||
txtViewMenu2.text = resources.getString(R.string.no_meal_tomorrow)
|
||||
} else {
|
||||
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
|
||||
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
|
||||
break@loop
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
mensaCardView.getLinLayoutDay().addView(getNoCard(resources.getString(R.string.mensa_closed)))
|
||||
}
|
||||
|
||||
linLayout_Home.addView(mensaCardView)
|
||||
}
|
||||
|
||||
}
|
||||
@ -119,38 +116,28 @@ class HomeFragment : Fragment() {
|
||||
/**
|
||||
* add the current timetable to the home screen
|
||||
*/
|
||||
private fun addCurrentTimeTable() {
|
||||
private fun addTimeTable() = doAsync {
|
||||
val dayIndex = NotRetardedCalendar().getDayOfWeekIndex()
|
||||
val cal = Calendar.getInstance()
|
||||
var dayCardView: DayCardView
|
||||
|
||||
if (mainActivity.getTimeTableCurrentWeek().isNotEmpty() && dayIndex < 6) {
|
||||
uiThread {
|
||||
|
||||
val timeTableDay = mainActivity.getTimeTableCurrentWeek()[dayIndex]
|
||||
if (timetables.isNotEmpty() && dayIndex < 6) {
|
||||
|
||||
for (i in 0..5) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
// first check the current day
|
||||
dayCardView = addDayTimetable(timetables[0].days[dayIndex])
|
||||
dayCardView.setDayHeading(resources.getString(R.string.today_date, formatter.format(cal.time)))
|
||||
|
||||
lessonCardView.getTxtViewLesson().text = resources.getString(R.string.string_new_line, timeTableDay[i].lessonSubject)
|
||||
lessonCardView.getTxtViewLesson().append(timeTableDay[i].lessonTeacher + "\n")
|
||||
lessonCardView.getTxtViewLesson().append(timeTableDay[i].lessonRoom)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
// if there are no lessons try to find the next day with a lesson
|
||||
if (dayCardView.getLinLayoutDay().childCount <= 1)
|
||||
dayCardView = findNextDay(0, dayIndex + 1)
|
||||
|
||||
if(lessonCardView.getTxtViewLesson().text.length > 2)
|
||||
linLayoutTimeTable.addView(lessonCardView)
|
||||
}
|
||||
|
||||
// add a card if there is no lesson today
|
||||
if (linLayoutTimeTable.childCount == 0) {
|
||||
// TODO we could display the next day with a lecture
|
||||
val noLessonCardView = LessonCardView(context!!, null)
|
||||
noLessonCardView.getTxtViewLesson().text = resources.getString(R.string.no_lesson_today)
|
||||
linLayoutTimeTable.addView(noLessonCardView)
|
||||
}
|
||||
} else {
|
||||
if (dayIndex == 6) {
|
||||
linLayout_Home.addView(dayCardView)
|
||||
} else if (dayIndex == 6) {
|
||||
// if that's the case it's sunday
|
||||
val noLessonCardView = LessonCardView(context!!, null)
|
||||
noLessonCardView.getTxtViewLesson().text = resources.getString(R.string.no_lesson_today)
|
||||
linLayoutTimeTable.addView(noLessonCardView)
|
||||
dayCardView = findNextDay(1, 0)
|
||||
linLayout_Home.addView(dayCardView)
|
||||
} else {
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.error)
|
||||
@ -160,10 +147,88 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setMainActivity(mainActivity: MainActivity) {
|
||||
this.mainActivity = mainActivity
|
||||
/**
|
||||
* add the timetable of one day to the home-screen
|
||||
* @param dayTimetable the day you wish to add
|
||||
*/
|
||||
private fun addDayTimetable(dayTimetable: TimetableDay) : DayCardView{
|
||||
var helpLesson = LessonLinearLayout(context)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
|
||||
for ((tsIndex, timeslot) in dayTimetable.timeslots.withIndex()) {
|
||||
|
||||
for(lesson in timeslot) {
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
val lessonLayout = LessonLinearLayout(context)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
if (lesson != timeslot.last()) {
|
||||
lessonLayout.disableDivider()
|
||||
}
|
||||
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helpLesson.disableDivider()
|
||||
|
||||
return dayCardView
|
||||
}
|
||||
|
||||
/**
|
||||
* find the next day with a lesson
|
||||
* @param startWeekIndex the week you want to start searching
|
||||
* @param startDayIndex the day index you want to start searching
|
||||
* @return a DayCardView with all lessons added
|
||||
*/
|
||||
private fun findNextDay(startWeekIndex: Int, startDayIndex: Int) : DayCardView{
|
||||
val cal = Calendar.getInstance()
|
||||
var dayCardView = DayCardView(context!!)
|
||||
var dayTimetable: TimetableDay? = null
|
||||
var dayIndexSearch = startDayIndex
|
||||
var weekIndexSearch = startWeekIndex
|
||||
loop@ while (dayTimetable == null && weekIndexSearch <= timetables.size) {
|
||||
for (i in (dayIndexSearch) ..5) {
|
||||
dayTimetable = timetables[weekIndexSearch].days[i]
|
||||
cal.add(Calendar.DATE, 1)
|
||||
|
||||
// add the timetable to the card, if it contains at least one lesson break!
|
||||
dayCardView = addDayTimetable(dayTimetable)
|
||||
dayCardView.setDayHeading(formatter.format(cal.time))
|
||||
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1)
|
||||
return dayCardView
|
||||
}
|
||||
dayIndexSearch = 0
|
||||
weekIndexSearch++
|
||||
cal.add(Calendar.DATE, 1)
|
||||
}
|
||||
|
||||
dayCardView.setDayHeading(formatter.format(Calendar.getInstance().time))
|
||||
dayCardView.getLinLayoutDay().addView(getNoCard(resources.getString(R.string.no_lesson_today))) // if there is no lecture at all show the no lesson card
|
||||
return dayCardView
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text the text to show on the card
|
||||
* @return a TextView with the text and all needed parameters
|
||||
*/
|
||||
private fun getNoCard(text: String): TextView {
|
||||
val noLesson = TextView(context)
|
||||
noLesson.text = text
|
||||
noLesson.setTextColor(ContextCompat.getColor(context!!, R.color.textPrimary))
|
||||
noLesson.textSize = 18.0F
|
||||
noLesson.setTypeface(null, Typeface.BOLD)
|
||||
noLesson.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
noLesson.setPadding(7,7,7,7)
|
||||
|
||||
return noLesson
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,18 +23,22 @@
|
||||
package org.mosad.seil0.projectlaogai.fragments
|
||||
|
||||
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 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.MainActivity
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MenuCardView
|
||||
import java.util.*
|
||||
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.DayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.MealLinearLayout
|
||||
|
||||
/**
|
||||
* The mensa controller class
|
||||
@ -43,77 +47,54 @@ import java.util.*
|
||||
class MensaFragment : Fragment() {
|
||||
|
||||
private lateinit var linLayoutMensaFragment: LinearLayout
|
||||
private var mainActivity = MainActivity()
|
||||
|
||||
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)
|
||||
linLayoutMensaFragment = view.findViewById(R.id.linLayout_Mensa)
|
||||
|
||||
addCurrentWeek()
|
||||
// add the current week (week starts on sunday)
|
||||
val dayCurrent = if(NotRetardedCalendar().getDayOfWeekIndex() == 6) 0 else NotRetardedCalendar().getDayOfWeekIndex()
|
||||
addWeek(mensaCurrentWeek, dayCurrent).get()
|
||||
|
||||
// add the next week
|
||||
addWeek(mensaNextWeek, 0).get()
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
private fun addCurrentWeek() {
|
||||
/**
|
||||
* add all menus from dayStart to Friday for a given week
|
||||
*/
|
||||
private fun addWeek(menusWeek: MensaWeek, dayStart: Int) = doAsync {
|
||||
|
||||
doAsync {
|
||||
uiThread {
|
||||
|
||||
uiThread {
|
||||
// only add the days dayStart to Fri since the mensa is closed on Sat/Sun
|
||||
for (dayIndex in dayStart..4) {
|
||||
var helpMeal = MealLinearLayout(context)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(menusWeek.days[dayIndex].meals[0].day)
|
||||
|
||||
for(day in Calendar.getInstance().get(Calendar.DAY_OF_WEEK)..7) {
|
||||
for (meal in menusWeek.days[dayIndex].meals) {
|
||||
val mealLayout = MealLinearLayout(context)
|
||||
mealLayout.setMeal(meal)
|
||||
|
||||
val strDay: String = when(day) {
|
||||
Calendar.MONDAY -> "Mon"
|
||||
Calendar.TUESDAY -> "Die"
|
||||
Calendar.WEDNESDAY -> "Mit"
|
||||
Calendar.THURSDAY -> "Don"
|
||||
Calendar.FRIDAY -> "Fre"
|
||||
Calendar.SATURDAY -> "Sam"
|
||||
else -> "TODAY" // the app will likely crash here
|
||||
if(meal.heading != "Buffet" || cShowBuffet) {
|
||||
dayCardView.getLinLayoutDay().addView(mealLayout)
|
||||
helpMeal = mealLayout
|
||||
}
|
||||
|
||||
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
||||
var add = false
|
||||
|
||||
for (meal in mainActivity.getWeekMenu()) {
|
||||
//println("Day: " + meal.day)
|
||||
if (meal.day.contains(strDay)) {
|
||||
|
||||
val menuViewMenu = MenuCardView(context!!, null)
|
||||
menuViewMenu.setMenuHeading(meal.heading)
|
||||
|
||||
for ((i, part) in meal.parts.withIndex()) {
|
||||
menuViewMenu.getTxtViewMenu().append(part)
|
||||
if(i < (meal.parts.size - 2))
|
||||
menuViewMenu.getTxtViewMenu().append("\n")
|
||||
}
|
||||
|
||||
cardViewMensaDay.setDayHeading(meal.day)
|
||||
cardViewMensaDay.getLinLayoutMensaDay().addView(menuViewMenu)
|
||||
add = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(add)
|
||||
linLayoutMensaFragment.addView(cardViewMensaDay)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
helpMeal.disableDivider()
|
||||
|
||||
if(dayCardView.getLinLayoutDay().childCount > 1)
|
||||
linLayout_Mensa.addView(dayCardView)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun setMainActivity(mainActivity: MainActivity) {
|
||||
this.mainActivity = mainActivity
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -22,13 +22,14 @@
|
||||
|
||||
package org.mosad.seil0.projectlaogai.fragments
|
||||
|
||||
import android.graphics.Color
|
||||
import android.content.Context
|
||||
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.Switch
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.afollestad.aesthetic.Aesthetic
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.color.colorChooser
|
||||
@ -37,10 +38,18 @@ import com.afollestad.materialdialogs.list.listItems
|
||||
import kotlinx.android.synthetic.main.fragment_settings.*
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
import org.mosad.seil0.projectlaogai.MainActivity
|
||||
import org.mosad.seil0.projectlaogai.BuildConfig
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorAccent
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorPrimary
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cCourse
|
||||
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cShowBuffet
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.CourseTTLink
|
||||
import java.util.ArrayList
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController
|
||||
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.coursesList
|
||||
import org.mosad.seil0.projectlaogai.controller.TCoRAPIController
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* The settings controller class
|
||||
@ -50,12 +59,10 @@ class SettingsFragment : Fragment() {
|
||||
|
||||
private lateinit var linLayoutUser: LinearLayout
|
||||
private lateinit var linLayoutCourse: LinearLayout
|
||||
private lateinit var linLayoutInfo: LinearLayout
|
||||
private lateinit var linLayoutMainColor: LinearLayout
|
||||
private lateinit var viewPrimaryColor: View
|
||||
private lateinit var courseTTLinkList: ArrayList<CourseTTLink>
|
||||
private var mainActivity = MainActivity()
|
||||
|
||||
private lateinit var linLayoutAbout: LinearLayout
|
||||
private lateinit var linLayoutPrimaryColor: LinearLayout
|
||||
private lateinit var linLayoutAccentColor: LinearLayout
|
||||
private lateinit var switchBuffet: Switch
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
@ -63,9 +70,10 @@ class SettingsFragment : Fragment() {
|
||||
|
||||
linLayoutUser = view.findViewById(R.id.linLayout_User)
|
||||
linLayoutCourse = view.findViewById(R.id.linLayout_Course)
|
||||
linLayoutInfo = view.findViewById(R.id.linLayout_Info)
|
||||
linLayoutMainColor = view.findViewById(R.id.linLayout_MainColor)
|
||||
viewPrimaryColor = view.findViewById(R.id.view_PrimaryColor)
|
||||
linLayoutAbout = view.findViewById(R.id.linLayout_About)
|
||||
linLayoutPrimaryColor = view.findViewById(R.id.linLayout_PrimaryColor)
|
||||
linLayoutAccentColor = view.findViewById(R.id.linLayout_AccentColor)
|
||||
switchBuffet = view.findViewById(R.id.switch_buffet)
|
||||
|
||||
initActions()
|
||||
|
||||
@ -76,7 +84,9 @@ class SettingsFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
txtView_Course.text = mainActivity.getCourse().course
|
||||
txtView_Course.text = cCourse.courseName
|
||||
txtView_AboutDesc.text = resources.getString(R.string.about_version, BuildConfig.VERSION_NAME, getString(R.string.build_time))
|
||||
switch_buffet.isChecked = cShowBuffet // init switch
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,24 +98,89 @@ class SettingsFragment : Fragment() {
|
||||
}
|
||||
|
||||
linLayoutCourse.setOnClickListener {
|
||||
// open a new dialog
|
||||
val courseList = ArrayList<String>()
|
||||
selectCourse(context!!)
|
||||
txtView_Course.text = cCourse.courseName // update txtView
|
||||
}
|
||||
|
||||
courseTTLinkList = mainActivity.getCourseTTLinkList()
|
||||
courseTTLinkList.forEach { (_, course) ->
|
||||
courseList.add(course)
|
||||
}
|
||||
linLayoutAbout.setOnClickListener {
|
||||
// open a new info dialog
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.about_dialog_heading)
|
||||
.message(R.string.about_dialog_text)
|
||||
.show()
|
||||
}
|
||||
|
||||
MaterialDialog(context!!).listItems(items = courseList){ _, index, text ->
|
||||
txtView_Course.text = text // update txtView
|
||||
linLayoutPrimaryColor.setOnClickListener {
|
||||
// open a new color chooser dialog
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.primary_color)
|
||||
.colorChooser(DataTypes().primaryColors, allowCustomArgb = true, initialSelection = cColorPrimary) { _, color ->
|
||||
view_PrimaryColor.setBackgroundColor(color)
|
||||
Aesthetic.config {
|
||||
colorPrimary(color)
|
||||
colorPrimaryDark(color)
|
||||
apply()
|
||||
}
|
||||
|
||||
val dialog = MaterialDialog(context!!).cancelable(false)
|
||||
cColorPrimary = color
|
||||
PreferencesController.save(context!!)
|
||||
}
|
||||
.positiveButton(R.string.select)
|
||||
.show()
|
||||
}
|
||||
|
||||
linLayoutAccentColor.setOnClickListener {
|
||||
// open a new color chooser dialog
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.accent_color)
|
||||
.colorChooser(DataTypes().accentColors, allowCustomArgb = true, initialSelection = cColorAccent) { _, color ->
|
||||
view_AccentColor.setBackgroundColor(color)
|
||||
Aesthetic.config {
|
||||
colorAccent(color)
|
||||
apply()
|
||||
}
|
||||
|
||||
cColorAccent = color
|
||||
PreferencesController.save(context!!)
|
||||
}
|
||||
.positiveButton(R.string.select)
|
||||
.show()
|
||||
}
|
||||
|
||||
switchBuffet.setOnClickListener {
|
||||
cShowBuffet = switchBuffet.isChecked
|
||||
PreferencesController.save(context!!)
|
||||
println(switchBuffet.isChecked)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun selectCourse(context: Context) {
|
||||
val courseNameList = ArrayList<String>()
|
||||
coursesList.forEach { (_, courseName) ->
|
||||
courseNameList.add(courseName)
|
||||
}
|
||||
|
||||
// open a new dialog
|
||||
MaterialDialog(context)
|
||||
.title(R.string.select_course)
|
||||
.listItems(items = courseNameList) { _, index, _ ->
|
||||
|
||||
val dialog = MaterialDialog(context).cancelable(false)
|
||||
.cancelOnTouchOutside(false)
|
||||
.customView(R.layout.dialog_loading)
|
||||
dialog.show()
|
||||
|
||||
doAsync {
|
||||
mainActivity.updateCourse(courseTTLinkList[index])
|
||||
cCourse = coursesList[index] // set the course
|
||||
PreferencesController.save(context)
|
||||
|
||||
// update current & next weeks timetable
|
||||
TCoRAPIController(context).getTimetable(cCourse.courseName, 0)
|
||||
TCoRAPIController(context).getTimetable(cCourse.courseName, 1)
|
||||
|
||||
CacheController(context).readTimetable(cCourse.courseName, 0)
|
||||
CacheController(context).readTimetable(cCourse.courseName, 1)
|
||||
|
||||
uiThread {
|
||||
dialog.dismiss()
|
||||
@ -114,39 +189,6 @@ class SettingsFragment : Fragment() {
|
||||
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
linLayoutInfo.setOnClickListener {
|
||||
// open a new info dialog
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.about)
|
||||
.message(R.string.about_text)
|
||||
.show()
|
||||
}
|
||||
|
||||
linLayoutMainColor.setOnClickListener {
|
||||
// open a new color chooser dialog
|
||||
val colors = intArrayOf(Color.BLACK, Color.DKGRAY, Color.RED, Color.GREEN, Color.YELLOW)
|
||||
|
||||
MaterialDialog(context!!)
|
||||
.title(R.string.primary_color)
|
||||
.colorChooser(colors, allowCustomArgb = true,initialSelection = mainActivity.getColorPrimary()) { _, color ->
|
||||
viewPrimaryColor.setBackgroundColor(color)
|
||||
Aesthetic.config {
|
||||
colorPrimary(color)
|
||||
colorPrimaryDark(color)
|
||||
apply()
|
||||
}
|
||||
|
||||
mainActivity.saveColorPrimary(color)
|
||||
}
|
||||
.positiveButton(R.string.select)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun setMainActivity(mainActivity: MainActivity) {
|
||||
this.mainActivity = mainActivity
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,21 +22,19 @@
|
||||
|
||||
package org.mosad.seil0.projectlaogai.fragments
|
||||
|
||||
import android.graphics.Color
|
||||
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 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.MainActivity
|
||||
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.MensaDayCardView
|
||||
import org.mosad.seil0.projectlaogai.uicomponents.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@ -46,17 +44,12 @@ import java.util.*
|
||||
*/
|
||||
class TimeTableFragment : Fragment() {
|
||||
|
||||
private lateinit var linLayoutTTFragment: LinearLayout
|
||||
private var mainActivity = MainActivity()
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
val view: View = inflater.inflate(R.layout.fragment_time_table, container, false)
|
||||
val view: View = inflater.inflate(R.layout.fragment_timetable, container, false)
|
||||
|
||||
linLayoutTTFragment = view.findViewById(R.id.linLayout_TTFragment)
|
||||
|
||||
if (mainActivity.getTimeTableCurrentWeek().isNotEmpty()) {
|
||||
addCurrentWeek()
|
||||
if (timetables[0].days.isNotEmpty() && timetables[1].days.isNotEmpty()) {
|
||||
addWeeks()
|
||||
} else {
|
||||
// TODO show card with error msg
|
||||
}
|
||||
@ -65,86 +58,87 @@ 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() = doAsync {
|
||||
val dayIndex = NotRetardedCalendar().getDayOfWeekIndex()
|
||||
val formatter = SimpleDateFormat("E dd.MM", Locale.GERMANY) // TODO change to android call when min api is 24
|
||||
val formatter = SimpleDateFormat("E dd.MM", Locale.getDefault()) // TODO change to android call when min api is 24
|
||||
val calendar = Calendar.getInstance()
|
||||
|
||||
doAsync {
|
||||
uiThread {
|
||||
|
||||
uiThread {
|
||||
// add the current week
|
||||
for (day in dayIndex..5) {
|
||||
var helpLesson = LessonLinearLayout(context)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(formatter.format(calendar.time))
|
||||
|
||||
// add current weeks days
|
||||
for(day in dayIndex..5) {
|
||||
val cardViewTimeTableDay = MensaDayCardView(context!!, null)
|
||||
cardViewTimeTableDay.setDayHeading(formatter.format(calendar.time))
|
||||
// for each timeslot of the day
|
||||
for ((tsIndex, timeslot) in timetables[0].days[day].timeslots.withIndex()) {
|
||||
|
||||
// for each lessen of the day
|
||||
for((i, lesson) in mainActivity.getTimeTableCurrentWeek()[day].withIndex()) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.setBackgroundColor(Color.TRANSPARENT)
|
||||
for(lesson in timeslot) {
|
||||
|
||||
lessonCardView.getTxtViewLesson().text = resources.getString(R.string.string_new_line, lesson.lessonSubject)
|
||||
lessonCardView.getTxtViewLesson().append(lesson.lessonTeacher + "\n")
|
||||
lessonCardView.getTxtViewLesson().append(lesson.lessonRoom)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
// only add the lesson if it contains data
|
||||
if(lessonCardView.getTxtViewLesson().text.length > 2)
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
}
|
||||
val lessonLayout = LessonLinearLayout(context)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
calendar.add(Calendar.DATE,1)
|
||||
if (lesson != timeslot.last())
|
||||
lessonLayout.disableDivider()
|
||||
|
||||
// if the day contains no lessons add a text "No lesson today"
|
||||
if (cardViewTimeTableDay.getLinLayoutMensaDay().childCount <= 1) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.setBackgroundColor(Color.TRANSPARENT)
|
||||
lessonCardView.getTxtViewLesson().text = resources.getString(R.string.no_lesson_today)
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
}
|
||||
|
||||
linLayoutTTFragment.addView(cardViewTimeTableDay)
|
||||
}
|
||||
|
||||
// TODO if there is no lesson at one day , show a no lesson card
|
||||
// add next weeks days, max number = dayIndex, if timetable was loaded
|
||||
if (mainActivity.getTimeTableNextWeek().isNotEmpty()) {
|
||||
calendar.add(Calendar.DATE,1) // before this we are at a sunday (no lecture on sundays!)
|
||||
|
||||
for(day in 0..(dayIndex - 1)) {
|
||||
|
||||
val cardViewTimeTableDay = MensaDayCardView(context!!, null)
|
||||
cardViewTimeTableDay.setDayHeading(formatter.format(calendar.time))
|
||||
|
||||
// for each lessen of the day
|
||||
for((i, lesson) in mainActivity.getTimeTableNextWeek()[day].withIndex()) {
|
||||
val lessonCardView = LessonCardView(context!!, null)
|
||||
lessonCardView.setBackgroundColor(Color.TRANSPARENT)
|
||||
|
||||
lessonCardView.getTxtViewLesson().text = resources.getString(R.string.string_new_line, lesson.lessonSubject)
|
||||
lessonCardView.getTxtViewLesson().append(lesson.lessonTeacher + "\n")
|
||||
lessonCardView.getTxtViewLesson().append(lesson.lessonRoom)
|
||||
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]
|
||||
|
||||
if(lessonCardView.getTxtViewLesson().text.length > 2)
|
||||
cardViewTimeTableDay.getLinLayoutMensaDay().addView(lessonCardView)
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
|
||||
calendar.add(Calendar.DATE,1)
|
||||
linLayoutTTFragment.addView(cardViewTimeTableDay)
|
||||
}
|
||||
}
|
||||
|
||||
helpLesson.disableDivider()
|
||||
calendar.add(Calendar.DATE, 1)
|
||||
|
||||
// if there are no lessons don't show the dayCardView
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1)
|
||||
linLayout_Timetable.addView(dayCardView)
|
||||
|
||||
}
|
||||
|
||||
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)) {
|
||||
var helpLesson = LessonLinearLayout(context!!)
|
||||
val dayCardView = DayCardView(context!!)
|
||||
dayCardView.setDayHeading(formatter.format(calendar.time))
|
||||
|
||||
// for each timeslot of the day
|
||||
for ((tsIndex, timeslot) in timetables[1].days[day].timeslots.withIndex()) {
|
||||
|
||||
for(lesson in timeslot) {
|
||||
|
||||
if(lesson.lessonSubject.isNotEmpty()) {
|
||||
|
||||
val lessonLayout = LessonLinearLayout(context!!)
|
||||
lessonLayout.setLesson(lesson, DataTypes().getTime()[tsIndex])
|
||||
dayCardView.getLinLayoutDay().addView(lessonLayout)
|
||||
|
||||
if (lesson != timeslot.last())
|
||||
lessonLayout.disableDivider()
|
||||
|
||||
helpLesson = lessonLayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helpLesson.disableDivider()
|
||||
calendar.add(Calendar.DATE, 1)
|
||||
|
||||
// if there are no lessons don't show the dayCardView
|
||||
if (dayCardView.getLinLayoutDay().childCount > 1)
|
||||
linLayout_Timetable.addView(dayCardView)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setMainActivity(mainActivity: MainActivity) {
|
||||
this.mainActivity = mainActivity
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,11 +22,55 @@
|
||||
|
||||
package org.mosad.seil0.projectlaogai.hsoparser
|
||||
|
||||
import android.graphics.Color
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class DataTypes {
|
||||
val times = arrayOf("8.00 - 9.30", "9.45 - 11.15" ,"11.35 - 13.05", "14.00 -15.30", "15.45 - 17.15", "17.30 - 19.00")
|
||||
|
||||
val primaryColors = intArrayOf(
|
||||
Color.parseColor("#E53935"),
|
||||
Color.parseColor("#E91E63"),
|
||||
Color.parseColor("#9C27B0"),
|
||||
Color.parseColor("#673AB7"),
|
||||
Color.parseColor("#3F51B5"),
|
||||
Color.parseColor("#2196F3"),
|
||||
Color.parseColor("#03A9F4"),
|
||||
Color.parseColor("#00BCD4"),
|
||||
Color.parseColor("#009688"),
|
||||
Color.parseColor("#4CAF50"),
|
||||
Color.parseColor("#8BC34A"),
|
||||
Color.parseColor("#CDDC39"),
|
||||
Color.parseColor("#FDD835"),
|
||||
Color.parseColor("#FFB300"),
|
||||
Color.parseColor("#FB8C00"),
|
||||
Color.parseColor("#FF5722"),
|
||||
Color.parseColor("#795548"),
|
||||
Color.parseColor("#9E9E9E"),
|
||||
Color.parseColor("#607B8B"),
|
||||
Color.parseColor("#000000")
|
||||
)
|
||||
|
||||
val accentColors = intArrayOf(
|
||||
Color.parseColor("#FF1744"),
|
||||
Color.parseColor("#F50057"),
|
||||
Color.parseColor("#D500F9"),
|
||||
Color.parseColor("#3F51B5"),
|
||||
Color.parseColor("#3D5AFE"),
|
||||
Color.parseColor("#2979FF"),
|
||||
Color.parseColor("#00B0FF"),
|
||||
Color.parseColor("#00E5FF"),
|
||||
Color.parseColor("#1DE9B6"),
|
||||
Color.parseColor("#00E676"),
|
||||
Color.parseColor("#C6FF00"),
|
||||
Color.parseColor("#FFD600"),
|
||||
Color.parseColor("#FFC400"),
|
||||
Color.parseColor("#FF9100"),
|
||||
Color.parseColor("#FF3D00"),
|
||||
Color.parseColor("#000000")
|
||||
)
|
||||
|
||||
init {
|
||||
// do something
|
||||
}
|
||||
@ -53,11 +97,30 @@ class NotRetardedCalendar {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun getTomorrowWeekIndex(): Int {
|
||||
return when(calendar.get(Calendar.DAY_OF_WEEK)) {
|
||||
Calendar.MONDAY -> 1
|
||||
Calendar.TUESDAY -> 2
|
||||
Calendar.WEDNESDAY -> 3
|
||||
Calendar.THURSDAY -> 4
|
||||
Calendar.FRIDAY -> 5
|
||||
Calendar.SATURDAY -> 6
|
||||
Calendar.SUNDAY -> 0
|
||||
else -> 7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Course(val courseLink: String, val courseName: String)
|
||||
|
||||
data class Meal(val day: String, val heading: String, val parts: ArrayList<String>, val additives: String)
|
||||
|
||||
data class Meals(val meals: ArrayList<Meal>)
|
||||
|
||||
data class MensaWeek(val days: Array<Meals> = Array(7) { Meals(ArrayList()) })
|
||||
|
||||
data class Lesson(val lessonSubject: String, val lessonTeacher: String, val lessonRoom:String, val lessonRemark: String)
|
||||
|
||||
data class CourseTTLink(val courseTTLink: String, val course: String)
|
||||
data class TimetableDay( val timeslots: Array<ArrayList<Lesson>> = Array(6) { ArrayList<Lesson>()})
|
||||
|
||||
data class Meal(val day: String, val heading: String, val parts: ArrayList<String>, val additives: String)
|
||||
data class TimetableWeek(val days: Array<TimetableDay> = Array(6) { TimetableDay() })
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* 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.hsoparser
|
||||
|
||||
import org.jsoup.Jsoup
|
||||
import java.util.*
|
||||
|
||||
class MensaParser {
|
||||
private var mealList = ArrayList<Meal>()
|
||||
|
||||
init {
|
||||
// do something
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the mensa menu for the whole week
|
||||
*/
|
||||
fun getMensaMenu(): ArrayList<Meal> {
|
||||
val menuHTML = Jsoup.connect("https://www.swfr.de/de/essen-trinken/speiseplaene/mensa-offenburg/").get()
|
||||
|
||||
menuHTML.select("#speiseplan-tabs").select("div.tab-content").select("div.menu-tagesplan").forEachIndexed { _, element ->
|
||||
val day = element.select("h3").text()
|
||||
for (i in 0 .. (element.select("div.row h4").size - 1)) {
|
||||
try {
|
||||
val heading = element.select("div.row h4")[i].text()
|
||||
val parts = ArrayList<String>(element.select("div.row").select("div.menu-info")[i].html().substringBefore("<span").replace("<br>", " ").split("\n"))
|
||||
val additives = element.select("div.row").select("div.menu-info")[i].select("span.show-with-allergenes").text()
|
||||
|
||||
mealList.add(Meal(day, heading, parts, additives))
|
||||
} catch (e: Exception) {
|
||||
// catch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mealList
|
||||
}
|
||||
|
||||
/**
|
||||
* return the mensa menu of a given day (Mon - Sat)
|
||||
*/
|
||||
fun getMensaMenuDay(mealList: ArrayList<Meal>, day: Int): ArrayList<Meal> {
|
||||
val dayMenus = ArrayList<Meal>()
|
||||
val strDay: String = when (day) {
|
||||
Calendar.MONDAY -> "Mon"
|
||||
Calendar.TUESDAY -> "Die"
|
||||
Calendar.WEDNESDAY -> "Mit"
|
||||
Calendar.THURSDAY -> "Don"
|
||||
Calendar.FRIDAY -> "Fre"
|
||||
Calendar.SATURDAY -> "Sam"
|
||||
else -> "TODAY"
|
||||
}
|
||||
|
||||
for (meal in mealList) {
|
||||
if (meal.day.contains(strDay))
|
||||
dayMenus.add(meal)
|
||||
}
|
||||
return dayMenus
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
/**
|
||||
* 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.hsoparser
|
||||
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class TimeTableParser {
|
||||
private val days = arrayOf("Monday", "Tuesday" ,"Wednesday", "Thursday", "Friday", "Saturday")
|
||||
private var courseTTLinkList = ArrayList<CourseTTLink>()
|
||||
|
||||
/**
|
||||
* get the timetable from the given url
|
||||
* the timetable is organised per row not per column;
|
||||
* Mon 1, Tue 1, Wed 1, Thur 1, Fri 1, Sat 1, Mon 2 and so on
|
||||
*/
|
||||
fun getTimeTable(courseTTURL: String): Array<Array<Lesson>> {
|
||||
var timeTableWeek = arrayOf<Array<Lesson>>()
|
||||
val scheduleHTML = Jsoup.connect(courseTTURL).get()
|
||||
|
||||
// create the timetable array
|
||||
for (i in 0..5) {
|
||||
var timeTableDay = arrayOf<Lesson>()
|
||||
for (j in 0..5) {
|
||||
timeTableDay += Lesson("", "","","")
|
||||
}
|
||||
timeTableWeek += timeTableDay
|
||||
}
|
||||
|
||||
//val week = scheduleHTML.select("h1.timetable-caption").text()
|
||||
//println("$week successful!\n")
|
||||
|
||||
scheduleHTML.select("table.timetable").select("td.lastcol").forEachIndexed { index, element ->
|
||||
timeTableWeek[index % 6][index / 6] = Lesson(element.select("div.lesson-subject").text(), element.select("div.lesson-teacher").text(), element.select("div.lesson-room").text(), element.select("div.lesson-remark").text())
|
||||
}
|
||||
|
||||
return timeTableWeek
|
||||
}
|
||||
|
||||
/**
|
||||
* parse all courses from the courses site at https://www.hs-offenburg.de/studium/vorlesungsplaene/
|
||||
*/
|
||||
fun getCourseTTLinks(): ArrayList<CourseTTLink> {
|
||||
val courseHTML = Jsoup.connect("https://www.hs-offenburg.de/studium/vorlesungsplaene/").get()
|
||||
|
||||
courseHTML.select("ul.index-group").select("li.Class").select("a[href]").forEachIndexed { _, element ->
|
||||
courseTTLinkList.add(CourseTTLink(element.attr("href"),element.text()))
|
||||
}
|
||||
return courseTTLinkList
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun printTimeTableWeek (timeTableWeek: Array<Array<Lesson>>) {
|
||||
|
||||
for (j in 0..5) print(days[j].padEnd(25 ,' ') + " | ")
|
||||
println()
|
||||
for (j in 0..5) print("-".padEnd(26 + (j.toFloat().div(j).toInt()), '-') + "+")
|
||||
println()
|
||||
|
||||
for (i in 0..5) {
|
||||
for (j in 0..5) print(timeTableWeek[j][i].lessonSubject.padEnd(25 ,' ').substring(0,25) + " | ")
|
||||
println()
|
||||
for (j in 0..5) print(timeTableWeek[j][i].lessonTeacher.padEnd(25 ,' ').substring(0,25) + " | ")
|
||||
println()
|
||||
for (j in 0..5) print(timeTableWeek[j][i].lessonRoom.padEnd(25 ,' ').substring(0,25) + " | ")
|
||||
println()
|
||||
for (j in 0..5) print("-".padEnd(26 + (j.toFloat().div(j).toInt()), '-') + "+")
|
||||
println()
|
||||
}
|
||||
println()
|
||||
}
|
||||
|
||||
}
|
@ -24,30 +24,26 @@ package org.mosad.seil0.projectlaogai.uicomponents
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.widget.TextView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.cardview.widget.CardView
|
||||
import kotlinx.android.synthetic.main.cardview_day.view.*
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
|
||||
class LessonCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){
|
||||
|
||||
private var txtViewLesson: TextView
|
||||
private var txtViewTime: TextView
|
||||
class DayCardView(context: Context) : CardView(context) {
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.lesson_cardview,this)
|
||||
|
||||
txtViewLesson = findViewById(R.id.txtView_Lesson)
|
||||
txtViewTime = findViewById(R.id.txtView_Time)
|
||||
inflate(context, R.layout.cardview_day,this)
|
||||
|
||||
// workaround to prevent a white border
|
||||
this.setBackgroundColor(Color.TRANSPARENT)
|
||||
}
|
||||
|
||||
fun getTxtViewLesson(): TextView {
|
||||
return txtViewLesson
|
||||
fun getLinLayoutDay() : LinearLayout {
|
||||
return linLayout_Day
|
||||
}
|
||||
|
||||
fun getTxtViewTime(): TextView {
|
||||
return txtViewTime
|
||||
fun setDayHeading(heading: String) {
|
||||
txtView_DayHeading.text = heading
|
||||
}
|
||||
|
||||
}
|
@ -23,32 +23,28 @@
|
||||
package org.mosad.seil0.projectlaogai.uicomponents
|
||||
|
||||
import android.content.Context
|
||||
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 org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Lesson
|
||||
|
||||
class MensaDayCardView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : androidx.cardview.widget.CardView(context, attrs){
|
||||
|
||||
private var linLayoutMensaDay: LinearLayout
|
||||
private var txtViewDayHeading: TextView
|
||||
class LessonLinearLayout(context: Context?) : LinearLayout(context) {
|
||||
|
||||
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)
|
||||
CardView.inflate(context, R.layout.linearlayout_lesson, this)
|
||||
}
|
||||
|
||||
fun getLinLayoutMensaDay(): LinearLayout {
|
||||
return linLayoutMensaDay
|
||||
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 setDayHeading(heading: String) {
|
||||
txtViewDayHeading.text = heading
|
||||
fun disableDivider() {
|
||||
divider_lesson.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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_meal.view.*
|
||||
import org.mosad.seil0.projectlaogai.R
|
||||
import org.mosad.seil0.projectlaogai.hsoparser.Meal
|
||||
|
||||
class MealLinearLayout(context: Context?): LinearLayout(context) {
|
||||
|
||||
init {
|
||||
CardView.inflate(context, R.layout.linearlayout_meal, this)
|
||||
}
|
||||
|
||||
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 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
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:drawable="@color/colorPrimary"/>
|
||||
<item android:drawable="@color/colorPrimary"/>
|
||||
|
||||
<!--TODO when minAPI is 23 use this-->
|
||||
<!--<item android:gravity="center" android:width="144dp" android:height="144dp">-->
|
||||
|
@ -21,6 +21,7 @@
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:itemTextColor="?colorAccent"
|
||||
app:menu="@menu/activity_main_drawer"/>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
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>
|
@ -1,7 +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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragments.HomeFragment">
|
||||
@ -10,97 +9,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardView"
|
||||
android:layout_width="0dp"
|
||||
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" android:elevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:layout_marginBottom="2dp">
|
||||
<TextView
|
||||
android:text="@string/meal_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Menu1Heading"
|
||||
android:textStyle="bold" android:textAlignment="center" android:textSize="16sp"
|
||||
android:typeface="sans" android:fontFamily="sans-serif" android:paddingBottom="5dp"/>
|
||||
<TextView
|
||||
android:id="@+id/txtViewMenu1"
|
||||
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>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardView2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
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">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:layout_marginBottom="2dp">
|
||||
<TextView
|
||||
android:text="@string/meal_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Menu2Heading"
|
||||
android:textAlignment="center" android:textStyle="bold" android:textSize="16sp"
|
||||
android:typeface="sans" android:fontFamily="sans-serif" android:paddingBottom="5dp"/>
|
||||
<TextView
|
||||
android:id="@+id/txtViewMenu2"
|
||||
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>
|
||||
<ScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView2" android:id="@+id/scrollViewTimeTable"
|
||||
android:background="@color/md_divider_dark_theme" android:paddingTop="6dp"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/linLayoutTimeTable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView2">
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_Home">
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragments.MensaFragment">
|
||||
@ -15,10 +15,8 @@
|
||||
<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>
|
||||
|
@ -14,7 +14,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
>
|
||||
android:background="@android:color/background_light">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -30,7 +30,7 @@
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Info"
|
||||
android:typeface="sans"
|
||||
android:textSize="18sp" android:textStyle="bold" android:fontFamily="sans-serif"
|
||||
android:layout_margin="7dp" android:textColor="@color/colorPrimary"/>
|
||||
android:layout_margin="7dp" android:textColor="?colorAccent"/>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
@ -78,7 +78,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:layout_margin="7dp"
|
||||
android:id="@+id/linLayout_Info">
|
||||
android:id="@+id/linLayout_About">
|
||||
<TextView
|
||||
android:text="@string/about_txtView"
|
||||
android:layout_width="match_parent"
|
||||
@ -86,9 +86,9 @@
|
||||
android:textStyle="bold" android:textSize="16sp"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
<TextView
|
||||
android:text="@string/version"
|
||||
android:text="@string/about_version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Version"/>
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_AboutDesc"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@ -100,20 +100,20 @@
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_Settings">
|
||||
android:layout_height="wrap_content" android:id="@+id/linLayout_Settings" android:padding="7dp">
|
||||
<TextView
|
||||
android:text="@string/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_Settings"
|
||||
android:typeface="sans"
|
||||
android:textSize="18sp" android:textColor="@color/design_default_color_primary"
|
||||
android:textStyle="bold" android:layout_margin="7dp" android:paddingTop="3dp"/>
|
||||
android:textSize="18sp" android:textColor="?colorAccent"
|
||||
android:textStyle="bold" android:paddingTop="3dp"/>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:layout_margin="7dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|end"
|
||||
android:clickable="true" android:id="@+id/linLayout_MainColor" android:focusable="true">
|
||||
android:clickable="true" android:id="@+id/linLayout_PrimaryColor" android:focusable="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
@ -125,7 +125,7 @@
|
||||
android:textSize="16sp" android:textStyle="bold"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
<TextView
|
||||
android:text="@string/main_color_desc"
|
||||
android:text="@string/primary_color_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_PrimaryColorDesc"/>
|
||||
</LinearLayout>
|
||||
@ -140,6 +140,44 @@
|
||||
android:background="?colorPrimary"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|end"
|
||||
android:clickable="true" android:id="@+id/linLayout_AccentColor" android:focusable="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/accent_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_AccentColor"
|
||||
android:textSize="16sp" android:textStyle="bold"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
<TextView
|
||||
android:text="@string/accent_color_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/txtView_AccentColorDesc"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:layout_margin="7dp"
|
||||
android:gravity="end">
|
||||
<View
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp" android:id="@+id/view_AccentColor"
|
||||
android:background="?colorAccent"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<Switch
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/switch_buffet"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/primary_text_light" android:textStyle="bold"
|
||||
android:text="@string/show_buffet"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
@ -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,34 +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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtView_Lesson"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/a_lesson"
|
||||
android:textColor="@android:color/primary_text_light"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:typeface="sans"/>
|
||||
|
||||
<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
@ -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
@ -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"
|
||||
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>
|
@ -27,7 +27,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
android:text="@string/nav_header_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:id="@+id/txtView_nav_header_title"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -4,7 +4,10 @@
|
||||
tools:showIn="navigation_view">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
<item android:id="@+id/nav_home" android:title="@string/home" android:icon="@drawable/ic_baseline_home_24dp"/>
|
||||
<item
|
||||
android:id="@+id/nav_home"
|
||||
android:title="@string/home"
|
||||
android:icon="@drawable/ic_baseline_home_24dp"/>
|
||||
<item
|
||||
android:id="@+id/nav_mensa"
|
||||
android:icon="@drawable/ic_local_dining_black_24dp"
|
||||
|
@ -5,12 +5,10 @@
|
||||
<string name="timetable">Stundenplan</string>
|
||||
<string name="moodle">Moodle</string>
|
||||
<string name="settings">Einstellungen</string>
|
||||
<string name="meal_1">Essen 1</string>
|
||||
<string name="meal_2">Essen 2</string>
|
||||
<string name="meal_1_tomorrow">Essen 1, Morgen</string>
|
||||
<string name="meal_2_tomorrow">Essen 1, Morgen</string>
|
||||
<string name="no_meal_today">heute keine Essensausgabe</string>
|
||||
<string name="no_meal_tomorrow">morgen keine Essensausgabe</string>
|
||||
<string name="meal">Essen</string>
|
||||
<string name="today_date">Heute, %1$s</string>
|
||||
<string name="tomorrow_date">Morgen, %1$s</string>
|
||||
<string name="mensa_closed">keine Essensausgabe</string>
|
||||
<string name="no_more_food">Diese Woche keine weitere Essensausgabe</string>
|
||||
<string name="no_lesson_today">heute keine Vorlesung!</string>
|
||||
<string name="error">Fehler</string>
|
||||
@ -19,11 +17,15 @@
|
||||
<string name="info">Info</string>
|
||||
<string name="user">Benutzer</string>
|
||||
<string name="course_desc">Tippen, um den Kurs zu ändern</string>
|
||||
<string name="primary_color">Primärfarbe</string>
|
||||
<string name="main_color_desc">Die Primärfarbe, standard ist Schwarz</string>
|
||||
<string name="primary_color">Hauptfarbe</string>
|
||||
<string name="primary_color_desc">Die Primärfarbe, Standard ist Schwarz.</string>
|
||||
<string name="accent_color">Akzentfarbe</string>
|
||||
<string name="accent_color_desc">Die Akzentfarbe, Standard ist indigo</string>
|
||||
<string name="select">auswählen</string>
|
||||
<string name="about">über</string>
|
||||
<string name="about_dialog_heading">Über</string>
|
||||
<string name="loading_timetable">lade Stundenplan …</string>
|
||||
<string name="navigation_drawer_close">Navigationsleiste schließen</string>
|
||||
<string name="navigation_drawer_open">Navigationsleiste öffnen</string>
|
||||
<string name="show_buffet">Buffet immer anzeigen</string>
|
||||
<string name="select_course">Wähle deinen Studiengang aus</string>
|
||||
</resources>
|
||||
|
@ -2,7 +2,31 @@
|
||||
<resources>
|
||||
<color name="colorPrimary">#000000</color>
|
||||
<color name="colorPrimaryDark">#000000</color>
|
||||
<color name="colorAccent">#d81b60</color>
|
||||
<color name="colorMensaDay">#ebe8e9</color>
|
||||
<color name="colorAccent">#3F51B5</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">#E0E0E0</color>
|
||||
<color name="textPrimaryLight">#000000</color>
|
||||
<color name="textSecondaryLight">#818181</color>
|
||||
|
||||
<color name="themePrimaryDark">#000000</color>
|
||||
<color name="themeSecondaryDark">#303030</color>
|
||||
<color name="themeTertiaryDark">#424242</color>
|
||||
|
||||
<color name="themePrimaryLight">#FFFFFF</color>
|
||||
<color name="themeSecondaryLight">#FFFFFF</color>
|
||||
<color name="themeTertiaryLight">#424242</color> <!-- TODO find a better color -->
|
||||
|
||||
<color name="test">#424242</color>
|
||||
|
||||
</resources>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<string name="app_name" translatable="false">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" translatable="false">hso App 0.3.2</string>
|
||||
<string name="nav_header_title" translatable="false">Project Laogai</string>
|
||||
<string name="nav_header_subtitle" translatable="false">seil0@mosad.xyz</string>
|
||||
<string name="nav_header_desc" translatable="false">Project Laogai</string>
|
||||
|
||||
@ -12,12 +12,10 @@
|
||||
<string name="moodle">Moodle</string>
|
||||
<string name="settings">Settings</string>
|
||||
|
||||
<string name="meal_1">Meal 1</string>
|
||||
<string name="meal_2">Meal 2</string>
|
||||
<string name="meal_1_tomorrow">Meal 1, tomorrow</string>
|
||||
<string name="meal_2_tomorrow">Meal 2, tomorrow</string>
|
||||
<string name="no_meal_today">Mensa closed today</string>
|
||||
<string name="no_meal_tomorrow">Mensa closed tomorrow</string>
|
||||
<string name="meal">Meal</string>
|
||||
<string name="today_date">Today, %1$s</string>
|
||||
<string name="tomorrow_date">Tomorrow, %1$s</string>
|
||||
<string name="mensa_closed">the Mensa is closed</string>
|
||||
<string name="no_more_food">No more Food this week</string>
|
||||
|
||||
<string name="no_lesson_today">"No lecture today!"</string>
|
||||
@ -28,28 +26,31 @@
|
||||
<string name="sample_user" translatable="false">SampleUser@stud.hs-offenburg.de</string>
|
||||
<string name="sample_course" translatable="false">SampleCourse 3</string>
|
||||
<string name="sample_date" translatable="false">Montag, 30.02</string>
|
||||
<string name="a_lesson" translatable="false">a lesson\na teacher\na room</string>
|
||||
<string name="a_time" translatable="false">0.00 – 23.59</string>
|
||||
|
||||
<string name="info">Info</string>
|
||||
<string name="user">User</string>
|
||||
<string name="course_desc">Tap to change course</string>
|
||||
<string name="select_course">Select your course</string>
|
||||
<string name="primary_color">primary color</string>
|
||||
<string name="main_color_desc">The primary color, default is black</string>
|
||||
<string name="primary_color_desc">The primary color, default is black.</string>
|
||||
<string name="accent_color">accent color</string>
|
||||
<string name="accent_color_desc">The accent color, default is indigo.</string>
|
||||
<string name="show_buffet">always show buffet</string>
|
||||
<string name="select">select</string>
|
||||
<string name="version" translatable="false">version 0.3.2</string>
|
||||
<string name="about">about</string>
|
||||
<string name="about_txtView" translatable="false">hso App by @Seil0</string>
|
||||
<string name="about_text" translatable="false">"This software is made by @Seil0 and is published under the terms and
|
||||
conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2019
|
||||
seil0@mosad.xyz "
|
||||
</string>
|
||||
<string name="about_version" translatable="false">version %1$s (%2$s)</string>
|
||||
<string name="about_dialog_heading">About</string>
|
||||
<string name="about_dialog_text" translatable="false">"This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2019 seil0@mosad.xyz "</string>
|
||||
<string name="loading_timetable">loading timetable …</string>
|
||||
|
||||
|
||||
<string name="string_new_line" translatable="false">%1$s\n</string>
|
||||
|
||||
<string name="save_key_course" translatable="false">org.mosad.seil0.projectlaogai.course</string>
|
||||
<string name="save_key_courseTTLink" translatable="false">org.mosad.seil0.projectlaogai.courseTTLink</string>
|
||||
<string name="save_key_colorPrimary" translatable="false">org.mosad.seil0.projectlaogai.colorPrimary</string>
|
||||
<string name="save_key_colorAccent" translatable="false">org.mosad.seil0.projectlaogai.colorAccent</string>
|
||||
<string name="save_key_showBuffet" translatable="false">org.mosad.seil0.projectlaogai.showBuffet</string>
|
||||
<string name="save_key_coursesCacheTime" translatable="false">org.mosad.seil0.projectlaogai.coursesCacheTime</string>
|
||||
<string name="save_key_mensaCacheTime" translatable="false">org.mosad.seil0.projectlaogai.mensaCacheTime</string>
|
||||
<string name="save_key_timetableCacheTime" translatable="false">org.mosad.seil0.projectlaogai.timetableCacheTime</string>
|
||||
|
||||
</resources>
|
||||
|
@ -1,13 +1,13 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.11'
|
||||
ext.kotlin_version = '1.3.21'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:3.3.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
@ -19,7 +19,6 @@ allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url "https://dl.bintray.com/drummer-aidan/maven/" }
|
||||
}
|
||||
}
|
||||
|
||||
|
8
fastlane/metadata/android/en-US/full_description.txt
Normal file
@ -0,0 +1,8 @@
|
||||
ProjectLaogai is a app to access the timetable and the mensa menu
|
||||
of Hochschule Offenburg.
|
||||
|
||||
Features:
|
||||
* check out the mensa menu of this and next week
|
||||
* access your timetable
|
||||
* open moodle
|
||||
* probably some funny bugs
|
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 148 KiB |
1
fastlane/metadata/android/en-US/short_description.txt
Normal file
@ -0,0 +1 @@
|
||||
access the timetable and mensa menu at Hochschule Offenburg
|
1
fastlane/metadata/android/en-US/title.txt
Normal file
@ -0,0 +1 @@
|
||||
ProjectLaogai
|