add a null check to default ringtone uri

This commit is contained in:
tibbi 2016-12-18 16:30:49 +01:00
parent a1ed41944e
commit 0d37b0f100
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class Config(val context: Context) {
set(vibrate) = mPrefs.edit().putBoolean(VIBRATE, vibrate).apply()
var reminderSound: String
get() = mPrefs.getString(REMINDER_SOUND, RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION).toString())
get() = mPrefs.getString(REMINDER_SOUND, getDefaultNotificationSound())
set(path) = mPrefs.edit().putString(REMINDER_SOUND, path).apply()
var storedView: Int
@ -64,4 +64,6 @@ class Config(val context: Context) {
defaultReminderType = REMINDER_AT_START
mPrefs.edit().putInt(REMINDER_MINUTES, mins).apply()
}
fun getDefaultNotificationSound() = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
}