azea/Splash #2
20 changed files with 106 additions and 43 deletions
|
@ -75,6 +75,8 @@ dependencies {
|
|||
def arch_version = "2.2.0"
|
||||
def roomVersion = '2.3.0'
|
||||
|
||||
implementation 'androidx.core:core-splashscreen:1.0.1'
|
||||
|
||||
|
||||
// ViewModel
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
|
|
|
@ -14,16 +14,19 @@
|
|||
android:theme="@style/Theme.Ophelia"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".view.splash.SplashActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Ophelia">
|
||||
android:theme="@style/SplashScreenTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,8 +1,5 @@
|
|||
package com.menagerie.ophelia.database.polycule
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
@ -10,7 +7,6 @@ import androidx.lifecycle.asLiveData
|
|||
import androidx.lifecycle.viewModelScope
|
||||
import com.menagerie.ophelia.database.polycule.entity.Bio
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.IllegalArgumentException
|
||||
|
||||
|
||||
class BioListViewModel(private val repository: PolyculeRepository) : ViewModel() {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.menagerie.ophelia.database.polycule
|
||||
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import com.menagerie.ophelia.database.polycule.entity.Bio
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.menagerie.ophelia.database.polycule
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
|
@ -34,7 +33,6 @@ abstract class PolyculeDatabase : RoomDatabase() {
|
|||
): PolyculeDatabase {
|
||||
return INSTANCE ?: synchronized(this)
|
||||
{
|
||||
Log.d("huh?", "FUCK")
|
||||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext,
|
||||
PolyculeDatabase::class.java,
|
||||
|
@ -55,41 +53,24 @@ abstract class PolyculeDatabase : RoomDatabase() {
|
|||
|
||||
override fun onCreate(db: SupportSQLiteDatabase) {
|
||||
super.onCreate(db)
|
||||
Log.d("WWW" , "FUCK")
|
||||
INSTANCE?.let { database ->
|
||||
scope.launch {
|
||||
Log.d("WWWWWWWWW", "FUCK")
|
||||
populateDatabase(database.bioDao())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun populateDatabase(bioDao: BioDao) {
|
||||
Log.d("TAWNI", "AAAAA")
|
||||
|
||||
var bio = Bio(
|
||||
name = "Fuck")
|
||||
name = "Azea")
|
||||
bioDao.insert(bio)
|
||||
bio = Bio(
|
||||
name = "Off")
|
||||
bioDao.insert(bio)
|
||||
|
||||
|
||||
|
||||
bio = Bio(
|
||||
name = "Android!")
|
||||
name = "Darkwood Mill")
|
||||
bioDao.insert(bio)
|
||||
bio = Bio(
|
||||
name = "(Now")
|
||||
bioDao.insert(bio)
|
||||
bio = Bio(
|
||||
name = "In")
|
||||
bioDao.insert(bio)
|
||||
bio = Bio(
|
||||
name = "Compose!)")
|
||||
name = "Blizzard")
|
||||
bioDao.insert(bio)
|
||||
val count = bioDao.getAllAlphabetisedBios().count()
|
||||
Log.d("Count", "$count")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.menagerie.ophelia.database.polycule
|
|||
|
||||
import com.menagerie.ophelia.database.polycule.entity.Bio
|
||||
|
||||
//Todo: Move repo access to manager to limit passing it around
|
||||
object PolyculeDatabaseManager {
|
||||
|
||||
lateinit var polyculeRepository : PolyculeRepository
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.menagerie.ophelia.database.polycule
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.menagerie.ophelia.database.polycule.entity.Bio
|
||||
import com.menagerie.ophelia.database.polycule.entity.BioDao
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.count
|
||||
|
||||
|
||||
class PolyculeRepository(
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.menagerie.ophelia.database.polycule.entity
|
|||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(
|
||||
|
|
|
@ -5,7 +5,6 @@ import androidx.room.Insert
|
|||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.count
|
||||
|
||||
@Dao
|
||||
abstract class BioDao {
|
||||
|
|
|
@ -4,7 +4,6 @@ import androidx.room.Dao
|
|||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.menagerie.ophelia.database.polycule.entity.Identity
|
||||
|
||||
@Dao
|
||||
abstract class IdentityDao {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.menagerie.ophelia.view.splash
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.menagerie.ophelia.MainActivity
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
@SuppressLint("CustomSplashScreen")
|
||||
class SplashActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val splashScreen = installSplashScreen()
|
||||
splashScreen.setKeepOnScreenCondition { true }
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
//TODO : Figure out how to update this properly
|
||||
lifecycleScope.launchWhenCreated {
|
||||
delay(1500)
|
||||
|
||||
val intent = Intent(this@SplashActivity,
|
||||
MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
app/src/main/res/drawable/bg_splash.xml
Normal file
11
app/src/main/res/drawable/bg_splash.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<color android:color="@color/purple_200"/>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/ophelia_background"/>
|
||||
</item>
|
||||
</layer-list>
|
13
app/src/main/res/drawable/bg_splash_12.xml
Normal file
13
app/src/main/res/drawable/bg_splash_12.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<color android:color="@color/purple_200"/>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:width="140dp"
|
||||
android:height="180dp"
|
||||
android:drawable="@drawable/ophelia_background"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
BIN
app/src/main/res/drawable/ic_app_logo.png
Normal file
BIN
app/src/main/res/drawable/ic_app_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
10
app/src/main/res/drawable/ophelia_background.xml
Normal file
10
app/src/main/res/drawable/ophelia_background.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#7dae7d"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
</vector>
|
5
app/src/main/res/drawable/ophelia_foreground.xml
Normal file
5
app/src/main/res/drawable/ophelia_foreground.xml
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@drawable/ophelia_background" />
|
||||
<foreground android:drawable="@drawable/ophelia_foreground" />
|
||||
<monochrome android:drawable="@drawable/ophelia_foreground" />
|
||||
</adaptive-icon>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@drawable/ophelia_background" />
|
||||
<foreground android:drawable="@drawable/ophelia_foreground" />
|
||||
<monochrome android:drawable="@drawable/ophelia_foreground" />
|
||||
</adaptive-icon>
|
10
app/src/main/res/values-v31/themes.xml
Normal file
10
app/src/main/res/values-v31/themes.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Ophelia" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
<style name="SplashScreenTheme" parent="Theme.Ophelia">
|
||||
<item name="windowSplashScreenBackground">@color/purple_200</item>
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/bg_splash_12</item>
|
||||
<item name="windowSplashScreenAnimationDuration">800</item>
|
||||
<item name="postSplashScreenTheme">@style/Theme.Ophelia</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Ophelia" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
<style name="SplashScreenTheme" parent="Theme.Ophelia">
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
</style>
|
||||
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue