CompactCalendarView icon indicating copy to clipboard operation
CompactCalendarView copied to clipboard

Wrap height of the calendar according to the number of days visisble

Open EndzeitBegins opened this issue 9 years ago • 4 comments

I've integrated your wonderfull calendar widget today and it works like a charm. Thanks for that, can I donate some euros to you via PayPal or such?

I embedded the Calendar in CollapsingToolbarLayout. In addition to the already issued scrolling problems from time to time I noticed that setting the height to wrap_content doesn't act as I expected as it fills the entire Toolbar. Is this the expected behaviour?

EndzeitBegins avatar Feb 03 '16 17:02 EndzeitBegins

The calendar was designed to be used with a set height/width. though, typically only the height really needs to be set. This is because it needs to know before hand how to draw items onto the paint object. There's no code to handle wrap_content, because there's nothing to wrap inside. wrap_content makes sense when there's content inside a view that you control, for example, a TextView. Since there's text inside, it will automatically measure how far it needs to extends height/width.

I suggest you try setting the height directly, it will use the screen density, so it should look the same across screens.

Thanks for the offer for donations :), but it's not required. If enough people want to donate, I can add something further to facilitate for that. But otherwise, enjoy free code.

SundeepK avatar Feb 03 '16 20:02 SundeepK

Thanks for the quick response. That's reasonable. I'll set the height to a pre-defined height again. I just was hoping that the view would shrink accordingly to it's actual height when there're only four rows for the week instead of six for example.

Are you working one the side-scrolling behavior to behave more like a ViewPager? Sometimes it works like a charm but when one's sliding more slowly it get's stuck in between two months and the listener for the month change isn't fired, even after fully scrolling over to the next month. I know there's an open issue about this, but I'm not sure if you were still working on it.

Thanks nonetheless for this amazing widget. And I have to apologize for my bad english. :D

EndzeitBegins avatar Feb 03 '16 20:02 EndzeitBegins

I just was hoping that the view would shrink accordingly to it's actual height when there're only four rows for the week instead of six for example.

That's an entirely different issue if that's what your after. Basically, the calendar right now is stuck at a specific height and doesn't resize if the number of days in the calendar is much less.

Are you working one the side-scrolling behavior to behave more like a ViewPager? Sometimes it works like a charm but when one's sliding more slowly it get's stuck in between two months and the listener for the month change isn't fired, even after fully scrolling over to the next month. I know there's an open issue about this, but I'm not sure if you were still working on it.

I plan to release this as a beta when I get time. I also am working on an open/close functionality on the calendar so that people don't have to embed the calendar into the toolbar (although it won't stop you if you want too.).This way it will resize the height of the view when you want to show or hide it.

Unfortunately, I haven't invested much time embedding the calendar in the toolbar, but there is a ticket which has a forked copy of the code to show how it can be done. It looks good from what I saw.

SundeepK avatar Feb 03 '16 21:02 SundeepK

@EndzeitBegins Did you get this working? How was your solution?

Fuhrmann avatar Apr 29 '18 04:04 Fuhrmann