11111
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* 消息長按彈窗
|
||||
*/
|
||||
public class MessageLongClickPopuwindow {
|
||||
private Activity mContext;
|
||||
private View popupView;
|
||||
private PopupWindow popupWindow;
|
||||
|
||||
public MessageLongClickPopuwindow(Activity context) {
|
||||
this.mContext = context;
|
||||
popupView = LayoutInflater.from(mContext).inflate(R.layout.view_message_long_click, null);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
}
|
||||
}
|
||||
@@ -31,19 +31,22 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
|
||||
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
|
||||
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||
if (messageDirection==Message.MessageDirection.SEND){
|
||||
readReceiptNew.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
readReceiptNew.setVisibility(View.GONE);
|
||||
}
|
||||
if (readReceiptNew!=null){
|
||||
if (messageDirection==Message.MessageDirection.SEND){
|
||||
readReceiptNew.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
readReceiptNew.setVisibility(View.GONE);
|
||||
}
|
||||
if (readReceipt.getVisibility()==View.VISIBLE) {
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
||||
} else {
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
||||
}
|
||||
if (readReceipt!=null){
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
if (readReceipt!=null){
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
holder.getConvertView().setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
@@ -15,6 +16,7 @@ import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.utils.FileSizeUtil;
|
||||
@@ -26,6 +28,7 @@ import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.FileMessage;
|
||||
import io.rong.message.ImageMessage;
|
||||
import io.rong.message.SightMessage;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
@@ -237,8 +240,70 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
if (pluginList.getVisibility() == VISIBLE) {
|
||||
pluginList.setVisibility(GONE);
|
||||
}
|
||||
Message message;
|
||||
long duration = FileUtil.getDuration(filePath);
|
||||
double fileSize = FileSizeUtil.getFileOrFilesSize(filePath, FileSizeUtil.SIZETYPE_MB);
|
||||
//将视频获取的毫秒时长转成分总
|
||||
long minute = duration / 60000;
|
||||
//大于两分钟走发送文件,否则走发送小视频
|
||||
if (minute > 2) {
|
||||
sendFile(filePath);
|
||||
} else {
|
||||
sendSightExtension(filePath, duration);
|
||||
}
|
||||
Log.e("InputPanelViewHolder", "时长" + duration + "文件大小");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送小视频消息
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param duration 视频时长
|
||||
*/
|
||||
private void sendSightExtension(String filePath, long duration) {
|
||||
long seconds = duration % 60000 ;
|
||||
long second = Math.round((float)seconds/1000) ;
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
Uri localUri = Uri.parse("file://" + filePath);
|
||||
SightMessage sightMessage = SightMessage.obtain(localUri, (int) second);
|
||||
Message message = Message.obtain(targetId, conversationType, sightMessage);
|
||||
IMCenter.getInstance().sendMediaMessage(message, null, null, new IRongCallback.ISendMediaMessageCallback() {
|
||||
@Override
|
||||
public void onProgress(Message message, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCanceled(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttached(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(final Message message, final RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(errorCode.msg);
|
||||
}
|
||||
});//
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送文件消息
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
*/
|
||||
private void sendFile(String filePath) {
|
||||
Message message;
|
||||
|
||||
Uri localUri = Uri.parse("file://" + filePath);
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
|
||||
@@ -273,10 +338,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
ToastUtil.show(errorCode.msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多媒体信息
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
android:id="@+id/rc_conversation_read_receipt"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -76,7 +77,7 @@
|
||||
android:singleLine="true"
|
||||
android:text="你好,朋友!"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_text_third_size" />
|
||||
android:textSize="15dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:cardBackgroundColor="#474747"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@mipmap/icon_message_copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:text="@string/copy"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@mipmap/icon_message_copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:text="@string/withdraw"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@mipmap/icon_message_quote"
|
||||
android:drawablePadding="5dp"
|
||||
android:text="@string/quote"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 470 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user