update 调整女神说布局大小

This commit is contained in:
2023-04-01 11:14:24 +08:00
parent ef757a8adc
commit 97ad5c2d92
6 changed files with 28 additions and 25 deletions

View File

@@ -76,7 +76,7 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
}
public void setData(String text, int position) {
textView.setText("已输入的\n内容已输\n入的内容\n入的内容");
textView.setText("已输入的内容\n已输入的内容\n已输入的");
ImgLoader.display(mContext, text, icon);
if (position == click) {
itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);

View File

@@ -121,20 +121,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
sayModel.getLivePreview().setContent(s.toString());
StringBuilder sb = new StringBuilder();
int len=6;
int n = (s.length() + 3) / len;
for (int i = 0; i < n; i++) {
if (i < (n - 1)) {
sb.append(s.toString().substring(i * len, (i + 1) * len)).append("\n");
} else {
sb.append(s.toString().substring(i * len));
}
}
if (sb.length() == 0) {
sb.append("默认字符\n默认字符\n默认字符");
}
sayText.setText(sb.toString());
sayText.setText(getText(s.toString()));
}
@Override
@@ -142,6 +129,21 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
}
public String getText(String content) {
int t = 6;
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();
}
});
close.setOnClickListener(v -> {
dismiss();