epoxy
epoxy copied to clipboard
onVisibilityChanged no call
Just started using the framework My code :
fun ModelCollector.refreshableCarouselNoSnapBuilder(builder: EpoxyCarouselNoSnapRefreshableBuilder.() -> Unit): CarouselNoSnapRefreshableModel_ { val carouselBuilder = EpoxyCarouselNoSnapRefreshableBuilder().apply { builder() } add(carouselBuilder.carouselNoSnapRefreshableModel) return carouselBuilder.carouselNoSnapRefreshableModel }
class EpoxyCarouselNoSnapRefreshableBuilder( internal val carouselNoSnapRefreshableModel: CarouselNoSnapRefreshableModel_ = CarouselNoSnapRefreshableModel_() ) : ModelCollector, CarouselNoSnapRefreshableModelBuilder by carouselNoSnapRefreshableModel { private val models = mutableListOf<EpoxyModel<*>>()
override fun add(model: EpoxyModel<*>) {
models.add(model)
// Set models list every time a model is added so that it can run debug validations to
// ensure it is still valid to mutate the carousel model.
carouselNoSnapRefreshableModel.models(models)
}
}
refreshableCarouselNoSnapBuilder { id("refreshableCarouselNoSnapBuilder") loadMoreListener([email protected]) refreshAble(false) height((horizontalItemHeight + marginDP2Top).toFloat()) data?.histories?.forEachIndexed { index, elementAt -> elementAt.feedFrom = "play_history" elementAt.routeSource = [email protected] ?: "" sItemContentView { id("id_history_$index") width(horizontalItemWidth) height(horizontalItemHeight) marginTop(DensityUtil.dp2px(14f)) marginLeft(if (index == 0) marginDP2Start else marginDP2Left) marginRight(0) elementAt.contentCoverUrl?.let { url -> cover(url) } elementAt.contentName?.let { name -> name(name) } onItemClickListener { _ -> [email protected](index) } totalCount(data.totalHistoryCount) onVisibilityStateChanged { model, view, visibilityState -> SDebugLog.d( "vis", "onVisibilityStateChanged = ${View.VISIBLE == visibilityState}" ) } onVisibilityChanged { model, view, percentVisibleHeight, percentVisibleWidth, heightVisible, widthVisible -> SDebugLog.d("vis", "height = ${View.VISIBLE == heightVisible}") SDebugLog.d("vis", "width = ${View.VISIBLE == widthVisible}") } // itemTag(elementAt.toTraceTag()) } if (index + 1 == data.totalHistoryCount) { sWSItemGap { id("itemGap_end") height(horizontalItemHeight.toFloat()) width(24f) color(R.color.s_transparent) } isEnableLoadMore(false) loadMoreListener(null) } } }