Refactor widgets
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user