Giter Site home page Giter Site logo

Header Click Event about android-week-view HOT 5 OPEN

alamkanak avatar alamkanak commented on May 7, 2024
Header Click Event

from android-week-view.

Comments (5)

alamkanak avatar alamkanak commented on May 7, 2024 1

Currently this feature is not available. Thanks for suggesting the idea 👍
Will let you know when the feature is available.

from android-week-view.

rincyrose avatar rincyrose commented on May 7, 2024

If you can make click event asap it will be very helpful for me to use this calendar in my app.

Thank you

from android-week-view.

dukerok avatar dukerok commented on May 7, 2024
        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            // If the tap was on an event then trigger the callback.
            if (mEventRects != null && mEventClickListener != null) {
                List<EventRect> reversedEventRects = mEventRects;
                Collections.reverse(reversedEventRects);
                for (EventRect event : reversedEventRects) {
                    if (event.rectF != null && e.getX() > event.rectF.left && e.getX() < event.rectF.right && e.getY() > event.rectF.top && e.getY() < event.rectF.bottom) {
                        mEventClickListener.onEventClick(event.originalEvent, event.rectF);
                        playSoundEffect(SoundEffectConstants.CLICK);
                        return super.onSingleTapConfirmed(e);
                    }
                }
            }
            // If the tap was on in an empty space, then trigger the callback.
            if (mEmptyViewClickListener != null && e.getX() > mHeaderColumnWidth && e.getY() > (mHeaderHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom)) {
                Calendar selectedTime = getTimeFromPoint(e.getX(), e.getY());
                if (selectedTime != null) {
                    playSoundEffect(SoundEffectConstants.CLICK);
                    mEmptyViewClickListener.onEmptyViewClicked(selectedTime);
                }
            }

            //todo added
            if (mHeaderViewClickListener != null && e.getX() > mHeaderColumnWidth && e.getY() < (mHeaderHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom)) {
                Calendar selectedTime = getTimeFromPoint(e.getX(), e.getY() + mHourHeight);
                if (selectedTime != null) {
                    playSoundEffect(SoundEffectConstants.CLICK);
                    mHeaderViewClickListener.onHeaderViewClicked(selectedTime);
                }
            }

            return super.onSingleTapConfirmed(e);
        }

from android-week-view.

basmasrour avatar basmasrour commented on May 7, 2024

Where can I override onSingleTapConfirmed()? in which class?
And how to add HeaderViewClickListener?

from android-week-view.

dukerok avatar dukerok commented on May 7, 2024

As the solution, I suggest you to change a WeekView.mGestureListener (onSingleTapConfirmed() method) field realization. But the tricky part here is that this field has private access and that is why you cannot access him directly.

I suggest you to fork library sources, change implementation, recompile and then use this jar or class;

from android-week-view.

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.