Skip to content

Commit 09e10d3

Browse files
committed
Fix issue where WeekView would crash when submitting new events
The issue occurred when submitting new events after having previously submitted an empty list.
1 parent b7e6413 commit 09e10d3

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

core/src/main/java/com/alamkanak/weekview/EventsCache.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,5 @@ internal class PagedEventsCache<T> : EventsCache<T>() {
182182
previousPeriodEvents = null
183183
currentPeriodEvents = null
184184
nextPeriodEvents = null
185-
fetchedRange = null
186185
}
187186
}

sample/src/main/java/com/alamkanak/weekview/sample/AsyncActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class AsyncActivity : AppCompatActivity() {
8282

8383
weekView.setOnEmptyViewLongClickListener { time ->
8484
val sdf = SimpleDateFormat.getDateTimeInstance()
85-
showToast("Empty view clicked at ${sdf.format(time.time)}")
85+
showToast("Empty view long-clicked at ${sdf.format(time.time)}")
8686
}
8787
}
8888
}

sample/src/main/java/com/alamkanak/weekview/sample/CustomFontActivity.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package com.alamkanak.weekview.sample
33
import android.os.Bundle
44
import androidx.appcompat.app.AppCompatActivity
55
import com.alamkanak.weekview.WeekView
6-
import com.alamkanak.weekview.sample.data.model.Event
76
import com.alamkanak.weekview.sample.data.EventsDatabase
7+
import com.alamkanak.weekview.sample.data.model.Event
88
import com.alamkanak.weekview.sample.util.lazyView
99
import com.alamkanak.weekview.sample.util.setupWithWeekView
1010
import com.alamkanak.weekview.sample.util.showToast
@@ -25,8 +25,8 @@ class CustomFontActivity : AppCompatActivity() {
2525

2626
weekView.setOnMonthChangeListener(this::onMonthChange)
2727
weekView.setOnEventClickListener { data, _ -> onEventClick(data) }
28-
weekView.setOnEventLongClickListener { data, _ -> onEventLongPress(data) }
29-
weekView.setOnEmptyViewLongClickListener(this::onEmptyViewLongPress)
28+
weekView.setOnEventLongClickListener { data, _ -> onEventLongClick(data) }
29+
weekView.setOnEmptyViewLongClickListener(this::onEmptyViewLongClick)
3030
}
3131

3232
private fun onMonthChange(
@@ -38,12 +38,12 @@ class CustomFontActivity : AppCompatActivity() {
3838
showToast("Clicked ${event.title}")
3939
}
4040

41-
private fun onEventLongPress(event: Event) {
41+
private fun onEventLongClick(event: Event) {
4242
showToast("Long-clicked ${event.title}")
4343
}
4444

45-
private fun onEmptyViewLongPress(time: Calendar) {
45+
private fun onEmptyViewLongClick(time: Calendar) {
4646
val sdf = SimpleDateFormat.getDateTimeInstance()
47-
showToast("Empty view clicked at ${sdf.format(time.time)}")
47+
showToast("Empty view long-clicked at ${sdf.format(time.time)}")
4848
}
4949
}

sample/src/main/java/com/alamkanak/weekview/sample/LimitedActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import com.alamkanak.weekview.OnEventClickListener
99
import com.alamkanak.weekview.OnEventLongClickListener
1010
import com.alamkanak.weekview.OnMonthChangeListener
1111
import com.alamkanak.weekview.WeekView
12-
import com.alamkanak.weekview.sample.data.model.Event
1312
import com.alamkanak.weekview.sample.data.EventsDatabase
13+
import com.alamkanak.weekview.sample.data.model.Event
1414
import com.alamkanak.weekview.sample.util.lazyView
1515
import com.alamkanak.weekview.sample.util.setupWithWeekView
1616
import com.alamkanak.weekview.sample.util.showToast
@@ -67,6 +67,6 @@ class LimitedActivity : AppCompatActivity(), OnEventClickListener<Event>,
6767

6868
override fun onEmptyViewLongClick(time: Calendar) {
6969
val sdf = SimpleDateFormat.getDateTimeInstance()
70-
showToast("Empty view clicked at ${sdf.format(time.time)}")
70+
showToast("Empty view long-clicked at ${sdf.format(time.time)}")
7171
}
7272
}

sample/src/main/java/com/alamkanak/weekview/sample/StaticActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class StaticActivity : AppCompatActivity(), OnEventClickListener<Event>,
7979

8080
override fun onEmptyViewLongClick(time: Calendar) {
8181
val sdf = SimpleDateFormat.getDateTimeInstance()
82-
showToast("Empty view clicked at ${sdf.format(time.time)}")
82+
showToast("Empty view long-clicked at ${sdf.format(time.time)}")
8383
}
8484

8585
internal fun updateDateText(firstVisibleDate: Calendar, lastVisibleDate: Calendar) {

0 commit comments

Comments
 (0)