xbmc / Official-Kodi-Remote-iOS

Full-featured remote control for XBMC Media Center. It features library browsing, now playing informations and a direct remote control.
Other
224 stars 104 forks source link

Rework PosterCell and RecentlyAddedCell #1191

Closed wutschel closed 4 days ago

wutschel commented 6 days ago

Description

Simplification of label layout in PosterCell

This PR simplifies the layout of posterLabel and labelImageView by adding both as subviews to posterThumbnail instead of self.contentView. This way calling applyRoundedEdgesView can be removed for both as the new parent view has this applied already.

Activity indicator position for PosterCell and RecentlyAddedCell

Correctly place the activity indicators for collection view. As the cell layout might change after rotation, the center must be updated before starting the animation.

Rework fullscreen grid view

Use pixel exact dimension for the item sizes (based on UIScreen.mainScreen.scale). Use fixed height for posterLabelFullscreen(keeping flexible width) and place it relative to the bottom of the cell.

Bring back blue frame for selected items (step 1)

The blue frame for selected items in collection view now works again when having "rounded edges" disabled. To make this happen, the cell's posterThumbnail is scaled down to unveil selectedBackgroundView again. To compensate for loss of thumb size caused by drawing borders in "rounded edges" mode, borders are not drawn anymore in collection view. This has no visible downside as the background is anyway dark and does not allow see the borders.

Bring back blue frame for selected items (step 2)

Instead of using selectedBackgroundView draw a border for contentView in the newly implemented framework method setSelected: and even follow the "rounded corners" setting. This also allows to increase the size of the thumbnail image views.

Simplify implementation of "rounded corners" for views

Only apply layer.cornerRadius to view, which is expected to give performance improvements and will resolve "purple" warnings by XCode. Also remove support for drawing borders which are not used when having rounded corners disabled.

Manual layout of PosterCell content

The auto-layout of iOS causes erratic changes of cell dimensions when using the collection view's flow layout (use case: enter a library view in grid view, then enter fullscreen view and start/end search). To avoid this, a manual override of the posterThumbnail and posterLabelFullscreen layout is introduced.

Remark: This PR causes some image view sizes to update, which in consequence will force re-building the image cache.

Additional minor changes

Summary for release notes

Maintenance: simplified collection view cell layout (potential performance improvement) Improvement: simplified "rounded corners" for views (potential performance improvement) Bugfix: correct position of activity indicators in grid view Bugfix: bring back blue frame on selected grid view items Bugfix: avoid erratic layout change of labels or thumbnails in grid view