use of net.iGap.fragments.emoji.remove.StickerSettingFragment in project iGap-Android by KianIranian-STDG.
the class FragmentChat method createKeyboardView.
private void createKeyboardView() {
if (getContext() != null) {
keyboardView = new KeyboardView(getContext(), new KeyboardView.Listener() {
@Override
public void onViewCreated(int mode) {
}
@Override
public void onStickerSettingClicked() {
if (getActivity() != null) {
showPopup(-1);
new HelperFragment(getActivity().getSupportFragmentManager(), new StickerSettingFragment()).setReplace(false).load();
}
}
@Override
public void onBackSpace() {
if (edtChat.length() == 0) {
return;
}
edtChat.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
}
@Override
public void onSendStickerAsMessage(StructIGSticker structIGSticker) {
sendStickerAsMessage(structIGSticker);
}
@Override
public void onAddStickerClicked() {
if (getActivity() != null) {
showPopup(-1);
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentSettingAddStickers.newInstance("ALL")).setReplace(false).load();
}
}
@Override
public void onEmojiSelected(String unicode) {
int i = edtChat.getSelectionEnd();
if (i < 0)
i = 0;
try {
CharSequence sequence = EmojiManager.getInstance().replaceEmoji(unicode, edtChat.getPaint().getFontMetricsInt(), LayoutCreator.dp(22), false);
if (edtChat.getText() != null)
edtChat.setText(edtChat.getText().insert(i, sequence));
int j = i + sequence.length();
edtChat.setSelection(j, j);
} catch (Exception e) {
e.printStackTrace();
}
if (EmojiManager.getInstance().isValidEmoji(unicode) && edtChat.getText().toString().equals(unicode)) {
getStickerByEmoji(unicode);
} else if (edtChat.getText() != null && !edtChat.getText().toString().equals("")) {
if (suggestedLayout != null && suggestedLayout.getVisibility() == View.VISIBLE) {
suggestedLayout.setVisibility(View.GONE);
lastChar = null;
}
}
}
}, KeyboardView.MODE_KEYBOARD, true);
keyboardView.setVisibility(View.GONE);
if (mustCheckPermission())
keyboardView.setStickerPermission(currentRoomAccess != null && currentRoomAccess.getRealmPostMessageRights() != null && currentRoomAccess.getRealmPostMessageRights().isCanSendSticker());
keyboardContainer.addView(keyboardView);
}
}
use of net.iGap.fragments.emoji.remove.StickerSettingFragment in project iGap-Android by KianIranian-STDG.
the class StoryDisplayFragment method createKeyboardView.
private void createKeyboardView() {
if (getContext() != null) {
keyboardView = new KeyboardView(getContext(), new KeyboardView.Listener() {
@Override
public void onViewCreated(int mode) {
}
@Override
public void onStickerSettingClicked() {
if (getActivity() != null) {
showPopup(-1);
new HelperFragment(getActivity().getSupportFragmentManager(), new StickerSettingFragment()).setReplace(false).load();
}
}
@Override
public void onBackSpace() {
if (replyEditText.length() == 0) {
return;
}
replyEditText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
}
@Override
public void onSendStickerAsMessage(StructIGSticker structIGSticker) {
sendStickerAsMessage(structIGSticker);
}
@Override
public void onAddStickerClicked() {
if (getActivity() != null) {
showPopup(-1);
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentSettingAddStickers.newInstance("ALL")).setReplace(false).load();
}
}
@Override
public void onEmojiSelected(String unicode) {
int i = replyEditText.getSelectionEnd();
if (i < 0)
i = 0;
try {
CharSequence sequence = EmojiManager.getInstance().replaceEmoji(unicode, replyEditText.getPaint().getFontMetricsInt(), LayoutCreator.dp(22), false);
if (replyEditText.getText() != null)
replyEditText.setText(replyEditText.getText().insert(i, sequence));
int j = i + sequence.length();
replyEditText.setSelection(j, j);
} catch (Exception e) {
e.printStackTrace();
}
if (EmojiManager.getInstance().isValidEmoji(unicode) && replyEditText.getText().toString().equals(unicode)) {
getStickerByEmoji(unicode);
} else if (replyEditText.getText() != null && !replyEditText.getText().toString().equals("")) {
if (suggestedLayout != null && suggestedLayout.getVisibility() == View.VISIBLE) {
suggestedLayout.setVisibility(View.GONE);
lastChar = null;
}
}
}
}, KeyboardView.MODE_KEYBOARD, false);
keyboardView.setVisibility(View.GONE);
// if (mustCheckPermission())
// keyboardView.setStickerPermission(currentRoomAccess != null && currentRoomAccess.getRealmPostMessageRights() != null && currentRoomAccess.getRealmPostMessageRights().isCanSendSticker());
keyboardContainer.addView(keyboardView);
}
}
Aggregations