Giter Site home page Giter Site logo

Comments (8)

alamkanak avatar alamkanak commented on May 8, 2024

Currently, this functionality is not available in the library. But soon it will be added.

from android-week-view.

 avatar commented on May 8, 2024

Could you say when new event handling will be implemented? I would love to apply this functionality in my app, which uses your plugin.

from android-week-view.

3rand avatar 3rand commented on May 8, 2024

I just made a workaround to get this by extending the code on the "onSingleTapConfirmed"

if (mEventClickListener != null) {
boolean didSelect = false;
if (mEventRects != null) {
List 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);
                        didSelect = true;
                        break;
                    }
                }
            }
            if (!didSelect) {
                int day_1 = mFirstVisibleDay.get(Calendar.DAY_OF_YEAR);
                int day_2 = mLastVisibleDay.get(Calendar.DAY_OF_YEAR);

                int chosen_day;

                if (day_1 != day_2) {
                    chosen_day = (int) (day_1 - 1 + Math.round((e.getX()  - mHeaderColumnPadding - (mNumberOfVisibleDays-1)*mColumnGap - mTextSize)
                            / mWidthPerDay));
                } else {
                    chosen_day = day_1;
                }

                Calendar RETCAL = Calendar.getInstance();
                RETCAL.setTime(mFirstVisibleDay.getTime());

                // int totalY = mScroller

                int chosen_hour = Math.max(Math.min((int) Math.round((e.getY() - mHeaderTextHeight - mHeaderRowPadding  - mHeaderMarginBottom - mScroller
                        .getCurrY()) / mHourHeight),23),0);

                RETCAL.set(Calendar.DAY_OF_YEAR, chosen_day);
                RETCAL.set(Calendar.HOUR_OF_DAY, chosen_hour);
                RETCAL.set(Calendar.MINUTE, 0);

                mEventClickListener.onBlankClick(RETCAL.getTime());

            }

        }
        return super.onSingleTapConfirmed(e);

onBlankClick is an extra method i added in the Interface.
This will give you the next full hour where the user has tapped.
Then you can use this to call your "insert new event" form

from android-week-view.

 avatar commented on May 8, 2024

I just created a pull request that can solve this problem. Please have a look.

from android-week-view.

alamkanak avatar alamkanak commented on May 8, 2024

Issue solved: #34.

mWeekView.setEmptyViewClickListener(new WeekView.EmptyViewClickListener() {
    @Override
    public void onEmptyViewClicked(Calendar time) {
        ...
    }
});

from android-week-view.

rachitmishra avatar rachitmishra commented on May 8, 2024

@alamkanak Wao! Awesome man! due to my busy schedule i was not able to work with this!
I will love to contribute! Thanx!

from android-week-view.

3rand avatar 3rand commented on May 8, 2024

thank you

from android-week-view.

3rand avatar 3rand commented on May 8, 2024

Well normally you hold events in a list (List), so you created a new event (newEvent) and add it to that list now.

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.