|
1 | 1 | package com.hyphenate.easeui.feature.chat.widgets |
2 | 2 |
|
| 3 | +import android.app.ProgressDialog.show |
3 | 4 | import android.content.ClipData |
4 | 5 | import android.content.ClipboardManager |
5 | 6 | import android.content.Context |
@@ -39,6 +40,7 @@ import com.hyphenate.easeui.common.ChatThread |
39 | 40 | import com.hyphenate.easeui.common.ChatType |
40 | 41 | import com.hyphenate.easeui.common.bus.ChatUIKitFlowBus |
41 | 42 | import com.hyphenate.easeui.common.enums.ChatUIKitFinishReason |
| 43 | +import com.hyphenate.easeui.common.extensions.hideSoftKeyboard |
42 | 44 | import com.hyphenate.easeui.common.extensions.isSuccess |
43 | 45 | import com.hyphenate.easeui.common.extensions.lifecycleScope |
44 | 46 | import com.hyphenate.easeui.common.extensions.mainScope |
@@ -274,6 +276,8 @@ class ChatUIKitLayout @JvmOverloads constructor( |
274 | 276 | */ |
275 | 277 | private var multipleSelectRemoveMsgListener: OnMultipleSelectRemoveMsgListener? = null |
276 | 278 |
|
| 279 | + private var voiceRecorderDialog:ChatUIKitVoiceRecorderDialog?=null |
| 280 | + |
277 | 281 | private val chatMessageListener = object : ChatUIKitMessageListener() { |
278 | 282 | override fun onMessageReceived(messages: MutableList<ChatMessage>?) { |
279 | 283 | var refresh = false |
@@ -565,7 +569,7 @@ class ChatUIKitLayout @JvmOverloads constructor( |
565 | 569 | } |
566 | 570 |
|
567 | 571 | override fun onToggleVoiceBtnClicked() { |
568 | | - ChatUIKitVoiceRecorderDialog(mContext, conversationId).apply { |
| 572 | + voiceRecorderDialog=ChatUIKitVoiceRecorderDialog(mContext, conversationId).apply { |
569 | 573 | if (mContext is AppCompatActivity) { |
570 | 574 | show(mContext.supportFragmentManager, "ease_chat_voice_recorder_dialog") |
571 | 575 | setOnVoiceRecorderClickListener(object : OnVoiceRecorderClickListener { |
@@ -1364,6 +1368,12 @@ class ChatUIKitLayout @JvmOverloads constructor( |
1364 | 1368 | return chatType?.getConversationType() == ChatConversationType.ChatRoom |
1365 | 1369 | } |
1366 | 1370 |
|
| 1371 | + fun stopRecorder(){ |
| 1372 | + if (voiceRecorderDialog?.recordStatus == ChatUIKitVoiceRecorderDialog.RecordStatus.RECORDING){ |
| 1373 | + voiceRecorderDialog?.toStopRecordStatus() |
| 1374 | + } |
| 1375 | + } |
| 1376 | + |
1367 | 1377 | companion object { |
1368 | 1378 | private val TAG: String = ChatUIKitLayout::class.java.simpleName.toString() |
1369 | 1379 | private const val MSG_TYPING_HEARTBEAT = 0 |
|
0 commit comments