Location: add icons for available payment methods (#1408)
* add backend for PaymentMethod.kt * change type of acceptedPaymentMethods to Map<PaymentMethod, Boolean> * add icons to UI and reduce PaymentMethod.kt to Cash and Card * make OSM parsing for acceptedPaymentMethods correct (in an opinionated way) * use Toll and TollOff icons * fix seperator on empty payment methods * fix sharedElement and animateEnterExit labels that are not part of the sharedElement * (feat) shape schemes --------- Co-authored-by: MM20 <15646950+MM2-0@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,8 @@ import de.mm20.launcher2.database.entities.IconPackEntity
|
||||
import de.mm20.launcher2.database.entities.PluginEntity
|
||||
import de.mm20.launcher2.database.entities.SavedSearchableEntity
|
||||
import de.mm20.launcher2.database.entities.SearchActionEntity
|
||||
import de.mm20.launcher2.database.entities.ThemeEntity
|
||||
import de.mm20.launcher2.database.entities.ColorsEntity
|
||||
import de.mm20.launcher2.database.entities.ShapesEntity
|
||||
import de.mm20.launcher2.database.entities.WidgetEntity
|
||||
import de.mm20.launcher2.database.migrations.Migration_10_11
|
||||
import de.mm20.launcher2.database.migrations.Migration_11_12
|
||||
@@ -37,6 +38,7 @@ import de.mm20.launcher2.database.migrations.Migration_23_24
|
||||
import de.mm20.launcher2.database.migrations.Migration_24_25
|
||||
import de.mm20.launcher2.database.migrations.Migration_25_26
|
||||
import de.mm20.launcher2.database.migrations.Migration_26_27
|
||||
import de.mm20.launcher2.database.migrations.Migration_27_28
|
||||
import de.mm20.launcher2.database.migrations.Migration_6_7
|
||||
import de.mm20.launcher2.database.migrations.Migration_7_8
|
||||
import de.mm20.launcher2.database.migrations.Migration_8_9
|
||||
@@ -54,9 +56,10 @@ import java.util.UUID
|
||||
WidgetEntity::class,
|
||||
CustomAttributeEntity::class,
|
||||
SearchActionEntity::class,
|
||||
ThemeEntity::class,
|
||||
ColorsEntity::class,
|
||||
PluginEntity::class,
|
||||
], version = 27, exportSchema = true
|
||||
ShapesEntity::class,
|
||||
], version = 28, exportSchema = true
|
||||
)
|
||||
@TypeConverters(ComponentNameConverter::class)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
@@ -156,6 +159,7 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
Migration_24_25(),
|
||||
Migration_25_26(),
|
||||
Migration_26_27(),
|
||||
Migration_27_28(),
|
||||
).build()
|
||||
if (_instance == null) _instance = instance
|
||||
return instance
|
||||
|
||||
@@ -4,30 +4,52 @@ import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import de.mm20.launcher2.database.entities.ThemeEntity
|
||||
import de.mm20.launcher2.database.entities.ColorsEntity
|
||||
import de.mm20.launcher2.database.entities.ShapesEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import java.util.UUID
|
||||
|
||||
@Dao
|
||||
interface ThemeDao {
|
||||
@Query("SELECT * FROM Theme")
|
||||
fun getAll(): Flow<List<ThemeEntity>>
|
||||
fun getAllColors(): Flow<List<ColorsEntity>>
|
||||
|
||||
@Query("SELECT * FROM Shapes")
|
||||
fun getAllShapes(): Flow<List<ShapesEntity>>
|
||||
|
||||
@Query("SELECT * FROM Theme WHERE id = :id LIMIT 1")
|
||||
fun get(id: UUID): Flow<ThemeEntity?>
|
||||
fun getColors(id: UUID): Flow<ColorsEntity?>
|
||||
|
||||
@Query("SELECT * FROM Shapes WHERE id = :id LIMIT 1")
|
||||
fun getShapes(id: UUID): Flow<ShapesEntity?>
|
||||
|
||||
@Insert
|
||||
suspend fun insert(theme: ThemeEntity)
|
||||
suspend fun insertColors(colors: ColorsEntity)
|
||||
|
||||
@Insert
|
||||
suspend fun insertShapes(shapes: ShapesEntity)
|
||||
|
||||
@Update
|
||||
suspend fun update(theme: ThemeEntity)
|
||||
suspend fun updateColors(colors: ColorsEntity)
|
||||
|
||||
@Update
|
||||
suspend fun updateShapes(shapes: ShapesEntity)
|
||||
|
||||
@Query("DELETE FROM Theme WHERE id = :id")
|
||||
suspend fun delete(id: UUID)
|
||||
suspend fun deleteColors(id: UUID)
|
||||
|
||||
@Query("DELETE FROM Shapes WHERE id = :id")
|
||||
suspend fun deleteShapes(id: UUID)
|
||||
|
||||
@Query("DELETE FROM Theme")
|
||||
suspend fun deleteAll()
|
||||
suspend fun deleteAllColors()
|
||||
|
||||
@Query("DELETE FROM Shapes")
|
||||
suspend fun deleteAllShapes()
|
||||
|
||||
@Insert
|
||||
fun insertAll(themes: List<ThemeEntity>)
|
||||
fun insertAllColors(colors: List<ColorsEntity>)
|
||||
|
||||
@Insert
|
||||
fun insertAllShapes(shapes: List<ShapesEntity>)
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import androidx.room.PrimaryKey
|
||||
import java.util.UUID
|
||||
|
||||
@Entity(tableName = "Theme")
|
||||
data class ThemeEntity(
|
||||
data class ColorsEntity(
|
||||
@PrimaryKey val id: UUID,
|
||||
val name: String,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.mm20.launcher2.database.entities
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import java.util.UUID
|
||||
|
||||
@Entity(tableName = "Shapes")
|
||||
data class ShapesEntity(
|
||||
@PrimaryKey val id: UUID,
|
||||
val name: String,
|
||||
|
||||
val baseShape: String,
|
||||
|
||||
val extraSmall: String? = null,
|
||||
val small: String? = null,
|
||||
val medium: String? = null,
|
||||
val large: String? = null,
|
||||
val largeIncreased: String? = null,
|
||||
val extraLarge: String? = null,
|
||||
val extraLargeIncreased: String? = null,
|
||||
val extraExtraLarge: String? = null,
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
package de.mm20.launcher2.database.migrations
|
||||
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
class Migration_27_28: Migration(27, 28) {
|
||||
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
db.execSQL(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS `Shapes` (
|
||||
`id` BLOB NOT NULL PRIMARY KEY,
|
||||
`name` TEXT NOT NULL,
|
||||
`baseShape` TEXT NOT NULL,
|
||||
`extraSmall` TEXT,
|
||||
`small` TEXT,
|
||||
`medium` TEXT,
|
||||
`large` TEXT,
|
||||
`largeIncreased` TEXT,
|
||||
`extraLarge` TEXT,
|
||||
`extraLargeIncreased` TEXT,
|
||||
`extraExtraLarge` TEXT
|
||||
)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user