-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
107f827
commit edb8046
Showing
1 changed file
with
6 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView | |
import com.kizitonwose.calendarview.CalendarView | ||
import com.kizitonwose.calendarview.model.* | ||
import com.kizitonwose.calendarview.utils.NO_INDEX | ||
import com.kizitonwose.calendarview.utils.getVerticalMargins | ||
import com.kizitonwose.calendarview.utils.inflate | ||
import com.kizitonwose.calendarview.utils.orZero | ||
import java.time.LocalDate | ||
|
@@ -218,29 +217,26 @@ internal class CalendarAdapter( | |
val visibleVH = | ||
calView.findViewHolderForAdapterPosition(visibleItemPos) as? MonthViewHolder ?: return | ||
val newHeight = visibleVH.headerView?.height.orZero() + | ||
visibleVH.headerView?.getVerticalMargins().orZero() + | ||
// visibleVH.bodyLayout.height` won't not give us the right height as it differs | ||
// depending on row count in the month. So we calculate the appropriate height | ||
// by checking the number of visible(non-empty) rows. | ||
visibleMonth.weekDays.size * calView.daySize.height + | ||
visibleVH.footerView?.height.orZero() + | ||
visibleVH.footerView?.getVerticalMargins().orZero() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kizitonwose
Author
Owner
|
||
if (calView.height != newHeight) { | ||
visibleVH.footerView?.height.orZero() | ||
if (calView.height != newHeight && !initialLayout) { | ||
ValueAnimator.ofInt(calView.height, newHeight).apply { | ||
// Don't animate when the view is shown initially. | ||
duration = if (initialLayout) 0 else calView.wrappedPageHeightAnimationDuration.toLong() | ||
duration = calView.wrappedPageHeightAnimationDuration.toLong() | ||
addUpdateListener { | ||
calView.updateLayoutParams { height = it.animatedValue as Int } | ||
visibleVH.itemView.requestLayout() | ||
} | ||
start() | ||
} | ||
} | ||
if (initialLayout) { | ||
initialLayout = false | ||
// Request layout in case dataset was changed. See issue #199 | ||
} else { | ||
// Fixes #199, #266 | ||
visibleVH.itemView.requestLayout() | ||
} | ||
if (initialLayout) initialLayout = false | ||
} | ||
} | ||
} | ||
|
hey @kizitonwose , did you mean to remove this? it looks like my fix for the calendar height is no longer present in the release?