Merge pull request #11295 from t895/onlayout-fix

Android: Fix condition where we set grid span too early
This commit is contained in:
JosJuice 2022-11-22 23:20:31 +01:00 committed by GitHub
commit 8ac8d5afb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -75,6 +75,11 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
@Override
public void onGlobalLayout()
{
if (mBinding.getRoot().getMeasuredWidth() == 0)
{
return;
}
int columns = mBinding.getRoot().getMeasuredWidth() /
requireContext().getResources().getDimensionPixelSize(R.dimen.card_width);
if (columns == 0)