launch TaskActivity if editing a task

This commit is contained in:
tibbi 2022-02-24 16:09:06 +01:00
parent a114e37643
commit abbe87d509
6 changed files with 13 additions and 7 deletions

View File

@ -69,7 +69,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:43cdaa1296'
implementation 'com.github.SimpleMobileTools:Simple-Commons:ec74a7c44f'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -37,7 +37,7 @@ class TaskActivity : SimpleActivity() {
val intent = intent ?: return
mDialogTheme = getDialogTheme()
updateColors()
val taskId = intent.getLongExtra(TASK_ID, 0L)
val taskId = intent.getLongExtra(EVENT_ID, 0L)
gotTask(savedInstanceState, null)
}

View File

@ -9,7 +9,6 @@ import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity
import com.simplemobiletools.calendar.pro.activities.MainActivity
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.adapters.DayEventsAdapter
@ -132,7 +131,7 @@ class DayFragment : Fragment() {
}
private fun editEvent(event: Event) {
Intent(context, EventActivity::class.java).apply {
Intent(context, event.getActivityToOpen()).apply {
putExtra(EVENT_ID, event.id)
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
startActivity(this)

View File

@ -549,7 +549,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
setOnClickListener {
Intent(context, EventActivity::class.java).apply {
Intent(context, event.getActivityToOpen()).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, EventActivity::class.java).apply {
Intent(context, event.getActivityToOpen()).apply {
putExtra(EVENT_ID, event.id)
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
startActivity(this)

View File

@ -8,7 +8,6 @@ const val SCHEDULE_CALDAV_REQUEST_CODE = 10000
const val DAY_CODE = "day_code"
const val YEAR_LABEL = "year"
const val EVENT_ID = "event_id"
const val TASK_ID = "task_id"
const val IS_DUPLICATE_INTENT = "is_duplicate_intent"
const val EVENT_OCCURRENCE_TS = "event_occurrence_ts"
const val NEW_EVENT_START_TS = "new_event_start_ts"

View File

@ -5,6 +5,8 @@ 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
@ -205,4 +207,10 @@ data class Event(
DateTimeZone.getDefault().id
}
}
fun getActivityToOpen() = if (isTask()) {
TaskActivity::class.java
} else {
EventActivity::class.java
}
}