糖果树UI升级:规则页面
This commit is contained in:
@@ -816,10 +816,6 @@
|
||||
android:name=".treasure_box.activity.TreasureBoxActivity"
|
||||
android:theme="@style/treasure_box_activity" />
|
||||
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxHonourActivity"
|
||||
android:theme="@style/treasure_box_activity" />
|
||||
|
||||
<activity android:name=".ui.setting.VerifyPhoneActivity" />
|
||||
<activity android:name=".ui.setting.ModifyPwdActivity" />
|
||||
<activity
|
||||
|
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_pressed="true" android:drawable="@drawable/auto_open_honour_box_pressed"/>
|
||||
<item android:state_focused="true" android:drawable="@drawable/auto_open_honour_box_pressed"/>
|
||||
<item android:drawable="@drawable/auto_open_honour_box_normal"/>
|
||||
</selector>
|
@@ -1,318 +0,0 @@
|
||||
package com.mango.moshen.treasure_box.activity;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.mango.moshen.R;
|
||||
import com.mango.moshen.base.BaseBindingActivity;
|
||||
import com.mango.moshen.databinding.ActivityTreasureBoxHonourBinding;
|
||||
import com.mango.moshen.ui.utils.ImageLoadUtils;
|
||||
import com.mango.moshen.ui.webview.DialogWebViewActivity;
|
||||
import com.mango.treasure_box.bean.PrizeInfo;
|
||||
import com.mango.treasure_box.model.BoxModel;
|
||||
import com.mango.treasure_box.model.IBoxModel;
|
||||
import com.mango.core.DemoCache;
|
||||
import com.mango.core.UriProvider;
|
||||
import com.mango.core.manager.IMNetEaseManager;
|
||||
import com.mango.core.manager.RoomEvent;
|
||||
import com.mango.core.pay.PayModel;
|
||||
import com.mango.core.pay.bean.WalletInfo;
|
||||
import com.mango.core.utils.StringUtils;
|
||||
import com.mango.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.mango.xchat_android_library.utils.FormatUtils;
|
||||
import com.mango.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.mango.xchat_android_library.utils.TextWatcherWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
||||
@ActLayoutRes(R.layout.activity_treasure_box_honour)
|
||||
public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreasureBoxHonourBinding> {
|
||||
private final Runnable removeRunnable = () -> mBinding.llPrizeHint.removeAllViews();
|
||||
private int price = 20;
|
||||
private volatile int keyNum;
|
||||
private ArrayList<PrizeInfo> cacheList = new ArrayList<>();
|
||||
private ArrayList<PrizeInfo> hintPrizeCacheList = new ArrayList<>();
|
||||
private ObjectAnimator translationXAnimator;
|
||||
private ObjectAnimator translationYAnimator;
|
||||
private int boxType = IBoxModel.BOX_TYPE_HONOUR;
|
||||
private int height;
|
||||
private int sendMessageSwitchLevel;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, TreasureBoxHonourActivity.class);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
|
||||
height = ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context));
|
||||
getWindow().setGravity(Gravity.BOTTOM);
|
||||
subscribeEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
mBinding.setClick(this);
|
||||
translationXAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationX", 0,
|
||||
ScreenUtil.screenWidth / 2f - ScreenUtil.dip2px(15 + 19)).setDuration(100);
|
||||
translationXAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
translationXAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mBinding.ivGiftAnim.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
mBinding.ivBox.post(() -> {
|
||||
translationYAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationY", 0,
|
||||
height - (mBinding.ivBox.getBottom() + mBinding.ivBox.getTop()) / 2f - ScreenUtil.dip2px(55)).setDuration(100);
|
||||
translationYAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
});
|
||||
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
||||
if (walletInfo != null) {
|
||||
mBinding.tvDiamondNum.setText(FormatUtils.formatBigInteger(walletInfo.getDiamondNum()));
|
||||
}
|
||||
|
||||
mBinding.editNum.addTextChangedListener(new TextWatcherWrapper() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
int num = StringUtils.toInt(mBinding.editNum.getText().toString(), 0);
|
||||
mBinding.tvContinuousNum.setText("消耗" + num * 10);
|
||||
}
|
||||
});
|
||||
looperPrize();
|
||||
looperHintPrize();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
loadKeyInfo();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void loadKeyInfo() {
|
||||
BoxModel.get()
|
||||
.getKeyInfo(boxType)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(keyInfo -> {
|
||||
changeKeyNum(keyInfo.getKeyNum());
|
||||
price = keyInfo.getKeyPrice();
|
||||
sendMessageSwitchLevel = keyInfo.getSendMessageSwitchLevel();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.root_view:
|
||||
finish();
|
||||
break;
|
||||
case R.id.iv_open:
|
||||
openBox(StringUtils.toInt(mBinding.editNum.getText().toString()));
|
||||
break;
|
||||
case R.id.iv_more:
|
||||
//new BoxMoreDialog(context, sendMessageSwitchLevel).openDialog();
|
||||
break;
|
||||
case R.id.tv_rank:
|
||||
//BoxRankingActivity.start(this);
|
||||
break;
|
||||
case R.id.iv_sub:
|
||||
mBinding.editNum.setText(String.valueOf(Math.max(StringUtils.toInt(mBinding.editNum.getText().toString(), 0) - 1, 1)));
|
||||
break;
|
||||
case R.id.iv_add:
|
||||
mBinding.editNum.setText(String.valueOf(Math.min((StringUtils.toInt(mBinding.editNum.getText().toString(), 0) + 1), 9999)));
|
||||
break;
|
||||
case R.id.view_bg:
|
||||
case R.id.iv_title:
|
||||
//do nothing
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查钥匙(锤子)数量
|
||||
*
|
||||
* @param count 想要使用的数量
|
||||
* @return true 表示数量不足,无法进行下一步操作
|
||||
* false 表示数量没问题,可以继续操作
|
||||
*/
|
||||
private boolean checkKeyNum(int count) {
|
||||
if (count == 0) {
|
||||
SingleToastUtil.showToast("开启数量不能为0!");
|
||||
return true;
|
||||
}
|
||||
if (keyNum < count) {
|
||||
getDialogManager().showOkCancelDialog("参与活动获得流星", "去参与",
|
||||
() -> DialogWebViewActivity.start(context, UriProvider.getBoxKey()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void openBox(int count) {
|
||||
if (checkKeyNum(count)) {
|
||||
return;
|
||||
}
|
||||
mBinding.ivOpen.setEnabled(false);
|
||||
mBinding.svgaOpen.startAnimation();
|
||||
BoxModel.get()
|
||||
.openBox(boxType, count, DemoCache.readNeedBoxMsg())
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(throwable -> {
|
||||
mBinding.ivOpen.setEnabled(true);
|
||||
toast(throwable.getMessage());
|
||||
})
|
||||
.toObservable()
|
||||
.flatMap(openBoxResult -> {
|
||||
mBinding.ivOpen.setEnabled(true);
|
||||
changeKeyNum(openBoxResult.getRemainKeyNum());
|
||||
cacheList.addAll(openBoxResult.getPrizeItemList());
|
||||
return Observable.fromIterable(openBoxResult.getPrizeItemList());
|
||||
})
|
||||
.filter(prizeInfo -> prizeInfo.getPrizeLevel() > 2)
|
||||
.subscribe(prizeInfo -> hintPrizeCacheList.add(prizeInfo));
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void looperPrize() {
|
||||
Observable.interval(0, 100, TimeUnit.MILLISECONDS)
|
||||
.compose(bindToLifecycle())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(aLong -> cacheList.size() > 0)
|
||||
.subscribe(aLong -> {
|
||||
PrizeInfo prizeInfo = cacheList.get(0);
|
||||
String url = prizeInfo.getPrizeImgUrl();
|
||||
if (cacheList.size() > 0) cacheList.remove(0);
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
if (translationXAnimator != null) translationXAnimator.start();
|
||||
if (translationYAnimator != null) translationYAnimator.start();
|
||||
mBinding.ivGiftAnim.setVisibility(View.VISIBLE);
|
||||
mBinding.svgaGiftBg.startAnimation();
|
||||
ImageLoadUtils.loadImage(context, url, mBinding.ivGiftAnim);
|
||||
}
|
||||
}
|
||||
, e -> looperPrize());//出错了继续looper......
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void looperHintPrize() {
|
||||
Observable.interval(0, 250, TimeUnit.MILLISECONDS)
|
||||
.compose(bindToLifecycle())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(aLong -> hintPrizeCacheList.size() > 0)
|
||||
.subscribe(aLong -> addPrizeHintView(hintPrizeCacheList.remove(0))
|
||||
, e -> looperHintPrize());//出错了继续looper......
|
||||
}
|
||||
|
||||
private void addPrizeHintView(PrizeInfo prizeInfo) {
|
||||
mBinding.llPrizeHint.removeCallbacks(removeRunnable);
|
||||
mBinding.llPrizeHint.postDelayed(removeRunnable, 3000);
|
||||
LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.item_box_prize_hint, null);
|
||||
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ScreenUtil.dip2px(21));
|
||||
layoutParams.setMargins(0, 0, 0, ScreenUtil.dip2px(5));
|
||||
linearLayout.setLayoutParams(layoutParams);
|
||||
switch (prizeInfo.getPrizeLevel()) {
|
||||
case 3:
|
||||
default:
|
||||
linearLayout.setBackgroundResource(R.drawable.bg_box_prize_hint_v3);
|
||||
break;
|
||||
case 4:
|
||||
linearLayout.setBackgroundResource(R.drawable.bg_box_prize_hint_v4);
|
||||
break;
|
||||
case 5:
|
||||
linearLayout.setBackgroundResource(R.drawable.bg_box_prize_hint_v5);
|
||||
break;
|
||||
}
|
||||
mBinding.llPrizeHint.addView(linearLayout);
|
||||
if (mBinding.llPrizeHint.getChildCount() > 6) {
|
||||
mBinding.llPrizeHint.removeViewAt(0);
|
||||
}
|
||||
for (int i = 0; i < mBinding.llPrizeHint.getChildCount(); i++) {
|
||||
ObjectAnimator.ofFloat(mBinding.llPrizeHint.getChildAt(i), "translationY", ScreenUtil.dip2px(21), 0)
|
||||
.setDuration(200)
|
||||
.start();
|
||||
}
|
||||
|
||||
((TextView) linearLayout.findViewById(R.id.tv_prize_name)).setText(prizeInfo.getPrizeName());
|
||||
((TextView) linearLayout.findViewById(R.id.tv_prize_num)).setText("x" + prizeInfo.getPrizeNum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新钥匙(锤子)数量
|
||||
*
|
||||
* @param num
|
||||
*/
|
||||
private void changeKeyNum(int num) {
|
||||
keyNum = num;
|
||||
mBinding.tvKeyNum.setText(keyNum + "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新钱包
|
||||
*
|
||||
* @param g
|
||||
*/
|
||||
private void setGold(double g) {
|
||||
mBinding.tvDiamondNum.setText(FormatUtils.formatBigInteger(g));
|
||||
PayModel.get().getCurrentWalletInfo().setDiamondNum(g);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void subscribeEvent() {
|
||||
//更新钻石数量和被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(roomEvent -> {
|
||||
switch (roomEvent.getEvent()) {
|
||||
case RoomEvent.WALLET_UPDATE:
|
||||
setGold(roomEvent.getWalletInfo().getDiamondNum());
|
||||
break;
|
||||
case RoomEvent.KICK_OUT_ROOM:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
super.setStatusBar();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
StatusBarUtil.StatusBarLightMode(this);
|
||||
}
|
||||
|
||||
}
|
@@ -6,18 +6,14 @@ import android.widget.ImageView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.mango.core.auth.AuthModel
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.base.BaseViewBindingFragment
|
||||
import com.mango.moshen.common.EmptyViewHelper
|
||||
import com.mango.moshen.databinding.FragmentBoxRecordBinding
|
||||
import com.mango.moshen.databinding.FragmentBoxRuleBinding
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
import com.mango.moshen.ui.utils.load
|
||||
import com.mango.treasure_box.bean.PrizeInfo
|
||||
import com.mango.treasure_box.bean.BoxRuleItemInfo
|
||||
import com.mango.treasure_box.model.BoxModel
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class BoxRuleFragment : BaseViewBindingFragment<FragmentBoxRuleBinding>() {
|
||||
|
||||
@@ -30,56 +26,43 @@ class BoxRuleFragment : BaseViewBindingFragment<FragmentBoxRuleBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var adapter: BaseQuickAdapter<PrizeInfo, BaseViewHolder>
|
||||
private var page = 1
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private val pageSize = 20
|
||||
private val format = SimpleDateFormat("MM-dd HH:mm", Locale.CHINA)
|
||||
private lateinit var adapter: BaseQuickAdapter<BoxRuleItemInfo, BaseViewHolder>
|
||||
private lateinit var rvDelegate: RVDelegate<BoxRuleItemInfo>
|
||||
|
||||
override fun init() {
|
||||
adapter =
|
||||
object : BaseQuickAdapter<PrizeInfo, BaseViewHolder>(R.layout.item_box_prize_record) {
|
||||
override fun convert(helper: BaseViewHolder, item: PrizeInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_prize_pic).load(item.prizeImgUrl)
|
||||
object : BaseQuickAdapter<BoxRuleItemInfo, BaseViewHolder>(R.layout.item_box_rule) {
|
||||
override fun convert(helper: BaseViewHolder, item: BoxRuleItemInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_prize_pic).load(item.prizeUrl)
|
||||
helper.setText(R.id.tv_prize_name, item.prizeName)
|
||||
.setText(R.id.tv_prize_num, "x${item.prizeNum}")
|
||||
.setText(R.id.tv_prize_time, format.format(item.createTime))
|
||||
.setText(R.id.tv_diamond, "${item.platformValue}")
|
||||
.setText(R.id.tv_probability, "${item.showRate}%")
|
||||
}
|
||||
}
|
||||
|
||||
rvDelegate = RVDelegate.Builder<PrizeInfo>()
|
||||
rvDelegate = RVDelegate.Builder<BoxRuleItemInfo>()
|
||||
.setAdapter(adapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无记录"))
|
||||
.setLayoutManager(LinearLayoutManager(mContext))
|
||||
.setRefreshLayout(binding.swipeRefresh)
|
||||
.setPageSize(pageSize)
|
||||
.build()
|
||||
|
||||
adapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
|
||||
|
||||
binding.swipeRefresh.setOnRefreshListener {
|
||||
loadData(true)
|
||||
loadData()
|
||||
}
|
||||
loadData(true)
|
||||
loadData()
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun loadData(isRefresh: Boolean) {
|
||||
binding.swipeRefresh.isRefreshing = isRefresh
|
||||
|
||||
if (isRefresh) {
|
||||
page = 1
|
||||
} else {
|
||||
page++
|
||||
}
|
||||
|
||||
private fun loadData() {
|
||||
binding.swipeRefresh.isRefreshing = true
|
||||
BoxModel.get()
|
||||
.getPrizeRecord(page, pageSize, "time", AuthModel.get().currentUid)
|
||||
.openBoxRule
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
rvDelegate.loadData(it, isRefresh)
|
||||
rvDelegate.setNewData(it)
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
})
|
||||
|
@@ -1,132 +0,0 @@
|
||||
package com.mango.moshen.treasure_box.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.mango.moshen.R;
|
||||
import com.mango.moshen.ui.webview.DialogWebViewActivity;
|
||||
import com.mango.core.UriProvider;
|
||||
import com.mango.core.manager.AvRoomDataManager;
|
||||
import com.mango.core.statistic.StatisticManager;
|
||||
import com.mango.core.statistic.protocol.StatisticsProtocol;
|
||||
import com.mango.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
public class ChooseTreasureBoxDialogFragment extends DialogFragment implements View.OnClickListener {
|
||||
|
||||
private ConstraintLayout clBoxNormal, clBoxHonour;
|
||||
|
||||
private OnTreasureBoxChooseListener onTreasureBoxChooseListener;
|
||||
|
||||
private TextView tvOpenTime;
|
||||
|
||||
private String mOpenTime;
|
||||
|
||||
private TextView mTvOpenHonour;
|
||||
|
||||
public ChooseTreasureBoxDialogFragment(String openTime) {
|
||||
this.mOpenTime = openTime;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_choose_treasure_box_dialog, container);
|
||||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题
|
||||
if (getDialog().getWindow() != null) {
|
||||
getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent);// 透明
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
clBoxNormal = view.findViewById(R.id.cl_box_normal);
|
||||
clBoxHonour = view.findViewById(R.id.cl_box_honour);
|
||||
tvOpenTime = view.findViewById(R.id.tv_open_time);
|
||||
mTvOpenHonour = view.findViewById(R.id.tv_open_honour);
|
||||
view.findViewById(R.id.iv_close).setOnClickListener(this);
|
||||
clBoxNormal.setOnClickListener(this);
|
||||
tvOpenTime.setText("限时 "+ mOpenTime);
|
||||
// String mOpenTime = "11:10-02:00";
|
||||
int startTime = Integer.parseInt(mOpenTime.substring(0,mOpenTime.indexOf("-")).replace(":",""));
|
||||
int endTime = Integer.parseInt(mOpenTime.substring(mOpenTime.indexOf("-") + 1).replace(":",""));
|
||||
LogUtils.e("startTime"+startTime);
|
||||
LogUtils.e("endTime"+endTime);
|
||||
LogUtils.e("范围:"+TimeUtils.getTimeLimit(startTime,endTime));
|
||||
|
||||
mTvOpenHonour.setEnabled(TimeUtils.getTimeLimit(startTime,endTime));
|
||||
if (TimeUtils.getTimeLimit(startTime,endTime)){
|
||||
clBoxHonour.setOnClickListener(this);
|
||||
}
|
||||
view.findViewById(R.id.ll_get_key).setOnClickListener(v -> DialogWebViewActivity.start(getContext(), UriProvider.getBoxKey()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
if (getActivity() != null && getActivity().getWindowManager() != null
|
||||
&& dialog.getWindow() != null) {
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
dialog.getWindow().setGravity(Gravity.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.iv_close) {
|
||||
dismiss();
|
||||
} else if (id == R.id.cl_box_normal) {
|
||||
if (onTreasureBoxChooseListener != null) {
|
||||
if (AvRoomDataManager.get().isCpRoom()) {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_CP_ROOM_SMASHEGG_CHOOSE, "开始砸金蛋-陪伴房");
|
||||
} else {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_MP_ROOM_SMASHEGG_CHOOSE, "开始砸金蛋-多人房");
|
||||
}
|
||||
onTreasureBoxChooseListener.onBoxClick(0);
|
||||
}
|
||||
dismiss();
|
||||
} else if (id == R.id.cl_box_honour) {
|
||||
if (onTreasureBoxChooseListener != null) {
|
||||
if (AvRoomDataManager.get().isCpRoom()) {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_CP_ROOM_SMASHEGG_CHOOSE, "开始砸至尊蛋-陪伴房");
|
||||
} else {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_MP_ROOM_SMASHEGG_CHOOSE, "开始砸至尊蛋-多人房");
|
||||
}
|
||||
onTreasureBoxChooseListener.onBoxClick(1);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnTreasureBoxChooseListener {
|
||||
/**
|
||||
* @param type 选择的宝箱类型 0 黄金(原始) 1 钻石
|
||||
*/
|
||||
void onBoxClick(int type);
|
||||
}
|
||||
|
||||
public void setOnTreasureBoxChooseListener(OnTreasureBoxChooseListener onTreasureBoxChooseListener) {
|
||||
this.onTreasureBoxChooseListener = onTreasureBoxChooseListener;
|
||||
}
|
||||
}
|
@@ -3,9 +3,7 @@ package com.mango.moshen.treasure_box.widget;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.mango.core.DemoCache;
|
||||
import com.mango.core.initial.InitialModel;
|
||||
import com.mango.core.initial.bean.InitInfo;
|
||||
import com.mango.core.level.UserLevelVo;
|
||||
@@ -15,10 +13,6 @@ import com.mango.core.super_admin.util.SuperAdminUtil;
|
||||
import com.mango.core.user.UserModel;
|
||||
import com.mango.core.user.bean.UserInfo;
|
||||
import com.mango.moshen.treasure_box.activity.TreasureBoxActivity;
|
||||
import com.mango.moshen.treasure_box.activity.TreasureBoxHonourActivity;
|
||||
import com.mango.moshen.treasure_box.fragment.ChooseTreasureBoxDialogFragment;
|
||||
import com.mango.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.mango.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
@@ -33,12 +27,6 @@ public class GoldBoxHelper {
|
||||
.flatMap(boxInfo -> Single.just(!isShowBox(boxInfo.getOpenBoxSwitchLevelNo())));
|
||||
}
|
||||
|
||||
public static boolean isShowBox() {
|
||||
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
|
||||
if (initInfo == null) return false;
|
||||
return isShowBox(initInfo.getOpenBoxSwitchLevelNo());
|
||||
}
|
||||
|
||||
private static boolean isShowBox(int switchLevelNo) {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return false;
|
||||
@@ -60,31 +48,7 @@ public class GoldBoxHelper {
|
||||
|
||||
|
||||
public static void handleBoxClick(Context context) {
|
||||
String openTime = GoldBoxHelper.getBoxOpenTime();
|
||||
if (openTime == null || openTime.isEmpty()) {
|
||||
SingleToastUtil.showToast("数据加载中,请稍后再试!");
|
||||
return;
|
||||
}
|
||||
int startTime = Integer.parseInt(openTime.substring(0, openTime.indexOf("-")).replace(":", ""));
|
||||
int endTime = Integer.parseInt(openTime.substring(openTime.indexOf("-") + 1).replace(":", ""));
|
||||
|
||||
if (startTime != endTime && TimeUtils.getTimeLimit(startTime, endTime)) {
|
||||
ChooseTreasureBoxDialogFragment chooseTreasureBoxDialogFragment = new ChooseTreasureBoxDialogFragment(openTime);
|
||||
chooseTreasureBoxDialogFragment.setOnTreasureBoxChooseListener(type -> {
|
||||
if (type == 0) {// 幸运许愿池(默认)
|
||||
TreasureBoxActivity.start(context);
|
||||
} else if (type == 1) {// 梦幻许愿池
|
||||
TreasureBoxHonourActivity.start(context);
|
||||
}
|
||||
});
|
||||
chooseTreasureBoxDialogFragment.show(((FragmentActivity) context).getSupportFragmentManager(), "chooseTreasureBoxDialogFragment");
|
||||
} else {
|
||||
TreasureBoxActivity.start(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isShowDiamondBox() {
|
||||
return AvRoomDataManager.get().mBoxSwitchVo.isDiamondBoxSwitch();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -93,12 +57,6 @@ public class GoldBoxHelper {
|
||||
return AvRoomDataManager.get().mBoxSwitchVo.getOpenBoxIcon();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getBoxOpenTime() {
|
||||
if (AvRoomDataManager.get().mBoxSwitchVo == null) return null;
|
||||
return AvRoomDataManager.get().mBoxSwitchVo.getDiamondBoxOpenTime();
|
||||
}
|
||||
|
||||
public static boolean isShowRadish() {
|
||||
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 946 B |
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 820 B |
@@ -20,13 +20,13 @@
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="214dp"
|
||||
android:layout_height="337dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/treasure_box_bg_normal"
|
||||
android:onClick="@{click}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
|
@@ -1,254 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="android.view.View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click}">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/treasure_box_bg_normal"
|
||||
android:onClick="@{click}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="317:387"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.85" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/treasure_box_title"
|
||||
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:drawableStart="@drawable/treasure_box_rank"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="排行榜"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:padding="@dimen/dp_9"
|
||||
android:src="@drawable/icon_room_box_more_normal"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_diamond_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:drawableTop="@drawable/treasure_box_diamond"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="11sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_more"
|
||||
tools:text="200" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_key_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:drawableTop="@drawable/treasure_box_meteor"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_diamond_num"
|
||||
tools:text="200" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_box"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="45dp"
|
||||
android:onClick="@{click}"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||
app:layout_constraintWidth_percent="0.53"
|
||||
app:source="svga/diamond_box_bg.svga" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_anim"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_box"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_box"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_box"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_box" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_continuous_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="消耗10"
|
||||
android:textColor="#fff15fc3"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_continuous_open"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_continuous_open"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_continuous_open" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_continuous_open"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:drawableStart="@drawable/treasure_box_meteor"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="5dp"
|
||||
android:text="连续开启"
|
||||
android:textColor="#fff15fc3"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_continuous_num"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_box" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/treasure_box_sub"
|
||||
app:layout_constraintEnd_toStartOf="@id/edit_num"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_continuous_open" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="23dp"
|
||||
android:background="@color/white_transparent_12"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
android:maxLength="4"
|
||||
android:minWidth="40dp"
|
||||
android:text="1"
|
||||
android:textColor="#ffc33c98"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_sub"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_add"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_sub"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_sub" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/treasure_box_add"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/edit_num"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_sub" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_open"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_marginBottom="22dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/click_open_honour_box_selector"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_sub" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_prize_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_continuous_num"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_open"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="60dp"
|
||||
app:autoPlay="false"
|
||||
app:fillMode="Clear"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||
app:loopCount="1"
|
||||
app:source="svga/bubble_pack.svga"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_gift_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="60dp"
|
||||
app:autoPlay="false"
|
||||
app:fillMode="Clear"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_box"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_box"
|
||||
app:loopCount="1"
|
||||
app:source="svga/bubble_tran_bg.svga"
|
||||
tools:background="@color/white"
|
||||
tools:visibility="gone" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
@@ -19,24 +19,53 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_box_rule_start" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:text="通过许愿池许愿获得的礼物放到礼物包裹,点开礼物面板即可查看"
|
||||
android:textColor="#fff8cbff"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:drawableStart="@drawable/icon_box_rule_start"
|
||||
android:drawablePadding="2dp"
|
||||
android:text="每次许愿100%获得礼物"
|
||||
android:textColor="#fff8cbff"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="礼物概率:"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="2dp">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@@ -1,192 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical"
|
||||
tools:background="@color/black_transparent_80">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_box_normal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
app:layout_constraintEnd_toStartOf="@id/cl_box_honour"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/treasure_box_bg_normal"
|
||||
app:layout_constraintDimensionRatio="162:195"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_title"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="27dp"
|
||||
android:src="@drawable/treasure_box_title_normal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
app:source="svga/gold_box_bg.svga"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_open"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/choose_box_bg_normal"
|
||||
android:gravity="center"
|
||||
android:text="立即开启"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_box_honour"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cl_box_normal"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_honour"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/treasure_box_bg_normal"
|
||||
app:layout_constraintDimensionRatio="162:195"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_title_honour"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="27dp"
|
||||
android:src="@drawable/treasure_box_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
app:source="svga/diamond_box_bg.svga"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_title_honour" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_open_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#DDFFF8"
|
||||
android:text="限时"
|
||||
android:textSize="11dp"
|
||||
android:layout_marginBottom="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_open_honour"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_open_honour"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/selector_choose_box_bg"
|
||||
android:gravity="center"
|
||||
android:enabled="true"
|
||||
android:text="立即开启"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_get_key"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cl_box_honour">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="参与活动获得"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/treasure_box_meteor" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="流星>"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="37dp"
|
||||
android:src="@drawable/icon_dialog_treasure_box_close"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
70
app/src/module_treasure_box/res/layout/item_box_rule.xml
Normal file
70
app/src/module_treasure_box/res/layout/item_box_rule.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="38dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_pic"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:textColor="#F8CBFF"
|
||||
android:textSize="12sp"
|
||||
tools:text="哈哈哈哈" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_diamond"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableEnd="@drawable/treasure_box_diamond"
|
||||
android:drawablePadding="2dp"
|
||||
android:lines="1"
|
||||
android:textColor="#A466FF"
|
||||
android:textSize="9sp"
|
||||
tools:text="x12" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_probability"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textColor="#ff9966e4"
|
||||
android:textSize="10sp"
|
||||
tools:text="06-30 16:00" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="#33ededed" />
|
||||
|
||||
</FrameLayout>
|
@@ -0,0 +1,91 @@
|
||||
package com.mango.treasure_box.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BoxRuleItemInfo implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* prizeName :
|
||||
* prizeImgUrl :
|
||||
* prizeLevel : 1
|
||||
* drawTime : 11111
|
||||
*/
|
||||
|
||||
private String prizeName;
|
||||
private String prizeUrl;
|
||||
private int prizeLevel;
|
||||
private long createTime;
|
||||
private int keyNum;
|
||||
private int platformValue;
|
||||
private int prizeNum;
|
||||
private String showRate;
|
||||
|
||||
public BoxRuleItemInfo() {
|
||||
}
|
||||
|
||||
public int getPlatformValue() {
|
||||
return platformValue;
|
||||
}
|
||||
|
||||
public void setPlatformValue(int platformValue) {
|
||||
this.platformValue = platformValue;
|
||||
}
|
||||
|
||||
|
||||
public String getPrizeName() {
|
||||
return prizeName;
|
||||
}
|
||||
|
||||
public void setPrizeName(String prizeName) {
|
||||
this.prizeName = prizeName;
|
||||
}
|
||||
|
||||
public String getPrizeUrl() {
|
||||
return prizeUrl;
|
||||
}
|
||||
|
||||
public void setPrizeUrl(String prizeImgUrl) {
|
||||
this.prizeUrl = prizeImgUrl;
|
||||
}
|
||||
|
||||
public int getPrizeLevel() {
|
||||
return prizeLevel;
|
||||
}
|
||||
|
||||
public void setPrizeLevel(int prizeLevel) {
|
||||
this.prizeLevel = prizeLevel;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public int getPrizeNum() {
|
||||
return prizeNum;
|
||||
}
|
||||
|
||||
public void setPrizeNum(int prizeNum) {
|
||||
this.prizeNum = prizeNum;
|
||||
}
|
||||
|
||||
public int getKeyNum() {
|
||||
return keyNum;
|
||||
}
|
||||
|
||||
public void setKeyNum(int keyNum) {
|
||||
this.keyNum = keyNum;
|
||||
}
|
||||
|
||||
public String getShowRate() {
|
||||
return showRate;
|
||||
}
|
||||
|
||||
public void setShowRate(String showRate) {
|
||||
this.showRate = showRate;
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
package com.mango.treasure_box.model;
|
||||
|
||||
import com.mango.treasure_box.bean.BoxOpenStatusInfo;
|
||||
import com.mango.treasure_box.bean.BoxRuleItemInfo;
|
||||
import com.mango.treasure_box.bean.HonourBuyKeyResultInfo;
|
||||
import com.mango.treasure_box.bean.HonourKeyInfo;
|
||||
import com.mango.treasure_box.bean.OpenBoxHonourResult;
|
||||
@@ -85,6 +86,13 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<BoxRuleItemInfo>> getOpenBoxRule() {
|
||||
return api.getOpenBoxRule(2)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<KeyInfo> buyKey(int keyNum) {
|
||||
return api.buyKey(keyNum, AuthModel.get().getCurrentUid())
|
||||
@@ -169,6 +177,14 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
||||
@Query("sortType") String sortType,
|
||||
@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 中奖记录列表
|
||||
*
|
||||
* @return 中奖纪录列表
|
||||
*/
|
||||
@GET("box/getOpenBoxRule ")
|
||||
Single<ServiceResult<List<BoxRuleItemInfo>>> getOpenBoxRule(@Query("boxType") int boxType);
|
||||
|
||||
/**
|
||||
* 开宝箱
|
||||
*
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.mango.treasure_box.model;
|
||||
|
||||
import com.mango.treasure_box.bean.BoxOpenStatusInfo;
|
||||
import com.mango.treasure_box.bean.BoxRuleItemInfo;
|
||||
import com.mango.treasure_box.bean.HonourBuyKeyResultInfo;
|
||||
import com.mango.treasure_box.bean.HonourKeyInfo;
|
||||
import com.mango.treasure_box.bean.OpenBoxHonourResult;
|
||||
@@ -17,6 +18,9 @@ import io.reactivex.Single;
|
||||
|
||||
public interface IBoxModel extends IModel {
|
||||
|
||||
int BOX_TYPE_NORMAL = 1;// 普通蛋
|
||||
int BOX_TYPE_HONOUR = 2;// 至尊蛋
|
||||
|
||||
/**
|
||||
* 获取开箱子配置图片
|
||||
*
|
||||
@@ -31,7 +35,7 @@ public interface IBoxModel extends IModel {
|
||||
* @param sendMessage
|
||||
* @return
|
||||
*/
|
||||
Single<OpenBoxResult> openBox(int boxType,int keyNum, boolean sendMessage);
|
||||
Single<OpenBoxResult> openBox(int boxType, int keyNum, boolean sendMessage);
|
||||
|
||||
/**
|
||||
* 获取中奖记录
|
||||
@@ -47,6 +51,8 @@ public interface IBoxModel extends IModel {
|
||||
String sortType,
|
||||
long uid);
|
||||
|
||||
Single<List<BoxRuleItemInfo>> getOpenBoxRule();
|
||||
|
||||
/**
|
||||
* 购买钥匙
|
||||
*
|
||||
@@ -69,9 +75,6 @@ public interface IBoxModel extends IModel {
|
||||
*/
|
||||
Single<ServiceResult<List<PrizeInfo>>> getPrizes();
|
||||
|
||||
int BOX_TYPE_NORMAL = 1;// 普通蛋
|
||||
int BOX_TYPE_HONOUR = 2;// 至尊蛋
|
||||
|
||||
/**
|
||||
* 蛋开放状态
|
||||
*/
|
||||
|
Reference in New Issue
Block a user