Wording, hide for older Android versions
This commit is contained in:
parent
f327c8ffdd
commit
c36e80c117
3 changed files with 16 additions and 10 deletions
|
@ -73,6 +73,10 @@ class NotificationService(val context: Context) {
|
||||||
maybeDeleteNotificationGroup(groupId)
|
maybeDeleteNotificationGroup(groupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun channelsSupported(): Boolean {
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
}
|
||||||
|
|
||||||
private fun subscriptionGroupId(subscription: Subscription): String {
|
private fun subscriptionGroupId(subscription: Subscription): String {
|
||||||
return subscription.id.toString()
|
return subscription.id.toString()
|
||||||
}
|
}
|
||||||
|
@ -339,7 +343,7 @@ class NotificationService(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeCreateNotificationChannel(group: String, priority: Int) {
|
private fun maybeCreateNotificationChannel(group: String, priority: Int) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (channelsSupported()) {
|
||||||
// Note: To change a notification channel, you must delete the old one and create a new one!
|
// Note: To change a notification channel, you must delete the old one and create a new one!
|
||||||
|
|
||||||
val channelId = toChannelId(group, priority)
|
val channelId = toChannelId(group, priority)
|
||||||
|
@ -378,19 +382,19 @@ class NotificationService(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeDeleteNotificationChannel(group: String, priority: Int) {
|
private fun maybeDeleteNotificationChannel(group: String, priority: Int) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (channelsSupported()) {
|
||||||
notificationManager.deleteNotificationChannel(toChannelId(group, priority))
|
notificationManager.deleteNotificationChannel(toChannelId(group, priority))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeCreateNotificationGroup(id: String, name: String) {
|
private fun maybeCreateNotificationGroup(id: String, name: String) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (channelsSupported()) {
|
||||||
notificationManager.createNotificationChannelGroup(NotificationChannelGroup(id, name))
|
notificationManager.createNotificationChannelGroup(NotificationChannelGroup(id, name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeDeleteNotificationGroup(id: String) {
|
private fun maybeDeleteNotificationGroup(id: String) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (channelsSupported()) {
|
||||||
notificationManager.deleteNotificationChannelGroup(id)
|
notificationManager.deleteNotificationChannelGroup(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,13 +115,15 @@ class DetailSettingsActivity : AppCompatActivity() {
|
||||||
private fun loadView() {
|
private fun loadView() {
|
||||||
if (subscription.upAppId == null) {
|
if (subscription.upAppId == null) {
|
||||||
loadInstantPref()
|
loadInstantPref()
|
||||||
loadDedicatedChannelsPrefs()
|
|
||||||
loadOpenChannelsPrefs()
|
|
||||||
loadMutedUntilPref()
|
loadMutedUntilPref()
|
||||||
loadMinPriorityPref()
|
loadMinPriorityPref()
|
||||||
loadAutoDeletePref()
|
loadAutoDeletePref()
|
||||||
loadIconSetPref()
|
loadIconSetPref()
|
||||||
loadIconRemovePref()
|
loadIconRemovePref()
|
||||||
|
if (notificationService.channelsSupported()) {
|
||||||
|
loadDedicatedChannelsPrefs()
|
||||||
|
loadOpenChannelsPrefs()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val notificationsHeaderId = context?.getString(R.string.detail_settings_notifications_header_key) ?: return
|
val notificationsHeaderId = context?.getString(R.string.detail_settings_notifications_header_key) ?: return
|
||||||
val notificationsHeader: PreferenceCategory? = findPreference(notificationsHeaderId)
|
val notificationsHeader: PreferenceCategory? = findPreference(notificationsHeaderId)
|
||||||
|
|
|
@ -350,10 +350,10 @@
|
||||||
<string name="detail_settings_notifications_instant_title">Instant delivery</string>
|
<string name="detail_settings_notifications_instant_title">Instant delivery</string>
|
||||||
<string name="detail_settings_notifications_instant_summary_on">Notifications are delivered instantly. Requires a foreground service and consumes more battery.</string>
|
<string name="detail_settings_notifications_instant_summary_on">Notifications are delivered instantly. Requires a foreground service and consumes more battery.</string>
|
||||||
<string name="detail_settings_notifications_instant_summary_off">Notifications are delivered using Firebase. Delivery may be delayed, but consumes less battery.</string>
|
<string name="detail_settings_notifications_instant_summary_off">Notifications are delivered using Firebase. Delivery may be delayed, but consumes less battery.</string>
|
||||||
<string name="detail_settings_notifications_dedicated_channels_title">Use dedicated channels</string>
|
<string name="detail_settings_notifications_dedicated_channels_title">Custom notification settings</string>
|
||||||
<string name="detail_settings_notifications_dedicated_channels_summary_on">Use dedicated notification channels for this subscription</string>
|
<string name="detail_settings_notifications_dedicated_channels_summary_on">Using dedicated notification channels for this subscription</string>
|
||||||
<string name="detail_settings_notifications_dedicated_channels_summary_off">Use default notification channels</string>
|
<string name="detail_settings_notifications_dedicated_channels_summary_off">Using default settings (sounds, Do Not Disturb override, etc.)</string>
|
||||||
<string name="detail_settings_notifications_open_channels_title">Configure dedicated channels</string>
|
<string name="detail_settings_notifications_open_channels_title">Configure notification settings</string>
|
||||||
<string name="detail_settings_notifications_open_channels_summary">Do Not Disturb (DND) override, sounds, etc.</string>
|
<string name="detail_settings_notifications_open_channels_summary">Do Not Disturb (DND) override, sounds, etc.</string>
|
||||||
<string name="detail_settings_appearance_header">Appearance</string>
|
<string name="detail_settings_appearance_header">Appearance</string>
|
||||||
<string name="detail_settings_appearance_icon_set_title">Subscription icon</string>
|
<string name="detail_settings_appearance_icon_set_title">Subscription icon</string>
|
||||||
|
|
Loading…
Reference in a new issue