Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f6f652ffb6 | |||
8fa0d496c6 | |||
0607d58760 |
@ -5,13 +5,15 @@ apply plugin: 'kotlin-android'
|
|||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
signingConfigs {
|
||||||
|
}
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.mosad.seil0.projectlaogai"
|
applicationId "org.mosad.seil0.projectlaogai"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 6
|
versionCode 7
|
||||||
versionName "0.2.2"
|
versionName "0.2.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -27,15 +29,14 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
implementation 'androidx.appcompat:appcompat:1.0.1'
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||||
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-beta5'
|
||||||
implementation 'com.afollestad.material-dialogs:color:2.0.0-beta4'
|
implementation 'com.afollestad.material-dialogs:color:2.0.0-beta5'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test:runner:1.1.0'
|
androidTestImplementation 'androidx.test:runner:1.1.0'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
|
||||||
|
@ -64,22 +64,42 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* add the current mensa meal to the home screens
|
* add the current mensa meal to the home screens
|
||||||
* TODO show meals of the next day if its later than 1500
|
|
||||||
*/
|
*/
|
||||||
private fun addCurrentMensaMenu() {
|
private fun addCurrentMensaMenu() {
|
||||||
doAsync {
|
doAsync {
|
||||||
val dayMenus: ArrayList<Meal> = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), Calendar.getInstance().get(Calendar.DAY_OF_WEEK))
|
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 {
|
||||||
|
dayMenus = MensaParser().getMensaMenuDay(mainActivity.getWeekMenu(), cal.get(Calendar.DAY_OF_WEEK) + 1)
|
||||||
|
uiThread {
|
||||||
|
// TODO Mensa closed today is showing
|
||||||
|
txtView_Menu1Heading.text = resources.getString(R.string.meal_1_tomorrow)
|
||||||
|
txtView_Menu2Heading.text = resources.getString(R.string.meal_2_tomorrow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uiThread {
|
uiThread {
|
||||||
|
|
||||||
if (dayMenus.size >= 2) {
|
if (dayMenus.size >= 2) {
|
||||||
for (part in dayMenus[0].parts) {
|
// get the index of the first meal, not a "Schneller Teller"
|
||||||
txtViewMenu1.append(part)
|
loop@ for ((i, meal) in dayMenus.withIndex()) {
|
||||||
|
if(meal.heading.contains("Essen")) {
|
||||||
|
for (part in dayMenus[i].parts) {
|
||||||
|
txtViewMenu1.append(part)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (part in dayMenus[i + 1].parts) {
|
||||||
|
txtViewMenu2.append(part)
|
||||||
|
}
|
||||||
|
|
||||||
|
break@loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (part in dayMenus[1].parts) {
|
|
||||||
txtViewMenu2.append(part)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
|
txtViewMenu1.text = resources.getString(R.string.no_meal_today)
|
||||||
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
|
txtViewMenu2.text = resources.getString(R.string.no_meal_today)
|
||||||
|
@ -71,7 +71,7 @@ class MensaFragment : Fragment() {
|
|||||||
Calendar.THURSDAY -> "Don"
|
Calendar.THURSDAY -> "Don"
|
||||||
Calendar.FRIDAY -> "Fre"
|
Calendar.FRIDAY -> "Fre"
|
||||||
Calendar.SATURDAY -> "Sam"
|
Calendar.SATURDAY -> "Sam"
|
||||||
else -> "TODAY" //TODO
|
else -> "TODAY" // the app will likely crash here
|
||||||
}
|
}
|
||||||
|
|
||||||
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
val cardViewMensaDay = MensaDayCardView(context!!, null)
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
<string name="settings">Einstellungen</string>
|
<string name="settings">Einstellungen</string>
|
||||||
<string name="meal_1">Essen 1</string>
|
<string name="meal_1">Essen 1</string>
|
||||||
<string name="meal_2">Essen 2</string>
|
<string name="meal_2">Essen 2</string>
|
||||||
|
<string name="meal_1_tomorrow">Essen 1, Morgen</string>
|
||||||
|
<string name="meal_2_tomorrow">Essen 1, Morgen</string>
|
||||||
<string name="no_meal_today">heute keine Essensausgabe</string>
|
<string name="no_meal_today">heute keine Essensausgabe</string>
|
||||||
<string name="no_more_food">Diese Woche keine weitere Essensausgabe</string>
|
<string name="no_more_food">Diese Woche keine weitere Essensausgabe</string>
|
||||||
<string name="no_lesson_today">heute keine Vorlesung</string>
|
<string name="no_lesson_today">heute keine Vorlesung</string>
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
<string name="meal_1">Meal 1</string>
|
<string name="meal_1">Meal 1</string>
|
||||||
<string name="meal_2">Meal 2</string>
|
<string name="meal_2">Meal 2</string>
|
||||||
|
<string name="meal_1_tomorrow">Meal 1, tomorrow</string>
|
||||||
|
<string name="meal_2_tomorrow">Meal 2, tomorrow</string>
|
||||||
<string name="no_meal_today">Mensa closed today</string>
|
<string name="no_meal_today">Mensa closed today</string>
|
||||||
<string name="no_more_food">No more Food this week</string>
|
<string name="no_more_food">No more Food this week</string>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.0'
|
ext.kotlin_version = '1.3.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
Reference in New Issue
Block a user