礼物盲盒基本逻辑
This commit is contained in:
parent
3e72b4a9eb
commit
1f7aef91a8
@ -0,0 +1,77 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlindBoxInfoModel extends BaseModel {
|
||||
/**
|
||||
* "info":[{"item_name":["麒麟勛章饰品","麒麟頭像框饰品","麒麟坐騎饰品","水晶项链礼物","夢幻水晶球礼物","心動泡泡礼物","蝴蝶少女礼物","金色唱片礼物","鑽石禮盒礼物","紙花船礼物"],"threshold_value":268,"threshold_dress_name":"麒麟坐騎","dress_threshold_value":0,"blind_box_type":1,"blind_box_id":1636},{"item_name":["金鳳勛章饰品","金鳳頭像框饰品","金鳳坐騎饰品","浪漫氣球礼物","捕夢網礼物","仙女棒礼物","藍寶石鈴鐺礼物","榮耀星礼物","童話屋礼物","夢幻許願池礼物"],"threshold_value":198,"threshold_dress_name":"金鳳坐騎","dress_threshold_value":0,"blind_box_type":2,"blind_box_id":1637},{"item_name":["神龍勛章饰品","神龍頭像框饰品","神龍坐騎饰品","水晶玫瑰礼物","sweet香水礼物","甜蜜熱氣球礼物","風鈴舞動礼物","音樂噴泉礼物","星空列車礼物","漂洋過海來看你礼物"],"threshold_value":128,"threshold_dress_name":"神龍坐騎","dress_threshold_value":0,"blind_box_type":3,"blind_box_id":1638}]
|
||||
*/
|
||||
@SerializedName("item_name")
|
||||
private List<String> itemName;
|
||||
@SerializedName("threshold_value")
|
||||
private String thresholdValue = "0";
|
||||
@SerializedName("threshold_dress_name")
|
||||
private String thresholdDressName;
|
||||
@SerializedName("dress_threshold_value")
|
||||
private String dressThresholdValue;
|
||||
@SerializedName("blind_box_type")
|
||||
private String blindBoxType;
|
||||
@SerializedName("blind_box_id")
|
||||
private String blindBoxId;
|
||||
|
||||
public List<String> getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setItemName(List<String> itemName) {
|
||||
this.itemName = itemName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThresholdValue() {
|
||||
return thresholdValue;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setThresholdValue(String thresholdValue) {
|
||||
this.thresholdValue = thresholdValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThresholdDressName() {
|
||||
return thresholdDressName;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setThresholdDressName(String thresholdDressName) {
|
||||
this.thresholdDressName = thresholdDressName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressThresholdValue() {
|
||||
return dressThresholdValue;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setDressThresholdValue(String dressThresholdValue) {
|
||||
this.dressThresholdValue = dressThresholdValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBlindBoxType() {
|
||||
return blindBoxType;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setBlindBoxType(String blindBoxType) {
|
||||
this.blindBoxType = blindBoxType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBlindBoxId() {
|
||||
return blindBoxId;
|
||||
}
|
||||
|
||||
public BlindBoxInfoModel setBlindBoxId(String blindBoxId) {
|
||||
this.blindBoxId = blindBoxId;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public class LiveGiftBean {
|
||||
// public static final int MARK_LUCK = 3;
|
||||
|
||||
private int id;
|
||||
private int type;//0 普通礼物 1是贵族 2守护 3粉丝团
|
||||
private int type;//0 普通礼物 1是贵族 2守护 3粉丝团 5盲盒礼物
|
||||
private int mark;// 0 普通 1热门 2守护 3幸运
|
||||
private String name;
|
||||
private String price;
|
||||
@ -34,6 +34,17 @@ public class LiveGiftBean {
|
||||
private String isweek;
|
||||
private String end_time;
|
||||
private String tag;
|
||||
@JSONField(name = "blind_box_type")
|
||||
private int blind_box_type = 0;
|
||||
|
||||
public int getBlind_box_type() {
|
||||
return blind_box_type;
|
||||
}
|
||||
|
||||
public LiveGiftBean setBlind_box_type(int blind_box_type) {
|
||||
this.blind_box_type = blind_box_type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
@ -17,11 +18,11 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.ListInfoMessageModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
||||
import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveAnchorSayModel;
|
||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.LiveTaskModel;
|
||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
@ -717,9 +718,16 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=Live.setLiveVote")
|
||||
Observable<ResponseModel<List<String>>> updateLiveVote(@Query("liveuid") String liveUid,
|
||||
@Query("option_content_key") String key);
|
||||
|
||||
/**
|
||||
* 主动结束投票
|
||||
*/
|
||||
@GET("/api/public/?service=Live.endLiveVote")
|
||||
Observable<ResponseModel<List<String>>> endLiveVote(@Query("liveuid") String liveUid);
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getBlindBoxInfo")
|
||||
Observable<ResponseModel<List<BlindBoxInfoModel>>> getBlindBoxInfo();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
@ -18,11 +19,11 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.ListInfoMessageModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
||||
import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveAnchorSayModel;
|
||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.LiveTaskModel;
|
||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
@ -1522,6 +1523,33 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物信息
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getBlindBoxInfo(HttpCallback<List<BlindBoxInfoModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getBlindBoxInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BlindBoxInfoModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BlindBoxInfoModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
23
common/src/main/res/drawable/bg_blind_progres.xml
Normal file
23
common/src/main/res/drawable/bg_blind_progres.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--设置ProgressBar背景色-->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<!--设置ProgressBar进度条圆角半径-->
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="#65FB712D" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!--设置ProgressBar进度条颜色-->
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="3dp" />
|
||||
<gradient
|
||||
android:endColor="#FCCCA4"
|
||||
android:startColor="#FCAB6A" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
24
common/src/main/res/drawable/bg_blind_progress.xml
Normal file
24
common/src/main/res/drawable/bg_blind_progress.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--设置ProgressBar背景色-->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<!--设置ProgressBar进度条圆角半径-->
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="#659FFBF6" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!--设置ProgressBar进度条颜色-->
|
||||
<item android:id="@android:id/progress" >
|
||||
<scale android:scaleWidth="100%" android:scaleHeight="6dp">
|
||||
<shape >
|
||||
<corners android:radius="3dp" />
|
||||
<gradient
|
||||
android:endColor="#10A5FB"
|
||||
android:startColor="#78E2FD" />
|
||||
</shape>
|
||||
</scale>
|
||||
|
||||
</item>
|
||||
</layer-list>
|
23
common/src/main/res/drawable/bg_blind_progress1.xml
Normal file
23
common/src/main/res/drawable/bg_blind_progress1.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--设置ProgressBar背景色-->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<!--设置ProgressBar进度条圆角半径-->
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="#65F8B334" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!--设置ProgressBar进度条颜色-->
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="3dp" />
|
||||
<gradient
|
||||
android:startColor="#FFF682"
|
||||
android:endColor="#FDF9C2" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
@ -1160,7 +1160,7 @@
|
||||
<string name="live_vote_close_yes">是</string>
|
||||
<string name="live_vote_close_no">否</string>
|
||||
<string name="live_vote_hide_text">投票中</string>
|
||||
<string name="live_room_vote_over_tip">%s <br/> 問答框%s秒后消失</string>
|
||||
<string name="live_room_vote_over_tip">%s <br /> 問答框%s秒后消失</string>
|
||||
<string name="live_anchor_vote_tip">請完整填寫</string>
|
||||
<string name="complete_information_consumable">填寫“*”的選項可完成</string>
|
||||
<string name="love_powder">真愛粉\n頭像框(7天)</string>
|
||||
@ -1172,4 +1172,9 @@
|
||||
<string name="complete_information_hint3">離開會讓您失去獎勵,您確認離開嗎?</string>
|
||||
<string name="complete_information_hint2">愛你,愛你</string>
|
||||
<string name="you_guide_me">指導下我好嗎</string>
|
||||
<string name="resend_win">再送%s个%s必得%s</string>
|
||||
<string name="have_already_win">已将%s发送至您的个性装扮</string>
|
||||
<string name="mini_blind_box">迷你盲盒</string>
|
||||
<string name="collection_blind_box">典藏盲盒</string>
|
||||
<string name="pd_blind_box">PD盲盒</string>
|
||||
</resources>
|
||||
|
@ -1178,4 +1178,11 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="complete_information_hint3">Leave without a gift</string>
|
||||
<string name="complete_information_hint2">Love you</string>
|
||||
<string name="you_guide_me">Can you guide me</string>
|
||||
<string name="resend_win">再送%s个%s必得%s</string>
|
||||
<string name="have_already_win">已将%s发送至您的个性装扮</string>
|
||||
<string name="mini_blind_box">迷你盲盒</string>
|
||||
<string name="collection_blind_box">典藏盲盒</string>
|
||||
<string name="pd_blind_box">PD盲盒</string>
|
||||
<string name="individual_dressing">个性装扮</string>
|
||||
<string name="random_availability">可随机获得,%s</string>
|
||||
</resources>
|
||||
|
@ -11,7 +11,10 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@ -19,9 +22,11 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
@ -37,12 +42,14 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean2;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
@ -120,6 +127,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
|
||||
private RecyclerView items;
|
||||
private LinearLayout mVipGold;
|
||||
private FrameLayout blindBox, frameBlindTop;
|
||||
private ProgressBar progressBlind, progressBlind1, progressBlind2;
|
||||
private GiftTopAdapter giftTopAdapter;
|
||||
public int type = 0;
|
||||
private static String type_name = "熱門";
|
||||
@ -127,7 +136,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
private ImageView mVipGoldIcon;
|
||||
private TextView mVipGoldTitle;
|
||||
private TextView mVipGoldDesc;
|
||||
private TextView mGiftPackage;
|
||||
private TextView mGiftPackage, blindNumber, textBlindProgress, textBlindGiftName;
|
||||
private boolean isPk;
|
||||
private int isContactGift = 0;
|
||||
DialogInterface.OnDismissListener onDismissListener;
|
||||
@ -152,6 +161,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
window.setDimAmount(0f);//去掉遮罩层(全透明)
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = DpUtil.dp2px(355);
|
||||
@ -191,6 +201,11 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mTvGoCharge = (TextView) mRootView.findViewById(R.id.go_charge);
|
||||
items = (RecyclerView) mRootView.findViewById(R.id.items);
|
||||
mLoading = mRootView.findViewById(R.id.loading);
|
||||
blindBox = mRootView.findViewById(R.id.blind_box);
|
||||
frameBlindTop = mRootView.findViewById(R.id.frame_blind_top);
|
||||
progressBlind = mRootView.findViewById(R.id.progress_blind1);
|
||||
progressBlind1 = mRootView.findViewById(R.id.progress_blind2);
|
||||
progressBlind2 = mRootView.findViewById(R.id.progress_blind3);
|
||||
mArrow = mRootView.findViewById(R.id.arrow);
|
||||
mBtnSend = mRootView.findViewById(R.id.btn_send);
|
||||
mBtnSendGroup = mRootView.findViewById(R.id.btn_send_group);
|
||||
@ -285,6 +300,9 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mVipGoldDesc = mRootView.findViewById(R.id.vipGoldDesc);
|
||||
mVipGold.setOnClickListener(this);
|
||||
mGiftPackage = mRootView.findViewById(R.id.btn_gift_package);
|
||||
blindNumber = mRootView.findViewById(R.id.blind_number);
|
||||
textBlindProgress = mRootView.findViewById(R.id.text_blind_progress);
|
||||
textBlindGiftName = mRootView.findViewById(R.id.text_blind_gift_name);
|
||||
mGiftPackage.setOnClickListener(this);
|
||||
mRootView.findViewById(R.id.live_gift_download_all).setOnClickListener(this);
|
||||
mHandler = new Handler() {
|
||||
@ -319,6 +337,24 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
if (isPk) {
|
||||
mVipGold.setVisibility(View.GONE);
|
||||
}
|
||||
getBlindBoxInfo();
|
||||
}
|
||||
|
||||
public List<BlindBoxInfoModel> blindBoxInfoModels = new ArrayList<>();
|
||||
|
||||
private void getBlindBoxInfo() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getBlindBoxInfo(new com.yunbao.common.http.base.HttpCallback<List<BlindBoxInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<BlindBoxInfoModel> data) {
|
||||
blindBoxInfoModels = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -666,6 +702,122 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
mArrow.setVisibility(View.VISIBLE);
|
||||
mBtnSend.setBackground(mDrawable1);
|
||||
}
|
||||
if (bean.getType() == 5) {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前盲盒礼物进度
|
||||
*
|
||||
* @param blindBoxType
|
||||
*/
|
||||
private StringBuffer blindGiftNamesBuffer = null;
|
||||
|
||||
private void showBlindProgress(int blindBoxType) {
|
||||
blindGiftNamesBuffer = new StringBuffer();
|
||||
BlindBoxInfoModel model = null;
|
||||
for (BlindBoxInfoModel boxInfoModel : blindBoxInfoModels) {
|
||||
if (TextUtils.equals(String.valueOf(blindBoxType), boxInfoModel.getBlindBoxType())) {
|
||||
model = boxInfoModel;
|
||||
}
|
||||
}
|
||||
if (model == null) return;
|
||||
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:
|
||||
boxBlindName = mContext.getString(R.string.mini_blind_box);
|
||||
progressBlind.setVisibility(View.VISIBLE);
|
||||
progressBlind1.setVisibility(View.GONE);
|
||||
progressBlind2.setVisibility(View.GONE);
|
||||
frameBlindTop.setBackgroundResource(R.mipmap.bg_kirin);
|
||||
progressBlind.setMax(Integer.parseInt(model.getThresholdValue()));
|
||||
progressBlind.setProgress(Integer.parseInt(model.getDressThresholdValue()));
|
||||
textBlindProgress.setTextColor(Color.parseColor("#047771"));
|
||||
break;
|
||||
case 2:
|
||||
boxBlindName = mContext.getString(R.string.collection_blind_box);
|
||||
progressBlind.setVisibility(View.GONE);
|
||||
progressBlind1.setVisibility(View.VISIBLE);
|
||||
progressBlind2.setVisibility(View.GONE);
|
||||
frameBlindTop.setBackgroundResource(R.mipmap.bg_phoenix);
|
||||
progressBlind1.setMax(Integer.parseInt(model.getThresholdValue()));
|
||||
progressBlind1.setProgress(Integer.parseInt(model.getDressThresholdValue()));
|
||||
textBlindProgress.setTextColor(Color.parseColor("#6D2E0F"));
|
||||
|
||||
break;
|
||||
default:
|
||||
boxBlindName = mContext.getString(R.string.pd_blind_box);
|
||||
progressBlind.setVisibility(View.GONE);
|
||||
progressBlind1.setVisibility(View.GONE);
|
||||
progressBlind2.setVisibility(View.VISIBLE);
|
||||
frameBlindTop.setBackgroundResource(R.mipmap.bg_dragon);
|
||||
progressBlind2.setMax(Integer.parseInt(model.getThresholdValue()));
|
||||
progressBlind2.setProgress(Integer.parseInt(model.getDressThresholdValue()));
|
||||
textBlindProgress.setTextColor(Color.parseColor("#905E01"));
|
||||
break;
|
||||
}
|
||||
|
||||
//进度下方提示语
|
||||
if (TextUtils.equals(model.getThresholdValue(), model.getDressThresholdValue())) {
|
||||
String individualDressing = mContext.getString(R.string.individual_dressing);
|
||||
String msg = mContext.getString(R.string.have_already_win);
|
||||
msg = String.format(msg, model.getThresholdDressName());
|
||||
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
|
||||
int individualDressingIndexOf = msg.indexOf(String.valueOf(individualDressing));
|
||||
int dressNameSize = model.getThresholdDressName().length();
|
||||
int individualDressingSize = String.valueOf(individualDressing).length();
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(msg);
|
||||
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);
|
||||
} 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());
|
||||
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
|
||||
int progressIndexOf = msg.indexOf(String.valueOf(progress));
|
||||
int dressNameSize = model.getThresholdDressName().length();
|
||||
int progressSize = String.valueOf(progress).length();
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(msg);
|
||||
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), progressIndexOf, progressIndexOf + progressSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
blindNumber.setText(builder);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(model.getDressThresholdValue())
|
||||
.append("/")
|
||||
.append(model.getThresholdValue());
|
||||
textBlindProgress.setText(stringBuffer.toString());
|
||||
}
|
||||
//盲盒礼物文字跑马灯
|
||||
for (int i = 0; i < model.getItemName().size(); i++) {
|
||||
blindGiftNamesBuffer
|
||||
.append(model.getItemName().get(i));
|
||||
|
||||
if (i != model.getItemName().size() - 1) {
|
||||
blindGiftNamesBuffer.append(",");
|
||||
}
|
||||
}
|
||||
textBlindGiftName.setText(String.format(mContext.getString(R.string.random_availability), blindGiftNamesBuffer.toString()));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,11 +23,11 @@
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:layout_width="19dp"
|
||||
android:layout_height="19dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:src="@mipmap/icon_small_download" />
|
||||
android:src="@mipmap/icon_small_download"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -84,6 +84,18 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/blind_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<include
|
||||
|
||||
layout="@layout/view_blind_box" />
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
113
live/src/main/res/layout/view_blind_box.xml
Normal file
113
live/src/main/res/layout/view_blind_box.xml
Normal file
@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="159dp"
|
||||
android:layout_height="110dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
<!--凤凰,龙,麒麟-->
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_blind_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="86.5dp"
|
||||
android:background="@mipmap/bg_phoenix">
|
||||
|
||||
<com.yunbao.common.views.weight.ClipPathCircleImage
|
||||
android:layout_width="29dp"
|
||||
android:layout_height="29dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="51dp"
|
||||
android:src="@mipmap/icon_avatar_test" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="51dp"
|
||||
android:layout_marginTop="59dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_blind3"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progress="30"
|
||||
android:progressDrawable="@drawable/bg_blind_progres"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_blind1"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/bg_blind_progress"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_blind2"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/bg_blind_progress1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_blind_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="6sp" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blind_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="6sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="47dp"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:src="@mipmap/icon_what" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="139dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_blind_bottom">
|
||||
|
||||
<com.yunbao.common.views.weight.MarqueeTextView
|
||||
android:id="@+id/text_blind_gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="7dp"
|
||||
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" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
BIN
live/src/main/res/mipmap-xxxhdpi/bg_blind_bottom.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/bg_blind_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
live/src/main/res/mipmap-xxxhdpi/bg_dragon.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/bg_dragon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 360 KiB |
BIN
live/src/main/res/mipmap-xxxhdpi/bg_kirin.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/bg_kirin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 257 KiB |
BIN
live/src/main/res/mipmap-xxxhdpi/bg_phoenix.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/bg_phoenix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 251 KiB |
BIN
live/src/main/res/mipmap-xxxhdpi/icon_what.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/icon_what.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in New Issue
Block a user