mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-31 10:54:51 +01:00
open TaskActivity properly from ListEvent items too
This commit is contained in:
parent
abbe87d509
commit
baeb0e2c44
@ -1135,7 +1135,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
val listItems = getEventListItems(events)
|
||||
val eventsAdapter = EventListAdapter(this, listItems, true, this, search_results_list) {
|
||||
if (it is ListEvent) {
|
||||
Intent(applicationContext, EventActivity::class.java).apply {
|
||||
Intent(applicationContext, getActivityToOpen(it.isTask)).apply {
|
||||
putExtra(EVENT_ID, it.id)
|
||||
startActivity(this)
|
||||
}
|
||||
|
@ -232,6 +232,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||
config.primaryColor,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
@ -247,6 +248,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||
config.primaryColor,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
@ -268,6 +270,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||
config.primaryColor,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
@ -283,6 +286,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||
config.primaryColor,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
@ -298,6 +302,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||
config.primaryColor,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
|
@ -216,7 +216,8 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
|
||||
it.color,
|
||||
it.location,
|
||||
it.isPastEvent,
|
||||
it.repeatInterval > 0
|
||||
it.repeatInterval > 0,
|
||||
it.isTask()
|
||||
)
|
||||
listItems.add(listEvent)
|
||||
}
|
||||
|
@ -544,7 +544,19 @@ fun Context.getEventListItems(events: List<Event>, addSectionDays: Boolean = tru
|
||||
}
|
||||
|
||||
val listEvent =
|
||||
ListEvent(it.id!!, it.startTS, it.endTS, it.title, it.description, it.getIsAllDay(), it.color, it.location, it.isPastEvent, it.repeatInterval > 0)
|
||||
ListEvent(
|
||||
it.id!!,
|
||||
it.startTS,
|
||||
it.endTS,
|
||||
it.title,
|
||||
it.description,
|
||||
it.getIsAllDay(),
|
||||
it.color,
|
||||
it.location,
|
||||
it.isPastEvent,
|
||||
it.repeatInterval > 0,
|
||||
it.isTask()
|
||||
)
|
||||
listItems.add(listEvent)
|
||||
}
|
||||
return listItems
|
||||
@ -610,7 +622,7 @@ fun Context.printBitmap(bitmap: Bitmap) {
|
||||
}
|
||||
|
||||
fun Context.editEvent(event: ListEvent) {
|
||||
Intent(this, EventActivity::class.java).apply {
|
||||
Intent(this, getActivityToOpen(event.isTask)).apply {
|
||||
putExtra(EVENT_ID, event.id)
|
||||
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
||||
startActivity(this)
|
||||
|
@ -16,9 +16,7 @@ import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||
import com.simplemobiletools.calendar.pro.extensions.getViewBitmap
|
||||
import com.simplemobiletools.calendar.pro.extensions.printBitmap
|
||||
import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.pro.helpers.EVENT_ID
|
||||
import com.simplemobiletools.calendar.pro.helpers.EVENT_OCCURRENCE_TS
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.calendar.pro.models.Event
|
||||
@ -131,7 +129,7 @@ class DayFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun editEvent(event: Event) {
|
||||
Intent(context, event.getActivityToOpen()).apply {
|
||||
Intent(context, getActivityToOpen(event.isTask())).apply {
|
||||
putExtra(EVENT_ID, event.id)
|
||||
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
||||
startActivity(this)
|
||||
|
@ -549,7 +549,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
}
|
||||
|
||||
setOnClickListener {
|
||||
Intent(context, event.getActivityToOpen()).apply {
|
||||
Intent(context, getActivityToOpen(event.isTask())).apply {
|
||||
putExtra(EVENT_ID, event.id!!)
|
||||
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
||||
startActivity(this)
|
||||
@ -719,7 +719,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
calculateExtraHeight()
|
||||
|
||||
setOnClickListener {
|
||||
Intent(context, event.getActivityToOpen()).apply {
|
||||
Intent(context, getActivityToOpen(event.isTask())).apply {
|
||||
putExtra(EVENT_ID, event.id)
|
||||
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
||||
startActivity(this)
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.simplemobiletools.calendar.pro.helpers
|
||||
|
||||
import com.simplemobiletools.calendar.pro.activities.EventActivity
|
||||
import com.simplemobiletools.calendar.pro.activities.TaskActivity
|
||||
|
||||
const val STORED_LOCALLY_ONLY = 0
|
||||
const val ROW_COUNT = 6
|
||||
const val COLUMN_COUNT = 7
|
||||
@ -224,3 +227,9 @@ fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean {
|
||||
i == 5 || i == 6 || i == 12 || i == 13
|
||||
}
|
||||
}
|
||||
|
||||
fun getActivityToOpen(isTask: Boolean) = if (isTask) {
|
||||
TaskActivity::class.java
|
||||
} else {
|
||||
EventActivity::class.java
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
import com.simplemobiletools.calendar.pro.activities.EventActivity
|
||||
import com.simplemobiletools.calendar.pro.activities.TaskActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.commons.extensions.addBitIf
|
||||
@ -207,10 +205,4 @@ data class Event(
|
||||
DateTimeZone.getDefault().id
|
||||
}
|
||||
}
|
||||
|
||||
fun getActivityToOpen() = if (isTask()) {
|
||||
TaskActivity::class.java
|
||||
} else {
|
||||
EventActivity::class.java
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.simplemobiletools.calendar.pro.models
|
||||
|
||||
data class ListEvent(var id: Long, var startTS: Long, var endTS: Long, var title: String, var description: String, var isAllDay: Boolean, var color: Int,
|
||||
var location: String, var isPastEvent: Boolean, var isRepeatable: Boolean) : ListItem()
|
||||
var location: String, var isPastEvent: Boolean, var isRepeatable: Boolean, var isTask: Boolean) : ListItem()
|
||||
|
Loading…
x
Reference in New Issue
Block a user