隐藏聊天界面

This commit is contained in:
18401019693 2022-09-27 16:35:43 +08:00
parent cadbf53086
commit 79a4c560df
8 changed files with 111 additions and 44 deletions

View File

@ -17,6 +17,7 @@ import com.yunbao.common.activity.ErrorActivity;
import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.MD5Util;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
@ -165,7 +166,7 @@ public class CommonHttpUtil {
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题 //或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG) HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
.params("langue", lang) .params("langue", lang)
.params("version", ""+VersionUtil.getVersion()) .params("version", "" + VersionUtil.getVersion())
.params("from", "android") .params("from", "android")
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
@ -185,6 +186,9 @@ public class CommonHttpUtil {
if (commonCallback != null) { if (commonCallback != null) {
commonCallback.callback(bean); commonCallback.callback(bean);
} }
if (obj.containsKey("is_chat")) {
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
}
} catch (Exception e) { } catch (Exception e) {
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
ErrorActivity.forward("GetConfig接口返回数据异常", error); ErrorActivity.forward("GetConfig接口返回数据异常", error);
@ -336,7 +340,7 @@ public class CommonHttpUtil {
.execute(callback); .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) HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
.params("purchaseToken", purchaseToken) .params("purchaseToken", purchaseToken)
.params("orderno", orderNo) .params("orderno", orderNo)
@ -346,7 +350,7 @@ public class CommonHttpUtil {
.execute(callback); .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") HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay")
.params("purchaseToken", purchaseToken) .params("purchaseToken", purchaseToken)
.params("orderno", orderNo) .params("orderno", orderNo)
@ -408,7 +412,7 @@ public class CommonHttpUtil {
public static void setAdvertisingChannels(String operation, HttpCallback callback) { public static void setAdvertisingChannels(String operation, HttpCallback callback) {
HttpClient.getInstance().get("Tx.setAdvertisingChannels", CommonHttpConsts.GET_USER_BASEINFO) HttpClient.getInstance().get("Tx.setAdvertisingChannels", CommonHttpConsts.GET_USER_BASEINFO)
.params("operation", operation) .params("operation", operation)
.params("marking", Adjust.getAdid()) .params("marking", Adjust.getAdid())
.execute(callback); .execute(callback);
} }

View File

@ -29,6 +29,24 @@ public class IMLoginManager extends BaseCacheManager {
private final static String isNewUserOne = "isNewUserOne"; private final static String isNewUserOne = "isNewUserOne";
private final static String GiftEffect = "giftEffect"; private final static String GiftEffect = "giftEffect";
private final static String MountEffect = "mountEffect"; 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 //暂时缓存token
private String token = ""; private String token = "";

View File

@ -74,9 +74,12 @@ public class MessageIMManager {
UnReadMessageManager.getInstance().addObserver(conversationTypes, new UnReadMessageManager.IUnReadMessageObserver() { UnReadMessageManager.getInstance().addObserver(conversationTypes, new UnReadMessageManager.IUnReadMessageObserver() {
@Override @Override
public void onCountChanged(int integer) { public void onCountChanged(int integer) {
imNumber = integer; if (!IMLoginManager.get(mContext).hintChat()) {
//发送通知 imNumber = integer;
unreadMessagesHandler.post(essagesRunnable); //发送通知
unreadMessagesHandler.post(essagesRunnable);
}
} }
}); });

View File

@ -1,14 +1,13 @@
package com.yunbao.live.activity; package com.yunbao.live.activity;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
@ -18,12 +17,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; 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.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.RouteUtil; 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.adapter.SystemChatMessageAdapter;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.event.RecommendLiveRoomEvent; import com.yunbao.live.event.RecommendLiveRoomEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
@ -45,8 +39,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import io.rong.imkit.conversationlist.ConversationListFragment; 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 ConversationListFragment conversationListFragment;
private FrameLayout container; private FrameLayout container;
private PDLIiveChatActivity mContext; private PDLIiveChatActivity mContext;
private LinearLayout ltNodataMsg;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -64,7 +57,7 @@ public class PDLIiveChatActivity extends FragmentActivity {
mContext = this; mContext = this;
windowColor(); windowColor();
initView(); initView();
initData();
Bus.getOn(this); Bus.getOn(this);
} }
@ -85,15 +78,26 @@ public class PDLIiveChatActivity extends FragmentActivity {
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
getWindow().setAttributes(lp); getWindow().setAttributes(lp);
setFinishOnTouchOutside(true);//允许点击空白处关闭 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);
} }

View File

@ -34,4 +34,18 @@
android:layout_marginTop="-10dp" android:layout_marginTop="-10dp"
android:background="@color/white" android:background="@color/white"
android:paddingTop="10dp" /> android:paddingTop="10dp" />
<LinearLayout
android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/img_no_new" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -560,7 +560,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}); });
//获取指导员账号 //获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this); ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion(); // checkVersion();
} }
/** /**

View File

@ -1,5 +1,7 @@
package com.yunbao.main.activity; package com.yunbao.main.activity;
import static com.yunbao.common.CommonAppContext.isReady;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -75,8 +77,6 @@ import java.util.List;
import io.rong.imkit.conversationlist.ConversationListFragment; import io.rong.imkit.conversationlist.ConversationListFragment;
import static com.yunbao.common.CommonAppContext.isReady;
/** /**
* pdlive消息中心 * pdlive消息中心
*/ */
@ -97,7 +97,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
private Handler netHandler = new Handler(); private Handler netHandler = new Handler();
private String type = null; private String type = null;
private List<ImUserBean> listUserBean = new ArrayList<>(); private List<ImUserBean> listUserBean = new ArrayList<>();
private LinearLayout topLayout; private LinearLayout topLayout, ltNodataMsg;
private ImageView imgNewsNotice, imgNewsInteraction, imgNewsOnline; private ImageView imgNewsNotice, imgNewsInteraction, imgNewsOnline;
@Override @Override
@ -179,6 +179,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
textNewsOnline = findViewById(R.id.text_news_online); textNewsOnline = findViewById(R.id.text_news_online);
newsIconClearance = findViewById(R.id.news_icon_clearance); newsIconClearance = findViewById(R.id.news_icon_clearance);
topLayout = findViewById(R.id.top_layout); topLayout = findViewById(R.id.top_layout);
ltNodataMsg = findViewById(R.id.lt_nodata_msg);
imgNewsNotice = findViewById(R.id.img_news_notice); imgNewsNotice = findViewById(R.id.img_news_notice);
imgNewsInteraction = findViewById(R.id.img_news_interaction); imgNewsInteraction = findViewById(R.id.img_news_interaction);
imgNewsOnline = findViewById(R.id.img_news_online); imgNewsOnline = findViewById(R.id.img_news_online);
@ -230,16 +231,25 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
IMLoginManager.get(mContext).checkInstructor(); IMLoginManager.get(mContext).checkInstructor();
mProcessResultUtil = new ProcessResultUtil(this); mProcessResultUtil = new ProcessResultUtil(this);
netHandler.post(imUserInfoRunnable); netHandler.post(imUserInfoRunnable);
//展示会话列表 if (IMLoginManager.get(mContext).hintChat()) {
conversationListFragment = new ConversationListFragment(); container.setVisibility(View.GONE);
FragmentManager manager = getSupportFragmentManager(); ltNodataMsg.setVisibility(View.VISIBLE);
FragmentTransaction transaction = manager.beginTransaction(); } else {
transaction.replace(R.id.container, conversationListFragment); container.setVisibility(View.VISIBLE);
transaction.commit(); ltNodataMsg.setVisibility(View.GONE);
//自定义空数据背景View //展示会话列表
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); conversationListFragment = new ConversationListFragment();
//刷新列表内用户信息 FragmentManager manager = getSupportFragmentManager();
ConversationIMListManager.get(mContext).addUserInfoProvider(); 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(); Bundle bundle = getIntent().getExtras();
if (bundle != null) { if (bundle != null) {

View File

@ -24,14 +24,14 @@
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/news_icon_clearance" android:id="@+id/news_icon_clearance"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_gravity="end|bottom" android:layout_gravity="end|bottom"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:src="@mipmap/news_icon_clearance" /> android:src="@mipmap/news_icon_clearance"
android:visibility="gone" />
</FrameLayout> </FrameLayout>
@ -62,8 +62,8 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="9dp" android:layout_marginEnd="9dp"
android:gravity="center"
android:background="@drawable/background_system_message" android:background="@drawable/background_system_message"
android:gravity="center"
android:text="7" android:text="7"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" android:textSize="12sp"
@ -91,8 +91,8 @@
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="17dp" android:layout_marginEnd="17dp"
android:background="@drawable/background_system_message" android:background="@drawable/background_system_message"
android:text="7"
android:gravity="center" android:gravity="center"
android:text="7"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" android:textSize="12sp"
android:visibility="gone" /> android:visibility="gone" />
@ -119,8 +119,8 @@
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="17dp" android:layout_marginEnd="17dp"
android:background="@drawable/background_system_message" android:background="@drawable/background_system_message"
android:text="7"
android:gravity="center" android:gravity="center"
android:text="7"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" android:textSize="12sp"
android:visibility="gone" /> android:visibility="gone" />
@ -137,6 +137,20 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="71dp" /> android:layout_marginBottom="71dp" />
<LinearLayout
android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="71dp"
android:gravity="center"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/img_no_new" />
</LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/rt_main_tab" android:id="@+id/rt_main_tab"
android:layout_width="match_parent" android:layout_width="match_parent"