kopia lustrzana https://github.com/ryukoposting/Signal-Android
Improve width calculation for span count.
rodzic
a46accfcc0
commit
9af966b030
|
@ -143,8 +143,9 @@ public class EmojiPageView extends RecyclerView implements VariationSelectorList
|
||||||
@Override
|
@Override
|
||||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||||
if (layoutManager instanceof GridLayoutManager) {
|
if (layoutManager instanceof GridLayoutManager) {
|
||||||
|
int viewWidth = w - getPaddingStart() - getPaddingEnd();
|
||||||
int idealWidth = getContext().getResources().getDimensionPixelOffset(R.dimen.emoji_drawer_item_width);
|
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);
|
((GridLayoutManager) layoutManager).setSpanCount(spanCount);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue