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

kotlin, setPageItemClickListener not works into fragments #40

Open
Paul75 opened this issue Jan 21, 2019 · 1 comment
Open

kotlin, setPageItemClickListener not works into fragments #40

Paul75 opened this issue Jan 21, 2019 · 1 comment

Comments

@Paul75
Copy link

Paul75 commented Jan 21, 2019

Hello,

When I want to add setPageItemClickListener to action when I click into screen It not works.

I do into onCreateView :

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        activity?.title = getString(R.string.title_offres)
        val view = inflater.inflate(R.layout.fragment_offres, container, false)

        top5 = view.findViewById(R.id.top5) as PagerContainer

        top5.setOverlapEnabled(true)

        val pager = top5.getViewPager()

        val adapter = Top5Adapter(container!!.context, generateData())

        top5.setOnClickListener {
            v -> { // not works
                Toast.makeText(v.context, "SFSDFSDFSF", Toast.LENGTH_LONG).show()
            }
        }

        pager.adapter =  adapter
        pager.clipChildren = false
        //
        pager.offscreenPageLimit = 5

// NOT WORKS
        top5.setPageItemClickListener(PageItemClickListener { v, position ->
            startActivity(Intent(context, DetailOffreActivity::class.java))
        })

        CoverFlow.Builder().with(pager)
            .scale(0.3f)
            .pagerMargin(resources.getDimensionPixelSize(R.dimen.text_margin).toFloat())
            .spaceSize(0f)
            .build()
        return view
    }

Thansk for help.

@GongChuanZan
Copy link

me too

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

2 participants