rename Day model to DayMonthly

This commit is contained in:
tibbi 2017-09-10 16:50:07 +02:00
parent fcb2725309
commit d5e14828f5
6 changed files with 17 additions and 17 deletions

View File

@ -17,7 +17,7 @@ import com.simplemobiletools.calendar.helpers.LOW_ALPHA
import com.simplemobiletools.calendar.helpers.MonthlyCalendarImpl
import com.simplemobiletools.calendar.helpers.MyWidgetMonthlyProvider
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.calendar.models.DayMonthly
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.beVisible
@ -29,7 +29,7 @@ import org.joda.time.DateTime
class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
lateinit var mRes: Resources
private var mDays: List<Day>? = null
private var mDays: List<DayMonthly>? = null
private var mPackageName = ""
private var mBgAlpha = 0f
@ -192,7 +192,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
}
}
override fun updateMonthlyCalendar(month: String, days: List<Day>) {
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
runOnUiThread {
mDays = days
updateMonth(month)

View File

@ -19,7 +19,7 @@ import com.simplemobiletools.calendar.extensions.getAppropriateTheme
import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
import com.simplemobiletools.calendar.interfaces.NavigationListener
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.calendar.models.DayMonthly
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.beGone
import com.simplemobiletools.commons.extensions.beVisibleIf
@ -82,7 +82,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
mCalendar.updateMonthlyCalendar(Formatter.getDateTimeFromCode(mDayCode))
}
override fun updateMonthlyCalendar(month: String, days: List<Day>) {
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
activity?.runOnUiThread {
mHolder.top_value.text = month
mHolder.top_value.setTextColor(mConfig.textColor)
@ -156,7 +156,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
}
}
private fun updateDays(days: List<Day>) {
private fun updateDays(days: List<DayMonthly>) {
val displayWeekNumbers = mConfig.displayWeekNumbers
val len = days.size
@ -210,7 +210,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
}
}
private fun getDayDotColor(day: Day, defaultColor: Int): Int {
private fun getDayDotColor(day: DayMonthly, defaultColor: Int): Int {
val colors = day.eventColors.distinct()
return if (colors.size == 1)
colors[0]

View File

@ -6,7 +6,7 @@ import com.simplemobiletools.calendar.extensions.dbHelper
import com.simplemobiletools.calendar.extensions.getFilteredEvents
import com.simplemobiletools.calendar.extensions.seconds
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.calendar.models.DayMonthly
import com.simplemobiletools.calendar.models.Event
import org.joda.time.DateTime
import java.util.*
@ -36,7 +36,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
}
fun getDays() {
val days = ArrayList<Day>(DAYS_CNT)
val days = ArrayList<DayMonthly>(DAYS_CNT)
val currMonthDays = mTargetDate.dayOfMonth().maximumValue
var firstDayIndex = mTargetDate.withDayOfMonth(1).dayOfWeek
@ -67,7 +67,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
val newDay = curDay.withDayOfMonth(value)
val dayCode = Formatter.getDayCodeFromDateTime(newDay)
val day = Day(value, isThisMonth, isToday, dayCode, false, newDay.weekOfWeekyear, ArrayList())
val day = DayMonthly(value, isThisMonth, isToday, dayCode, false, newDay.weekOfWeekyear, ArrayList())
days.add(day)
value++
}
@ -76,7 +76,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
}
// it works more often than not, dont touch
private fun markDaysWithEvents(days: ArrayList<Day>) {
private fun markDaysWithEvents(days: ArrayList<DayMonthly>) {
mContext.dbHelper.getEventTypes {
val dayEvents = HashMap<String, ArrayList<Event>>()
mEvents.forEach {

View File

@ -18,7 +18,7 @@ import com.simplemobiletools.calendar.activities.SplashActivity
import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.extensions.launchNewEventIntent
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.calendar.models.DayMonthly
import com.simplemobiletools.commons.extensions.adjustAlpha
import org.joda.time.DateTime
@ -135,7 +135,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
mCalendar?.getMonth(mTargetDate)
}
fun updateDays(days: List<Day>) {
fun updateDays(days: List<DayMonthly>) {
val displayWeekNumbers = mContext.config.displayWeekNumbers
val len = days.size
val packageName = mContext.packageName
@ -215,7 +215,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
mRemoteViews?.setTextViewText(R.id.top_value, month)
}
override fun updateMonthlyCalendar(month: String, days: List<Day>) {
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
try {
updateMonth(month)
updateDays(days)

View File

@ -1,7 +1,7 @@
package com.simplemobiletools.calendar.interfaces
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.calendar.models.DayMonthly
interface MonthlyCalendar {
fun updateMonthlyCalendar(month: String, days: List<Day>)
fun updateMonthlyCalendar(month: String, days: List<DayMonthly>)
}

View File

@ -1,4 +1,4 @@
package com.simplemobiletools.calendar.models
data class Day(val value: Int, val isThisMonth: Boolean, val isToday: Boolean, val code: String, var hasEvent: Boolean, val weekOfYear: Int,
data class DayMonthly(val value: Int, val isThisMonth: Boolean, val isToday: Boolean, val code: String, var hasEvent: Boolean, val weekOfYear: Int,
var eventColors: ArrayList<Int>)