From 202c265e716fd26f3d11220c1a0e5163ccc34772 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 26 Jul 2022 16:21:00 +0800 Subject: [PATCH] 11111 --- .../manager/NoviceInstructorManager.java | 5 +-- .../manager/imrongcloud/MessageIMManager.java | 24 ++++++++----- .../com/yunbao/common/utils/RouteUtil.java | 11 ------ config.gradle | 4 +-- .../live/views/InputPanelViewHolder.java | 12 ++++++- .../yunbao/main/activity/MainActivity.java | 23 ++++++++++-- .../ConversationIMListManager.java | 20 ++++++++--- .../yunbao/main/views/MainMeViewHolder.java | 35 ------------------- main/src/main/res/layout/view_homemain.xml | 1 + 9 files changed, 68 insertions(+), 67 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java index 61f54e0f2..eb8b2a60f 100644 --- a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java @@ -68,6 +68,7 @@ public class NoviceInstructorManager extends BaseCacheManager { * 清除相关信息 */ public void removeNoviceInstructor() { + model = null; deleteByKey(KEY_NOVICE_INSTRUCTOR); } @@ -75,9 +76,8 @@ public class NoviceInstructorManager extends BaseCacheManager { * 请求接口获取是否展示 */ public void getNetNoviceInstructor() { - if (null != model) { + if (model != null) netHandler.post(instructorOperationRunnable); - } } /** @@ -87,6 +87,7 @@ public class NoviceInstructorManager extends BaseCacheManager { @Override public void run() { + //展示指引弹窗 EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(true)); } diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java index f38ad18c4..378c4d185 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java @@ -13,6 +13,7 @@ import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import org.greenrobot.eventbus.EventBus; @@ -83,7 +84,7 @@ public class MessageIMManager { * 获取系统消息(有未读数展示红点) */ public void getSystemMessages() { - systemNumber=0; + systemNumber = 0; IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); HttpClient.getInstance().get("Message.getLists", "getImUserInfo") .params("uid", userInfo.getId()) @@ -103,10 +104,10 @@ public class MessageIMManager { //未读消息不为空并且大于0 try { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { - systemNumber = Integer.parseInt(number)+systemNumber; + systemNumber = Integer.parseInt(number) + systemNumber; } } catch (NumberFormatException e) { - systemNumber =systemNumber+ 0; + systemNumber = systemNumber + 0; } } //发送通知 @@ -145,7 +146,7 @@ public class MessageIMManager { * 获取系统消息(有未读数展示红点) */ public void getSystemMessages(SystemMessagesHttpCallback callback) { - systemNumber=0; + systemNumber = 0; IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); HttpClient.getInstance().get("Message.getLists", "getImUserInfo") .params("uid", userInfo.getId()) @@ -168,10 +169,10 @@ public class MessageIMManager { //未读消息不为空并且大于0 try { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { - systemNumber = Integer.parseInt(number)+systemNumber; + systemNumber = Integer.parseInt(number) + systemNumber; } } catch (NumberFormatException e) { - systemNumber = systemNumber+0; + systemNumber = systemNumber + 0; } } //发送通知 @@ -207,8 +208,15 @@ public class MessageIMManager { */ private ConversationClickListener listener = new ConversationClickListener() { @Override - public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String s) { - return false; + public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String targetId) { + IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); + long userId = IMLoginManager.get(context).getUserInfo().getId(); + if (!TextUtils.equals(model.getIsAdmin(), "1") && userId != model.getId()) { + RouteUtil.forwardUserHome(mContext, userInfo.getUserId(), 0); + } else if (userId == model.getId()) { + RouteUtil.forwardUserHome(mContext, userInfo.getUserId(), 2); + } + return true; } @Override diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index f75134248..c81e75990 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -57,17 +57,6 @@ public class RouteUtil { */ public static void forwardUserHome(Context context, String toUid, boolean fromLiveRoom, String fromLiveUid, int intoIndex) { Constants.myIntoIndex = 2; -// if (intoIndex == 2) { -// ARouter.getInstance().build(PATH_USER_HOME) -// .withString(Constants.TO_UID, toUid) -// .withBoolean(Constants.FROM_LIVE_ROOM, fromLiveRoom) -// .withString(Constants.LIVE_UID, fromLiveUid) -// .navigation(); - -// WebViewActivity.forward(context, HtmlConfig.PERSONAL + "?touid=" + toUid + "&&isHomePage=1" + "&&fromType=0"); -// } else { -// WebViewActivity.forward(context, HtmlConfig.PERSONAL + "?touid=" + toUid + "&&isHomePage=1" + "&&fromType=0"); -// } forwardMainUserHome(context, toUid, fromLiveRoom, fromLiveUid, intoIndex); } diff --git a/config.gradle b/config.gradle index eddca7244..53e2161f5 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java index cfe4b4941..499c9e6ab 100644 --- a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java @@ -16,12 +16,15 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.FileUtil; import com.yunbao.common.utils.TimeUtils; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.utils.FileSizeUtil; +import org.greenrobot.eventbus.EventBus; + import io.rong.imkit.IMCenter; import io.rong.imlib.IRongCallback; import io.rong.imlib.RongIMClient; @@ -160,7 +163,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi } else { ToastUtil.show("不可以发送空消息"); } - + //发送以后删除相应标志 + NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); } private TextWatcher mEditTextWatcher = new TextWatcher() { @@ -235,6 +239,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi } }); + //发送以后删除相应标志 + NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); } public void sendVideoFile(String filePath) { @@ -293,6 +299,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi ToastUtil.show(errorCode.msg); } });// + //发送以后删除相应标志 + NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); } /** @@ -337,6 +345,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi ToastUtil.show(errorCode.msg); } }); + //发送以后删除相应标志 + NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); } /** diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index d7b396e37..fc60865b1 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -46,6 +46,7 @@ import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveSvgGiftBean; +import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.bean.UpdataListBean; import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.event.MessageIMEvent; @@ -56,6 +57,7 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; @@ -354,7 +356,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mViewPager.setCurrentItem(0); mTabButtonGroup.setCurPosition(0); isInstructor(); - + //测试代码要删除 + NoviceInstructorManager.get(this).setNoviceInstructor(new NoviceInstructorModel()); } @@ -578,7 +581,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mTabButtonGroup.setCurPosition(Constants.isShowPage); } Constants.isShowPage = -1; - + //获取用户面向指导员的操作 + NoviceInstructorManager.get(this).getNetNoviceInstructor(); } /** @@ -1022,7 +1026,20 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene boolean isShowHomeIcon = event.isShowHomeIcon(); if (isShowHomeIcon) { - + waitingTip.setVisibility(View.VISIBLE); + //跳转消息中心 + waitingTip.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //跳转消息列表 + Bundle bundle = new Bundle(); + bundle.putInt(PDLiveConversationListActivity.MESSAGENUMBER, messageNumber); + bundle.putInt(PDLiveConversationListActivity.NUMBERME, numberMe); + ConversationIMListManager.get(mContext).jumpConversationList(bundle); + } + }); + }else { + waitingTip.setVisibility(View.GONE); } } diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index e503a801b..319429288 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -11,9 +11,12 @@ import android.view.View; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.google.gson.Gson; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.InstructorRemarkManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.activity.PDLIiveChatActivity; import com.yunbao.live.activity.PDLiveConversationActivity; import com.yunbao.live.bean.SearchUserBean; @@ -109,9 +112,9 @@ public class ConversationIMListManager { * @param targetId 用户id */ public void jumpConversation(Activity context, String targetId) { - if (context instanceof PDLIiveChatActivity) { - context.finish(); - } + if (context instanceof PDLIiveChatActivity) { + context.finish(); + } Conversation.ConversationType type = Conversation.ConversationType.PRIVATE; RouteUtils.routeToConversationActivity(context, type, targetId, null); } @@ -151,8 +154,15 @@ public class ConversationIMListManager { private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() { @Override - public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String s) { - return false; + public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) { + //非指导员都可以点击 + UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId); + IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); + if (!TextUtils.equals(model.getIsAdmin(),"1")){ + RouteUtil.forwardUserHome(mContext, targetId, 0); + } + + return true; } @Override diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 54d3abdff..704dedf6d 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -132,36 +132,20 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi tv_level = (TextView) findViewById(R.id.tv_level); good_nub_ico = (ImageView) findViewById(R.id.good_nub_ico); mID = (TextView) findViewById(R.id.id_val); -// mFollow = (TextView) findViewById(R.id.btn_follow); -// mFans = (TextView) findViewById(R.id.btn_fans); signature = (TextView) findViewById(R.id.signature); coin = (TextView) findViewById(R.id.coin); star_coin = (TextView) findViewById(R.id.star_coin); gold = (TextView) findViewById(R.id.gold); btnCopy = (TextView) findViewById(R.id.btn_copy); -// btnUserNoble = (LinearLayout) findViewById(R.id.btn_user_noble); user_noble_text = (TextView) findViewById(R.id.user_noble_text); - -// img_kefu = (ImageView) findViewById(R.id.img_kefu); img_setting = (ImageView) findViewById(R.id.img_setting); -// rt_kefu = (RelativeLayout) findViewById(R.id.rt_kefu); -// rt_setting = (RelativeLayout) findViewById(R.id.rt_setting); - v_noble = (View) findViewById(R.id.v_noble); lt_noble = (LinearLayout) findViewById(R.id.lt_noble); user_noble_time = (TextView) findViewById(R.id.user_noble_time); - banner_me = (Banner) findViewById(R.id.banner_me); lt_advertisement = (LinearLayout) findViewById(R.id.lt_advertisement); - img_lv_pic = (ImageView) findViewById(R.id.img_lv_pic); - tv_setting = (TextView) findViewById(R.id.tv_setting); - -// mFollow.setOnClickListener(this); -// mFans.setOnClickListener(this); -// findViewById(R.id.btn_edit).setOnClickListener(this); -// findViewById(R.id.btn_msg).setOnClickListener(this); findViewById(R.id.lt_star_coin).setOnClickListener(this); findViewById(R.id.btn_coin).setOnClickListener(this); findViewById(R.id.btn_gold).setOnClickListener(this); @@ -181,14 +165,9 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi Toast.makeText(mContext, "複製成功", Toast.LENGTH_SHORT).show(); } }); -// findViewById(R.id.btn_detail).setOnClickListener(this); -// findViewById(R.id.btn_shop).setOnClickListener(this); mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); mRecyclerView.setHasFixedSize(true); -// mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)); -// EventBus.getDefault().register(this); - banner_me.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { @@ -210,7 +189,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi loadData(); } mPaused = false; -// EventBus.getDefault().unregister(this); } @Override @@ -295,11 +273,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi private List mBannerListNew = new ArrayList<>(); private void showData(UserBean u, List list) { -// if ("0".equals(u.getFront_task())) { -// EventBus.getDefault().post(new UpdateTablePointMe(0)); -// } else { -// EventBus.getDefault().post(new UpdateTablePointMe(1)); -// } mBannerList.clear(); mBannerListNew.clear(); if (!u.getSlide().equals("") && u.getSlide() != null) { @@ -314,7 +287,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } showBanner(); ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar); -// mTtileView.setText(u.getUserNiceName()); mName.setText(u.getUserNiceName()); if (!"0".endsWith(u.getNoble_id())) { user_noble_text.setText(mContext.getResources().getString(R.string.now_noble) + u.getNoble_name()); @@ -323,9 +295,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi user_noble_text.setText(u.getNoble_name()); user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text)); } -// user_noble_time.setText(""); -// mSex.setImageResource(CommonIconUtil.getSexIcon(u.getSex())); - signature.setText(u.getSignature()); CommonAppConfig appConfig = CommonAppConfig.getInstance(); LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor()); @@ -362,7 +331,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi if ("C".equals(u.getUsers_type())) { Constants.isAnchor = true; if (anchorLevelBean != null) { -// ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevelAnchor); ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevel); ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic); //主播等级 @@ -399,8 +367,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi good_nub_ico.setVisibility(View.GONE); mID.setText(u.getLiangNameTip()); } -// mFollow.setText("" + u.getFollows()); -// mFans.setText("" + u.getFans()); if (list != null && list.size() > 0) { List listNow = new ArrayList<>(); for (UserItemBean userItemBean : list) { @@ -421,7 +387,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } } if (beanKefu != null) { -// ImgLoader.display(mContext, beanKefu.getThumb(), img_kefu); } if (beanStetting != null) { ImgLoader.display(mContext, beanStetting.getThumb(), img_setting); diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index fda0ea433..7f1d29526 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -162,6 +162,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:clickable="true" + android:visibility="gone" android:layout_marginStart="57dp" android:src="@mipmap/waiting_tip" android:focusable="true" />