diff --git a/live/src/main/assets/ic_live_anchor_call_me.svga b/live/src/main/assets/ic_live_anchor_call_me.svga new file mode 100644 index 000000000..ba388de6d Binary files /dev/null and b/live/src/main/assets/ic_live_anchor_call_me.svga differ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 1361344f5..533e60088 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -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; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index 92e5187d1..788d257ce 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -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); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 1833f177a..3d17a4414 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -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); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java index 01ed583ec..c78ad3c1e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java @@ -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); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java index 7ee0fe1b9..67006691c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java @@ -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) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index f655da606..12a8fd209 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -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(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 9f1122571..5a049048a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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() { @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); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 23c6dc4fe..56a3862b0 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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(); + } } } diff --git a/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java new file mode 100644 index 000000000..a9edba0e6 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java @@ -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 { + 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; + } +} diff --git a/live/src/main/res/drawable/bg_live_top_banner.xml b/live/src/main/res/drawable/bg_live_top_banner.xml new file mode 100644 index 000000000..bf21e74a3 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_top_banner.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_top_banner_text.xml b/live/src/main/res/drawable/bg_live_top_banner_text.xml new file mode 100644 index 000000000..1589f8921 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_top_banner_text.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_anchor_say.xml b/live/src/main/res/layout/dialog_anchor_say.xml index 94ebe87a1..520668864 100644 --- a/live/src/main/res/layout/dialog_anchor_say.xml +++ b/live/src/main/res/layout/dialog_anchor_say.xml @@ -8,7 +8,7 @@ + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index d8b84b36b..9bde8b6fe 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -74,6 +74,7 @@ 選擇禮物 未填寫 请填写联系方式后再启用 + 未選擇禮物 信內容 我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。 聯繫方式