egeniq / android-tv-program-guide

Android TV Program Guide
Apache License 2.0
164 stars 66 forks source link

Facing issue related timeline dimen #25

Closed duongtainhan closed 3 years ago

duongtainhan commented 3 years ago

Hello, Thanks for this amazing library. I want to change the distance between hours. I am facing the issue when changing "programguide_table_width_per_hour" in dimen values from 300dp to 80dp. I find that progress of some programs is not working properly with current time. Can you guys tell me how can I fix this issue? Thanks & Regards. screen

dzolnai commented 3 years ago

Hi! I tried to reproduce it myself, but for me it works correctly. Did you make any other changes beside reducing the dimension value to 80dp? Did you test this on an emulator or real device? What Android version does this happen on?

duongtainhan commented 3 years ago
dzolnai commented 3 years ago

Thanks I can reproduce it, and will work on a fix.

dzolnai commented 3 years ago

I have found the issue: if the program is too short, it will have a negative width, and that will mess up the entire row. You can work around this by having a smaller programguide_item_spacing, and of course, by not having programs which are too short. The width is calculated by multiplying the length of the program with the programguide_table_width_per_hour dimension, and then subtracting the spacing value twice. This has to be at least 1 px wide. If your programguide_table_width_per_hour is 80dp, and you keep spacing on 2dp, your programme's need to be a bit more longer than 3 minutes. If you reduce spacing to 1dp, then that is reduced to 1.5 minutes. Of course, having a larger programguide_table_width_per_hour solves this as well. I have pushed a fix that adds a mitigation for this. But I still recommend reducing at least the spacing a bit, because the fix does not fully fix it, there will be a very small misalignment because now the numbers won't add up.

duongtainhan commented 3 years ago

Thank you very much for the useful information. I will change programguide_item_spacing and programguide_table_width_per_hour appropriately so that no bug can occur. There is a dimension value I still do not understand is programguide_minimum_item_width_sticking_out_behind_channel_column. Which view size will change when I change that dimension value?

dzolnai commented 3 years ago

The dimension programguide_minimum_item_width_sticking_out_behind_channel_column is not one which is used to size widgets. Instead, it is used on the focus search when the entire grid receives focus. That means, it will do a lookup based in the top row, and find the best program to highlight. Usually this would be the leftmost one, but there are some edge cases where the one on the left is almost out of view, just a few pixels (or maybe 20-30pixels) are visible. Also the programmes are there overlapped by the channel list, it would not be very useful if we would highlight one behind the channel list. So that dimension tells the list that how many pixels a programme needs to stick out under the channel list to the right, so that it can be selected. If the programme below the channel list does not have that many pixels, the one to the right of it will be selected.

duongtainhan commented 3 years ago

Thank You for Help and Support. I appreciate your help.