diff --git a/Android/chatinput/build.gradle b/Android/chatinput/build.gradle index e7f45876..dd5985f5 100644 --- a/Android/chatinput/build.gradle +++ b/Android/chatinput/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.library' ext { PUBLISH_GROUP_ID = 'cn.jiguang.imui' PUBLISH_ARTIFACT_ID = 'chatinput' - PUBLISH_VERSION = '0.7.3' + PUBLISH_VERSION = '0.7.4' } android { diff --git a/Android/chatinput/src/main/java/cn/jiguang/imui/chatinput/ChatInputView.java b/Android/chatinput/src/main/java/cn/jiguang/imui/chatinput/ChatInputView.java index 8387ba4b..a5b76ef7 100644 --- a/Android/chatinput/src/main/java/cn/jiguang/imui/chatinput/ChatInputView.java +++ b/Android/chatinput/src/main/java/cn/jiguang/imui/chatinput/ChatInputView.java @@ -573,7 +573,9 @@ public void onClick(View view) { } else if (view.getId() == R.id.aurora_ib_camera_record_video) { // click record video button // if it is not record video mode - mCameraControllerListener.onSwitchCameraModeClick(!mIsRecordVideoMode); + if (mCameraControllerListener != null) { + mCameraControllerListener.onSwitchCameraModeClick(!mIsRecordVideoMode); + } if (!mIsRecordVideoMode) { mIsRecordVideoMode = true; mCaptureBtn.setBackgroundResource(R.drawable.aurora_preview_record_video_start); @@ -621,15 +623,15 @@ public void run() { } // if finished recording video, send it } else if (mFinishRecordingVideo) { - if (mListener != null) { + if (mListener != null && mVideoFilePath != null) { File file = new File(mVideoFilePath); VideoItem video = new VideoItem(mVideoFilePath, file.getName(), file.length() + "", System.currentTimeMillis() + "", mMediaPlayer.getDuration() / 1000); List list = new ArrayList<>(); list.add(video); mListener.onSendFiles(list); - mFinishRecordingVideo = false; mVideoFilePath = null; } + mFinishRecordingVideo = false; mMediaPlayer.stop(); mMediaPlayer.release(); recoverScreen(); @@ -640,7 +642,9 @@ public void run() { } } else if (view.getId() == R.id.aurora_ib_camera_close) { try { - mCameraControllerListener.onCloseCameraClick(); + if (mCameraControllerListener != null) { + mCameraControllerListener.onCloseCameraClick(); + } mMediaPlayer.stop(); mMediaPlayer.release(); if (mCameraSupport != null) { diff --git a/ReactNative/android/build.gradle b/ReactNative/android/build.gradle index be87e1cd..989ffc40 100644 --- a/ReactNative/android/build.gradle +++ b/ReactNative/android/build.gradle @@ -28,7 +28,7 @@ dependencies { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'cn.jiguang.imui:messagelist:0.6.8' - compile 'cn.jiguang.imui:chatinput:0.7.3' + compile 'cn.jiguang.imui:chatinput:0.7.4' compile 'pub.devrel:easypermissions:0.4.0' compile 'org.greenrobot:eventbus:3.0.0' implementation 'com.android.support:appcompat-v7:27.1.0' diff --git a/ReactNative/android/src/main/java/cn/jiguang/imui/messagelist/viewmanager/ReactChatInputManager.java b/ReactNative/android/src/main/java/cn/jiguang/imui/messagelist/viewmanager/ReactChatInputManager.java index 53d810a5..30b7ca04 100644 --- a/ReactNative/android/src/main/java/cn/jiguang/imui/messagelist/viewmanager/ReactChatInputManager.java +++ b/ReactNative/android/src/main/java/cn/jiguang/imui/messagelist/viewmanager/ReactChatInputManager.java @@ -262,10 +262,15 @@ public boolean switchToMicrophoneMode() { mShowMenu = true; mChatInput.setPendingShowMenu(true); EmoticonsKeyboardUtils.closeSoftKeyboard(editText); - mChatInput.showMenuLayout(); - mChatInput.showRecordVoiceLayout(); - sendSizeChangedEvent(calculateMenuHeight()); - mChatInput.requestLayout(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mChatInput.showMenuLayout(); + mChatInput.showRecordVoiceLayout(); + sendSizeChangedEvent(calculateMenuHeight()); + } + }, 100); + } mLastClickId = 0; return false; @@ -293,10 +298,16 @@ public boolean switchToGalleryMode() { mShowMenu = true; mChatInput.setPendingShowMenu(true); EmoticonsKeyboardUtils.closeSoftKeyboard(editText); - sendSizeChangedEvent(calculateMenuHeight()); - mChatInput.showMenuLayout(); - mChatInput.showSelectPhotoLayout(); - mChatInput.requestLayout(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + sendSizeChangedEvent(calculateMenuHeight()); + mChatInput.showMenuLayout(); + mChatInput.showSelectPhotoLayout(); + mChatInput.requestLayout(); + } + }, 100); + } mLastClickId = 1; return false; @@ -327,10 +338,16 @@ public boolean switchToCameraMode() { mChatInput.setPendingShowMenu(true); mChatInput.initCamera(); EmoticonsKeyboardUtils.closeSoftKeyboard(editText); - mChatInput.showMenuLayout(); - mChatInput.showCameraLayout(); - sendSizeChangedEvent(calculateMenuHeight()); - mChatInput.requestLayout(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mChatInput.showMenuLayout(); + mChatInput.showCameraLayout(); + sendSizeChangedEvent(calculateMenuHeight()); + mChatInput.requestLayout(); + } + }, 100); + } mLastClickId = 2; return false; @@ -349,10 +366,15 @@ public boolean switchToEmojiMode() { mShowMenu = true; mChatInput.setPendingShowMenu(true); EmoticonsKeyboardUtils.closeSoftKeyboard(editText); - mChatInput.showMenuLayout(); - mChatInput.showEmojiLayout(); - sendSizeChangedEvent(calculateMenuHeight()); - mChatInput.requestLayout(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mChatInput.showMenuLayout(); + mChatInput.showEmojiLayout(); + sendSizeChangedEvent(calculateMenuHeight()); + mChatInput.requestLayout(); + } + }, 100); } mLastClickId = 3; return false; diff --git a/package.json b/package.json index 73fb74e3..5aec7de5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurora-imui-react-native", - "version": "0.9.25", + "version": "0.9.26", "description": "aurora imui plugin for react native application", "main": "index.js",