use of org.thoughtcrime.securesms.components.emoji.EmojiPageViewGridAdapter.EmojiHeader in project Signal-Android by signalapp.
the class EmojiPageView method initialize.
public void initialize(@NonNull EmojiEventListener emojiSelectionListener, @NonNull VariationSelectorListener variationSelectorListener, boolean allowVariations, @NonNull LinearLayoutManager layoutManager, @LayoutRes int displayEmojiLayoutResId, @LayoutRes int displayEmoticonLayoutResId) {
this.variationSelectorListener = variationSelectorListener;
this.layoutManager = layoutManager;
this.scrollDisabler = new ScrollDisabler();
this.popup = new EmojiVariationSelectorPopup(getContext(), emojiSelectionListener);
this.adapterFactory = () -> new EmojiPageViewGridAdapter(popup, emojiSelectionListener, this, allowVariations, displayEmojiLayoutResId, displayEmoticonLayoutResId);
if (this.layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayout = (GridLayoutManager) this.layoutManager;
gridLayout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (getAdapter() != null) {
Optional<MappingModel<?>> model = getAdapter().getModel(position);
if (model.isPresent() && (model.get() instanceof EmojiHeader || model.get() instanceof EmojiNoResultsModel)) {
return gridLayout.getSpanCount();
}
}
return 1;
}
});
}
setLayoutManager(layoutManager);
Drawable drawable = DrawableUtil.tint(ContextUtil.requireDrawable(getContext(), R.drawable.triangle_bottom_right_corner), ContextCompat.getColor(getContext(), R.color.signal_button_secondary_text_disabled));
addItemDecoration(new EmojiItemDecoration(allowVariations, drawable));
}
use of org.thoughtcrime.securesms.components.emoji.EmojiPageViewGridAdapter.EmojiHeader in project Signal-Android by WhisperSystems.
the class EmojiPageView method initialize.
public void initialize(@NonNull EmojiEventListener emojiSelectionListener, @NonNull VariationSelectorListener variationSelectorListener, boolean allowVariations, @NonNull LinearLayoutManager layoutManager, @LayoutRes int displayEmojiLayoutResId, @LayoutRes int displayEmoticonLayoutResId) {
this.variationSelectorListener = variationSelectorListener;
this.layoutManager = layoutManager;
this.scrollDisabler = new ScrollDisabler();
this.popup = new EmojiVariationSelectorPopup(getContext(), emojiSelectionListener);
this.adapterFactory = () -> new EmojiPageViewGridAdapter(popup, emojiSelectionListener, this, allowVariations, displayEmojiLayoutResId, displayEmoticonLayoutResId);
if (this.layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayout = (GridLayoutManager) this.layoutManager;
gridLayout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (getAdapter() != null) {
Optional<MappingModel<?>> model = getAdapter().getModel(position);
if (model.isPresent() && (model.get() instanceof EmojiHeader || model.get() instanceof EmojiNoResultsModel)) {
return gridLayout.getSpanCount();
}
}
return 1;
}
});
}
setLayoutManager(layoutManager);
Drawable drawable = DrawableUtil.tint(ContextUtil.requireDrawable(getContext(), R.drawable.triangle_bottom_right_corner), ContextCompat.getColor(getContext(), R.color.signal_button_secondary_text_disabled));
addItemDecoration(new EmojiItemDecoration(allowVariations, drawable));
}
Aggregations