-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds an option to show a notification with buttons for predefined ambient sound mode, noise canceling mode, or equalizer profiles. The number of quick presets is limited to two due to the limit of three buttons on a notification. If more than two quick presets are needed in the future, a custom notification layout may be necessary.
- Loading branch information
Showing
37 changed files
with
987 additions
and
138 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
android/app/schemas/com.oppzippy.openscq30.room.AppDatabase/2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 2, | ||
"identityHash": "ee376b5d213217c100cea5afb6fb0b09", | ||
"entities": [ | ||
{ | ||
"tableName": "equalizer_custom_profile", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `values` BLOB NOT NULL, PRIMARY KEY(`name`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "name", | ||
"columnName": "name", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "values", | ||
"columnName": "values", | ||
"affinity": "BLOB", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"name" | ||
] | ||
}, | ||
"indices": [ | ||
{ | ||
"name": "index_equalizer_custom_profile_values", | ||
"unique": true, | ||
"columnNames": [ | ||
"values" | ||
], | ||
"orders": [], | ||
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_equalizer_custom_profile_values` ON `${TABLE_NAME}` (`values`)" | ||
} | ||
], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "quick_preset", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `ambientSoundMode` TEXT, `noiseCancelingMode` TEXT, `equalizerProfileName` TEXT, PRIMARY KEY(`id`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "ambientSoundMode", | ||
"columnName": "ambientSoundMode", | ||
"affinity": "TEXT", | ||
"notNull": false | ||
}, | ||
{ | ||
"fieldPath": "noiseCancelingMode", | ||
"columnName": "noiseCancelingMode", | ||
"affinity": "TEXT", | ||
"notNull": false | ||
}, | ||
{ | ||
"fieldPath": "equalizerProfileName", | ||
"columnName": "equalizerProfileName", | ||
"affinity": "TEXT", | ||
"notNull": false | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"id" | ||
] | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
} | ||
], | ||
"views": [], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ee376b5d213217c100cea5afb6fb0b09')" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...oid/app/src/main/java/com/oppzippy/openscq30/features/quickpresets/storage/QuickPreset.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.oppzippy.openscq30.features.quickpresets.storage | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
import com.oppzippy.openscq30.lib.AmbientSoundMode | ||
import com.oppzippy.openscq30.lib.NoiseCancelingMode | ||
|
||
@Entity( | ||
tableName = "quick_preset", | ||
) | ||
data class QuickPreset( | ||
@PrimaryKey val id: Int, | ||
val ambientSoundMode: AmbientSoundMode? = null, | ||
val noiseCancelingMode: NoiseCancelingMode? = null, | ||
val equalizerProfileName: String? = null, | ||
) |
21 changes: 21 additions & 0 deletions
21
.../app/src/main/java/com/oppzippy/openscq30/features/quickpresets/storage/QuickPresetDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.oppzippy.openscq30.features.quickpresets.storage | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
|
||
@Dao | ||
interface QuickPresetDao { | ||
@Query("SELECT * FROM quick_preset") | ||
suspend fun getAll(): List<QuickPreset> | ||
|
||
@Query("SELECT * FROM quick_preset WHERE id = :id") | ||
suspend fun get(id: Int): QuickPreset? | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
suspend fun insert(customProfile: QuickPreset) | ||
|
||
@Query("DELETE FROM quick_preset WHERE id = :id") | ||
suspend fun delete(id: Int) | ||
} |
18 changes: 18 additions & 0 deletions
18
...rc/main/java/com/oppzippy/openscq30/features/quickpresets/storage/QuickPresetDaoModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.oppzippy.openscq30.features.quickpresets.storage | ||
|
||
import com.oppzippy.openscq30.room.AppDatabase | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object QuickPresetDaoModule { | ||
@Provides | ||
@Singleton | ||
fun provideQuickPresetDao(database: AppDatabase): QuickPresetDao { | ||
return database.quickPresetDao() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.