[feat] Video position remember& New Icon and Theme

This commit is contained in:
acite
2025-09-18 23:44:07 +08:00
parent a15325deeb
commit 1b24312a95
26 changed files with 118 additions and 62 deletions

View File

@@ -0,0 +1,12 @@
package com.acitelight.aether.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity
data class VideoRecord (
@PrimaryKey(autoGenerate = false) val id: String = "",
@ColumnInfo(name = "name") val klass: String = "",
@ColumnInfo(name = "position") val position: Long
)

View File

@@ -0,0 +1,27 @@
package com.acitelight.aether.model
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import kotlinx.coroutines.flow.Flow
@Dao
interface VideoRecordDao {
@Query("SELECT * FROM videorecord")
fun getAll(): Flow<List<VideoRecord>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(rec: VideoRecord)
@Update
suspend fun update(rec: VideoRecord)
@Delete
suspend fun delete(rec: VideoRecord)
@Query("SELECT * FROM videorecord WHERE id = :id")
suspend fun getById(id: String): VideoRecord?
}

View File

@@ -0,0 +1,28 @@
package com.acitelight.aether.model
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
@Database(entities = [VideoRecord::class], version = 1)
abstract class VideoRecordDatabase : RoomDatabase() {
abstract fun userDao(): VideoRecordDao
companion object {
@Volatile
private var INSTANCE: VideoRecordDatabase? = null
fun getDatabase(context: Context): VideoRecordDatabase {
return INSTANCE ?: synchronized(this) {
val instance = Room.databaseBuilder(
context.applicationContext,
VideoRecordDatabase::class.java,
"videorecord_database"
).build()
INSTANCE = instance
instance
}
}
}
}