#1386·epoxy

onVisibilityChanged 没有调用

作者: WShuo051X创建于 2024年6月27日更新于 2024年6月27日

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()) } …