Git Product home page Git Product logo

Comments (7)

kizitonwose avatar kizitonwose commented on June 30, 2024 3

Closing this issue as there's now a solution. If you need any further assistance, let me know.

from calendar.

kizitonwose avatar kizitonwose commented on June 30, 2024 2

I finally got my hands on a Samsung device and can confirm that the suggested workaround does not work on the device.

However, after further testing, there's another workaround which works on Samsung devices as well as other devices which I tested on:

calendarView.addOnItemTouchListener(object : RecyclerView.SimpleOnItemTouchListener() {
    override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
        return rv.scrollState == RecyclerView.SCROLL_STATE_DRAGGING
    }
})

For reference purposes, here are other things I tried and how they turned out.

calendarView.setOnTouchListener { _, event ->
    event.action == MotionEvent.ACTION_MOVE
}

The above workaround allows an initial scroll action on the calendar before taking effect which is rather weird.

Another option is to extend the CalenderView class and override the dispatchTouchEvent method.

override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
    return if (ev.action == MotionEvent.ACTION_MOVE) true else super.dispatchTouchEvent(ev)
}

This gives the desired result. However, while the calendar does not move after a swipe action, a touch event is registered at the start position of the swipe gesture, hence the date cell at that position receives a click event.

from calendar.

kizitonwose avatar kizitonwose commented on June 30, 2024

Clicks are not detected using Action.MOVE event. I disabled scroll in example 5 in the sample app and clicks are still received. See the screen recording below:

Example 5

from calendar.

federicomiralles avatar federicomiralles commented on June 30, 2024

@kizitonwose I tried the same on my end by adding:

exFiveCalendar.addOnItemTouchListener(object : RecyclerView.SimpleOnItemTouchListener() {
            override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
                return if (e.action == MotionEvent.ACTION_MOVE) {
                    true
                } else {
                    super.onInterceptTouchEvent(rv, e)
                }
            }
        })

to the example you mentioned but I got the same result... I can't tap on a day...
I tried using a Motorola One with Android Pie.

from calendar.

kizitonwose avatar kizitonwose commented on June 30, 2024

That's very strange. Can you test with a different phone?
Also, do you have any other click listeners attached on any other part of the calendar? Example, month header or footer?

Sadly, this is a problem with RecyclerView itself, not this library so I may not be able to help much.

from calendar.

federicomiralles avatar federicomiralles commented on June 30, 2024

@kizitonwose unfortunately it also happens on Samsung devices but it's strange because it does works on other like Xiaomi. :/

from calendar.

kizitonwose avatar kizitonwose commented on June 30, 2024

Currently waiting to get a Samsung device to test with.

from calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.