This commit is contained in:
18401019693 2022-07-21 15:05:35 +08:00
parent 821bd863c8
commit 01bdab01f6
18 changed files with 816 additions and 390 deletions

View File

@ -102,6 +102,7 @@ public abstract class AbsActivity extends AppCompatActivity {
* 设置透明状态栏
*/
private void setStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

View File

@ -490,7 +490,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveRoomViewHolder.onGuardInfoChanged(bean);
LiveChatBean chatBean = new LiveChatBean();
chatBean.setContent(bean.getUserName());
// chatBean.setType(LiveChatBean.SYSTEM);
mLiveRoomViewHolder.insertChat(chatBean, 1);
}
}
@ -837,23 +836,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onGameZjh(JSONObject obj) {
// if (mGamePresenter != null) {
// mGamePresenter.onGameZjhSocket(obj);
// }
}
@Override
public void onGameHd(JSONObject obj) {
// if (mGamePresenter != null) {
// mGamePresenter.onGameHdSocket(obj);
// }
}
@Override
public void onGameZp(JSONObject obj) {
// if (mGamePresenter != null) {
// mGamePresenter.onGameZpSocket(obj);
// }
}
@Override
@ -918,7 +908,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 打开私信列表窗口
*/
public void openChatListWindow() {
RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationActivity, PDLIiveChatActivity.class);
Intent intent = new Intent(mContext, PDLIiveChatActivity.class);
mContext.startActivity(intent);
}

View File

@ -1,36 +1,66 @@
package com.yunbao.live.activity;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R;
import com.yunbao.live.adapter.SystemChatMessageAdapter;
import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.http.ImHttpUtil;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.rong.imkit.conversationlist.ConversationListFragment;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imlib.model.UserInfo;
/**
* 直播页面聊天列表
*/
public class PDLIiveChatActivity extends AbsActivity {
@Override
protected int getLayoutId() {
return R.layout.activity_pd_chat;
}
public class PDLIiveChatActivity extends FragmentActivity {
private ConversationListFragment conversationListFragment;
private FrameLayout container;
private PDLIiveChatActivity mContext;
@Override
protected void main(Bundle savedInstanceState) {
super.main(savedInstanceState);
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_pd_chat);
mContext = this;
windowColor();
initView();
initData();
}
public void windowColor() {
Window window = getWindow();
//取消设置Window半透明的Flag
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
@ -47,17 +77,89 @@ public class PDLIiveChatActivity extends AbsActivity {
setFinishOnTouchOutside(true);//允许点击空白处关闭
}
/**
* 初始化控件
*/
private void initView() {
container = findViewById(R.id.container);
}
/**
* 初始化数据
*/
private void initData() {
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
container.post(new Runnable() {
@Override
public void run() {
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
addSystemMessagesView(listUserBean);
}
});
}
}
});
//刷新列表内用户信息
addUserInfoProvider();
//获取一下系统通知
MessageIMManager.get(this).getSystemMessages();
}
/**
* 添加头部系统消息
*
* @param listUserBean 数据源
*/
private void addSystemMessagesView(List<ImUserBean> listUserBean) {
//倒序展示
Collections.reverse(listUserBean);
//展示会话列表
ConversationListFragment conversationListFragment = new ConversationListFragment();
conversationListFragment = new ConversationListFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationListFragment);
transaction.commit();
//自定义空数据背景View
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
//初始化系统消息界面
View rootView = LayoutInflater.from(mContext).inflate(R.layout.view_system_message, null, true);
RecyclerView systemMessageList = rootView.findViewById(R.id.system_message_list);
SystemChatMessageAdapter messageAdapter = new SystemChatMessageAdapter(mContext);
messageAdapter.addDataAll(listUserBean);
systemMessageList.setHasFixedSize(false);
systemMessageList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, true));
systemMessageList.setAdapter(messageAdapter);
conversationListFragment.addHeaderView(rootView);
}
/**
* 刷新用户信息(异步)
*/
public void addUserInfoProvider() {
RongUserInfoManager.getInstance().setUserInfoProvider(userId -> {
CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
UserInfo userInfo = new UserInfo(userId, userBean.getUserNiceName(), Uri.parse(userBean.getAvatar()));
//使用空白字段存储自己服务器用户的所有的信息
userInfo.setExtra(GsonUtils.toJson(userBean));
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
}
}
});
return null;
}, true);
}
}

View File

@ -81,8 +81,10 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
//新手指导员
if (TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) {
isAdmin = true;
imgMore.setVisibility(View.GONE);
} else {//非指导员
isAdmin = false;
imgMore.setVisibility(View.VISIBLE);
}
Log.e("PDLiveConversation", userInfo.getExtra());
}

View File

@ -0,0 +1,150 @@
package com.yunbao.live.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent;
import com.alibaba.fastjson.JSON;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R;
import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.views.SystemChatMessageViewHolder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* 系统消息适配器
*/
public class SystemChatMessageAdapter extends RecyclerView.Adapter {
private List<ImUserBean> listUserBean = new ArrayList<>();
protected Activity mContext;
protected LayoutInflater mInflater;
public SystemChatMessageAdapter(Activity mContext) {
this.mContext = mContext;
mInflater = LayoutInflater.from(mContext);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//view_system_message_item.xml
return new SystemChatMessageViewHolder(mInflater.inflate(R.layout.view_system_message_item, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
ImUserBean model = listUserBean.get(position);
SystemChatMessageViewHolder messageViewHolder = (SystemChatMessageViewHolder) holder;
ImgLoader.displayWithError(mContext, model.getImage(), messageViewHolder.avatarImage, com.yunbao.live.R.mipmap.chat_head_mo);
if (position == 2) {
messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getLink()) ? mContext.getResources().getString(R.string.chat_like) : model.getLink());
} else {
if (position == 1) {
messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getContent()) ? mContext.getResources().getString(R.string.chat_action_no) : model.getContent());
} else {
messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getContent()) ? "" : model.getContent());
}
}
messageViewHolder.userName.setText(model.getTitle());
messageViewHolder.lastTime.setText(model.getLastDate());
String number = model.getNum();
if (!TextUtils.isEmpty(number) && !TextUtils.equals(number, "0")) {
messageViewHolder.redPoint.setVisibility(View.VISIBLE);
messageViewHolder.redPoint.setText(number);
} else {
messageViewHolder.redPoint.setVisibility(View.GONE);
}
//系统消息的跳转
messageViewHolder.setViewHolderOnClickListener((view, model1) -> {
//获取一下系统通知
MessageIMManager.get(mContext).getSystemMessages(new MessageIMManager.SystemMessagesHttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code==0){
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
addSystemMessagesView(listUserBean);
}
}
});
if (model1.getContent().equals("在線客服")) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p");
Adjust.trackEvent(adjustEvent1);
} else if (model1.getContent().equals("新手指導員")) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_guide", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_guide", null);
AdjustEvent adjustEvent1 = new AdjustEvent("m0nfpn");
Adjust.trackEvent(adjustEvent1);
}
if (!TextUtils.isEmpty(model1.getLink())) {
mContext.startActivity(new Intent(mContext, WebViewActivity.class).putExtra("url", model1.getLink()));
} else if ("1".equals(model1.getType()) || "2".equals(model1.getType())) {//系统消息,互动消息,猜你喜欢
forward(mContext, model1.getType(), "", model1.getTitle(), "");
} else if ("3".equals(model1.getType())) {
if (model1.getLink() != null && !"".equals(model1.getLink())) {
WebViewActivity.forward(mContext, model1.getLink());
} else {
forward(mContext, model1.getType(), "", model1.getTitle(), "");
}
}
}, model);
}
@Override
public int getItemCount() {
return listUserBean.size();
}
/**
* 添加数据源
*
* @param mListUserBean 数据源
*/
public void addDataAll(List<ImUserBean> mListUserBean) {
listUserBean.clear();
listUserBean.addAll(mListUserBean);
notifyDataSetChanged();
}
private void forward(Context context, String type, String uid, String title, String headImg) {
context.startActivity(new Intent(context, SystemMessageActivity.class)
.putExtra("type", type)
.putExtra("uid", uid)
.putExtra("title", title)
.putExtra("headImg", headImg));
}
/**
* 添加头部系统消息
*
* @param mlistUserBean 数据源
*/
private void addSystemMessagesView(List<ImUserBean> mlistUserBean) {
//倒序展示
Collections.reverse(mlistUserBean);
listUserBean.clear();
listUserBean.addAll(mlistUserBean);
notifyDataSetChanged();
}
}

View File

@ -29,8 +29,6 @@ import java.io.File;
*/
public class LiveChatRoomDialogFragment extends AbsDialogFragment {
// private ChatRoomDialogViewHolder mChatRoomViewHolder;
private int mOriginHeight;
private ProcessImageUtil mImageUtil;
@ -73,63 +71,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
return;
}
boolean following = bundle.getBoolean(Constants.FOLLOW);
// mChatRoomViewHolder = new ChatRoomDialogViewHolder(mContext, (ViewGroup) mRootView.findViewById(R.id.container), userBean, following);
// mChatRoomViewHolder.setActionListener(new ChatRoomActionListener() {
// @Override
// public void onCloseClick() {
// dismiss();
// }
//
// @Override
// public void onPopupWindowChanged(int deltaHeight) {
// addHeight(deltaHeight);
// }
//
// @Override
// public void onChooseImageClick() {
// checkReadWritePermissions();
// }
//
// @Override
// public void onCameraClick() {
// takePhoto();
// }
//
// @Override
// public void onVoiceInputClick() {
// checkVoiceRecordPermission(new Runnable() {
// @Override
// public void run() {
// openVoiceInputDialog();
// }
// });
// }
//
// @Override
// public void onLocationClick() {
// checkLocationPermission();
// }
//
// @Override
// public void onVoiceClick() {
// checkVoiceRecordPermission(new Runnable() {
// @Override
// public void run() {
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.clickVoiceRecord();
// }
// }
// });
// }
//
// @Override
// public ViewGroup getImageParentView() {
// return ((LiveActivity) mContext).getPageContainer();
// }
//
// });
// mChatRoomViewHolder.addToParent();
// mChatRoomViewHolder.loadData();
}
@ -143,9 +84,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
@Override
public void onSuccess(File file) {
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.sendImage(file.getAbsolutePath());
// }
}
@Override
@ -162,10 +100,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
}
mImageUtil = null;
((LiveActivity) mContext).setChatRoomOpened(null, false);
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.refreshLastMessage();
// mChatRoomViewHolder.release();
// }
super.onDestroy();
}
@ -187,9 +121,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
public void scrollToBottom() {
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.scrollToBottom();
// }
}
/**
@ -218,17 +149,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
if (mImageUtil == null) {
return;
}
// mImageUtil.startActivityForResult(new Intent(mContext, ChatChooseImageActivity.class), new ActivityResultCallback() {
// @Override
// public void onSuccess(Intent intent) {
// if (intent != null) {
// String imagePath = intent.getStringExtra(Constants.SELECT_IMAGE_PATH);
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.sendImage(imagePath);
// }
// }
// }
// });
}
/**
@ -264,24 +184,6 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
if (mImageUtil == null) {
return;
}
// mImageUtil.startActivityForResult(new Intent(mContext, LocationActivity.class), new ActivityResultCallback() {
// @Override
// public void onSuccess(Intent intent) {
// if (intent != null) {
// double lat = intent.getDoubleExtra(Constants.LAT, 0);
// double lng = intent.getDoubleExtra(Constants.LNG, 0);
// int scale = intent.getIntExtra(Constants.SCALE, 0);
// String address = intent.getStringExtra(Constants.ADDRESS);
// if (lat > 0 && lng > 0 && scale > 0 && !TextUtils.isEmpty(address)) {
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.sendLocation(lat, lng, scale, address);
// }
// } else {
// ToastUtil.show(WordUtil.getString(R.string.im_get_location_failed));
// }
// }
// }
// });
}
/**
@ -303,24 +205,15 @@ public class LiveChatRoomDialogFragment extends AbsDialogFragment {
* 打开语音输入窗口
*/
private void openVoiceInputDialog() {
// ChatVoiceInputDialog fragment = new ChatVoiceInputDialog();
// fragment.setChatRoomViewHolder(mChatRoomViewHolder);
// fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "ChatVoiceInputDialog");
}
@Override
public void onPause() {
super.onPause();
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.onPause();
// }
}
@Override
public void onResume() {
super.onResume();
// if (mChatRoomViewHolder != null) {
// mChatRoomViewHolder.onResume();
// }
}
}

View File

@ -112,9 +112,6 @@ public class LiveEnterRoomAnimPresenter {
enter_room_gif_small = (GifImageView) root.findViewById(R.id.enter_room_gif_small);
enter_room_svg_small = (SVGAImageView) root.findViewById(R.id.enter_room_svg_small);
tv_enterroom_user = (TextView) root.findViewById(R.id.tv_enterroom_user);
// enter_room_img_small = (ImageView) root.findViewById(R.id.enter_room_img_small);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
rt_enterroom_svga.getLayoutParams();
params.topMargin = mScreenWdith * 720 / 960 - 24;
@ -242,11 +239,6 @@ public class LiveEnterRoomAnimPresenter {
}
private void playHaoHuaGift(File file) {
//测试
// Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.zuojia_test_new);
// LoadDian9TuUtil.setNinePathImage(mContext, tv_enterroom_user, bitmap, 0);
// LoadDian9TuUtil.loadDian9Tu(mContext, tv_enterroom_user, "https://qny.shayucm.com/Car_New/zuojia_test_new.png", 0);
if (carType.contains("gif")) {
Log.i("fff", "gif");
playGif(file);
@ -405,10 +397,7 @@ public class LiveEnterRoomAnimPresenter {
needAnim = true;
mShowGif = true;
//直播间进场坐骑
// mWordText.setText( Html.fromHtml( u.getUserNiceName() + " <font color='#000379'>"+car.getWords() + "</font> "));
// carType = car.getWords();
carType = car.getSwf();
// mWordText.setText( u.getUserNiceName() +car.getWords() );
mWordText.setVisibility(View.GONE);
String[] arr = url.split("/");
@ -547,9 +536,6 @@ public class LiveEnterRoomAnimPresenter {
if (enter_room_gif_small != null) {
enter_room_gif_small.setImageDrawable(null);
}
// if (enter_room_img_small != null) {
// enter_room_img_small.setImageDrawable(null);
// }
if (mGifDrawable != null && !mGifDrawable.isRecycled()) {
mGifDrawable.stop();
mGifDrawable.recycle();

View File

@ -0,0 +1,408 @@
package com.yunbao.live.views;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.yunbao.live.R;
import io.rong.imkit.IMCenter;
import io.rong.imkit.conversation.extension.InputMode;
import io.rong.imkit.conversation.extension.RongExtensionCacheHelper;
import io.rong.imkit.conversation.extension.RongExtensionViewModel;
import io.rong.imkit.manager.AudioPlayManager;
import io.rong.imkit.manager.AudioRecordManager;
import io.rong.imkit.utils.PermissionCheckUtil;
import io.rong.imkit.utils.RongUtils;
import io.rong.imlib.IMLibExtensionModuleManager;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.HardwareResource;
import static android.view.View.VISIBLE;
public class InputPanel {
private final String TAG = this.getClass().getSimpleName();
private Conversation.ConversationType mConversationType;
private Context mContext;
private String mTargetId;
private InputPanel.InputStyle mInputStyle;
private Fragment mFragment;
private View mInputPanel;
private boolean mIsVoiceInputMode;
private ImageView mVoiceToggleBtn;
private EditText mEditText;
private TextView mVoiceInputBtn;
private ImageView mEmojiToggleBtn;
private Button mSendBtn;
private ImageView mAddBtn;
private ViewGroup mAddOrSendBtn;
private RongExtensionViewModel mExtensionViewModel;
private String mInitialDraft = "";
private float mLastTouchY;
private boolean mUpDirection;
private View.OnTouchListener mOnVoiceBtnTouchListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
float mOffsetLimit = 70.0F * v.getContext().getResources().getDisplayMetrics().density;
String[] permissions = new String[]{"android.permission.RECORD_AUDIO"};
if (!PermissionCheckUtil.checkPermissions(v.getContext(), permissions) && event.getAction() == 0) {
PermissionCheckUtil.requestPermissions(InputPanel.this.mFragment, permissions, 100);
return true;
} else {
if (event.getAction() == 0) {
if (AudioPlayManager.getInstance().isPlaying()) {
AudioPlayManager.getInstance().stopPlay();
}
if (RongUtils.phoneIsInUse(v.getContext()) || IMLibExtensionModuleManager.getInstance().onRequestHardwareResource(HardwareResource.ResourceType.VIDEO) || IMLibExtensionModuleManager.getInstance().onRequestHardwareResource(HardwareResource.ResourceType.AUDIO)) {
Toast.makeText(v.getContext(), v.getContext().getResources().getString(R.string.rc_voip_occupying), Toast.LENGTH_SHORT).show();
return true;
}
AudioRecordManager.getInstance().startRecord(v.getRootView(), InputPanel.this.mConversationType, InputPanel.this.mTargetId);
InputPanel.this.mLastTouchY = event.getY();
InputPanel.this.mUpDirection = false;
((TextView) v).setText(R.string.rc_voice_release_to_send);
((TextView) v).setBackground(v.getContext().getResources().getDrawable(R.drawable.rc_ext_voice_touched_button));
} else if (event.getAction() == 2) {
if (InputPanel.this.mLastTouchY - event.getY() > mOffsetLimit && !InputPanel.this.mUpDirection) {
AudioRecordManager.getInstance().willCancelRecord();
InputPanel.this.mUpDirection = true;
((TextView) v).setText(R.string.rc_voice_press_to_input);
((TextView) v).setBackground(v.getContext().getResources().getDrawable(R.drawable.rc_ext_voice_idle_button));
} else if (event.getY() - InputPanel.this.mLastTouchY > -mOffsetLimit && InputPanel.this.mUpDirection) {
AudioRecordManager.getInstance().continueRecord();
InputPanel.this.mUpDirection = false;
((TextView) v).setBackground(v.getContext().getResources().getDrawable(R.drawable.rc_ext_voice_touched_button));
((TextView) v).setText(R.string.rc_voice_release_to_send);
}
} else if (event.getAction() == 1 || event.getAction() == 3) {
AudioRecordManager.getInstance().stopRecord();
((TextView) v).setText(R.string.rc_voice_press_to_input);
((TextView) v).setBackground(v.getContext().getResources().getDrawable(R.drawable.rc_ext_voice_idle_button));
}
if (InputPanel.this.mConversationType.equals(Conversation.ConversationType.PRIVATE)) {
RongIMClient.getInstance().sendTypingStatus(InputPanel.this.mConversationType, InputPanel.this.mTargetId, "RC:VcMsg");
}
return true;
}
}
};
private View.OnClickListener mOnSendBtnClick = new View.OnClickListener() {
public void onClick(View v) {
InputPanel.this.mExtensionViewModel.onSendClick();
}
};
private View.OnFocusChangeListener mOnEditTextFocusChangeListener = new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
if (InputPanel.this.mExtensionViewModel != null && InputPanel.this.mExtensionViewModel.getInputModeLiveData() != null) {
InputPanel.this.mExtensionViewModel.getInputModeLiveData().postValue(InputMode.TextInput);
}
if (!TextUtils.isEmpty(InputPanel.this.mEditText.getText())) {
InputPanel.this.mSendBtn.setVisibility(VISIBLE);
InputPanel.this.mAddBtn.setVisibility(View.GONE);
}
} else {
EditText editText = InputPanel.this.mExtensionViewModel.getEditTextWidget();
if (editText.getText() != null && editText.getText().length() == 0) {
InputPanel.this.mSendBtn.setVisibility(View.GONE);
InputPanel.this.mAddBtn.setVisibility(VISIBLE);
}
}
}
};
private TextWatcher mEditTextWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s != null && s.length() != 0) {
InputPanel.this.mAddOrSendBtn.setVisibility(VISIBLE);
InputPanel.this.mSendBtn.setVisibility(VISIBLE);
InputPanel.this.mAddBtn.setVisibility(View.GONE);
} else {
IMCenter.getInstance().saveTextMessageDraft(InputPanel.this.mConversationType, InputPanel.this.mTargetId, InputPanel.this.mEditText.getText().toString(), (RongIMClient.ResultCallback) null);
if (!InputPanel.this.mInputStyle.equals(InputPanel.InputStyle.STYLE_CONTAINER_EXTENSION) && !InputPanel.this.mInputStyle.equals(InputPanel.InputStyle.STYLE_SWITCH_CONTAINER_EXTENSION)) {
InputPanel.this.mAddOrSendBtn.setVisibility(View.GONE);
} else {
InputPanel.this.mAddOrSendBtn.setVisibility(VISIBLE);
InputPanel.this.mAddBtn.setVisibility(VISIBLE);
InputPanel.this.mSendBtn.setVisibility(View.GONE);
}
}
int offset;
if (count == 0) {
int var10000 = start + before;
offset = -before;
} else {
offset = count;
}
if (Conversation.ConversationType.PRIVATE.equals(InputPanel.this.mConversationType) && offset != 0) {
RongIMClient.getInstance().sendTypingStatus(InputPanel.this.mConversationType, InputPanel.this.mTargetId, "RC:TxtMsg");
}
}
public void afterTextChanged(Editable s) {
}
};
public InputPanel(Fragment fragment, ViewGroup parent, InputPanel.InputStyle inputStyle, Conversation.ConversationType type, String targetId) {
this.mFragment = fragment;
this.mInputStyle = inputStyle;
this.mConversationType = type;
this.mTargetId = targetId;
this.initView(fragment.getContext(), parent);
this.mExtensionViewModel = (RongExtensionViewModel) (new ViewModelProvider(fragment)).get(RongExtensionViewModel.class);
this.mExtensionViewModel.getInputModeLiveData().observe(fragment.getViewLifecycleOwner(), new Observer<InputMode>() {
public void onChanged(InputMode inputMode) {
InputPanel.this.updateViewByInputMode(inputMode);
}
});
if (fragment.getContext() != null) {
this.mIsVoiceInputMode = RongExtensionCacheHelper.isVoiceInputMode(fragment.getContext(), this.mConversationType, this.mTargetId);
}
if (this.mIsVoiceInputMode) {
this.mExtensionViewModel.getInputModeLiveData().setValue(InputMode.VoiceInput);
} else {
this.getDraft();
this.mExtensionViewModel.getInputModeLiveData().setValue(InputMode.TextInput);
}
}
@SuppressLint({"ClickableViewAccessibility"})
private void initView(final Context context, ViewGroup parent) {
this.mContext = context;
this.mInputPanel = LayoutInflater.from(context).inflate(R.layout.rc_extension_input_panel, parent, false);
this.mVoiceToggleBtn = (ImageView) this.mInputPanel.findViewById(R.id.input_panel_voice_toggle);
this.mEditText = (EditText) this.mInputPanel.findViewById(R.id.edit_btn);
this.mVoiceInputBtn = (TextView) this.mInputPanel.findViewById((R.id.press_to_speech_btn));
this.mEmojiToggleBtn = (ImageView) this.mInputPanel.findViewById((R.id.input_panel_emoji_btn));
this.mAddOrSendBtn = (ViewGroup) this.mInputPanel.findViewById((R.id.input_panel_add_or_send));
this.mSendBtn = (Button) this.mInputPanel.findViewById((R.id.input_panel_send_btn));
this.mAddBtn = (ImageView) this.mInputPanel.findViewById((R.id.input_panel_add_btn));
this.mSendBtn.setOnClickListener(this.mOnSendBtnClick);
this.mEditText.setOnFocusChangeListener(this.mOnEditTextFocusChangeListener);
this.mEditText.addTextChangedListener(this.mEditTextWatcher);
this.mVoiceToggleBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (InputPanel.this.mIsVoiceInputMode) {
InputPanel.this.mIsVoiceInputMode = false;
InputPanel.this.mExtensionViewModel.getInputModeLiveData().setValue(InputMode.TextInput);
InputPanel.this.mEditText.requestFocus();
if (TextUtils.isEmpty(InputPanel.this.mInitialDraft)) {
InputPanel.this.getDraft();
}
} else {
InputPanel.this.mExtensionViewModel.getInputModeLiveData().postValue(InputMode.VoiceInput);
InputPanel.this.mIsVoiceInputMode = true;
}
RongExtensionCacheHelper.saveVoiceInputMode(context, InputPanel.this.mConversationType, InputPanel.this.mTargetId, InputPanel.this.mIsVoiceInputMode);
}
});
this.mEmojiToggleBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (InputPanel.this.mExtensionViewModel != null) {
if (InputPanel.this.mExtensionViewModel.getInputModeLiveData().getValue() != null && ((InputMode) InputPanel.this.mExtensionViewModel.getInputModeLiveData().getValue()).equals(InputMode.EmoticonMode)) {
InputPanel.this.mEditText.requestFocus();
InputPanel.this.mExtensionViewModel.getInputModeLiveData().postValue(InputMode.TextInput);
} else {
InputPanel.this.mExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode);
}
}
}
});
this.mAddBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (InputPanel.this.mExtensionViewModel.getInputModeLiveData().getValue() != null && ((InputMode) InputPanel.this.mExtensionViewModel.getInputModeLiveData().getValue()).equals(InputMode.PluginMode)) {
InputPanel.this.mEditText.requestFocus();
InputPanel.this.mExtensionViewModel.getInputModeLiveData().setValue(InputMode.TextInput);
}
InputPanel.this.mExtensionViewModel.getInputModeLiveData().setValue(InputMode.PluginMode);
}
});
this.mVoiceInputBtn.setOnTouchListener(this.mOnVoiceBtnTouchListener);
this.setInputPanelStyle(this.mInputStyle);
}
private void updateViewByInputMode(InputMode inputMode) {
if (!inputMode.equals(InputMode.TextInput) && !inputMode.equals(InputMode.PluginMode)) {
if (inputMode.equals(InputMode.VoiceInput)) {
this.mVoiceToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_toggle_keyboard_btn)));
this.mVoiceInputBtn.setVisibility(VISIBLE);
this.mEditText.setVisibility(View.GONE);
this.mEmojiToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_input_panel_emoji)));
} else if (inputMode.equals(InputMode.EmoticonMode)) {
this.mVoiceToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_toggle_voice_btn)));
this.mEmojiToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_toggle_keyboard_btn)));
this.mEditText.setVisibility(View.GONE);
this.mVoiceInputBtn.setVisibility(View.GONE);
}
} else {
if (inputMode.equals(InputMode.TextInput)) {
this.mIsVoiceInputMode = false;
}
this.mVoiceToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_toggle_voice_btn)));
this.mEmojiToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_input_panel_emoji)));
this.mEditText.setVisibility(VISIBLE);
this.mVoiceInputBtn.setVisibility(View.GONE);
this.mEmojiToggleBtn.setImageDrawable(this.mContext.getResources().getDrawable((R.drawable.rc_ext_input_panel_emoji)));
}
}
public EditText getEditText() {
return this.mEditText;
}
public View getRootView() {
return this.mInputPanel;
}
public void setVisible(int viewId, boolean visible) {
this.mInputPanel.findViewById(viewId).setVisibility(visible ? VISIBLE : View.GONE);
}
public void setInputPanelStyle(InputPanel.InputStyle style) {
switch (style) {
case STYLE_SWITCH_CONTAINER_EXTENSION:
this.setSCE();
break;
case STYLE_CONTAINER:
this.setC();
break;
case STYLE_CONTAINER_EXTENSION:
this.setCE();
break;
case STYLE_SWITCH_CONTAINER:
this.setSC();
break;
default:
this.setSCE();
}
this.mInputStyle = style;
}
private void setSCE() {
if (this.mInputPanel != null) {
this.mVoiceToggleBtn.setVisibility(VISIBLE);
this.mEmojiToggleBtn.setVisibility(VISIBLE);
this.mAddBtn.setVisibility(VISIBLE);
}
}
private void setC() {
if (this.mInputPanel != null) {
this.mVoiceToggleBtn.setVisibility(View.GONE);
this.mAddOrSendBtn.setVisibility(View.GONE);
this.mEmojiToggleBtn.setVisibility(View.GONE);
this.mAddBtn.setVisibility(View.GONE);
this.mSendBtn.setVisibility(View.GONE);
}
}
private void setCE() {
if (this.mInputPanel != null) {
this.mVoiceToggleBtn.setVisibility(View.GONE);
this.mAddOrSendBtn.setVisibility(VISIBLE);
this.mEmojiToggleBtn.setVisibility(VISIBLE);
this.mAddBtn.setVisibility(VISIBLE);
}
}
private void setSC() {
if (this.mInputPanel != null) {
this.mVoiceToggleBtn.setVisibility(VISIBLE);
this.mAddOrSendBtn.setVisibility(View.GONE);
this.mAddBtn.setVisibility(View.GONE);
}
}
private void getDraft() {
RongIMClient.getInstance().getTextMessageDraft(this.mConversationType, this.mTargetId, new RongIMClient.ResultCallback<String>() {
public void onSuccess(String s) {
if (!TextUtils.isEmpty(s)) {
InputPanel.this.mInitialDraft = s;
InputPanel.this.mEditText.setText(s);
InputPanel.this.mEditText.setSelection(s.length());
InputPanel.this.mEditText.requestFocus();
}
}
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
}
public void onDestroy() {
this.mFragment = null;
this.mExtensionViewModel = null;
if (this.mEditText != null && this.mEditText.getText() != null && !this.mInitialDraft.equals(this.mEditText.getText().toString())) {
IMCenter.getInstance().saveTextMessageDraft(this.mConversationType, this.mTargetId, this.mEditText.getText().toString(), (RongIMClient.ResultCallback) null);
}
}
public static enum InputStyle {
STYLE_SWITCH_CONTAINER_EXTENSION(291),
STYLE_SWITCH_CONTAINER(288),
STYLE_CONTAINER_EXTENSION(35),
STYLE_CONTAINER(32);
int v;
private InputStyle(int v) {
this.v = v;
}
public static InputPanel.InputStyle getStyle(int v) {
InputPanel.InputStyle result = null;
InputPanel.InputStyle[] var2 = values();
int var3 = var2.length;
for (int var4 = 0; var4 < var3; ++var4) {
InputPanel.InputStyle style = var2[var4];
if (style.v == v) {
result = style;
break;
}
}
return result;
}
}
}

View File

@ -6,9 +6,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -20,6 +17,10 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent;
import com.alibaba.fastjson.JSON;
@ -695,8 +696,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
});
mChatRecyclerView.setAdapter(mLiveChatAdapter);
// mVotesName.setText(CommonAppConfig.getInstance().getVotesName());
mBtnFollow.setOnClickListener(this);
mViewMedal.setOnClickListener(this);
findViewById(R.id.btn_close).setOnClickListener(this);
@ -720,7 +719,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
mLightAnimPresenter = new LiveLightAnimPresenter(mContext, mParentView);
mLiveEnterRoomAnimPresenter = new LiveEnterRoomAnimPresenter(mContext, mContentView, mScreenWdith);
// LiveAudienceActivity.liveLinkMicDrPkPresenter = new LiveLinkMicDrPkPresenter(mLiveUid,mContext, mLivePlayViewHolder, false, null);
mLiveRoomHandler = new LiveRoomHandler(this);
mRefreshUserListCallback = new HttpCallback() {
@Override
@ -989,12 +987,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 显示直播标题
*/
public void setTitle(String title) {
// if (!TextUtils.isEmpty(title)) {
// if (mLiveGiftAnimPresenter == null) {
// mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer);
// }
// mLiveGiftAnimPresenter.showLiveTitleAnim(title);
// }
}
@ -1006,11 +998,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
isAttention = attention;
if (mBtnFollow != null) {
if (attention == 0) {
// if (mBtnFollow.getVisibility() != View.VISIBLE) {
mBtnFollow.setVisibility(View.VISIBLE);
mViewMedal.setVisibility(View.GONE);
// }
} else {
if (mBtnFollow.getVisibility() == View.VISIBLE) {
mBtnFollow.setVisibility(View.GONE);
@ -1043,15 +1032,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (LivePushTxViewHolder.mTRTCCloud != null) {
} else {
// touid = touids;
// ImgLoader.displayAvatar(mContext, url, avatarOther);
// tv_avatarOther_name.setText(name);
// goto_room_view.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// showUserDialog(touids);
// }
// });
}
}
@ -1059,51 +1039,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
goto_room_view.setVisibility(View.GONE);
}
// private LiveRoomCheckLivePresenter mCheckLivePresenter;
// private void gotoLive(final String live_id) {
// LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
// @Override
// public void onSuccess(int code, String msg, String[] info) {
// LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
// @Override
// public void onSuccess(int code, String msg, String[] info) {
// if (code == 0 && info.length > 0) {
// LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
// V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() {
// @Override
// public void onSuccess() {
// CommonAppContext.Ingroup = 0;
// if (mCheckLivePresenter == null) {
// mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
// @Override
// public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
// if (liveBean == null) {
// return;
// }
//
// LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
//// if (mFromLiveRoom) {
//// ((UserHomeActivity) mContext).onBackPressed();
// EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
//// } else {
//// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
//// }
// }
// });
// }
// mCheckLivePresenter.checkLive(liveBean);
// }
//
// @Override
// public void onError(int code, String desc) {
// }
// });
// }
// }
// });
// }
// });
// }
/**
* 显示刷新直播间用户列表
@ -1118,9 +1053,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 显示主播映票数
*/
public void setVotes(String votes) {
// if (mVotes != null) {
// mVotes.setText(votes);
// }
}
/**
@ -1185,11 +1117,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/
public void onGuardInfoChanged(LiveBuyGuardMsgBean bean) {
setGuardNum(bean.getGuardNum());
// setVotes(bean.getVotes());
// if (mLiveUserAdapter != null) {
// refreshUserList();
// mLiveUserAdapter.onGuardChanged(bean.getUid(), bean.getGuardType());
// }
}
/**
@ -1371,33 +1298,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
isStayRoomfive = isTrue;
}
/**
* 用户进入房间用户列表添加该用户
*/
// public void insertUser(LiveUserGiftBean bean) {
// if (mLiveUserAdapter != null) {
//// mLiveUserAdapter.insertItem(bean);
// }
// }
// /**
// * 用户进入房间添加僵尸粉
// */
// public void insertUser(List<LiveUserGiftBean> list) {
// if (mLiveUserAdapter != null) {
// refreshUserList();
//// mLiveUserAdapter.insertList(list);
// }
// }
// /**
// * 用户离开房间用户列表删除该用户
// */
// public void removeUser(String uid) {
// if (mLiveUserAdapter != null) {
// mLiveUserAdapter.removeItem(uid);
// }
// }
/**
* 刷新用户列表
@ -1405,11 +1305,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void refreshUserList(JSONObject obj) {
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class);
mLiveUserAdapter.refreshList(list);
// if (!TextUtils.isEmpty(mLiveUid) && mRefreshUserListCallback != null && mLiveUserAdapter != null) {
// LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
// LiveHttpUtil.getUserList(mLiveUid, mStream, "guanzhong",1,mRefreshUserListCallback);
// startRefreshUserList();
// }
}
/**
@ -1598,9 +1493,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mVotes.setText(bean.getVotes());
room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num()));
mTvMedalRank.setText(bean.getMedalRankNum());
//开通粉丝勋章成功弹窗
// if (bean.getMedalFirstGet()!=null && bean.getMedalFirstGet().equals("1"))
// ((LiveAudienceActivity) mContext).openFansMedalOkWindow();
if (mLiveGiftAnimPresenter == null) {
mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
}
@ -1617,21 +1509,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//开通粉丝勋章成功弹窗
if (!isAncher && bean.getMedalFirstGet() != null && bean.getMedalFirstGet().equals("1")
&& bean.getUid().equals(CommonAppConfig.getInstance().getUid())) {
// UserBean userBean = CommonAppConfig.getInstance().getUserBean();
// userBean.setMedalName(bean.getMedalRankNum());
((LiveAudienceActivity) mContext).openFansMedalOkWindow();
// ((LiveAudienceActivity) mContext).openFansMedalOkWindow();
}
Log.i("tvss", bean.getDrpk_status() + "" + mLiveUid + "vsss" + bean.getRoomnum());
if (mLiveGiftAnimPresenter == null) {
// if(bean.getDrpk_status().equals("0")){
// mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer);
// }else{
// if(!mLiveUid.equals(bean.getRoomnum())){
mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
// }
// }
}
mLiveGiftAnimPresenter.showGiftAnim(bean, isAncher);
}
@ -1639,7 +1522,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//全服通知 购买守护
public void showGuardGifMessage(LiveReceiveGiftBean bean) {
mVotes.setText(bean.getVotes());
// mTvMedalRank.setText(bean.getMedalRankNum());
if (mLiveGiftAnimPresenter == null) {
mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
}
@ -1824,12 +1706,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 显示奖池按钮
*/
public void showPrizePoolLevel(String level) {
/* if (mBtnPrizePool != null && mBtnPrizePool.getVisibility() != View.VISIBLE) {
mBtnPrizePool.setVisibility(View.VISIBLE);
}
if (mPrizePoolLevel != null) {
mPrizePoolLevel.setText(String.format(WordUtil.getString(R.string.live_gift_prize_pool_3), level));
}*/
}
/**

View File

@ -0,0 +1,47 @@
package com.yunbao.live.views;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.live.R;
import com.yunbao.live.bean.ImUserBean;
/**
* 系统消息界面
*/
public class SystemChatMessageViewHolder extends RecyclerView.ViewHolder {
public RoundedImageView avatarImage;
public TextView userName, userMsg, lastTime, redPoint;
private ViewHolderOnClickListener listener;
private ImUserBean model;
public SystemChatMessageViewHolder(@NonNull View itemView) {
super(itemView);
avatarImage = itemView.findViewById(R.id.avatar);
userName = itemView.findViewById(R.id.name);
userMsg = itemView.findViewById(R.id.msg);
lastTime = itemView.findViewById(R.id.time);
redPoint = itemView.findViewById(R.id.red_point);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != listener) {
listener.onClick(v, model);
}
}
});
}
public interface ViewHolderOnClickListener {
void onClick(View view, ImUserBean model);
}
public void setViewHolderOnClickListener(ViewHolderOnClickListener listener, ImUserBean model) {
this.listener = listener;
this.model = model;
}
}

View File

@ -2,13 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/view_title" />
<FrameLayout
android:paddingTop="10dp"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_height="400dp"
android:background="@color/white"/>
</LinearLayout>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_marginTop="200dp"
android:layout_height="wrap_content">
<LinearLayout

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/system_message_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:scaleType="centerCrop"
app:riv_oval="true" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:layout_toRightOf="@id/avatar"
android:ellipsize="end"
android:singleLine="true"
android:text="dasdas"
android:textColor="@color/textColor"
android:textSize="16sp" />
<TextView
android:id="@+id/msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_marginTop="2dp"
android:layout_marginRight="80dp"
android:layout_toRightOf="@id/avatar"
android:ellipsize="end"
android:singleLine="true"
android:text="dasd "
android:textColor="@color/gray3"
android:textSize="14sp" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/name"
android:layout_alignParentRight="true"
android:layout_marginTop="3dp"
android:layout_marginRight="15dp"
android:text="dasdas "
android:textColor="@color/gray3"
android:textSize="12sp" />
<TextView
android:id="@+id/red_point"
android:layout_width="20dp"
android:layout_height="15dp"
android:layout_below="@id/time"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:background="@drawable/background_ff50715"
android:gravity="center"
android:includeFontPadding="false"
android:minWidth="14dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:textColor="#fff"
android:textSize="12sp"
android:visibility="invisible" />
</RelativeLayout>

View File

@ -67,6 +67,7 @@ import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.live.LiveConfig;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.PDLIiveChatActivity;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.http.LiveHttpConsts;

View File

@ -53,7 +53,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.activity.PDLiveConversationActivity;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.ReportCommunityBean;
import com.yunbao.live.event.LiveRoomChangeEvent;
@ -294,7 +294,6 @@ public class MyWebViewActivity extends AbsActivity {
@JavascriptInterface
public void androidClickSayHiBack(String uid, String name, String img) {
Constants.firstInto = 0;
// SystemMessageActivity.forward(mContext, "-2", uid, name, img);
ConversationIMListManager.get(mContext).jumpConversation(mContext, uid);
}

View File

@ -39,6 +39,7 @@ public class ConversationIMListManager {
RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationListActivity, PDLiveConversationListActivity.class);
//将自定义会话列表 Activity 注册到 IMKit SDK
RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationListActivity, PDLIiveChatActivity.class);
RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationActivity, PDLiveConversationActivity.class);
RongConfigCenter.conversationListConfig().setDataProcessor(new PDLiveMessageProcessor());
//获取会话模板管理器
ProviderManager<BaseUiConversation> providerManager = RongConfigCenter.conversationListConfig().getProviderManager();
@ -92,7 +93,7 @@ public class ConversationIMListManager {
* @param targetId 用户id
*/
public void jumpConversation(Activity context,String targetId) {
RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationActivity, PDLiveConversationActivity.class);
Intent intent = new Intent(context, PDLiveConversationActivity.class);
intent.putExtra(RouteUtils.TARGET_ID, targetId);
context.startActivity(intent);

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/input_panel_add_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:src="@drawable/rc_ext_input_panel_add"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/input_panel_voice_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginBottom="6.5dp"
android:src="@drawable/rc_ext_toggle_voice"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/input_panel_add_btn"
android:orientation="horizontal">
<EditText
android:id="@+id/edit_btn"
style="@style/EditTextStyle.Alignment"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:background="@drawable/rc_ext_panel_editbox_background"
android:maxLines="4"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/input_panel_emoji_btn"
app:layout_constraintStart_toEndOf="@+id/input_panel_voice_toggle"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/press_to_speech_btn"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="@dimen/rc_ext_input_panel_editbox_height"
android:layout_marginStart="8dp"
android:layout_marginTop="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:background="@drawable/rc_ext_voice_idle_button"
android:gravity="center"
android:text="@string/rc_voice_press_to_input"
android:textColor="@color/rc_text_main_color"
android:textSize="@dimen/rc_font_nav_or_date_size"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/input_panel_emoji_btn"
app:layout_constraintStart_toEndOf="@+id/input_panel_voice_toggle"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/input_panel_emoji_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:src="@drawable/rc_ext_input_panel_emoji"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/input_panel_add_or_send"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/input_panel_add_or_send"
android:layout_width="41dp"
android:layout_height="wrap_content"
android:layout_marginTop="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:layout_toEndOf="@id/edit_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/input_panel_send_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@mipmap/btn_sand"
android:textSize="@dimen/rc_font_text_third_size"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>