Browse Source

minor fixes

pull/20/head
Jannik 3 years ago
parent
commit
bf48bec16b
  1. 14
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  2. 1
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  3. 31
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt
  4. 4
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt
  5. 17
      app/src/main/res/layout/fragment_moodle.xml
  6. 4
      app/src/main/res/values-de-rDE/strings.xml
  7. 10
      app/src/main/res/values/strings.xml

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

@ -35,16 +35,12 @@ 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.fragments.HomeFragment
import org.mosad.seil0.projectlaogai.fragments.MensaFragment
import org.mosad.seil0.projectlaogai.fragments.SettingsFragment
import org.mosad.seil0.projectlaogai.fragments.TimeTableFragment
import org.mosad.seil0.projectlaogai.fragments.*
import org.mosad.seil0.projectlaogai.hsoparser.*
import kotlin.system.measureTimeMillis
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
//TODO make toolbar and navbar global
private val mensaParser = MensaParser()
private val timeTableParser = TimeTableParser()
@ -60,6 +56,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
// load mensa and timetable
load()
@ -129,7 +126,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
R.id.nav_moodle -> {
// val moodleFragment = MoodleFragment()
//
// val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
// fragmentTransaction.replace(R.id.fragment_container, moodleFragment)
// fragmentTransaction.commit()
}
R.id.nav_settings -> {
val settingsFragment = SettingsFragment()
@ -166,7 +167,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
/**
* load the mensa menus of the current week
* TODO evaluate if we should use a timeout here
*/
private fun load() {

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

@ -70,7 +70,6 @@ class HomeFragment : Fragment() {
val dayMenus: ArrayList<Meal>
val cal = Calendar.getInstance()
// TODO needs testing
if (cal.get(Calendar.HOUR_OF_DAY) < 15) {
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK))
} else {

31
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt

@ -0,0 +1,31 @@
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 kotlinx.android.synthetic.main.fragment_moodle.*
import org.mosad.seil0.projectlaogai.R
/**
* The moodle screen controller class
* contains all needed parts to display and the moodle screen
*/
class MoodleFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view: View = inflater.inflate(R.layout.fragment_settings, container, false)
//webView.loadUrl("www.google.de")
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
//webView.loadUrl("www.google.de")
}
}

4
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt

@ -125,11 +125,11 @@ class SettingsFragment : Fragment() {
linLayoutMainColor.setOnClickListener {
// open a new color chooser dialog
val colors = intArrayOf(Color.parseColor("#3F51B5"), Color.RED, Color.GREEN, Color.BLUE)
val colors = intArrayOf(Color.BLACK, Color.RED, Color.GREEN, Color.BLUE)
MaterialDialog(context!!)
.title(R.string.primary_color)
.colorChooser(colors, initialSelection = Color.parseColor("#3F51B5")) { _, color ->
.colorChooser(colors, initialSelection = Color.BLACK) { _, color ->
viewPrimaryColor.setBackgroundColor(color)
}
.positiveButton(R.string.select)

17
app/src/main/res/layout/fragment_moodle.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.MoodleFragment">
<!-- TODO: Update blank fragment layout -->
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/webView"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment"/>
</FrameLayout>

4
app/src/main/res/values-de-rDE/strings.xml

@ -19,10 +19,10 @@
<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 Indigo</string>
<string name="main_color_desc">Die Primärfarbe, standard ist Schwarz</string>
<string name="select">auswählen</string>
<string name="about">ü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>
</resources>
</resources>

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

@ -34,12 +34,15 @@
<string name="user">User</string>
<string name="course_desc">Tap to change course</string>
<string name="primary_color">primary color</string>
<string name="main_color_desc">The primary color, default is indigo</string>
<string name="main_color_desc">The primary color, default is black</string>
<string name="select">select</string>
<string name="version" translatable="false">version 0.3.0</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 seil0@mosad.xyz "</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
seil0@mosad.xyz "
</string>
<string name="loading_timetable">loading timetable …</string>
@ -47,4 +50,7 @@
<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>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
Loading…
Cancel
Save