Bimba.git

ref: 84baea2e358831b29e22b269f8f578abc6111e26

app/src/main/java/ml/adamsprogs/bimba/activities/SplashActivity.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package ml.adamsprogs.bimba.activities

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.content.Intent
import android.database.sqlite.SQLiteCantOpenDatabaseException
import ml.adamsprogs.bimba.models.Timetable


class SplashActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        try {
            val timetable = Timetable.getTimetable(this)
            if (timetable.isEmpty())
                startActivity(Intent(this, NoDbActivity::class.java))
            else
                startActivity(Intent(this, DashActivity::class.java))
        } catch(e: SQLiteCantOpenDatabaseException) {
            startActivity(Intent(this, NoDbActivity::class.java))
        }
        finish()
    }
}