@ -61,7 +61,6 @@ class Notifications : InjectingPreferenceFragment() {
)
rescheduleNotificationsOnChange ( true , R . string . p _bundle _notifications )
initializeRingtonePreference ( )
initializeCompletionSoundPreference ( )
initializeTimePreference ( getDefaultRemindTimePreference ( ) !! , REQUEST _DEFAULT _REMIND )
initializeTimePreference ( getQuietStartPreference ( ) !! , REQUEST _QUIET _START )
@ -140,13 +139,6 @@ class Notifications : InjectingPreferenceFragment() {
openUrl ( R . string . troubleshooting , R . string . url _notifications )
requires ( AndroidUtilities . atLeastOreo ( ) , R . string . more _settings )
requires (
AndroidUtilities . preOreo ( ) ,
R . string . p _rmd _ringtone ,
R . string . p _rmd _vibrate ,
R . string . p _led _notification
)
requires (
AndroidUtilities . preUpsideDownCake ( ) ,
R . string . p _rmd _persistent ,
@ -199,7 +191,6 @@ class Notifications : InjectingPreferenceFragment() {
override fun onPreferenceTreeClick ( preference : Preference ) : Boolean =
when ( preference . key ) {
getString ( R . string . p _rmd _ringtone ) ,
getString ( R . string . p _completion _ringtone ) -> {
val intent = Intent ( RingtoneManager . ACTION _RINGTONE _PICKER )
intent . putExtra (
@ -233,11 +224,7 @@ class Notifications : InjectingPreferenceFragment() {
}
startActivityForResult (
intent ,
if ( preference . key == getString ( R . string . p _rmd _ringtone ) ) {
REQUEST _CODE _ALERT _RINGTONE
} else {
REQUEST _CODE _COMPLETION _SOUND
}
)
true
}
@ -267,12 +254,6 @@ class Notifications : InjectingPreferenceFragment() {
}
}
private fun initializeRingtonePreference ( ) =
initializeRingtonePreference (
R . string . p _rmd _ringtone ,
R . string . silent ,
)
private fun initializeCompletionSoundPreference ( ) =
initializeRingtonePreference (
R . string . p _completion _ringtone ,
@ -310,16 +291,6 @@ class Notifications : InjectingPreferenceFragment() {
override fun onActivityResult ( requestCode : Int , resultCode : Int , data : Intent ? ) {
when ( requestCode ) {
REQUEST _CODE _ALERT _RINGTONE -> if ( resultCode == RESULT _OK && data != null ) {
val ringtone : Uri ? =
data . getParcelableExtra ( RingtoneManager . EXTRA _RINGTONE _PICKED _URI )
if ( ringtone != null ) {
preferences . setString ( R . string . p _rmd _ringtone , ringtone . toString ( ) )
} else {
preferences . setString ( R . string . p _rmd _ringtone , " " )
}
initializeRingtonePreference ( )
}
REQUEST _CODE _COMPLETION _SOUND -> if ( resultCode == RESULT _OK && data != null ) {
val ringtone : Uri ? =
data . getParcelableExtra ( RingtoneManager . EXTRA _RINGTONE _PICKED _URI )
@ -354,7 +325,6 @@ class Notifications : InjectingPreferenceFragment() {
private const val REQUEST _QUIET _START = 10001
private const val REQUEST _QUIET _END = 10002
private const val REQUEST _DEFAULT _REMIND = 10003
private const val REQUEST _CODE _ALERT _RINGTONE = 10005
private const val REQUEST _CODE _TTS _CHECK = 10006
private const val REQUEST _CODE _COMPLETION _SOUND = 10007
}