update
@ -40,6 +40,7 @@ public abstract class AbsOTOActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
onCreate();
|
||||
setStatusBar();
|
||||
setContentView(getLayoutId());
|
||||
mContext = this;
|
||||
@ -64,6 +65,8 @@ public abstract class AbsOTOActivity extends AppCompatActivity {
|
||||
|
||||
protected abstract void main(Bundle savedInstanceState);
|
||||
|
||||
protected void onCreate(){}
|
||||
|
||||
/**
|
||||
* 设置标题
|
||||
*/
|
||||
|
@ -150,13 +150,8 @@ public class MainActivity extends AbsOTOActivity {
|
||||
}
|
||||
|
||||
private void updateUnreadCount(int count) {
|
||||
if(count==0){
|
||||
dslTabLayout.setDrawBadge(false);
|
||||
}else {
|
||||
dslTabLayout.setDrawBadge(true);
|
||||
}
|
||||
dslTabLayout.setDrawBadge(count > 0);
|
||||
dslTabLayout.updateTabBadge(2, count + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,12 @@ import androidx.annotation.NonNull;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.adapter.HomeHotListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||
@ -48,6 +53,20 @@ public class HotFragment extends BaseFragment {
|
||||
|
||||
private void onConversationListRefresh(RefreshLayout refreshLayout) {
|
||||
|
||||
}
|
||||
private void initData(){
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getHomeHot(new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -10,7 +10,12 @@ import androidx.annotation.NonNull;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||
@ -47,13 +52,30 @@ public class RecommendFragment extends BaseFragment {
|
||||
top.setOnClickListener(view -> {
|
||||
recyclerView.scrollToPosition(0);
|
||||
});
|
||||
initData();
|
||||
}
|
||||
|
||||
private void onConversationListLoadMore() {
|
||||
mRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
private void onConversationListRefresh(RefreshLayout refreshLayout) {
|
||||
|
||||
initData();
|
||||
}
|
||||
private void initData(){
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getHomeRecommend(new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
adapter.setList(data);
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,17 +1,28 @@
|
||||
package com.shayu.onetoone.activity.fragments.message;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.MessageChatTipsContent;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -23,6 +34,10 @@ import java.util.Date;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imkit.manager.AudioPlayManager;
|
||||
import io.rong.imkit.manager.AudioRecordManager;
|
||||
import io.rong.imkit.utils.PermissionCheckUtil;
|
||||
import io.rong.imkit.utils.RongOperationPermissionUtils;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
@ -38,7 +53,13 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
ImageView img, call, video, gift;
|
||||
ProcessImageUtil cameraUtil;
|
||||
String targetId;
|
||||
Conversation.ConversationType conversationType= Conversation.ConversationType.PRIVATE;
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
View audioLayout;
|
||||
ImageView btnAudio;
|
||||
ImageView btnText;
|
||||
ImageView btnClose;
|
||||
private float mLastTouchY;
|
||||
private boolean mUpDirection;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
@ -51,7 +72,7 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
initCamera();
|
||||
|
||||
call.setOnClickListener(v -> {
|
||||
MessageChatTipsContent bean= MessageChatTipsContent.obtain(WordUtil.getString(R.string.message_chat_tip1));
|
||||
MessageChatTipsContent bean = MessageChatTipsContent.obtain(WordUtil.getString(R.string.message_chat_tip1));
|
||||
IMCenter.getInstance().insertOutgoingMessage(conversationType, targetId, Message.SentStatus.SENT, bean, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() {
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
@ -61,11 +82,12 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode e) {
|
||||
ToastUtil.show(R.string.system_tip_failure);
|
||||
System.out.println("失败:"+e.getMessage());
|
||||
System.out.println("失败:" + e.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
updateMyInfo();
|
||||
}
|
||||
|
||||
private void initCamera() {
|
||||
@ -87,6 +109,7 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void initBtn() {
|
||||
try {
|
||||
Field field = mRongExtension.getInputPanel().getClass().getDeclaredField("mInputPanel");
|
||||
@ -94,15 +117,83 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
mInputPanel = (View) field.get(mRongExtension.getInputPanel());
|
||||
assert mInputPanel != null;
|
||||
mSendBtn = mInputPanel.findViewById(R.id.send_btn);
|
||||
ImageView mVoiceToggleBtn = (ImageView) mInputPanel.findViewById(R.id.input_panel_voice_toggle);
|
||||
assert mVoiceToggleBtn != null;
|
||||
|
||||
mVoiceToggleBtn.setOnClickListener(v -> {
|
||||
changeAudioLayout();
|
||||
});
|
||||
img = mInputPanel.findViewById(R.id.input_panel_image_btn);
|
||||
video = mInputPanel.findViewById(R.id.input_panel_video_btn);
|
||||
call = mInputPanel.findViewById(R.id.input_panel_call_btn);
|
||||
gift = mInputPanel.findViewById(R.id.input_panel_gift_btn);
|
||||
audioLayout = mInputPanel.findViewById(R.id.audio_layout);
|
||||
btnAudio = mInputPanel.findViewById(R.id.audio_btn);
|
||||
btnText = mInputPanel.findViewById(R.id.text_btn);
|
||||
btnClose = mInputPanel.findViewById(R.id.close_btn);
|
||||
|
||||
btnText.setOnClickListener(v -> changeAudioLayout());
|
||||
btnClose.setOnClickListener(v -> changeAudioLayout());
|
||||
|
||||
btnAudio.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
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(ChatMessageFragment.this, permissions, 100);
|
||||
return true;
|
||||
} else {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (AudioPlayManager.getInstance().isPlaying()) {
|
||||
AudioPlayManager.getInstance().stopPlay();
|
||||
}
|
||||
|
||||
if (RongOperationPermissionUtils.isOnRequestHardwareResource()) {
|
||||
Toast.makeText(v.getContext(), v.getContext().getResources().getString(io.rong.imkit.R.string.rc_voip_occupying), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
ChatMessageFragment.this.mLastTouchY = event.getY();
|
||||
ChatMessageFragment.this.mUpDirection = false;
|
||||
AudioRecordManager.getInstance().startRecord(v.getRootView(), mRongExtension.getConversationIdentifier());
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
if (ChatMessageFragment.this.mLastTouchY - event.getY() > mOffsetLimit && !ChatMessageFragment.this.mUpDirection) {
|
||||
AudioRecordManager.getInstance().willCancelRecord();
|
||||
ChatMessageFragment.this.mUpDirection = true;
|
||||
} else if (event.getY() - ChatMessageFragment.this.mLastTouchY > -mOffsetLimit && ChatMessageFragment.this.mUpDirection) {
|
||||
AudioRecordManager.getInstance().continueRecord();
|
||||
ChatMessageFragment.this.mUpDirection = false;
|
||||
}
|
||||
|
||||
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
|
||||
AudioRecordManager.getInstance().stopRecord();
|
||||
}
|
||||
|
||||
if (mRongExtension.getConversationIdentifier().getType().equals(Conversation.ConversationType.PRIVATE)) {
|
||||
RongIMClient.getInstance().sendTypingStatus(mRongExtension.getConversationIdentifier().getType(),
|
||||
mRongExtension.getConversationIdentifier().getTargetId(), "RC:VcMsg");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void changeAudioLayout() {
|
||||
if (audioLayout.getVisibility() == View.VISIBLE) {
|
||||
audioLayout.setVisibility(View.GONE);
|
||||
} else {
|
||||
audioLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendText() {
|
||||
try {
|
||||
Field field = mRongExtension.getInputPanel().getClass().getDeclaredField("mSendBtn");
|
||||
@ -116,7 +207,7 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
}
|
||||
|
||||
private void sendImage(File file) {
|
||||
ImageMessage imageMessage = ImageMessage.obtain(Uri.parse("file://"+file.getAbsolutePath()),true);
|
||||
ImageMessage imageMessage = ImageMessage.obtain(Uri.parse("file://" + file.getAbsolutePath()), true);
|
||||
Message message = Message.obtain(targetId, conversationType, imageMessage);
|
||||
message.setSenderUserId(CommonAppConfig.getInstance().getUid());
|
||||
message.setObjectName("RC:ImgMsg");
|
||||
@ -152,4 +243,19 @@ public class ChatMessageFragment extends ConversationFragment {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void updateMyInfo() {
|
||||
OTONetManager.getInstance(getActivity())
|
||||
.getBaseInfos(false, new HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.shayu.onetoone.activity.fragments.message;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -20,6 +21,7 @@ import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.adapter.MsgMessageRecyclerViewAdapter;
|
||||
import com.shayu.onetoone.bean.MsgMessageBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.TargetUserInfoBean;
|
||||
import com.shayu.onetoone.event.MessageMsgBusEvent;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yanzhenjie.recyclerview.OnItemMenuClickListener;
|
||||
@ -34,6 +36,7 @@ import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RandomUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -48,6 +51,7 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import io.rong.common.RLog;
|
||||
import io.rong.imkit.GlideKitImageEngine;
|
||||
import io.rong.imkit.IMCenter;
|
||||
@ -75,6 +79,7 @@ import io.rong.imlib.IRongCoreEnum;
|
||||
import io.rong.imlib.RongCoreClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.ConversationIdentifier;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
|
||||
@ -151,8 +156,8 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
}
|
||||
});
|
||||
initSystemNotice();
|
||||
initUserInfo(0);
|
||||
initRongConfig();
|
||||
updateUserInfo();
|
||||
}
|
||||
|
||||
private void initRongConfig() {
|
||||
@ -165,36 +170,6 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
});
|
||||
}
|
||||
|
||||
private void initUserInfo(long timer) {
|
||||
RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() {
|
||||
@Override
|
||||
public void onSuccess(List<Conversation> conversations) {
|
||||
long destructTime = 0;
|
||||
for (Conversation conversation : conversations) {
|
||||
String targetId = conversation.getTargetId();
|
||||
Log.i(TAG, "targetId = " + targetId);
|
||||
UserInfo info = new UserInfo(targetId, "用户名" + targetId, Uri.parse("https://downs.yaoulive.com/avatar/12.jpg"));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sex", RandomUtil.nextInt(20) % 2);
|
||||
json.put("age", RandomUtil.nextInt(40));
|
||||
info.setExtra(json.toJSONString());
|
||||
RongUserInfoManager.getInstance().refreshUserInfoCache(info);
|
||||
if (conversations.size() < 10) {
|
||||
destructTime = conversation.getSentTime();
|
||||
}
|
||||
}
|
||||
if (destructTime > 0) {
|
||||
initUserInfo(destructTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode e) {
|
||||
|
||||
}
|
||||
}, timer, 10, Conversation.ConversationType.PRIVATE);
|
||||
}
|
||||
|
||||
|
||||
private void initSystemNotice() {
|
||||
|
||||
@ -205,9 +180,17 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
public void onSuccess(List<OfficialNoticeBean> data) {
|
||||
for (OfficialNoticeBean datum : data) {
|
||||
if (datum.getType() == 3) {
|
||||
SpUtil.setStringValue("customerService", JSONObject.toJSONString(datum));
|
||||
continue;
|
||||
}
|
||||
mAdapter.add(setTopData(datum.getTitle(), datum.getContent(), datum.getAddtime()*1000, datum.getNew_image(), datum.getNum(), datum.getType()), datum.getType());
|
||||
mAdapter.add(setTopData(datum.getTitle(),
|
||||
datum.getContent(),
|
||||
datum.getAddtime() * 1000,
|
||||
datum.getNew_image(),
|
||||
datum.getNum(),
|
||||
datum.getType(),
|
||||
JSONObject.toJSONString(datum)
|
||||
), datum.getType());
|
||||
}
|
||||
onConversationListRefresh(mRefreshLayout);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
@ -223,7 +206,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
|
||||
}
|
||||
|
||||
private SingleConversation setTopData(String title, String content, long time, String avatar, int num, int id) {
|
||||
private SingleConversation setTopData(String title, String content, long time, String avatar, int num, int id, String exp) {
|
||||
SingleConversation conversation = new SingleConversation(getContext(), new Conversation());
|
||||
conversation.mCore.setConversationType(Conversation.ConversationType.PRIVATE);
|
||||
conversation.mCore.setSenderUserName(title);
|
||||
@ -233,6 +216,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
conversation.mConversationContent = new SpannableString(content);
|
||||
conversation.mCore.setUnreadMessageCount(num);
|
||||
conversation.mCore.setTargetId(id + "");
|
||||
conversation.mCore.setLatestMessageExtra(exp);
|
||||
UserInfo info = new UserInfo(id + "", title, Uri.parse(avatar));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sex", -1);
|
||||
@ -376,6 +360,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
this.mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
MsgMessageFragment.this.onConversationListRefresh(refreshLayout);
|
||||
updateUserInfo();
|
||||
}
|
||||
});
|
||||
this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
@ -467,12 +452,13 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
BaseUiConversation baseUiConversation = (BaseUiConversation) this.mAdapter.getItem(position);
|
||||
String targetId = baseUiConversation.mCore.getTargetId();
|
||||
try {
|
||||
long type=Integer.parseInt(targetId);
|
||||
if(type<100){
|
||||
int type = Integer.parseInt(targetId);
|
||||
if (type < 100) {
|
||||
ToastUtil.showDebug("还没做");
|
||||
startSystem(JSONObject.parseObject(mAdapter.getSystemItem(type).mCore.getLatestMessageExtra(), OfficialNoticeBean.class), baseUiConversation.getConversationIdentifier());
|
||||
return;
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ConversationListBehaviorListener listBehaviorListener = RongConfigCenter.conversationListConfig().getListener();
|
||||
@ -493,53 +479,18 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
}
|
||||
}
|
||||
|
||||
private void startSystem(OfficialNoticeBean noticeBean, ConversationIdentifier conversationIdentifier) {
|
||||
if (noticeBean.getType() != 3) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("model", noticeBean.getType());
|
||||
bundle.putString("data", JSONObject.toJSONString(noticeBean));
|
||||
RouteUtils.routeToConversationActivity(getContext(), conversationIdentifier, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(View view, ViewHolder holder, int position) {
|
||||
/*if (position >= 0 && position < this.mAdapter.getData().size()) {
|
||||
final BaseUiConversation baseUiConversation = (BaseUiConversation) this.mAdapter.getItem(position);
|
||||
ConversationListBehaviorListener listBehaviorListener = RongConfigCenter.conversationListConfig().getListener();
|
||||
if (listBehaviorListener != null && listBehaviorListener.onConversationLongClick(view.getContext(), view, baseUiConversation)) {
|
||||
RLog.d(this.TAG, "ConversationList item click event has been intercepted by App.");
|
||||
return true;
|
||||
} else {
|
||||
final ArrayList<String> items = new ArrayList();
|
||||
final String removeItem = view.getContext().getResources().getString(io.rong.imkit.R.string.rc_conversation_list_dialog_remove);
|
||||
final String setTopItem = view.getContext().getResources().getString(io.rong.imkit.R.string.rc_conversation_list_dialog_set_top);
|
||||
final String cancelTopItem = view.getContext().getResources().getString(io.rong.imkit.R.string.rc_conversation_list_dialog_cancel_top);
|
||||
if (!(baseUiConversation instanceof GatheredConversation)) {
|
||||
if (baseUiConversation.mCore.isTop()) {
|
||||
items.add(cancelTopItem);
|
||||
} else {
|
||||
items.add(setTopItem);
|
||||
}
|
||||
}
|
||||
|
||||
items.add(removeItem);
|
||||
int size = items.size();
|
||||
OptionsPopupDialog.newInstance(view.getContext(), (String[]) items.toArray(new String[size])).setOptionsPopupDialogListener(new OptionsPopupDialog.OnOptionsItemClickedListener() {
|
||||
public void onOptionsItemClicked(final int which) {
|
||||
if (!((String) items.get(which)).equals(setTopItem) && !((String) items.get(which)).equals(cancelTopItem)) {
|
||||
if (((String) items.get(which)).equals(removeItem)) {
|
||||
IMCenter.getInstance().removeConversation(baseUiConversation.mCore.getConversationType(), baseUiConversation.mCore.getTargetId(), (RongIMClient.ResultCallback) null);
|
||||
}
|
||||
} else {
|
||||
IMCenter.getInstance().setConversationToTop(baseUiConversation.getConversationIdentifier(), !baseUiConversation.mCore.isTop(), false, new RongIMClient.ResultCallback<Boolean>() {
|
||||
public void onSuccess(Boolean value) {
|
||||
Toast.makeText(view.getContext(), (CharSequence) items.get(which), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}).show();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -564,11 +515,42 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
return creator;
|
||||
}
|
||||
|
||||
private void updateUserInfo() {
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
for (BaseUiConversation datum : mAdapter.getData()) {
|
||||
String targetId = datum.mCore.getTargetId();
|
||||
try {
|
||||
int id = Integer.parseInt(targetId);
|
||||
if (id > 100) {
|
||||
ids.add(id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getTargetUserInfoList(ids, new HttpCallback<List<TargetUserInfoBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<TargetUserInfoBean> data) {
|
||||
for (TargetUserInfoBean item : data) {
|
||||
UserInfo info = new UserInfo(item.getId() + "", item.getUser_nicename(), Uri.parse(item.getAvatar()));
|
||||
info.setExtra(JSONObject.toJSONString(item));
|
||||
RongUserInfoManager.getInstance().refreshUserInfoCache(info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void busEvent(MessageMsgBusEvent event) {
|
||||
if (event.getType() == MessageMsgBusEvent.TYPE_ALL_READ) {
|
||||
allRead();
|
||||
}else if(event.getType()==MessageMsgBusEvent.TYPE_UPDATE_SYSTEM){
|
||||
} else if (event.getType() == MessageMsgBusEvent.TYPE_UPDATE_SYSTEM) {
|
||||
initSystemNotice();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package com.shayu.onetoone.activity.fragments.message;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class SystemMessageFragment extends ConversationFragment {
|
||||
View mInputPanel;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
init();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
try {
|
||||
Field field = mRongExtension.getInputPanel().getClass().getDeclaredField("mInputPanel");
|
||||
field.setAccessible(true);
|
||||
mInputPanel = (View) field.get(mRongExtension.getInputPanel());
|
||||
assert mInputPanel != null;
|
||||
mInputPanel.setVisibility(View.GONE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(getContext())
|
||||
.getSystemMessageList(SystemMessageBean.TYPE_SYSTEM, new HttpCallback<List<SystemMessageBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SystemMessageBean> data) {
|
||||
for (SystemMessageBean item : data) {
|
||||
sendMessage(item);
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
|
||||
private void sendMessage(SystemMessageBean item) {
|
||||
TextMessage content = TextMessage.obtain(item.getContent());
|
||||
UiMessage message = new UiMessage(Message.obtain("4", Conversation.ConversationType.PRIVATE, content));
|
||||
message.setSentStatus(Message.SentStatus.SENT);
|
||||
message.setTargetId("4");
|
||||
mAdapter.add(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,15 +1,31 @@
|
||||
package com.shayu.onetoone.activity.message;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.AbsOTOActivity;
|
||||
import com.shayu.onetoone.activity.fragments.message.ChatMessageFragment;
|
||||
import com.shayu.onetoone.activity.fragments.message.SystemMessageFragment;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
|
||||
@ -18,17 +34,120 @@ import io.rong.imkit.conversation.ConversationFragment;
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_MSG_CHAT)
|
||||
public class ChatActivity extends AbsOTOActivity {
|
||||
String targetId;
|
||||
RoundedImageView avatar;
|
||||
TextView uname;
|
||||
TextView sign;
|
||||
TextView home;
|
||||
ImageView sex;
|
||||
ImageView status;
|
||||
Button follow;
|
||||
OfficialNoticeBean noticeBean;
|
||||
|
||||
View titleBar;
|
||||
int model;
|
||||
Button callService;
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
model = getIntent().getIntExtra("model", 0);
|
||||
String data = getIntent().getStringExtra("data");
|
||||
if (!StringUtil.isEmpty(data)) {
|
||||
noticeBean = JSONObject.parseObject(data, OfficialNoticeBean.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
switch (model) {
|
||||
case SystemMessageBean.TYPE_SYSTEM:
|
||||
return R.layout.activity_msg_message;
|
||||
}
|
||||
return R.layout.activity_msg_chat;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
ConversationFragment conversationFragment = new ChatMessageFragment();
|
||||
|
||||
|
||||
ConversationFragment conversationFragment;
|
||||
switch (model) {
|
||||
case SystemMessageBean.TYPE_SYSTEM:
|
||||
conversationFragment = new SystemMessageFragment();
|
||||
initSystemMessage();
|
||||
break;
|
||||
default:
|
||||
conversationFragment = new ChatMessageFragment();
|
||||
initChat();
|
||||
}
|
||||
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
transaction.commit();
|
||||
|
||||
}
|
||||
|
||||
private void initSystemMessage() {
|
||||
titleBar = findViewById(R.id.include);
|
||||
callService=findViewById(R.id.call_service);
|
||||
titleBar.setVisibility(View.VISIBLE);
|
||||
setTitle(noticeBean.getTitle());
|
||||
callService.setOnClickListener(v -> {
|
||||
String value = SpUtil.getStringValue("customerService");
|
||||
if(!StringUtil.isEmpty(value)) {
|
||||
OfficialNoticeBean service=JSONObject.parseObject(value, OfficialNoticeBean.class);
|
||||
RouteUtil.forwardZhuangBanActivity(service.getTitle(),service.getLink());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initChat() {
|
||||
avatar = findViewById(R.id.avatar);
|
||||
uname = findViewById(R.id.user_name);
|
||||
sign = findViewById(R.id.signature);
|
||||
sex = findViewById(R.id.sex);
|
||||
status = findViewById(R.id.status);
|
||||
home = findViewById(R.id.home);
|
||||
follow = findViewById(R.id.follow);
|
||||
targetId = getIntent().getStringExtra("targetId");
|
||||
updateUserInfo();
|
||||
follow.setOnClickListener(v -> {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void updateUserInfo() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getTargetUserInfo(Integer.parseInt(targetId), new HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
ImgLoader.display(mContext, data.getUser().getAvatar(), avatar);
|
||||
uname.setText(data.getUser().getUserNicename());
|
||||
sign.setText(data.getUser().getSignature());
|
||||
if (data.getUser().getSex() == 1) {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_man);
|
||||
} else {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_woman);
|
||||
}
|
||||
|
||||
switch (Integer.parseInt(data.getUser().getOnline())) {
|
||||
case 0:
|
||||
status.setImageResource(R.mipmap.ic_message_msg_status_online);
|
||||
break;
|
||||
case 2:
|
||||
status.setImageResource(R.mipmap.ic_message_msg_status_busy);
|
||||
break;
|
||||
default:
|
||||
status.setImageResource(R.mipmap.ic_message_msg_status_offline);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ public class MsgMoreGreetConfigActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
System.out.println("file = " + file.getAbsolutePath());
|
||||
System.out.println("file.exists() = " + file.exists());
|
||||
OTONetManager.getInstance(mContext)
|
||||
.updateFile(file, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
@ -188,7 +190,15 @@ public class MsgMoreGreetConfigActivity extends AbsOTOActivity {
|
||||
.getMessageMoreGreetConfig(new HttpCallback<List<GreetBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<GreetBean> data) {
|
||||
adapter.setList(data);
|
||||
List<GreetBean> list=new ArrayList<>();
|
||||
for (GreetBean item : data) {
|
||||
if(item.getType()==0){
|
||||
list.add(item);
|
||||
}else if(item.getType()==2){
|
||||
ImgLoader.display(mContext,item.getContent(), (ImageView) findViewById(R.id.imageView5));
|
||||
}
|
||||
}
|
||||
adapter.setList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,23 +4,38 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
|
||||
public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.ViewHolder>{
|
||||
private Context mContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.ViewHolder> {
|
||||
private Context mContext;
|
||||
private List<HomeItemBean> list;
|
||||
|
||||
public HomeHotListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
list = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
public void setList(List<HomeItemBean> list) {
|
||||
this.list = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_hot,parent,false));
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_hot, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,14 +45,31 @@ public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 10;
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private RoundedImageView cover;
|
||||
private ImageView status;
|
||||
private ImageView chat;
|
||||
private TextView userName;
|
||||
private ImageView sex;
|
||||
private TextView age;
|
||||
private ImageView levelIcon;
|
||||
private TextView level;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
level=itemView.findViewById(R.id.level);
|
||||
levelIcon=itemView.findViewById(R.id.ic_level);
|
||||
age=itemView.findViewById(R.id.age);
|
||||
sex=itemView.findViewById(R.id.sex);
|
||||
chat=itemView.findViewById(R.id.btn_chat);
|
||||
userName=itemView.findViewById(R.id.user_name);
|
||||
cover=itemView.findViewById(R.id.cover);
|
||||
status=itemView.findViewById(R.id.status);
|
||||
}
|
||||
private void setData(HomeItemBean bean,int position){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,40 +4,106 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.utils.ConversationUtils;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommendListAdapter.ViewHolder>{
|
||||
private Context mContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommendListAdapter.ViewHolder> {
|
||||
private Context mContext;
|
||||
private List<HomeItemBean> list;
|
||||
|
||||
public HomeRecommendListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_recommend,parent,false));
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_recommend, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
holder.setData(list.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 10;
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
public void setList(List<HomeItemBean> data) {
|
||||
this.list = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private RoundedImageView avatar;
|
||||
private ImageView chat;
|
||||
private TextView userName;
|
||||
private ImageView sex;
|
||||
private TextView star;
|
||||
private TextView sign;
|
||||
private LinearLayout tagLayout;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
star = itemView.findViewById(R.id.star_up);
|
||||
sex = itemView.findViewById(R.id.sex);
|
||||
chat = itemView.findViewById(R.id.btn_chat_up);
|
||||
userName = itemView.findViewById(R.id.user_name);
|
||||
avatar = itemView.findViewById(R.id.avatar);
|
||||
tagLayout = itemView.findViewById(R.id.user_tag_layout);
|
||||
sign = itemView.findViewById(R.id.user_sign);
|
||||
}
|
||||
|
||||
private void setData(HomeItemBean bean, int position) {
|
||||
star.setText(bean.getStar() + "·" + bean.getStar_name());
|
||||
sign.setText(bean.getSignature());
|
||||
userName.setText(bean.getUser_nicename());
|
||||
if (WordUtil.isNewZh()) {
|
||||
addTag(bean.getCn_label());
|
||||
} else {
|
||||
addTag(bean.getEn_label());
|
||||
}
|
||||
if (bean.getSex() == 1) {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_man);
|
||||
} else {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_woman);
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getAvatar(), avatar);
|
||||
chat.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ConversationUtils.startConversation(mContext, bean.getId() + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addTag(List<String> tags) {
|
||||
for (String tag : tags) {
|
||||
if (StringUtil.isEmpty(tag)) {
|
||||
continue;
|
||||
}
|
||||
TextView tagView = (TextView) LayoutInflater.from(mContext).inflate(R.layout.item_home_recommend_tag, (ViewGroup) itemView.getRootView(), false);
|
||||
tagView.setText(tag);
|
||||
tagLayout.addView(tagView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import io.rong.imlib.model.Conversation;
|
||||
*/
|
||||
public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
List<BaseUiConversation> conversationList = null;
|
||||
Map<Integer,BaseUiConversation> map = new HashMap<>();
|
||||
Map<Integer, SingleConversation> map = new HashMap<>();
|
||||
|
||||
SwipeRecyclerView mList;
|
||||
|
||||
@ -38,9 +38,9 @@ public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
String targetId = getData().get(position).mCore.getTargetId();
|
||||
try {
|
||||
int type=Integer.parseInt(targetId);
|
||||
int type = Integer.parseInt(targetId);
|
||||
mList.setSwipeItemMenuEnabled(position, type > 100);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
super.onBindViewHolder(holder, position);
|
||||
@ -52,6 +52,14 @@ public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
List<BaseUiConversation> top = new ArrayList<>();
|
||||
List<BaseUiConversation> data2 = new ArrayList<>();
|
||||
for (BaseUiConversation datum : data) {
|
||||
try {
|
||||
int parseInt = Integer.parseInt(datum.mCore.getTargetId());
|
||||
if (parseInt < 100) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (datum.mCore.getConversationType() == Conversation.ConversationType.PRIVATE || datum.mCore.getConversationType() == Conversation.ConversationType.SYSTEM) {
|
||||
if (datum.mCore.isTop()) {
|
||||
top.add(datum);
|
||||
@ -62,7 +70,7 @@ public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
}
|
||||
List<BaseUiConversation> list = new ArrayList<>(top);
|
||||
data2.addAll(map.values());
|
||||
Collections.sort(data2,new ListComparator());
|
||||
Collections.sort(data2, new ListComparator());
|
||||
list.addAll(data2);
|
||||
|
||||
super.setDataCollection(list);
|
||||
@ -70,21 +78,25 @@ public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
|
||||
|
||||
public void add(SingleConversation item, int position) {
|
||||
map.put(position,item);
|
||||
map.put(position, item);
|
||||
}
|
||||
|
||||
public void clearSystemNotification(){
|
||||
public void clearSystemNotification() {
|
||||
for (BaseUiConversation conversation : map.values()) {
|
||||
conversation.mCore.setUnreadMessageCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
public SingleConversation getSystemItem(int position) {
|
||||
return map.get(position);
|
||||
}
|
||||
|
||||
private class ListComparator implements Comparator<BaseUiConversation> {
|
||||
|
||||
@Override
|
||||
public int compare(BaseUiConversation baseUiConversation, BaseUiConversation t1) {
|
||||
System.out.println(" "+t1.mCore.getSentTime()+"|"+baseUiConversation.mCore.getSentTime()+" "+baseUiConversation.mCore.getConversationTitle()+"|"+t1.mCore.getConversationTitle());
|
||||
return (int) (t1.mCore.getSentTime()-baseUiConversation.mCore.getSentTime());
|
||||
System.out.println(" " + t1.mCore.getSentTime() + "|" + baseUiConversation.mCore.getSentTime() + " " + baseUiConversation.mCore.getConversationTitle() + "|" + t1.mCore.getConversationTitle());
|
||||
return (int) (t1.mCore.getSentTime() - baseUiConversation.mCore.getSentTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
299
OneToOne/src/main/java/com/shayu/onetoone/bean/HomeItemBean.java
Normal file
@ -0,0 +1,299 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeItemBean extends BaseModel {
|
||||
private int id;
|
||||
private String label_id;
|
||||
private List<String> cn_label;
|
||||
private List<String> en_label;
|
||||
private int first_mate;
|
||||
private long create_time;
|
||||
private long update_time;
|
||||
private int sex;
|
||||
private int b_y;
|
||||
private int b_ym;
|
||||
private int b_ymd;
|
||||
private int name_auth;
|
||||
private long name_auth_time;
|
||||
private String auth_front;
|
||||
private String auth_back;
|
||||
private String auth_remark;
|
||||
private int sage_auth;
|
||||
private long sage_auth_time;
|
||||
private int is_hot;
|
||||
private String vodie_price;
|
||||
private String price;
|
||||
private int star;
|
||||
private String area;
|
||||
private int is_hello;
|
||||
private int online;
|
||||
private String user_nicename;
|
||||
private String avatar;
|
||||
private String avatar_thumb;
|
||||
private String birthday;
|
||||
private String signature;
|
||||
private String star_name;
|
||||
private int age;
|
||||
|
||||
public HomeItemBean() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel_id() {
|
||||
return label_id;
|
||||
}
|
||||
|
||||
public void setLabel_id(String label_id) {
|
||||
this.label_id = label_id;
|
||||
}
|
||||
|
||||
public List<String> getCn_label() {
|
||||
return cn_label;
|
||||
}
|
||||
|
||||
public void setCn_label(List<String> cn_label) {
|
||||
this.cn_label = cn_label;
|
||||
}
|
||||
|
||||
public List<String> getEn_label() {
|
||||
return en_label;
|
||||
}
|
||||
|
||||
public void setEn_label(List<String> en_label) {
|
||||
this.en_label = en_label;
|
||||
}
|
||||
|
||||
public int getFirst_mate() {
|
||||
return first_mate;
|
||||
}
|
||||
|
||||
public void setFirst_mate(int first_mate) {
|
||||
this.first_mate = first_mate;
|
||||
}
|
||||
|
||||
public long getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(long create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
public long getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(long update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public int getB_y() {
|
||||
return b_y;
|
||||
}
|
||||
|
||||
public void setB_y(int b_y) {
|
||||
this.b_y = b_y;
|
||||
}
|
||||
|
||||
public int getB_ym() {
|
||||
return b_ym;
|
||||
}
|
||||
|
||||
public void setB_ym(int b_ym) {
|
||||
this.b_ym = b_ym;
|
||||
}
|
||||
|
||||
public int getB_ymd() {
|
||||
return b_ymd;
|
||||
}
|
||||
|
||||
public void setB_ymd(int b_ymd) {
|
||||
this.b_ymd = b_ymd;
|
||||
}
|
||||
|
||||
public int getName_auth() {
|
||||
return name_auth;
|
||||
}
|
||||
|
||||
public void setName_auth(int name_auth) {
|
||||
this.name_auth = name_auth;
|
||||
}
|
||||
|
||||
public long getName_auth_time() {
|
||||
return name_auth_time;
|
||||
}
|
||||
|
||||
public void setName_auth_time(long name_auth_time) {
|
||||
this.name_auth_time = name_auth_time;
|
||||
}
|
||||
|
||||
public String getAuth_front() {
|
||||
return auth_front;
|
||||
}
|
||||
|
||||
public void setAuth_front(String auth_front) {
|
||||
this.auth_front = auth_front;
|
||||
}
|
||||
|
||||
public String getAuth_back() {
|
||||
return auth_back;
|
||||
}
|
||||
|
||||
public void setAuth_back(String auth_back) {
|
||||
this.auth_back = auth_back;
|
||||
}
|
||||
|
||||
public String getAuth_remark() {
|
||||
return auth_remark;
|
||||
}
|
||||
|
||||
public void setAuth_remark(String auth_remark) {
|
||||
this.auth_remark = auth_remark;
|
||||
}
|
||||
|
||||
public int getSage_auth() {
|
||||
return sage_auth;
|
||||
}
|
||||
|
||||
public void setSage_auth(int sage_auth) {
|
||||
this.sage_auth = sage_auth;
|
||||
}
|
||||
|
||||
public long getSage_auth_time() {
|
||||
return sage_auth_time;
|
||||
}
|
||||
|
||||
public void setSage_auth_time(long sage_auth_time) {
|
||||
this.sage_auth_time = sage_auth_time;
|
||||
}
|
||||
|
||||
public int getIs_hot() {
|
||||
return is_hot;
|
||||
}
|
||||
|
||||
public void setIs_hot(int is_hot) {
|
||||
this.is_hot = is_hot;
|
||||
}
|
||||
|
||||
public String getVodie_price() {
|
||||
return vodie_price;
|
||||
}
|
||||
|
||||
public void setVodie_price(String vodie_price) {
|
||||
this.vodie_price = vodie_price;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) {
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public int getIs_hello() {
|
||||
return is_hello;
|
||||
}
|
||||
|
||||
public void setIs_hello(int is_hello) {
|
||||
this.is_hello = is_hello;
|
||||
}
|
||||
|
||||
public int getOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setOnline(int online) {
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatar_thumb() {
|
||||
return avatar_thumb;
|
||||
}
|
||||
|
||||
public void setAvatar_thumb(String avatar_thumb) {
|
||||
this.avatar_thumb = avatar_thumb;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getStar_name() {
|
||||
return star_name;
|
||||
}
|
||||
|
||||
public void setStar_name(String star_name) {
|
||||
this.star_name = star_name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ public class OfficialNoticeBean extends BaseModel {
|
||||
String link;
|
||||
int type;
|
||||
|
||||
|
||||
public OfficialNoticeBean() {
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,130 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SystemMessageBean extends BaseModel {
|
||||
public static final int TYPE_ACTIVITY=1;
|
||||
public static final int TYPE_INTERACTION=2;
|
||||
public static final int TYPE_SYSTEM=4;
|
||||
|
||||
private int id;
|
||||
private String title;
|
||||
private String banner;
|
||||
private String link;
|
||||
private String user_nicename;
|
||||
private String avatar;
|
||||
private String avatar_thumb;
|
||||
private int uid;
|
||||
private int dynamic_id;
|
||||
private String to_comment_id;
|
||||
private String content;
|
||||
private int type;
|
||||
private long addtime;
|
||||
|
||||
public SystemMessageBean() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getBanner() {
|
||||
return banner;
|
||||
}
|
||||
|
||||
public void setBanner(String banner) {
|
||||
this.banner = banner;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatar_thumb() {
|
||||
return avatar_thumb;
|
||||
}
|
||||
|
||||
public void setAvatar_thumb(String avatar_thumb) {
|
||||
this.avatar_thumb = avatar_thumb;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getDynamic_id() {
|
||||
return dynamic_id;
|
||||
}
|
||||
|
||||
public void setDynamic_id(int dynamic_id) {
|
||||
this.dynamic_id = dynamic_id;
|
||||
}
|
||||
|
||||
public String getTo_comment_id() {
|
||||
return to_comment_id;
|
||||
}
|
||||
|
||||
public void setTo_comment_id(String to_comment_id) {
|
||||
this.to_comment_id = to_comment_id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public long getAddtime() {
|
||||
return addtime;
|
||||
}
|
||||
|
||||
public void setAddtime(long addtime) {
|
||||
this.addtime = addtime;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
public class TargetUserInfoBean {
|
||||
private String user_nicename;
|
||||
private String avatar;
|
||||
private String avatar_thumb;
|
||||
private int sex;
|
||||
private String signature;
|
||||
private int id;
|
||||
|
||||
public TargetUserInfoBean() {
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatar_thumb() {
|
||||
return avatar_thumb;
|
||||
}
|
||||
|
||||
public void setAvatar_thumb(String avatar_thumb) {
|
||||
this.avatar_thumb = avatar_thumb;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -4,10 +4,14 @@ import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.GreetBean;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.bean.TargetUserInfoBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.network.API;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@ -20,6 +24,8 @@ import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -87,6 +93,7 @@ public class OTONetManager {
|
||||
if (callback != null) {
|
||||
IMLoginModel userInfo = liveGiftBeanResponseModel.getData().getInfo().getUser();
|
||||
UserInfo info = new UserInfo(userInfo.getId() + "", userInfo.getUserNicename(), Uri.parse(userInfo.getAvatar()));
|
||||
info.setExtra(JSONObject.toJSONString(userInfo));
|
||||
RongUserInfoManager.getInstance().refreshUserInfoCache(info);
|
||||
callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo());
|
||||
}
|
||||
@ -399,6 +406,127 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getTargetUserInfoList(List<Integer> ids,HttpCallback<List<TargetUserInfoBean>> callback) {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
for (Integer id : ids) {
|
||||
sb.append(id).append(",");
|
||||
}
|
||||
API.get().otoApi(mContext)
|
||||
.getTargetUserInfoList(sb.toString())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<TargetUserInfoBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<TargetUserInfoBean>> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getTargetUserInfo(int toUid,HttpCallback<UserBean> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getTargetUserInfo(toUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<UserBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<UserBean> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeHot(HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeHot()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<HomeItemBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<HomeItemBean>> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeRecommend(HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeRecommend()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<HomeItemBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<HomeItemBean>> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getSystemMessageList(int type,HttpCallback<List<SystemMessageBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getSystemMessageList(type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SystemMessageBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SystemMessageBean>> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
|
@ -2,8 +2,11 @@ package com.shayu.onetoone.network;
|
||||
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.GreetBean;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.bean.TargetUserInfoBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
@ -90,6 +93,16 @@ public interface OneToOneApi {
|
||||
@GET("/api/public/?service=Message.getLists")
|
||||
Observable<ResponseModel<List<OfficialNoticeBean>>> getLists();
|
||||
|
||||
@GET("/api/public/?service=Friendappinfos.getOtherInfo")
|
||||
Observable<ResponseModel<UserBean>> getTargetUserInfo(@Query("tuid")int id);
|
||||
@GET("/api/public/?service=Friendappinfos.getOtherList")
|
||||
Observable<ResponseModel<List<TargetUserInfoBean>>> getTargetUserInfoList(@Query("ids")String ids);
|
||||
@GET("/api/public/?service=Friendappuser.hot")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeHot();
|
||||
@GET("/api/public/?service=Friendappuser.recommend")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeRecommend();
|
||||
@GET("/api/public/?service=Message.getListInfo")
|
||||
Observable<ResponseModel<List<SystemMessageBean>>> getSystemMessageList(@Query("type")int type);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,13 +30,19 @@ public class CustomConversationProvider extends BaseConversationProvider {
|
||||
if (userInfo != null) {
|
||||
JSONObject json = JSONObject.parseObject(userInfo.getExtra());
|
||||
holder.getView(R.id.sex).setVisibility(View.VISIBLE);
|
||||
if (json.getInteger("sex") == -1) {
|
||||
try {
|
||||
if (json.getInteger("sex") == -1) {
|
||||
holder.getView(R.id.sex).setVisibility(View.GONE);
|
||||
} else if (json.getInteger("sex") == 2) {
|
||||
holder.setImageResource(R.id.sex, R.mipmap.ic_message_tab_woman);
|
||||
} else {
|
||||
holder.setImageResource(R.id.sex, R.mipmap.ic_message_tab_man);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
holder.getView(R.id.sex).setVisibility(View.GONE);
|
||||
} else if (json.getInteger("sex") == 0) {
|
||||
holder.setImageResource(R.id.sex, R.mipmap.ic_message_tab_woman);
|
||||
} else {
|
||||
holder.setImageResource(R.id.sex, R.mipmap.ic_message_tab_man);
|
||||
}
|
||||
|
||||
}
|
||||
super.bindViewHolder(holder, uiConversation, position, list, listener);
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.shayu.onetoone.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import io.rong.imkit.utils.RouteUtils;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.ConversationIdentifier;
|
||||
|
||||
public class ConversationUtils {
|
||||
public static void startConversation(Context mContext,String targetId){
|
||||
ConversationIdentifier conversationIdentifier = new ConversationIdentifier(Conversation.ConversationType.PRIVATE, targetId);
|
||||
RouteUtils.routeToConversationActivity(mContext, conversationIdentifier, false, new Bundle());
|
||||
}
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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_marginTop="26dp"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="26dp">
|
||||
|
||||
<include
|
||||
android:id="@+id/include2"
|
||||
|
42
OneToOne/src/main/res/layout/activity_msg_message.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="26dp">
|
||||
|
||||
<include
|
||||
android:id="@+id/include"
|
||||
layout="@layout/view_activity_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="71dp"
|
||||
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/call_service"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/include">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/call_service"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#8E7DDF"
|
||||
android:text="聯繫客服"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
16
OneToOne/src/main/res/layout/item_home_recommend_tag.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
tools:text="166CM"
|
||||
android:id="@+id/tag"
|
||||
android:layout_marginStart="7dp"
|
||||
android:padding="3dp"
|
||||
android:paddingStart="7dp"
|
||||
android:paddingEnd="7dp"
|
||||
android:textSize="10sp"
|
||||
android:textColor="#888888"
|
||||
android:background="@drawable/bg_home_recommend_tag"
|
||||
android:layout_height="19dp">
|
||||
|
||||
</TextView>
|
@ -13,7 +13,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@mipmap/ic_msg_audio"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@ -23,13 +25,14 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="6.5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/rc_ext_panel_editbox_background"
|
||||
android:hint="輸入信息"
|
||||
android:maxLines="4"
|
||||
android:textColorHint="#BDBDBD"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/input_panel_emoji_btn"
|
||||
app:layout_constraintStart_toEndOf="@+id/input_panel_voice_toggle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -43,16 +46,17 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="6.5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
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_toTopOf="@+id/linearLayout2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/input_panel_emoji_btn"
|
||||
app:layout_constraintStart_toEndOf="@+id/input_panel_voice_toggle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="gone" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/input_panel_emoji_btn"
|
||||
@ -60,7 +64,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6.5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:src="@mipmap/ic_msg_emoji"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/input_panel_add_or_send"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@ -68,10 +74,11 @@
|
||||
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"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_marginBottom="12dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/input_panel_send_btn"
|
||||
android:layout_width="0dp"
|
||||
@ -85,6 +92,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/send_btn"
|
||||
android:layout_width="wrap_content"
|
||||
@ -101,16 +109,15 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/audio_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/input_panel_add_or_send">
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/input_panel_image_btn"
|
||||
@ -153,4 +160,14 @@
|
||||
android:src="@mipmap/ic_msg_add" />
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/audio_layout"
|
||||
layout="@layout/view_message_input_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="190dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
48
OneToOne/src/main/res/layout/view_message_input_audio.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="190dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_btn"
|
||||
android:layout_width="85dp"
|
||||
android:layout_height="85dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:src="@mipmap/ic_chat_video_btn" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/text_btn"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="61dp"
|
||||
android:layout_marginBottom="62dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/audio_btn"
|
||||
app:layout_constraintEnd_toStartOf="@+id/audio_btn"
|
||||
app:srcCompat="@mipmap/ic_chat_video_text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="61dp"
|
||||
android:layout_marginBottom="62dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/audio_btn"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_btn"
|
||||
app:srcCompat="@mipmap/ic_chat_video_close" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time_text"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="TextView"
|
||||
app:layout_constraintBottom_toTopOf="@+id/audio_btn"
|
||||
app:layout_constraintEnd_toEndOf="@+id/audio_btn"
|
||||
app:layout_constraintStart_toStartOf="@+id/audio_btn" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -128,10 +128,11 @@
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:src="@mipmap/ic_message_msg_status" />
|
||||
android:src="@mipmap/ic_message_msg_status_online" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -144,6 +145,8 @@
|
||||
android:id="@+id/star_up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:background="@mipmap/bg_message_msg_title_heartbeat"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3dp"
|
||||
@ -168,10 +171,12 @@
|
||||
android:background="@drawable/ic_message_msg_bar_decorate" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_sign"
|
||||
android:id="@+id/signature"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="TextView"
|
||||
android:textColor="#888888"
|
||||
android:textSize="12sp" />
|
||||
|
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ic_chat_video_btn.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ic_chat_video_close.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ic_chat_video_text.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@ -257,6 +257,16 @@ public class IMLoginModel extends BaseModel {
|
||||
private String guardType = "";
|
||||
@SerializedName("need_bind")
|
||||
int needBind;
|
||||
@SerializedName("online")
|
||||
private String online ;
|
||||
|
||||
public String getOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setOnline(String online) {
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
public int getNeedBind() {
|
||||
return needBind;
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@ -101,10 +104,10 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
mAlumbResultCallback = new ActivityResultCallback() {
|
||||
@Override
|
||||
public void onSuccess(Intent intent) {
|
||||
if(mNeedCrop) {
|
||||
if (mNeedCrop) {
|
||||
crop(intent.getData());
|
||||
}else{
|
||||
mResultCallback.onSuccess(new File(intent.getData().toString()));
|
||||
} else {
|
||||
mResultCallback.onSuccess(new File(getFilePathForUri(mContext,intent.getData())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,6 +152,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
public void getImageByAlumb() {
|
||||
getImageByAlumb(true);
|
||||
}
|
||||
|
||||
public void getImageByAlumb(boolean needCrop) {
|
||||
mNeedCrop = needCrop;
|
||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||
@ -243,6 +247,65 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
mResultCallback = resultCallback;
|
||||
}
|
||||
|
||||
private static String getFilePathForUri(Context context, Uri uri) {
|
||||
String filePath = null;
|
||||
if (DocumentsContract.isDocumentUri(context, uri)) {
|
||||
// 如果是document类型的 uri, 则通过document id来进行处理
|
||||
String documentId = DocumentsContract.getDocumentId(uri);
|
||||
if (isMediaDocument(uri)) { // MediaProvider
|
||||
// 使用':'分割
|
||||
String id = documentId.split(":")[1];
|
||||
String selection = MediaStore.Images.Media._ID + "=?";
|
||||
String[] selectionArgs = {id};
|
||||
filePath = getDataColumn(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection, selectionArgs);
|
||||
} else if (isDownloadsDocument(uri)) { // DownloadsProvider
|
||||
Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(documentId));
|
||||
filePath = getDataColumn(context, contentUri, null, null);
|
||||
}
|
||||
} else if ("content".equalsIgnoreCase(uri.getScheme())) {
|
||||
// 如果是 content 类型的 Uri
|
||||
filePath = getDataColumn(context, uri, null, null);
|
||||
} else if ("file".equals(uri.getScheme())) {
|
||||
// 如果是 file 类型的 Uri,直接获取图片对应的路径
|
||||
filePath = uri.getPath();
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
|
||||
String path = null;
|
||||
String[] projection = new String[]{MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(projection[0]);
|
||||
path = cursor.getString(columnIndex);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri the Uri to check
|
||||
* @return Whether the Uri authority is MediaProvider
|
||||
*/
|
||||
private static boolean isMediaDocument(Uri uri) {
|
||||
return "com.android.providers.media.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri the Uri to check
|
||||
* @return Whether the Uri authority is DownloadsProvider
|
||||
*/
|
||||
private static boolean isDownloadsDocument(Uri uri) {
|
||||
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
super.release();
|
||||
|