diff --git a/app/src/main/java/me/yifeiyuan/flapdev/components/Banner.kt b/app/src/main/java/me/yifeiyuan/flapdev/components/Banner.kt index e012e0c4..a1b27ff1 100644 --- a/app/src/main/java/me/yifeiyuan/flapdev/components/Banner.kt +++ b/app/src/main/java/me/yifeiyuan/flapdev/components/Banner.kt @@ -1,10 +1,12 @@ package me.yifeiyuan.flapdev.components +import android.util.Log import android.widget.ImageView import androidx.viewpager2.widget.ViewPager2 import com.bumptech.glide.Glide import me.yifeiyuan.flap.FlapAdapter import me.yifeiyuan.flap.dsl.adapterDelegate +import me.yifeiyuan.flapdev.FlapApplication.Companion.toast import me.yifeiyuan.flapdev.R /** @@ -37,6 +39,10 @@ fun createBannerAdapterDelegate() = adapterDelegate(R.layout.compon bannerAdapter.setDataAndNotify(it) } } + + bannerAdapter.doOnItemClick { recyclerView, childView, position -> + toast("点击 banner position=$position") + } } fun bannerImageDelegate() = adapterDelegate(R.layout.component_banner_image) { diff --git a/app/src/main/res/layout/component_banner.xml b/app/src/main/res/layout/component_banner.xml index 961deafe..d27e77fd 100644 --- a/app/src/main/res/layout/component_banner.xml +++ b/app/src/main/res/layout/component_banner.xml @@ -11,4 +11,10 @@ android:layout_height="120dp" /> + + \ No newline at end of file