diff --git a/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java b/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java new file mode 100644 index 000000000..c4baf0d10 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java @@ -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" ; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java index 84eeb6593..7ea5bb874 100644 --- a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java +++ b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java @@ -69,8 +69,6 @@ public class SendBlindGiftEvent extends BaseModel { private String needcoin; @SerializedName("gift_msg") private String giftMsg; - @SerializedName("gift_notification") - private boolean giftNotification; @SerializedName("gift_colour") private String giftColour; @SerializedName("box_type") @@ -101,6 +99,8 @@ public class SendBlindGiftEvent extends BaseModel { private String dressColour; @SerializedName("dress_threshold_value") private String dressThresholdValue; + @SerializedName("threshold_value") + private String thresholdValue; @SerializedName("live_gift_notify") private String liveGiftNotify; @SerializedName("userNiceName") @@ -110,6 +110,15 @@ public class SendBlindGiftEvent extends BaseModel { return userNiceName; } + public String getThresholdValue() { + return thresholdValue; + } + + public SendBlindGiftEvent setThresholdValue(String thresholdValue) { + this.thresholdValue = thresholdValue; + return this; + } + public SendBlindGiftEvent setUserNiceName(String userNiceName) { this.userNiceName = userNiceName; return this; @@ -403,14 +412,6 @@ public class SendBlindGiftEvent extends BaseModel { return this; } - public boolean isGiftNotification() { - return giftNotification; - } - - public SendBlindGiftEvent setGiftNotification(boolean giftNotification) { - this.giftNotification = giftNotification; - return this; - } public String getGiftColour() { return giftColour; diff --git a/common/src/main/res/drawable/bg_blind_progres.xml b/common/src/main/res/drawable/bg_blind_progres.xml index ea281105c..6b71da1c7 100644 --- a/common/src/main/res/drawable/bg_blind_progres.xml +++ b/common/src/main/res/drawable/bg_blind_progres.xml @@ -5,7 +5,7 @@ - + diff --git a/common/src/main/res/drawable/bg_blind_progress.xml b/common/src/main/res/drawable/bg_blind_progress.xml index b331a7c48..7ae0982da 100644 --- a/common/src/main/res/drawable/bg_blind_progress.xml +++ b/common/src/main/res/drawable/bg_blind_progress.xml @@ -5,7 +5,7 @@ - + diff --git a/common/src/main/res/drawable/bg_blind_progress1.xml b/common/src/main/res/drawable/bg_blind_progress1.xml index 690c1cf90..294f2eb04 100644 --- a/common/src/main/res/drawable/bg_blind_progress1.xml +++ b/common/src/main/res/drawable/bg_blind_progress1.xml @@ -5,7 +5,7 @@ - + diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index b421ca23e..42961e3a7 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1172,7 +1172,7 @@ 離開會讓您失去獎勵,您確認離開嗎? 愛你,愛你 指導下我好嗎 - 再送%s个%s必得%s + 再送%s个必得%s 已将%s发送至您的个性装扮 迷你盲盒 典藏盲盒 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 24fa82072..ba587e3ae 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1165,7 +1165,7 @@ Limited ride And limited avatar frame Yes No VOTE - %s
box disappears after %s seconds
+ %s
box disappears after %s seconds
Please complete the form. Fill And gift Fill in the \'*\' option to complete @@ -1178,11 +1178,18 @@ Limited ride And limited avatar frame Leave without a gift Love you Can you guide me - 再送%s个%s必得%s + 再送%s个必得%s 已将%s发送至您的个性装扮 迷你盲盒 典藏盲盒 PD盲盒 个性装扮 可随机获得,%s + 已获得,%s,%s + 已获得,%s + 完成必得 + 盲盒榜 + 參與 + %s在%s中抽取到了 + %S送给了%s diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index dbd60c39d..26f7ead05 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -81,7 +81,6 @@ import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.CustomDrawerPopupView; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.VerticalViewPager; @@ -861,10 +860,10 @@ public class LiveAudienceActivity extends LiveActivity { public void showerHtml(String htmlUrl, boolean screen) { if (TextUtils.equals(htmlUrl, "recharge")) { RouteUtil.forwardMyCoin(mContext); - } else if (TextUtils.equals(htmlUrl, "to_me_information")){ - onBackPressed(); + } else if (TextUtils.equals(htmlUrl, "to_me_information")) { + onBackPressed(); Constants.isShowPage = 3; - }else { + } else { if (!screen) { ZhuangBanActivity.forward(mContext, htmlUrl, false); } else { @@ -1377,7 +1376,11 @@ public class LiveAudienceActivity extends LiveActivity { } catch (Exception e) { e.printStackTrace(); } - + break; + case BLIND_BOX: + if (manager != null) { + manager.blindBoxAllServerNotify(event.getAllServerNotifyEvent()); + } break; } diff --git a/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java b/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java index 1c2fa184c..af542556d 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java @@ -3,13 +3,15 @@ package com.yunbao.live.bean; import android.text.TextUtils; 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. * 收到送礼物消息的实体类 */ -public class LiveReceiveGiftBean { +public class LiveReceiveGiftBean extends BaseModel { private String uid; private String avatar; @@ -51,6 +53,26 @@ public class LiveReceiveGiftBean { private String nobilityname; private String opentype; 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() { return anchorUid; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index 5fd26b9ce..1590f9a31 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -170,7 +170,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On window.setDimAmount(0f);//去掉遮罩层(全透明) WindowManager.LayoutParams params = window.getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; - params.height = DpUtil.dp2px(355); + params.height = DpUtil.dp2px(433); params.gravity = Gravity.BOTTOM; window.setAttributes(params); } @@ -698,6 +698,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } private void itemCheckOp(LiveGiftBean bean) { + stringBuilders.clear(); mLiveGiftBean = bean; hideLianBtn(); mBtnSend.setEnabled(true); @@ -715,13 +716,12 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On showBlindProgress(bean.getBlind_box_type()); } else { - mVipGold.setVisibility(View.VISIBLE); - blindBox.setVisibility(View.GONE); - WindowManager.LayoutParams params = getDialog().getWindow().getAttributes(); - params.width = WindowManager.LayoutParams.MATCH_PARENT; - params.height = DpUtil.dp2px(355); - params.gravity = Gravity.BOTTOM; - getDialog().getWindow().setAttributes(params); + if (isPk) { + mVipGold.setVisibility(View.GONE); + }else { + mVipGold.setVisibility(View.VISIBLE); + } + blindBox.setVisibility(View.INVISIBLE); } } @@ -761,11 +761,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mBtnChooseCount.setEnabled(false); mVipGold.setVisibility(View.GONE); 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 = ""; switch (blindBoxType) { case 1: @@ -818,7 +813,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } else { int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue()); 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 progressIndexOf = msg.indexOf(String.valueOf(progress)); 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++) { if (TextUtils.equals(blindBoxInfoModels.get(i).getBlindBoxType(), event.getBoxType())) { blindBoxInfoModels.get(i).setDressThresholdValue(event.getDressThresholdValue()); + blindBoxInfoModels.get(i).setThresholdValue(event.getThresholdValue()); 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")), individualDressingIndexOf, individualDressingIndexOf + individualDressingSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); blindNumber.setText(builder); + textBlindProgress.setText(R.string.get_it_done); } else { int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue()); 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 progressIndexOf = msg.indexOf(String.valueOf(progress)); int dressNameSize = model.getThresholdDressName().length(); @@ -1110,6 +1107,58 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On .append(model.getThresholdValue()); 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 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())); + } + } + }; + } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 7d72304c6..f771db0bd 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -9,6 +9,7 @@ import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; @@ -41,6 +42,16 @@ public class LiveAudienceEvent extends BaseModel { private WishModel wishListProgress; private XydCompleteModel xydCompleteModel; private LiveReceiveGiftBean liveReceiveGiftBean; + private AllServerNotifyEvent allServerNotifyEvent; + + public AllServerNotifyEvent getAllServerNotifyEvent() { + return allServerNotifyEvent; + } + + public LiveAudienceEvent setAllServerNotifyEvent(AllServerNotifyEvent allServerNotifyEvent) { + this.allServerNotifyEvent = allServerNotifyEvent; + return this; + } public LiveReceiveGiftBean getLiveReceiveGiftBean() { return liveReceiveGiftBean; @@ -344,7 +355,8 @@ public class LiveAudienceEvent extends BaseModel { LIVE_FONT_SIZE(64, "字号设置"), VOTE_CREATE(65, "创建投票"), VOTE_UPDATE(66, "更新投票"), - VOTE_END(67, "投票结束"); + VOTE_END(67, "投票结束"), + BLIND_BOX(68, "盲盒全服通知"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index b91798350..9cabe9fed 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -6,6 +6,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.os.Message; @@ -23,6 +24,7 @@ import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.MediaController; import android.widget.TextView; @@ -37,6 +39,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; 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.L; import com.yunbao.common.utils.MicStatusManager; -import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; +import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.custom.FrameImageView; +import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.AllMsgTextRender; @@ -86,7 +89,9 @@ import pl.droidsonroids.gif.GifImageView; public class LiveGiftAnimPresenter { - private final View mIvLook; + private final TextView mIvLook; + private View superNotice; + private LinearLayout bgAllServer; private final View mGifGiftTipGroupBuyGuard; private final View mIvLookBuyGuard; private final View mGifGiftTipGroupBuyZuoji; @@ -162,6 +167,8 @@ public class LiveGiftAnimPresenter { private boolean mShowBuyLiangName; private boolean mShowBuyVip; + private boolean mShowBlindBox; + private CommonCallback mDownloadGifCallback; private CommonCallback mDownloadIconCallback; @@ -216,6 +223,8 @@ public class LiveGiftAnimPresenter { mTitleContainer = v.findViewById(R.id.title_container); mSVGAImageViewFront = v.findViewById(R.id.svga_iv_all_server); 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); svgaImageViewCallback(); @@ -325,7 +334,25 @@ public class LiveGiftAnimPresenter { @Override public void onClick(View view) { //切换直播间 - changeLiveRoom(); + + 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(); + } + } }); mGifGiftTipGroupAllServer.setOnClickListener(new View.OnClickListener() { @@ -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() { mGifGiftTipGroupBuyZuoji.setOnClickListener(new View.OnClickListener() { @Override @@ -410,7 +445,7 @@ public class LiveGiftAnimPresenter { private void setGitTipAnimatorAllServer() { mDp500 = DpUtil.dp2px(500); mGifGiftTipShowAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", mDp500, 0); - mGifGiftTipShowAnimatorAllServer.setDuration(2000); + mGifGiftTipShowAnimatorAllServer.setDuration(2500); mGifGiftTipShowAnimatorAllServer.setInterpolator(new LinearInterpolator()); mGifGiftTipShowAnimatorAllServer.addListener(new AnimatorListenerAdapter() { @Override @@ -422,7 +457,7 @@ public class LiveGiftAnimPresenter { }); mDp10 = DpUtil.dp2px(10); mGifGiftTipHideAnimatorAllServer = ObjectAnimator.ofFloat(mGifGiftTipGroupAllServer, "translationX", 0); - mGifGiftTipHideAnimatorAllServer.setDuration(3000); + mGifGiftTipHideAnimatorAllServer.setDuration(3500); mGifGiftTipHideAnimatorAllServer.setInterpolator(new AccelerateDecelerateInterpolator()); mGifGiftTipHideAnimatorAllServer.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override @@ -673,10 +708,16 @@ public class LiveGiftAnimPresenter { mGifGiftTipHideAnimatorAllServer.start(); } else if (msg.what == WHAT_ALL_SERVER_2) { mShowAllServer = false; + mShowBlindBox = false; heightOffsetArr[index4OtherGift] = 0; LiveReceiveGiftBean bean = mGifAll.poll(); if (bean != null) { - chooseInto(bean); + if (bean.isBlindBox()) { + showSendGiftAnimAllServer2(bean); + } else { + chooseInto(bean); + } + } } else if (msg.what == WHAT_BUY_GUARD_1) { mGifGiftTipHideAnimatorBuyGuard.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuard.getWidth()); @@ -832,8 +873,6 @@ public class LiveGiftAnimPresenter { } } else { mShowAllServer = true; - - index4OtherGift = getFirstIndexOfValue(heightOffsetArr, 0); if (index4OtherGift >= 0) { heightOffsetArr[index4OtherGift] = 1; @@ -843,16 +882,57 @@ public class LiveGiftAnimPresenter { params.topMargin = DpUtil.dp2px(y); mGifGiftTipGroupAllServer.setLayoutParams(params); } - mAncherName = mTempGifGiftBean.getAncherName(); mGifGiftTipAllServer.setSelected(false); - - mIvLook.setVisibility(View.VISIBLE); mGifGiftTipGroupAllServer.setAlpha(1f); mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE); + textRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, ""); + mIvLook.setVisibility(View.VISIBLE); 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() + " " - +mContext.getString(R.string.live_send_buy_zuoji_1) + + mContext.getString(R.string.live_send_buy_zuoji_1) + " " + (mTempGifGiftBean.getCarName()); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); mGifGiftTipBuyZuoji.setText(spanned); @@ -975,7 +1055,7 @@ public class LiveGiftAnimPresenter { } String text = mTempGifGiftBean.getUserNiceName() + " " - +mContext.getString(R.string.live_send_buy_liang_name_1) + + mContext.getString(R.string.live_send_buy_liang_name_1) + " " + mTempGifGiftBean.getLiangName(); Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont")); mGifGiftTipBuyLiangName.setText(spanned); @@ -1124,7 +1204,7 @@ public class LiveGiftAnimPresenter { } }); } 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); } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 082fe779d..b131c0f4e 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -32,6 +32,7 @@ import com.yunbao.common.bean.SocketModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.http.HttpCallback; @@ -363,6 +364,24 @@ public class SocketRyClient { buyZuoJiByNotify(map); } else if (action2 == 66) {//购买贵族 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; case Constants.SOCKET_SEND_BARRAGE://发弹幕 diff --git a/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java b/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java index 602dd7cd2..8c3d979b5 100644 --- a/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java @@ -1,14 +1,18 @@ package com.yunbao.live.utils; import android.content.Context; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.text.Spannable; import android.text.SpannableStringBuilder; +import android.text.TextUtils; import android.text.style.ForegroundColorSpan; +import android.text.style.ImageSpan; import android.view.WindowManager; import android.widget.TextView; import com.yunbao.common.custom.VerticalImageSpan; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.DpUtil; import com.yunbao.live.R; @@ -68,7 +72,7 @@ public class AllMsgTextRender { ImgLoader.displayDrawable(context, url, new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { - if (builder!=null&&!builder.toString().contains(text)){ + if (builder != null && !builder.toString().contains(text)) { builder = createPrefix(drawable, builder); builder = renderMsg(color2, builder, text); 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); + } + /** * 渲染消息 */ 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 067ad135d..921a581c0 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -88,6 +88,7 @@ import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; 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); + } } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 10c8e51df..3f39c1888 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -43,6 +43,7 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.custom.MyViewPager; +import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.SendBlindGiftEvent; @@ -1999,4 +2000,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showXydComplete(model, false, liveReceiveGiftBean); } } + + public void blindBoxAllServerNotify(AllServerNotifyEvent event) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.blindBoxAllServerNotify(event); + } + } } diff --git a/live/src/main/res/drawable/bg_all_server_336cf7.xml b/live/src/main/res/drawable/bg_all_server_336cf7.xml new file mode 100644 index 000000000..c4b94e022 --- /dev/null +++ b/live/src/main/res/drawable/bg_all_server_336cf7.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_all_server_fcb50e.xml b/live/src/main/res/drawable/bg_all_server_fcb50e.xml new file mode 100644 index 000000000..f86cf2ee3 --- /dev/null +++ b/live/src/main/res/drawable/bg_all_server_fcb50e.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_all_server_fd5a9d.xml b/live/src/main/res/drawable/bg_all_server_fd5a9d.xml new file mode 100644 index 000000000..98c6ad51b --- /dev/null +++ b/live/src/main/res/drawable/bg_all_server_fd5a9d.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index 770e7b92a..fa39f0cff 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -8,7 +8,7 @@ @@ -68,9 +70,9 @@ android:layout_height="match_parent" android:layout_gravity="start" android:text="@string/live_gift_buy_gold" - android:textStyle="bold" android:textColor="#F5C600" - android:textSize="10sp" /> + android:textSize="10sp" + android:textStyle="bold" /> + android:visibility="invisible"> + android:background="@mipmap/bg_kirin"> + android:layout_marginTop="51dp" /> - + + @@ -100,15 +101,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:layout_margin="7dp" + android:layout_margin="5dp" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:gravity="center" - android:textSize="7sp" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" - android:textColor="@color/white" /> + android:textColor="@color/white" + android:textSize="10sp" /> \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index db2e6b405..11d8f8c09 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -970,6 +970,7 @@ android:visibility="invisible"> - + { - private static final int PAGE_COUNT = 2; + private static final int PAGE_COUNT = 3; public static final String DAY = "day"; public static final String WEEK = "week"; public static final String MONTH = "month"; @@ -121,7 +122,8 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener mIndicator = (MagicIndicator) findViewById(R.id.indicator); final String[] titles = new String[]{ (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.setAdapter(new CommonNavigatorAdapter() { @@ -231,9 +233,12 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener if (position == 0) { select.setTextColor(Color.parseColor("#FF82C1")); unSelect.setTextColor(Color.parseColor("#FFFFFF")); - } else { + } else if (position == 1){ select.setTextColor(Color.parseColor("#7BBAFF")); 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); vh = mContributeViewHolder; 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) { return; diff --git a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java index e2729f123..7451774ec 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java @@ -51,7 +51,7 @@ public class MainListAdapter extends RefreshAdapter { private List mTopList; private int mType; private List outRankHide = new ArrayList<>(); - protected boolean isRankOne;//是否为魅力榜 (第一个tab) + protected int isRankOne;//是否为魅力榜 (第一个tab) public MainListAdapter(Context context, int type) { @@ -93,7 +93,7 @@ public class MainListAdapter extends RefreshAdapter { } - public void setRankOne(boolean rankOne) { + public void setRankOne(int rankOne) { isRankOne = rankOne; } @@ -267,12 +267,15 @@ public class MainListAdapter extends RefreshAdapter { } else { mBtnFollow.doChecked(false); mBtnFollow.setText(mFollow); - if(isRankOne){ + if(isRankOne==0){ mBtnFollow.setBackgroundResource(R.drawable.background_ff82c1); mBtnFollow.setTextColor(Color.parseColor("#FF82C1")); - }else { + }else if(isRankOne==1){ mBtnFollow.setBackgroundResource(R.drawable.background_ff7bbaff); mBtnFollow.setTextColor(Color.parseColor("#7BBAFF")); + }else if(isRankOne==2){ + mBtnFollow.setBackgroundResource(R.drawable.background_ffff9072); + mBtnFollow.setTextColor(Color.parseColor("#ff9072")); } } mSex.setVisibility(View.INVISIBLE); diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpConsts.java b/main/src/main/java/com/yunbao/main/http/MainHttpConsts.java index 6bd896b02..73bdffd3d 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpConsts.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpConsts.java @@ -15,6 +15,7 @@ public class MainHttpConsts { public static final String GET_NEAR = "getNear"; public static final String PROFIT_LIST = "profitList"; 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 SET_BLACK = "setBlack"; public static final String GET_SETTING_LIST = "getSettingList"; diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 6cb05f77e..5283180ca 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -62,7 +62,7 @@ public class MainHttpUtil { HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD) .params("openid", openid) .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("type", type) .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); HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD) .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("uuid_Device", uuidDevice) .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) .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) .params("jian_key", jian_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) .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("admin_id", promo_code) @@ -696,9 +705,10 @@ public class MainHttpUtil { HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR) .execute(callback); } - // - public static void setMessageReadAll(){ - HttpClient.getInstance().get("User.getUserInstructor","") + + // + public static void setMessageReadAll() { + HttpClient.getInstance().get("User.getUserInstructor", "") .execute(new HttpCallback() { @Override 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") .params("uuid_Device", DeviceUtils.getUniqueDeviceId()) .execute(callback); diff --git a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java index 831135ffb..41b565440 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -31,7 +31,6 @@ import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.live.http.LiveHttpUtil; 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 TOTAL = "total"; protected String mType; - protected boolean isRankOne;//是否为魅力榜 (第一个tab) + protected int isRankOne;//是否为魅力榜 (第一个tab) protected CommonRefreshView mRefreshView; public MainListAdapter mAdapter; protected OnLoadData loadData; @@ -94,7 +93,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple if (outRankHide != null) { for (String hideId : outRankHide) { 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 { @@ -216,8 +215,10 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple } if (position == 0) { mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour_top); - } else { + } else if (position == 1) { 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); if (bean.getAttention() != 1) { getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true); - getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" +mContext.getString(R.string.follow)); - if (isRankOne) { + getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" + mContext.getString(R.string.follow)); + if (isRankOne==0) { getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ffff79c2); 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).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); } else { diff --git a/main/src/main/java/com/yunbao/main/views/MainListBoxBlindViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainListBoxBlindViewHolder.java new file mode 100644 index 000000000..f2bfe546b --- /dev/null +++ b/main/src/main/java/com/yunbao/main/views/MainListBoxBlindViewHolder.java @@ -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 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() { + @Override + public RefreshAdapter 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 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 list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + } + + /** + * 设置隐藏数据 + * + * @param outRankHide + */ + public void setHide(List outRankHide) { + this.outRankHide = outRankHide; + if (mAdapter != null) + mAdapter.setHide(outRankHide); + } +} diff --git a/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java index dc8a0d293..af9da6db1 100644 --- a/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java @@ -27,7 +27,7 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder { public MainListContributeViewHolder(Context context, ViewGroup parentView) { super(context, parentView); - isRankOne = false; + isRankOne = 2; } @Override diff --git a/main/src/main/java/com/yunbao/main/views/MainListProfitViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainListProfitViewHolder.java index cb9b1c49c..5ce848333 100644 --- a/main/src/main/java/com/yunbao/main/views/MainListProfitViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainListProfitViewHolder.java @@ -24,7 +24,7 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder { public MainListProfitViewHolder(Context context, ViewGroup parentView) { super(context, parentView); - isRankOne = true; + isRankOne = 1; } @Override diff --git a/main/src/main/res/drawable/background_ff9072.xml b/main/src/main/res/drawable/background_ff9072.xml new file mode 100644 index 000000000..379d92da8 --- /dev/null +++ b/main/src/main/res/drawable/background_ff9072.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/drawable/background_ffff9072.xml b/main/src/main/res/drawable/background_ffff9072.xml new file mode 100644 index 000000000..b653689c9 --- /dev/null +++ b/main/src/main/res/drawable/background_ffff9072.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/view_main_list.xml b/main/src/main/res/layout/view_main_list.xml index 6b8a4600e..ae09b69f8 100644 --- a/main/src/main/res/layout/view_main_list.xml +++ b/main/src/main/res/layout/view_main_list.xml @@ -16,6 +16,7 @@ app:layout_constraintTop_toTopOf="parent"> + - \ No newline at end of file diff --git a/main/src/main/res/mipmap-xxhdpi/bg_glamour3_top.png b/main/src/main/res/mipmap-xxhdpi/bg_glamour3_top.png new file mode 100644 index 000000000..f91ae900b Binary files /dev/null and b/main/src/main/res/mipmap-xxhdpi/bg_glamour3_top.png differ