From 80dd14779937228c01282cafe28baaf49ff73ad0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 15 Jan 2017 20:48:39 +0100 Subject: [PATCH] add a weekly calendar implementation placeholder --- .../calendar/helpers/MonthlyCalendarImpl.kt | 3 +-- .../calendar/helpers/WeeklyCalendarImpl.kt | 25 +++++++++++++++++++ .../calendar/interfaces/WeeklyCalendar.kt | 7 ++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/calendar/helpers/WeeklyCalendarImpl.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/calendar/interfaces/WeeklyCalendar.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt index 393019abc..fc3e9bac3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt @@ -12,13 +12,12 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context) private val DAYS_CNT = 42 private val YEAR_PATTERN = "YYYY" - private val mToday: String + private val mToday: String = DateTime().toString(Formatter.DAYCODE_PATTERN) var mEvents: List lateinit var mTargetDate: DateTime init { - mToday = DateTime().toString(Formatter.DAYCODE_PATTERN) mEvents = ArrayList() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/WeeklyCalendarImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/WeeklyCalendarImpl.kt new file mode 100644 index 000000000..a625e6585 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/WeeklyCalendarImpl.kt @@ -0,0 +1,25 @@ +package com.simplemobiletools.calendar.helpers + +import android.content.Context +import com.simplemobiletools.calendar.interfaces.WeeklyCalendar +import com.simplemobiletools.calendar.models.Event +import org.joda.time.DateTime +import java.util.* + +class WeeklyCalendarImpl(val mCallback: WeeklyCalendar, val mContext: Context) : DBHelper.GetEventsListener { + var mEvents: List + + lateinit var mTargetDate: DateTime + + init { + mEvents = ArrayList() + } + + fun updateWeeklyCalendar(targetDate: DateTime) { + mTargetDate = targetDate + } + + override fun gotEvents(events: MutableList) { + mEvents = events + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/interfaces/WeeklyCalendar.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/interfaces/WeeklyCalendar.kt new file mode 100644 index 000000000..f43599adb --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/interfaces/WeeklyCalendar.kt @@ -0,0 +1,7 @@ +package com.simplemobiletools.calendar.interfaces + +import com.simplemobiletools.calendar.models.Event + +interface WeeklyCalendar { + fun updateWeeklyCalendar(events: List) +}