OpenSooq / Pluto

Pluto is an Easy, lightweight and high performance slider view library for Android. You have the flexibility to customize it to any view since it based RecyclerView.
https://engineering.opensooq.com
109 stars 16 forks source link

Attrs app:selected_color, app:unselected_color not work and event item click is not work on Samsung Galaxy S10 plus #9

Closed thoaileminh closed 4 years ago

thoaileminh commented 5 years ago

I have 2 proplems, please help me reslove them: 1: My layout above not show custom color indicators.

`<?xml version="1.0" encoding="utf-8"?> <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)`
tamtom commented 5 years ago

is everything working normally on other devices? and the issue only on Samsung S10+?

thoaileminh commented 5 years ago

Just xml layout is working fine on other devices, excepted S10+. And OnItemClickListener event is not working all device.

tamtom commented 5 years ago

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) 
thoaileminh commented 5 years ago

Here is my complete code, github cut my code, it still not work bro @Ramzi-Alqrainy :(

image

image

tamtom commented 5 years ago

maybe there is n issue in the logger, check your logcat filter or show toast instead

thoaileminh commented 5 years ago

I checked many time, I want to open new Activity, but debugger not detect my breakpoint

tamtom commented 4 years ago

not reproducible, you can clone and customize the library I'm pretty it will work with you