mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
so repeating by weekdays apparently belongs to the weekly repetition
This commit is contained in:
@@ -152,8 +152,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||||||
updateRepetitionText()
|
updateRepetitionText()
|
||||||
checkRepeatTexts(interval)
|
checkRepeatTexts(interval)
|
||||||
|
|
||||||
if (mRepeatInterval == DAY) {
|
if (mRepeatInterval == WEEK) {
|
||||||
setRepeatRule(config.defaultDailyRepetition)
|
setRepeatRule(Math.pow(2.0, (mEventStartDateTime.dayOfWeek - 1).toDouble()).toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||||||
event_repetition_limit_holder.beGoneIf(limit == 0)
|
event_repetition_limit_holder.beGoneIf(limit == 0)
|
||||||
checkRepetitionLimitText()
|
checkRepetitionLimitText()
|
||||||
|
|
||||||
event_repetition_rule_holder.beVisibleIf(mRepeatInterval == DAY)
|
event_repetition_rule_holder.beVisibleIf(mRepeatInterval == WEEK)
|
||||||
checkRepetitionRuleText()
|
checkRepetitionRuleText()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showRepetitionRuleDialog() {
|
private fun showRepetitionRuleDialog() {
|
||||||
if (mRepeatInterval == DAY) {
|
if (mRepeatInterval == WEEK) {
|
||||||
RepeatRuleDailyDialog(this, mRepeatRule) {
|
RepeatRuleDailyDialog(this, mRepeatRule) {
|
||||||
setRepeatRule(it)
|
setRepeatRule(it)
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkRepetitionRuleText() {
|
private fun checkRepetitionRuleText() {
|
||||||
if (mRepeatInterval == DAY) {
|
if (mRepeatInterval == WEEK) {
|
||||||
event_repetition_rule.text = getString(if (mRepeatRule == EVERY_DAY) R.string.every_day else R.string.selected_days)
|
event_repetition_rule.text = getString(if (mRepeatRule == EVERY_DAY) R.string.every_day else R.string.selected_days)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,9 @@ import android.net.Uri
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.dialogs.RepeatRuleDailyDialog
|
|
||||||
import com.simplemobiletools.calendar.extensions.config
|
import com.simplemobiletools.calendar.extensions.config
|
||||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||||
import com.simplemobiletools.calendar.extensions.getReminderText
|
import com.simplemobiletools.calendar.extensions.getReminderText
|
||||||
import com.simplemobiletools.calendar.helpers.EVERY_DAY
|
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
@@ -52,7 +50,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupWeeklyEnd()
|
setupWeeklyEnd()
|
||||||
setupVibrate()
|
setupVibrate()
|
||||||
setupReminderSound()
|
setupReminderSound()
|
||||||
setupDailyRepetition()
|
|
||||||
setupEventReminder()
|
setupEventReminder()
|
||||||
updateTextColors(settings_holder)
|
updateTextColors(settings_holder)
|
||||||
checkPrimaryColor()
|
checkPrimaryColor()
|
||||||
@@ -187,20 +184,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupDailyRepetition() {
|
|
||||||
updateDailyRepetitionText()
|
|
||||||
settings_default_daily_repetition_holder.setOnClickListener {
|
|
||||||
RepeatRuleDailyDialog(this, config.defaultDailyRepetition) {
|
|
||||||
config.defaultDailyRepetition = it
|
|
||||||
updateDailyRepetitionText()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateDailyRepetitionText() {
|
|
||||||
settings_default_daily_repetition.text = getString(if (config.defaultDailyRepetition == EVERY_DAY) R.string.every_day else R.string.selected_days)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupEventReminder() {
|
private fun setupEventReminder() {
|
||||||
var reminderMinutes = config.defaultReminderMinutes
|
var reminderMinutes = config.defaultReminderMinutes
|
||||||
settings_default_reminder.text = getReminderText(reminderMinutes)
|
settings_default_reminder.text = getReminderText(reminderMinutes)
|
||||||
|
@@ -57,12 +57,12 @@ fun Context.scheduleNextEventReminder(event: Event) {
|
|||||||
reminderSeconds.forEach {
|
reminderSeconds.forEach {
|
||||||
var startTS = event.startTS - it
|
var startTS = event.startTS - it
|
||||||
if (event.repeatInterval == DAY) {
|
if (event.repeatInterval == DAY) {
|
||||||
while (startTS < now || isOccurrenceIgnored(event, startTS, it) || isWrongDay(event, startTS, it)) {
|
while (startTS < now || isOccurrenceIgnored(event, startTS, it)) {
|
||||||
startTS += event.repeatInterval
|
startTS += event.repeatInterval
|
||||||
}
|
}
|
||||||
nextTS = Math.min(nextTS, startTS)
|
nextTS = Math.min(nextTS, startTS)
|
||||||
} else if (event.repeatInterval == WEEK) {
|
} else if (event.repeatInterval == WEEK) {
|
||||||
while (startTS < now || isOccurrenceIgnored(event, startTS, it)) {
|
while (startTS < now || isOccurrenceIgnored(event, startTS, it) || isWrongDay(event, startTS, it)) {
|
||||||
startTS += event.repeatInterval
|
startTS += event.repeatInterval
|
||||||
}
|
}
|
||||||
nextTS = Math.min(nextTS, startTS)
|
nextTS = Math.min(nextTS, startTS)
|
||||||
|
@@ -49,10 +49,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
get() = prefs.getInt(VIEW, MONTHLY_VIEW)
|
get() = prefs.getInt(VIEW, MONTHLY_VIEW)
|
||||||
set(view) = prefs.edit().putInt(VIEW, view).apply()
|
set(view) = prefs.edit().putInt(VIEW, view).apply()
|
||||||
|
|
||||||
var defaultDailyRepetition: Int
|
|
||||||
get() = prefs.getInt(DAILY_REPETITION, EVERY_DAY)
|
|
||||||
set(dailyRepetition) = prefs.edit().putInt(DAILY_REPETITION, dailyRepetition).apply()
|
|
||||||
|
|
||||||
var defaultReminderMinutes: Int
|
var defaultReminderMinutes: Int
|
||||||
get() = prefs.getInt(REMINDER_MINUTES, 10)
|
get() = prefs.getInt(REMINDER_MINUTES, 10)
|
||||||
set(mins) = prefs.edit().putInt(REMINDER_MINUTES, mins).apply()
|
set(mins) = prefs.edit().putInt(REMINDER_MINUTES, mins).apply()
|
||||||
|
@@ -38,7 +38,6 @@ val END_WEEKLY_AT = "end_weekly_at"
|
|||||||
val VIBRATE = "vibrate"
|
val VIBRATE = "vibrate"
|
||||||
val REMINDER_SOUND = "reminder_sound"
|
val REMINDER_SOUND = "reminder_sound"
|
||||||
val VIEW = "view"
|
val VIEW = "view"
|
||||||
val DAILY_REPETITION = "daily_repetition"
|
|
||||||
val REMINDER_MINUTES = "reminder_minutes"
|
val REMINDER_MINUTES = "reminder_minutes"
|
||||||
val DISPLAY_EVENT_TYPES = "display_event_types"
|
val DISPLAY_EVENT_TYPES = "display_event_types"
|
||||||
val GOOGLE_SYNC = "google_sync"
|
val GOOGLE_SYNC = "google_sync"
|
||||||
|
@@ -255,41 +255,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/settings_default_daily_repetition_holder"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingBottom="@dimen/bigger_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_margin"
|
|
||||||
android:paddingRight="@dimen/activity_margin"
|
|
||||||
android:paddingTop="@dimen/bigger_margin">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
|
||||||
android:id="@+id/settings_default_daily_repetition_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_toLeftOf="@+id/settings_default_daily_repetition"
|
|
||||||
android:layout_toStartOf="@+id/settings_default_daily_repetition"
|
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
|
||||||
android:paddingRight="@dimen/medium_margin"
|
|
||||||
android:text="@string/default_daily_repetition"/>
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
|
||||||
android:id="@+id/settings_default_daily_repetition"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_marginEnd="@dimen/small_margin"
|
|
||||||
android:layout_marginRight="@dimen/small_margin"
|
|
||||||
android:background="@null"
|
|
||||||
android:clickable="false"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_default_reminder_holder"
|
android:id="@+id/settings_default_reminder_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Widerholung</string>
|
<string name="repeat">Widerholung</string>
|
||||||
<string name="every_day">Täglich</string>
|
<string name="every_day">Täglich</string>
|
||||||
<string name="selected_days">an ausgewählten Tagen</string>
|
<string name="selected_days">an ausgewählten Tagen</string>
|
||||||
<string name="default_daily_repetition">Standard, tägliche Wiederholung</string>
|
|
||||||
<string name="on_the_same_day">jeden Monat am selben Tag</string>
|
<string name="on_the_same_day">jeden Monat am selben Tag</string>
|
||||||
<string name="on_the_last_day">am letzten Tag des Monat</string>
|
<string name="on_the_last_day">am letzten Tag des Monat</string>
|
||||||
<string name="every_m">jeden</string>
|
<string name="every_m">jeden</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repetição</string>
|
<string name="repeat">Repetição</string>
|
||||||
<string name="every_day">Todos os dias</string>
|
<string name="every_day">Todos os dias</string>
|
||||||
<string name="selected_days">Nos dias selecionados</string>
|
<string name="selected_days">Nos dias selecionados</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">No mesmo dia de cada mês</string>
|
<string name="on_the_same_day">No mesmo dia de cada mês</string>
|
||||||
<string name="on_the_last_day">No último dia do mês</string>
|
<string name="on_the_last_day">No último dia do mês</string>
|
||||||
<string name="every_m">A cada</string>
|
<string name="every_m">A cada</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Opakovať</string>
|
<string name="repeat">Opakovať</string>
|
||||||
<string name="every_day">Každý deň</string>
|
<string name="every_day">Každý deň</string>
|
||||||
<string name="selected_days">Vo vybraných dňoch</string>
|
<string name="selected_days">Vo vybraných dňoch</string>
|
||||||
<string name="default_daily_repetition">Predvolené denné opakovanie</string>
|
|
||||||
<string name="on_the_same_day">Každý mesiac v rovnaký deň</string>
|
<string name="on_the_same_day">Každý mesiac v rovnaký deň</string>
|
||||||
<string name="on_the_last_day">Posledný deň v mesiaci</string>
|
<string name="on_the_last_day">Posledný deň v mesiaci</string>
|
||||||
<string name="every_m">Každý</string>
|
<string name="every_m">Každý</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
<string name="repeat">Repeat</string>
|
<string name="repeat">Repeat</string>
|
||||||
<string name="every_day">Every day</string>
|
<string name="every_day">Every day</string>
|
||||||
<string name="selected_days">On selected days</string>
|
<string name="selected_days">On selected days</string>
|
||||||
<string name="default_daily_repetition">Default daily repetition</string>
|
|
||||||
<string name="on_the_same_day">On the same day every month</string>
|
<string name="on_the_same_day">On the same day every month</string>
|
||||||
<string name="on_the_last_day">On the last day of the month</string>
|
<string name="on_the_last_day">On the last day of the month</string>
|
||||||
<string name="every_m">Every</string>
|
<string name="every_m">Every</string>
|
||||||
|
Reference in New Issue
Block a user