-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add dynamic height options #24
Add dynamic height options #24
Conversation
Could you elaborate on the effects that your changes have? All I can observe is the increased height of all-day event chips. |
The first commit (e3a9765) has no visual impact. It's just an harmonization of the use of headerHeight to facilitate the positionning. It has also some minor corrections like the size of the all day event chip which was not using the existing parameter The third commit(ac772f0) just increase the precision of the postionning of hour separator has it was needed for the option. The new option |
335ee95
to
a979def
Compare
i added a fix for the position of the day label (5a88afe) and a new parameter headerMarginBottom. |
@@ -39,6 +39,7 @@ | |||
int headerRowBackgroundColor = Color.WHITE; | |||
int headerRowPadding = 10; | |||
int todayHeaderTextColor = Color.rgb(39, 137, 228); | |||
int headerMarginBottom = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, headerRowPadding
is used to determine the padding below the all-day event chips. By introducing this new attribute, we make yet another breaking change for users of this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's a breaking change. The thing is that actually, the header is not well computed, i mean the user can't have a control to change the 3 spaces available correctly.
For example, the headerMarginBottom
actually couldn't be controlled, i just added the possibility to the user to change it.
How would you want to compute the header spaces ? i'll think about how to change it without impact or less impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover, the day label was not well placed and there will be impact on existing project. So what do you think is the best ?
Edit : The vertical position of the day label is computed as this :
val y = drawingConfig.headerTextHeight + config.headerRowPadding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s a lot happening in this pull request already, so I think it’d be best to leave it as it is for now. Feel free to pick up the topic in a separate pull request, if you like.
headerHeight += config.headerRowBottomLineWidth; | ||
} | ||
if (hasEventInHeader) { | ||
headerHeight += config.allDayEventHeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking back to my refactoring, allDayEventHeight
is something that I wanted to deprecate, but forgot to do. The reason is that while the event chip might become taller, the event text size stays the same, resulting in a waste of space (just take a look at the screenshot you posted above).
There are a couple options for how to continue:
- Continue to calculate the chip height based on the text size and officially deprecate
allDayEventHeight
. - Adjust the text size of all-day events to fit the height of the chip (
allDayEventHeight
). - Introduce an
allDayEventTextSize
, which is applied to all-day event chips. If not specified, it would fall back to theeventTextSize
, so it would not be a breaking change.
What’s your take on this, @Bwaim?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your propositions 1 and 3 are good. As you said, we should try to reduce the header size to the minimum.
Added to the deprecation of allDayEventHeight
, maybe we could add a new parameter maxAllDayEventHeight
to prevent the chip to be too big. What do you think about it ?
I think the proposition 2 is not good because if the event label is very long, we will have a problem to decide the text size to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s try idea 3. It gives the most control and wouldn’t change anything for users of this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In last commit, i implemented your propositions 1 and 3, do you prefer i just let proposition 3 and revert the deprecation of allDayEventHeight
? Should i remove the maxAllDayEventHeight
parameter i added ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think maxAllDayEventHeight
is necessary – the height of the chip will be determined by allDayEventTextSize
. You can remove the former.
The deprecation of allDayEventHeight
is fine.
3a67798
to
52cad28
Compare
I commited a new version taking into account the remarks.
|
52cad28
to
c63d1cd
Compare
- Write the day label correctly, using the baseline - Use the allDayEventHeight parameter for the size of all day event chip - Correct computation of the day label height
- Fix the bug of the all day event chip displayed in the upper left corner - Rename the parameter dynamicHourHeight to showCompleteDay - Rename the example to "Basic Example (showing complete day)" - Correct the indentation of activity_constraint.xml
I commited a new version taking into account the remark concerning the use of |
- Remove the parameter allDayEventHeight - Add a parameter allDayEventTextSize - Add a parameter maxAllDayEventHeight - Calculate the chip height based on the text size and maxAllDayEventHeight
@Bwaim Sorry for the delay. I’m having exams soon, so I’m not sure when I’ll find the time. But I won’t forget about your two pull requests 😉 |
@thellmund No problem, exams first, good luck ! |
@Bwaim Looked at your latest changes as a bit of studying procrastination 😉I noticed two small issues:
Besides that, the rest seems fine. Just these two things, and then we can merge this thing 👌 |
@Bwaim Nevermind, I will merge this commit and resolve the issues 😊 |
@thellmund As explained in my comment of the 10 January, the padding below all-day event chips is now controlled with the parameter |
This PR contains :
I could adapt it if you accept previous PR as it has cross impact