新人观播礼开发基本完成

This commit is contained in:
老皮 2024-10-08 15:28:01 +08:00
parent 99bc3cd71c
commit ef09d9c58a
9 changed files with 126 additions and 2 deletions

View File

@ -205,7 +205,9 @@ public class Constants {
public static final String Lucky100Check = "Lucky100Check";//幸运天使
public static final String PrankSendData = "PrankSendData";//整蛊进度
public static final String SOCKET_SEND_NEW_TASK_PUSH="SendNewTaskPush";//直播间-新用户完成任务push
public static final String SOCKET_SEND_NEW_TASK_IM ="SendNewTaskIM"; //直播间新用户领取礼物IM
public static final int SOCKET_WHAT_CONN = 0;
public static final int SOCKET_WHAT_DISCONN = 2;
public static final int SOCKET_WHAT_BROADCAST = 1;

View File

@ -87,4 +87,7 @@
<color name="gray_F4F4F4">#F4F4F4</color>
<color name="color_555555">#555555</color>
<color name="color_525252">#525252</color>
<color name="chat_event_entrance">#FFFFBD59</color>
</resources>

View File

@ -1561,6 +1561,16 @@ public class LiveAudienceActivity extends LiveActivity {
manager.setSudName(event.getAvatar(), event.getCreateSudRoomModel());
}
break;
case LIVE_AUTHOR_NEW_TASK_PUSH:
if (manager != null) {
manager.setNewTaskPush(event.getUid(),event.getHrefUrl());
}
break;
case LIVE_AUTHOR_GIFT_PUSH:
if (manager != null) {
manager.setNewTaskIM(event.getUid());
}
break;
}

View File

@ -8,6 +8,8 @@ import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_TASK_INLET;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_TASK_INLET1;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@ -19,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;
@ -551,6 +556,44 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
stringBuffer.append( "<font color='#ECB238'>【"+bean.getContent()+"】</font>");
mTextView.setText(Html.fromHtml(stringBuffer.toString()));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
} else if(bean.getType() == TYPE_TO_TASK_INLET){
String str = "發送彈幕與主播進行互動吧!完成弹幕互动和点赞任務,还可以领取超多新人豪華禮物哦!活动入口";
String str_en = "Complete the barrage interaction and like tasks, and you can also receive many new luxury gifts! Event entrance";
if(WordUtil.isNewZh()){
SpannableString spannableString = new SpannableString(str);
int start = str.indexOf("活动入口");
int end = start + "活动入口".length();
spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mTextView.setText(spannableString);
}else{
SpannableString spannableString = new SpannableString(str_en);
int start = str_en.indexOf("Event entrance");
int end = start + "Event entrance".length();
spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mTextView.setText(spannableString);
}
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else if(bean.getType() == TYPE_TO_TASK_INLET1){
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);
spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), 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);
spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mTextView.setText(spannableString);
}
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else{
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡

View File

@ -59,6 +59,16 @@ public class LiveAudienceEvent extends BaseModel {
public String mStream;
public String mLiveUid, giftId;
public SudGameDateModel createSudRoomModel;
private String hrefUrl;
public String getHrefUrl() {
return hrefUrl;
}
public LiveAudienceEvent setHrefUrl(String url) {
hrefUrl = url;
return this;
}
public SudGameDateModel getCreateSudRoomModel() {
return createSudRoomModel;
@ -491,7 +501,9 @@ public class LiveAudienceEvent extends BaseModel {
PK_RANK_START(76, "PK排位赛开始"),
GuardSpecialEffect(77, "PK排位赛开始"),
LIVE_DIALOG_ANCHOR_TIPS(78, "主播公会赛tips"),
LIVE_REMOVE_LIVEUID(79, "主播退出多人PK");
LIVE_REMOVE_LIVEUID(79, "主播退出多人PK"),
LIVE_AUTHOR_NEW_TASK_PUSH(80, "新人任务完成"),
LIVE_AUTHOR_GIFT_PUSH(81, "新人领取礼物");
private int type;
private String name;

View File

@ -802,6 +802,19 @@ public class SocketSwClient {
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_DIALOG_ANCHOR_TIPS)
.setObject(WordUtil.isNewZh() ? item.getString("text") : item.getString("text_en")));
case Constants.SOCKET_SEND_NEW_TASK_PUSH:
item = map.getJSONObject("ct");
if(CommonAppConfig.getInstance().getUid().equals(item.getString("uid"))){
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_NEW_TASK_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href")));
}
break;
case Constants.SOCKET_SEND_NEW_TASK_IM:
item = map.getJSONObject("ct");
if(CommonAppConfig.getInstance().getUid().equals(item.getString("uid"))){
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_GIFT_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href")));
}
break;
}
}

View File

@ -948,6 +948,10 @@ public class LiveTextRender {
}
*/
if (bean == null || bean.getContent() == null){
builder.append("null");
return builder;
}
builder.append(bean.getContent());
//超皇设置渐变色展示昵称
if (TextUtils.equals("7", bean.getNobleId()) && !TextUtils.isEmpty(bean.getContentColor())) {

View File

@ -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.app.Activity;
@ -748,11 +750,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000 * 300));
}
}
//向chatList发送一条活动入口消息
public void showSendGiftTaskIMMsg() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
LiveChatBean bean = new LiveChatBean();
bean.setType(LiveChatBean.TYPE_TO_TASK_INLET1);
mLiveChatAdapter.insertItem(bean);
}
}, 1000);
}
public boolean isShowH5Dialog;
public void showH5Dialog() {
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+"&app_from=PDL");
bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+"&app_from=PDLive");
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
@ -1817,6 +1833,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
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) {
L.e("TYPE_TO_TASK_INLET1=" + bean.getType());
showH5Dialog();
}else{
showUserDialog(bean.getId());
}
@ -5420,6 +5439,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
RouteUtil.forwardBattlePass();
return;
}
if (mBannerList4.get(p).getLink().equals("NewUser") || mBannerList4.get(p).getType() == 999) {
showH5Dialog();
return;
}
if (TextUtils.equals("特惠首冲", mBannerList4.get(p).getName())) {
Map<String, String> map_ekv = new HashMap<String, String>();

View File

@ -2285,6 +2285,19 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
public void setNewTaskPush(String uid,String url) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showTaskDetailsNotify1(url);
}
}
public void setNewTaskIM(String uid) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showSendGiftTaskIMMsg();
}
}
/**
* 全服喇叭
*