mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-12 09:50:48 +01:00
show the current DisplayPastEvents period in settings
This commit is contained in:
parent
ea498e2bc1
commit
120041cd09
@ -336,7 +336,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
}
|
||||
|
||||
private fun updateReminder1Text() {
|
||||
event_reminder_1.text = getReminderText(mReminder1Minutes)
|
||||
event_reminder_1.text = getFormattedMinutes(mReminder1Minutes)
|
||||
if (mReminder1Minutes == REMINDER_OFF) {
|
||||
mReminder2Minutes = REMINDER_OFF
|
||||
mReminder3Minutes = REMINDER_OFF
|
||||
@ -351,7 +351,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
alpha = 0.4f
|
||||
mReminder3Minutes = REMINDER_OFF
|
||||
} else {
|
||||
text = getReminderText(mReminder2Minutes)
|
||||
text = getFormattedMinutes(mReminder2Minutes)
|
||||
alpha = 1f
|
||||
}
|
||||
}
|
||||
@ -364,7 +364,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
text = resources.getString(R.string.add_another_reminder)
|
||||
alpha = 0.4f
|
||||
} else {
|
||||
text = getReminderText(mReminder3Minutes)
|
||||
text = getFormattedMinutes(mReminder3Minutes)
|
||||
alpha = 1f
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,11 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog
|
||||
import com.simplemobiletools.calendar.dialogs.SnoozePickerDialog
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||
import com.simplemobiletools.calendar.extensions.getReminderText
|
||||
import com.simplemobiletools.calendar.extensions.getFormattedMinutes
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
@ -203,12 +204,12 @@ class SettingsActivity : SimpleActivity() {
|
||||
|
||||
private fun setupEventReminder() {
|
||||
var reminderMinutes = config.defaultReminderMinutes
|
||||
settings_default_reminder.text = getReminderText(reminderMinutes)
|
||||
settings_default_reminder.text = getFormattedMinutes(reminderMinutes)
|
||||
settings_default_reminder_holder.setOnClickListener {
|
||||
showEventReminderDialog(reminderMinutes) {
|
||||
config.defaultReminderMinutes = it
|
||||
reminderMinutes = it
|
||||
settings_default_reminder.text = getReminderText(it)
|
||||
settings_default_reminder.text = getFormattedMinutes(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,7 +223,24 @@ class SettingsActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun setupDisplayPastEvents() {
|
||||
updatePastEventsText()
|
||||
settings_display_past_events_holder.setOnClickListener {
|
||||
CustomEventReminderDialog(this) {
|
||||
config.displayPastEvents = it
|
||||
updatePastEventsText()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePastEventsText() {
|
||||
settings_display_past_events.text = getDisplayPastEventsText(config.displayPastEvents)
|
||||
}
|
||||
|
||||
private fun getDisplayPastEventsText(displayPastEvents: Int): String {
|
||||
return if (displayPastEvents == 0)
|
||||
getString(R.string.never)
|
||||
else
|
||||
getFormattedMinutes(displayPastEvents)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog
|
||||
import com.simplemobiletools.calendar.dialogs.CustomEventRepeatIntervalDialog
|
||||
import com.simplemobiletools.calendar.extensions.getReminderText
|
||||
import com.simplemobiletools.calendar.extensions.getFormattedMinutes
|
||||
import com.simplemobiletools.calendar.extensions.getRepetitionText
|
||||
import com.simplemobiletools.calendar.helpers.DAY
|
||||
import com.simplemobiletools.calendar.helpers.MONTH
|
||||
@ -36,7 +36,7 @@ open class SimpleActivity : BaseSimpleActivity() {
|
||||
val items = ArrayList<RadioItem>(minutes.size + 1)
|
||||
minutes.mapIndexedTo(items, {
|
||||
index, value ->
|
||||
RadioItem(index, getReminderText(value), value)
|
||||
RadioItem(index, getFormattedMinutes(value), value)
|
||||
})
|
||||
|
||||
var selectedIndex = 0
|
||||
|
@ -109,11 +109,17 @@ private fun getNotificationIntent(context: Context, eventId: Int): PendingIntent
|
||||
|
||||
fun Context.getAppropriateTheme() = if (config.backgroundColor.getContrastColor() == Color.WHITE) R.style.MyDialogTheme_Dark else R.style.MyDialogTheme
|
||||
|
||||
fun Context.getReminderText(minutes: Int) = when (minutes) {
|
||||
fun Context.getFormattedMinutes(minutes: Int) = when (minutes) {
|
||||
-1 -> getString(R.string.no_reminder)
|
||||
0 -> getString(R.string.at_start)
|
||||
else -> {
|
||||
if (minutes % 1440 == 0)
|
||||
if (minutes % 525600 == 0)
|
||||
resources.getQuantityString(R.plurals.years, minutes / 525600, minutes / 525600)
|
||||
if (minutes % 43200 == 0)
|
||||
resources.getQuantityString(R.plurals.months, minutes / 43200, minutes / 43200)
|
||||
else if (minutes % 10080 == 0)
|
||||
resources.getQuantityString(R.plurals.weeks, minutes / 10080, minutes / 10080)
|
||||
else if (minutes % 1440 == 0)
|
||||
resources.getQuantityString(R.plurals.days, minutes / 1440, minutes / 1440)
|
||||
else if (minutes % 60 == 0)
|
||||
resources.getQuantityString(R.plurals.hours_before, minutes / 60, minutes / 60)
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Januar</string>
|
||||
<string name="february">Februar</string>
|
||||
<string name="march">März</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Enero</string>
|
||||
<string name="february">Febrero</string>
|
||||
<string name="march">Marzo</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Janvier</string>
|
||||
<string name="february">Février</string>
|
||||
<string name="march">Mars</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">जनवरी</string>
|
||||
<string name="february">फरवरी</string>
|
||||
<string name="march">मार्च</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Január</string>
|
||||
<string name="february">Február</string>
|
||||
<string name="march">Március</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Gennaio</string>
|
||||
<string name="february">Febbraio</string>
|
||||
<string name="march">Marzo</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">ינואר</string>
|
||||
<string name="february">פברואר</string>
|
||||
<string name="march">מרץ</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">1月</string>
|
||||
<string name="february">2月</string>
|
||||
<string name="march">3月</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">janeiro</string>
|
||||
<string name="february">fevereiro</string>
|
||||
<string name="march">março</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">janeiro</string>
|
||||
<string name="february">fevereiro</string>
|
||||
<string name="march">março</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Январь</string>
|
||||
<string name="february">Февраль</string>
|
||||
<string name="march">Март</string>
|
||||
|
@ -205,6 +205,8 @@
|
||||
<item quantity="other">%1$d hodín</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Nikdy</string>
|
||||
|
||||
<string name="january">Január</string>
|
||||
<string name="february">Február</string>
|
||||
<string name="march">Marec</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Januari</string>
|
||||
<string name="february">Februari</string>
|
||||
<string name="march">Mars</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">Ocak</string>
|
||||
<string name="february">Şubat</string>
|
||||
<string name="march">Mart</string>
|
||||
|
@ -196,6 +196,8 @@
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
|
||||
<string name="never">Never</string>
|
||||
|
||||
<string name="january">January</string>
|
||||
<string name="february">February</string>
|
||||
<string name="march">March</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user