Skip to content

Commit

Permalink
Add link to manage notifications to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wv5twkFEKh54vo4tta9yu7dHa3 authored and Gitsaibot committed Feb 1, 2024
1 parent 9861b4a commit b73640c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.provider.CalendarContract
import android.provider.Settings
import android.util.TypedValue
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
Expand All @@ -34,6 +35,7 @@ import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import com.android.calendar.Utils
import com.android.calendar.alerts.channelId
import com.android.calendar.persistence.CalendarRepository
import ws.xsoh.etar.R

Expand Down Expand Up @@ -133,11 +135,23 @@ class CalendarPreferences : PreferenceFragmentCompat() {
isSelectable = false
}


if (!isLocalAccount) {
screen.addPreference(synchronizePreference)
}

screen.addPreference(visiblePreference)

if(Utils.isOreoOrLater()){
val notificationPreference = Preference(context).apply {
title = getString(R.string.preferences_manage_notifications)
intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
putExtra(Settings.EXTRA_CHANNEL_ID, channelId(this@CalendarPreferences.calendarId))
}
}
screen.addPreference(notificationPreference)
}

screen.addPreference(colorPreference)
if (isLocalAccount) {
screen.addPreference(displayNamePreference)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@
<string name="preferences_calendar_info_category">Calendar information</string>
<string name="preferences_calendar_color">Color</string>
<string name="preferences_calendar_visible">Display events</string>
<!-- Button to access system notification preference for a given calendar -->
<string name="preferences_manage_notifications">Manage notifications</string>
<string name="preferences_calendar_synchronize">Synchronize this calendar</string>
<string name="preferences_calendar_color_warning_title">Warning</string>
<string name="preferences_calendar_color_warning_message">Changing the color may be reverted when the calendar is synchronized again.\n\nIn DAVx⁵ \'Manage calendar colors\' can be disabled to prevent this.</string>
Expand Down

0 comments on commit b73640c

Please sign in to comment.