Attrs app:selected_color, app:unselected_color not work and event item click is not work on Samsung Galaxy S10 plus
thoaileminh opened this issue · comments
I have 2 proplems, please help me reslove them:
1: My layout above not show custom color indicators.
`
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.opensooq.pluto.PlutoView
android:id="@+id/bannerStarSlide"
android:layout_width="match_parent"
android:layout_height="@dimen/iv_race_height"
android:foreground="?attr/selectableItemBackground"
app:indicator_visibility="true"
app:layout_constraintTop_toTopOf="parent" />
<com.opensooq.pluto.PlutoIndicator
android:id="@+id/indicatorStarSlide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bannerStarSlide"
android:layout_marginBottom="@dimen/margin_2"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="@+id/bannerStarSlide"
app:selected_color="@color/gl_indicator_selected"
app:unselected_color="@color/gl_indicator_unselected" />
</androidx.constraintlayout.widget.ConstraintLayout>`
I have to custom in my code, please check:
` val dm = DisplayMetrics()
activity?.windowManager?.defaultDisplay?.getMetrics(dm)
val dotsSize = resources.getDimensionPixelSize(R.dimen.slide_dot_size)
indicatorStarSlide.setDefaultIndicatorSize(
dotsSize.toFloat(),
dotsSize.toFloat(),
PlutoIndicator.Unit.Px
)
indicatorStarSlide.setDefaultIndicatorShape(PlutoIndicator.Shape.Oval)
bannerStarSlide.setCustomIndicator(indicatorStarSlide)`
2. onItemClicked event not working
Apdater:
`class StarSlideAdapter(
items: ArrayList,
listener : OnItemClickListener? = null
) : PlutoAdapter<StarSlideItemModel, StarSlideAdapter.ViewHolder>(items, listener) {
override fun getViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(parent, R.layout.gl_holder_star_slide)
}
class ViewHolder(parent: ViewGroup, itemLayoutId: Int) :
PlutoViewHolder<StarSlideItemModel>(parent, itemLayoutId) {
private var ivStarSlide: AppCompatImageView = getView(R.id.ivStarSlide)
override fun set(item: StarSlideItemModel, position: Int) {
ivStarSlide.load(item.raceUrl)
}
}
}`
Fragment:
`
val adapter =
StarSlideAdapter(createItemSlider(), object : OnItemClickListener {
override fun onItemClicked(item: StarSlideItemModel?, position: Int) {
Timber.e("----> slideItem %s ", item)
}
})
bannerStarSlide.create(adapter, BANNER_SLIDE_DURATION, lifecycle)`
is everything working normally on other devices? and the issue only on Samsung S10+?
Just xml layout is working fine on other devices, excepted S10+.
And OnItemClickListener event is not working all device.
is that your code?
class StarSlideAdapter(
items: ArrayList,
listener : OnItemClickListener? = null
) : PlutoAdapter<StarSlideItemModel, StarSlideAdapter.ViewHolder>(items, listener)
because I belive you should specify the model in the listener and in the list
like this
class StarSlideAdapter(
items: ArrayList<StarSlideItemModel>,
listener : OnItemClickListener<StarSlideItemModel>? = null
) : PlutoAdapter<StarSlideItemModel, StarSlideAdapter.ViewHolder>(items, listener)
maybe there is n issue in the logger, check your logcat filter or show toast instead
I checked many time, I want to open new Activity, but debugger not detect my breakpoint
not reproducible, you can clone and customize the library I'm pretty it will work with you