4 Commits
0.3.0 ... 0.3.1

Author SHA1 Message Date
3d7f6f961a the menus text is now selectable
* fixed some formating errors at the mensa screen
2018-11-26 12:56:06 +01:00
f97e8b2b14 fixed text overlapping and some crashes 2018-11-26 11:17:07 +01:00
deaf139b70 updated some libraries 2018-11-22 18:07:30 +01:00
bf48bec16b minor fixes 2018-11-19 12:00:39 +01:00
13 changed files with 94 additions and 33 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "org.mosad.seil0.projectlaogai"
minSdkVersion 21
targetSdkVersion 28
versionCode 8
versionName "0.3.0"
versionCode 9
versionName "0.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -34,9 +34,9 @@ dependencies {
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'org.jetbrains.anko:anko-commons:0.10.7'
implementation 'com.afollestad.material-dialogs:core:2.0.0-beta5'
implementation 'com.afollestad.material-dialogs:color:2.0.0-beta5'
implementation 'org.jetbrains.anko:anko-commons:0.10.8'
implementation 'com.afollestad.material-dialogs:core:2.0.0-rc1'
implementation 'com.afollestad.material-dialogs:color:2.0.0-rc1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

View File

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

View File

@ -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 {
@ -88,12 +87,16 @@ class HomeFragment : Fragment() {
// get the index of the first meal, not a "Schneller Teller"
loop@ for ((i, meal) in dayMenus.withIndex()) {
if(meal.heading.contains("Essen")) {
for (part in dayMenus[i].parts) {
for ((j, part) in dayMenus[i].parts.withIndex()) {
txtViewMenu1.append(part)
if(j < (dayMenus[i].parts.size - 2))
txtViewMenu1.append("\n")
}
for (part in dayMenus[i + 1].parts) {
for ((j, part) in dayMenus[i + 1].parts.withIndex()) {
txtViewMenu2.append(part)
if(j < (dayMenus[i + 1].parts.size - 2))
txtViewMenu2.append("\n")
}
break@loop

View File

@ -84,8 +84,10 @@ class MensaFragment : Fragment() {
val menuViewMenu = MenuCardView(context!!, null)
menuViewMenu.setMenuHeading(meal.heading)
for(part in meal.parts) {
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) //TODO move this out of the first for loop, performance!!

View File

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

View File

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

View File

@ -55,7 +55,11 @@ class TimeTableFragment : Fragment() {
linLayoutTTFragment = view.findViewById(R.id.linLayout_TTFragment)
addCurrentWeek()
if (mainActivity.getTimeTableCurrentWeek().isNotEmpty()) {
addCurrentWeek()
} else {
// TODO show card with error msg
}
return view
}

View File

@ -43,7 +43,7 @@ class MensaParser {
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("|"))
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))
@ -52,6 +52,7 @@ class MensaParser {
}
}
}
return mealList
}

View File

@ -13,7 +13,7 @@
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="0dp"
android:layout_height="125dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
@ -28,7 +28,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:layout_marginBottom="2dp">
<TextView
android:text="@string/meal_1"
android:layout_width="match_parent"
@ -36,20 +36,22 @@
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:id="@+id/txtViewMenu1"/>
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="125dp"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
@ -60,7 +62,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:layout_marginBottom="2dp">
<TextView
android:text="@string/meal_2"
android:layout_width="match_parent"
@ -75,7 +77,8 @@
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans"/>
android:typeface="sans"
android:textIsSelectable="true"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<ScrollView

View File

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

View File

@ -35,7 +35,8 @@
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans"/>
android:typeface="sans"
android:textIsSelectable="true"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

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

View File

@ -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.0</string>
<string name="nav_header_title" translatable="false">hso App 0.3.1</string>
<string name="nav_header_subtitle" translatable="false">seil0@mosad.xyz</string>
<string name="nav_header_desc" translatable="false">Project Laogai</string>
@ -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="version" translatable="false">version 0.3.1</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>