diff --git a/common/src/main/res/drawable/background_e6000.xml b/common/src/main/res/drawable/background_e6000.xml
new file mode 100644
index 000000000..564f3e6fc
--- /dev/null
+++ b/common/src/main/res/drawable/background_e6000.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java
new file mode 100644
index 000000000..c24849ea0
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java
@@ -0,0 +1,76 @@
+package com.yunbao.live.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.yunbao.common.adapter.OnItemClickListener;
+import com.yunbao.live.R;
+
+import java.util.List;
+
+public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter {
+ private Context mContext;
+ private List list;
+ private int click = -1;
+ private OnItemClickListener onItemClickListener;
+
+ public LiveAnchorSayItemsAdapter(Context mContext) {
+ this.mContext = mContext;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ notifyDataSetChanged();
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.onItemClickListener = onItemClickListener;
+ }
+
+ @NonNull
+ @Override
+ public ItemsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ return new ItemsViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_anchor_say, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemsViewHolder holder, int position) {
+ holder.setData(list.get(position), position);
+ }
+
+ @Override
+ public int getItemCount() {
+ return list.size();
+ }
+
+ public class ItemsViewHolder extends RecyclerView.ViewHolder {
+ private TextView textView;
+
+ public ItemsViewHolder(@NonNull View itemView) {
+ super(itemView);
+ textView = itemView.findViewById(R.id.anchor_say_text);
+ itemView.setOnClickListener(v -> {
+ click = getAbsoluteAdapterPosition();
+ if (onItemClickListener != null) {
+ onItemClickListener.onItemClick(click);
+ }
+ notifyDataSetChanged();
+ });
+ }
+
+ public void setData(String text, int position) {
+ textView.setText(text);
+ if (position == click) {
+ itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);
+ } else {
+ itemView.setBackgroundResource(R.drawable.bg_anchor_say);
+ }
+ }
+ }
+}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java
new file mode 100644
index 000000000..8bb57df18
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java
@@ -0,0 +1,126 @@
+package com.yunbao.live.dialog;
+
+import android.content.Context;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.GridLayoutManager;
+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.dialog.AbsDialogPopupWindow;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.live.R;
+import com.yunbao.live.adapter.LiveAnchorSayItemsAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
+ RecyclerView list;
+ View anchorDemo;
+ LiveAnchorSayItemsAdapter adapter;
+ ImageView saySwitch;
+ TextView sayText;
+ EditText sayEdit;
+
+ public LiveAnchorSayPopDialog(@NonNull Context context) {
+ super(context);
+ }
+
+ @Override
+ public void buildDialog(XPopup.Builder builder) {
+ builder.autoFocusEditText(false);
+ builder.enableDrag(false);
+ builder.borderRadius(50);
+ }
+
+ @Override
+ public int bindLayoutId() {
+ return R.layout.dialog_anchor_say;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ adapter = new LiveAnchorSayItemsAdapter(getContext());
+ anchorDemo = findViewById(R.id.anchor_say);
+ sayText = anchorDemo.findViewById(R.id.anchor_say_text);
+ list = findViewById(R.id.anchor_say_list);
+ saySwitch = findViewById(R.id.say_switch);
+ sayEdit = findViewById(R.id.anchor_say_edit);
+ list.setLayoutManager(new GridLayoutManager(getContext(), 3));
+ list.setAdapter(adapter);
+ adapter.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(int position) {
+
+
+ }
+ });
+ 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);
+
+ }
+ });
+
+ sayEdit.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+ StringBuilder sb = new StringBuilder();
+ int n = (s.length() + 3) / 4;
+ for (int i = 0; i < n; i++) {
+ if (i < (n - 1)) {
+ sb.append(s.toString().substring(i * 4, (i + 1) * 4)).append("\n");
+ } else {
+ sb.append(s.toString().substring(i * 4));
+ }
+ }
+ if(sb.length()==0){
+ sb.append("默认字符\n默认字符\n默认字符");
+ }
+ sayText.setText(sb.toString());
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+
+ }
+
+ });
+
+ }
+
+ private void initData() {
+ List data = new ArrayList<>();
+ for (int i = 0; i < 20; i++) {
+ data.add("data " + i);
+
+ }
+ adapter.setList(data);
+ }
+}
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 604304be3..a8f23ad72 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -37,6 +37,7 @@ 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;
@@ -334,6 +335,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//全服通知
private ImageView customFullServiceNotify;
+ //----主播说组件---//
+ private View mAnchorSay;
+ private ImageView mAnchorSayImage;
+ private TextView mAnchorSayText;
+ //----!主播说组件---//
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView);
@@ -676,6 +682,89 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void init() {
EventBus.getDefault().register(this);
+ 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;
+
+ @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);
@@ -1825,7 +1914,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onError(String error) {
- ToastUtil.show( R.string.net_error);
+ ToastUtil.show(R.string.net_error);
}
});
diff --git a/live/src/main/res/anim/view_live_anchor_say_text_in.xml b/live/src/main/res/anim/view_live_anchor_say_text_in.xml
new file mode 100644
index 000000000..b31b61750
--- /dev/null
+++ b/live/src/main/res/anim/view_live_anchor_say_text_in.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
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
new file mode 100644
index 000000000..4e314cec9
--- /dev/null
+++ b/live/src/main/res/anim/view_live_anchor_say_text_out.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/bg_anchor_say.xml b/live/src/main/res/drawable/bg_anchor_say.xml
new file mode 100644
index 000000000..e698c0765
--- /dev/null
+++ b/live/src/main/res/drawable/bg_anchor_say.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/bg_anchor_say_select.xml b/live/src/main/res/drawable/bg_anchor_say_select.xml
new file mode 100644
index 000000000..607704adc
--- /dev/null
+++ b/live/src/main/res/drawable/bg_anchor_say_select.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 000000000..d36bfaa68
--- /dev/null
+++ b/live/src/main/res/layout/dialog_anchor_say.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/item_anchor_say.xml b/live/src/main/res/layout/item_anchor_say.xml
new file mode 100644
index 000000000..f1fc38fff
--- /dev/null
+++ b/live/src/main/res/layout/item_anchor_say.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/sim_live_room_anchor_say.xml b/live/src/main/res/layout/sim_live_room_anchor_say.xml
new file mode 100644
index 000000000..44c17dda3
--- /dev/null
+++ b/live/src/main/res/layout/sim_live_room_anchor_say.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
\ 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 063e7d89a..ce2dd81d1 100644
--- a/live/src/main/res/layout/view_live_room.xml
+++ b/live/src/main/res/layout/view_live_room.xml
@@ -1258,6 +1258,17 @@
+
+
+
+ android:visibility="visible" />
+ android:layout_marginTop="60dp"
+ android:visibility="gone" />
\ No newline at end of file
diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
index 6fb5f18d4..a41f106e5 100644
--- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
+++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
@@ -9,6 +9,7 @@ import android.widget.ImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.WordUtil;
+import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
@@ -43,6 +44,11 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
+ img_trophy.setOnLongClickListener(v -> {
+ new LiveAnchorSayPopDialog(mContext).showDialog();
+ return false;
+ });
+
}