mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
remove some DB code from dayactivity
This commit is contained in:
@@ -4,15 +4,17 @@ import android.content.Intent
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.design.widget.Snackbar
|
import android.support.design.widget.Snackbar
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.simplemobiletools.calendar.*
|
import com.simplemobiletools.calendar.Constants
|
||||||
import com.simplemobiletools.calendar.Formatter
|
import com.simplemobiletools.calendar.Formatter
|
||||||
|
import com.simplemobiletools.calendar.NavigationListener
|
||||||
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.adapters.MyDayPagerAdapter
|
import com.simplemobiletools.calendar.adapters.MyDayPagerAdapter
|
||||||
import com.simplemobiletools.calendar.models.Event
|
import com.simplemobiletools.calendar.models.Event
|
||||||
import kotlinx.android.synthetic.main.activity_day.*
|
import kotlinx.android.synthetic.main.activity_day.*
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsListener {
|
class DayActivity : SimpleActivity(), NavigationListener {
|
||||||
|
|
||||||
private val PREFILLED_DAYS = 61
|
private val PREFILLED_DAYS = 61
|
||||||
private var mDayCode: String? = null
|
private var mDayCode: String? = null
|
||||||
@@ -45,11 +47,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
//mToBeDeleted = ArrayList<Int>()
|
//mToBeDeleted = ArrayList<Int>()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
checkEvents()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
checkDeleteEvents()
|
checkDeleteEvents()
|
||||||
@@ -80,12 +77,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
overridePendingTransition(0, 0)
|
overridePendingTransition(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkEvents() {
|
|
||||||
val startTS = Formatter.getDayStartTS(mDayCode)
|
|
||||||
val endTS = Formatter.getDayEndTS(mDayCode)
|
|
||||||
DBHelper.newInstance(applicationContext, this).getEvents(startTS, endTS)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*private fun updateEvents(events: MutableList<Event>) {
|
/*private fun updateEvents(events: MutableList<Event>) {
|
||||||
mEvents = ArrayList(events)
|
mEvents = ArrayList(events)
|
||||||
val eventsToShow = getEventsToShow(events)
|
val eventsToShow = getEventsToShow(events)
|
||||||
@@ -116,18 +107,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun eventInserted(event: Event) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun eventUpdated(event: Event) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun eventsDeleted(cnt: Int) {
|
|
||||||
checkEvents()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkDeleteEvents() {
|
private fun checkDeleteEvents() {
|
||||||
if (mSnackbar != null && mSnackbar!!.isShown) {
|
if (mSnackbar != null && mSnackbar!!.isShown) {
|
||||||
deleteEvents()
|
deleteEvents()
|
||||||
@@ -137,7 +116,7 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteEvents() {
|
private fun deleteEvents() {
|
||||||
mSnackbar!!.dismiss()
|
/*mSnackbar!!.dismiss()
|
||||||
|
|
||||||
val cnt = mToBeDeleted!!.size
|
val cnt = mToBeDeleted!!.size
|
||||||
val eventIDs = arrayOfNulls<String>(cnt)
|
val eventIDs = arrayOfNulls<String>(cnt)
|
||||||
@@ -145,7 +124,7 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
eventIDs[i] = mToBeDeleted!![i].toString()
|
eventIDs[i] = mToBeDeleted!![i].toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
DBHelper.newInstance(applicationContext, this).deleteEvents(eventIDs)
|
DBHelper.newInstance(applicationContext, this).deleteEvents(eventIDs)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private val undoDeletion = View.OnClickListener { undoDeletion() }
|
private val undoDeletion = View.OnClickListener { undoDeletion() }
|
||||||
@@ -158,10 +137,6 @@ class DayActivity : SimpleActivity(), NavigationListener, DBHelper.DBOperationsL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun gotEvents(events: MutableList<Event>) {
|
|
||||||
//updateEvents(events)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun prepareDeleteEvents() {
|
private fun prepareDeleteEvents() {
|
||||||
/*val checked = mEventsList!!.checkedItemPositions
|
/*val checked = mEventsList!!.checkedItemPositions
|
||||||
for (i in mEvents!!.indices) {
|
for (i in mEvents!!.indices) {
|
||||||
|
Reference in New Issue
Block a user