diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61293f9c8..ef3f8890f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,12 @@
Changelog
==========
+Version 6.22.2 *(2023-07-16)*
+----------------------------
+
+ * Fixed a couple weekly view related glitches
+ * Added some translation, stability and UX improvements
+
Version 6.22.1 *(2023-07-02)*
----------------------------
diff --git a/app/build.gradle b/app/build.gradle
index c9da05d67..096c2c52d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -19,8 +19,8 @@ android {
applicationId "com.simplemobiletools.calendar.pro"
minSdkVersion 23
targetSdkVersion 33
- versionCode 237
- versionName "6.22.1"
+ versionCode 238
+ versionName "6.22.2"
multiDexEnabled true
setProperty("archivesBaseName", "calendar")
vectorDrawables.useSupportLibrary = true
@@ -78,7 +78,7 @@ dependencies {
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.print:print:1.0.0"
- kapt 'androidx.room:room-compiler:2.5.1'
- implementation 'androidx.room:room-runtime:2.5.1'
- annotationProcessor 'androidx.room:room-compiler:2.5.1'
+ kapt 'androidx.room:room-compiler:2.5.2'
+ implementation 'androidx.room:room-runtime:2.5.2'
+ annotationProcessor 'androidx.room:room-compiler:2.5.2'
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt
index 5cf7deedf..2e29600bb 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt
@@ -1308,7 +1308,7 @@ class EventActivity : SimpleActivity() {
// recreate the event if it was moved in a different CalDAV calendar
if (mEvent.id != null && oldSource != newSource && oldSource != SOURCE_IMPORTED_ICS) {
if (mRepeatInterval > 0 && wasRepeatable) {
- applyOriginalStartEndTimes()
+ eventsHelper.applyOriginalStartEndTimes(mEvent, mOriginalStartTS, mOriginalEndTS)
}
eventsHelper.deleteEvent(mEvent.id!!, true)
mEvent.id = null
@@ -1321,15 +1321,7 @@ class EventActivity : SimpleActivity() {
storeEvent(wasRepeatable)
}
} else {
- PermissionRequiredDialog(
- this,
- R.string.allow_notifications_reminders,
- positiveActionCallback = {
- handleNotificationPermission {
- openNotificationSettings()
- }
- }
- )
+ PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {
@@ -1367,70 +1359,31 @@ class EventActivity : SimpleActivity() {
private fun showEditRepeatingEventDialog() {
EditRepeatingEventDialog(this) {
hideKeyboard()
+ if (it == null) {
+ return@EditRepeatingEventDialog
+ }
when (it) {
EDIT_SELECTED_OCCURRENCE -> {
- ensureBackgroundThread {
- mEvent.apply {
- parentId = id!!.toLong()
- id = null
- repeatRule = 0
- repeatInterval = 0
- repeatLimit = 0
- }
-
- eventsHelper.insertEvent(mEvent, addToCalDAV = true, showToasts = true) {
- finish()
- }
+ eventsHelper.editSelectedOccurrence(mEvent, true) {
+ finish()
}
}
EDIT_FUTURE_OCCURRENCES -> {
- ensureBackgroundThread {
- val eventId = mEvent.id!!
- val originalEvent = eventsDB.getEventWithId(eventId) ?: return@ensureBackgroundThread
- mEvent.maybeAdjustRepeatLimitCount(originalEvent, mEventOccurrenceTS)
- mEvent.id = null
- eventsHelper.apply {
- addEventRepeatLimit(eventId, mEventOccurrenceTS)
- if (mEventOccurrenceTS == originalEvent.startTS) {
- deleteEvent(eventId, true)
- }
-
- insertEvent(mEvent, addToCalDAV = true, showToasts = true) {
- finish()
- }
- }
+ eventsHelper.editFutureOccurrences(mEvent, mEventOccurrenceTS, true) {
+ finish()
}
}
EDIT_ALL_OCCURRENCES -> {
- ensureBackgroundThread {
- applyOriginalStartEndTimes()
- eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {
- finish()
- }
+ eventsHelper.editAllOccurrences(mEvent, mOriginalStartTS, mOriginalEndTS, true) {
+ finish()
}
}
}
}
}
- private fun applyOriginalStartEndTimes() {
- // Shift the start and end times of the first (original) event based on the changes made
- val originalEvent = eventsDB.getEventWithId(mEvent.id!!) ?: return
- val originalStartTS = originalEvent.startTS
- val originalEndTS = originalEvent.endTS
- val oldStartTS = mOriginalStartTS
- val oldEndTS = mOriginalEndTS
-
- mEvent.apply {
- val startTSDelta = oldStartTS - startTS
- val endTSDelta = oldEndTS - endTS
- startTS = originalStartTS - startTSDelta
- endTS = originalEndTS - endTSDelta
- }
- }
-
private fun updateStartTexts() {
updateStartDateText()
updateStartTimeText()
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt
index 0cc9f4412..5127bd447 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt
@@ -618,6 +618,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
updateViewPager()
setupQuickFilter()
}
+
it == -1 -> toast(R.string.no_new_birthdays)
else -> toast(R.string.no_birthdays)
}
@@ -648,6 +649,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
updateViewPager()
setupQuickFilter()
}
+
it == -1 -> toast(R.string.no_new_anniversaries)
else -> toast(R.string.no_anniversaries)
}
@@ -1067,15 +1069,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
} else {
- PermissionRequiredDialog(
- this,
- R.string.allow_notifications_reminders,
- positiveActionCallback = {
- handleNotificationPermission {
- openNotificationSettings()
- }
- }
- )
+ PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {
@@ -1112,6 +1106,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
showErrorToast(e)
}
}
+
else -> toast(R.string.invalid_file_format)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SimpleActivity.kt
index e8c8d1b3b..610cc3a03 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SimpleActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SimpleActivity.kt
@@ -85,15 +85,7 @@ open class SimpleActivity : BaseSimpleActivity() {
}
}
} else {
- PermissionRequiredDialog(
- this,
- R.string.allow_notifications_reminders,
- positiveActionCallback = {
- handleNotificationPermission {
- openNotificationSettings()
- }
- }
- )
+ PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt
index 5985ed3af..84df33745 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt
@@ -433,15 +433,7 @@ class TaskActivity : SimpleActivity() {
storeTask(wasRepeatable)
}
} else {
- PermissionRequiredDialog(
- this,
- R.string.allow_notifications_reminders,
- positiveActionCallback = {
- handleNotificationPermission {
- openNotificationSettings()
- }
- }
- )
+ PermissionRequiredDialog(this, R.string.allow_notifications_reminders, { openNotificationSettings() })
}
}
} else {
@@ -479,55 +471,23 @@ class TaskActivity : SimpleActivity() {
private fun showEditRepeatingTaskDialog() {
EditRepeatingEventDialog(this, isTask = true) {
hideKeyboard()
+ if (it == null) {
+ return@EditRepeatingEventDialog
+ }
when (it) {
EDIT_SELECTED_OCCURRENCE -> {
- ensureBackgroundThread {
- mTask.apply {
- parentId = id!!.toLong()
- id = null
- repeatRule = 0
- repeatInterval = 0
- repeatLimit = 0
- }
-
- eventsHelper.insertTask(mTask, showToasts = true) {
- finish()
- }
+ eventsHelper.editSelectedOccurrence(mTask, true) {
+ finish()
}
}
EDIT_FUTURE_OCCURRENCES -> {
- ensureBackgroundThread {
- val taskId = mTask.id!!
- val originalTask = eventsDB.getTaskWithId(taskId) ?: return@ensureBackgroundThread
- mTask.maybeAdjustRepeatLimitCount(originalTask, mTaskOccurrenceTS)
- mTask.id = null
- eventsHelper.apply {
- addEventRepeatLimit(taskId, mTaskOccurrenceTS)
- if (mTaskOccurrenceTS == originalTask.startTS) {
- deleteEvent(taskId, true)
- }
-
- insertTask(mTask, showToasts = true) {
- finish()
- }
- }
+ eventsHelper.editFutureOccurrences(mTask, mTaskOccurrenceTS, true) {
+ finish()
}
}
EDIT_ALL_OCCURRENCES -> {
- ensureBackgroundThread {
- // Shift the start and end times of the first (original) event based on the changes made
- val originalEvent = eventsDB.getTaskWithId(mTask.id!!) ?: return@ensureBackgroundThread
- val originalStartTS = originalEvent.startTS
- val oldStartTS = mOriginalStartTS
-
- mTask.apply {
- val startTSDelta = oldStartTS - startTS
- startTS = originalStartTS - startTSDelta
- endTS = startTS
- }
- eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) {
- finish()
- }
+ eventsHelper.editAllOccurrences(mTask, mOriginalStartTS, showToasts = true) {
+ finish()
}
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt
index 5627e539e..e0cd0223d 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt
@@ -12,7 +12,7 @@ import com.simplemobiletools.commons.extensions.hideKeyboard
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_edit_repeating_event.view.*
-class EditRepeatingEventDialog(val activity: SimpleActivity, val isTask: Boolean = false, val callback: (allOccurrences: Int) -> Unit) {
+class EditRepeatingEventDialog(val activity: SimpleActivity, val isTask: Boolean = false, val callback: (allOccurrences: Int?) -> Unit) {
private var dialog: AlertDialog? = null
init {
@@ -33,12 +33,15 @@ class EditRepeatingEventDialog(val activity: SimpleActivity, val isTask: Boolean
activity.setupDialogStuff(view, this) { alertDialog ->
dialog = alertDialog
alertDialog.hideKeyboard()
+ alertDialog.setOnDismissListener { sendResult(null) }
}
}
}
- private fun sendResult(allOccurrences: Int) {
+ private fun sendResult(allOccurrences: Int?) {
callback(allOccurrences)
- dialog?.dismiss()
+ if (allOccurrences != null) {
+ dialog?.dismiss()
+ }
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SetRemindersDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SetRemindersDialog.kt
index 357dc92de..16f194583 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SetRemindersDialog.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SetRemindersDialog.kt
@@ -36,15 +36,7 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
}
}
} else {
- PermissionRequiredDialog(
- activity,
- R.string.allow_notifications_reminders,
- positiveActionCallback = {
- activity.handleNotificationPermission {
- activity.openNotificationSettings()
- }
- }
- )
+ PermissionRequiredDialog(activity, R.string.allow_notifications_reminders, { activity.openNotificationSettings() })
}
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt
index b7e79f5e3..e4ecdfafd 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt
@@ -20,7 +20,6 @@ import android.provider.CalendarContract
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
-import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.app.AlarmManagerCompat
import androidx.core.app.NotificationCompat
@@ -48,7 +47,6 @@ import com.simplemobiletools.commons.helpers.*
import kotlinx.android.synthetic.main.day_monthly_event_view.view.*
import org.joda.time.DateTime
import org.joda.time.DateTimeConstants
-import org.joda.time.DateTimeZone
import org.joda.time.LocalDate
import java.io.File
import java.io.FileOutputStream
@@ -327,7 +325,8 @@ fun Context.notifyEvent(originalEvent: Event) {
val events = eventsHelper.getRepeatableEventsFor(currentSeconds - WEEK_SECONDS, currentSeconds + YEAR_SECONDS, event.id!!)
for (currEvent in events) {
eventStartTS = if (currEvent.getIsAllDay()) Formatter.getDayStartTS(Formatter.getDayCodeFromTS(currEvent.startTS)) else currEvent.startTS
- val firstReminderMinutes = arrayOf(currEvent.reminder3Minutes, currEvent.reminder2Minutes, currEvent.reminder1Minutes).filter { it != REMINDER_OFF }.max()
+ val firstReminderMinutes =
+ arrayOf(currEvent.reminder3Minutes, currEvent.reminder2Minutes, currEvent.reminder1Minutes).filter { it != REMINDER_OFF }.max()
if (eventStartTS - firstReminderMinutes * 60 > currentSeconds) {
break
}
@@ -759,7 +758,11 @@ fun Context.editEvent(event: ListEvent) {
}
fun Context.getFirstDayOfWeek(date: DateTime): String {
- var startOfWeek = date.withZoneRetainFields(DateTimeZone.UTC).withTimeAtStartOfDay()
+ return getFirstDayOfWeekDt(date).toString()
+}
+
+fun Context.getFirstDayOfWeekDt(date: DateTime): DateTime {
+ var startOfWeek = date.withTimeAtStartOfDay()
if (!config.startWeekWithCurrentDay) {
startOfWeek = if (config.isSundayFirst) {
// a workaround for Joda-time's Monday-as-first-day-of-the-week
@@ -772,7 +775,7 @@ fun Context.getFirstDayOfWeek(date: DateTime): String {
startOfWeek.withDayOfWeek(DateTimeConstants.MONDAY)
}
}
- return startOfWeek.toString()
+ return startOfWeek
}
fun Context.isTaskCompleted(event: Event): Boolean {
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt
index 3f4c344b0..681971e15 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt
@@ -16,6 +16,9 @@ import androidx.collection.LongSparseArray
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
+import com.simplemobiletools.calendar.pro.activities.MainActivity
+import com.simplemobiletools.calendar.pro.activities.SimpleActivity
+import com.simplemobiletools.calendar.pro.dialogs.EditRepeatingEventDialog
import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter
@@ -188,6 +191,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
fun updateCalendar() {
if (context != null) {
+ currentlyDraggedView = null
WeeklyCalendarImpl(this, requireContext()).updateWeeklyCalendar(weekTimestamp)
}
}
@@ -196,14 +200,14 @@ class WeekFragment : Fragment(), WeeklyCalendar {
mView.week_events_columns_holder.removeAllViews()
(0 until config.weeklyViewDays).forEach {
val column = inflater.inflate(R.layout.weekly_view_day_column, mView.week_events_columns_holder, false) as RelativeLayout
- column.tag = Formatter.getUTCDayCodeFromTS(weekTimestamp + it * DAY_SECONDS)
+ column.tag = Formatter.getDayCodeFromTS(weekTimestamp + it * DAY_SECONDS)
mView.week_events_columns_holder.addView(column)
dayColumns.add(column)
}
}
private fun setupDayLabels() {
- var curDay = Formatter.getUTCDateTimeFromTS(weekTimestamp)
+ var curDay = Formatter.getDateTimeFromTS(weekTimestamp)
val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
val screenWidth = context?.usableScreenSize?.x ?: return
val dayWidth = screenWidth / config.weeklyViewDays
@@ -269,12 +273,12 @@ class WeekFragment : Fragment(), WeeklyCalendar {
DragEvent.ACTION_DRAG_ENDED -> true
DragEvent.ACTION_DROP -> {
try {
- val eventId = dragEvent.clipData.getItemAt(0).text.toString().toLong()
+ val (eventId, originalStartTS, originalEndTS) = dragEvent.clipData.getItemAt(0).text.toString().split(";").map { it.toLong() }
val startHour = (dragEvent.y / rowHeight).toInt()
ensureBackgroundThread {
val event = context?.eventsDB?.getEventOrTaskWithId(eventId)
- event?.let {
- val currentStartTime = Formatter.getDateTimeFromTS(it.startTS)
+ event?.let { event ->
+ val currentStartTime = Formatter.getDateTimeFromTS(event.startTS)
val startTime = Formatter.getDateTimeFromTS(weekTimestamp + index * DAY_SECONDS)
.withTime(
startHour,
@@ -284,14 +288,47 @@ class WeekFragment : Fragment(), WeeklyCalendar {
).seconds()
val currentEventDuration = event.endTS - event.startTS
val endTime = startTime + currentEventDuration
- context?.eventsHelper?.updateEvent(
- it.copy(
- startTS = startTime,
- endTS = endTime,
- flags = it.flags.removeBit(FLAG_ALL_DAY)
- ), updateAtCalDAV = true, showToasts = false
- ) {
- updateCalendar()
+ val newEvent = event.copy(
+ startTS = startTime,
+ endTS = endTime,
+ flags = event.flags.removeBit(FLAG_ALL_DAY)
+ )
+ if (event.repeatInterval > 0) {
+ val activity = this.activity as SimpleActivity
+ activity.runOnUiThread {
+ EditRepeatingEventDialog(activity) {
+ activity.hideKeyboard()
+ when (it) {
+ null -> {
+ revertDraggedEvent()
+ }
+ EDIT_SELECTED_OCCURRENCE -> {
+ context?.eventsHelper?.editSelectedOccurrence(newEvent, false) {
+ updateCalendar()
+ }
+ }
+ EDIT_FUTURE_OCCURRENCES -> {
+ context?.eventsHelper?.editFutureOccurrences(newEvent, originalStartTS, false) {
+ // we need to refresh all fragments because they can contain future occurrences
+ (activity as MainActivity).refreshItems()
+ }
+ }
+ EDIT_ALL_OCCURRENCES -> {
+ context?.eventsHelper?.editAllOccurrences(newEvent, originalStartTS, originalEndTS, false) {
+ (activity as MainActivity).refreshItems()
+ }
+ }
+ }
+ }
+ }
+ } else {
+ if (event.startTS == newEvent.startTS && event.endTS == newEvent.endTS) {
+ revertDraggedEvent()
+ } else {
+ context?.eventsHelper?.updateEvent(newEvent, updateAtCalDAV = true, showToasts = false) {
+ updateCalendar()
+ }
+ }
}
}
}
@@ -306,6 +343,13 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
}
+ private fun revertDraggedEvent() {
+ activity?.runOnUiThread {
+ currentlyDraggedView?.beVisible()
+ currentlyDraggedView = null
+ }
+ }
+
private fun getViewGestureDetector(view: ViewGroup, index: Int): GestureDetector {
return GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() {
override fun onSingleTapUp(event: MotionEvent): Boolean {
@@ -552,7 +596,13 @@ class WeekFragment : Fragment(), WeeklyCalendar {
do {
val dayOfWeek = dayColumns.indexOfFirst { it.tag == currentDayCode }
if (dayOfWeek == -1 || dayOfWeek >= config.weeklyViewDays) {
- continue@dayevents
+ if (startDayCode != endDayCode) {
+ currentDateTime = currentDateTime.plusDays(1)
+ currentDayCode = Formatter.getDayCodeFromDateTime(currentDateTime)
+ continue
+ } else {
+ continue@dayevents
+ }
}
val dayColumn = dayColumns[dayOfWeek]
@@ -628,7 +678,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
setOnLongClickListener { view ->
currentlyDraggedView = view
val shadowBuilder = View.DragShadowBuilder(view)
- val clipData = ClipData.newPlainText(WEEKLY_EVENT_ID_LABEL, event.id.toString())
+ val clipData = ClipData.newPlainText(WEEKLY_EVENT_ID_LABEL, "${event.id};${event.startTS};${event.endTS}")
if (isNougatPlus()) {
view.startDragAndDrop(clipData, shadowBuilder, null, 0)
} else {
@@ -892,7 +942,6 @@ class WeekFragment : Fragment(), WeeklyCalendar {
if (!dragEvent.result) {
view.beVisible()
}
- currentlyDraggedView = null
true
}
else -> false
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragmentsHolder.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragmentsHolder.kt
index e8e5a60a3..a06c89546 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragmentsHolder.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragmentsHolder.kt
@@ -189,22 +189,11 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
}
private fun dateSelected(dateTime: DateTime, datePicker: DatePicker) {
- val isSundayFirst = requireContext().config.isSundayFirst
val month = datePicker.month + 1
val year = datePicker.year
val day = datePicker.dayOfMonth
- var newDateTime = dateTime.withDate(year, month, day)
-
- if (isSundayFirst) {
- newDateTime = newDateTime.plusDays(1)
- }
-
- var selectedWeek = newDateTime.withDayOfWeek(1).withTimeAtStartOfDay().minusDays(if (isSundayFirst) 1 else 0)
- if (newDateTime.minusDays(7).seconds() > selectedWeek.seconds()) {
- selectedWeek = selectedWeek.plusDays(7)
- }
-
- currentWeekTS = selectedWeek.seconds()
+ val newDateTime = dateTime.withDate(year, month, day)
+ currentWeekTS = requireContext().getFirstDayOfWeekDt(newDateTime).seconds()
setupFragment()
}
@@ -311,7 +300,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
override fun getCurrentDate(): DateTime? {
return if (currentWeekTS != 0L) {
- Formatter.getUTCDateTimeFromTS(currentWeekTS)
+ Formatter.getDateTimeFromTS(currentWeekTS)
} else {
null
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
index cb9927108..fb3a1e1c9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt
@@ -180,6 +180,66 @@ class EventsHelper(val context: Context) {
callback?.invoke()
}
+ fun applyOriginalStartEndTimes(event: Event, oldStartTS: Long, oldEndTS: Long) {
+ val originalEvent = eventsDB.getEventOrTaskWithId(event.id!!) ?: return
+ val originalStartTS = originalEvent.startTS
+ val originalEndTS = originalEvent.endTS
+
+ event.apply {
+ val startTSDelta = oldStartTS - startTS
+ val endTSDelta = oldEndTS - endTS
+ startTS = originalStartTS - startTSDelta
+ endTS = if (isTask()) startTS else originalEndTS - endTSDelta
+ }
+ }
+
+ fun editSelectedOccurrence(event: Event, showToasts: Boolean, callback: () -> Unit) {
+ ensureBackgroundThread {
+ event.apply {
+ parentId = id!!.toLong()
+ id = null
+ repeatRule = 0
+ repeatInterval = 0
+ repeatLimit = 0
+ }
+ if (event.isTask()) {
+ insertTask(event, showToasts = showToasts, callback = callback)
+ } else {
+ insertEvent(event, addToCalDAV = true, showToasts = showToasts) {
+ callback()
+ }
+ }
+ }
+ }
+
+ fun editFutureOccurrences(event: Event, eventOccurrenceTS: Long, showToasts: Boolean, callback: () -> Unit) {
+ ensureBackgroundThread {
+ val eventId = event.id!!
+ val originalEvent = eventsDB.getEventOrTaskWithId(event.id!!) ?: return@ensureBackgroundThread
+ event.maybeAdjustRepeatLimitCount(originalEvent, eventOccurrenceTS)
+ event.id = null
+ addEventRepeatLimit(eventId, eventOccurrenceTS)
+ if (eventOccurrenceTS == originalEvent.startTS) {
+ deleteEvent(eventId, true)
+ }
+
+ if (event.isTask()) {
+ insertTask(event, showToasts = showToasts, callback = callback)
+ } else {
+ insertEvent(event, addToCalDAV = true, showToasts = showToasts) {
+ callback()
+ }
+ }
+ }
+ }
+
+ fun editAllOccurrences(event: Event, originalStartTS: Long, originalEndTS: Long = 0, showToasts: Boolean, callback: () -> Unit) {
+ ensureBackgroundThread {
+ applyOriginalStartEndTimes(event, originalStartTS, originalEndTS)
+ updateEvent(event, updateAtCalDAV = !event.isTask(), showToasts = showToasts, callback = callback)
+ }
+ }
+
private fun ensureEventTypeVisibility(event: Event, enableEventType: Boolean) {
if (enableEventType) {
val eventType = event.eventType.toString()
diff --git a/app/src/main/res/layout-land/fragment_month_day.xml b/app/src/main/res/layout-land/fragment_month_day.xml
new file mode 100644
index 000000000..9663a745e
--- /dev/null
+++ b/app/src/main/res/layout-land/fragment_month_day.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml
index bfa4525f6..c576d0ceb 100644
--- a/app/src/main/res/values-bg/strings.xml
+++ b/app/src/main/res/values-bg/strings.xml
@@ -9,7 +9,7 @@
Месечен и дневен изглед
Годишен изглед
Списък със събития
- No upcoming events.
+ Няма предстоящи събития.
Отидете на днес
Отиди на дата
@@ -29,9 +29,9 @@
Филтриране на събитията по тип
Моля попълнете местоположение за показване на картата
Предстоящо събитие
- You have filtered out all event types
- Event color
- Default calendar color
+ Вие филтрирахте всички типове събития
+ Цвят на събитието
+ Цвят на календара по подразбиране
Задача
Задачи
@@ -41,7 +41,7 @@
Дублиране на задача
Означете като завършено
Означете като незавършено
- Task color
+ Цвят на задачата
Повторение
Без повторение
@@ -54,8 +54,8 @@
години
Повтаряй до
Завинаги
- Събитието се повтаря
- The task is repeatable
+ Събитието e повтаряемо
+ Задачата e повтаряема
Изборът съдържа само повтарящи се събития
Изтрийте само избраното събитие
Изтрийте това събитие и всички бъдещи събития
@@ -130,8 +130,8 @@
Експортиране на събития в .ics файл
Тип събитие по подразбиране
Експортиране и на минали събития
- Export tasks
- Export past entries too
+ Експортиране на задачи
+ Експортиране и на минали записи
Включване на типа събития
Име на файла (без .ics)
Игнорирайте типовете събития във файла, винаги използвайте този по подразбиране
@@ -180,8 +180,8 @@
Смяна на описанието на събитието с местоположение
Показване на описание или местоположение
Изтриване на всички събития
- Delete all events and tasks
- Сигурни ли сте, че искате да изтриете всички събития\? Това ще остави типовете събития и другите ви настройки непокътнати.
+ Изтриване на всички събития и задачи
+ Сигурни ли сте, че искате да изтриете всички събития и задачи\? Това ще остави типовете събития и другите ви настройки непокътнати.
Показване на решетка
Циклично напомняне до отхвърляне
Затъмняване на минали събития
@@ -227,7 +227,7 @@
Не са намерени календари, които да могат да се синхронизират
Свободно
Заето
- Fetching event %s failed
+ Изтегляне на събитие %s е неуспешно
Понеделник
@@ -267,7 +267,7 @@
Как мога да премахна празниците, импортирани чрез бутона \"Добавяне на празници\"\?
Създадените по този начин празници се вмъкват в нов тип събитие, наречен \"Празници\". Можете да отидете в Настройки -> Управление на типове събития, да натиснете продължително дадения тип събитие и да го изтриете, като изберете кошчето за боклук.
Мога ли да си синхронизирам своите събития с Google Calendar или друга услуга, поддържаща CalDAV\?
- Maybe even share calendars with other people?
+ Може дори да споделяте календари с други хора\?
Да, просто превключете \"Синхронизация с CalDAV\" в настройките на приложението и изберете календарите, които искате да синхронизирате. Ще ви е необходимо обаче приложение на трета страна, което да обработва синхронизацията между устройството и сървърите. В случай че искате да синхронизирате календар на Google, тяхното официално приложение \"Календар\" ще свърши тази работа. За други календари ще ви е необходим адаптер за синхронизиране от трета страна, например DAVx5.
Виждам напомняния но не чувам звук. Какво мога да направя\?
Системата оказва огромно влияние не само върху показването на действителното напомняне, но и върху възпроизвеждането на звука. Ако не можете да чуете никакъв звук, опитайте да влезете в настройките на приложението, да натиснете опцията \"Аудио поток, използван от напомнянията\" и да я промените на друга стойност. Ако все още не работи, проверете настройките на звука, дали конкретният поток не е заглушен.
@@ -281,4 +281,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml
index 883f575a8..e9a377fb3 100644
--- a/app/src/main/res/values-uk/strings.xml
+++ b/app/src/main/res/values-uk/strings.xml
@@ -41,7 +41,7 @@
Дублювати завдання
Позначити завершеним
Позначити незавершеним
- Task color
+ Колір завдання
Повторювати
Без повторень
@@ -287,4 +287,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
+
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/238.txt b/fastlane/metadata/android/en-US/changelogs/238.txt
new file mode 100644
index 000000000..6b66fccf9
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/238.txt
@@ -0,0 +1,2 @@
+ * Fixed a couple weekly view related glitches
+ * Added some translation, stability and UX improvements