diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 43c48853e..8040dbffd 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -17,6 +17,7 @@ import com.yunbao.common.activity.ErrorActivity; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.L; import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.SpUtil; @@ -165,7 +166,7 @@ public class CommonHttpUtil { //或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题 HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG) .params("langue", lang) - .params("version", ""+VersionUtil.getVersion()) + .params("version", "" + VersionUtil.getVersion()) .params("from", "android") .execute(new HttpCallback() { @Override @@ -185,6 +186,9 @@ public class CommonHttpUtil { if (commonCallback != null) { commonCallback.callback(bean); } + if (obj.containsKey("is_chat")) { + IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat"))); + } } catch (Exception e) { String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); ErrorActivity.forward("GetConfig接口返回数据异常", error); @@ -336,7 +340,7 @@ public class CommonHttpUtil { .execute(callback); } - public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData,String gps_adid, HttpCallback callback) { + public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, String gps_adid, HttpCallback callback) { HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE) .params("purchaseToken", purchaseToken) .params("orderno", orderNo) @@ -346,7 +350,7 @@ public class CommonHttpUtil { .execute(callback); } - public static void Google_sec_pay(String purchaseToken, String orderNo, String tradeNo,HttpCallback callback) { + public static void Google_sec_pay(String purchaseToken, String orderNo, String tradeNo, HttpCallback callback) { HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay") .params("purchaseToken", purchaseToken) .params("orderno", orderNo) @@ -408,7 +412,7 @@ public class CommonHttpUtil { public static void setAdvertisingChannels(String operation, HttpCallback callback) { HttpClient.getInstance().get("Tx.setAdvertisingChannels", CommonHttpConsts.GET_USER_BASEINFO) .params("operation", operation) - .params("marking", Adjust.getAdid()) + .params("marking", Adjust.getAdid()) .execute(callback); } diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index ea5ee467c..576350fb8 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -29,6 +29,24 @@ public class IMLoginManager extends BaseCacheManager { private final static String isNewUserOne = "isNewUserOne"; private final static String GiftEffect = "giftEffect"; private final static String MountEffect = "mountEffect"; + private final static String IS_CHAT = "isChat"; + + /** + * @param isChat 是否隐藏聊天列表 is_chat 1:开启 0:关闭 + */ + public void initChat(String isChat) { + put(IS_CHAT, isChat); + } + + /** + * 是否隐藏聊天列表 + * + * @return + */ + public boolean hintChat() { + return TextUtils.equals(getString(IS_CHAT), "0"); + } + //暂时缓存token private String token = ""; 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 8d3554fdd..b95bb4e37 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 @@ -74,9 +74,12 @@ public class MessageIMManager { UnReadMessageManager.getInstance().addObserver(conversationTypes, new UnReadMessageManager.IUnReadMessageObserver() { @Override public void onCountChanged(int integer) { - imNumber = integer; - //发送通知 - unreadMessagesHandler.post(essagesRunnable); + if (!IMLoginManager.get(mContext).hintChat()) { + imNumber = integer; + //发送通知 + unreadMessagesHandler.post(essagesRunnable); + } + } }); diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index 91808132f..3fdc0d10b 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -1,14 +1,13 @@ package com.yunbao.live.activity; -import android.net.Uri; import android.os.Bundle; -import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; +import android.widget.LinearLayout; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; @@ -18,12 +17,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.blankj.utilcode.util.GsonUtils; -import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.RouteUtil; @@ -31,7 +26,6 @@ import com.yunbao.live.R; import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.LiveBean; -import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.RecommendLiveRoomEvent; import com.yunbao.live.http.LiveHttpUtil; @@ -45,8 +39,6 @@ import java.util.Collections; import java.util.List; import io.rong.imkit.conversationlist.ConversationListFragment; -import io.rong.imkit.userinfo.RongUserInfoManager; -import io.rong.imlib.model.UserInfo; /** * 直播页面聊天列表 @@ -55,6 +47,7 @@ public class PDLIiveChatActivity extends FragmentActivity { private ConversationListFragment conversationListFragment; private FrameLayout container; private PDLIiveChatActivity mContext; + private LinearLayout ltNodataMsg; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -64,7 +57,7 @@ public class PDLIiveChatActivity extends FragmentActivity { mContext = this; windowColor(); initView(); - initData(); + Bus.getOn(this); } @@ -85,15 +78,26 @@ public class PDLIiveChatActivity extends FragmentActivity { lp.height = WindowManager.LayoutParams.WRAP_CONTENT; getWindow().setAttributes(lp); setFinishOnTouchOutside(true);//允许点击空白处关闭 + ltNodataMsg = findViewById(R.id.lt_nodata_msg); + container = findViewById(R.id.container); + if (IMLoginManager.get(mContext).hintChat()) { + container.setVisibility(View.GONE); + ltNodataMsg.setVisibility(View.VISIBLE); + } else { + container.setVisibility(View.VISIBLE); + ltNodataMsg.setVisibility(View.GONE); + + //展示会话列表 + conversationListFragment = new ConversationListFragment(); + FragmentManager manager = getSupportFragmentManager(); + FragmentTransaction transaction = manager.beginTransaction(); + transaction.replace(R.id.container, conversationListFragment); + transaction.commit(); + //自定义空数据背景View + conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); + initData(); + } - //展示会话列表 - conversationListFragment = new ConversationListFragment(); - FragmentManager manager = getSupportFragmentManager(); - FragmentTransaction transaction = manager.beginTransaction(); - transaction.replace(R.id.container, conversationListFragment); - transaction.commit(); - //自定义空数据背景View - conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); } diff --git a/live/src/main/res/layout/activity_pd_chat.xml b/live/src/main/res/layout/activity_pd_chat.xml index aaeaa2496..55b68f9d4 100644 --- a/live/src/main/res/layout/activity_pd_chat.xml +++ b/live/src/main/res/layout/activity_pd_chat.xml @@ -34,4 +34,18 @@ android:layout_marginTop="-10dp" android:background="@color/white" android:paddingTop="10dp" /> + + + + + \ No newline at end of file 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 bad5d790b..afc24d989 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -560,7 +560,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene }); //获取指导员账号 ConversationIMListManager.get(this).getUserInstructor(this); - checkVersion(); +// checkVersion(); } /** diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java index 97ef35e76..5fe07d6c3 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java @@ -1,5 +1,7 @@ package com.yunbao.main.activity; +import static com.yunbao.common.CommonAppContext.isReady; + import android.app.Dialog; import android.content.Intent; import android.os.Bundle; @@ -75,8 +77,6 @@ import java.util.List; import io.rong.imkit.conversationlist.ConversationListFragment; -import static com.yunbao.common.CommonAppContext.isReady; - /** * pdlive消息中心 */ @@ -97,7 +97,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. private Handler netHandler = new Handler(); private String type = null; private List listUserBean = new ArrayList<>(); - private LinearLayout topLayout; + private LinearLayout topLayout, ltNodataMsg; private ImageView imgNewsNotice, imgNewsInteraction, imgNewsOnline; @Override @@ -179,6 +179,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. textNewsOnline = findViewById(R.id.text_news_online); newsIconClearance = findViewById(R.id.news_icon_clearance); topLayout = findViewById(R.id.top_layout); + ltNodataMsg = findViewById(R.id.lt_nodata_msg); imgNewsNotice = findViewById(R.id.img_news_notice); imgNewsInteraction = findViewById(R.id.img_news_interaction); imgNewsOnline = findViewById(R.id.img_news_online); @@ -230,16 +231,25 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. IMLoginManager.get(mContext).checkInstructor(); mProcessResultUtil = new ProcessResultUtil(this); netHandler.post(imUserInfoRunnable); - //展示会话列表 - conversationListFragment = new ConversationListFragment(); - FragmentManager manager = getSupportFragmentManager(); - FragmentTransaction transaction = manager.beginTransaction(); - transaction.replace(R.id.container, conversationListFragment); - transaction.commit(); - //自定义空数据背景View - conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); - //刷新列表内用户信息 - ConversationIMListManager.get(mContext).addUserInfoProvider(); + if (IMLoginManager.get(mContext).hintChat()) { + container.setVisibility(View.GONE); + ltNodataMsg.setVisibility(View.VISIBLE); + } else { + container.setVisibility(View.VISIBLE); + ltNodataMsg.setVisibility(View.GONE); + //展示会话列表 + conversationListFragment = new ConversationListFragment(); + FragmentManager manager = getSupportFragmentManager(); + FragmentTransaction transaction = manager.beginTransaction(); + transaction.replace(R.id.container, conversationListFragment); + transaction.commit(); + //自定义空数据背景View + conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); + //刷新列表内用户信息 + ConversationIMListManager.get(mContext).addUserInfoProvider(); + } + + //消息中心 Bundle bundle = getIntent().getExtras(); if (bundle != null) { diff --git a/main/src/main/res/layout/activity_conversation_list.xml b/main/src/main/res/layout/activity_conversation_list.xml index 54cb78932..791d44248 100644 --- a/main/src/main/res/layout/activity_conversation_list.xml +++ b/main/src/main/res/layout/activity_conversation_list.xml @@ -24,14 +24,14 @@ android:textStyle="bold" /> + android:src="@mipmap/news_icon_clearance" + android:visibility="gone" /> @@ -62,8 +62,8 @@ android:layout_alignParentEnd="true" android:layout_marginTop="20dp" android:layout_marginEnd="9dp" - android:gravity="center" android:background="@drawable/background_system_message" + android:gravity="center" android:text="7" android:textColor="@color/white" android:textSize="12sp" @@ -91,8 +91,8 @@ android:layout_marginTop="20dp" android:layout_marginEnd="17dp" android:background="@drawable/background_system_message" - android:text="7" android:gravity="center" + android:text="7" android:textColor="@color/white" android:textSize="12sp" android:visibility="gone" /> @@ -119,8 +119,8 @@ android:layout_marginTop="20dp" android:layout_marginEnd="17dp" android:background="@drawable/background_system_message" - android:text="7" android:gravity="center" + android:text="7" android:textColor="@color/white" android:textSize="12sp" android:visibility="gone" /> @@ -137,6 +137,20 @@ android:layout_height="match_parent" android:layout_marginBottom="71dp" /> + + + + +