use of net.iGap.fragments.emoji.SuggestedStickerAdapter in project iGap-Android by KianIranian-STDG.
the class FragmentChat method getStickerByEmoji.
private void getStickerByEmoji(String unicode) {
if (lastChar == null) {
lastChar = unicode;
if (suggestedLayout == null && getContext() != null) {
stickerRepository = StickerRepository.getInstance();
suggestedAdapter = new SuggestedStickerAdapter();
compositeDisposable = new CompositeDisposable();
suggestedLayout = new FrameLayout(getContext());
suggestedRecyclerView = new RecyclerView(getContext());
suggestedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false));
suggestedRecyclerView.setAdapter(suggestedAdapter);
suggestedRecyclerView.setClipToPadding(false);
suggestedRecyclerView.setPadding(LayoutCreator.dp(2), LayoutCreator.dp(3), LayoutCreator.dp(8), LayoutCreator.dp(2));
suggestedAdapter.setListener(structIGSticker -> {
lastChar = null;
suggestedLayout.setVisibility(View.GONE);
suggestedAdapter.clearData();
suggestedRecyclerView.scrollToPosition(0);
if (disposable != null && !disposable.isDisposed())
disposable.dispose();
edtChat.setText("");
sendStickerAsMessage(structIGSticker);
});
suggestedLayout.addView(suggestedRecyclerView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
rootView.addView(suggestedLayout, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (G.isAppRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 6, 8, 6, keyboardViewVisible ? LayoutCreator.pxToDp(keyboardHeight) + 60 : 60));
}
suggestedRecyclerView.setBackground(Theme.getInstance().tintDrawable(getResources().getDrawable(R.drawable.shape_suggested_sticker), rootView.getContext(), R.attr.iGapEditTxtColor));
disposable = stickerRepository.getStickerByEmoji(lastChar).filter(structIGStickers -> structIGStickers.size() > 0 && lastChar != null).subscribe(structIGStickers -> {
suggestedAdapter.setIgStickers(structIGStickers);
suggestedLayout.setVisibility(View.VISIBLE);
});
compositeDisposable.add(disposable);
}
}
use of net.iGap.fragments.emoji.SuggestedStickerAdapter in project iGap-Android by KianIranian-STDG.
the class StoryDisplayFragment method getStickerByEmoji.
private void getStickerByEmoji(String unicode) {
if (lastChar == null) {
lastChar = unicode;
if (suggestedLayout == null && getContext() != null) {
stickerRepository = StickerRepository.getInstance();
suggestedAdapter = new SuggestedStickerAdapter();
compositeDisposable = new CompositeDisposable();
suggestedLayout = new FrameLayout(getContext());
suggestedRecyclerView = new RecyclerView(getContext());
suggestedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false));
suggestedRecyclerView.setAdapter(suggestedAdapter);
suggestedRecyclerView.setClipToPadding(false);
suggestedRecyclerView.setPadding(LayoutCreator.dp(2), LayoutCreator.dp(3), LayoutCreator.dp(8), LayoutCreator.dp(2));
suggestedAdapter.setListener(structIGSticker -> {
lastChar = null;
suggestedLayout.setVisibility(View.GONE);
suggestedAdapter.clearData();
suggestedRecyclerView.scrollToPosition(0);
if (disposable != null && !disposable.isDisposed())
disposable.dispose();
replyEditText.setText("");
sendStickerAsMessage(structIGSticker);
});
suggestedLayout.addView(suggestedRecyclerView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
// rootLayout.addView(suggestedLayout, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (G.isAppRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 6, 8, 6, keyboardViewVisible ? LayoutCreator.pxToDp(keyboardHeight) + 60 : 60));
}
suggestedRecyclerView.setBackground(Theme.getInstance().tintDrawable(getResources().getDrawable(R.drawable.shape_suggested_sticker), getContext(), R.attr.iGapEditTxtColor));
disposable = stickerRepository.getStickerByEmoji(lastChar).filter(structIGStickers -> structIGStickers.size() > 0 && lastChar != null).subscribe(structIGStickers -> {
suggestedAdapter.setIgStickers(structIGStickers);
suggestedLayout.setVisibility(View.VISIBLE);
});
compositeDisposable.add(disposable);
}
}
Aggregations