The code to display attachements in a grid is one of the most complex parts in Tusky. There are different aspect ratios, blurhashes, focuspoints, ...
I'm currently rewriting it in Compose and it is SHOCKINGLY EASY
The old code to respect the focuspoint alone has 144 lines including comments (it does some Matrix calculation stuff). The new code is 6 lines (it just works natively in Compose, lol)