version 0.1.2

* fixed a crash that occurred if there was no meal for the current day
* added a card if there's no more meals this week
* added a card if there's no lesson at the current day
This commit is contained in:
Jannik 2018-11-01 01:06:53 +01:00
parent 9f09fdcff2
commit b915f574fe
8 changed files with 43 additions and 18 deletions

View File

@ -10,8 +10,8 @@ android {
applicationId "org.mosad.seil0.projectlaogai" applicationId "org.mosad.seil0.projectlaogai"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 2 versionCode 3
versionName "0.1.1" versionName "0.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@ -24,13 +24,13 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'org.jsoup:jsoup:1.11.3' implementation 'org.jsoup:jsoup:1.11.3'
implementation "org.jetbrains.anko:anko-commons:0.10.7" implementation 'org.jetbrains.anko:anko-commons:0.10.7'
implementation 'com.afollestad.material-dialogs:core:2.0.0-beta4' implementation 'com.afollestad.material-dialogs:core:2.0.0-beta4'
implementation 'com.afollestad.material-dialogs:color:2.0.0-beta4' implementation 'com.afollestad.material-dialogs:color:2.0.0-beta4'

View File

@ -156,4 +156,5 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
timeTableWeek = timeTableParser.getTimeTable("https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0") timeTableWeek = timeTableParser.getTimeTable("https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0")
}.get() }.get()
} }
} }

View File

@ -71,12 +71,18 @@ class HomeFragment : Fragment() {
val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(currentMenus, Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(currentMenus, Calendar.getInstance().get(Calendar.DAY_OF_WEEK))
uiThread { uiThread {
for(part in dayMenus[0].parts) {
txtViewMenu1.append(part)
}
for(part in dayMenus[1].parts) { if (dayMenus.size >= 2) {
txtViewMenu2.append(part) for(part in dayMenus[0].parts) {
txtViewMenu1.append(part)
}
for(part in dayMenus[1].parts) {
txtViewMenu2.append(part)
}
} else {
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
} }
} }
} }
@ -97,6 +103,14 @@ class HomeFragment : Fragment() {
if(lessonCardView.getTxtViewLesson().text.length > 2) if(lessonCardView.getTxtViewLesson().text.length > 2)
linLayoutTimeTable.addView(lessonCardView) 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) + "\n"
linLayoutTimeTable.addView(noLessonCardView)
}
} }
fun setCurrentMenu(weekMenus: ArrayList<Meal>){ fun setCurrentMenu(weekMenus: ArrayList<Meal>){

View File

@ -99,6 +99,13 @@ class MensaFragment : Fragment() {
if(add) if(add)
linLayoutMensaFragment.addView(cardViewMensaDay) 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)
}
} }
} }

View File

@ -72,9 +72,8 @@ class MensaParser {
} }
for (meal in mealList) { for (meal in mealList) {
if (meal.day.contains(strDay)) { if (meal.day.contains(strDay))
dayMenus.add(meal) dayMenus.add(meal)
}
} }
return dayMenus return dayMenus
} }

View File

@ -31,7 +31,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:text="@string/essen_1" android:text="@string/meal_1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Menu1Heading" android:layout_height="wrap_content" android:id="@+id/txtView_Menu1Heading"
android:textStyle="bold" android:textAlignment="center" android:textSize="16sp" android:textStyle="bold" android:textAlignment="center" android:textSize="16sp"
@ -65,7 +65,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:text="@string/essen_2" android:text="@string/meal_2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Menu2Heading" android:layout_height="wrap_content" android:id="@+id/txtView_Menu2Heading"
android:textAlignment="center" android:textStyle="bold" android:textSize="16sp" android:textAlignment="center" android:textStyle="bold" android:textSize="16sp"

View File

@ -23,7 +23,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:text="@string/essen_1" android:text="@string/meal_1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_MenuHeading" android:layout_height="wrap_content" android:id="@+id/txtView_MenuHeading"
android:textStyle="bold" android:textAlignment="center" android:textSize="16sp" android:textStyle="bold" android:textAlignment="center" android:textSize="16sp"

View File

@ -2,7 +2,7 @@
<string name="app_name">Project Laogai</string> <string name="app_name">Project Laogai</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">hso App 0.1.1</string> <string name="nav_header_title">hso App 0.1.2</string>
<string name="nav_header_subtitle">seil0@mosad.xyz</string> <string name="nav_header_subtitle">seil0@mosad.xyz</string>
<string name="nav_header_desc">Navigation header</string> <string name="nav_header_desc">Navigation header</string>
@ -14,8 +14,12 @@
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="essen_1">Essen 1</string> <string name="meal_1">Essen 1</string>
<string name="essen_2">Essen 2</string> <string name="meal_2">Essen 2</string>
<string name="no_meal_today">heute 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="a_lesson">a lesson\na teacher\na room</string> <string name="a_lesson">a lesson\na teacher\na room</string>
<string name="a_time">0.00 23.59</string> <string name="a_time">0.00 23.59</string>
@ -29,7 +33,7 @@
<string name="primary_color">primary color</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 indigo</string>
<string name="select">select</string> <string name="select">select</string>
<string name="version">version 0.1.1</string> <string name="version">version 0.1.2</string>
<string name="about">about</string> <string name="about">about</string>
<string name="about_text">This software is made by @Seil0 and is published under the terms and conditions of GPL 3. <string name="about_text">This software is made by @Seil0 and is published under the terms and conditions of GPL 3.
For further information visit git.mosad.xyz/Seil0/ProjectLaogai\n\n© 2018 seil0@mosad.xyz For further information visit git.mosad.xyz/Seil0/ProjectLaogai\n\n© 2018 seil0@mosad.xyz