remove a redundant interface
This commit is contained in:
parent
ab0bfebdf1
commit
a105d270c0
3 changed files with 7 additions and 37 deletions
|
@ -22,7 +22,7 @@ import kotlinx.android.synthetic.main.activity_event.*
|
|||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||
class EventActivity : SimpleActivity() {
|
||||
companion object {
|
||||
val STORED_LOCALLY_ONLY = 0
|
||||
}
|
||||
|
@ -753,13 +753,4 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
event_type_image.applyColorFilter(textColor)
|
||||
event_caldav_calendar_image.applyColorFilter(textColor)
|
||||
}
|
||||
|
||||
override fun eventInserted(event: Event) {
|
||||
}
|
||||
|
||||
override fun eventsDeleted(cnt: Int) {
|
||||
}
|
||||
|
||||
override fun gotEvents(events: MutableList<Event>) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@ import com.simplemobiletools.calendar.extensions.config
|
|||
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||
import com.simplemobiletools.calendar.extensions.getAppropriateTheme
|
||||
import com.simplemobiletools.calendar.extensions.getFilteredEvents
|
||||
import com.simplemobiletools.calendar.helpers.*
|
||||
import com.simplemobiletools.calendar.helpers.DAY_CODE
|
||||
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.interfaces.DeleteEventsListener
|
||||
import com.simplemobiletools.calendar.interfaces.NavigationListener
|
||||
|
@ -31,7 +33,7 @@ import kotlinx.android.synthetic.main.top_navigation.view.*
|
|||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListener {
|
||||
class DayFragment : Fragment(), DeleteEventsListener {
|
||||
var mListener: NavigationListener? = null
|
||||
private var mTextColor = 0
|
||||
private var mDayCode = ""
|
||||
|
@ -110,7 +112,7 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
|
|||
fun checkEvents() {
|
||||
val startTS = Formatter.getDayStartTS(mDayCode)
|
||||
val endTS = Formatter.getDayEndTS(mDayCode)
|
||||
DBHelper.newInstance(context!!, this).getEvents(startTS, endTS) {
|
||||
context!!.dbHelper.getEvents(startTS, endTS) {
|
||||
receivedEvents(it)
|
||||
}
|
||||
}
|
||||
|
@ -165,15 +167,4 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
|
|||
}
|
||||
(activity as DayActivity).recheckEvents()
|
||||
}
|
||||
|
||||
override fun eventInserted(event: Event) {
|
||||
}
|
||||
|
||||
override fun eventsDeleted(cnt: Int) {
|
||||
(activity as DayActivity).recheckEvents()
|
||||
}
|
||||
|
||||
override fun gotEvents(events: MutableList<Event>) {
|
||||
receivedEvents(events)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,10 +70,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
val REGULAR_EVENT_TYPE_ID = 1
|
||||
var dbInstance: DBHelper? = null
|
||||
|
||||
private var mEventsListener: EventUpdateListener? = null
|
||||
|
||||
fun newInstance(context: Context, callback: EventUpdateListener? = null): DBHelper {
|
||||
mEventsListener = callback
|
||||
fun newInstance(context: Context): DBHelper {
|
||||
if (dbInstance == null)
|
||||
dbInstance = DBHelper(context)
|
||||
|
||||
|
@ -427,7 +424,6 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
mDb.delete(EXCEPTIONS_TABLE_NAME, exceptionSelection, null)
|
||||
|
||||
context.updateWidgets()
|
||||
mEventsListener?.eventsDeleted(ids.size)
|
||||
|
||||
ids.forEach {
|
||||
context.cancelNotification(it.toInt())
|
||||
|
@ -961,12 +957,4 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
cursor?.close()
|
||||
}
|
||||
}
|
||||
|
||||
interface EventUpdateListener {
|
||||
fun eventInserted(event: Event)
|
||||
|
||||
fun eventsDeleted(cnt: Int)
|
||||
|
||||
fun gotEvents(events: MutableList<Event>)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue