Skip to content

Commit

Permalink
完善 demo
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCheen committed Oct 17, 2022
1 parent 954915a commit fb01b55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/me/yifeiyuan/flapdev/components/Banner.kt
Original file line number Diff line number Diff line change
@@ -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

/**
Expand Down Expand Up @@ -37,6 +39,10 @@ fun createBannerAdapterDelegate() = adapterDelegate<BannerModel>(R.layout.compon
bannerAdapter.setDataAndNotify(it)
}
}

bannerAdapter.doOnItemClick { recyclerView, childView, position ->
toast("点击 banner position=$position")
}
}

fun bannerImageDelegate() = adapterDelegate<BannerImageModel>(R.layout.component_banner_image) {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/layout/component_banner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
android:layout_height="120dp"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ViewPager2 测试"
/>

</FrameLayout>

0 comments on commit fb01b55

Please sign in to comment.