When using attributes _tileWidth_ or _tileHeight_, there should be the option to set one dimension and tell the other one to match parent's. Right now, leaving one blank defaults to the default value (44dp), which I don't think is what most of us want.
Reviewing https://github.com/prolificinteractive/material-calendarview/issues/132, I think it's incorrectly closed, since the changes in _1.3_ do not fix OPs original issue.
This is the part of the code that should be changed, in _MaterialCalendarView.onMeasure_
if (this.tileWidth > 0 || this.tileHeight > 0) {
if (this.tileWidth > 0) {
//We have a tileWidth set, we should use that
measureTileWidth = this.tileWidth;
}
if (this.tileHeight > 0) {
//We have a tileHeight set, we should use that
measureTileHeight = this.tileHeight;
}
} else ...
//if you specified width/height, measureTileSize is still -1 here
if (measureTileSize > 0) {
...
} else if (measureTileSize <= 0) {
if (measureTileWidth <= 0) {
//Set width to default if no value were set
measureTileWidth = dpToPx(DEFAULT_TILE_SIZE_DP);
}
if (measureTileHeight <= 0) {
//Set height to default if no value were set
measureTileHeight = dpToPx(DEFAULT_TILE_SIZE_DP);
}
}
I see 3 possible solutions
Solution 1 is the default behaviour I'd expect from a calendar, but I guess breaking changes are to be avoided. Solution 2 will fail to compile for some users, which is good for those that upgrade without looking at the Changelog. Solution 3 is the most complete of the 3.
Maybe there are more options, but these are the ones I came up with.
Would love to see a PR for this
I'm working on this branch https://github.com/Maragues/material-calendarview/tree/tile-match-parent
Let's see if I can make it work
@Maragues Im not sure we need to have a parameter match_parent for tile sizes. Using match_parent on the calendarView itself seems to do the same job.
@quentin41500 Yes, but giving a value to width/height forces the other dimension to 44dp
Fixed in v1.4.2
Most helpful comment
Fixed in v1.4.2