|
@@ -82,7 +82,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
protected View actionPanelBottomLayout; // 更多布局
|
|
protected View actionPanelBottomLayout; // 更多布局
|
|
|
protected LinearLayout messageActivityBottomLayout;
|
|
protected LinearLayout messageActivityBottomLayout;
|
|
|
protected EditText messageEditText;// 文本消息编辑框
|
|
protected EditText messageEditText;// 文本消息编辑框
|
|
|
- protected Button audioRecordBtn; // 录音按钮
|
|
|
|
|
|
|
+ //protected Button audioRecordBtn; // 录音按钮
|
|
|
protected View audioAnimLayout; // 录音动画布局
|
|
protected View audioAnimLayout; // 录音动画布局
|
|
|
protected FrameLayout textAudioSwitchLayout; // 切换文本,语音按钮布局
|
|
protected FrameLayout textAudioSwitchLayout; // 切换文本,语音按钮布局
|
|
|
protected View switchToTextButtonInInputBar;// 文本消息选择按钮
|
|
protected View switchToTextButtonInInputBar;// 文本消息选择按钮
|
|
@@ -141,6 +141,11 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
this(container, view, actions, true);
|
|
this(container, view, actions, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public void setSendGiftEnable(boolean enable){
|
|
|
|
|
+ if (enable)sendGiftBtn.setVisibility(View.VISIBLE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void onPause() {
|
|
public void onPause() {
|
|
|
// 停止录音
|
|
// 停止录音
|
|
|
if (audioMessageHelper != null) {
|
|
if (audioMessageHelper != null) {
|
|
@@ -177,7 +182,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
initViews();
|
|
initViews();
|
|
|
initInputBarListener();
|
|
initInputBarListener();
|
|
|
initTextEdit();
|
|
initTextEdit();
|
|
|
- initAudioRecordButton();
|
|
|
|
|
|
|
+ //initAudioRecordButton();
|
|
|
restoreText(false);
|
|
restoreText(false);
|
|
|
setAitListener(true);
|
|
setAitListener(true);
|
|
|
|
|
|
|
@@ -208,6 +213,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
sendEmojiBtn = view.findViewById(R.id.chat_bottom_bar_05);
|
|
sendEmojiBtn = view.findViewById(R.id.chat_bottom_bar_05);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//Gift Panel
|
|
//Gift Panel
|
|
|
giftPanel = (GiftPanel) view.findViewById(R.id.gift_panel);
|
|
giftPanel = (GiftPanel) view.findViewById(R.id.gift_panel);
|
|
|
giftPanel.setContainer(container);
|
|
giftPanel.setContainer(container);
|
|
@@ -217,14 +224,14 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout);
|
|
messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout);
|
|
|
messageInputBar = view.findViewById(R.id.textMessageLayout);
|
|
messageInputBar = view.findViewById(R.id.textMessageLayout);
|
|
|
switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage);
|
|
switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage);
|
|
|
- switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage);
|
|
|
|
|
|
|
+// switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage);
|
|
|
moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText);
|
|
moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText);
|
|
|
emojiButtonInInputBar = view.findViewById(R.id.emoji_button);
|
|
emojiButtonInInputBar = view.findViewById(R.id.emoji_button);
|
|
|
sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage);
|
|
sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage);
|
|
|
messageEditText = (EditText) view.findViewById(R.id.editTextMessage);
|
|
messageEditText = (EditText) view.findViewById(R.id.editTextMessage);
|
|
|
|
|
|
|
|
// 语音
|
|
// 语音
|
|
|
- audioRecordBtn = (Button) view.findViewById(R.id.audioRecord);
|
|
|
|
|
|
|
+ //audioRecordBtn = (Button) view.findViewById(R.id.audioRecord);
|
|
|
audioAnimLayout = view.findViewById(R.id.layoutPlayAudio);
|
|
audioAnimLayout = view.findViewById(R.id.layoutPlayAudio);
|
|
|
time = (Chronometer) view.findViewById(R.id.timer);
|
|
time = (Chronometer) view.findViewById(R.id.timer);
|
|
|
timerTip = (TextView) view.findViewById(R.id.timer_tip);
|
|
timerTip = (TextView) view.findViewById(R.id.timer_tip);
|
|
@@ -235,7 +242,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
|
|
|
|
|
// 显示录音按钮
|
|
// 显示录音按钮
|
|
|
switchToTextButtonInInputBar.setVisibility(View.GONE);
|
|
switchToTextButtonInInputBar.setVisibility(View.GONE);
|
|
|
- switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
+// switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
// 文本录音按钮切换布局
|
|
// 文本录音按钮切换布局
|
|
|
textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout);
|
|
textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout);
|
|
@@ -248,7 +255,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
|
|
|
|
|
private void initInputBarListener() {
|
|
private void initInputBarListener() {
|
|
|
switchToTextButtonInInputBar.setOnClickListener(clickListener);
|
|
switchToTextButtonInInputBar.setOnClickListener(clickListener);
|
|
|
- switchToAudioButtonInInputBar.setOnClickListener(clickListener);
|
|
|
|
|
|
|
+// switchToAudioButtonInInputBar.setOnClickListener(clickListener);
|
|
|
emojiButtonInInputBar.setOnClickListener(clickListener);
|
|
emojiButtonInInputBar.setOnClickListener(clickListener);
|
|
|
sendMessageButtonInInputBar.setOnClickListener(clickListener);
|
|
sendMessageButtonInInputBar.setOnClickListener(clickListener);
|
|
|
moreFuntionButtonInInputBar.setOnClickListener(clickListener);
|
|
moreFuntionButtonInInputBar.setOnClickListener(clickListener);
|
|
@@ -432,10 +439,10 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
hideEmojiLayout();
|
|
hideEmojiLayout();
|
|
|
hideActionPanelLayout();
|
|
hideActionPanelLayout();
|
|
|
|
|
|
|
|
- audioRecordBtn.setVisibility(View.GONE);
|
|
|
|
|
|
|
+ //audioRecordBtn.setVisibility(View.GONE);
|
|
|
messageEditText.setVisibility(View.VISIBLE);
|
|
messageEditText.setVisibility(View.VISIBLE);
|
|
|
switchToTextButtonInInputBar.setVisibility(View.GONE);
|
|
switchToTextButtonInInputBar.setVisibility(View.GONE);
|
|
|
- switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
+// switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
messageInputBar.setVisibility(View.VISIBLE);
|
|
messageInputBar.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
@@ -463,7 +470,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
// 切换成音频,收起键盘,按钮切换成键盘
|
|
// 切换成音频,收起键盘,按钮切换成键盘
|
|
|
private void switchToAudioLayout() {
|
|
private void switchToAudioLayout() {
|
|
|
messageEditText.setVisibility(View.GONE);
|
|
messageEditText.setVisibility(View.GONE);
|
|
|
- audioRecordBtn.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
+ //audioRecordBtn.setVisibility(View.VISIBLE);
|
|
|
hideInputMethod();
|
|
hideInputMethod();
|
|
|
hideEmojiLayout();
|
|
hideEmojiLayout();
|
|
|
hideActionPanelLayout();
|
|
hideActionPanelLayout();
|
|
@@ -534,7 +541,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
|
|
|
|
|
// 隐藏语音布局
|
|
// 隐藏语音布局
|
|
|
private void hideAudioLayout() {
|
|
private void hideAudioLayout() {
|
|
|
- audioRecordBtn.setVisibility(View.GONE);
|
|
|
|
|
|
|
+ //audioRecordBtn.setVisibility(View.GONE);
|
|
|
messageEditText.setVisibility(View.VISIBLE);
|
|
messageEditText.setVisibility(View.VISIBLE);
|
|
|
switchToTextButtonInInputBar.setVisibility(View.VISIBLE);
|
|
switchToTextButtonInInputBar.setVisibility(View.VISIBLE);
|
|
|
switchToAudioButtonInInputBar.setVisibility(View.GONE);
|
|
switchToAudioButtonInInputBar.setVisibility(View.GONE);
|
|
@@ -544,7 +551,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
private void showEmojiLayout() {
|
|
private void showEmojiLayout() {
|
|
|
hideInputMethod();
|
|
hideInputMethod();
|
|
|
hideActionPanelLayout();
|
|
hideActionPanelLayout();
|
|
|
- hideAudioLayout();
|
|
|
|
|
|
|
+ //hideAudioLayout();
|
|
|
|
|
|
|
|
messageEditText.requestFocus();
|
|
messageEditText.requestFocus();
|
|
|
uiHandler.postDelayed(showEmojiRunnable, 200);
|
|
uiHandler.postDelayed(showEmojiRunnable, 200);
|
|
@@ -717,28 +724,28 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
/**
|
|
/**
|
|
|
* ****************************** 语音 ***********************************
|
|
* ****************************** 语音 ***********************************
|
|
|
*/
|
|
*/
|
|
|
- private void initAudioRecordButton() {
|
|
|
|
|
- audioRecordBtn.setOnTouchListener(new View.OnTouchListener() {
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public boolean onTouch(View v, MotionEvent event) {
|
|
|
|
|
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
|
|
- touched = true;
|
|
|
|
|
- initAudioRecord();
|
|
|
|
|
- onStartAudioRecord();
|
|
|
|
|
- } else if (event.getAction() == MotionEvent.ACTION_CANCEL
|
|
|
|
|
- || event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
|
- touched = false;
|
|
|
|
|
- onEndAudioRecord(isCancelled(v, event));
|
|
|
|
|
- } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
|
|
|
|
- touched = true;
|
|
|
|
|
- cancelAudioRecord(isCancelled(v, event));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// private void initAudioRecordButton() {
|
|
|
|
|
+// audioRecordBtn.setOnTouchListener(new View.OnTouchListener() {
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public boolean onTouch(View v, MotionEvent event) {
|
|
|
|
|
+// if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
|
|
+// touched = true;
|
|
|
|
|
+// initAudioRecord();
|
|
|
|
|
+// onStartAudioRecord();
|
|
|
|
|
+// } else if (event.getAction() == MotionEvent.ACTION_CANCEL
|
|
|
|
|
+// || event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
|
+// touched = false;
|
|
|
|
|
+// onEndAudioRecord(isCancelled(v, event));
|
|
|
|
|
+// } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
|
|
|
|
+// touched = true;
|
|
|
|
|
+// cancelAudioRecord(isCancelled(v, event));
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// return false;
|
|
|
|
|
+// }
|
|
|
|
|
+// });
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
// 上滑取消录音判断
|
|
// 上滑取消录音判断
|
|
|
private static boolean isCancelled(View view, MotionEvent event) {
|
|
private static boolean isCancelled(View view, MotionEvent event) {
|
|
@@ -782,8 +789,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
container.activity.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
container.activity.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
|
|
|
|
|
|
audioMessageHelper.completeRecord(cancel);
|
|
audioMessageHelper.completeRecord(cancel);
|
|
|
- audioRecordBtn.setText(R.string.record_audio);
|
|
|
|
|
- audioRecordBtn.setBackgroundResource(R.drawable.nim_message_input_edittext_box);
|
|
|
|
|
|
|
+ //audioRecordBtn.setText(R.string.record_audio);
|
|
|
|
|
+ //audioRecordBtn.setBackgroundResource(R.drawable.nim_message_input_edittext_box);
|
|
|
stopAudioRecordAnim();
|
|
stopAudioRecordAnim();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -852,8 +859,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- audioRecordBtn.setText(R.string.record_audio_end);
|
|
|
|
|
- audioRecordBtn.setBackgroundResource(R.drawable.nim_message_input_edittext_box_pressed);
|
|
|
|
|
|
|
+ //audioRecordBtn.setText(R.string.record_audio_end);
|
|
|
|
|
+ //audioRecordBtn.setBackgroundResource(R.drawable.nim_message_input_edittext_box_pressed);
|
|
|
|
|
|
|
|
updateTimerTip(false); // 初始化语音动画状态
|
|
updateTimerTip(false); // 初始化语音动画状态
|
|
|
playAudioRecordAnim();
|
|
playAudioRecordAnim();
|