fix #392, properly format snooze time in settings
This commit is contained in:
parent
555496e828
commit
6c438b5cc1
|
@ -46,7 +46,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:3.15.4'
|
implementation 'com.simplemobiletools:commons:3.15.5'
|
||||||
implementation 'joda-time:joda-time:2.9.9'
|
implementation 'joda-time:joda-time:2.9.9'
|
||||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
|
|
|
@ -327,16 +327,10 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSnoozeText() {
|
private fun updateSnoozeText() {
|
||||||
settings_snooze_delay.text = res.getQuantityString(R.plurals.by_minutes, config.snoozeTime, config.snoozeTime)
|
settings_snooze_delay.text = formatMinutesToTimeString(config.snoozeTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getHoursString(hours: Int): String {
|
private fun getHoursString(hours: Int) = String.format("%02d:00", hours)
|
||||||
return if (hours < 10) {
|
|
||||||
"0$hours:00"
|
|
||||||
} else {
|
|
||||||
"$hours:00"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupDisplayPastEvents() {
|
private fun setupDisplayPastEvents() {
|
||||||
var displayPastEvents = config.displayPastEvents
|
var displayPastEvents = config.displayPastEvents
|
||||||
|
@ -385,10 +379,10 @@ class SettingsActivity : SimpleActivity() {
|
||||||
else -> R.string.large
|
else -> R.string.large
|
||||||
})
|
})
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
if (requestCode == GET_RINGTONE_URI) {
|
if (requestCode == GET_RINGTONE_URI) {
|
||||||
var uri = data?.getParcelableExtra<Parcelable>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
var uri = resultData?.getParcelableExtra<Parcelable>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
||||||
|
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
config.reminderSound = ""
|
config.reminderSound = ""
|
||||||
|
|
|
@ -244,7 +244,7 @@ private fun getPendingIntent(context: Context, event: Event): PendingIntent {
|
||||||
|
|
||||||
private fun getSnoozePendingIntent(context: Context, event: Event): PendingIntent {
|
private fun getSnoozePendingIntent(context: Context, event: Event): PendingIntent {
|
||||||
val snoozeClass = if (context.config.useSameSnooze) SnoozeService::class.java else SnoozeReminderActivity::class.java
|
val snoozeClass = if (context.config.useSameSnooze) SnoozeService::class.java else SnoozeReminderActivity::class.java
|
||||||
val intent = Intent(context, snoozeClass).setAction("Snoozeee")
|
val intent = Intent(context, snoozeClass).setAction("Snooze")
|
||||||
intent.putExtra(EVENT_ID, event.id)
|
intent.putExtra(EVENT_ID, event.id)
|
||||||
return if (context.config.useSameSnooze) {
|
return if (context.config.useSameSnooze) {
|
||||||
PendingIntent.getService(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
PendingIntent.getService(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
|
Loading…
Reference in New Issue