Browse Source

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
pull/20/head
Jannik 4 years ago
parent
commit
b915f574fe
  1. 8
      app/build.gradle
  2. 1
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  3. 24
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/HomeFragment.kt
  4. 7
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  5. 3
      app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/MensaParser.kt
  6. 4
      app/src/main/res/layout/fragment_home.xml
  7. 2
      app/src/main/res/layout/menu_cardview.xml
  8. 12
      app/src/main/res/values/strings.xml

8
app/build.gradle

@ -10,8 +10,8 @@ android {
applicationId "org.mosad.seil0.projectlaogai"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "0.1.1"
versionCode 3
versionName "0.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -24,13 +24,13 @@ android {
dependencies {
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.legacy:legacy-support-v4:1.0.0'
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 'org.jetbrains.anko:anko-commons:0.10.7'
implementation 'com.afollestad.material-dialogs:core:2.0.0-beta4'
implementation 'com.afollestad.material-dialogs:color:2.0.0-beta4'

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

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

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

@ -71,12 +71,18 @@ class HomeFragment : Fragment() {
val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(currentMenus, Calendar.getInstance().get(Calendar.DAY_OF_WEEK))
uiThread {
for(part in dayMenus[0].parts) {
txtViewMenu1.append(part)
}
for(part in dayMenus[1].parts) {
txtViewMenu2.append(part)
if (dayMenus.size >= 2) {
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)
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>){

7
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

@ -99,6 +99,13 @@ class MensaFragment : Fragment() {
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)
}
}
}

3
app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/MensaParser.kt

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

4
app/src/main/res/layout/fragment_home.xml

@ -31,7 +31,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/essen_1"
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"
@ -65,7 +65,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/essen_2"
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"

2
app/src/main/res/layout/menu_cardview.xml

@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/essen_1"
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"

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

@ -2,7 +2,7 @@
<string name="app_name">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">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_desc">Navigation header</string>
@ -14,8 +14,12 @@
<string name="settings">Settings</string>
<string name="action_settings">Settings</string>
<string name="essen_1">Essen 1</string>
<string name="essen_2">Essen 2</string>
<string name="meal_1">Essen 1</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_time">0.00 – 23.59</string>
@ -29,7 +33,7 @@
<string name="primary_color">primary color</string>
<string name="main_color_desc">The primary color, default is indigo</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_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

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close