update 女神说主播端显示

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -114,6 +114,10 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow {
}); });
status.setTag(0); status.setTag(0);
status.setOnClickListener(v -> { 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(); int tag = (int) v.getTag();
if (tag == 0) { if (tag == 0) {
status.setImageResource(R.mipmap.special_icon_on); 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) { public void onTextChanged(CharSequence s, int start, int before, int count) {
sayModel.getLivePreview().setContent(s.toString()); sayModel.getLivePreview().setContent(s.toString());
StringBuilder sb = new StringBuilder(); 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++) { for (int i = 0; i < n; i++) {
if (i < (n - 1)) { 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 { } else {
sb.append(s.toString().substring(i * 4)); sb.append(s.toString().substring(i * len));
} }
} }
if (sb.length() == 0) { if (sb.length() == 0) {

View File

@ -25,7 +25,9 @@ import android.widget.TextView;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveAnchorMessageCustomPopup; 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) { } else if (id == R.id.live_tool_call_me) {
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog(); new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_anchor_say) { } 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.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Outline; import android.graphics.Outline;
import android.os.Bundle; import android.os.Bundle;
import android.os.CountDownTimer; import android.os.CountDownTimer;
@ -4259,15 +4258,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveAnchorSayModel sayModel; LiveAnchorSayModel sayModel;
public void initAnchorSay() { public void initAnchorSayData() {
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);
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback<LiveAnchorSayModel>() { .getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback<LiveAnchorSayModel>() {
@Override @Override
@ -4291,7 +4282,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
public String getText(String content) { public String getText(String content) {
int t = 4; int t = 6;
float len = (float) content.length() / t; float len = (float) content.length() / t;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("\n"); 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() { public void initTopBanner() {
checkNewLetter(); checkNewLetter();
mTopBannerList = new ArrayList<>(); mTopBannerList = new ArrayList<>();
topBanner1.setVisibility(View.GONE); topBanner1.setVisibility(View.GONE);
topBanner1.setAutoPlay(true) topBanner1.setAutoPlay(true)
.setPages(mTopBannerList, new Banner4CustomViewHolder()) .setPages(mTopBannerList, new TopBannerCustomViewHolder())
.setDelayTime(3000) .setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR) .setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() { .setOnBannerClickListener(new OnBannerClickListener() {
@Override @Override
public void onBannerClick(List datas, int position) { 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); Dialog loading = DialogUitl.loadingDialog(mContext);
loading.show(); loading.show();
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
@ -4348,9 +4365,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (data.getIsShow() == 1) { if (data.getIsShow() == 1) {
topBanner1.setVisibility(View.VISIBLE); topBanner1.setVisibility(View.VISIBLE);
BannerBean call = new BannerBean(); BannerBean call = new BannerBean();
call.setIconRes(R.mipmap.ic_live_float_call_me);
call.setActivityId(data.getGiftId()); call.setActivityId(data.getGiftId());
call.setType(TOP_BANNER_TYPE_CALL_ME); call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR);
mTopBannerList.add(0, call); mTopBannerList.add(0, call);
topBanner1.update(mTopBannerList); topBanner1.update(mTopBannerList);
} }

View File

@ -1328,6 +1328,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void setPkStatus(boolean isPk) { public void setPkStatus(boolean isPk) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hotAddVisibility(isPk); 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;
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="52dp" android:height="52dp">
<shape android:shape="rectangle">
<solid android:color="#4d000000" />
<corners android:topLeftRadius="6dp" android:topRightRadius="6dp" android:bottomLeftRadius="6dp" android:bottomRightRadius="6dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="48dp" android:height="18dp">
<shape android:shape="rectangle">
<stroke android:width="0dp" android:color="#4dffffff" />
<solid android:color="#000000" />
<gradient android:angle="180" android:centerColor="#0548cfff" android:endColor="#4d7733ff" android:startColor="#4d33ddff" android:type="linear" android:useLevel="true" />
<corners android:bottomLeftRadius="10dp" android:bottomRightRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" />
<stroke
android:width="1dp"
android:color="#4dFFFFFF" />
</shape>
</item>
</selector>

View File

@ -8,7 +8,7 @@
<include <include
android:id="@+id/anchor_say" android:id="@+id/anchor_say"
layout="@layout/sim_live_room_anchor_say" layout="@layout/sim_live_room_anchor_say"
android:layout_width="67dp" android:layout_width="77dp"
android:layout_height="88dp" android:layout_height="88dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:visibility="invisible" android:visibility="invisible"

View File

@ -19,13 +19,15 @@
<TextView <TextView
android:id="@+id/anchor_say_text" android:id="@+id/anchor_say_text"
android:layout_width="50dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:ellipsize="none" android:ellipsize="none"
android:gravity="center" android:gravity="center"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxEms="4" android:maxEms="6"
android:text="中文测试\n中文测试\n中文测试\n中文测试" android:text="中文测试\n中文测试\n中文测试\n中文测试"
android:textColor="#333333" android:textColor="#333333"
android:textSize="10sp" android:textSize="10sp"

View File

@ -1272,7 +1272,7 @@
<include <include
android:id="@+id/anchor_say_layout" android:id="@+id/anchor_say_layout"
layout="@layout/sim_live_room_anchor_say" layout="@layout/sim_live_room_anchor_say"
android:layout_width="67dp" android:layout_width="77dp"
android:layout_height="88dp" android:layout_height="88dp"
android:layout_alignBottom="@+id/live_video" android:layout_alignBottom="@+id/live_video"
android:layout_marginStart="14dp" android:layout_marginStart="14dp"

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView7"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/bg_live_top_banner" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginTop="5dp"
android:visibility="visible"
app:autoPlay="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_live_top_banner_text"
android:paddingStart="5dp"
android:paddingTop="2dp"
android:paddingEnd="5dp"
android:paddingBottom="2dp"
android:text="@string/live_ready_anchor_call_me"
android:textColor="@color/white"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/svga" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -74,6 +74,7 @@
<string name="live_anchor_edit_call_me_select_gift">選擇禮物</string> <string name="live_anchor_edit_call_me_select_gift">選擇禮物</string>
<string name="live_anchor_edit_call_me_not_filled">未填寫</string> <string name="live_anchor_edit_call_me_not_filled">未填寫</string>
<string name="live_anchor_edit_call_me_not_filled_toash">请填写联系方式后再启用</string> <string name="live_anchor_edit_call_me_not_filled_toash">请填写联系方式后再启用</string>
<string name="live_anchor_edit_call_me_not_gift_toash">未選擇禮物</string>
<string name="live_anchor_edit_call_me_letter_title">信內容</string> <string name="live_anchor_edit_call_me_letter_title">信內容</string>
<string name="live_anchor_edit_call_me_letter_content">我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。</string> <string name="live_anchor_edit_call_me_letter_content">我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。</string>
<string name="live_ready_anchor_call_me">聯繫方式</string> <string name="live_ready_anchor_call_me">聯繫方式</string>