Fix: Include video and audio files in adaptive layout check#18322
Fix: Include video and audio files in adaptive layout check#18322Josh65-2201 wants to merge 2 commits intofiles-community:mainfrom
Conversation
| if (folderPercentage + miscPercentage > LargeThreshold) | ||
| return Layouts.Detail; | ||
| if (imagePercentage > ExtraLargeThreshold) | ||
| if (imagePercentage > ExtraLargeThreshold || mediaPercentage > ExtraLargeThreshold) |
There was a problem hiding this comment.
The if statement should also make sure folderPercentage + miscPercentage > LargeThreshold is false. Otherwise, it will incorrectly switch to grid mode.
There was a problem hiding this comment.
As far as I can tell it checks how many folder and none media items there is compared to media/images, If that was above large threshold (>80%) then imagePercentage and mediaPercentage would be less than 20% combined and wouldn't pass ExtraLargeThreshold (>85%) anyway as it's already making a percentage based on how many total items there are in the folder.
There was a problem hiding this comment.
You’re right.
One other thing, previously, when the image percentage was between 60% and 75%, the layout switched to Grid. It seems odd to me then that 75% to 85% would use Details, it would make more sense if we simply used Grid for anything above 60%.
There was a problem hiding this comment.
ExtraLargeThreshold (85%) is what main currently uses, Do you want it changed to medium (I think that 60%)?
There was a problem hiding this comment.
I think that makes more sense, I'm just curious why the original behavior excluded 75% - 85%.
There was a problem hiding this comment.
Probably because it default was grid so it worked as intended in use
Resolved / Related Issues
To prevent extra work, all changes to the Files codebase must link to an approved issue marked as
Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.
Added .ogg (.oga is the same format just different file extension) to the isAudio check. Was only in the isVideo check and as it can have video in it (although rarely) I have kept it there.
Note that the existing isMedia checks audio and video files in a folder. Since audio can have album art for the thumbnail I believe it's fine to have them also use grid layout