女神说编辑完成
This commit is contained in:
parent
7356431414
commit
330cf1faa2
@ -588,6 +588,7 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<String>> setLivePreviewInfo(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("isShow") int isShow,
|
||||
@Query("title") String title ,
|
||||
@Query("content") String content,
|
||||
@Query("styleImage") String styleImage
|
||||
);
|
||||
|
@ -1286,10 +1286,11 @@ public class LiveNetManager {
|
||||
*/
|
||||
public void setLivePreviewInfo(String liveUid,
|
||||
int isShow,
|
||||
String title,
|
||||
String content,
|
||||
String styleImage, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setLivePreviewInfo(liveUid, isShow, content, styleImage)
|
||||
.setLivePreviewInfo(liveUid, isShow,title, content, styleImage)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -8,6 +9,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@ -20,7 +22,7 @@ import java.util.List;
|
||||
public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSayItemsAdapter.ItemsViewHolder> {
|
||||
private Context mContext;
|
||||
private List<String> list;
|
||||
private int click = -1;
|
||||
private int click = 0;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
|
||||
public LiveAnchorSayItemsAdapter(Context mContext) {
|
||||
@ -45,12 +47,17 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ItemsViewHolder holder, int position) {
|
||||
holder.setData(list.get(position), position);
|
||||
if (position == 0) {
|
||||
holder.setData("", 0);
|
||||
return;
|
||||
} else {
|
||||
holder.setData(list.get(position - 1), position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
return list.size() + 1;
|
||||
}
|
||||
|
||||
public class ItemsViewHolder extends RecyclerView.ViewHolder {
|
||||
@ -59,8 +66,8 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
|
||||
|
||||
public ItemsViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
textView = itemView.findViewById(R.id.anchor_say_text);
|
||||
icon = itemView.findViewById(R.id.anchor_say_icon);
|
||||
textView = itemView.findViewById(R.id.contentTv);
|
||||
icon = itemView.findViewById(R.id.anchorSayBg);
|
||||
itemView.setOnClickListener(v -> click());
|
||||
textView.setOnClickListener(v -> click());
|
||||
icon.setOnClickListener(v -> click());
|
||||
@ -69,15 +76,26 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
|
||||
|
||||
private void click() {
|
||||
click = getAbsoluteAdapterPosition();
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(list.get(click), click);
|
||||
if (click > 0) {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(list.get(click), click);
|
||||
}
|
||||
} else {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", 0);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setData(String text, int position) {
|
||||
// textView.setText("已输入的\n内容已输\n入的内容\n已输入的");
|
||||
ImgLoader.display(mContext, text, icon);
|
||||
|
||||
// textView.setText("已输入的\n内容已输\n入的内容\n已输入的");
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
icon.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.bg_live_room_say));
|
||||
} else {
|
||||
ImgLoader.display(mContext, text, icon);
|
||||
}
|
||||
if (position == click) {
|
||||
itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);
|
||||
} else {
|
||||
|
@ -39,8 +39,12 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
ImageView saySwitch;
|
||||
ImageView close;
|
||||
ImageView sayBg;
|
||||
|
||||
TextView sayTitleTv;
|
||||
TextView sayText;
|
||||
|
||||
EditText sayEdit;
|
||||
EditText titleEdit;
|
||||
String mLiveUid;
|
||||
String url;
|
||||
LiveAnchorSayModel sayModel;
|
||||
@ -70,7 +74,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
setSayData(url, sayEdit.getText().toString());
|
||||
setSayData(url, titleEdit.getText().toString(), sayEdit.getText().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -83,12 +87,17 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
super.onCreate();
|
||||
adapter = new LiveAnchorSayItemsAdapter(getContext());
|
||||
anchorDemo = findViewById(R.id.anchor_say);
|
||||
sayText = anchorDemo.findViewById(R.id.anchor_say_text);
|
||||
|
||||
sayTitleTv = anchorDemo.findViewById(R.id.titleTv);
|
||||
sayText = anchorDemo.findViewById(R.id.contentTv);
|
||||
sayBg = anchorDemo.findViewById(R.id.anchorSayBg);
|
||||
|
||||
list = findViewById(R.id.anchor_say_list);
|
||||
saySwitch = findViewById(R.id.say_switch);
|
||||
sayEdit = findViewById(R.id.anchor_say_edit);
|
||||
titleEdit = findViewById(R.id.titleEdit);
|
||||
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<String>() {
|
||||
@ -121,51 +130,56 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
sayModel.getLivePreview().setContent(s.toString());
|
||||
sayText.setText(getText(s.toString()));
|
||||
sayText.setText(s.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
titleEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
sayModel.getLivePreview().setTitle(s.toString());
|
||||
sayTitleTv.setText(s.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
close.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setSayData(String url, String edit) {
|
||||
if(sayModel==null||sayModel.getLivePreview()==null){
|
||||
private void setSayData(String url, String title, String edit) {
|
||||
if (sayModel == null || sayModel.getLivePreview() == null) {
|
||||
return;
|
||||
}
|
||||
Log.i("女神说", "setSayData: " + url + " " + title + " " + edit);
|
||||
LiveNetManager.get(getContext())
|
||||
.setLivePreviewInfo(
|
||||
mLiveUid,
|
||||
sayModel.getLivePreview().getIsShow(),
|
||||
title,
|
||||
edit,
|
||||
url,
|
||||
new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Log.i("女神说", "onSuccess: " + data);
|
||||
// ToastUtil.showDebug(WordUtil.isZh() ? "成功" : "success");
|
||||
// ToastUtil.showDebug(WordUtil.isZh() ? "成功" : "success");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -187,13 +201,14 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
public void onSuccess(LiveAnchorSayModel data) {
|
||||
sayModel = data;
|
||||
List<String> urls = new ArrayList<>(data.getStyle());
|
||||
adapter.setList(urls);
|
||||
// adapter.setList(urls);
|
||||
LiveAnchorSayModel.LivePreview preview = data.getLivePreview();
|
||||
if (preview != null) {
|
||||
sayText.setText(preview.getContent());
|
||||
titleEdit.setText(preview.getTitle());
|
||||
sayEdit.setText(preview.getContent());
|
||||
url = preview.getStyleImage();
|
||||
ImgLoader.display(getContext(), preview.getStyleImage(), sayBg);
|
||||
// ImgLoader.display(getContext(), preview.getStyleImage(), sayBg);
|
||||
if (preview.getIsShow() == 1) {
|
||||
saySwitch.setTag("");
|
||||
saySwitch.setImageResource(R.mipmap.special_icon_on);
|
||||
@ -210,7 +225,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnDismissListener{
|
||||
public interface OnDismissListener {
|
||||
void onDismiss();
|
||||
}
|
||||
|
||||
|
@ -7,18 +7,19 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/anchor_say"
|
||||
layout="@layout/sim_live_room_anchor_say"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="88dp"
|
||||
layout="@layout/sim_live_room_anchor_say1"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_height="500dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/background_e6000"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -65,6 +66,53 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="標題"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/titleEdit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:autofillHints=""
|
||||
android:background="@drawable/bg_item_random_pk_type_1"
|
||||
android:ems="10"
|
||||
android:hint="@string/live_anchor_say_edit_hint"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLength="30"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="#FFF"
|
||||
android:textColorHint="#80FFFFFF"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/titleTv" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contentTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="内容"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/titleEdit" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/anchor_say_edit"
|
||||
android:layout_width="0dp"
|
||||
@ -77,15 +125,14 @@
|
||||
android:ems="10"
|
||||
android:hint="@string/live_anchor_say_edit_hint"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLength="16"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColorHint="#80FFFFFF"
|
||||
android:textColor="#FFF"
|
||||
android:textColorHint="#80FFFFFF"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/contentTv" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
@ -111,7 +158,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text2"
|
||||
tools:layoutManager="GridLayoutManager"
|
||||
tools:listitem="@layout/item_anchor_say"
|
||||
tools:listitem="@layout/sim_live_room_anchor_say1"
|
||||
tools:spanCount="3" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
<include
|
||||
layout="@layout/sim_live_room_anchor_say"
|
||||
layout="@layout/sim_live_room_anchor_say1"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="88dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -3,9 +3,18 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_live_room_say"
|
||||
android:minHeight="90dp">
|
||||
android:id="@+id/sayBg"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/anchorSayBg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:src="@drawable/bg_live_room_say"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleTv"
|
||||
@ -33,11 +42,16 @@
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="9sp"
|
||||
android:textSize="10sp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="5"
|
||||
android:minLines="3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleTv"
|
||||
tools:text="欢迎大家来到我的直播间欢迎大家来到我的直播间欢迎大家来到我的直播休息13242" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="4dp"
|
||||
tools:text="欢迎大家来到我的直播间欢迎大家来到我的直播间欢迎大家来到我的直播休息" />
|
||||
|
||||
|
||||
<ImageView
|
||||
@ -51,4 +65,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1778,8 +1778,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/live_video"
|
||||
android:layout_marginStart="12dp"
|
||||
android:visibility="invisible"
|
||||
toolsvisible="visible"/>
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_pk_top"
|
||||
@ -2570,21 +2569,23 @@
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/zhengguTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/trick_up"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:paddingStart="8dp"
|
||||
android:background="@drawable/bc_zheng_gu_left"
|
||||
android:textColor="@color/white"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@drawable/bc_zheng_gu_left"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="@string/trick_up"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/prank_group_turntable_icon"
|
||||
android:layout_width="44dp"
|
||||
|
Loading…
Reference in New Issue
Block a user