Merge branch 'dev_6.5.0_anchor_say' into dev_6.5.0_anchor_call_me
# Conflicts: # common/src/main/java/com/yunbao/common/http/PDLiveApi.java # common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java # main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
This commit is contained in:
commit
3a980d22fd
@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -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<String> style;
|
||||
|
||||
public LiveAnchorSayModel() {
|
||||
}
|
||||
|
||||
public LivePreview getLivePreview() {
|
||||
return livePreview;
|
||||
}
|
||||
|
||||
public void setLivePreview(LivePreview livePreview) {
|
||||
this.livePreview = livePreview;
|
||||
}
|
||||
|
||||
public List<String> getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(List<String> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -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<ResponseModel<List<ListInfoMessageModel>>> getAnchorMsg(
|
||||
@Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit
|
||||
);
|
||||
/**
|
||||
* 获取女神说数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getLivePreviewInfo")
|
||||
Observable<ResponseModel<LiveAnchorSayModel>> getLivePreviewInfo(
|
||||
@Query("liveuid") String liveUid
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置女神说
|
||||
*
|
||||
* @param isShow 是否显示
|
||||
* @param content 内容
|
||||
* @param styleImage 女神说底图地址
|
||||
*
|
||||
*/
|
||||
@GET("/api/public/?service=Live.setLivePreview")
|
||||
Observable<ResponseModel<HttpCallbackModel>> setLivePreviewInfo(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("isShow") int isShow,
|
||||
@Query("content") String content,
|
||||
@Query("styleImage")String styleImage
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置主播联系方式
|
||||
|
@ -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<LiveAnchorSayModel> 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<HttpCallbackModel> 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
|
||||
|
@ -1089,4 +1089,5 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_medal_des4">Get a fan badge for giving gifts</string>
|
||||
<string name="clear_unread_messages">Whether to clear unread messages</string>
|
||||
<string name="support_login">The application collects location data to support login and registration functions.</string>
|
||||
<string name="layout_live_anchor_say_ready_title">女神說</string>
|
||||
</resources>
|
||||
|
@ -1085,7 +1085,7 @@
|
||||
<string name="sign_up_for">註冊PD LIVE</string>
|
||||
<string name="register_and_log_in">註冊並登錄</string>
|
||||
<string name="enjoy_a_lot">開通貴族,尊享超多特權!</string>
|
||||
|
||||
<string name="layout_live_anchor_say_ready_title">女神說</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
@ -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);
|
||||
|
@ -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<LiveAnchorSayItemsAdapter.ItemsViewHolder> {
|
||||
private Context mContext;
|
||||
private List<String> list;
|
||||
private int click = -1;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
|
||||
public LiveAnchorSayItemsAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setList(List<String> list) {
|
||||
@ -29,7 +33,7 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@ -51,21 +55,29 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
|
||||
|
||||
public class ItemsViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView textView;
|
||||
private ImageView icon;
|
||||
|
||||
public ItemsViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
textView = itemView.findViewById(R.id.anchor_say_text);
|
||||
itemView.setOnClickListener(v -> {
|
||||
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(click);
|
||||
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 {
|
||||
|
@ -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<String>() {
|
||||
@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<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Log.i("女神说", "onSuccess: " + data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
Log.e("女神说", "onError: " + error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
List<String> data = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
data.add("data " + i);
|
||||
LiveNetManager.get(getContext())
|
||||
.getLivePreviewInfo(mLiveUid, new HttpCallback<LiveAnchorSayModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveAnchorSayModel data) {
|
||||
List<String> 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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<LiveAnchorSayModel>() {
|
||||
@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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -8,5 +8,5 @@
|
||||
<alpha
|
||||
android:duration="300"
|
||||
android:fromAlpha="1"
|
||||
android:toAlpha="0" />
|
||||
android:toAlpha="0.2" />
|
||||
</set>
|
@ -8,8 +8,8 @@
|
||||
<include
|
||||
android:id="@+id/anchor_say"
|
||||
layout="@layout/sim_live_room_anchor_say"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -47,6 +47,7 @@
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
|
@ -12,7 +12,7 @@
|
||||
<include
|
||||
layout="@layout/sim_live_room_anchor_say"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="88dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -2,34 +2,46 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="88dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/anchor_say_icon"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/red"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/anchor_say_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/blue"
|
||||
android:ellipsize="none"
|
||||
android:inputType="textMultiLine"
|
||||
android:text="中文测试\n中文测试\n中文测试"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
android:maxEms="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@color/main_color_79CDF9"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/anchor_say_icon" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@color/main_color_79CDF9" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/anchor_say_text"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:ellipsize="none"
|
||||
android:gravity="center"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxEms="4"
|
||||
android:text="中文测试\n中文测试\n中文测试\n中文测试"
|
||||
android:textColor="#333333"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/anchor_say_icon"
|
||||
tools:text="中文测试\n中文测试\n中文测试\n中文测试" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/anchor_say_hide"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_live_anchor_say_show" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1261,10 +1261,11 @@
|
||||
<include
|
||||
android:id="@+id/anchor_say_layout"
|
||||
layout="@layout/sim_live_room_anchor_say"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_alignBottom="@+id/live_video"
|
||||
android:layout_marginStart="14dp"
|
||||
android:visibility="invisible"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="@color/white" />
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/traceroute_rootview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -45,7 +46,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/traceroute_item"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="98dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
@ -95,10 +96,10 @@
|
||||
android:id="@+id/btn_room_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_live_class"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_live_clarity"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@ -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">
|
||||
|
||||
<TextView
|
||||
@ -160,12 +161,12 @@
|
||||
android:id="@+id/btn_wishlist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_live_clarity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_wishlist"
|
||||
@ -185,6 +186,43 @@
|
||||
android:src="@mipmap/icon_live_more" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_live_anchor_say"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_room_type">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_anchor_say"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@mipmap/icon_fhd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/live_anchor_say"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/layout_live_anchor_say_ready_title"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/icon_live_more" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="0dp"
|
||||
@ -195,7 +233,7 @@
|
||||
android:background="@drawable/bg_line"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_live_class" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_live_anchor_say" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/avatar"
|
||||
|
BIN
live/src/main/res/mipmap-mdpi/ic_live_anchor_say_hide.png
Normal file
BIN
live/src/main/res/mipmap-mdpi/ic_live_anchor_say_hide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
live/src/main/res/mipmap-mdpi/ic_live_anchor_say_show.png
Normal file
BIN
live/src/main/res/mipmap-mdpi/ic_live_anchor_say_show.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -1,14 +1,19 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.dialog.LiveAnchorEditCallMeDialog;
|
||||
import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
|
||||
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
import com.yunbao.main.activity.TestActivity;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/22.
|
||||
@ -40,7 +45,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
||||
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
|
||||
|
||||
img_trophy.setOnLongClickListener(v -> {
|
||||
new LiveAnchorEditCallMeDialog(mContext).showDialog();
|
||||
new LiveAnchorSayPopDialog(mContext).setLiveUid("98275").showDialog();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user