新人奖励领取

This commit is contained in:
Martin 2024-08-26 13:15:09 +08:00
parent f3945e1b21
commit e1f59b9223
6 changed files with 55 additions and 4 deletions

View File

@ -21,11 +21,14 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html; import android.text.Html;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.Log; import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -239,6 +242,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
SVGAImageView avatar_gift_svga; SVGAImageView avatar_gift_svga;
RelativeLayout avatarLayout; RelativeLayout avatarLayout;
TextView event_entrance;
public Vh(View itemView) { public Vh(View itemView) {
super(itemView); super(itemView);
mBg = (LinearLayout) itemView.findViewById(R.id.bg); 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); msg_avatar = itemView.findViewById(R.id.msg_avatar);
avatar_gift_svga = itemView.findViewById(R.id.avatar_gift_svga); avatar_gift_svga = itemView.findViewById(R.id.avatar_gift_svga);
avatarLayout = itemView.findViewById(R.id.avatarLayout); avatarLayout = itemView.findViewById(R.id.avatarLayout);
event_entrance = itemView.findViewById(R.id.event_entrance);
} }
void setData(final LiveChatBean bean, int position) { void setData(final LiveChatBean bean, int position) {
@ -571,12 +578,26 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
stringBuffer.append("<font color='#ffffff'>" + (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!") + "</font>"); stringBuffer.append("<font color='#ffffff'>" + (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!") + "</font>");
stringBuffer.append("<font color='#FFFFBD59'>" + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + "</font>"); stringBuffer.append("<font color='#FFFFBD59'>" + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + "</font>");
mTextView.setText(Html.fromHtml(stringBuffer.toString())); mTextView.setText(Html.fromHtml(stringBuffer.toString()));
event_entrance.setVisibility(View.VISIBLE);
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else if(bean.getType() == TYPE_TO_TASK_INLET1){ }else if(bean.getType() == TYPE_TO_TASK_INLET1){
StringBuffer stringBuffer = new StringBuffer(); String str = "您有一份獎勵可領取,點擊此處前往領取禮物吧!";
stringBuffer.append("<font color='#ffffff'>" + (WordUtil.isNewZh() ? "您有一份獎勵可領取,點擊此處 前往領取禮物吧!" : "You have a reward to claim, click here to claim your gift!") + "</font>"); String str_en = "You have a reward to claim, click here to claim your gift!";
stringBuffer.append("<font color='#FFFFBD59'>" + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + "</font>"); if(WordUtil.isNewZh()){
mTextView.setText(Html.fromHtml(stringBuffer.toString())); 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); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else{ }else{
/*avatar_gift_svga.setImageDrawable(null); /*avatar_gift_svga.setImageDrawable(null);

View File

@ -1,6 +1,8 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; 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.animation.ObjectAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
@ -1925,6 +1927,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (mContext instanceof LiveSwAnchorActivity) { } else if (mContext instanceof LiveSwAnchorActivity) {
com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder.closeMenuRed(); com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder.closeMenuRed();
} }
}else if(bean.getType() == TYPE_TO_TASK_INLET||bean.getType() == TYPE_TO_TASK_INLET1){
showH5Dialog();
} else { } else {
showUserDialog(bean.getId()); showUserDialog(bean.getId());
} }

View File

@ -615,6 +615,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
private long getNextTime(int time) { private long getNextTime(int time) {
long now = SystemClock.uptimeMillis(); long now = SystemClock.uptimeMillis();
if (time < 1000) { if (time < 1000) {
return now + time; return now + time;
} }
return now + time + -now % 1000; return now + time + -now % 1000;
@ -627,4 +628,5 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
public boolean isShowMenuRed() { public boolean isShowMenuRed() {
return menuRed.getVisibility() == View.VISIBLE; return menuRed.getVisibility() == View.VISIBLE;
} }
} }

View File

@ -62,6 +62,19 @@
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
tools:text="aaaaaaaaa111111111111111111111111111111111111111111111111111111111" /> tools:text="aaaaaaaaa111111111111111111111111111111111111111111111111111111111" />
<TextView
android:id="@+id/event_entrance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="11dp"
android:gravity="top"
android:text="@string/entrance_event"
android:textColor="#FFFFBD59"
tools:visibility="visible"
android:visibility="gone"
android:textSize="12dp" />
<LinearLayout <LinearLayout
android:id="@+id/view_follow" android:id="@+id/view_follow"
android:layout_width="96dp" android:layout_width="96dp"
@ -341,6 +354,15 @@
android:visibility="visible" android:visibility="visible"
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -165,5 +165,6 @@
<string name="live_room_gift">禮物牆</string> <string name="live_room_gift">禮物牆</string>
<string name="live_room_wishlist">心願</string> <string name="live_room_wishlist">心願</string>
<string name="live_room_new_task">新手任務</string> <string name="live_room_new_task">新手任務</string>
<string name="entrance_event">活動入口</string>
</resources> </resources>

View File

@ -168,4 +168,5 @@
<string name="live_room_gift">Gift Wall</string> <string name="live_room_gift">Gift Wall</string>
<string name="live_room_wishlist">Wishlist</string> <string name="live_room_wishlist">Wishlist</string>
<string name="live_room_new_task">Newb job</string> <string name="live_room_new_task">Newb job</string>
<string name="entrance_event">Event entrance</string>
</resources> </resources>