Improve width calculation for span count.

fork-5.53.8
Cody Henthorne 2021-07-29 15:57:57 -04:00
rodzic a46accfcc0
commit 9af966b030
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -143,8 +143,9 @@ public class EmojiPageView extends RecyclerView implements VariationSelectorList
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (layoutManager instanceof GridLayoutManager) {
int viewWidth = w - getPaddingStart() - getPaddingEnd();
int idealWidth = getContext().getResources().getDimensionPixelOffset(R.dimen.emoji_drawer_item_width);
int spanCount = Math.max(w / idealWidth, 1);
int spanCount = Math.max(viewWidth / idealWidth, 1);
((GridLayoutManager) layoutManager).setSpanCount(spanCount);
}