From 6ef8c3778baaf143b47a9853954e62fbf5588ea5 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 27 Mar 2023 11:09:03 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=A5=B3=E7=A5=9E=E8=AF=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/bean/HttpCallbackModel.java | 8 + .../common/bean/LiveAnchorSayModel.java | 80 ++++++++ .../com/yunbao/common/http/PDLiveApi.java | 24 +++ .../common/http/live/LiveNetManager.java | 42 +++++ common/src/main/res/values-en/strings.xml | 1 + common/src/main/res/values/strings.xml | 2 +- .../live/activity/LiveRyAnchorActivity.java | 1 + .../adapter/LiveAnchorSayItemsAdapter.java | 34 ++-- .../live/dialog/LiveAnchorSayPopDialog.java | 93 ++++++++-- .../live/views/LiveNewReadyRyViewHolder.java | 9 + .../yunbao/live/views/LiveRoomViewHolder.java | 174 ++++++++++-------- .../live/views/PortraitLiveManager.java | 3 + .../anim/view_live_anchor_say_text_out.xml | 2 +- .../src/main/res/layout/dialog_anchor_say.xml | 9 +- live/src/main/res/layout/item_anchor_say.xml | 2 +- .../res/layout/sim_live_room_anchor_say.xml | 56 +++--- live/src/main/res/layout/view_live_room.xml | 5 +- .../main/res/layout/view_new_live_ready.xml | 52 +++++- .../mipmap-mdpi/ic_live_anchor_say_hide.png | Bin 0 -> 15241 bytes .../mipmap-mdpi/ic_live_anchor_say_show.png | Bin 0 -> 15232 bytes .../yunbao/main/views/MainHomeViewHolder.java | 2 +- 21 files changed, 456 insertions(+), 143 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java create mode 100644 live/src/main/res/mipmap-mdpi/ic_live_anchor_say_hide.png create mode 100644 live/src/main/res/mipmap-mdpi/ic_live_anchor_say_show.png diff --git a/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java b/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java index da77d56e5..a519e9385 100644 --- a/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java +++ b/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java @@ -28,4 +28,12 @@ public class HttpCallbackModel extends BaseModel { public void setMsg(String msg) { this.msg = msg; } + + @Override + public String toString() { + return "HttpCallbackModel{" + + "code=" + code + + ", msg='" + msg + '\'' + + '}'; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java b/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java new file mode 100644 index 000000000..ba686fa63 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java @@ -0,0 +1,80 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class LiveAnchorSayModel extends BaseModel{ + @SerializedName("livePreview") + private LivePreview livePreview; + @SerializedName("style") + private List style; + + public LiveAnchorSayModel() { + } + + public LivePreview getLivePreview() { + return livePreview; + } + + public void setLivePreview(LivePreview livePreview) { + this.livePreview = livePreview; + } + + public List getStyle() { + return style; + } + + public void setStyle(List style) { + this.style = style; + } + public class LivePreview{ + private int isShow; + private String content; + private String styleImage; + + public LivePreview() { + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getStyleImage() { + return styleImage; + } + + public void setStyleImage(String styleImage) { + this.styleImage = styleImage; + } + + @Override + public String toString() { + return "LivePreview{" + + "isShow=" + isShow + + ", content='" + content + '\'' + + ", styleImage='" + styleImage + '\'' + + '}'; + } + } + + @Override + public String toString() { + return "LiveAnchorSayModel{" + + "livePreview=" + livePreview + + ", style=" + style + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 5d269d74e..ad2df6a05 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -14,6 +14,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -575,4 +576,27 @@ public interface PDLiveApi { Observable>> getAnchorMsg( @Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit ); + /** + * 获取女神说数据 + */ + @GET("/api/public/?service=Live.getLivePreviewInfo") + Observable> getLivePreviewInfo( + @Query("liveuid") String liveUid + ); + + /** + * 设置女神说 + * + * @param isShow 是否显示 + * @param content 内容 + * @param styleImage 女神说底图地址 + * + */ + @GET("/api/public/?service=Live.setLivePreview") + Observable> setLivePreviewInfo( + @Query("liveuid") String liveUid, + @Query("isShow") int isShow, + @Query("content") String content, + @Query("styleImage")String styleImage + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 89ac477d5..fb3f9392b 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -16,6 +16,7 @@ import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -1145,6 +1146,47 @@ public class LiveNetManager { }).isDisposed(); } + /** + * 获取女神说数据 + */ + public void getLivePreviewInfo(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLivePreviewInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + callback.onError(throwable.getMessage()); + }).isDisposed(); + } + + /** + * 设置女神说 + * + * @param isShow 是否显示 + * @param content 内容 + * @param styleImage 女神说底图地址 + */ + public void setLivePreviewInfo(String liveUid, + int isShow, + String content, + String styleImage, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setLivePreviewInfo(liveUid, isShow, content, styleImage) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index ba779e04e..bead9d8a8 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -1089,4 +1089,5 @@ Limited ride And limited avatar frame Get a fan badge for giving gifts Whether to clear unread messages The application collects location data to support login and registration functions. + 女神說 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 7d686fd4a..0d9896c02 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1085,7 +1085,7 @@ 註冊PD LIVE 註冊並登錄 開通貴族,尊享超多特權! - + 女神說 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 ae017e117..1833f177a 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -262,6 +262,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK); mLiveReadyViewHolder.setManager(manager); mLiveReadyViewHolder.addToParent(); + mLiveReadyViewHolder.setLiveUid(mLiveUid); mLiveReadyViewHolder.subscribeActivityLifeCycle(); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java index c24849ea0..a0a6d8998 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java @@ -4,24 +4,28 @@ import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.yunbao.common.adapter.OnItemClickListener; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.live.R; +import java.util.ArrayList; import java.util.List; public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter { private Context mContext; private List list; private int click = -1; - private OnItemClickListener onItemClickListener; + private OnItemClickListener onItemClickListener; public LiveAnchorSayItemsAdapter(Context mContext) { this.mContext = mContext; + list = new ArrayList<>(); } public void setList(List list) { @@ -29,7 +33,7 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter onItemClickListener) { this.onItemClickListener = onItemClickListener; } @@ -51,21 +55,29 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter { - click = getAbsoluteAdapterPosition(); - if (onItemClickListener != null) { - onItemClickListener.onItemClick(click); - } - notifyDataSetChanged(); - }); + icon = itemView.findViewById(R.id.anchor_say_icon); + itemView.setOnClickListener(v -> click()); + textView.setOnClickListener(v -> click()); + icon.setOnClickListener(v -> click()); + + } + + private void click() { + click = getAbsoluteAdapterPosition(); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(list.get(click), click); + } + notifyDataSetChanged(); } public void setData(String text, int position) { - textView.setText(text); + textView.setText("已输入的\n内容已输\n入的内容\n入的内容"); + ImgLoader.display(mContext, text, icon); if (position == click) { itemView.setBackgroundResource(R.drawable.bg_anchor_say_select); } else { 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 8bb57df18..db856e5ec 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java @@ -16,8 +16,13 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; -import com.yunbao.common.adapter.OnItemClickListener; +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.LiveAnchorSayItemsAdapter; @@ -30,13 +35,22 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { View anchorDemo; LiveAnchorSayItemsAdapter adapter; ImageView saySwitch; + ImageView close; + ImageView sayBg; TextView sayText; EditText sayEdit; + String mLiveUid; + String url; public LiveAnchorSayPopDialog(@NonNull Context context) { super(context); } + public LiveAnchorSayPopDialog setLiveUid(String mLiveUid) { + this.mLiveUid = mLiveUid; + return this; + } + @Override public void buildDialog(XPopup.Builder builder) { builder.autoFocusEditText(false); @@ -44,6 +58,12 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { builder.borderRadius(50); } + @Override + protected void onDismiss() { + super.onDismiss(); + setSayData(url, sayEdit.getText().toString()); + } + @Override public int bindLayoutId() { return R.layout.dialog_anchor_say; @@ -58,26 +78,26 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { list = findViewById(R.id.anchor_say_list); saySwitch = findViewById(R.id.say_switch); sayEdit = findViewById(R.id.anchor_say_edit); + close = findViewById(R.id.close); + sayBg = anchorDemo.findViewById(R.id.anchor_say_icon); list.setLayoutManager(new GridLayoutManager(getContext(), 3)); list.setAdapter(adapter); - adapter.setOnItemClickListener(new OnItemClickListener() { + adapter.setOnItemClickListener(new OnItemClickListener() { @Override - public void onItemClick(int position) { - - + public void onItemClick(String bean, int position) { + anchorDemo.setVisibility(VISIBLE); + ImgLoader.display(getContext(), bean, sayBg); + url = bean; } }); initData(); - saySwitch.setOnClickListener(v -> { if (saySwitch.getTag() == null) { saySwitch.setTag(""); saySwitch.setImageResource(R.mipmap.special_icon_on); - anchorDemo.setVisibility(VISIBLE); } else { saySwitch.setTag(null); saySwitch.setImageResource(R.mipmap.special_icon_off); - anchorDemo.setVisibility(INVISIBLE); } }); @@ -100,7 +120,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { sb.append(s.toString().substring(i * 4)); } } - if(sb.length()==0){ + if (sb.length() == 0) { sb.append("默认字符\n默认字符\n默认字符"); } sayText.setText(sb.toString()); @@ -112,15 +132,60 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { } }); + close.setOnClickListener(v -> { + dismiss(); + }); + + } + + private void setSayData(String url, String edit) { + LiveNetManager.get(getContext()) + .setLivePreviewInfo( + mLiveUid, + saySwitch.getTag() == null ? 0 : 1, + edit, + url, + new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + Log.i("女神说", "onSuccess: " + data); + } + + @Override + public void onError(String error) { + Log.e("女神说", "onError: " + error); + } + } + ); } private void initData() { - List data = new ArrayList<>(); - for (int i = 0; i < 20; i++) { - data.add("data " + i); + LiveNetManager.get(getContext()) + .getLivePreviewInfo(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(LiveAnchorSayModel data) { + List urls = new ArrayList<>(data.getStyle()); + adapter.setList(urls); + LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); + if (preview != null) { + sayText.setText(preview.getContent()); + sayEdit.setText(preview.getContent()); + url = preview.getStyleImage(); + ImgLoader.display(getContext(), preview.getStyleImage(), sayBg); + if (preview.getIsShow() == 1) { + saySwitch.setTag(""); + saySwitch.setImageResource(R.mipmap.special_icon_on); + } + anchorDemo.setVisibility(VISIBLE); + } - } - adapter.setList(data); + } + + @Override + public void onError(String error) { + + } + }); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index 1411da666..51ce764c1 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java @@ -53,6 +53,7 @@ import com.yunbao.faceunity.FaceManager; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; +import com.yunbao.live.dialog.LiveAnchorSayPopDialog; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment; import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment; @@ -96,6 +97,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl private int selectClarity = 1; private LiveOpenCustomPopup liveOpenCustomPopup; private boolean selector = true; + private String mLiveUid; public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { super(context, parentView, liveSdk); @@ -195,6 +197,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl findViewById(R.id.btn_wishlist).setOnClickListener(this); findViewById(R.id.btn_horizontally).setOnClickListener(this); findViewById(R.id.anchor_agreement_layout).setOnClickListener(this); + findViewById(R.id.btn_live_anchor_say).setOnClickListener(this); if (manager != null) { manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() { @@ -565,6 +568,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl .append("&token=") .append(model.getToken()); RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false); + } else if (i == R.id.btn_live_anchor_say) { + new LiveAnchorSayPopDialog(mContext).setLiveUid(mLiveUid).showDialog(); } } @@ -893,4 +898,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl public void onDestroy() { LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM); } + + public void setLiveUid(String mLiveUid) { + this.mLiveUid = mLiveUid; + } } 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 a8f23ad72..ce67758e7 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -37,7 +37,6 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.SimpleItemAnimator; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -69,6 +68,7 @@ import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LinkMicUserBean; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -339,6 +339,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private View mAnchorSay; private ImageView mAnchorSayImage; private TextView mAnchorSayText; + private ImageView mAnchorSayHide; //----!主播说组件---// public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { @@ -685,86 +686,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mAnchorSay = findViewById(R.id.anchor_say_layout); mAnchorSayImage = (ImageView) findViewById(R.id.anchor_say_icon); mAnchorSayText = (TextView) findViewById(R.id.anchor_say_text); - mAnchorSayImage.setOnClickListener(v -> { - Animation animation; - if (mAnchorSayText.getVisibility() == View.VISIBLE) { - animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_out); - } else { - animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_in); - } - animation.setAnimationListener(new Animation.AnimationListener() { - boolean isShow = false; + mAnchorSayHide = (ImageView) findViewById(R.id.anchor_say_hide); + mAnchorSayHide.setOnClickListener(v -> hideAnchorSay()); - @Override - public void onAnimationStart(Animation animation) { - if (mAnchorSayText.getVisibility() == View.GONE) { - mAnchorSayText.setVisibility(View.VISIBLE); - isShow = true; - } - } - @Override - public void onAnimationEnd(Animation animation) { - if (mAnchorSayText.getVisibility() == View.VISIBLE && !isShow) { - mAnchorSayText.setVisibility(View.GONE); - } - } - - @Override - public void onAnimationRepeat(Animation animation) { - - } - }); - mAnchorSayText.startAnimation(animation); - }); - - mAnchorSayImage.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - Animation animation; - if (mAnchorSay.getVisibility() == View.VISIBLE) { - animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_out); - } else { - animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_in); - if(v==null){ - mAnchorSayText.setVisibility(View.VISIBLE); - } - } - animation.setAnimationListener(new Animation.AnimationListener() { - boolean isShow = false; - - @Override - public void onAnimationStart(Animation animation) { - if (mAnchorSay.getVisibility() == View.GONE) { - mAnchorSay.setVisibility(View.VISIBLE); - isShow = true; - } - } - - @Override - public void onAnimationEnd(Animation animation) { - if (mAnchorSay.getVisibility() == View.VISIBLE && !isShow) { - mAnchorSay.setVisibility(View.GONE); - } - if(v!=null) { - new Handler(Looper.getMainLooper()).postDelayed(() -> { - onLongClick(null); - - }, 2000); - }else{ - mAnchorSayText.setVisibility(View.VISIBLE); - } - } - - @Override - public void onAnimationRepeat(Animation animation) { - - } - }); - mAnchorSay.startAnimation(animation); - return false; - } - }); btnEvent = findViewById(R.id.btn_event); fullScreen = (FullServiceNotificationView) findViewById(R.id.full_screen); noble = (NobleNoticeView) findViewById(R.id.noble); @@ -1259,6 +1184,48 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis initStarChallengeStatus(); } + /** + * 隐藏女神说 + */ + private void hideAnchorSay() { + boolean hide = mAnchorSay.getTag() == null || (boolean) mAnchorSay.getTag(); + Animation animation; + if (hide) { + animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_out); + } else { + animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_in); + } + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + if (!hide) { + mAnchorSay.setX((float) mAnchorSayImage.getTag()); + mAnchorSayImage.setVisibility(View.VISIBLE); + mAnchorSayText.setVisibility(View.VISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show); + } + } + + @Override + public void onAnimationEnd(Animation animation) { + if (hide) { + 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); + } + mAnchorSay.setTag(!hide); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + mAnchorSay.startAnimation(animation); + } + /** * 获取当前直播间星级 */ @@ -4277,4 +4244,53 @@ 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); + LiveNetManager.get(mContext) + .getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(LiveAnchorSayModel data) { + Log.i("女神说", "onSuccess: " + data); + sayModel = data; + LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); + if (preview != null) { + mAnchorSayText.setText(getText(data.getLivePreview().getContent())); + ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage); + if (preview.getIsShow() == 1) { + mAnchorSay.setVisibility(View.VISIBLE); + } + } + + } + + @Override + public void onError(String error) { + + } + + public String getText(String content) { + int t = 4; + float len = (float) content.length() / t; + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + for (int i = 0; i < len; i++) { + if (len - i < 1) { + sb.append(content.substring(i * t)); + } else { + sb.append(content.substring(i * t, i * t + t)).append("\n"); + } + } + return sb.toString(); + } + }); + } } 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 5d1c3e7b7..54fc2e672 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -470,6 +470,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setVotes(data.getEnterRoomInfo().getVotestotal()); //真爱排行 数量 mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum()); + //初始化女神说 + mLiveRoomViewHolder.initAnchorSay(); + isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); if (isattention == 0) { if (countDownTimer != null) { diff --git a/live/src/main/res/anim/view_live_anchor_say_text_out.xml b/live/src/main/res/anim/view_live_anchor_say_text_out.xml index 4e314cec9..33a223e8b 100644 --- a/live/src/main/res/anim/view_live_anchor_say_text_out.xml +++ b/live/src/main/res/anim/view_live_anchor_say_text_out.xml @@ -8,5 +8,5 @@ + android:toAlpha="0.2" /> \ 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 d36bfaa68..1b6d25537 100644 --- a/live/src/main/res/layout/dialog_anchor_say.xml +++ b/live/src/main/res/layout/dialog_anchor_say.xml @@ -8,8 +8,8 @@ + android:layout_width="67dp" + android:layout_height="88dp"> - - + app:layout_constraintTop_toTopOf="parent" + tools:srcCompat="@color/main_color_79CDF9" /> + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index ce2dd81d1..ed31db548 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -1261,10 +1261,11 @@ diff --git a/live/src/main/res/layout/view_new_live_ready.xml b/live/src/main/res/layout/view_new_live_ready.xml index 43961a227..5b17cb408 100644 --- a/live/src/main/res/layout/view_new_live_ready.xml +++ b/live/src/main/res/layout/view_new_live_ready.xml @@ -1,6 +1,7 @@ @@ -45,7 +46,7 @@ @@ -135,7 +136,7 @@ android:layout_marginEnd="16dp" android:gravity="center" android:orientation="horizontal" - app:layout_constraintEnd_toStartOf="@+id/btn_wishlist" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/btn_live_clarity"> + + + + + + + + + + app:layout_constraintTop_toBottomOf="@+id/btn_live_anchor_say" /> +IgNcU9XiJuNF|NQ?2%dwh*r#L(u}hO#f)n)?TOMs9?|Q?Is~Sgy7S5 z`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zxbWZ{D0Jw!w$aKVy^Wt!XKhfQqm*+WRKfp-tzdVwwd~PWushm1>RjWdSc5WLEvgxC z@h5NSSSaNl5=cX~n%l%WG`cz3QB3(sr_Drh`fLu9E{%4_na6^Clmo`Kw|+H6cH#8aDgh8XA;J|?ozi|z&Esfx7U%)7a7dPPHEDH6CO-?fD7`|rKZblcKE>C`vMhmRb#tq+u@esI0N zzqPHk)$i$8R;#yV&YW{`(EH)SmW!6IK1qvto8iE=CwAx44pG91Po07Mr+!{{=hw0o zN$jTi!w!d|&6;ulSLK>lp1Zu}N>=BUJO3hHePZ}}fH`@MRkm&Q@ADQml(ZdcE9kuP z^4B-5lO4bP#nJ8asAoRweRs;a69*-&Z%TKbzje&7d${YXDY=)h<<}*95epxcGdsFS)ZaVqyf}W>mfBKQ=#`EZfw0e;(vuokX z=Te^;w02AWk=lOYt6Mu(xF&tJ`!${ITwmSQl*)#{zJJDl8Q5UU=wIo}ubx-&B4MhY xGgOEFWzP%q{wlv(lziN%zjyDQb^mc7iqAJSyuV)e1^ { - new LiveAnchorSayPopDialog(mContext).showDialog(); + new LiveAnchorSayPopDialog(mContext).setLiveUid("98275").showDialog(); return false; });