use of com.lqr.emoji.IEmotionExtClickListener in project android-chat by wildfirechat.
the class ConversationInputPanel method init.
public void init(Fragment fragment, InputAwareLayout rootInputAwareLayout) {
LayoutInflater.from(getContext()).inflate(R.layout.conversation_input_panel, this, true);
ButterKnife.bind(this, this);
this.activity = fragment.getActivity();
this.fragment = fragment;
this.rootLinearLayout = rootInputAwareLayout;
this.extension = new ConversationExtension(fragment, this, extViewPager);
sharedPreferences = getContext().getSharedPreferences("sticker", Context.MODE_PRIVATE);
// emotion
emotionLayout.setEmotionAddVisiable(true);
emotionLayout.setEmotionSettingVisiable(true);
// audio record panel
audioRecorderPanel = new AudioRecorderPanel(getContext());
audioRecorderPanel.setRecordListener(new AudioRecorderPanel.OnRecordListener() {
@Override
public void onRecordSuccess(String audioFile, int duration) {
// ๅ้ๆไปถ
File file = new File(audioFile);
if (file.exists()) {
messageViewModel.sendAudioFile(conversation, Uri.parse(audioFile), duration);
}
}
@Override
public void onRecordFail(String reason) {
Toast.makeText(activity, reason, Toast.LENGTH_SHORT).show();
}
@Override
public void onRecordStateChanged(AudioRecorderPanel.RecordState state) {
if (state == AudioRecorderPanel.RecordState.START) {
TypingMessageContent content = new TypingMessageContent(TypingMessageContent.TYPING_VOICE);
messageViewModel.sendMessage(conversation, content);
}
}
});
SharedPreferences sp = fragment.getContext().getSharedPreferences(Config.SP_CONFIG_FILE_NAME, Context.MODE_PRIVATE);
boolean pttEnabled = sp.getBoolean("pttEnabled", true);
if (pttEnabled && PTTClient.checkAddress(ChatManager.Instance().getHost())) {
pttImageView.setVisibility(View.VISIBLE);
pttPanel = new PttPanel(getContext());
}
// emotion
emotionLayout.setEmotionSelectedListener(this);
emotionLayout.setEmotionExtClickListener(new IEmotionExtClickListener() {
@Override
public void onEmotionAddClick(View view) {
Toast.makeText(activity, "add", Toast.LENGTH_SHORT).show();
}
@Override
public void onEmotionSettingClick(View view) {
Toast.makeText(activity, "setting", Toast.LENGTH_SHORT).show();
}
});
messageViewModel = ViewModelProviders.of(fragment).get(MessageViewModel.class);
conversationViewModel = ViewModelProviders.of(fragment).get(ConversationViewModel.class);
}
Aggregations