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 40040a124..af0263c6e 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 @@ -35,8 +35,6 @@ import kotlinx.android.synthetic.main.week_event_marker.view.* import org.joda.time.DateTime import org.joda.time.Days import java.util.* -import kotlin.collections.ArrayList -import kotlin.collections.LinkedHashMap class WeekFragment : Fragment(), WeeklyCalendar { private val WEEKLY_EVENT_ID_LABEL = "event_id_label" @@ -268,7 +266,7 @@ class WeekFragment : Fragment(), WeeklyCalendar { val eventId = dragEvent.clipData.getItemAt(0).text.toString().toLong() val startHour = (dragEvent.y / rowHeight).toInt() ensureBackgroundThread { - val event = context?.eventsDB?.getEventWithId(eventId) + val event = context?.eventsDB?.getEventOrTaskWithId(eventId) event?.let { val currentStartTime = Formatter.getDateTimeFromTS(it.startTS) val startTime = Formatter.getDateTimeFromTS(weekTimestamp + index * DAY_SECONDS) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt index f6b4e20ca..0862f8938 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt @@ -21,6 +21,9 @@ interface EventsDao { @Query("SELECT * FROM events WHERE id = :id AND type = $TYPE_TASK") fun getTaskWithId(id: Long): Event? + @Query("SELECT * FROM events WHERE id = :id AND type = $TYPE_EVENT OR type = $TYPE_TASK") + fun getEventOrTaskWithId(id: Long): Event? + @Query("SELECT * FROM events WHERE import_id = :importId AND type = $TYPE_EVENT") fun getEventWithImportId(importId: String): Event?