盲盒全服通知逻辑

This commit is contained in:
18401019693 2023-05-27 11:40:09 +08:00
parent b4dc035a1b
commit 66290323d8
41 changed files with 720 additions and 109 deletions

View File

@ -0,0 +1,142 @@
package com.yunbao.common.event;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel;
public class AllServerNotifyEvent extends BaseModel {
//礼物图标
@SerializedName("gifticon")
private String giftIcon;
//用户名
@SerializedName("userNiceName")
private String userNiceName;
//礼物名称
@SerializedName("giftname")
private String giftName;
//盲盒名称
@SerializedName("box_type_name")
private String boxTypeName;
//饰品名称
@SerializedName("dress_name")
private String dressName;
//区分礼物还是饰品 lw 1 sp 0
@SerializedName("gift_notification")
private String giftNotification;
//盲盒礼物ID
@SerializedName("blind_box_id")
private String blindBoxId;
//盲盒类型
@SerializedName("box_type")
private String boxType;
//饰品图片
@SerializedName("display_src")
private String displaySrc;
//主播名字
@SerializedName("ancherName")
private String anchorName;
public String getAnchorName() {
return anchorName;
}
public AllServerNotifyEvent setAnchorName(String anchorName) {
this.anchorName = anchorName;
return this;
}
public String getDisplaySrc() {
return displaySrc;
}
public AllServerNotifyEvent setDisplaySrc(String displaySrc) {
this.displaySrc = displaySrc;
return this;
}
public String getBoxType() {
return boxType;
}
public AllServerNotifyEvent setBoxType(String boxType) {
this.boxType = boxType;
return this;
}
public String getGiftIcon() {
return giftIcon;
}
public AllServerNotifyEvent setGiftIcon(String giftIcon) {
this.giftIcon = giftIcon;
return this;
}
public String getUserNiceName() {
return userNiceName;
}
public AllServerNotifyEvent setUserNiceName(String userNiceName) {
this.userNiceName = userNiceName;
return this;
}
public String getGiftName() {
return giftName;
}
public AllServerNotifyEvent setGiftName(String giftName) {
this.giftName = giftName;
return this;
}
public String getBoxTypeName() {
return boxTypeName;
}
public AllServerNotifyEvent setBoxTypeName(String boxTypeName) {
this.boxTypeName = boxTypeName;
return this;
}
public String getDressName() {
return dressName;
}
public AllServerNotifyEvent setDressName(String dressName) {
this.dressName = dressName;
return this;
}
public String getGiftNotification() {
return giftNotification;
}
public AllServerNotifyEvent setGiftNotification(String giftNotification) {
this.giftNotification = giftNotification;
return this;
}
public String getBlindBoxId() {
return blindBoxId;
}
public AllServerNotifyEvent setBlindBoxId(String blindBoxId) {
this.blindBoxId = blindBoxId;
return this;
}
@Override
public String toString() {
return "\n" + "AllServerNotifyEvent{" + "\n" +
"giftIcon='" + giftIcon + '\'' + "\n" +
", userNiceName='" + userNiceName + '\'' + "\n" +
", giftName='" + giftName + '\'' + "\n" +
", boxTypeName='" + boxTypeName + '\'' + "\n" +
", dressName='" + dressName + '\'' + "\n" +
", giftNotification='" + giftNotification + '\'' + "\n" +
", blindBoxId='" + blindBoxId + '\'' + "\n" +
", boxType='" + boxType + '\'' + "\n" +
", displaySrc='" + displaySrc + '\'' + "\n" +
'}' + "\n" ;
}
}

View File

@ -69,8 +69,6 @@ public class SendBlindGiftEvent extends BaseModel {
private String needcoin; private String needcoin;
@SerializedName("gift_msg") @SerializedName("gift_msg")
private String giftMsg; private String giftMsg;
@SerializedName("gift_notification")
private boolean giftNotification;
@SerializedName("gift_colour") @SerializedName("gift_colour")
private String giftColour; private String giftColour;
@SerializedName("box_type") @SerializedName("box_type")
@ -101,6 +99,8 @@ public class SendBlindGiftEvent extends BaseModel {
private String dressColour; private String dressColour;
@SerializedName("dress_threshold_value") @SerializedName("dress_threshold_value")
private String dressThresholdValue; private String dressThresholdValue;
@SerializedName("threshold_value")
private String thresholdValue;
@SerializedName("live_gift_notify") @SerializedName("live_gift_notify")
private String liveGiftNotify; private String liveGiftNotify;
@SerializedName("userNiceName") @SerializedName("userNiceName")
@ -110,6 +110,15 @@ public class SendBlindGiftEvent extends BaseModel {
return userNiceName; return userNiceName;
} }
public String getThresholdValue() {
return thresholdValue;
}
public SendBlindGiftEvent setThresholdValue(String thresholdValue) {
this.thresholdValue = thresholdValue;
return this;
}
public SendBlindGiftEvent setUserNiceName(String userNiceName) { public SendBlindGiftEvent setUserNiceName(String userNiceName) {
this.userNiceName = userNiceName; this.userNiceName = userNiceName;
return this; return this;
@ -403,14 +412,6 @@ public class SendBlindGiftEvent extends BaseModel {
return this; return this;
} }
public boolean isGiftNotification() {
return giftNotification;
}
public SendBlindGiftEvent setGiftNotification(boolean giftNotification) {
this.giftNotification = giftNotification;
return this;
}
public String getGiftColour() { public String getGiftColour() {
return giftColour; return giftColour;

View File

@ -5,7 +5,7 @@
<shape> <shape>
<!--设置ProgressBar进度条圆角半径--> <!--设置ProgressBar进度条圆角半径-->
<corners android:radius="3dp" /> <corners android:radius="3dp" />
<solid android:color="#65FB712D" /> <solid android:color="#90FB712D" />
</shape> </shape>
</item> </item>

View File

@ -5,7 +5,7 @@
<shape> <shape>
<!--设置ProgressBar进度条圆角半径--> <!--设置ProgressBar进度条圆角半径-->
<corners android:radius="3dp" /> <corners android:radius="3dp" />
<solid android:color="#659FFBF6" /> <solid android:color="#909FFBF6" />
</shape> </shape>
</item> </item>

View File

@ -5,7 +5,7 @@
<shape> <shape>
<!--设置ProgressBar进度条圆角半径--> <!--设置ProgressBar进度条圆角半径-->
<corners android:radius="3dp" /> <corners android:radius="3dp" />
<solid android:color="#65F8B334" /> <solid android:color="#90F8B334" />
</shape> </shape>
</item> </item>

View File

@ -1172,7 +1172,7 @@
<string name="complete_information_hint3">離開會讓您失去獎勵,您確認離開嗎?</string> <string name="complete_information_hint3">離開會讓您失去獎勵,您確認離開嗎?</string>
<string name="complete_information_hint2">愛你,愛你</string> <string name="complete_information_hint2">愛你,愛你</string>
<string name="you_guide_me">指導下我好嗎</string> <string name="you_guide_me">指導下我好嗎</string>
<string name="resend_win">再送%s个%s必得%s</string> <string name="resend_win">再送%s个必得%s</string>
<string name="have_already_win">已将%s发送至您的个性装扮</string> <string name="have_already_win">已将%s发送至您的个性装扮</string>
<string name="mini_blind_box">迷你盲盒</string> <string name="mini_blind_box">迷你盲盒</string>
<string name="collection_blind_box">典藏盲盒</string> <string name="collection_blind_box">典藏盲盒</string>

View File

@ -1165,7 +1165,7 @@ Limited ride And limited avatar frame</string>
<string name="live_vote_close_yes">Yes</string> <string name="live_vote_close_yes">Yes</string>
<string name="live_vote_close_no">No</string> <string name="live_vote_close_no">No</string>
<string name="live_vote_hide_text">VOTE</string> <string name="live_vote_hide_text">VOTE</string>
<string name="live_room_vote_over_tip">%s <br/> box disappears after %s seconds</string> <string name="live_room_vote_over_tip">%s <br /> box disappears after %s seconds</string>
<string name="live_anchor_vote_tip">Please complete the form.</string> <string name="live_anchor_vote_tip">Please complete the form.</string>
<string name="complete_information">Fill And gift</string> <string name="complete_information">Fill And gift</string>
<string name="complete_information_consumable">Fill in the \'*\' option to complete</string> <string name="complete_information_consumable">Fill in the \'*\' option to complete</string>
@ -1178,11 +1178,18 @@ Limited ride And limited avatar frame</string>
<string name="complete_information_hint3">Leave without a gift</string> <string name="complete_information_hint3">Leave without a gift</string>
<string name="complete_information_hint2">Love you</string> <string name="complete_information_hint2">Love you</string>
<string name="you_guide_me">Can you guide me</string> <string name="you_guide_me">Can you guide me</string>
<string name="resend_win">再送%s个%s必得%s</string> <string name="resend_win">再送%s个必得%s</string>
<string name="have_already_win">已将%s发送至您的个性装扮</string> <string name="have_already_win">已将%s发送至您的个性装扮</string>
<string name="mini_blind_box">迷你盲盒</string> <string name="mini_blind_box">迷你盲盒</string>
<string name="collection_blind_box">典藏盲盒</string> <string name="collection_blind_box">典藏盲盒</string>
<string name="pd_blind_box">PD盲盒</string> <string name="pd_blind_box">PD盲盒</string>
<string name="individual_dressing">个性装扮</string> <string name="individual_dressing">个性装扮</string>
<string name="random_availability">可随机获得,%s</string> <string name="random_availability">可随机获得,%s</string>
<string name="random_availability2">已获得,%s%s</string>
<string name="random_availability3">已获得,%s</string>
<string name="get_it_done">完成必得</string>
<string name="blind_box_list">盲盒榜</string>
<string name="participate_in">參與</string>
<string name="extract_to">%s在%s中抽取到了</string>
<string name="extract_to2">%S送给了%s</string>
</resources> </resources>

View File

@ -81,7 +81,6 @@ import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.CustomDrawerPopupView; import com.yunbao.common.views.CustomDrawerPopupView;
import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.common.views.weight.VerticalViewPager;
@ -861,10 +860,10 @@ public class LiveAudienceActivity extends LiveActivity {
public void showerHtml(String htmlUrl, boolean screen) { public void showerHtml(String htmlUrl, boolean screen) {
if (TextUtils.equals(htmlUrl, "recharge")) { if (TextUtils.equals(htmlUrl, "recharge")) {
RouteUtil.forwardMyCoin(mContext); RouteUtil.forwardMyCoin(mContext);
} else if (TextUtils.equals(htmlUrl, "to_me_information")){ } else if (TextUtils.equals(htmlUrl, "to_me_information")) {
onBackPressed(); onBackPressed();
Constants.isShowPage = 3; Constants.isShowPage = 3;
}else { } else {
if (!screen) { if (!screen) {
ZhuangBanActivity.forward(mContext, htmlUrl, false); ZhuangBanActivity.forward(mContext, htmlUrl, false);
} else { } else {
@ -1377,7 +1376,11 @@ public class LiveAudienceActivity extends LiveActivity {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
break;
case BLIND_BOX:
if (manager != null) {
manager.blindBoxAllServerNotify(event.getAllServerNotifyEvent());
}
break; break;
} }

View File

@ -3,13 +3,15 @@ package com.yunbao.live.bean;
import android.text.TextUtils; import android.text.TextUtils;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.event.AllServerNotifyEvent;
/** /**
* Created by cxf on 2017/8/22. * Created by cxf on 2017/8/22.
* 收到送礼物消息的实体类 * 收到送礼物消息的实体类
*/ */
public class LiveReceiveGiftBean { public class LiveReceiveGiftBean extends BaseModel {
private String uid; private String uid;
private String avatar; private String avatar;
@ -51,6 +53,26 @@ public class LiveReceiveGiftBean {
private String nobilityname; private String nobilityname;
private String opentype; private String opentype;
private String anchorUid; private String anchorUid;
private boolean isBlindBox = false;
private AllServerNotifyEvent event = new AllServerNotifyEvent();
public AllServerNotifyEvent getEvent() {
return event;
}
public LiveReceiveGiftBean setEvent(AllServerNotifyEvent event) {
this.event = event;
return this;
}
public boolean isBlindBox() {
return isBlindBox;
}
public LiveReceiveGiftBean setBlindBox(boolean blindBox) {
isBlindBox = blindBox;
return this;
}
public String getAnchorUid() { public String getAnchorUid() {
return anchorUid; return anchorUid;

View File

@ -170,7 +170,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
window.setDimAmount(0f);//去掉遮罩层全透明 window.setDimAmount(0f);//去掉遮罩层全透明
WindowManager.LayoutParams params = window.getAttributes(); WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT; params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(355); params.height = DpUtil.dp2px(433);
params.gravity = Gravity.BOTTOM; params.gravity = Gravity.BOTTOM;
window.setAttributes(params); window.setAttributes(params);
} }
@ -698,6 +698,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
} }
private void itemCheckOp(LiveGiftBean bean) { private void itemCheckOp(LiveGiftBean bean) {
stringBuilders.clear();
mLiveGiftBean = bean; mLiveGiftBean = bean;
hideLianBtn(); hideLianBtn();
mBtnSend.setEnabled(true); mBtnSend.setEnabled(true);
@ -715,13 +716,12 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
showBlindProgress(bean.getBlind_box_type()); showBlindProgress(bean.getBlind_box_type());
} else { } else {
if (isPk) {
mVipGold.setVisibility(View.GONE);
}else {
mVipGold.setVisibility(View.VISIBLE); mVipGold.setVisibility(View.VISIBLE);
blindBox.setVisibility(View.GONE); }
WindowManager.LayoutParams params = getDialog().getWindow().getAttributes(); blindBox.setVisibility(View.INVISIBLE);
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(355);
params.gravity = Gravity.BOTTOM;
getDialog().getWindow().setAttributes(params);
} }
} }
@ -761,11 +761,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
mBtnChooseCount.setEnabled(false); mBtnChooseCount.setEnabled(false);
mVipGold.setVisibility(View.GONE); mVipGold.setVisibility(View.GONE);
blindBox.setVisibility(View.VISIBLE); blindBox.setVisibility(View.VISIBLE);
WindowManager.LayoutParams params = getDialog().getWindow().getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(433);
params.gravity = Gravity.BOTTOM;
getDialog().getWindow().setAttributes(params);
String boxBlindName = ""; String boxBlindName = "";
switch (blindBoxType) { switch (blindBoxType) {
case 1: case 1:
@ -818,7 +813,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue()); int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue());
String msg = mContext.getString(R.string.resend_win); String msg = mContext.getString(R.string.resend_win);
msg = String.format(msg, String.valueOf(progress), boxBlindName, model.getThresholdDressName()); msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName()); int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
int progressIndexOf = msg.indexOf(String.valueOf(progress)); int progressIndexOf = msg.indexOf(String.valueOf(progress));
int dressNameSize = model.getThresholdDressName().length(); int dressNameSize = model.getThresholdDressName().length();
@ -1050,6 +1045,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
for (int i = 0; i < blindBoxInfoModels.size(); i++) { for (int i = 0; i < blindBoxInfoModels.size(); i++) {
if (TextUtils.equals(blindBoxInfoModels.get(i).getBlindBoxType(), event.getBoxType())) { if (TextUtils.equals(blindBoxInfoModels.get(i).getBlindBoxType(), event.getBoxType())) {
blindBoxInfoModels.get(i).setDressThresholdValue(event.getDressThresholdValue()); blindBoxInfoModels.get(i).setDressThresholdValue(event.getDressThresholdValue());
blindBoxInfoModels.get(i).setThresholdValue(event.getThresholdValue());
model = blindBoxInfoModels.get(i); model = blindBoxInfoModels.get(i);
} }
} }
@ -1091,10 +1087,11 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), individualDressingIndexOf, individualDressingIndexOf + individualDressingSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), individualDressingIndexOf, individualDressingIndexOf + individualDressingSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
blindNumber.setText(builder); blindNumber.setText(builder);
textBlindProgress.setText(R.string.get_it_done);
} else { } else {
int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue()); int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue());
String msg = mContext.getString(R.string.resend_win); String msg = mContext.getString(R.string.resend_win);
msg = String.format(msg, String.valueOf(progress), boxBlindName, model.getThresholdDressName()); msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName()); int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
int progressIndexOf = msg.indexOf(String.valueOf(progress)); int progressIndexOf = msg.indexOf(String.valueOf(progress));
int dressNameSize = model.getThresholdDressName().length(); int dressNameSize = model.getThresholdDressName().length();
@ -1110,6 +1107,58 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
.append(model.getThresholdValue()); .append(model.getThresholdValue());
textBlindProgress.setText(stringBuffer.toString()); textBlindProgress.setText(stringBuffer.toString());
} }
if (stringBuilders.size() == 0) {
boxBlindHandler.postDelayed(boxBlindRunnable, 1500);
}
if (!TextUtils.isEmpty(event.getDressName()) && !TextUtils.isEmpty(event.getDressMsg())) {
SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
String boxBlindMsg = String.format(mContext.getString(R.string.random_availability2), event.getGiftname(), event.getDressName());
stringBuilder.append(boxBlindMsg);
int dressNameIndex = boxBlindMsg.indexOf(event.getDressName());
int dressNameSize = event.getDressName().length();
int giftNameIndex = boxBlindMsg.indexOf(event.getGiftname());
int giftNameSize = event.getGiftname().length();
stringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(event.getDressColour())),
dressNameIndex,
dressNameIndex + dressNameSize,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
stringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(event.getGiftColour())),
giftNameIndex,
giftNameIndex + giftNameSize,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
stringBuilders.add(stringBuilder);
} else {
SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
String boxBlindMsg = String.format(mContext.getString(R.string.random_availability3), event.getGiftname());
stringBuilder.append(boxBlindMsg);
int giftNameIndex = boxBlindMsg.indexOf(event.getGiftname());
int giftNameSize = event.getGiftname().length();
stringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(event.getGiftColour())),
giftNameIndex,
giftNameIndex + giftNameSize,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
stringBuilders.add(stringBuilder);
}
} }
} }
private List<SpannableStringBuilder> stringBuilders = new ArrayList<>();
private Handler boxBlindHandler = new Handler();
private Runnable boxBlindRunnable = new Runnable() {
@Override
public void run() {
if (stringBuilders != null && stringBuilders.size() > 0) {
SpannableStringBuilder stringBuilder = stringBuilders.get(0);
textBlindGiftName.setText(stringBuilder);
boxBlindHandler.postDelayed(boxBlindRunnable, 1100);
stringBuilders.remove(0);
} else {
textBlindGiftName.setText(String.format(mContext.getString(R.string.random_availability), blindGiftNamesBuffer.toString()));
}
}
};
} }

View File

@ -9,6 +9,7 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
@ -41,6 +42,16 @@ public class LiveAudienceEvent extends BaseModel {
private WishModel wishListProgress; private WishModel wishListProgress;
private XydCompleteModel xydCompleteModel; private XydCompleteModel xydCompleteModel;
private LiveReceiveGiftBean liveReceiveGiftBean; private LiveReceiveGiftBean liveReceiveGiftBean;
private AllServerNotifyEvent allServerNotifyEvent;
public AllServerNotifyEvent getAllServerNotifyEvent() {
return allServerNotifyEvent;
}
public LiveAudienceEvent setAllServerNotifyEvent(AllServerNotifyEvent allServerNotifyEvent) {
this.allServerNotifyEvent = allServerNotifyEvent;
return this;
}
public LiveReceiveGiftBean getLiveReceiveGiftBean() { public LiveReceiveGiftBean getLiveReceiveGiftBean() {
return liveReceiveGiftBean; return liveReceiveGiftBean;
@ -344,7 +355,8 @@ public class LiveAudienceEvent extends BaseModel {
LIVE_FONT_SIZE(64, "字号设置"), LIVE_FONT_SIZE(64, "字号设置"),
VOTE_CREATE(65, "创建投票"), VOTE_CREATE(65, "创建投票"),
VOTE_UPDATE(66, "更新投票"), VOTE_UPDATE(66, "更新投票"),
VOTE_END(67, "投票结束"); VOTE_END(67, "投票结束"),
BLIND_BOX(68, "盲盒全服通知");
private int type; private int type;
private String name; private String name;

View File

@ -6,6 +6,7 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
@ -23,6 +24,7 @@ import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation; import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.MediaController; import android.widget.MediaController;
import android.widget.TextView; import android.widget.TextView;
@ -37,6 +39,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig; import com.yunbao.common.HtmlConfig;
import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
@ -48,14 +51,14 @@ import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.HtmlTagHandler;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.custom.FrameImageView; import com.yunbao.live.custom.FrameImageView;
import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.utils.AllMsgTextRender; import com.yunbao.live.utils.AllMsgTextRender;
@ -86,7 +89,9 @@ import pl.droidsonroids.gif.GifImageView;
public class LiveGiftAnimPresenter { public class LiveGiftAnimPresenter {
private final View mIvLook; private final TextView mIvLook;
private View superNotice;
private LinearLayout bgAllServer;
private final View mGifGiftTipGroupBuyGuard; private final View mGifGiftTipGroupBuyGuard;
private final View mIvLookBuyGuard; private final View mIvLookBuyGuard;
private final View mGifGiftTipGroupBuyZuoji; private final View mGifGiftTipGroupBuyZuoji;
@ -162,6 +167,8 @@ public class LiveGiftAnimPresenter {
private boolean mShowBuyLiangName; private boolean mShowBuyLiangName;
private boolean mShowBuyVip; private boolean mShowBuyVip;
private boolean mShowBlindBox;
private CommonCallback<File> mDownloadGifCallback; private CommonCallback<File> mDownloadGifCallback;
private CommonCallback<File> mDownloadIconCallback; private CommonCallback<File> mDownloadIconCallback;
@ -216,6 +223,8 @@ public class LiveGiftAnimPresenter {
mTitleContainer = v.findViewById(R.id.title_container); mTitleContainer = v.findViewById(R.id.title_container);
mSVGAImageViewFront = v.findViewById(R.id.svga_iv_all_server); mSVGAImageViewFront = v.findViewById(R.id.svga_iv_all_server);
mIvLook = v.findViewById(R.id.iv_look); mIvLook = v.findViewById(R.id.iv_look);
superNotice = v.findViewById(R.id.super_notice);
bgAllServer = v.findViewById(R.id.bg_all_server);
mIvLookBuyGuard = v.findViewById(R.id.iv_look_buy_guard); mIvLookBuyGuard = v.findViewById(R.id.iv_look_buy_guard);
svgaImageViewCallback(); svgaImageViewCallback();
@ -325,8 +334,26 @@ public class LiveGiftAnimPresenter {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
//切换直播间 //切换直播间
if (TextUtils.equals(mIvLook.getText().toString(),mContext.getString(R.string.participate_in))) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.LIVE_STREAM, mStream);
bundle.putString(Constants.LIVE_WISH_GIFTID, blindBox.getEvent().getBlindBoxId() + "");
bundle.putBoolean("isContactGift", true);
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}
}, 1000);
} else {
changeLiveRoom(); changeLiveRoom();
} }
}
}); });
mGifGiftTipGroupAllServer.setOnClickListener(new View.OnClickListener() { mGifGiftTipGroupAllServer.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -336,6 +363,14 @@ public class LiveGiftAnimPresenter {
}); });
} }
public String mLiveUid;
public String mStream;
public void setLiveUidStream(String liveUid, String stream) {
mLiveUid = liveUid;
mStream = stream;
}
private void mIvLookBuyZuojiClick() { private void mIvLookBuyZuojiClick() {
mGifGiftTipGroupBuyZuoji.setOnClickListener(new View.OnClickListener() { mGifGiftTipGroupBuyZuoji.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -410,7 +445,7 @@ public class LiveGiftAnimPresenter {
private void setGitTipAnimatorAllServer() { private void setGitTipAnimatorAllServer() {
mDp500 = DpUtil.dp2px(500); mDp500 = DpUtil.dp2px(500);
mGifGiftTipShowAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", mDp500, 0); mGifGiftTipShowAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", mDp500, 0);
mGifGiftTipShowAnimatorAllServer.setDuration(2000); mGifGiftTipShowAnimatorAllServer.setDuration(2500);
mGifGiftTipShowAnimatorAllServer.setInterpolator(new LinearInterpolator()); mGifGiftTipShowAnimatorAllServer.setInterpolator(new LinearInterpolator());
mGifGiftTipShowAnimatorAllServer.addListener(new AnimatorListenerAdapter() { mGifGiftTipShowAnimatorAllServer.addListener(new AnimatorListenerAdapter() {
@Override @Override
@ -422,7 +457,7 @@ public class LiveGiftAnimPresenter {
}); });
mDp10 = DpUtil.dp2px(10); mDp10 = DpUtil.dp2px(10);
mGifGiftTipHideAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", 0); mGifGiftTipHideAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", 0);
mGifGiftTipHideAnimatorAllServer.setDuration(3000); mGifGiftTipHideAnimatorAllServer.setDuration(3500);
mGifGiftTipHideAnimatorAllServer.setInterpolator(new AccelerateDecelerateInterpolator()); mGifGiftTipHideAnimatorAllServer.setInterpolator(new AccelerateDecelerateInterpolator());
mGifGiftTipHideAnimatorAllServer.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { mGifGiftTipHideAnimatorAllServer.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override @Override
@ -673,11 +708,17 @@ public class LiveGiftAnimPresenter {
mGifGiftTipHideAnimatorAllServer.start(); mGifGiftTipHideAnimatorAllServer.start();
} else if (msg.what == WHAT_ALL_SERVER_2) { } else if (msg.what == WHAT_ALL_SERVER_2) {
mShowAllServer = false; mShowAllServer = false;
mShowBlindBox = false;
heightOffsetArr[index4OtherGift] = 0; heightOffsetArr[index4OtherGift] = 0;
LiveReceiveGiftBean bean = mGifAll.poll(); LiveReceiveGiftBean bean = mGifAll.poll();
if (bean != null) { if (bean != null) {
if (bean.isBlindBox()) {
showSendGiftAnimAllServer2(bean);
} else {
chooseInto(bean); chooseInto(bean);
} }
}
} else if (msg.what == WHAT_BUY_GUARD_1) { } else if (msg.what == WHAT_BUY_GUARD_1) {
mGifGiftTipHideAnimatorBuyGuard.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuard.getWidth()); mGifGiftTipHideAnimatorBuyGuard.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuard.getWidth());
mGifGiftTipHideAnimatorBuyGuard.start(); mGifGiftTipHideAnimatorBuyGuard.start();
@ -832,8 +873,6 @@ public class LiveGiftAnimPresenter {
} }
} else { } else {
mShowAllServer = true; mShowAllServer = true;
index4OtherGift = getFirstIndexOfValue(heightOffsetArr, 0); index4OtherGift = getFirstIndexOfValue(heightOffsetArr, 0);
if (index4OtherGift >= 0) { if (index4OtherGift >= 0) {
heightOffsetArr[index4OtherGift] = 1; heightOffsetArr[index4OtherGift] = 1;
@ -843,16 +882,57 @@ public class LiveGiftAnimPresenter {
params.topMargin = DpUtil.dp2px(y); params.topMargin = DpUtil.dp2px(y);
mGifGiftTipGroupAllServer.setLayoutParams(params); mGifGiftTipGroupAllServer.setLayoutParams(params);
} }
mAncherName = mTempGifGiftBean.getAncherName(); mAncherName = mTempGifGiftBean.getAncherName();
mGifGiftTipAllServer.setSelected(false); mGifGiftTipAllServer.setSelected(false);
mIvLook.setVisibility(View.VISIBLE);
mGifGiftTipGroupAllServer.setAlpha(1f); mGifGiftTipGroupAllServer.setAlpha(1f);
mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE); mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE);
textRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, "");
mIvLook.setVisibility(View.VISIBLE);
mGifGiftTipShowAnimatorAllServer.start(); mGifGiftTipShowAnimatorAllServer.start();
textRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, ""); }
} //送礼物 全服通知
private LiveReceiveGiftBean blindBox = null;
public void showSendGiftAnimAllServer2(LiveReceiveGiftBean bean) {
blindBox = bean;
if (mShowBlindBox) {
if (mGifAll != null) {
mGifAll.offer(bean);
}
} else {
mShowBlindBox = true;
mAncherName = bean.getAncherName();
mGifGiftTipAllServer.setSelected(false);
mGifGiftTipGroupAllServer.setAlpha(1f);
mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE);
AllServerNotifyEvent serverNotifyEvent = bean.getEvent();
switch (Integer.parseInt(serverNotifyEvent.getBoxType())) {
case 1:
bgAllServer.setBackgroundResource(R.mipmap.bg_kirin_notify);
mIvLook.setBackgroundResource(R.drawable.bg_all_server_336cf7);
break;
case 2:
bgAllServer.setBackgroundResource(R.mipmap.bg_phoenix_notify);
mIvLook.setBackgroundResource(R.drawable.bg_all_server_fd5a9d);
break;
default:
bgAllServer.setBackgroundResource(R.mipmap.bg_dragon_notify);
mIvLook.setBackgroundResource(R.drawable.bg_all_server_fcb50e);
break;
}
mIvLook.setText(R.string.participate_in);
superNotice.setBackgroundResource(R.mipmap.icon_blind_box_headlines);
mIvLook.setVisibility(View.VISIBLE);
textRender.blindBoxText(mContext, mGifGiftTipAllServer, serverNotifyEvent);
mGifGiftTipShowAnimatorAllServer.start();
mGifGiftTipAllServer.postDelayed(() -> {
if (mGifGiftTipAllServer != null) {
mGifGiftTipAllServer.setSelected(true);
}
}, delayMarqueen + 600);
} }
} }
@ -934,7 +1014,7 @@ public class LiveGiftAnimPresenter {
} }
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>"
+mContext.getString(R.string.live_send_buy_zuoji_1) + mContext.getString(R.string.live_send_buy_zuoji_1)
+ "</myfont> " + (mTempGifGiftBean.getCarName()); + "</myfont> " + (mTempGifGiftBean.getCarName());
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyZuoji.setText(spanned); mGifGiftTipBuyZuoji.setText(spanned);
@ -975,7 +1055,7 @@ public class LiveGiftAnimPresenter {
} }
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>"
+mContext.getString(R.string.live_send_buy_liang_name_1) + mContext.getString(R.string.live_send_buy_liang_name_1)
+ "</myfont> " + mTempGifGiftBean.getLiangName(); + "</myfont> " + mTempGifGiftBean.getLiangName();
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyLiangName.setText(spanned); mGifGiftTipBuyLiangName.setText(spanned);
@ -1124,7 +1204,7 @@ public class LiveGiftAnimPresenter {
} }
}); });
} else { } else {
GiftCacheUtil.getFile(mContext,Constants.GIF_GIFT_PREFIX + bean.getGiftId(), url, "1", mDownloadGifCallback); GiftCacheUtil.getFile(mContext, Constants.GIF_GIFT_PREFIX + bean.getGiftId(), url, "1", mDownloadGifCallback);
} }
} }

View File

@ -32,6 +32,7 @@ import com.yunbao.common.bean.SocketModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -363,6 +364,24 @@ public class SocketRyClient {
buyZuoJiByNotify(map); buyZuoJiByNotify(map);
} else if (action2 == 66) {//购买贵族 } else if (action2 == 66) {//购买贵族
buyVipByNotify(map); buyVipByNotify(map);
} else if (action2 == 88) {
AllServerNotifyEvent allServerNotifyEvent
= new AllServerNotifyEvent()
.setBlindBoxId(map.getString("blind_box_id"))
.setBoxType(map.getString("box_type"))
.setBoxTypeName(map.getString("box_type_name"))
.setDressName(map.getString("dress_name"))
.setGiftNotification(map.getString("gift_notification"))
.setGiftName(map.getString("giftname"))
.setUserNiceName(map.getString("uname"))
.setGiftIcon(map.getString("gifticon"))
.setAnchorName(map.getString("ancherName"))
.setDisplaySrc(map.getString("display_src"));
Log.e("AllServerNotifyEvent", allServerNotifyEvent.toString());
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX)
.setAllServerNotifyEvent(allServerNotifyEvent));
} }
break; break;
case Constants.SOCKET_SEND_BARRAGE://发弹幕 case Constants.SOCKET_SEND_BARRAGE://发弹幕

View File

@ -1,14 +1,18 @@
package com.yunbao.live.utils; package com.yunbao.live.utils;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.TextView; import android.widget.TextView;
import com.yunbao.common.custom.VerticalImageSpan; import com.yunbao.common.custom.VerticalImageSpan;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -68,7 +72,7 @@ public class AllMsgTextRender {
ImgLoader.displayDrawable(context, url, new ImgLoader.DrawableCallback() { ImgLoader.displayDrawable(context, url, new ImgLoader.DrawableCallback() {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
if (builder!=null&&!builder.toString().contains(text)){ if (builder != null && !builder.toString().contains(text)) {
builder = createPrefix(drawable, builder); builder = createPrefix(drawable, builder);
builder = renderMsg(color2, builder, text); builder = renderMsg(color2, builder, text);
textView.setText(builder); textView.setText(builder);
@ -124,6 +128,95 @@ public class AllMsgTextRender {
} }
} }
/**
* 盲盒字体组装
*
* @param context
* @param textView
* @param serverNotifyEvent
*/
public void blindBoxText(Context context, TextView textView, AllServerNotifyEvent serverNotifyEvent) {
String space = " ";
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
String extractTo = context.getString(R.string.extract_to);
extractTo = String.format(extractTo, serverNotifyEvent.getUserNiceName(), serverNotifyEvent.getBoxTypeName());
spannableStringBuilder.append(extractTo);
int indexImage = spannableStringBuilder.length();
int endImage = indexImage + space.length();
spannableStringBuilder.append(space);
String giftName;
int giftNameIndex;
int endName;
if (!TextUtils.isEmpty(serverNotifyEvent.getGiftNotification())
&& TextUtils.equals(serverNotifyEvent.getGiftNotification(), "1")) {
giftName = context.getString(R.string.extract_to2);
giftName = String.format(giftName, serverNotifyEvent.getGiftName(), serverNotifyEvent.getAnchorName());
spannableStringBuilder.append(giftName);
giftNameIndex = spannableStringBuilder.toString().indexOf(serverNotifyEvent.getGiftName());
endName = giftNameIndex + serverNotifyEvent.getGiftName().length();
ImgLoader.displayDrawable(context, serverNotifyEvent.getGiftIcon(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
drawable.setBounds(0, 0, DpUtil.dp2px(21), DpUtil.dp2px(21));
//用这个drawable对象代替字符串easy
ImageSpan span = new ImageSpan(drawable, ImageSpan.ALIGN_BASELINE);
spannableStringBuilder.setSpan(span, indexImage, endImage, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
blind(spannableStringBuilder,textView,serverNotifyEvent,giftNameIndex,endName);
}
@Override
public void onLoadFailed() {
blind(spannableStringBuilder,textView,serverNotifyEvent,giftNameIndex,endName);
}
});
} else {
giftName = serverNotifyEvent.getDressName();
spannableStringBuilder.append(giftName);
giftNameIndex = spannableStringBuilder.toString().indexOf(giftName);
endName = giftNameIndex + giftName.length();
ImgLoader.displayDrawable(context, serverNotifyEvent.getDisplaySrc(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
drawable.setBounds(0, 0, DpUtil.dp2px(21), DpUtil.dp2px(21));
//用这个drawable对象代替字符串easy
ImageSpan span = new ImageSpan(drawable, ImageSpan.ALIGN_BASELINE);
spannableStringBuilder.setSpan(span, indexImage, endImage, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
blind(spannableStringBuilder,textView,serverNotifyEvent,giftNameIndex,endName);
}
@Override
public void onLoadFailed() {
blind(spannableStringBuilder,textView,serverNotifyEvent,giftNameIndex,endName);
}
});
}
}
private void blind( SpannableStringBuilder spannableStringBuilder, TextView textView, AllServerNotifyEvent serverNotifyEvent, int giftNameIndex,int endName) {
switch (Integer.parseInt(serverNotifyEvent.getBoxType())) {
case 1:
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#336DF7")),
giftNameIndex,
endName,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
break;
case 2:
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FD5A9D")),
giftNameIndex,
endName,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
break;
default:
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FCB514")),
giftNameIndex,
endName,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
break;
}
textView.setText(spannableStringBuilder);
}
/** /**
* 渲染消息 * 渲染消息
*/ */

View File

@ -88,6 +88,7 @@ import com.yunbao.common.bean.TaskModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -5093,4 +5094,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
} }
public void blindBoxAllServerNotify(AllServerNotifyEvent event) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setBlindBox(true);
receiveGiftBean.setEvent(event);
if (mLiveGiftAnimPresenter == null) {
mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
}
mLiveGiftAnimPresenter.showSendGiftAnimAllServer2(receiveGiftBean);
mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream);
}
} }

View File

@ -43,6 +43,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.LiveFloatEvent;
import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.event.SendBlindGiftEvent;
@ -1999,4 +2000,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.showXydComplete(model, false, liveReceiveGiftBean); mLiveRoomViewHolder.showXydComplete(model, false, liveReceiveGiftBean);
} }
} }
public void blindBoxAllServerNotify(AllServerNotifyEvent event) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.blindBoxAllServerNotify(event);
}
}
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="13dp" />
<solid android:color="#336CF7" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="13dp" />
<solid android:color="#FCB50E" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="13dp" />
<solid android:color="#FD5A9D" />
</shape>

View File

@ -8,7 +8,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="10dp" android:layout_marginBottom="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
@ -44,6 +44,8 @@
android:layout_width="102dp" android:layout_width="102dp"
android:layout_height="31dp" android:layout_height="31dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="70dp"
android:layout_marginBottom="5dp"
android:background="@drawable/bg_live_vip_blue" android:background="@drawable/bg_live_vip_blue"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
@ -68,9 +70,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:text="@string/live_gift_buy_gold" android:text="@string/live_gift_buy_gold"
android:textStyle="bold"
android:textColor="#F5C600" android:textColor="#F5C600"
android:textSize="10sp" /> android:textSize="10sp"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/vipGoldDesc" android:id="@+id/vipGoldDesc"
@ -89,7 +91,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:visibility="gone"> android:visibility="invisible">
<include <include

View File

@ -9,15 +9,14 @@
android:id="@+id/frame_blind_top" android:id="@+id/frame_blind_top"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="86.5dp" android:layout_height="86.5dp"
android:background="@mipmap/bg_phoenix"> android:background="@mipmap/bg_kirin">
<com.opensource.svgaplayer.SVGAImageView <com.opensource.svgaplayer.SVGAImageView
android:id="@+id/blind_svga" android:id="@+id/blind_svga"
android:layout_width="29dp" android:layout_width="29dp"
android:layout_height="29dp" android:layout_height="29dp"
android:layout_marginStart="14dp" android:layout_marginStart="14dp"
android:layout_marginTop="51dp" android:layout_marginTop="51dp" />
/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -33,8 +32,8 @@
<ProgressBar <ProgressBar
android:id="@+id/progress_blind3" android:id="@+id/progress_blind3"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="74dp" android:layout_width="80dp"
android:layout_height="6dp" android:layout_height="8dp"
android:layout_gravity="center" android:layout_gravity="center"
android:max="100" android:max="100"
android:progress="30" android:progress="30"
@ -44,8 +43,8 @@
<ProgressBar <ProgressBar
android:id="@+id/progress_blind1" android:id="@+id/progress_blind1"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="74dp" android:layout_width="80dp"
android:layout_height="6dp" android:layout_height="8dp"
android:layout_gravity="center" android:layout_gravity="center"
android:max="100" android:max="100"
android:progress="50" android:progress="50"
@ -55,8 +54,8 @@
<ProgressBar <ProgressBar
android:id="@+id/progress_blind2" android:id="@+id/progress_blind2"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="74dp" android:layout_width="80dp"
android:layout_height="6dp" android:layout_height="8dp"
android:layout_gravity="center" android:layout_gravity="center"
android:max="100" android:max="100"
android:progress="50" android:progress="50"
@ -72,26 +71,28 @@
</FrameLayout> </FrameLayout>
</LinearLayout>
<TextView <TextView
android:id="@+id/blind_number" android:id="@+id/blind_number"
android:layout_width="wrap_content" android:layout_width="90dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginStart="47dp"
android:layout_marginTop="71dp"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="6sp" /> android:textSize="8sp" />
</LinearLayout>
<ImageView <ImageView
android:layout_width="13dp" android:layout_width="13dp"
android:layout_height="13dp" android:layout_height="13dp"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_marginTop="47dp" android:layout_marginTop="40dp"
android:layout_marginEnd="19dp" android:layout_marginEnd="15dp"
android:src="@mipmap/icon_what" /> android:src="@mipmap/icon_what" />
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:layout_width="139dp" android:layout_width="149dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/bg_blind_bottom"> android:background="@mipmap/bg_blind_bottom">
@ -100,15 +101,15 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="7dp" android:layout_margin="5dp"
android:ellipsize="marquee" android:ellipsize="marquee"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:gravity="center" android:gravity="center"
android:textSize="7sp"
android:marqueeRepeatLimit="marquee_forever" android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true" android:scrollHorizontally="true"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/white" /> android:textColor="@color/white"
android:textSize="10sp" />
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View File

@ -970,6 +970,7 @@
android:visibility="invisible"> android:visibility="invisible">
<LinearLayout <LinearLayout
android:id="@+id/bg_all_server"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -978,8 +979,9 @@
android:background="@drawable/bg_live_gift_tip" android:background="@drawable/bg_live_gift_tip"
android:gravity="center|left" android:gravity="center|left"
android:orientation="horizontal"> android:orientation="horizontal">
<!--盲盒头条-->
<View <View
android:id="@+id/super_notice"
android:layout_width="63dp" android:layout_width="63dp"
android:layout_height="18sp" android:layout_height="18sp"
android:layout_marginLeft="18dp" android:layout_marginLeft="18dp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -45,6 +45,7 @@ import com.yunbao.main.adapter.MainListAdapter;
import com.yunbao.main.bean.ListBean; import com.yunbao.main.bean.ListBean;
import com.yunbao.main.http.MainHttpUtil; import com.yunbao.main.http.MainHttpUtil;
import com.yunbao.main.views.AbsMainListChildViewHolder; import com.yunbao.main.views.AbsMainListChildViewHolder;
import com.yunbao.main.views.MainListBoxBlindViewHolder;
import com.yunbao.main.views.MainListContributeViewHolder; import com.yunbao.main.views.MainListContributeViewHolder;
import com.yunbao.main.views.MainListProfitViewHolder; import com.yunbao.main.views.MainListProfitViewHolder;
import com.yunbao.main.views.MyClipPagerTitleView; import com.yunbao.main.views.MyClipPagerTitleView;
@ -72,7 +73,7 @@ import java.util.List;
import pl.droidsonroids.gif.GifImageView; import pl.droidsonroids.gif.GifImageView;
public class MainListActivity extends AbsActivity implements OnItemClickListener<ListBean> { public class MainListActivity extends AbsActivity implements OnItemClickListener<ListBean> {
private static final int PAGE_COUNT = 2; private static final int PAGE_COUNT = 3;
public static final String DAY = "day"; public static final String DAY = "day";
public static final String WEEK = "week"; public static final String WEEK = "week";
public static final String MONTH = "month"; public static final String MONTH = "month";
@ -121,7 +122,8 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
mIndicator = (MagicIndicator) findViewById(R.id.indicator); mIndicator = (MagicIndicator) findViewById(R.id.indicator);
final String[] titles = new String[]{ final String[] titles = new String[]{
(mContext.getString(R.string.glamour_list)), (mContext.getString(R.string.glamour_list)),
(mContext.getString(R.string.magnificent_list)) (mContext.getString(R.string.magnificent_list)),
(mContext.getString(R.string.blind_box_list))
}; };
CommonNavigator commonNavigator = new CommonNavigator(mContext); CommonNavigator commonNavigator = new CommonNavigator(mContext);
commonNavigator.setAdapter(new CommonNavigatorAdapter() { commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@ -231,9 +233,12 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
if (position == 0) { if (position == 0) {
select.setTextColor(Color.parseColor("#FF82C1")); select.setTextColor(Color.parseColor("#FF82C1"));
unSelect.setTextColor(Color.parseColor("#FFFFFF")); unSelect.setTextColor(Color.parseColor("#FFFFFF"));
} else { } else if (position == 1){
select.setTextColor(Color.parseColor("#7BBAFF")); select.setTextColor(Color.parseColor("#7BBAFF"));
unSelect.setTextColor(Color.parseColor("#FFFFFF")); unSelect.setTextColor(Color.parseColor("#FFFFFF"));
}else if (position == 2){
select.setTextColor(Color.parseColor("#ff9072"));
unSelect.setTextColor(Color.parseColor("#FFFFFF"));
} }
} }
@ -256,6 +261,11 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
mContributeViewHolder.setHide(outRankHide); mContributeViewHolder.setHide(outRankHide);
vh = mContributeViewHolder; vh = mContributeViewHolder;
vh.setAppbarColor(Color.parseColor("#73B2FF")); vh.setAppbarColor(Color.parseColor("#73B2FF"));
}else if (position == 2) {
MainListBoxBlindViewHolder mainListBoxBlindViewHolder = new MainListBoxBlindViewHolder(mContext,parent);
mainListBoxBlindViewHolder.setHide(outRankHide);
vh = mainListBoxBlindViewHolder;
vh.setAppbarColor(Color.parseColor("#ff9072"));
} }
if (vh == null) { if (vh == null) {
return; return;

View File

@ -51,7 +51,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
private List<ListBean> mTopList; private List<ListBean> mTopList;
private int mType; private int mType;
private List<String> outRankHide = new ArrayList<>(); private List<String> outRankHide = new ArrayList<>();
protected boolean isRankOne;//是否为魅力榜 第一个tab protected int isRankOne;//是否为魅力榜 第一个tab
public MainListAdapter(Context context, int type) { public MainListAdapter(Context context, int type) {
@ -93,7 +93,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
} }
public void setRankOne(boolean rankOne) { public void setRankOne(int rankOne) {
isRankOne = rankOne; isRankOne = rankOne;
} }
@ -267,12 +267,15 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
} else { } else {
mBtnFollow.doChecked(false); mBtnFollow.doChecked(false);
mBtnFollow.setText(mFollow); mBtnFollow.setText(mFollow);
if(isRankOne){ if(isRankOne==0){
mBtnFollow.setBackgroundResource(R.drawable.background_ff82c1); mBtnFollow.setBackgroundResource(R.drawable.background_ff82c1);
mBtnFollow.setTextColor(Color.parseColor("#FF82C1")); mBtnFollow.setTextColor(Color.parseColor("#FF82C1"));
}else { }else if(isRankOne==1){
mBtnFollow.setBackgroundResource(R.drawable.background_ff7bbaff); mBtnFollow.setBackgroundResource(R.drawable.background_ff7bbaff);
mBtnFollow.setTextColor(Color.parseColor("#7BBAFF")); mBtnFollow.setTextColor(Color.parseColor("#7BBAFF"));
}else if(isRankOne==2){
mBtnFollow.setBackgroundResource(R.drawable.background_ffff9072);
mBtnFollow.setTextColor(Color.parseColor("#ff9072"));
} }
} }
mSex.setVisibility(View.INVISIBLE); mSex.setVisibility(View.INVISIBLE);

View File

@ -15,6 +15,7 @@ public class MainHttpConsts {
public static final String GET_NEAR = "getNear"; public static final String GET_NEAR = "getNear";
public static final String PROFIT_LIST = "profitList"; public static final String PROFIT_LIST = "profitList";
public static final String CONSUME_LIST = "consumeList"; public static final String CONSUME_LIST = "consumeList";
public static final String BLIND_BOX_LIST = "blindBoxList";
public static final String GET_BASE_INFO = "getBaseInfo"; public static final String GET_BASE_INFO = "getBaseInfo";
public static final String SET_BLACK = "setBlack"; public static final String SET_BLACK = "setBlack";
public static final String GET_SETTING_LIST = "getSettingList"; public static final String GET_SETTING_LIST = "getSettingList";

View File

@ -62,7 +62,7 @@ public class MainHttpUtil {
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD) HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
.params("openid", openid) .params("openid", openid)
.params("nicename", nicename) .params("nicename", nicename)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY==true?"1":"3") .params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
.params("avatar", avatar) .params("avatar", avatar)
.params("type", type) .params("type", type)
.params("source", DEVICE) .params("source", DEVICE)
@ -77,11 +77,11 @@ public class MainHttpUtil {
* 第三方登录---增加参数推广码,手机唯一标识 * 第三方登录---增加参数推广码,手机唯一标识
*/ */
public static void loginByThird(String UserID,String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) { public static void loginByThird(String UserID, String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) {
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT); String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD) HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
.params("openid", openid) .params("openid", openid)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY==true?"1":"3") .params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
.params("admin_id", promoCode) .params("admin_id", promoCode)
.params("uuid_Device", uuidDevice) .params("uuid_Device", uuidDevice)
.params("nicename", nicename) .params("nicename", nicename)
@ -198,6 +198,14 @@ public class MainHttpUtil {
} }
//排行榜 盲盒榜
public static void blindBoxList(String type, int p, HttpCallback callback) {
HttpClient.getInstance().get("Home.blindBoxList", MainHttpConsts.BLIND_BOX_LIST)
.params("type", type)
.params("p", p)
.execute(callback);
}
/** /**
* 获取谷歌 * 获取谷歌
@ -324,10 +332,11 @@ public class MainHttpUtil {
.params("p", p) .params("p", p)
.execute(callback); .execute(callback);
} }
/** /**
* 搜索 * 搜索
*/ */
public static void searchnew(String fan_key, String jian_key,int type, int p, HttpCallback callback) { public static void searchnew(String fan_key, String jian_key, int type, int p, HttpCallback callback) {
HttpClient.getInstance().get("", MainHttpConsts.SEARCH) HttpClient.getInstance().get("", MainHttpConsts.SEARCH)
.params("jian_key", jian_key) .params("jian_key", jian_key)
.params("fan_key", fan_key) .params("fan_key", fan_key)
@ -553,10 +562,10 @@ public class MainHttpUtil {
/** /**
* 手机注册接口---增加参数推广码,手机唯一标识,国家代码 * 手机注册接口---增加参数推广码,手机唯一标识,国家代码
*/ */
public static void register(String UserID,String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) { public static void register(String UserID, String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) {
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER) HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
.params("user_login", user_login) .params("user_login", user_login)
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY==true?"1":"3") .params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
//增加参数推广码 //增加参数推广码
.params("user_activation_key", promo_code) .params("user_activation_key", promo_code)
.params("admin_id", promo_code) .params("admin_id", promo_code)
@ -696,9 +705,10 @@ public class MainHttpUtil {
HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR) HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR)
.execute(callback); .execute(callback);
} }
// //
public static void setMessageReadAll(){ public static void setMessageReadAll() {
HttpClient.getInstance().get("User.getUserInstructor","") HttpClient.getInstance().get("User.getUserInstructor", "")
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
@ -706,10 +716,11 @@ public class MainHttpUtil {
} }
}); });
} }
/** /**
* 获取设备号有没有注册过 * 获取设备号有没有注册过
*/ */
public static void getDeviceLoginType( HttpCallback callback) { public static void getDeviceLoginType(HttpCallback callback) {
HttpClient.getInstance().get("Login.getDeviceLoginType", "Login.getDeviceLoginType") HttpClient.getInstance().get("Login.getDeviceLoginType", "Login.getDeviceLoginType")
.params("uuid_Device", DeviceUtils.getUniqueDeviceId()) .params("uuid_Device", DeviceUtils.getUniqueDeviceId())
.execute(callback); .execute(callback);

View File

@ -31,7 +31,6 @@ import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
@ -57,7 +56,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
public static final String MONTH = "month"; public static final String MONTH = "month";
public static final String TOTAL = "total"; public static final String TOTAL = "total";
protected String mType; protected String mType;
protected boolean isRankOne;//是否为魅力榜 第一个tab protected int isRankOne;//是否为魅力榜 第一个tab
protected CommonRefreshView mRefreshView; protected CommonRefreshView mRefreshView;
public MainListAdapter mAdapter; public MainListAdapter mAdapter;
protected OnLoadData loadData; protected OnLoadData loadData;
@ -94,7 +93,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
if (outRankHide != null) { if (outRankHide != null) {
for (String hideId : outRankHide) { for (String hideId : outRankHide) {
if (i < 3) { if (i < 3) {
hv.setData(list.get(i).setHide(TextUtils .equals(list.get(i).getUid(), hideId)), i); hv.setData(list.get(i).setHide(TextUtils.equals(list.get(i).getUid(), hideId)), i);
} }
} }
} else { } else {
@ -216,8 +215,10 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
} }
if (position == 0) { if (position == 0) {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour_top); mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour_top);
} else { } else if (position == 1) {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour2_top); mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour2_top);
} else if (position == 2) {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour3_top);
} }
} }
@ -335,13 +336,16 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
setVisibility(bean.isHide() ? View.GONE : View.VISIBLE, position, mBtnFollow1, mBtnFollow2, mBtnFollow3); setVisibility(bean.isHide() ? View.GONE : View.VISIBLE, position, mBtnFollow1, mBtnFollow2, mBtnFollow3);
if (bean.getAttention() != 1) { if (bean.getAttention() != 1) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" +mContext.getString(R.string.follow)); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" + mContext.getString(R.string.follow));
if (isRankOne) { if (isRankOne==0) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ffff79c2); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ffff79c2);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF")); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
} else { } else if (isRankOne==1){
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_7bbaff); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_7bbaff);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF")); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
} else if (isRankOne == 2) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ff9072);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
} }
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.VISIBLE); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.VISIBLE);
} else { } else {

View File

@ -0,0 +1,95 @@
package com.yunbao.main.views;
import android.content.Context;
import android.view.ViewGroup;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.main.adapter.MainListAdapter;
import com.yunbao.main.bean.ListBean;
import com.yunbao.main.http.MainHttpUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 排行榜盲盒榜
*/
public class MainListBoxBlindViewHolder extends AbsMainListChildViewHolder {
private List<String> outRankHide = new ArrayList<>();
public MainListBoxBlindViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
isRankOne = 2;
}
@Override
public void init() {
super.init();
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<ListBean>() {
@Override
public RefreshAdapter<ListBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainListAdapter(mContext, MainListAdapter.TYPE_CONTRIBUTE);
mAdapter.setRankOne(isRankOne);
mAdapter.setOnItemClickListener(MainListBoxBlindViewHolder.this);
}
mAdapter.setHide(outRankHide);
return mAdapter;
}
@Override
public void loadData(int p, HttpCallback callback) {
if (!mType.isEmpty()) {
MainHttpUtil.blindBoxList(mType, p, callback);
}
}
@Override
public List<ListBean> processData(String[] info) {
list = JSON.parseArray(Arrays.toString(info), ListBean.class);
if (mRefreshView.getPageCount() == 1) {
if (loadData != null) {
loadData.onData(list, outRankHide);
}
}
mAdapter.setHide(outRankHide);
return list;
}
@Override
public void onRefreshSuccess(List<ListBean> list, int listCount) {
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<ListBean> loadItemList, int loadItemCount) {
}
@Override
public void onLoadMoreFailure() {
}
});
}
/**
* 设置隐藏数据
*
* @param outRankHide
*/
public void setHide(List<String> outRankHide) {
this.outRankHide = outRankHide;
if (mAdapter != null)
mAdapter.setHide(outRankHide);
}
}

View File

@ -27,7 +27,7 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
public MainListContributeViewHolder(Context context, ViewGroup parentView) { public MainListContributeViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
isRankOne = false; isRankOne = 2;
} }
@Override @Override

View File

@ -24,7 +24,7 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder {
public MainListProfitViewHolder(Context context, ViewGroup parentView) { public MainListProfitViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
isRankOne = true; isRankOne = 1;
} }
@Override @Override

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="62dp" android:height="26dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffffff" />
<solid android:color="#FF9072" />
<corners android:radius="14dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="28dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#FF9072" />
<corners android:radius="14dp" />
</shape>
</item>
</selector>

View File

@ -16,6 +16,7 @@
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
</androidx.viewpager.widget.ViewPager> </androidx.viewpager.widget.ViewPager>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg_layout" android:id="@+id/bg_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -91,5 +92,4 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB