so repeating by weekdays apparently belongs to the weekly repetition

This commit is contained in:
tibbi 2017-04-15 21:08:03 +02:00
parent 2104b55122
commit 0ce8380c12
20 changed files with 7 additions and 78 deletions

View File

@ -152,8 +152,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
updateRepetitionText()
checkRepeatTexts(interval)
if (mRepeatInterval == DAY) {
setRepeatRule(config.defaultDailyRepetition)
if (mRepeatInterval == WEEK) {
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)
checkRepetitionLimitText()
event_repetition_rule_holder.beVisibleIf(mRepeatInterval == DAY)
event_repetition_rule_holder.beVisibleIf(mRepeatInterval == WEEK)
checkRepetitionRuleText()
}
@ -192,7 +192,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
private fun showRepetitionRuleDialog() {
if (mRepeatInterval == DAY) {
if (mRepeatInterval == WEEK) {
RepeatRuleDailyDialog(this, mRepeatRule) {
setRepeatRule(it)
}
@ -208,7 +208,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
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)
}
}

View File

@ -7,11 +7,9 @@ import android.net.Uri
import android.os.Bundle
import android.os.Parcelable
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.dialogs.RepeatRuleDailyDialog
import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.extensions.dbHelper
import com.simplemobiletools.calendar.extensions.getReminderText
import com.simplemobiletools.calendar.helpers.EVERY_DAY
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.updateTextColors
@ -52,7 +50,6 @@ class SettingsActivity : SimpleActivity() {
setupWeeklyEnd()
setupVibrate()
setupReminderSound()
setupDailyRepetition()
setupEventReminder()
updateTextColors(settings_holder)
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() {
var reminderMinutes = config.defaultReminderMinutes
settings_default_reminder.text = getReminderText(reminderMinutes)

View File

@ -57,12 +57,12 @@ fun Context.scheduleNextEventReminder(event: Event) {
reminderSeconds.forEach {
var startTS = event.startTS - it
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
}
nextTS = Math.min(nextTS, startTS)
} 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
}
nextTS = Math.min(nextTS, startTS)

View File

@ -49,10 +49,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(VIEW, MONTHLY_VIEW)
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
get() = prefs.getInt(REMINDER_MINUTES, 10)
set(mins) = prefs.edit().putInt(REMINDER_MINUTES, mins).apply()

View File

@ -38,7 +38,6 @@ val END_WEEKLY_AT = "end_weekly_at"
val VIBRATE = "vibrate"
val REMINDER_SOUND = "reminder_sound"
val VIEW = "view"
val DAILY_REPETITION = "daily_repetition"
val REMINDER_MINUTES = "reminder_minutes"
val DISPLAY_EVENT_TYPES = "display_event_types"
val GOOGLE_SYNC = "google_sync"

View File

@ -255,41 +255,6 @@
</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
android:id="@+id/settings_default_reminder_holder"
android:layout_width="match_parent"

View File

@ -48,7 +48,6 @@
<string name="repeat">Widerholung</string>
<string name="every_day">Täglich</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_last_day">am letzten Tag des Monat</string>
<string name="every_m">jeden</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repetição</string>
<string name="every_day">Todos os dias</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_last_day">No último dia do mês</string>
<string name="every_m">A cada</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Opakovať</string>
<string name="every_day">Každý deň</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_last_day">Posledný deň v mesiaci</string>
<string name="every_m">Každý</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>

View File

@ -48,7 +48,6 @@
<string name="repeat">Repeat</string>
<string name="every_day">Every day</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_last_day">On the last day of the month</string>
<string name="every_m">Every</string>