From e1f59b9223d784478d50bfe3e4901e04d69d5c3b Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Mon, 26 Aug 2024 13:15:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E4=BA=BA=E5=A5=96=E5=8A=B1=E9=A2=86?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/adapter/LiveChatAdapter.java | 29 ++++++++++++++++--- .../yunbao/live/views/LiveRoomViewHolder.java | 4 +++ .../live/views/LiveRyAnchorViewHolder.java | 2 ++ live/src/main/res/layout/item_live_chat.xml | 22 ++++++++++++++ live/src/main/res/values-zh/strings.xml | 1 + live/src/main/res/values/strings.xml | 1 + 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 8ff946f11..7cc20ac16 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -21,11 +21,14 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Html; import android.text.Spannable; +import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; +import android.text.style.AbsoluteSizeSpan; import android.text.style.ForegroundColorSpan; import android.util.Log; +import android.util.TypedValue; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -239,6 +242,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter { SVGAImageView avatar_gift_svga; RelativeLayout avatarLayout; + TextView event_entrance; + public Vh(View itemView) { super(itemView); mBg = (LinearLayout) itemView.findViewById(R.id.bg); @@ -272,6 +277,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter { msg_avatar = itemView.findViewById(R.id.msg_avatar); avatar_gift_svga = itemView.findViewById(R.id.avatar_gift_svga); avatarLayout = itemView.findViewById(R.id.avatarLayout); + + event_entrance = itemView.findViewById(R.id.event_entrance); } void setData(final LiveChatBean bean, int position) { @@ -571,12 +578,26 @@ public class LiveChatAdapter extends RecyclerView.Adapter { stringBuffer.append("" + (WordUtil.isNewZh() ? "發送彈幕與主播進行互動吧!完成弹幕互动和点赞任務,还可以领取超多新人豪華禮物哦" : "Send bullet screens to interact with the anchor! Complete the bullet screen interaction and like tasks, and you can also receive many new luxury gifts!") + ""); stringBuffer.append("," + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + ""); mTextView.setText(Html.fromHtml(stringBuffer.toString())); + event_entrance.setVisibility(View.VISIBLE); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); }else if(bean.getType() == TYPE_TO_TASK_INLET1){ - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("" + (WordUtil.isNewZh() ? "您有一份獎勵可領取,點擊此處 前往領取禮物吧!" : "You have a reward to claim, click here to claim your gift!") + ""); - stringBuffer.append("," + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + ""); - mTextView.setText(Html.fromHtml(stringBuffer.toString())); + String str = "您有一份獎勵可領取,點擊此處前往領取禮物吧!"; + String str_en = "You have a reward to claim, click here to claim your gift!"; + if(WordUtil.isNewZh()){ + SpannableString spannableString = new SpannableString(str); + int start = str.indexOf("點擊此處"); + int end = start + "點擊此處".length(); + float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, mContext.getResources().getDisplayMetrics()); + spannableString.setSpan(new AbsoluteSizeSpan((int) size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mTextView.setText(spannableString); + }else{ + SpannableString spannableString = new SpannableString(str_en); + int start = str_en.indexOf("click here"); + int end = start + "click here".length(); + float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, mContext.getResources().getDisplayMetrics()); + spannableString.setSpan(new AbsoluteSizeSpan((int) size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mTextView.setText(spannableString); + } new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); }else{ /*avatar_gift_svga.setImageDrawable(null); 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 86a6f8341..98582fdbb 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1,6 +1,8 @@ package com.yunbao.live.views; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_TASK_INLET; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_TASK_INLET1; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; @@ -1925,6 +1927,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (mContext instanceof LiveSwAnchorActivity) { com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder.closeMenuRed(); } + }else if(bean.getType() == TYPE_TO_TASK_INLET||bean.getType() == TYPE_TO_TASK_INLET1){ + showH5Dialog(); } else { showUserDialog(bean.getId()); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index f2f039cc3..0d48e9bfc 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -615,6 +615,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { private long getNextTime(int time) { long now = SystemClock.uptimeMillis(); if (time < 1000) { + return now + time; } return now + time + -now % 1000; @@ -627,4 +628,5 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { public boolean isShowMenuRed() { return menuRed.getVisibility() == View.VISIBLE; } + } diff --git a/live/src/main/res/layout/item_live_chat.xml b/live/src/main/res/layout/item_live_chat.xml index de1ca3bbd..1d39cc6e0 100644 --- a/live/src/main/res/layout/item_live_chat.xml +++ b/live/src/main/res/layout/item_live_chat.xml @@ -62,6 +62,19 @@ tools:ignore="RtlHardcoded" tools:text="aaaaaaaaa111111111111111111111111111111111111111111111111111111111" /> + + + + + + + + + diff --git a/live/src/main/res/values-zh/strings.xml b/live/src/main/res/values-zh/strings.xml index 54e305399..0b04f564f 100644 --- a/live/src/main/res/values-zh/strings.xml +++ b/live/src/main/res/values-zh/strings.xml @@ -165,5 +165,6 @@ 禮物牆 心願 新手任務 + 活動入口 diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index 7a8b9a2ea..2bf1d6c21 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -168,4 +168,5 @@ Gift Wall Wishlist Newb job + Event entrance \ No newline at end of file