Search in sources :

Example 1 with EaseVoiceRecorderView

use of com.hyphenate.easeui.widget.EaseVoiceRecorderView in project SmartCampus by Vegen.

the class EaseChatFragment method initView.

/**
 * init view
 */
protected void initView() {
    // hold to record voice
    // noinspection ConstantConditions
    voiceRecorderView = (EaseVoiceRecorderView) getView().findViewById(R.id.voice_recorder);
    // message list layout
    messageList = (EaseChatMessageList) getView().findViewById(R.id.message_list);
    if (chatType != EaseConstant.CHATTYPE_SINGLE)
        messageList.setShowUserNick(true);
    // messageList.setAvatarShape(1);
    listView = messageList.getListView();
    extendMenuItemClickListener = new MyItemClickListener();
    inputMenu = (EaseChatInputMenu) getView().findViewById(R.id.input_menu);
    registerExtendMenuItem();
    // init input menu
    inputMenu.init(null);
    inputMenu.setChatInputMenuListener(new ChatInputMenuListener() {

        @Override
        public void onSendMessage(String content) {
            sendTextMessage(content);
        }

        @Override
        public boolean onPressToSpeakBtnTouch(View v, MotionEvent event) {
            return voiceRecorderView.onPressToSpeakBtnTouch(v, event, new EaseVoiceRecorderCallback() {

                @Override
                public void onVoiceRecordComplete(String voiceFilePath, int voiceTimeLength) {
                    sendVoiceMessage(voiceFilePath, voiceTimeLength);
                }
            });
        }

        @Override
        public void onBigExpressionClicked(EaseEmojicon emojicon) {
            sendBigExpressionMessage(emojicon.getName(), emojicon.getIdentityCode());
        }
    });
    swipeRefreshLayout = messageList.getSwipeRefreshLayout();
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light, R.color.holo_orange_light, R.color.holo_red_light);
    inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    if (isRoaming) {
        fetchQueue = Executors.newSingleThreadExecutor();
    }
}
Also used : EaseVoiceRecorderCallback(com.hyphenate.easeui.widget.EaseVoiceRecorderView.EaseVoiceRecorderCallback) EaseEmojicon(com.hyphenate.easeui.domain.EaseEmojicon) ChatInputMenuListener(com.hyphenate.easeui.widget.EaseChatInputMenu.ChatInputMenuListener) View(android.view.View) ListView(android.widget.ListView) EaseVoiceRecorderView(com.hyphenate.easeui.widget.EaseVoiceRecorderView) MotionEvent(android.view.MotionEvent)

Aggregations

MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 ListView (android.widget.ListView)1 EaseEmojicon (com.hyphenate.easeui.domain.EaseEmojicon)1 ChatInputMenuListener (com.hyphenate.easeui.widget.EaseChatInputMenu.ChatInputMenuListener)1 EaseVoiceRecorderView (com.hyphenate.easeui.widget.EaseVoiceRecorderView)1 EaseVoiceRecorderCallback (com.hyphenate.easeui.widget.EaseVoiceRecorderView.EaseVoiceRecorderCallback)1