added a splah screen

This commit is contained in:
Jannik 2018-10-30 20:41:22 +01:00
parent f8ecf18de7
commit a5a1ad333b
15 changed files with 86 additions and 17 deletions

View File

@ -10,10 +10,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -21,6 +21,13 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait">
</activity>
</application>
</manifest>

View File

@ -33,6 +33,10 @@ import androidx.fragment.app.FragmentTransaction
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.app_bar_main.*
import org.jetbrains.anko.doAsync
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.hsoparser.Lesson
import org.mosad.seil0.projectlaogai.hsoparser.Meal
import org.mosad.seil0.projectlaogai.hsoparser.MensaParser
@ -143,7 +147,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
/**
* load the mensa menus of the current week
* TODO show loading screen while loading
* TODO make mensa nad timetable query parallel
* TODO make mensa and timetable query parallel (use coroutines)
* TODO evaluate if we should use a timeout here
*/
private fun load() {
@ -151,6 +155,5 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
weekMenus = mensaParser.getMensaMenu()
timeTableWeek = timeTableParser.getTimeTable("https://www.hs-offenburg.de/index.php?id=6627&class=class&iddV=DA64F6FE-9DDB-429E-A677-05D0D40CB636&week=0")
}.get()
}
}

View File

@ -0,0 +1,16 @@
package org.mosad.seil0.projectlaogai
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class SplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
}
}

View File

@ -20,7 +20,7 @@
*
*/
package org.mosad.seil0.projectlaogai
package org.mosad.seil0.projectlaogai.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment
@ -32,6 +32,7 @@ import kotlinx.android.synthetic.main.fragment_home.*
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
import org.mosad.seil0.projectlaogai.hsoparser.Lesson
import org.mosad.seil0.projectlaogai.hsoparser.Meal
@ -88,8 +89,7 @@ class HomeFragment : Fragment() {
for (i in 0..5) {
val lessonCardView = LessonCardView(context!!, null)
lessonCardView.getTxtViewLesson().text = """${timeTableDay[i].lessonSubject}
"""
lessonCardView.getTxtViewLesson().text = timeTableDay[i].lessonSubject + "\n"
lessonCardView.getTxtViewLesson().append(timeTableDay[i].lessonTeacher + "\n")
lessonCardView.getTxtViewLesson().append(timeTableDay[i].lessonRoom)
lessonCardView.getTxtViewTime().text = DataTypes().getTime()[i]

View File

@ -20,7 +20,7 @@
*
*/
package org.mosad.seil0.projectlaogai
package org.mosad.seil0.projectlaogai.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment
@ -30,6 +30,7 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.hsoparser.Meal
import org.mosad.seil0.projectlaogai.hsoparser.MensaParser
import org.mosad.seil0.projectlaogai.uicomponents.MensaDayCardView

View File

@ -20,7 +20,7 @@
*
*/
package org.mosad.seil0.projectlaogai
package org.mosad.seil0.projectlaogai.fragments
import android.graphics.Color
import android.os.Bundle
@ -33,6 +33,7 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.color.colorChooser
import com.afollestad.materialdialogs.list.listItems
import kotlinx.android.synthetic.main.fragment_settings.*
import org.mosad.seil0.projectlaogai.R
/**
* The settings controller class

View File

@ -1,4 +1,4 @@
package org.mosad.seil0.projectlaogai
package org.mosad.seil0.projectlaogai.fragments
import android.os.Bundle
@ -6,6 +6,7 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import org.mosad.seil0.projectlaogai.R
/**
* The timetable controller class

View File

@ -1,3 +1,25 @@
/**
* ProjectLaogai
*
* Copyright 2018 <seil0@mosad.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
package org.mosad.seil0.projectlaogai.hsoparser
class DataTypes {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/colorPrimary"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/ic_launcher"/>
</item>
</layer-list>

View File

@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeFragment">
tools:context=".fragments.HomeFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MensaFragment">
tools:context=".fragments.MensaFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingsFragment">
tools:context=".fragments.SettingsFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TimeTableFragment">
tools:context=".fragments.TimeTableFragment">
<TextView
android:layout_width="match_parent"

View File

@ -7,6 +7,7 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
@ -14,4 +15,8 @@
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
</resources>