properly update everything at the weekly view on zoom
This commit is contained in:
parent
8d3517824e
commit
dfd557c183
|
@ -50,6 +50,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
private var currentTimeView: ImageView? = null
|
||||
private var allDayHolders = ArrayList<RelativeLayout>()
|
||||
private var allDayRows = ArrayList<HashSet<Int>>()
|
||||
private var currEvents = ArrayList<Event>()
|
||||
private var eventTypeColors = LongSparseArray<Int>()
|
||||
private var eventTimeRanges = LinkedHashMap<String, ArrayList<EventWeeklyView>>()
|
||||
|
||||
|
@ -222,7 +223,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
override fun onScaleEnd(detector: ScaleGestureDetector) {
|
||||
val newFactor = Math.max(Math.min(config.weeklyViewItemHeightMultiplier * detector.scaleFactor, MAX_ZOOM_FACTOR), MIN_ZOOM_FACTOR)
|
||||
config.weeklyViewItemHeightMultiplier = newFactor
|
||||
listener?.updateRowHeight()
|
||||
updateViewScale()
|
||||
|
||||
mView.week_events_scrollview.isScrollable = true
|
||||
super.onScaleEnd(detector)
|
||||
}
|
||||
|
@ -244,11 +246,21 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
compareBy<Event> { it.startTS }.thenBy { it.endTS }.thenBy { it.title }.thenBy { if (replaceDescription) it.location else it.description }
|
||||
).toMutableList() as ArrayList<Event>
|
||||
|
||||
currEvents = sorted
|
||||
addEvents(sorted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateViewScale() {
|
||||
rowHeight = context!!.getWeeklyViewItemHeight()
|
||||
listener?.updateRowHeight(rowHeight.toInt())
|
||||
val fullHeight = Math.max(rowHeight.toInt() * 24, mView.week_events_scrollview.height + 5)
|
||||
mView.week_horizontal_grid_holder.layoutParams.height = fullHeight
|
||||
mView.week_events_columns_holder.layoutParams.height = fullHeight
|
||||
addEvents(currEvents)
|
||||
}
|
||||
|
||||
private fun addEvents(events: ArrayList<Event>) {
|
||||
initGrid()
|
||||
allDayHolders.clear()
|
||||
|
|
|
@ -210,14 +210,13 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
|
||||
override fun getCurrScrollY() = weekScrollY
|
||||
|
||||
override fun updateRowHeight() {
|
||||
override fun updateRowHeight(rowHeight: Int) {
|
||||
val childCnt = weekHolder!!.week_view_hours_holder.childCount
|
||||
val itemHeight = context!!.getWeeklyViewItemHeight().toInt()
|
||||
for (i in 0..childCnt) {
|
||||
val textView = weekHolder!!.week_view_hours_holder.getChildAt(i) as? TextView ?: continue
|
||||
textView.layoutParams.height = itemHeight
|
||||
textView.layoutParams.height = rowHeight
|
||||
}
|
||||
|
||||
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, itemHeight)
|
||||
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, rowHeight)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ interface WeekFragmentListener {
|
|||
|
||||
fun getCurrScrollY(): Int
|
||||
|
||||
fun updateRowHeight()
|
||||
fun updateRowHeight(rowHeight: Int)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue