优化首页右下角悬浮层隐藏显示问题

This commit is contained in:
zlzw 2024-05-24 14:49:14 +08:00
parent 24170d55e2
commit c033340aad
3 changed files with 55 additions and 21 deletions

View File

@ -323,7 +323,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void run() {
loading.setVisibility(View.GONE);
enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
ToastUtil.show(mContext.getString(R.string.net_error) + " :500");//异常下播等待加载时间过了后弹出
//ToastUtil.show(mContext.getString(R.string.net_error) + " :500");//异常下播等待加载时间过了后弹出
}
};

View File

@ -51,6 +51,7 @@ import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.utils.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
@ -517,8 +518,20 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
if (index == 0) {
isfloatBannernet = true;
initAnchorRecommendBanner();
// isfloatBannernet = true;
// initAnchorRecommendBanner();
if (floatEventShow) {
if (floatWarOrder.getTag() != null) {
floatWarOrder.setVisibility(View.VISIBLE);
} else {
floatWarOrder.setVisibility(View.GONE);
if (floatBanner.getTag() != null) {
floatBanner.setVisibility(View.VISIBLE);
} else {
floatBanner.setVisibility(View.GONE);
}
}
}
} else if (index == 2) {
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
@ -621,30 +634,26 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (isFinishing()) return;
if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.setVisibility(View.VISIBLE);
floatBanner.setTag(data);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
floatBanner.showBanner(data.getList());
} else {
floatBanner.setVisibility(View.GONE);
floatBanner.setTag(null);
findViewById(R.id.banner_click).setVisibility(View.GONE);
}
if (data.getShowRedPacket() == 0) {
floatRedPacket.setVisibility(View.GONE);
} else {
floatRedPacket.setVisibility(View.VISIBLE);
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
}
if (data.getShowWarOrder() == 0) {
floatWarOrder.setVisibility(View.GONE);
floatWarOrder.setTag(null);
//战令关闭情况下在判断一次Banner是否足够
if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.setVisibility(View.VISIBLE);
floatBanner.setTag(data);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
floatBanner.showBanner(data.getList());
} else {
floatBanner.setVisibility(View.GONE);
floatBanner.setTag(null);
findViewById(R.id.banner_click).setVisibility(View.GONE);
}
} else {
@ -657,8 +666,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
floatBanner.setVisibility(View.GONE);
floatBanner.setTag(null);
findViewById(R.id.banner_click).setVisibility(View.GONE);
}
if (data.getShowRedPacket() == 0) {
floatRedPacket.setVisibility(View.GONE);
} else if (floatWarOrder.getTag() == null && floatWarOrder.getTag() == null) {
floatRedPacket.setVisibility(View.VISIBLE);
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
}
}
@ -1499,18 +1517,34 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
}
boolean floatEventShow = true;
@Subscribe(threadMode = ThreadMode.MAIN)
public void onFloatWarOrderEvent(FloatWarOrderEvent event) {
/* if (event.isFloatWarOrder()) {
floatWarOrder.setVisibility(View.GONE);
System.out.println("FloatWarOrderEvent:事件" + event.isFloatWarOrder());
System.out.println("战令:" + floatWarOrder.getTag());
System.out.println("Banner:" + floatBanner.getTag());
floatEventShow = event.isFloatWarOrder();
if (event.isFloatWarOrder()) {
if (floatWarOrder.getTag() == null) {
floatWarOrder.setVisibility(View.GONE);
} else {
floatWarOrder.setVisibility(View.VISIBLE);
}
if (floatBanner.getTag() == null) {
floatBanner.setVisibility(View.GONE);
} else {
floatBanner.setVisibility(View.VISIBLE);
}
} else {
floatWarOrder.setVisibility(View.VISIBLE);
}*/
if(floatWarOrder.getTag()!=null){
floatBanner.setVisibility(View.GONE);
floatWarOrder.setVisibility(View.GONE);
}
/* if(floatWarOrder.getTag()!=null){
floatWarOrder.setVisibility(View.VISIBLE);
}else{
floatWarOrder.setVisibility(View.GONE);
}
}*/
}
private void initRedPacket() {

View File

@ -85,22 +85,22 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
case 0:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_follow", "首页关注列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true));
break;
case 1:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_hot", "首页热门列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true));
break;
case 2:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_recommend", "首页推荐列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true));
break;
case 3:
floatWarOrder = true;
MobclickAgent.onEvent(mContext, "home_page_redpk", "首页红包列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true));
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
break;
}
if (mViewHolders == null) {