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 e0b4ef681..6c3f99b6d 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -16,6 +16,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -577,6 +578,29 @@ 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 50c3e6715..a70d6349e 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 @@ -18,6 +18,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -1148,6 +1149,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(); + } + /** * 设置主播联系方式 * @param liveUid 直播间id 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 456430ce4..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" /> { - new LiveAnchorEditCallMeDialog(mContext).showDialog(); + new LiveAnchorSayPopDialog(mContext).setLiveUid("98275").showDialog(); return false; });