mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-16 20:00:39 +01:00
edit the event on click
This commit is contained in:
parent
631fe89f3b
commit
4ed18a90d7
@ -1,6 +1,5 @@
|
||||
package com.simplemobiletools.calendar.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.Snackbar
|
||||
@ -21,7 +20,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
||||
private var mSelectedItemsCnt: Int = 0
|
||||
private var mSnackbar: Snackbar? = null
|
||||
private var mToBeDeleted: MutableList<Int>? = null
|
||||
private val EDIT_EVENT = 1
|
||||
|
||||
companion object {
|
||||
val DELETED_ID = "deleted_id"
|
||||
@ -82,12 +80,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
||||
overridePendingTransition(0, 0)
|
||||
}
|
||||
|
||||
private fun editEvent(event: Event) {
|
||||
val intent = Intent(applicationContext, EventActivity::class.java)
|
||||
intent.putExtra(Constants.EVENT, event)
|
||||
startActivityForResult(intent, EDIT_EVENT)
|
||||
}
|
||||
|
||||
private fun checkEvents() {
|
||||
val startTS = Formatter.getDayStartTS(mDayCode)
|
||||
val endTS = Formatter.getDayEndTS(mDayCode)
|
||||
@ -114,14 +106,14 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
||||
}*/
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (requestCode == EDIT_EVENT && resultCode == Activity.RESULT_OK && data != null) {
|
||||
/*if (requestCode == EDIT_EVENT && resultCode == Activity.RESULT_OK && data != null) {
|
||||
val deletedId = data.getIntExtra(DELETED_ID, -1)
|
||||
if (deletedId != -1) {
|
||||
mToBeDeleted!!.clear()
|
||||
mToBeDeleted!!.add(deletedId)
|
||||
notifyEventDeletion(1)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun eventInserted(event: Event) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.simplemobiletools.calendar.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
@ -13,6 +14,7 @@ import android.widget.DatePicker
|
||||
import android.widget.RelativeLayout
|
||||
import com.simplemobiletools.calendar.*
|
||||
import com.simplemobiletools.calendar.Formatter
|
||||
import com.simplemobiletools.calendar.activities.EventActivity
|
||||
import com.simplemobiletools.calendar.adapters.EventsAdapter
|
||||
import com.simplemobiletools.calendar.models.Event
|
||||
import kotlinx.android.synthetic.main.day_fragment.view.*
|
||||
@ -21,6 +23,8 @@ import java.util.*
|
||||
|
||||
class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnItemClickListener,
|
||||
AbsListView.MultiChoiceModeListener {
|
||||
private val EDIT_EVENT = 1
|
||||
|
||||
private var mTextColor: Int = 0
|
||||
private var mWeakTextColor: Int = 0
|
||||
private var mTextColorWithEvent: Int = 0
|
||||
@ -122,6 +126,12 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte
|
||||
}
|
||||
}
|
||||
|
||||
private fun editEvent(event: Event) {
|
||||
val intent = Intent(activity.applicationContext, EventActivity::class.java)
|
||||
intent.putExtra(Constants.EVENT, event)
|
||||
startActivityForResult(intent, EDIT_EVENT)
|
||||
}
|
||||
|
||||
private fun getEventsToShow(events: MutableList<Event>): List<Event> {
|
||||
/*val cnt = events.size
|
||||
for (i in cnt - 1 downTo 0) {
|
||||
@ -169,8 +179,8 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte
|
||||
mode.invalidate()*/
|
||||
}
|
||||
|
||||
override fun onItemClick(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
//editEvent(getEventsToShow(mEvents)[position])
|
||||
override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||
editEvent(getEventsToShow(mEvents!!)[position])
|
||||
}
|
||||
|
||||
override fun eventInserted(event: Event?) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user