发现萌新-打招呼-消息列表
This commit is contained in:
@@ -93,6 +93,7 @@ import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderAudioParty;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderContent;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderGift;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderHello;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLevel;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLottery;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderOnline;
|
||||
@@ -143,6 +144,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.LevelUpAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.LotteryAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NobleAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NoticeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
||||
@@ -393,6 +395,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
NimUIKit.registerMsgItemViewHolder(GiftAttachment.class, MsgViewHolderGift.class);
|
||||
NimUIKit.registerMsgItemViewHolder(NoticeAttachment.class, MsgViewHolderContent.class);
|
||||
NimUIKit.registerMsgItemViewHolder(RedPacketAttachment.class, MsgViewHolderRedPacket.class);
|
||||
NimUIKit.registerMsgItemViewHolder(NewbieHelloAttachment.class, MsgViewHolderHello.class);
|
||||
NimUIKit.registerMsgItemViewHolder(LotteryAttachment.class, MsgViewHolderLottery.class);
|
||||
NimUIKit.registerMsgItemViewHolder(NobleAttachment.class, MsgViewHolderText.class);
|
||||
NimUIKit.registerMsgItemViewHolder(CarAttachment.class, MsgViewHolderText.class);
|
||||
|
@@ -1138,15 +1138,14 @@ public abstract class BaseMvpActivity<V extends IMvpBaseView, P extends Abstract
|
||||
int gender = helloInfo.getGender();
|
||||
String nick = helloInfo.getNick();
|
||||
String avatar = helloInfo.getAvatar();
|
||||
long inRoomUid = helloInfo.getInRoomUid();
|
||||
getDialogManager().showNewbieHelloDialog(avatar,gender,nick, message, "去找TA", "忽略", true, new DialogManager.OkCancelDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
if (inRoomUid == 0){
|
||||
// NimP2PMessageActivity.start(context, uid);
|
||||
if (helloInfo.getInRoomUid() == 0){
|
||||
NimP2PMessageActivity.start(context, helloInfo.getUid());
|
||||
return;
|
||||
}
|
||||
AVRoomActivity.start(context,inRoomUid);
|
||||
AVRoomActivity.start(context,helloInfo.getInRoomUid());
|
||||
}
|
||||
},context);
|
||||
}
|
||||
|
@@ -0,0 +1,50 @@
|
||||
package com.yizhuan.erban.ui.im.chat;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2018/1/2.
|
||||
*/
|
||||
|
||||
public class MsgViewHolderHello extends MsgViewHolderBase implements View.OnClickListener{
|
||||
private TextView content;
|
||||
private long inRoomUid;
|
||||
|
||||
public MsgViewHolderHello(BaseMultiItemFetchLoadAdapter adapter) {
|
||||
super(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentResId() {
|
||||
return R.layout.layout_msg_view_holder_hello;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inflateContentView() {
|
||||
content = findViewById(R.id.content);
|
||||
content.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindContentView() {
|
||||
NewbieHelloAttachment attachment = (NewbieHelloAttachment) message.getAttachment();
|
||||
inRoomUid = attachment.getNewbieHelloInfo().getInRoomUid();
|
||||
content.setText(attachment.getNewbieHelloInfo().getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (inRoomUid == 0)return;
|
||||
AVRoomActivity.start(context,inRoomUid);
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
package com.yizhuan.erban.ui.im.chat;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/9/21.
|
||||
*/
|
||||
|
||||
public class MsgViewHolderNoti {
|
||||
}
|
@@ -13,6 +13,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.google.gson.Gson;
|
||||
@@ -36,6 +37,7 @@ import com.yizhuan.erban.team.view.NimTeamMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.recent.adapter.AttentionInRoomAdapter;
|
||||
import com.yizhuan.erban.ui.relation.AttentionListActivity;
|
||||
import com.yizhuan.erban.ui.widget.RecallDialog;
|
||||
import com.yizhuan.tutu.mentoring_relationship.adapter.GrabApprenticesAdapter;
|
||||
import com.yizhuan.tutu.room_chat.activity.NimHallTeamRoomMessageActivity;
|
||||
import com.yizhuan.tutu.room_chat.activity.NimRoomP2PMessageActivity;
|
||||
@@ -49,6 +51,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldThirdLevelAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NobleAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NoticeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RedPacketAttachment;
|
||||
@@ -65,6 +68,7 @@ import com.yizhuan.xchat_android_core.user.AttentionModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.AttentionInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.AttentionItem;
|
||||
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_library.utils.CommonUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
@@ -94,6 +98,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_GAME;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MODULE_HALL;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_NEWBIE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_PUBLIC_CHAT_HALL;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
||||
@@ -115,6 +120,8 @@ public class RecentListFragment extends BaseFragment {
|
||||
|
||||
private static final String TAG = "RecentListFragment";
|
||||
|
||||
private final String share_pref_is_newbie_clicked = "share_pref_is_newbie_clicked";
|
||||
|
||||
private RecyclerView grabApprenticesRecyclerView;
|
||||
private GrabApprenticesAdapter grabApprenticesAdapter;
|
||||
|
||||
@@ -124,6 +131,7 @@ public class RecentListFragment extends BaseFragment {
|
||||
private RecyclerView rvAttentionOnline;
|
||||
private AttentionInRoomAdapter mAttentionInRoomAdapter;
|
||||
private FrameLayout flNewbie;
|
||||
private ImageView ivRedPoint;
|
||||
|
||||
public static RecentListFragment newInstance(boolean isInRoom) {
|
||||
|
||||
@@ -204,7 +212,10 @@ public class RecentListFragment extends BaseFragment {
|
||||
}
|
||||
});
|
||||
|
||||
boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false);
|
||||
flNewbie = mView.findViewById(R.id.fl_newbie);
|
||||
ivRedPoint = mView.findViewById(R.id.iv_red_point);
|
||||
ivRedPoint.setVisibility(isClicked?View.GONE:View.VISIBLE);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -241,7 +252,11 @@ public class RecentListFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
flNewbie.setOnClickListener(v -> RoomNewbieActivity.start(getActivity(),false));
|
||||
flNewbie.setOnClickListener(v -> {
|
||||
SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新
|
||||
ivRedPoint.setVisibility(View.GONE);
|
||||
RoomNewbieActivity.start(getActivity(),false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -356,6 +371,8 @@ public class RecentListFragment extends BaseFragment {
|
||||
return ((CarAttachment) attachment).msg;
|
||||
} else if (customAttachment.getFirst() == CUSTOM_MSG_ASSISTANT_MSG) {
|
||||
return ((AssistantAttachment) attachment).title;
|
||||
} else if (customAttachment.getFirst() == CUSTOM_MSG_NEWBIE) {
|
||||
return ((NewbieHelloAttachment) attachment).getNewbieHelloInfo().message;
|
||||
} else if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP) {
|
||||
switch (customAttachment.getSecond()) {
|
||||
case CUSTOM_MSG_SHARE_ROOM:
|
||||
|
17
app/src/main/res/layout/layout_msg_view_holder_hello.xml
Normal file
17
app/src/main/res/layout/layout_msg_view_holder_hello.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="10dp"
|
||||
android:text="恭喜您,获得抽奖机会,点我抽奖>>"
|
||||
android:textColor="@color/text_color_primary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
@@ -30,6 +30,7 @@ import com.yizhuan.erban.ui.im.recent.RecentContactsFragment;
|
||||
import com.yizhuan.erban.ui.im.recent.adapter.RecentContactAdapter;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -278,6 +279,11 @@ public abstract class RoomMsgRecentViewHolder extends RecyclerViewHolder<BaseQui
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_LEVEL_UP:
|
||||
return "[升级信息]";
|
||||
|
||||
case CustomAttachment.CUSTOM_MSG_NEWBIE:
|
||||
NewbieHelloAttachment newbieHelloAttachment = (NewbieHelloAttachment) attachment;
|
||||
return newbieHelloAttachment.getNewbieHelloInfo().message;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.netease.nim.uikit.business.recent.RecentContactsCallback;
|
||||
@@ -36,6 +37,7 @@ import com.yizhuan.xchat_android_core.luckymoney.LuckyMoneyInfo;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.bean.AitMeInfo;
|
||||
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -76,6 +78,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
public class RoomMsgRecentListFragment extends BaseFragment {
|
||||
private RoomMsgRecentContactsFragment recentContactsFragment;
|
||||
private FrameLayout flNewbie;
|
||||
private ImageView ivRedPoint;
|
||||
private final String share_pref_is_newbie_clicked = "share_pref_is_newbie_clicked";
|
||||
|
||||
public static RoomMsgRecentListFragment newInstance() {
|
||||
return new RoomMsgRecentListFragment();
|
||||
@@ -93,12 +97,19 @@ public class RoomMsgRecentListFragment extends BaseFragment {
|
||||
FragmentManager fragmentManager = getChildFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.recent_container, recentContactsFragment).commitAllowingStateLoss();
|
||||
boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false);
|
||||
flNewbie = mView.findViewById(R.id.fl_newbie);
|
||||
ivRedPoint = mView.findViewById(R.id.iv_red_point);
|
||||
ivRedPoint.setVisibility(isClicked?View.GONE:View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
flNewbie.setOnClickListener(v -> RoomNewbieActivity.start(getActivity(),true));
|
||||
flNewbie.setOnClickListener(v -> {
|
||||
SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新
|
||||
ivRedPoint.setVisibility(View.GONE);
|
||||
RoomNewbieActivity.start(getActivity(),false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -159,7 +159,10 @@ public class IMMessageManager {
|
||||
NewbieHelloAttachment newbieHelloAttachment = (NewbieHelloAttachment) msg.getAttachment();
|
||||
NewbieHelloInfo helloInfo = newbieHelloAttachment.getNewbieHelloInfo();
|
||||
if (attachment.getSecond() == CUSTOM_MSG_RECEIV_NEWBIE_HELLO) {
|
||||
EventBus.getDefault().post(new NewbieHelloDialogEvent(helloInfo));
|
||||
String uid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
if (!(Objects.equals(uid, String.valueOf(helloInfo.getUid())))){
|
||||
EventBus.getDefault().post(new NewbieHelloDialogEvent(helloInfo));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -9,4 +9,5 @@ public class NewbieHelloInfo {
|
||||
public int gender;
|
||||
public String message;
|
||||
public long inRoomUid;
|
||||
public String uid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user