Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9872365d authored by abdullahirum's avatar abdullahirum
Browse files

Fix for unresponsive color picker collection

The recycler view which houses the color picker options has a height of zero at times.
This was the reason why it became unresponsive.
An invisible view was used to force the height of the recycler view to be stable
 (the recycler view contents are loaded dynamicall)
 but it seems this doesnt work all the time.
This diff removes the invisible view and simply uses the actual height of the recycler view
(which is static)

problem: https://drive.google.com/file/d/1NTrRR09fU1AqZnq2sYitdrxbdEXqhhi2/view?usp=share_link&resourcekey=0-uQqWi7zwJSXxVJxRHTDT6A
fix: https://drive.google.com/file/d/1_DnCowkeJlMP9LEr7XnSr3OgBMqgfvVQ/view?usp=share_link&resourcekey=0-7LbnFBeexZxLheOEjI7hOg

UPDATE:
The above solution (hard coding the recycler view's height) did not work. This is because the recycler view's height is not static
as was wrongly assumed initially. The heigh may change if the system font is increased or decreased. I also verified by changing the
system font size and saw that the text in the reccler view would get cut off.

I reverted back to setting the RV's height to wrap_content and setting a minimum height as the smallest system font size.
This should have theoreticall worked but it didn't. Sometimes the RV would size itself correctly and sometimes it would not (i.e.
the size would default to the minimum set height instead). This seems to be a bug in the RV we are using. I removed all the views
from the screen except the RV and encountered the same behaviour (i.e. the height getting incorrectl set sometimes). So this ruled
out the possibility that other views ma be affecting the RVs height. I tried other things suggested in stack overflow such as using
a relative layout instead of LinearLayout but no luck. So i'm pretty sure there is some issue with RV not respecting wrap_content
when there is a TextView as its child. Others have reported this issue on SO.

The only solution that i found that works robustly was entirely replacing the RV with a LinearLayout. The LinearLaout sizes itself correctly
everytime and respects its children TextView's dynamic height. Since there are only about 10 colors to choose from, using
a LinearLayout should not affect perfmance.

fix with Linear layout:
 https://drive.google.com/file/d/1n4vp-X7YskAJLi7LvDdWqntB4YM8u1JA/view?usp=share_link&resourcekey=0-D9HolXVoW52_-0a5JyXjOw

Bug: 276005686
Test: manual
Change-Id: If387f1805fb694549b6941b83c56611a3accb172
parent f55aa8af
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment