From a0d8a5a5a965ecc77ad77baf5f1ff457e6bb9ae7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 3 Dec 2017 21:13:06 +0100 Subject: [PATCH] pass context instead of activity in a couple Formatter functions --- .../simplemobiletools/calendar/activities/MainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index c11227ec5..1a0a96250 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -633,7 +633,7 @@ class MainActivity : SimpleActivity(), NavigationListener { week_view_hours_holder.removeAllViews() val hourDateTime = DateTime().withDate(2000, 1, 1).withTime(0, 0, 0, 0) for (i in 1..23) { - val formattedHours = Formatter.getHours(this, hourDateTime.withHourOfDay(i)) + val formattedHours = Formatter.getHours(applicationContext, hourDateTime.withHourOfDay(i)) (layoutInflater.inflate(R.layout.weekly_view_hour_textview, null, false) as TextView).apply { text = formattedHours setTextColor(mStoredTextColor) @@ -684,14 +684,14 @@ class MainActivity : SimpleActivity(), NavigationListener { private fun setupWeeklyActionbarTitle(timestamp: Int) { val startDateTime = Formatter.getDateTimeFromTS(timestamp) val endDateTime = Formatter.getDateTimeFromTS(timestamp + WEEK_SECONDS) - val startMonthName = Formatter.getMonthName(this, startDateTime.monthOfYear) + val startMonthName = Formatter.getMonthName(applicationContext, startDateTime.monthOfYear) if (startDateTime.monthOfYear == endDateTime.monthOfYear) { var newTitle = startMonthName if (startDateTime.year != DateTime().year) newTitle += " - ${startDateTime.year}" title = newTitle } else { - val endMonthName = Formatter.getMonthName(this, endDateTime.monthOfYear) + val endMonthName = Formatter.getMonthName(applicationContext, endDateTime.monthOfYear) title = "$startMonthName - $endMonthName" } supportActionBar?.subtitle = "${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}"