Skip to content

Commit f8f51bd

Browse files
committed
Move EventChipsExpander code into EventChipsLoader
1 parent 8339769 commit f8f51bd

11 files changed

+231
-233
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class AllDayEventsUpdater<T : Any>(
1515
private val view: WeekView<T>,
1616
private val config: WeekViewConfigWrapper,
1717
private val cache: WeekViewCache<T>,
18-
private val chipCache: EventChipCache<T>,
18+
private val chipsCache: EventChipsCache<T>,
1919
private val emojiTextProcessor: EmojiTextProcessor = EmojiTextProcessor()
2020
) : Updater {
2121

@@ -28,7 +28,7 @@ internal class AllDayEventsUpdater<T : Any>(
2828
override fun isRequired(drawingContext: DrawingContext): Boolean {
2929
val didScrollHorizontally = previousHorizontalOrigin != config.currentOrigin.x
3030
val dateRange = drawingContext.dateRange
31-
val containsNewChips = chipCache.allDayEventChipsInDateRange(dateRange).any { it.bounds == null }
31+
val containsNewChips = chipsCache.allDayEventChipsInDateRange(dateRange).any { it.bounds == null }
3232
return didScrollHorizontally || containsNewChips
3333
}
3434

@@ -43,7 +43,7 @@ internal class AllDayEventsUpdater<T : Any>(
4343
else -> startPixel
4444
}
4545

46-
val eventChips = chipCache.allDayEventChipsByDate(date)
46+
val eventChips = chipsCache.allDayEventChipsByDate(date)
4747
for (eventChip in eventChips) {
4848
calculateTextLayout(eventChip, modifiedStartPixel)
4949
}

core/src/main/java/com/alamkanak/weekview/EventChipCache.kt renamed to core/src/main/java/com/alamkanak/weekview/EventChipsCache.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ package com.alamkanak.weekview
33
import java.util.Calendar
44
import java.util.concurrent.ConcurrentHashMap
55

6-
internal class EventChipCache<T> {
6+
internal class EventChipsCache<T> {
77

88
val allEventChips: List<EventChip<T>>
99
get() = normalEventChipsByDate.values.flatten() + allDayEventChipsByDate.values.flatten()
1010

1111
private val normalEventChipsByDate = ConcurrentHashMap<Long, MutableList<EventChip<T>>>()
1212
private val allDayEventChipsByDate = ConcurrentHashMap<Long, MutableList<EventChip<T>>>()
1313

14-
fun groupedByDate(): Map<Calendar, List<EventChip<T>>> {
15-
return allEventChips.groupBy { it.event.startTime.atStartOfDay }
16-
}
17-
1814
fun allEventChipsInDateRange(
1915
dateRange: List<Calendar>
2016
): List<EventChip<T>> {

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

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)