open proper event occurrence from event list widget too

This commit is contained in:
tibbi 2017-06-14 21:30:29 +02:00
parent e6ec7d8210
commit 369179bd16
6 changed files with 10 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.simplemobiletools.calendar.helpers.DAY_CODE
import com.simplemobiletools.calendar.helpers.EVENT_ID
import com.simplemobiletools.calendar.helpers.EVENT_OCCURRENCE_TS
class SplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -18,6 +19,7 @@ class SplashActivity : AppCompatActivity() {
} else if (intent.extras?.containsKey(EVENT_ID) == true) {
Intent(this, EventActivity::class.java).apply {
putExtra(EVENT_ID, intent.getIntExtra(EVENT_ID, 0))
putExtra(EVENT_OCCURRENCE_TS, intent.getIntExtra(EVENT_OCCURRENCE_TS, 0))
startActivity(this)
}
} else {

View File

@ -11,6 +11,7 @@ import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.extensions.dbHelper
import com.simplemobiletools.calendar.extensions.seconds
import com.simplemobiletools.calendar.helpers.EVENT_ID
import com.simplemobiletools.calendar.helpers.EVENT_OCCURRENCE_TS
import com.simplemobiletools.calendar.helpers.Formatter
import com.simplemobiletools.calendar.models.ListEvent
import com.simplemobiletools.calendar.models.ListItem
@ -65,6 +66,7 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
Intent().apply {
putExtra(EVENT_ID, item.id)
putExtra(EVENT_OCCURRENCE_TS, item.startTS)
setOnClickFillInIntent(event_item_holder, this)
}
}

View File

@ -107,8 +107,8 @@ fun Context.cancelNotification(id: Int) {
private fun getNotificationIntent(context: Context, event: Event): PendingIntent {
val intent = Intent(context, NotificationReceiver::class.java)
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
intent.putExtra(EVENT_ID, event.id)
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
return PendingIntent.getBroadcast(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
@ -203,15 +203,15 @@ private fun getFormattedEventTime(startTime: String, endTime: String) = if (star
private fun getPendingIntent(context: Context, event: Event): PendingIntent {
val intent = Intent(context, EventActivity::class.java)
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
intent.putExtra(EVENT_ID, event.id)
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
return PendingIntent.getActivity(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
private fun getSnoozePendingIntent(context: Context, event: Event): PendingIntent {
val intent = Intent(context, SnoozeService::class.java).setAction("snooze")
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
intent.putExtra(EVENT_ID, event.id)
intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS)
return PendingIntent.getService(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}

View File

@ -141,8 +141,8 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
private fun editEvent(event: Event) {
Intent(activity.applicationContext, EventActivity::class.java).apply {
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
putExtra(EVENT_ID, event.id)
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
startActivity(this)
}
}

View File

@ -103,8 +103,8 @@ class EventListFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEvents
private fun editEvent(event: ListEvent) {
Intent(activity.applicationContext, EventActivity::class.java).apply {
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
putExtra(EVENT_ID, event.id)
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
startActivity(this)
}
}

View File

@ -269,8 +269,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
setOnClickListener {
Intent(activity.applicationContext, EventActivity::class.java).apply {
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
putExtra(EVENT_ID, event.id)
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
startActivity(this)
}
}