Refactor widgets

This commit is contained in:
MM20
2022-03-29 18:14:07 +02:00
parent 2e43b871c5
commit 956af82f79
21 changed files with 804 additions and 846 deletions
@@ -1,7 +1,9 @@
package de.mm20.launcher2.database
import androidx.lifecycle.LiveData
import androidx.room.*
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Transaction
import de.mm20.launcher2.database.entities.WidgetEntity
import kotlinx.coroutines.flow.Flow
@@ -19,6 +21,16 @@ interface WidgetDao {
@Insert
fun insertAll(widgets: List<WidgetEntity>)
@Insert
fun insert(widget: WidgetEntity)
@Query("DELETE FROM Widget")
fun deleteAll()
@Query("DELETE FROM Widget WHERE data = :data AND type = :type")
fun deleteWidget(type: String, data: String)
@Query("UPDATE Widget SET height = :newHeight WHERE data = :data AND type = :type")
fun updateHeight(type: String, data: String, newHeight: Int)
}