merge version 0.5.1 #38
@ -11,7 +11,7 @@ android {
 | 
			
		||||
        minSdkVersion 23
 | 
			
		||||
        targetSdkVersion 29
 | 
			
		||||
        versionCode 15
 | 
			
		||||
        versionName "0.5.190"
 | 
			
		||||
        versionName "0.5.1"
 | 
			
		||||
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 | 
			
		||||
        resValue "string", "build_time", buildTime()
 | 
			
		||||
        setProperty("archivesBaseName", "projectlaogai-$versionName")
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,7 @@ import android.nfc.NfcAdapter
 | 
			
		||||
import android.nfc.NfcManager
 | 
			
		||||
import android.nfc.tech.NfcA
 | 
			
		||||
import android.os.Bundle
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import android.view.Menu
 | 
			
		||||
import android.view.MenuItem
 | 
			
		||||
import androidx.appcompat.app.ActionBarDrawerToggle
 | 
			
		||||
@ -56,6 +57,7 @@ import kotlin.system.measureTimeMillis
 | 
			
		||||
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
 | 
			
		||||
 | 
			
		||||
    private var activeFragment: Fragment = HomeFragment() // the currently active fragment, home at the start
 | 
			
		||||
    private val className = "MainActivity"
 | 
			
		||||
 | 
			
		||||
    private lateinit var adapter: NfcAdapter
 | 
			
		||||
    private lateinit var pendingIntent: PendingIntent
 | 
			
		||||
@ -173,7 +175,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
 | 
			
		||||
            PreferencesController.load(this) // load the settings, must be finished before doing anything else
 | 
			
		||||
            CacheController(this) // load the cache
 | 
			
		||||
        }
 | 
			
		||||
        println("startup completed in $startupTime ms")
 | 
			
		||||
        Log.i(className, "startup completed in $startupTime ms")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun initAesthetic() {
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,7 @@
 | 
			
		||||
package org.mosad.seil0.projectlaogai.controller
 | 
			
		||||
 | 
			
		||||
import android.content.Context
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import com.google.gson.Gson
 | 
			
		||||
import com.google.gson.GsonBuilder
 | 
			
		||||
import com.google.gson.JsonParser
 | 
			
		||||
@ -43,6 +44,7 @@ import kotlin.collections.ArrayList
 | 
			
		||||
 | 
			
		||||
class CacheController(cont: Context) {
 | 
			
		||||
 | 
			
		||||
    private val className = "CacheController"
 | 
			
		||||
    private val context = cont
 | 
			
		||||
 | 
			
		||||
    init {
 | 
			
		||||
@ -56,7 +58,7 @@ class CacheController(cont: Context) {
 | 
			
		||||
 | 
			
		||||
        // if a) it's monday and the last cache update was on sunday or b) the cache is older than 24hr, update blocking
 | 
			
		||||
        if ((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (currentTime - mensaMenu.meta.updateTime) > 86400) {
 | 
			
		||||
            println("update mensa blocking")
 | 
			
		||||
           Log.i(className, "update mensa blocking")
 | 
			
		||||
            GlobalScope.launch(Dispatchers.Default) { TCoRAPIController.getMensa(context).join() }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -66,7 +68,7 @@ class CacheController(cont: Context) {
 | 
			
		||||
 | 
			
		||||
        // if a) it`s monday and the last cache update was not on a sunday or b) the cache is older than 24hr, update blocking
 | 
			
		||||
        if ((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (currentTime - timetables[0].meta.updateTime) > 86400) {
 | 
			
		||||
            println("updating timetable after sunday!")
 | 
			
		||||
            Log.i(className, "updating timetable after sunday!")
 | 
			
		||||
 | 
			
		||||
            GlobalScope.launch(Dispatchers.Default) {
 | 
			
		||||
                val threads = listOf(
 | 
			
		||||
@ -171,7 +173,7 @@ class CacheController(cont: Context) {
 | 
			
		||||
     * read coursesList, mensa (current and next week), timetable (current and next week)
 | 
			
		||||
     * @param courseName the course name (e.g AI1)
 | 
			
		||||
     */
 | 
			
		||||
    fun readStartCache(courseName: String) {
 | 
			
		||||
    private fun readStartCache(courseName: String) {
 | 
			
		||||
        readCoursesList(context)
 | 
			
		||||
        readMensa(context)
 | 
			
		||||
        readTimetable(courseName, 0, context)
 | 
			
		||||
 | 
			
		||||
@ -66,7 +66,7 @@ class NFCMensaCard {
 | 
			
		||||
                    lookAtMe(context, data, settings.value).show()
 | 
			
		||||
                }
 | 
			
		||||
            } catch (ex: Exception) {
 | 
			
		||||
                Log.i(className,"could not connect to tag", ex)
 | 
			
		||||
                Log.w(className,"could not connect to tag", ex)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -82,7 +82,7 @@ class TimeTableFragment : Fragment() {
 | 
			
		||||
 | 
			
		||||
            faBtnAddLesson.setOnClickListener {
 | 
			
		||||
                MaterialDialog(context!!)
 | 
			
		||||
                    .title(text = "Vorlesung hinzufügen")
 | 
			
		||||
                    .title(text = resources.getString(R.string.add_lesson))
 | 
			
		||||
                    .message(text = "wähle einen Studiengang aus:\n\nWähle eine Vorlesung aus: \n\n Diese Funktion ist noch nicht verfügbar")
 | 
			
		||||
                    .show()
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -18,20 +18,23 @@
 | 
			
		||||
    <string name="no_more_food">Diese Woche keine weitere Essensausgabe</string>
 | 
			
		||||
    <string name="no_lesson_today">heute keine Vorlesung!</string>
 | 
			
		||||
 | 
			
		||||
    <!-- fragment_timetable -->
 | 
			
		||||
    <string name="add_lesson">Eine Vorlesung hinzufügen</string>
 | 
			
		||||
 | 
			
		||||
    <!-- fragment_settings -->
 | 
			
		||||
    <string name="info">Info</string>
 | 
			
		||||
    <string name="user">Benutzer</string>
 | 
			
		||||
    <string name="course_desc">Tippen, um den Kurs zu ändern</string>
 | 
			
		||||
    <string name="course_desc">Tippe um den Kurs zu ändern</string>
 | 
			
		||||
    <string name="about_dialog_heading">Über</string>
 | 
			
		||||
    <string name="licenses">Lizenzen</string>
 | 
			
		||||
    <string name="theme">Design</string>
 | 
			
		||||
    <string name="themeLight">Hell</string>
 | 
			
		||||
    <string name="themeDark">Dunkel</string>
 | 
			
		||||
    <string name="themeBlack">Schwarz</string>
 | 
			
		||||
    <string name="primary_color">Hauptfarbe</string>
 | 
			
		||||
    <string name="primary_color_desc">Die Primärfarbe, Standard ist Schwarz.</string>
 | 
			
		||||
    <string name="primary_color">Primärfarbe</string>
 | 
			
		||||
    <string name="primary_color_desc">Zum Ändern tippen, Standard ist Schwarz.</string>
 | 
			
		||||
    <string name="accent_color">Akzentfarbe</string>
 | 
			
		||||
    <string name="accent_color_desc">Die Akzentfarbe, Standard ist indigo</string>
 | 
			
		||||
    <string name="accent_color_desc">Zum Ändern tippen, Standard ist Indigo.</string>
 | 
			
		||||
    <string name="show_buffet">Buffet immer anzeigen</string>
 | 
			
		||||
 | 
			
		||||
    <!-- dialogs -->
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,9 @@
 | 
			
		||||
    <string name="no_more_food">No more Food this week</string>
 | 
			
		||||
    <string name="no_lesson_today">"No lecture today!"</string>
 | 
			
		||||
 | 
			
		||||
    <!-- fragment_timetable -->
 | 
			
		||||
    <string name="add_lesson">Add a lesson</string>
 | 
			
		||||
 | 
			
		||||
    <!-- fragment_settings -->
 | 
			
		||||
    <string name="info">Info</string>
 | 
			
		||||
    <string name="user">User</string>
 | 
			
		||||
@ -34,9 +37,9 @@
 | 
			
		||||
    <string name="themeDark">Dark</string>
 | 
			
		||||
    <string name="themeBlack">Black</string>
 | 
			
		||||
    <string name="primary_color">Primary color</string>
 | 
			
		||||
    <string name="primary_color_desc">The primary color, default is black.</string>
 | 
			
		||||
    <string name="primary_color_desc">Tap to change, 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="accent_color_desc">Tap to change, default is indigo.</string>
 | 
			
		||||
    <string name="show_buffet">Always show buffet</string>
 | 
			
		||||
 | 
			
		||||
    <!-- dialogs -->
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user