feat : app-module_treasure_box
@@ -0,0 +1,122 @@
|
||||
package com.chwl.app.treasure_box.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.avroom.adapter.CommonVPAdapter;
|
||||
import com.chwl.app.base.BaseViewBindingActivity;
|
||||
import com.chwl.app.databinding.ActivityRoomBoxRankingBinding;
|
||||
import com.chwl.app.decoration.view.widgets.CarMagicIndicator;
|
||||
import com.chwl.app.room_chat.event.ClickRootViewEvent;
|
||||
import com.chwl.app.treasure_box.fragment.BoxRankingFragment;
|
||||
import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.manager.RoomEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BoxRankingActivity extends BaseViewBindingActivity<ActivityRoomBoxRankingBinding>
|
||||
implements CarMagicIndicator.OnItemSelectListener, View.OnClickListener {
|
||||
|
||||
public static final int TYPE_TODAY = 1;//今日
|
||||
public static final int TYPE_YESTERDAY = 2;//今日
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, BoxRankingActivity.class);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void init() {
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
binding.rootView.setOnClickListener(this);
|
||||
binding.viewpager.setOffscreenPageLimit(2);
|
||||
binding.viewpager.setAdapter(new CommonVPAdapter(getSupportFragmentManager(), getLifecycle(), getFragment()));
|
||||
binding.viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
onTabChanged(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
super.onPageScrollStateChanged(state);
|
||||
}
|
||||
});
|
||||
binding.tvTabToday.setOnClickListener(v -> {
|
||||
binding.viewpager.setCurrentItem(0);
|
||||
onTabChanged(0);
|
||||
});
|
||||
binding.tvTabYesterday.setOnClickListener(v -> {
|
||||
binding.viewpager.setCurrentItem(1);
|
||||
onTabChanged(1);
|
||||
});
|
||||
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
private void onTabChanged(int tabPosition) {
|
||||
if (tabPosition == 0) {
|
||||
binding.tvTabToday.setBackgroundResource(R.drawable.smash_eggs_rank_bg_tab_selected_left);
|
||||
binding.tvTabYesterday.setBackground(null);
|
||||
} else {
|
||||
binding.tvTabToday.setBackground(null);
|
||||
binding.tvTabYesterday.setBackgroundResource(R.drawable.smash_eggs_rank_bg_tab_selected_right);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private ArrayList<Fragment> getFragment() {
|
||||
ArrayList<Fragment> list = new ArrayList<>();
|
||||
list.add(BoxRankingFragment.newInstance(TYPE_TODAY));
|
||||
list.add(BoxRankingFragment.newInstance(TYPE_YESTERDAY));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
binding.viewpager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view.getId() == R.id.root_view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRootViewClicked(ClickRootViewEvent event) {
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,497 @@
|
||||
package com.chwl.app.treasure_box.activity;
|
||||
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL;
|
||||
|
||||
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.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseBindingActivity;
|
||||
import com.chwl.app.databinding.ActivityTreasureBoxBinding;
|
||||
import com.chwl.app.treasure_box.widget.dialog.BoxLoveLackDialog;
|
||||
import com.chwl.app.treasure_box.widget.dialog.BoxMoreDialog;
|
||||
import com.chwl.app.treasure_box.widget.dialog.BuyLoveDialog;
|
||||
import com.chwl.app.treasure_box.widget.dialog.TreasureBoxDialog;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.utils.KeyBoardUtils;
|
||||
import com.chwl.app.utils.UserUtils;
|
||||
import com.chwl.core.DemoCache;
|
||||
import com.chwl.core.bean.BaseProtocol;
|
||||
import com.chwl.core.exception.FailReasonException;
|
||||
import com.chwl.core.im.custom.bean.RoomLuckySeaAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean;
|
||||
import com.chwl.core.manager.AvRoomDataManager;
|
||||
import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.manager.RoomEvent;
|
||||
import com.chwl.core.pay.PayModel;
|
||||
import com.chwl.core.room.bean.FindLoveSwitchVo;
|
||||
import com.chwl.core.treasure_box.bean.PrizeNewInfo;
|
||||
import com.chwl.core.treasure_box.bean.UserTicketInfo;
|
||||
import com.chwl.core.treasure_box.model.BoxModel;
|
||||
import com.chwl.library.annatation.ActLayoutRes;
|
||||
import com.chwl.library.common.SpConstants;
|
||||
import com.chwl.library.common.util.SPUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.chwl.library.utils.TimeUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
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)
|
||||
public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBoxBinding> implements View.OnClickListener {
|
||||
|
||||
public static final int MAX_BUY_QUANTITY_LIMIT = 99999;
|
||||
|
||||
private final Runnable removeRunnable = () -> mBinding.llPrizeHint.removeAllViews();
|
||||
private ArrayList<PrizeNewInfo> cacheList = new ArrayList<>();
|
||||
private ArrayList<PrizeNewInfo> hintPrizeCacheList = new ArrayList<>();
|
||||
private int height;
|
||||
private int sendMessageSwitchLevel;
|
||||
|
||||
private int mNum = -1;
|
||||
|
||||
private UserTicketInfo userTicketInfo;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, TreasureBoxActivity.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, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
getWindow().setGravity(Gravity.BOTTOM);
|
||||
subscribeEvent();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void init() {
|
||||
mBinding.setClick(this);
|
||||
mBinding.view1.setOnClickListener(v -> setBoxPriceSelect(1));
|
||||
mBinding.view2.setOnClickListener(v -> setBoxPriceSelect(2));
|
||||
mBinding.view3.setOnClickListener(v -> setBoxPriceSelect(3));
|
||||
|
||||
mBinding.edInputNum.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
try {
|
||||
mNum = Integer.parseInt(s.toString());
|
||||
if (mNum > MAX_BUY_QUANTITY_LIMIT) {
|
||||
mNum = MAX_BUY_QUANTITY_LIMIT;
|
||||
mBinding.edInputNum.setText(String.valueOf(mNum));
|
||||
mBinding.edInputNum.setSelection(mBinding.edInputNum.getText().length());
|
||||
SingleToastUtil.showToast(getString(R.string.treasure_box_activity_treasureboxactivity_01, MAX_BUY_QUANTITY_LIMIT));
|
||||
}
|
||||
setBoxPriceSelect(0);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.tvBuy.setOnClickListener(v -> {
|
||||
if (userTicketInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mNum == -1) {
|
||||
toast(getString(R.string.please_select_or_enter_the_quantity_of_hearts_purchased));
|
||||
return;
|
||||
}
|
||||
|
||||
long date = SPUtils.getLong(SpConstants.BOX_BUY_LOVE, 0L);
|
||||
if (date != 0L) {
|
||||
if (TimeUtils.isToday(date)) {
|
||||
BoxModel.get()
|
||||
.buyTicket(mNum)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(throwable -> toast(throwable.getMessage()))
|
||||
.subscribe(userTicketInfo -> {
|
||||
ToastUtils.show(R.string.doSuccess);
|
||||
onTickerInfoUpdated(userTicketInfo);
|
||||
});
|
||||
} else {
|
||||
BuyLoveDialog.Companion.newInstance(mNum, (int) userTicketInfo.getTicketPrice() * mNum).show(this);
|
||||
}
|
||||
} else {
|
||||
BuyLoveDialog.Companion.newInstance(mNum, (int) userTicketInfo.getTicketPrice() * mNum).show(this);
|
||||
}
|
||||
});
|
||||
|
||||
loadUserTicket();
|
||||
loadKeyInfo();
|
||||
looperHintPrize();
|
||||
SVGAParser.Companion.shareParser()
|
||||
.decodeFromAssets("svga/smash_eggs_open.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
|
||||
mBinding.ivBoxOpen.setImageDrawable(drawable);
|
||||
mBinding.ivBoxOpen.startAnimation();
|
||||
mBinding.ivBoxOpen.stepToFrame(0, false);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void loadUserTicket() {
|
||||
BoxModel.get()
|
||||
.getUserTicket()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(userTicketInfo -> onTickerInfoUpdated(userTicketInfo));
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onTickerInfoUpdated(UserTicketInfo userTicketInfo) {
|
||||
this.userTicketInfo = userTicketInfo;
|
||||
mBinding.tvBoxNum.setText(String.valueOf(userTicketInfo.getTicketNum()));
|
||||
}
|
||||
|
||||
private void setBoxPriceSelect(int pos) {
|
||||
if (pos == 0) {
|
||||
mBinding.view1.setSelected(false);
|
||||
mBinding.view2.setSelected(false);
|
||||
mBinding.view3.setSelected(false);
|
||||
mBinding.tv1.setAlpha(0.6f);
|
||||
mBinding.tv2.setAlpha(0.6f);
|
||||
mBinding.tv3.setAlpha(0.6f);
|
||||
return;
|
||||
}
|
||||
|
||||
mBinding.edInputNum.setText(null);
|
||||
KeyBoardUtils.hideKeyBoard(this, mBinding.edInputNum);
|
||||
mBinding.edInputNum.clearFocus();
|
||||
|
||||
if (pos == 1) {
|
||||
mNum = 1;
|
||||
mBinding.view1.setSelected(true);
|
||||
mBinding.view2.setSelected(false);
|
||||
mBinding.view3.setSelected(false);
|
||||
mBinding.tv1.setAlpha(1f);
|
||||
mBinding.tv2.setAlpha(0.6f);
|
||||
mBinding.tv3.setAlpha(0.6f);
|
||||
} else if (pos == 2) {
|
||||
mNum = 10;
|
||||
mBinding.view1.setSelected(false);
|
||||
mBinding.view2.setSelected(true);
|
||||
mBinding.view3.setSelected(false);
|
||||
mBinding.tv1.setAlpha(0.6f);
|
||||
mBinding.tv2.setAlpha(1f);
|
||||
mBinding.tv3.setAlpha(0.6f);
|
||||
} else if (pos == 3) {
|
||||
mNum = 100;
|
||||
mBinding.view1.setSelected(false);
|
||||
mBinding.view2.setSelected(false);
|
||||
mBinding.view3.setSelected(true);
|
||||
mBinding.tv1.setAlpha(0.6f);
|
||||
mBinding.tv2.setAlpha(0.6f);
|
||||
mBinding.tv3.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"CheckResult", "ClickableViewAccessibility"})
|
||||
private void loadKeyInfo() {
|
||||
FindLoveSwitchVo findLoveSwitchVo = AvRoomDataManager.get().mFindLoveSwitchVo;
|
||||
if (findLoveSwitchVo == null) {
|
||||
return;
|
||||
}
|
||||
sendMessageSwitchLevel = findLoveSwitchVo.getSendMsgLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.layout_root:
|
||||
finish();
|
||||
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_box_1:
|
||||
openBox(1);
|
||||
break;
|
||||
case R.id.iv_box_2:
|
||||
openBox(10);
|
||||
break;
|
||||
case R.id.iv_box_3:
|
||||
openBox(100);
|
||||
break;
|
||||
case R.id.iv_box_4:
|
||||
openBox(200);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void openBox(int count) {
|
||||
if (count == 0) {
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.treasure_box_activity_treasureboxactivity_03));
|
||||
return;
|
||||
}
|
||||
if (count > Integer.parseInt(mBinding.tvBoxNum.getText().toString())) {
|
||||
if (userTicketInfo != null) {
|
||||
BoxLoveLackDialog.Companion.newInstance(count, (int) userTicketInfo.getTicketPrice()).show(context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
boolean sendMessage = (sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() < sendMessageSwitchLevel) || DemoCache.readNeedBoxMsg();
|
||||
setBoxEnable(false);
|
||||
mBinding.ivBoxOpen.startAnimation();
|
||||
long startTime = System.currentTimeMillis();
|
||||
BoxModel.get().openBoxDraw(count, sendMessage)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(throwable -> {
|
||||
setBoxEnable(true);
|
||||
if (throwable instanceof FailReasonException) {
|
||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
||||
if (failReasonException.getCode() == BoxModel.ERROR_CODE_DIAMOND) {
|
||||
TreasureBoxDialog.newInstance().show(this);
|
||||
} else {
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
}
|
||||
} else {
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
}
|
||||
})
|
||||
.toObservable()
|
||||
.delay(startTime - System.currentTimeMillis() + 300, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(openBoxResult -> {
|
||||
setBoxEnable(true);
|
||||
cacheList.addAll(openBoxResult);
|
||||
|
||||
if (userTicketInfo != null) {
|
||||
userTicketInfo.setTicketNum(userTicketInfo.getTicketNum() - count);
|
||||
mBinding.tvBoxNum.setText(String.valueOf(userTicketInfo.getTicketNum()));
|
||||
}
|
||||
loadUserTicket();
|
||||
|
||||
return Observable.fromIterable(openBoxResult);
|
||||
})
|
||||
.filter(prizeInfo -> prizeInfo.getLevel() > 2)
|
||||
.subscribe(prizeInfo -> {
|
||||
hintPrizeCacheList.add(prizeInfo);
|
||||
});
|
||||
}
|
||||
|
||||
private void setBoxEnable(boolean status) {
|
||||
mBinding.ivBox1.setEnabled(status);
|
||||
mBinding.ivBox2.setEnabled(status);
|
||||
mBinding.ivBox3.setEnabled(status);
|
||||
mBinding.ivBox4.setEnabled(status);
|
||||
}
|
||||
|
||||
@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(PrizeNewInfo prizeInfo) {
|
||||
mBinding.llPrizeHint.removeCallbacks(removeRunnable);
|
||||
mBinding.llPrizeHint.postDelayed(removeRunnable, 3000);
|
||||
LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.item_box_prize_hint, null);
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ScreenUtil.dip2px(21));
|
||||
layoutParams.setMargins(0, 0, 0, ScreenUtil.dip2px(5));
|
||||
linearLayout.setLayoutParams(layoutParams);
|
||||
linearLayout.setPadding(ScreenUtil.dip2px(10), 0, ScreenUtil.dip2px(10), 0);
|
||||
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();
|
||||
}
|
||||
|
||||
ImageLoadUtils.loadAvatar(prizeInfo.getPicUrl(), linearLayout.findViewById(R.id.iv_icon));
|
||||
((TextView) linearLayout.findViewById(R.id.tv_prize_name)).setText(prizeInfo.getRewardName());
|
||||
((TextView) linearLayout.findViewById(R.id.tv_diamond)).setText(String.valueOf(prizeInfo.getDiamonds()));
|
||||
((TextView) linearLayout.findViewById(R.id.tv_prize_num)).setText("x" + prizeInfo.getNum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新钱包
|
||||
*
|
||||
* @param g
|
||||
*/
|
||||
private void setGold(double 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:
|
||||
loadKeyInfo();
|
||||
setGold(roomEvent.getWalletInfo().getDiamondNum());
|
||||
break;
|
||||
case RoomEvent.KICK_OUT_ROOM:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收到全局广播信息
|
||||
*
|
||||
* @param body 信息实体
|
||||
*/
|
||||
protected void onReceivedNimBroadcastMessage(String body) {
|
||||
BaseProtocol baseProtocol;
|
||||
try {
|
||||
baseProtocol = JSON.parseObject(body, BaseProtocol.class);
|
||||
} catch (Exception e) {
|
||||
baseProtocol = null;
|
||||
}
|
||||
if (baseProtocol == null) return;
|
||||
switch (baseProtocol.getFirst()) {
|
||||
// case CUSTOM_MSG_BOX://寻爱之旅
|
||||
// if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
// RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
// RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
// roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
||||
// roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
||||
// roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
||||
// roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
||||
// roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
||||
// roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
||||
// roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
||||
// if (AvRoomDataManager.get().isOpenPureMode()) {
|
||||
// // 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
// if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// }
|
||||
// } else {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
// .onNext(new RoomEvent()
|
||||
// .setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
||||
// .setChatRoomMessage(message));
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CUSTOM_MSG_LUCKY_SEA://星级厨房
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
||||
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
|
||||
attachment.setRoomLuckySeaMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class));
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_TEMPLATE_NOTIFY://通用飘屏
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_TEMPLATE_NOTIFY_ALL) {
|
||||
//xxx 通用飘屏
|
||||
RoomTemplateNotifyAttachment attachment = new RoomTemplateNotifyAttachment(CUSTOM_MSG_TEMPLATE_NOTIFY, CUSTOM_MSG_TEMPLATE_NOTIFY_ALL);
|
||||
attachment.setMsgBean(new Gson().fromJson(String.valueOf(baseProtocol.getData()), RoomTemplateNotifyMsgBean.class));
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
||||
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.TEMPLATE_NOTIFY);
|
||||
}
|
||||
break;
|
||||
// case CUSTOM_MSG_LUCKY_GIFT://福袋
|
||||
// if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
|
||||
// RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
|
||||
// attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class));
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
||||
// IMNetEaseManager.get().noticeServiceLuckyBagNotice(message);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
super.setStatusBar();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
StatusBarUtil.StatusBarLightMode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
@@ -0,0 +1,316 @@
|
||||
package com.chwl.app.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.chwl.core.utils.StringFormatUtils;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseBindingActivity;
|
||||
import com.chwl.app.databinding.ActivityTreasureBoxHonourBinding;
|
||||
import com.chwl.app.treasure_box.widget.dialog.BoxMoreDialog;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||
import com.chwl.core.treasure_box.bean.PrizeInfo;
|
||||
import com.chwl.core.treasure_box.model.BoxModel;
|
||||
import com.chwl.core.treasure_box.model.IBoxModel;
|
||||
import com.chwl.core.DemoCache;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.manager.RoomEvent;
|
||||
import com.chwl.core.pay.PayModel;
|
||||
import com.chwl.core.pay.bean.WalletInfo;
|
||||
import com.chwl.library.annatation.ActLayoutRes;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.chwl.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 = StringFormatUtils.toInt(mBinding.editNum.getText().toString(), 0);
|
||||
mBinding.tvContinuousNum.setText(ResUtil.getString(R.string.treasure_box_activity_treasureboxhonouractivity_01) + num * 10);
|
||||
}
|
||||
});
|
||||
loadKeyInfo();
|
||||
looperPrize();
|
||||
looperHintPrize();
|
||||
}
|
||||
|
||||
@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(StringFormatUtils.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(StringFormatUtils.toInt(mBinding.editNum.getText().toString(), 0) - 1, 1)));
|
||||
break;
|
||||
case R.id.iv_add:
|
||||
mBinding.editNum.setText(String.valueOf(Math.min((StringFormatUtils.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(ResUtil.getString(R.string.treasure_box_activity_treasureboxhonouractivity_02));
|
||||
return true;
|
||||
}
|
||||
if (keyNum < count) {
|
||||
getDialogManager().showOkCancelDialog(ResUtil.getString(R.string.treasure_box_activity_treasureboxhonouractivity_03), ResUtil.getString(R.string.treasure_box_activity_treasureboxhonouractivity_04),
|
||||
() -> 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:
|
||||
loadKeyInfo();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.chwl.app.treasure_box.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.utils.ImageLoadKt;
|
||||
import com.chwl.core.room.treasure_box.bean.TreasureRankingInfo;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/16
|
||||
*/
|
||||
|
||||
public class BoxRankingListAdapter extends BaseQuickAdapter<TreasureRankingInfo, com.chad.library.adapter.base.BaseViewHolder> {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public BoxRankingListAdapter(Context context) {
|
||||
super(R.layout.box_ranking_list_item);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void convert(@NonNull com.chad.library.adapter.base.BaseViewHolder baseViewHolder, final TreasureRankingInfo rankVosBeans) {
|
||||
if (rankVosBeans == null) return;
|
||||
|
||||
baseViewHolder.setText(R.id.tv_userName, rankVosBeans.getNick()).setText(R.id.tv_amount, rankVosBeans.getDiamonds() + "");
|
||||
ImageLoadKt.loadAvatar(baseViewHolder.getView(R.id.iv_avatar), rankVosBeans.getAvatar());
|
||||
TextView tvPosition = baseViewHolder.getView(R.id.tv_position);
|
||||
ImageView ivPosition = baseViewHolder.getView(R.id.iv_position);
|
||||
switch (baseViewHolder.getLayoutPosition()) {
|
||||
case 0:
|
||||
tvPosition.setVisibility(View.GONE);
|
||||
ivPosition.setVisibility(View.VISIBLE);
|
||||
ivPosition.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.smash_eggs_rank_top1));
|
||||
break;
|
||||
case 1:
|
||||
tvPosition.setVisibility(View.GONE);
|
||||
ivPosition.setVisibility(View.VISIBLE);
|
||||
ivPosition.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.smash_eggs_rank_top2));
|
||||
break;
|
||||
case 2:
|
||||
tvPosition.setVisibility(View.GONE);
|
||||
ivPosition.setVisibility(View.VISIBLE);
|
||||
ivPosition.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.smash_eggs_rank_top3));
|
||||
break;
|
||||
default:
|
||||
tvPosition.setVisibility(View.VISIBLE);
|
||||
ivPosition.setVisibility(View.GONE);
|
||||
tvPosition.setText(baseViewHolder.getLayoutPosition() + 1 + "");
|
||||
break;
|
||||
}
|
||||
baseViewHolder.addOnClickListener(R.id.iv_avatar);
|
||||
}
|
||||
}
|
@@ -0,0 +1,207 @@
|
||||
package com.chwl.app.treasure_box.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpFragment;
|
||||
import com.chwl.app.common.NoDataFragment;
|
||||
import com.chwl.app.treasure_box.adapter.BoxRankingListAdapter;
|
||||
import com.chwl.app.treasure_box.module.IBoxRankingView;
|
||||
import com.chwl.app.treasure_box.presenter.BoxRankingPresenter;
|
||||
import com.chwl.app.treasure_box.widget.BoxRankLoadMoreView;
|
||||
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.HorizontalDecoration;
|
||||
import com.chwl.core.room.treasure_box.bean.TreasureRankingInfo;
|
||||
import com.chwl.core.room.treasure_box.event.RefreshBoxRankingEvent;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 房间内寻爱排行榜
|
||||
*
|
||||
* @author MadisonRong RoomNewbieListFragment
|
||||
*/
|
||||
@CreatePresenter(BoxRankingPresenter.class)
|
||||
public class BoxRankingFragment extends BaseMvpFragment<IBoxRankingView, BoxRankingPresenter> implements IBoxRankingView, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
private RecyclerView recyclerView;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private BoxRankingListAdapter mAdapter;
|
||||
private int datetype;
|
||||
|
||||
private boolean isInitiated = false;
|
||||
public static BoxRankingFragment newInstance(int datetype) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("datetype", datetype);
|
||||
BoxRankingFragment fragment = new BoxRankingFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
if (getArguments() != null) {
|
||||
datetype = getArguments().getInt("datetype");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_newbie_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
recyclerView = mView.findViewById(R.id.recycler_view);
|
||||
swipeRefresh = mView.findViewById(R.id.swipe_refresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
swipeRefresh.setOnRefreshListener(() -> {
|
||||
mAdapter.setEnableLoadMore(true);
|
||||
loadData(true, datetype);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
initRecyclerView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if(!isInitiated){
|
||||
loadData(true, datetype);
|
||||
}
|
||||
isInitiated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void loadData(boolean isRefresh, int datetype) {
|
||||
getMvpPresenter().loadData(isRefresh, datetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.OnClickListener getLoadMoreListener() {
|
||||
return super.getLoadMoreListener();
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerView.setItemAnimator(null);
|
||||
recyclerView.addItemDecoration(new HorizontalDecoration(UIUtil.dip2px(mContext, 8), false, false));
|
||||
mAdapter = new BoxRankingListAdapter(mContext);
|
||||
mAdapter.setLoadMoreView(new BoxRankLoadMoreView());
|
||||
mAdapter.setOnLoadMoreListener(this, recyclerView);
|
||||
mAdapter.setOnItemChildClickListener((adapter, view, position) -> UserInfoActivity.Companion.start(mContext, mAdapter.getData().get(position).getUid()));
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getBoxRankingSuccess(List<TreasureRankingInfo> rankingInfo) {
|
||||
hideStatus();
|
||||
if (mAdapter != null) {
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
|
||||
if (rankingInfo == null || rankingInfo.size() == 0) {
|
||||
showNoData(getString(R.string.empty_data));
|
||||
} else {
|
||||
mAdapter.setNewData(rankingInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNoData(View view, int drawable, CharSequence charSequence) {
|
||||
if (!checkActivityValid())
|
||||
return;
|
||||
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
View status = view.findViewById(R.id.status_layout);
|
||||
if (status == null || status.getId() == View.NO_ID) {
|
||||
return;
|
||||
}
|
||||
NoDataFragment fragment = NoDataFragment.newInstance(R.layout.fragment_box_rank_no_data, drawable, charSequence);
|
||||
fragment.setListener(getLoadListener());
|
||||
getChildFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxRankingFails(String error) {
|
||||
hideStatus();
|
||||
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
showNoData(getString(R.string.empty_data));
|
||||
}
|
||||
mAdapter.loadMoreEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxRankingLoadMoreSuccess(List<TreasureRankingInfo> rankingInfo) {
|
||||
if (ListUtils.isListEmpty(rankingInfo)) {
|
||||
mAdapter.loadMoreEnd();
|
||||
return;
|
||||
}
|
||||
mAdapter.addData(rankingInfo);
|
||||
mAdapter.loadMoreComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxRankingLoadMoreFails(String error) {
|
||||
hideStatus();
|
||||
int page = getMvpPresenter().getPage();
|
||||
if (page <= 1) {
|
||||
showNoData(getString(R.string.empty_data));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
super.onReloadData();
|
||||
loadData(true, datetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
loadData(false, datetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRefreshRanking(RefreshBoxRankingEvent event) {
|
||||
loadData(true, datetype);
|
||||
}
|
||||
}
|
@@ -0,0 +1,120 @@
|
||||
package com.chwl.app.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.chwl.app.R;
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.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(ResUtil.getString(R.string.treasure_box_fragment_choosetreasureboxdialogfragment_01) + 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(ResUtil.getString(R.string.treasure_box_fragment_choosetreasureboxdialogfragment_02) + 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) {
|
||||
onTreasureBoxChooseListener.onBoxClick(0);
|
||||
}
|
||||
dismiss();
|
||||
} else if (id == R.id.cl_box_honour) {
|
||||
if (onTreasureBoxChooseListener != null) {
|
||||
onTreasureBoxChooseListener.onBoxClick(1);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnTreasureBoxChooseListener {
|
||||
/**
|
||||
* @param type 选择的宝箱类型 0 黄金(原始) 1 钻石
|
||||
*/
|
||||
void onBoxClick(int type);
|
||||
}
|
||||
|
||||
public void setOnTreasureBoxChooseListener(OnTreasureBoxChooseListener onTreasureBoxChooseListener) {
|
||||
this.onTreasureBoxChooseListener = onTreasureBoxChooseListener;
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.chwl.app.treasure_box.module;
|
||||
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.bean.response.ServiceResult;
|
||||
import com.chwl.core.community.CommunityConstant;
|
||||
import com.chwl.core.room.treasure_box.bean.TreasureRankingInfo;
|
||||
import com.chwl.core.utils.net.RxHelper;
|
||||
import com.chwl.library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class BoxRankingModel {
|
||||
|
||||
private final Api api = RxNet.create(Api.class);
|
||||
|
||||
public Single<List<TreasureRankingInfo>> getBoxRankingList(int datetype,int page,int pageSize) {
|
||||
return api.apiNewbieList(String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
CommunityConstant.VERSION_VALID_TYPE,
|
||||
AuthModel.get().getTicket(),
|
||||
datetype,
|
||||
page,
|
||||
pageSize)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
private static final class Helper {
|
||||
public static final BoxRankingModel INSTANCE = new BoxRankingModel();
|
||||
}
|
||||
|
||||
public static BoxRankingModel get() {
|
||||
return BoxRankingModel.Helper.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@GET("/findLove/rank")
|
||||
Single<ServiceResult<List<TreasureRankingInfo>>> apiNewbieList(
|
||||
@Query("uid") String uid,
|
||||
@Query("types") String types,
|
||||
@Query("ticket") String ticket,
|
||||
@Query("type") int type,
|
||||
@Query("page") int page,
|
||||
@Query("pageSize") int pageSize);
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.chwl.app.treasure_box.module;
|
||||
|
||||
import com.chwl.core.room.treasure_box.bean.TreasureRankingInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IBoxRankingView extends IMvpBaseView {
|
||||
void getBoxRankingSuccess(List<TreasureRankingInfo> list);
|
||||
void getBoxRankingFails(String error);
|
||||
void getBoxRankingLoadMoreSuccess(List<TreasureRankingInfo> list);
|
||||
void getBoxRankingLoadMoreFails(String error);
|
||||
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package com.chwl.app.treasure_box.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.treasure_box.module.BoxRankingModel;
|
||||
import com.chwl.app.treasure_box.module.IBoxRankingView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.room.treasure_box.bean.BoxRankingInfo;
|
||||
import com.chwl.core.room.treasure_box.bean.TreasureRankingInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class BoxRankingPresenter extends BaseMvpPresenter<IBoxRankingView> {
|
||||
|
||||
private int page = 0;
|
||||
|
||||
public void loadData(boolean isRefresh,int datetype) {
|
||||
if (isRefresh) {
|
||||
page = 1;
|
||||
} else {
|
||||
page++;
|
||||
}
|
||||
|
||||
BoxRankingModel.get().getBoxRankingList(datetype,page, Constants.PAGE_SIZE)
|
||||
.compose(bindToLifecycle()).subscribe(new SingleObserver<List<TreasureRankingInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<TreasureRankingInfo> roomNewbieInfos) {
|
||||
if (roomNewbieInfos != null) {
|
||||
if (mMvpView != null) {
|
||||
if (isRefresh){
|
||||
mMvpView.getBoxRankingSuccess(roomNewbieInfos);
|
||||
}else {
|
||||
mMvpView.getBoxRankingLoadMoreSuccess(roomNewbieInfos);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mMvpView != null) {
|
||||
if (isRefresh){
|
||||
mMvpView.getBoxRankingFails(ResUtil.getString(R.string.treasure_box_presenter_boxrankingpresenter_01));
|
||||
}else {
|
||||
mMvpView.getBoxRankingLoadMoreFails(ResUtil.getString(R.string.treasure_box_presenter_boxrankingpresenter_02));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (mMvpView != null) {
|
||||
mMvpView.getBoxRankingFails(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.chwl.app.treasure_box.widget;
|
||||
|
||||
import com.chad.library.adapter.base.loadmore.LoadMoreView;
|
||||
import com.chwl.app.R;
|
||||
|
||||
public final class BoxRankLoadMoreView extends LoadMoreView {
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.box_rank_view_load_more;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLoadingViewId() {
|
||||
return R.id.load_more_loading_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLoadFailViewId() {
|
||||
return R.id.load_more_load_fail_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLoadEndViewId() {
|
||||
return R.id.load_more_load_end_view;
|
||||
}
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
package com.chwl.app.treasure_box.widget;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.treasure_box.activity.TreasureBoxActivity;
|
||||
import com.chwl.app.treasure_box.activity.TreasureBoxHonourActivity;
|
||||
import com.chwl.app.treasure_box.fragment.ChooseTreasureBoxDialogFragment;
|
||||
import com.chwl.core.initial.InitialModel;
|
||||
import com.chwl.core.initial.bean.FairyOpenInfo;
|
||||
import com.chwl.core.initial.bean.InitInfo;
|
||||
import com.chwl.core.manager.AvRoomDataManager;
|
||||
import com.chwl.core.user.UserModel;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.chwl.library.utils.TimeUtils;
|
||||
|
||||
|
||||
public class GoldBoxHelper {
|
||||
public static void handleBoxClick(Context context) {
|
||||
String openTime = GoldBoxHelper.getBoxOpenTime();
|
||||
if (openTime == null || openTime.isEmpty()) {
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.treasure_box_widget_goldboxhelper_01));
|
||||
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
|
||||
public static String getBoxIcon() {
|
||||
if (AvRoomDataManager.get().mBoxSwitchVo == null) return null;
|
||||
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();
|
||||
if (initInfo == null || userInfo == null) return false;
|
||||
return userInfo.getUserLevelVo().getExperLevelSeq() >= initInfo.getLinearlyPoolOpenLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 屏幕宽高比小于2的机型房间活动入口和开箱入口整合,个播房不需要整合
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static boolean needIntegrateBoxEntrance() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isShowFairy() {
|
||||
FairyOpenInfo fairyOpenInfo = InitialModel.get().getFairyOpenInfo();
|
||||
if (fairyOpenInfo == null) return false;
|
||||
return fairyOpenInfo.isOpen();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
package com.chwl.app.treasure_box.widget.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.base.BaseDialogFragment
|
||||
import com.chwl.app.databinding.TreasureBoxDialogLoveLackBinding
|
||||
import com.chwl.app.treasure_box.activity.TreasureBoxActivity.MAX_BUY_QUANTITY_LIMIT
|
||||
import com.chwl.app.treasure_box.widget.dialog.TreasureBoxDialog.Companion.newInstance
|
||||
import com.chwl.core.exception.FailReasonException
|
||||
import com.chwl.core.treasure_box.bean.UserTicketInfo
|
||||
import com.chwl.core.treasure_box.model.BoxModel
|
||||
import com.chwl.core.utils.StringFormatUtils
|
||||
import com.chwl.library.common.SpConstants
|
||||
import com.chwl.library.common.util.SPUtils
|
||||
import com.chwl.library.common.util.SoftKeyboardStateHelper
|
||||
import com.chwl.library.common.util.SoftKeyboardStateHelper.SoftKeyboardStateListener
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import com.chwl.library.utils.TextWatcherWrapper
|
||||
import com.chwl.library.utils.TimeUtils
|
||||
import com.hjq.toast.ToastUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 购买碎片
|
||||
*/
|
||||
class BoxLoveLackDialog : BaseDialogFragment<TreasureBoxDialogLoveLackBinding>() {
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.CENTER
|
||||
|
||||
private var num: Int = 0
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(num: Int, ticketPrice: Int): BoxLoveLackDialog {
|
||||
val args = Bundle()
|
||||
args.putInt("num", num)
|
||||
args.putInt("ticketPrice", ticketPrice)
|
||||
val fragment = BoxLoveLackDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val ticketPrice by lazy { requireArguments().getInt("ticketPrice") }
|
||||
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
override fun init() {
|
||||
num = requireArguments().getInt("num")
|
||||
|
||||
binding.editNum.setText(num.toString())
|
||||
binding.tvPrizeName.text = (num * ticketPrice).toString()
|
||||
|
||||
binding.ivSub.setOnClickListener {
|
||||
val editNum =
|
||||
(StringFormatUtils.toInt(binding.editNum.text.toString(), 0) - 10).coerceAtLeast(1)
|
||||
binding.editNum.setText(editNum.toString())
|
||||
binding.tvPrizeName.text = (editNum * ticketPrice).toString()
|
||||
}
|
||||
|
||||
binding.ivAdd.setOnClickListener {
|
||||
val editNum =
|
||||
(StringFormatUtils.toInt(binding.editNum.text.toString(), 0) + 10).coerceAtMost(
|
||||
MAX_BUY_QUANTITY_LIMIT
|
||||
)
|
||||
binding.editNum.setText(editNum.toString())
|
||||
binding.tvPrizeName.text = (editNum * ticketPrice).toString()
|
||||
}
|
||||
|
||||
binding.ivClose.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
binding.tvBuy.setOnClickListener {
|
||||
BoxModel.get()
|
||||
.buyTicket(num)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError { dealError(it) }
|
||||
.subscribe { userTicketInfo: UserTicketInfo ->
|
||||
EventBus.getDefault().post(userTicketInfo)
|
||||
dismissAllowingStateLoss()
|
||||
val date = SPUtils.getLong(SpConstants.BOX_BUY_SUCCESS, 0L)
|
||||
if (TimeUtils.isToday(date)) {
|
||||
ToastUtils.show(R.string.doSuccess)
|
||||
return@subscribe
|
||||
}
|
||||
BuyLoveSuccessDialog.newInstance(num).show(context)
|
||||
}
|
||||
}
|
||||
|
||||
binding.editNum.addTextChangedListener(object : TextWatcherWrapper() {
|
||||
override fun afterTextChanged(editable: Editable) {
|
||||
var n = StringFormatUtils.toInt(binding.editNum.text.toString(), 0)
|
||||
if (n > MAX_BUY_QUANTITY_LIMIT) {
|
||||
n = MAX_BUY_QUANTITY_LIMIT
|
||||
binding.editNum.setText(n.toString())
|
||||
binding.editNum.setSelection(3)
|
||||
SingleToastUtil.showToast(
|
||||
getString(
|
||||
R.string.treasure_box_activity_treasureboxactivity_01,
|
||||
MAX_BUY_QUANTITY_LIMIT
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.tvPrizeName.text = (n * ticketPrice).toString()
|
||||
num = n
|
||||
}
|
||||
})
|
||||
|
||||
SoftKeyboardStateHelper(binding.editNum).addSoftKeyboardStateListener(object :
|
||||
SoftKeyboardStateListener {
|
||||
override fun onSoftKeyboardOpened(keyboardHeightInPx: Int) {}
|
||||
override fun onSoftKeyboardClosed() {
|
||||
val num = StringFormatUtils.toInt(binding.editNum.text.toString(), 0)
|
||||
if (num == 0) {
|
||||
binding.editNum.setText("1")
|
||||
binding.editNum.setSelection(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun dealError(error: Throwable) {
|
||||
if (error is FailReasonException) {
|
||||
if (error.code == BoxModel.ERROR_CODE_DIAMOND) {
|
||||
newInstance().show(context)
|
||||
} else {
|
||||
SingleToastUtil.showToast(error.message)
|
||||
}
|
||||
} else {
|
||||
SingleToastUtil.showToast(error.message)
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package com.chwl.app.treasure_box.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseBindingDialog;
|
||||
import com.chwl.app.databinding.DialogBoxMoreBinding;
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||
import com.chwl.app.utils.UserUtils;
|
||||
import com.chwl.core.DemoCache;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.library.annatation.ActLayoutRes;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
@ActLayoutRes(R.layout.dialog_box_more)
|
||||
public class BoxMoreDialog extends BaseBindingDialog<DialogBoxMoreBinding> {
|
||||
|
||||
private int sendMessageSwitchLevel;
|
||||
|
||||
public BoxMoreDialog(Context context, int sendMessageSwitchLevel) {
|
||||
super(context);
|
||||
width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
this.sendMessageSwitchLevel = sendMessageSwitchLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
WindowManager.LayoutParams windowParams = window.getAttributes();
|
||||
windowParams.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(windowParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
binding.tvHistory.setOnClickListener(v -> {
|
||||
DialogWebViewActivity.start(context, UriProvider.getBoxHistory(), false);
|
||||
closeDialog();
|
||||
});
|
||||
binding.tvBoxRule.setOnClickListener(v -> {
|
||||
DialogWebViewActivity.start(context, UriProvider.getBoxHelp(), false);
|
||||
closeDialog();
|
||||
});
|
||||
|
||||
boolean canSwitch = sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() >= sendMessageSwitchLevel;
|
||||
|
||||
updateMsgSwitch(canSwitch && DemoCache.readNeedBoxMsg());
|
||||
binding.ivSwitch.setOnClickListener(v -> {
|
||||
if (canSwitch) {
|
||||
boolean sendMsg = !DemoCache.readNeedBoxMsg();
|
||||
updateMsgSwitch(sendMsg);
|
||||
DemoCache.saveNeedBoxMsg(sendMsg);
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.widget_dialog_boxmoredialog_01));
|
||||
} else {
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.widget_dialog_boxmoredialog_02) + sendMessageSwitchLevel + ResUtil.getString(R.string.widget_dialog_boxmoredialog_03));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateMsgSwitch(boolean sendMsg) {
|
||||
binding.ivSwitch.setImageResource(sendMsg ?
|
||||
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
|
||||
}
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package com.chwl.app.treasure_box.widget.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.base.BaseDialogFragment
|
||||
import com.chwl.app.databinding.TreasureBoxDialogBuyLoveBinding
|
||||
import com.chwl.core.exception.FailReasonException
|
||||
import com.chwl.core.treasure_box.bean.UserTicketInfo
|
||||
import com.chwl.core.treasure_box.model.BoxModel
|
||||
import com.chwl.library.common.SpConstants
|
||||
import com.chwl.library.common.util.SPUtils
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import com.chwl.library.utils.TimeUtils
|
||||
import com.hjq.toast.ToastUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 购买爱心
|
||||
*/
|
||||
class BuyLoveDialog : BaseDialogFragment<TreasureBoxDialogBuyLoveBinding>() {
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.CENTER
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(num: Int, ticketPrice: Int): BuyLoveDialog {
|
||||
val args = Bundle()
|
||||
args.putInt("num", num)
|
||||
args.putInt("ticketPrice", ticketPrice)
|
||||
val fragment = BuyLoveDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val num by lazy { requireArguments().getInt("num") }
|
||||
private val ticketPrice by lazy { requireArguments().getInt("ticketPrice") }
|
||||
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
override fun init() {
|
||||
binding?.tvLackLove?.text = getString(R.string.buy_love_num, num)
|
||||
binding?.tvPrizeName?.text = ticketPrice.toString()
|
||||
|
||||
binding?.cbPay?.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
SPUtils.putLong(SpConstants.BOX_BUY_LOVE, System.currentTimeMillis())
|
||||
} else {
|
||||
SPUtils.putLong(SpConstants.BOX_BUY_LOVE, 0L)
|
||||
}
|
||||
}
|
||||
|
||||
binding?.ivClose?.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
binding?.tvBuy?.setOnClickListener {
|
||||
val date = SPUtils.getLong(SpConstants.BOX_BUY_SUCCESS, 0L)
|
||||
if (TimeUtils.isToday(date)) {
|
||||
BoxModel.get()
|
||||
.buyTicket(num)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError { dealError(it) }
|
||||
.subscribe { userTicketInfo: UserTicketInfo ->
|
||||
ToastUtils.show(R.string.doSuccess)
|
||||
dismissAllowingStateLoss()
|
||||
EventBus.getDefault().post(userTicketInfo)
|
||||
}
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
BoxModel.get()
|
||||
.buyTicket(num)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError { dealError(it) }
|
||||
.subscribe { userTicketInfo: UserTicketInfo ->
|
||||
BuyLoveSuccessDialog.newInstance(num).show(context)
|
||||
dismissAllowingStateLoss()
|
||||
EventBus.getDefault().post(userTicketInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun dealError(error: Throwable) {
|
||||
if (error is FailReasonException) {
|
||||
if (error.code == BoxModel.ERROR_CODE_DIAMOND) {
|
||||
TreasureBoxDialog.newInstance().show(context)
|
||||
} else {
|
||||
SingleToastUtil.showToast(error.message)
|
||||
}
|
||||
} else {
|
||||
SingleToastUtil.showToast(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package com.chwl.app.treasure_box.widget.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import com.chwl.app.base.BaseDialogFragment
|
||||
import com.chwl.app.databinding.TreasureBoxDialogBuyLoveSuccessBinding
|
||||
import com.chwl.library.common.SpConstants
|
||||
import com.chwl.library.common.util.SPUtils
|
||||
|
||||
/**
|
||||
* 购买爱心
|
||||
*/
|
||||
class BuyLoveSuccessDialog : BaseDialogFragment<TreasureBoxDialogBuyLoveSuccessBinding>() {
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.CENTER
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(num: Int): BuyLoveSuccessDialog {
|
||||
val args = Bundle()
|
||||
args.putInt("num", num)
|
||||
val fragment = BuyLoveSuccessDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val num by lazy { requireArguments().getInt("num") }
|
||||
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
override fun init() {
|
||||
binding?.tvPrizeName?.text = "x${num}"
|
||||
|
||||
binding?.cbPay?.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
SPUtils.putLong(SpConstants.BOX_BUY_SUCCESS, System.currentTimeMillis())
|
||||
} else {
|
||||
SPUtils.putLong(SpConstants.BOX_BUY_SUCCESS, 0L)
|
||||
}
|
||||
}
|
||||
|
||||
binding?.ivClose?.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.chwl.app.treasure_box.widget.dialog
|
||||
|
||||
import com.chwl.app.base.BaseDialogFragment
|
||||
import com.chwl.app.databinding.DialogTreasureBoxBinding
|
||||
import com.chwl.app.ui.pay.ChargeActivity
|
||||
|
||||
/**
|
||||
* author: wushaocheng
|
||||
* time: 2023/3/23
|
||||
* desc: 寻爱钻石不足提示
|
||||
*/
|
||||
class TreasureBoxDialog : BaseDialogFragment<DialogTreasureBoxBinding>() {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(): TreasureBoxDialog {
|
||||
return TreasureBoxDialog()
|
||||
}
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
binding?.tvCharge?.setOnClickListener {
|
||||
ChargeActivity.start(context)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 858 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 884 B |
After Width: | Height: | Size: 612 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 662 B |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 842 B |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/smash_eggs_buy_bg_hammer" />
|
||||
|
||||
<item
|
||||
android:bottom="11dp"
|
||||
android:drawable="@drawable/smash_eggs_buy_ic_hammer"
|
||||
android:left="11dp"
|
||||
android:right="11dp"
|
||||
android:top="11dp" />
|
||||
</layer-list>
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="0.5dp"
|
||||
android:color="#99ffcdfc" />
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:startColor="#ff934aee"
|
||||
android:endColor="#ff2e2b99"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
359
app/src/module_treasure_box/res/layout/activity_treasure_box.xml
Normal file
@@ -0,0 +1,359 @@
|
||||
<?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/layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="@{click}">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/smash_eggs_bg"
|
||||
android:onClick="@{click}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="375:552">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tv_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_rank"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_11"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_more"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_hammer_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.766" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_hammer_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.045" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_hammer_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.957" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_box_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_hammer_1"
|
||||
app:layout_constraintDimensionRatio="78:53"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_box_2"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toStartOf="@id/line_hammer_start"
|
||||
app:layout_constraintTop_toTopOf="@id/line_hammer_top"
|
||||
app:layout_constraintWidth_percent="0.208" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_box_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_hammer_10"
|
||||
app:layout_constraintDimensionRatio="78:53"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_box_3"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_box_1"
|
||||
app:layout_constraintTop_toTopOf="@id/line_hammer_top"
|
||||
app:layout_constraintWidth_percent="0.208" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_box_3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_hammer_100"
|
||||
app:layout_constraintDimensionRatio="78:53"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_box_4"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_box_2"
|
||||
app:layout_constraintTop_toTopOf="@id/line_hammer_top"
|
||||
app:layout_constraintWidth_percent="0.208" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_box_4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/smash_eggs_ic_hammer_200"
|
||||
app:layout_constraintDimensionRatio="78:53"
|
||||
app:layout_constraintEnd_toEndOf="@id/line_hammer_end"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_box_3"
|
||||
app:layout_constraintTop_toTopOf="@id/line_hammer_top"
|
||||
app:layout_constraintWidth_percent="0.208" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.913" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cs_bottom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/shape_7821e8_15dp"
|
||||
app:layout_constraintDimensionRatio="288:28"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line_bottom"
|
||||
app:layout_constraintWidth_percent="0.768">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_num_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.055" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_num_icon_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.013" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_box_num"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
android:autoSizeMinTextSize="@dimen/sp_7"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
app:autoSizeMinTextSize="@dimen/sp_7"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:corner="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="42:16"
|
||||
app:layout_constraintEnd_toStartOf="@id/view_1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
app:layout_constraintStart_toStartOf="@id/line_num_start"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.145"
|
||||
app:solid="@color/color_7748C7" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:src="@drawable/smash_eggs_ic_hammer"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="@id/line_num_icon_start"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.08" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_1"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:background="@drawable/selector_bg_box_price"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="31:16"
|
||||
app:layout_constraintEnd_toStartOf="@id/view_2"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_box_num"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.107" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"
|
||||
android:text="1"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_1"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_1"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_1"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_2"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:background="@drawable/selector_bg_box_price"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="31:16"
|
||||
app:layout_constraintEnd_toStartOf="@id/view_3"
|
||||
app:layout_constraintStart_toEndOf="@+id/view_1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.107" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"
|
||||
android:text="10"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_2"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_2"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_2" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_3"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:background="@drawable/selector_bg_box_price"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="31:16"
|
||||
app:layout_constraintEnd_toStartOf="@id/ed_input_num"
|
||||
app:layout_constraintStart_toEndOf="@+id/view_2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.107" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"
|
||||
android:text="100"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_3"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_3"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_3" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/ed_input_num"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
android:autoSizeMinTextSize="@dimen/sp_7"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:background="@drawable/base_shape_33ffffff_9dp"
|
||||
android:gravity="center"
|
||||
android:hint="@string/please_input_quantity"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:paddingHorizontal="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white_tran_60"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
app:autoSizeMinTextSize="@dimen/sp_7"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="56:18"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_buy"
|
||||
app:layout_constraintStart_toEndOf="@id/view_3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.194" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_buy_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.989" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
android:autoSizeMinTextSize="@dimen/sp_7"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:background="@drawable/smash_eggs_ic_buy"
|
||||
android:gravity="center"
|
||||
android:text="@string/buy"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:autoSizeMaxTextSize="@dimen/sp_10"
|
||||
app:autoSizeMinTextSize="@dimen/sp_7"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="52:22"
|
||||
app:layout_constraintEnd_toEndOf="@id/line_buy_end"
|
||||
app:layout_constraintStart_toEndOf="@id/ed_input_num"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.18" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_open_anim_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.378" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_box_open"
|
||||
android:layout_width="match_parent"
|
||||
app:fillMode="Backward"
|
||||
app:clearsAfterDetached="true"
|
||||
android:layout_height="match_parent"
|
||||
app:loopCount="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_prize_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginBottom="110dp"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_width="200dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.chwl.app.avroom.widget.RoomEffectBoxView
|
||||
android:id="@+id/effect_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
@@ -0,0 +1,254 @@
|
||||
<?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="@string/layout_activity_treasure_box_honour_01"
|
||||
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="@string/layout_activity_treasure_box_honour_02"
|
||||
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="@string/layout_activity_treasure_box_honour_03"
|
||||
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>
|
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_40">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/load_more_loading_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_marginEnd="@dimen/dp_4"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loading_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:text="@string/text_more_loading"
|
||||
android:textColor="@color/white_op_30"
|
||||
android:textSize="@dimen/sp_14"/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/load_more_load_fail_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prompt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white_op_30"
|
||||
android:text="@string/text_more_load_failed"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/load_more_load_end_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/text_more_load_end"
|
||||
android:textColor="@color/white_op_30"/>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
77
app/src/module_treasure_box/res/layout/dialog_box_more.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="android.view.View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_white_top_10dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingBottom="80dp"
|
||||
android:paddingEnd="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="@string/layout_dialog_box_more_01"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:background="@drawable/bottom_line"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layout_dialog_box_more_03"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_box_rule"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layout_dialog_box_more_04"
|
||||
android:background="@drawable/bottom_line"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_msg_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="43dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layout_dialog_box_more_05"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_switch"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:src="@drawable/icon_room_set_lock_false" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_data_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_common_failure" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_data_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/layout_item_empty_list_01"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@@ -0,0 +1,192 @@
|
||||
<?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_toTopOf="parent" />
|
||||
|
||||
<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="@string/layout_fragment_choose_treasure_box_dialog_01"
|
||||
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="@string/layout_fragment_choose_treasure_box_dialog_02"
|
||||
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="@string/layout_fragment_choose_treasure_box_dialog_03"
|
||||
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="@string/layout_fragment_choose_treasure_box_dialog_04"
|
||||
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="@string/layout_fragment_choose_treasure_box_dialog_05"
|
||||
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>
|
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:background="@drawable/bg_934aee_2e2b99_r10">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"/>
|
||||
|
||||
<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="@color/white"
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="@string/layout_item_box_prize_hint_01" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:src="@drawable/ic_diamond"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:layout_width="@dimen/dp_11"
|
||||
android:layout_height="@dimen/dp_11"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_diamond"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="2000"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="@color/color_FFD98C"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
tools:text="x12" />
|
||||
|
||||
</LinearLayout>
|
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="289dp"
|
||||
android:background="@drawable/smash_eggs_buy_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.6" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:src="@drawable/smash_eggs_buy_ic_close"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_lack_love"
|
||||
android:text="@string/buy_love_num"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_7147E6"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/smash_eggs_buy_hammer"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_lack_love" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:drawableStart="@drawable/icon_diamond"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_FF9A1F"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_prize_icon"
|
||||
tools:text="10000" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="152dp"
|
||||
android:layout_height="32dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/smash_eggs_buy_bg_buy"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
app:corner="@dimen/dp_18"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_prize_name" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/cbPay"
|
||||
android:text="@string/star_send_gift_ignore_today"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textColor="@color/color_A3A3A3"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/selector_select_box"
|
||||
android:paddingStart="@dimen/dp_6"
|
||||
android:paddingEnd="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_buy"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="240dp"
|
||||
android:background="@drawable/smash_eggs_buy_success_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.6" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:src="@drawable/smash_eggs_buy_ic_close"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_lack_love"
|
||||
android:text="@string/get"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_7147E6"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/smash_eggs_buy_hammer"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_lack_love" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_7147E6"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_prize_icon"
|
||||
tools:text="x100" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/cbPay"
|
||||
android:text="今日不再提示"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:textColor="@color/color_A3A0AD"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/selector_select_box"
|
||||
android:paddingStart="@dimen/dp_6"
|
||||
android:paddingEnd="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_prize_name"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/smash_eggs_buy_multi_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.6" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:src="@drawable/smash_eggs_buy_ic_close"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_lack_love"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:autoSizeMaxTextSize="@dimen/sp_12"
|
||||
android:autoSizeMinTextSize="@dimen/sp_7"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:text="@string/hammers_insufficient_buy"
|
||||
android:textColor="@color/color_7147E6"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
app:autoSizeMaxTextSize="@dimen/sp_12"
|
||||
app:autoSizeMinTextSize="@dimen/sp_7"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/smash_eggs_buy_hammer"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_lack_love" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableStart="@drawable/icon_diamond"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_FF9A1F"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_prize_icon"
|
||||
tools:text="10000" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_add_num"
|
||||
android:layout_width="@dimen/dp_146"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@drawable/smash_eggs_buy_multi_bg_num"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_prize_name">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_21"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:src="@drawable/smash_eggs_buy_multi_add" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_num"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
android:minWidth="40dp"
|
||||
android:text="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sub"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_21"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_2"
|
||||
android:src="@drawable/smash_eggs_buy_multi_subtract" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="@dimen/dp_152"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/smash_eggs_buy_bg_buy"
|
||||
android:gravity="center"
|
||||
app:corner="@dimen/dp_18"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_add_num" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
8
app/src/module_treasure_box/res/values-ar/strings.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="text_more_load_end">لا توجد بيانات إضافية</string>
|
||||
<string name="text_more_load_failed">فشل التحميل، اضغط للمحاولة مرة أخرى</string>
|
||||
<string name="text_more_loading">جار التحميل…</string>
|
||||
|
||||
<string name="hammers_insufficient_buy">ليس هناك ما يكفي من المطارق المتاحة، يرجى شراء واحدة</string>
|
||||
</resources>
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="text_more_load_end">沒有更多數據</string>
|
||||
<string name="text_more_load_failed">加載失敗,請點我重試</string>
|
||||
<string name="text_more_loading">正在加載中…</string>
|
||||
<string name="hammers_insufficient_buy">可用錘子不足,請購買</string>
|
||||
</resources>
|
13
app/src/module_treasure_box/res/values/colors.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="color_FFEA03">#FFEA03</color>
|
||||
<color name="color_FFCF4C">#FFCF4C</color>
|
||||
<color name="color_AF2D00">#AF2D00</color>
|
||||
<color name="color_FF9251">#FF9251</color>
|
||||
<color name="color_FF8D50">#FF8D50</color>
|
||||
<color name="color_FFE823">#FFE823</color>
|
||||
<color name="color_4D8820E0">#4D8820E0</color>
|
||||
<color name="color_4D7247ED">#4D7247ED</color>
|
||||
<color name="color_7247ED">#7247ED</color>
|
||||
<color name="color_D9FEFEFE">#D9FEFEFE</color>
|
||||
</resources>
|
8
app/src/module_treasure_box/res/values/strings.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="text_more_load_end">No more data</string>
|
||||
<string name="text_more_load_failed">Load failed, tap to retry</string>
|
||||
<string name="text_more_loading">Loading…</string>
|
||||
|
||||
<string name="hammers_insufficient_buy">Not enough hammers available, please buy one</string>
|
||||
</resources>
|