Merge tag '10.5' into main

pull/1194/head
Alex Baker 5 years ago
commit 0f0323ce0f

@ -1,7 +1,7 @@
Change Log
---
=======
### 10.5 (2020-10-19)
### 10.5 (2020-10-21)
* Multi-select rescheduling
* New task default settings

@ -44,7 +44,7 @@ android {
defaultConfig {
testApplicationId = "org.tasks.test"
applicationId = "org.tasks"
versionCode = 100500
versionCode = 100501
versionName = "10.5"
targetSdkVersion(Versions.targetSdk)
minSdkVersion(Versions.minSdk)

@ -67,6 +67,8 @@ class TaskDao @Inject constructor(
suspend fun setParent(parent: Long, tasks: List<Long>) = taskDao.setParent(parent, tasks)
suspend fun getChildren(ids: List<Long>) = taskDao.getChildren(ids)
suspend fun getChildren(id: Long): List<Long> = taskDao.getChildren(id)
suspend fun setCollapsed(id: Long, collapsed: Boolean) = taskDao.setCollapsed(id, collapsed)

@ -7,6 +7,7 @@ import com.todoroo.astrid.data.Task
import com.todoroo.astrid.gcal.GCalHelper
import org.tasks.LocalBroadcastManager
import org.tasks.data.*
import org.tasks.db.DbUtils.dbchunk
import org.tasks.preferences.Preferences
import java.util.*
import javax.inject.Inject
@ -25,7 +26,12 @@ class TaskDuplicator @Inject constructor(
suspend fun duplicate(taskIds: List<Long>): List<Task> {
val result: MutableList<Task> = ArrayList()
for (task in taskDao.fetch(taskIds)) {
val tasks = ArrayList(taskIds)
taskIds.dbchunk().forEach {
tasks.removeAll(googleTaskDao.getChildren(it))
tasks.removeAll(taskDao.getChildren(it))
}
for (task in taskDao.fetch(tasks)) {
result.add(clone(task))
}
localBroadcastManager.broadcastRefresh()

@ -87,8 +87,8 @@ class DateTimePicker : BottomSheetDialogFragment() {
bundle.putLongArray(EXTRA_TASKS, tasks.map { it.id }.toLongArray())
val dueDates = tasks.map { it.dueDate.startOfDay() }.toSet()
val dueTimes = tasks.map { it.dueDate.millisOfDay() }.toSet()
bundle.putLong(EXTRA_DAY, if (dueDates.size == 1) dueDates.first() else -1)
bundle.putInt(EXTRA_TIME, if (dueTimes.size == 1) dueTimes.first() else -1)
bundle.putLong(EXTRA_DAY, if (dueDates.size == 1) dueDates.first() else MULTIPLE_DAYS)
bundle.putInt(EXTRA_TIME, if (dueTimes.size == 1) dueTimes.first() else MULTIPLE_TIMES)
bundle.putBoolean(EXTRA_AUTO_CLOSE, autoClose)
val fragment = DateTimePicker()
fragment.arguments = bundle
@ -129,7 +129,11 @@ class DateTimePicker : BottomSheetDialogFragment() {
binding.calendarView.firstDayOfWeek = firstDayOfWeek
}
selectedDay = savedInstanceState?.getLong(EXTRA_DAY) ?: requireArguments().getLong(EXTRA_DAY)
selectedTime = savedInstanceState?.getInt(EXTRA_TIME) ?: requireArguments().getInt(EXTRA_TIME)
selectedTime =
savedInstanceState?.getInt(EXTRA_TIME)
?: requireArguments().getInt(EXTRA_TIME)
.takeIf { it == MULTIPLE_TIMES || Task.hasDueTime(it.toLong()) }
?: NO_TIME
return binding.root
}
@ -275,14 +279,26 @@ class DateTimePicker : BottomSheetDialogFragment() {
taskDao
.fetch(taskIds.toList())
.forEach {
val day = if (selectedDay == MULTIPLE_DAYS) {
if (it.hasDueDate()) it.dueDate else today.millis
} else {
selectedDay
}
val time = if (selectedTime == MULTIPLE_TIMES) {
if (it.hasDueTime()) it.dueDate.millisOfDay() else NO_TIME
} else {
selectedTime
}
it.setDueDateAdjustingHideUntil(when {
selectedDay == MULTIPLE_DAYS ->
it.dueDate.toDateTime().withMillisOfDay(selectedTime).millis
selectedDay == NO_DAY -> 0L
selectedTime == MULTIPLE_TIMES ->
selectedDay.toDateTime().withMillisOfDay(it.dueDate.millisOfDay()).millis
selectedTime == NO_TIME -> selectedDay
else -> selectedDay.toDateTime().withMillisOfDay(selectedTime).millis
day == NO_DAY -> 0L
time == NO_TIME -> Task.createDueDate(
Task.URGENCY_SPECIFIC_DAY,
day
)
else -> Task.createDueDate(
Task.URGENCY_SPECIFIC_DAY_TIME,
day.toDateTime().withMillisOfDay(time).millis
)
})
taskDao.save(it)
}

Loading…
Cancel
Save