隐藏聊天界面
This commit is contained in:
parent
cadbf53086
commit
79a4c560df
@ -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)
|
||||
|
@ -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 = "";
|
||||
|
||||
|
@ -74,10 +74,13 @@ public class MessageIMManager {
|
||||
UnReadMessageManager.getInstance().addObserver(conversationTypes, new UnReadMessageManager.IUnReadMessageObserver() {
|
||||
@Override
|
||||
public void onCountChanged(int integer) {
|
||||
if (!IMLoginManager.get(mContext).hintChat()) {
|
||||
imNumber = integer;
|
||||
//发送通知
|
||||
unreadMessagesHandler.post(essagesRunnable);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -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,6 +78,14 @@ 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();
|
||||
@ -94,6 +95,9 @@ public class PDLIiveChatActivity extends FragmentActivity {
|
||||
transaction.commit();
|
||||
//自定义空数据背景View
|
||||
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
|
||||
initData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,18 @@
|
||||
android:layout_marginTop="-10dp"
|
||||
android:background="@color/white"
|
||||
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>
|
@ -560,7 +560,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
});
|
||||
//获取指导员账号
|
||||
ConversationIMListManager.get(this).getUserInstructor(this);
|
||||
checkVersion();
|
||||
// checkVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<ImUserBean> 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,6 +231,12 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
IMLoginManager.get(mContext).checkInstructor();
|
||||
mProcessResultUtil = new ProcessResultUtil(this);
|
||||
netHandler.post(imUserInfoRunnable);
|
||||
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();
|
||||
@ -240,6 +247,9 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
|
||||
//刷新列表内用户信息
|
||||
ConversationIMListManager.get(mContext).addUserInfoProvider();
|
||||
}
|
||||
|
||||
|
||||
//消息中心
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (bundle != null) {
|
||||
|
@ -24,14 +24,14 @@
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/news_icon_clearance"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@mipmap/news_icon_clearance" />
|
||||
android:src="@mipmap/news_icon_clearance"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@ -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" />
|
||||
|
||||
<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
|
||||
android:id="@+id/rt_main_tab"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user