update 女神说主播端显示

update 联系方式改成svga
update PK时隐藏女神说和联系方式
This commit is contained in:
2023-03-30 11:23:11 +08:00
parent c22da60b82
commit ce2048b9a5
17 changed files with 186 additions and 26 deletions

View File

@@ -109,7 +109,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
public String anyway;
public ViewGroup mContainer;
protected ViewGroup mPageContainer;
protected LiveRoomViewHolder mLiveRoomViewHolder;
public LiveRoomViewHolder mLiveRoomViewHolder;
protected AbsLiveViewHolder mLiveBottomViewHolder;
protected LiveAddImpressViewHolder mLiveAddImpressViewHolder;
protected LiveContributeViewHolder mLiveContributeViewHolder;

View File

@@ -483,6 +483,8 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
}
mLiveRoomViewHolder.initHourRankList();
mLiveRoomViewHolder.startAnchorLight();
//初始化女神说
mLiveRoomViewHolder.initAnchorSay();
}
if (mLiveAnchorViewHolder == null) {
mLiveAnchorViewHolder = new LiveAnchorViewHolder(mContext, mContainer);

View File

@@ -780,7 +780,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.initHourRankList();
}
mLiveRoomViewHolder.startAnchorLight();
//初始化女神说
mLiveRoomViewHolder.initAnchorSay();
}
if (mLiveAnchorViewHolder == null) {
mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer);

View File

@@ -114,6 +114,10 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow {
});
status.setTag(0);
status.setOnClickListener(v -> {
if(callMeModel.getGiftId()==0){
ToastUtil.show(R.string.live_anchor_edit_call_me_not_gift_toash);
return;
}
int tag = (int) v.getTag();
if (tag == 0) {
status.setImageResource(R.mipmap.special_icon_on);

View File

@@ -122,12 +122,13 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
public void onTextChanged(CharSequence s, int start, int before, int count) {
sayModel.getLivePreview().setContent(s.toString());
StringBuilder sb = new StringBuilder();
int n = (s.length() + 3) / 4;
int len=6;
int n = (s.length() + 3) / len;
for (int i = 0; i < n; i++) {
if (i < (n - 1)) {
sb.append(s.toString().substring(i * 4, (i + 1) * 4)).append("\n");
sb.append(s.toString().substring(i * len, (i + 1) * len)).append("\n");
} else {
sb.append(s.toString().substring(i * 4));
sb.append(s.toString().substring(i * len));
}
}
if (sb.length() == 0) {

View File

@@ -25,7 +25,9 @@ import android.widget.TextView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveAnchorMessageCustomPopup;
@@ -195,7 +197,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
} else if (id == R.id.live_tool_call_me) {
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_anchor_say) {
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).showDialog();
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position)
-> mLiveRoomHandler.postDelayed(()-> ((LiveRyAnchorActivity)(mContext)).mLiveRoomViewHolder.initAnchorSayData(),1000)).showDialog();
}
}

View File

@@ -6,7 +6,6 @@ import static com.yunbao.live.views.LivePushRyViewHolder.btn_close;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Outline;
import android.os.Bundle;
import android.os.CountDownTimer;
@@ -4259,15 +4258,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveAnchorSayModel sayModel;
public void initAnchorSay() {
if (mAnchorSay.getTag() != null) {
mAnchorSay.setX((float) mAnchorSayImage.getTag());
mAnchorSayImage.setTag(null);
mAnchorSayImage.setVisibility(View.VISIBLE);
mAnchorSayText.setVisibility(View.VISIBLE);
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
}
mAnchorSay.setTag(null);
public void initAnchorSayData() {
LiveNetManager.get(mContext)
.getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback<LiveAnchorSayModel>() {
@Override
@@ -4291,7 +4282,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public String getText(String content) {
int t = 4;
int t = 6;
float len = (float) content.length() / t;
StringBuilder sb = new StringBuilder();
sb.append("\n");
@@ -4307,20 +4298,46 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
}
private static final int TOP_BANNER_TYPE_CALL_ME = 100;//联系方式
public void initAnchorSay() {
if (mAnchorSay.getTag() != null) {
mAnchorSay.setX((float) mAnchorSayImage.getTag());
mAnchorSayImage.setTag(null);
mAnchorSayImage.setVisibility(View.VISIBLE);
mAnchorSayText.setVisibility(View.VISIBLE);
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
}
mAnchorSay.setTag(null);
initAnchorSayData();
}
public void hideAnchorSayAndCallAnchor(){
mAnchorSay.setX((float) mAnchorSayImage.getTag());
mAnchorSayImage.setTag(null);
mAnchorSayImage.setVisibility(View.VISIBLE);
mAnchorSayText.setVisibility(View.VISIBLE);
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
topBanner1.setVisibility(View.GONE);
}
public void showAnchorSayAndCallAnchor(){
mAnchorSayImage.setTag(mAnchorSay.getX());
mAnchorSay.setX(-DpUtil.dp2px(45));
mAnchorSayImage.setVisibility(View.INVISIBLE);
mAnchorSayText.setVisibility(View.INVISIBLE);
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide);
topBanner1.setVisibility(View.VISIBLE);
}
public void initTopBanner() {
checkNewLetter();
mTopBannerList = new ArrayList<>();
topBanner1.setVisibility(View.GONE);
topBanner1.setAutoPlay(true)
.setPages(mTopBannerList, new Banner4CustomViewHolder())
.setPages(mTopBannerList, new TopBannerCustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int position) {
if (mTopBannerList.get(position).getType() == TOP_BANNER_TYPE_CALL_ME) {
if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) {
Dialog loading = DialogUitl.loadingDialog(mContext);
loading.show();
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
@@ -4348,9 +4365,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (data.getIsShow() == 1) {
topBanner1.setVisibility(View.VISIBLE);
BannerBean call = new BannerBean();
call.setIconRes(R.mipmap.ic_live_float_call_me);
call.setActivityId(data.getGiftId());
call.setType(TOP_BANNER_TYPE_CALL_ME);
call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR);
mTopBannerList.add(0, call);
topBanner1.update(mTopBannerList);
}

View File

@@ -1328,6 +1328,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void setPkStatus(boolean isPk) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hotAddVisibility(isPk);
if (isPk) {
mLiveRoomViewHolder.hideAnchorSayAndCallAnchor();
} else {
mLiveRoomViewHolder.showAnchorSayAndCallAnchor();
}
}
}

View File

@@ -0,0 +1,56 @@
package com.yunbao.live.views;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import com.ms.banner.holder.BannerViewHolder;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R;
public class TopBannerCustomViewHolder implements BannerViewHolder<BannerBean> {
public static final int TYPE_CALL_ANCHOR = 0;//联系主播
public static final int TYPE_IMAGE = 1;
@Override
public View createView(Context context, int position, BannerBean data) {
View view = null;
if (data.getType() == TYPE_IMAGE) {
ImageView icon = new ImageView(context);
if (data.getIconRes() != 0) {
ImgLoader.display(context, data.getIconRes(), icon);
} else {
ImgLoader.display(context, data.getImageUrl(), icon);
}
view = icon;
} else {
view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null);
SVGAImageView svga = view.findViewById(R.id.svga);
new SVGAParser(context).decodeFromAssets("ic_live_anchor_call_me.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga.setImageDrawable(drawable);
svga.setTag("svga");
SVGAViewUtils.playEndClear(svga, false);
svga.setClearsAfterStop(false);
}
@Override
public void onError() {
Log.e("errqs", "errl");
}
}, null);
}
return view;
}
}