Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onVisibilityChanged no call #1386

Open
WShuo051X opened this issue Jun 27, 2024 · 0 comments
Open

onVisibilityChanged no call #1386

WShuo051X opened this issue Jun 27, 2024 · 0 comments

Comments

@WShuo051X
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant