-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audio ducking now supported during external notifications (#1009)
Co-authored-by: Matt Chowning <[email protected]>
- Loading branch information
Showing
11 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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
37 changes: 37 additions & 0 deletions
37
...s/src/main/java/au/com/shiftyjelly/pocketcasts/preferences/PlayOverNotificationSetting.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,37 @@ | ||
package au.com.shiftyjelly.pocketcasts.preferences | ||
|
||
import androidx.annotation.StringRes | ||
import au.com.shiftyjelly.pocketcasts.localization.R as LR | ||
|
||
enum class PlayOverNotificationSetting( | ||
val preferenceInt: Int, | ||
@StringRes val titleRes: Int, | ||
val analyticsString: String, | ||
) { | ||
NEVER( | ||
titleRes = LR.string.settings_notification_play_over_never, | ||
preferenceInt = 2, | ||
analyticsString = "never" | ||
), | ||
DUCK( | ||
titleRes = LR.string.settings_notification_play_over_duck, | ||
preferenceInt = 1, | ||
analyticsString = "duck" | ||
), | ||
ALWAYS( | ||
titleRes = LR.string.settings_notification_play_over_always, | ||
preferenceInt = 0, | ||
analyticsString = "always" | ||
); | ||
|
||
companion object { | ||
fun fromPreferenceString(stringValue: String): PlayOverNotificationSetting { | ||
try { | ||
val intValue = stringValue.toInt() | ||
return values().first { it.preferenceInt == intValue } | ||
} catch (e: Exception) { | ||
throw IllegalStateException("Unknown play over notification setting: $stringValue") | ||
} | ||
} | ||
} | ||
} |
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
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
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
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
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
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