Compare commits
8 Commits
molistar/1
...
dev/app_co
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e4d44155dc | ||
![]() |
06c974a6ed | ||
![]() |
4bfbd19b53 | ||
![]() |
61a26f0c4f | ||
![]() |
e8cfc8a13b | ||
![]() |
295de38074 | ||
![]() |
e3c5f10d02 | ||
![]() |
d949cfa7ff |
BIN
app/src/main/assets/svga/Combo_Boom.svga
Normal file
@@ -97,7 +97,7 @@ public class GlobalHandleManager {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()) return;
|
||||
LevelUpDialog.start(activity, event.getLevelName(), true);
|
||||
// LevelUpDialog.start(activity, event.getLevelName(), true);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -105,7 +105,7 @@ public class GlobalHandleManager {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()) return;
|
||||
LevelUpDialog.start(activity, event.getLevelName(), false);
|
||||
// LevelUpDialog.start(activity, event.getLevelName(), false);
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
|
@@ -0,0 +1,126 @@
|
||||
package com.chwl.app.avroom.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.avroom.widget.VDHLayout
|
||||
import com.chwl.app.ui.widget.dialog.BaseDialog
|
||||
|
||||
abstract class BaseRoomNotifyeBaseDialog<VB : ViewBinding>(context: Context, theme: Int = 0) : BaseDialog(context, theme) {
|
||||
|
||||
protected val handle = Handler(Looper.getMainLooper())
|
||||
protected lateinit var mBinding: VB
|
||||
|
||||
abstract fun createBinding(inflater: LayoutInflater): VB
|
||||
|
||||
abstract fun init()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mBinding = createBinding(LayoutInflater.from(context))
|
||||
setContentView(mBinding.root)
|
||||
setCancelable(true)
|
||||
setCanceledOnTouchOutside(false)
|
||||
window?.let {
|
||||
initWindow(it)
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
handle.postDelayed({
|
||||
dismissDialog()
|
||||
}, (getStaySecond()*1000).toLong())
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
handle.removeCallbacksAndMessages(null)
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
protected open fun initWindow(window: Window) {
|
||||
window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
val windowParams = window.attributes
|
||||
windowParams.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
windowParams.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
windowParams.dimAmount = 0.0f
|
||||
windowParams.gravity = Gravity.TOP
|
||||
windowParams.x = 0
|
||||
windowParams.y = getTopOffset()
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)
|
||||
window.attributes = windowParams
|
||||
window.setWindowAnimations(getAnimations())
|
||||
}
|
||||
|
||||
protected open fun getStaySecond():Float{
|
||||
return 5f
|
||||
}
|
||||
|
||||
protected open fun getTopOffset():Int{
|
||||
return 0
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
protected open fun getAnimations():Int{
|
||||
return R.style.anim_left
|
||||
}
|
||||
|
||||
override fun setContentView(view: View) {
|
||||
if (useSlipSlip()) {
|
||||
val vdhLayout = VDHLayout(context, null)
|
||||
vdhLayout.addView(view)
|
||||
vdhLayout.setListener { dismissDialog() }
|
||||
super.setContentView(vdhLayout)
|
||||
return
|
||||
}
|
||||
super.setContentView(view)
|
||||
}
|
||||
|
||||
override fun setContentView(layoutResID: Int) {
|
||||
if (useSlipSlip()) {
|
||||
val vdhLayout = VDHLayout(context, null)
|
||||
LayoutInflater.from(context).inflate(layoutResID, vdhLayout)
|
||||
vdhLayout.setListener { dismissDialog() }
|
||||
super.setContentView(vdhLayout)
|
||||
return
|
||||
}
|
||||
super.setContentView(layoutResID)
|
||||
}
|
||||
|
||||
override fun setContentView(view: View, params: ViewGroup.LayoutParams?) {
|
||||
if (useSlipSlip()) {
|
||||
val vdhLayout = VDHLayout(context, null)
|
||||
vdhLayout.addView(view)
|
||||
vdhLayout.setListener { dismissDialog() }
|
||||
super.setContentView(vdhLayout, params)
|
||||
return
|
||||
}
|
||||
super.setContentView(view, params)
|
||||
}
|
||||
|
||||
open fun dismissDialog(){
|
||||
try {
|
||||
dismiss()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否启动侧滑,左滑:删除,右滑:回到原位置
|
||||
*/
|
||||
protected open fun useSlipSlip(): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
package com.chwl.app.avroom.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.avroom.activity.AVRoomActivity
|
||||
import com.chwl.app.common.widget.dialog.DialogManager
|
||||
import com.chwl.app.common.widget.dialog.DialogManager.OkCancelDialogListener
|
||||
import com.chwl.app.databinding.RoomNotifyLuckGiftDlgBinding
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||
import com.chwl.app.utils.NumberUtils
|
||||
import com.chwl.core.gift.bean.LuckyGiftMsgAllBean
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.example.lib_utils.UiUtils
|
||||
|
||||
/**
|
||||
* @Author Vance
|
||||
* 幸运礼物的飘屏,全服但是展示的时候限制只有房间才展示
|
||||
*/
|
||||
class BaseRoomNotifyeLuckGiftDialog(private val context: Context) : BaseRoomNotifyeBaseDialog<RoomNotifyLuckGiftDlgBinding>(context) {
|
||||
|
||||
override fun createBinding(inflater: LayoutInflater): RoomNotifyLuckGiftDlgBinding {
|
||||
return RoomNotifyLuckGiftDlgBinding.inflate(inflater)
|
||||
}
|
||||
|
||||
private var mDialogManager: DialogManager? = null
|
||||
var luckyGiftMsgBean: LuckyGiftMsgAllBean ? = null
|
||||
|
||||
override fun init() {
|
||||
|
||||
if (UiUtils.isRtl(context)) {
|
||||
mBinding.bg.scaleX = -1f
|
||||
}
|
||||
|
||||
ImageLoadUtils.loadImage(mBinding.avatar,luckyGiftMsgBean?.sender?.avatar?:"")
|
||||
mBinding.giftName.text = luckyGiftMsgBean?.giftNameMap?.getFirstText()
|
||||
mBinding.winNum.text = luckyGiftMsgBean?.times.toString()
|
||||
|
||||
val coinNum = NumberUtils.format(luckyGiftMsgBean?.coins?:0)
|
||||
mBinding.coinNum.text = coinNum
|
||||
|
||||
mBinding.clickArea.setOnClickListener {
|
||||
mDialogManager = DialogManager(context)
|
||||
mDialogManager?.showOkCancelDialog(ResUtil.getString(R.string.changeRoomTips), true, object : OkCancelDialogListener {
|
||||
override fun onCancel() {
|
||||
mDialogManager?.dismissDialog()
|
||||
}
|
||||
|
||||
override fun onOk() {
|
||||
mDialogManager?.dismissDialog()
|
||||
luckyGiftMsgBean?.roomUid?.let {
|
||||
if (AvRoomDataManager.get().roomUid != it) {
|
||||
AVRoomActivity.start(context, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var mCallBack : CallBack? = null
|
||||
interface CallBack{
|
||||
fun onHide();
|
||||
}
|
||||
|
||||
override fun dismissDialog() {
|
||||
super.dismissDialog()
|
||||
mCallBack?.onHide()
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -77,6 +77,14 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
private Context context;
|
||||
private OptAdapter optAdapter;
|
||||
private OnActionListener onActionListener;
|
||||
private CallBack callBack;
|
||||
public void setCallBack(CallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
}
|
||||
|
||||
public interface CallBack{
|
||||
void onCLick(int Type);
|
||||
}
|
||||
|
||||
public RoomOperationDialog(@NonNull Context context) {
|
||||
super(context, R.style.ErbanBottomSheetDialogDimFalse);
|
||||
@@ -133,6 +141,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
addSuperAdminAction(optAdapter);
|
||||
addShieldReportAction(optAdapter);
|
||||
addRoomTypeSwitchAction(optAdapter);
|
||||
//todo-- add pk btn
|
||||
rvOPtList.setAdapter(optAdapter);
|
||||
}
|
||||
|
||||
|
@@ -22,9 +22,7 @@ import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -59,9 +57,7 @@ import com.chwl.app.event.OpenRoomIntroEvent
|
||||
import com.chwl.app.friend.view.SelectFriendActivity
|
||||
import com.chwl.app.home.adapter.RoomActAdapter
|
||||
import com.chwl.app.music.widget.MusicPlayerView
|
||||
import com.chwl.app.public_chat.ui.message.HeadlineViewModel
|
||||
import com.chwl.app.room_chat.activity.RoomMsgActivity
|
||||
import com.chwl.app.ui.pay.ChargeActivity
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.app.ui.webview.DialogWebViewActivity
|
||||
import com.chwl.app.ui.widget.ButtonItem
|
||||
@@ -69,7 +65,6 @@ import com.chwl.app.ui.widget.GiftDialog
|
||||
import com.chwl.app.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
||||
import com.chwl.app.ui.widget.GiftDialog.SenGiftCallback
|
||||
import com.chwl.app.ui.widget.UserInfoDialog
|
||||
import com.chwl.app.ui.widget.dialog.CommonTipDialog
|
||||
import com.chwl.app.ui.widget.dynamicface.DynamicFaceDialog
|
||||
import com.chwl.app.ui.widget.magicindicator.MagicIndicator
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil
|
||||
@@ -78,13 +73,13 @@ import com.chwl.app.ui.widget.rollviewpager.RollPagerView
|
||||
import com.chwl.app.ui.widget.rollviewpager.Util
|
||||
import com.chwl.app.ui.widget.rollviewpager.hintview.ColorPointHintView
|
||||
import com.chwl.app.utils.KeyBoardUtils
|
||||
import com.chwl.app.vip.dialog.SelectPayTypeDialog
|
||||
import com.chwl.core.Constants
|
||||
import com.chwl.core.UriProvider
|
||||
import com.chwl.core.auth.AuthModel
|
||||
import com.chwl.core.bean.RoomMicInfo
|
||||
import com.chwl.core.gift.GiftModel
|
||||
import com.chwl.core.gift.bean.GiftInfo
|
||||
import com.chwl.core.gift.event.GiftComboEvent
|
||||
import com.chwl.core.gift.event.RoomFreeGiftEvent
|
||||
import com.chwl.core.helper.AtProxy
|
||||
import com.chwl.core.home.bean.BannerInfo
|
||||
@@ -118,12 +113,15 @@ import com.chwl.core.support.room.RoomWidget
|
||||
import com.chwl.core.user.UserModel
|
||||
import com.chwl.core.user.bean.BaseInfo
|
||||
import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.core.utils.net.BalanceNotEnoughExeption
|
||||
import com.chwl.core.utils.net.VipLevelNotEnoughException
|
||||
import com.chwl.library.common.util.LimitClickUtils
|
||||
import com.chwl.library.net.rxnet.utils.RxNetWorkUtils
|
||||
import com.chwl.library.rxbus.RxBus
|
||||
import com.chwl.library.utils.*
|
||||
import com.chwl.library.utils.JavaUtil
|
||||
import com.chwl.library.utils.ListUtils
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import com.chwl.library.utils.UIUtils
|
||||
import com.google.gson.Gson
|
||||
import com.netease.nim.uikit.common.antispam.AntiSpamEvent
|
||||
import com.netease.nimlib.sdk.StatusCode
|
||||
@@ -135,7 +133,6 @@ import com.tbruyelle.rxpermissions2.RxPermissions
|
||||
import com.trello.rxlifecycle3.android.FragmentEvent
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -870,6 +867,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
|
||||
for (i in micMemberInfos.indices) {
|
||||
targetUids.add(micMemberInfos[i].account.toLong())
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_BEGIN))
|
||||
|
||||
GiftModel.get()
|
||||
.sendRoomGift(
|
||||
giftInfo.giftId,
|
||||
@@ -891,11 +891,16 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
|
||||
dialogManager.showOkDialog(message)
|
||||
}
|
||||
}
|
||||
.subscribe { _, throwable ->
|
||||
.subscribe { gift, throwable ->
|
||||
if (throwable != null) {
|
||||
toast(throwable.message)
|
||||
callback.onFail()
|
||||
EventBus.getDefault().post(GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_CANCEL))
|
||||
} else {
|
||||
giftDialog?.hide()
|
||||
val giftComboEvent = GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_END)
|
||||
giftComboEvent.giftNumber = gift.data.giftNum
|
||||
EventBus.getDefault().post(giftComboEvent)
|
||||
callback.onSuccess()
|
||||
}
|
||||
}
|
||||
@@ -1280,6 +1285,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
|
||||
giftDialog?.setOnDismissListener { giftDialog = null }
|
||||
}
|
||||
if (giftDialog?.isShowing != true && !requireActivity().isFinishing) {
|
||||
EventBus.getDefault().post(GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_POINT))
|
||||
giftDialog?.show()
|
||||
}
|
||||
}
|
||||
@@ -1483,6 +1489,26 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
|
||||
}
|
||||
|
||||
protected open fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||
|
||||
//todo-- 音乐按钮
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onGiftComboEvent(event: GiftComboEvent) {
|
||||
when (event.action) {
|
||||
|
||||
GiftComboEvent.Action.ACT_GIFT_START-> {
|
||||
giftDialog?.sendGift()
|
||||
}
|
||||
|
||||
GiftComboEvent.Action.ACT_GIFT_SHOW-> {
|
||||
giftDialog?.show()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -6,7 +6,10 @@ import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewStub;
|
||||
@@ -19,9 +22,23 @@ import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.chwl.app.avroom.activity.RoomTitleEditActivity;
|
||||
import com.chwl.app.avroom.dialog.BaseRoomNotifyeLuckGiftDialog;
|
||||
import com.chwl.app.databinding.LayoutRoomNotifyLuckyGiftTipBinding;
|
||||
import com.chwl.app.utils.GiftAnimUtil;
|
||||
import com.chwl.app.utils.NumberUtils;
|
||||
import com.chwl.app.utils.WeakPool;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.gift.bean.LuckyGiftMsgAllBean;
|
||||
import com.chwl.core.gift.bean.LuckyGiftMsgSelfBean;
|
||||
import com.chwl.core.gift.bean.MsgSuperLuckyGift;
|
||||
import com.chwl.core.utils.ComboUtil;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtilsV2;
|
||||
import com.chwl.app.ui.widget.BonsellaJoinAttackButtonView;
|
||||
import com.chwl.app.ui.widget.GiftDialog;
|
||||
import com.chwl.app.ui.widget.UserInfoDialog;
|
||||
import com.chwl.core.gift.event.GiftComboEvent;
|
||||
import com.chwl.core.gift.toolbox.GiftToolbox;
|
||||
import com.chwl.core.utils.LogUtils;
|
||||
import com.chwl.library.utils.JavaUtil;
|
||||
import com.example.lib_utils.UiUtils;
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
@@ -66,6 +83,7 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
@@ -101,6 +119,9 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
//收藏房间
|
||||
private String FOLLOW_ROOM_TYPE = "";
|
||||
|
||||
//幸运礼物 飘屏队列
|
||||
private ArrayList<LuckyGiftMsgAllBean> mLuckyGiftList = new ArrayList<>();
|
||||
|
||||
public static HomePartyFragment newInstance() {
|
||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -243,7 +264,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
case RoomEvent.ROOM_INFO_UPDATE:
|
||||
updateView(AvRoomDataManager.get().mCurrentRoomInfo);
|
||||
break;
|
||||
case RoomEvent.RECEIVE_NORMALE_GIFT:
|
||||
case RoomEvent.RECEIVE_NORMALE_GIFT://普通
|
||||
onReceiveGiftMsg(roomEvent.getGiftReceiveInfo());
|
||||
break;
|
||||
case RoomEvent.RECEIVE_MUTLT_NORMALEI_GIFT://普通多人
|
||||
@@ -267,12 +288,17 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
case RoomEvent.FANS_TEAM_JOIN:
|
||||
onReceiveFansTeamJoinMsg(roomEvent.getChatRoomMessage());
|
||||
break;
|
||||
case RoomEvent.MSG_SUPER_LUCKY_GIFT:
|
||||
onLuckyGiftMsg(roomEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取礼物飘屏是否展示
|
||||
*
|
||||
@@ -491,10 +517,16 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
luckyGiftTipPool.clear();
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
mLuckyGiftList.clear();
|
||||
|
||||
if (giftView != null) {
|
||||
giftView.release();
|
||||
}
|
||||
EventBus.getDefault().unregister(this);
|
||||
gameMainBinding.giftComboBtn.cancel();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -508,10 +540,10 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
updateOnlineNumberView(onlineNumber);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 普通多人
|
||||
*
|
||||
* @param giftMultiReceiverInfo
|
||||
*/
|
||||
private void onReceiveMultiGiftMsg(GiftMultiReceiverInfo giftMultiReceiverInfo) {
|
||||
if (giftMultiReceiverInfo == null || !isResumed()) return;
|
||||
@@ -519,12 +551,12 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
giftView = (GiftV2View) mVsGift2View.inflate();
|
||||
}
|
||||
giftView.onReceiveGiftToMultiMsg(giftMultiReceiverInfo);
|
||||
giftMultiReceiverInfo.isMulti = true;
|
||||
gameMainBinding.giftComboLayout.onRoomCustomMsg(giftMultiReceiverInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通全麦
|
||||
*
|
||||
* @param multiGiftReceiveInfo
|
||||
*/
|
||||
private void onReceiveAllMicGiftMsg(MultiGiftReceiveInfo multiGiftReceiveInfo) {
|
||||
if (multiGiftReceiveInfo == null || !isResumed()) return;
|
||||
@@ -532,14 +564,20 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
giftView = (GiftV2View) mVsGift2View.inflate();
|
||||
}
|
||||
giftView.onReceiveMultiGiftMsg(multiGiftReceiveInfo);
|
||||
gameMainBinding.giftComboLayout.onRoomCustomMsg(GiftToolbox.transformToGiftMultiReceiverInfo(multiGiftReceiveInfo));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通
|
||||
*/
|
||||
private void onReceiveGiftMsg(GiftReceiveInfo giftReceiveInfo) {
|
||||
if (giftReceiveInfo == null || !isResumed()) return;
|
||||
if (giftView == null) {
|
||||
giftView = (GiftV2View) mVsGift2View.inflate();
|
||||
}
|
||||
giftView.onReceiveGiftMsg(giftReceiveInfo);
|
||||
gameMainBinding.giftComboLayout.onRoomCustomMsg(GiftToolbox.transformToGiftMultiReceiverInfo(giftReceiveInfo));
|
||||
}
|
||||
|
||||
private void onReceiveMagicMsg(MagicReceivedInfo magicReceivedInfo) {
|
||||
@@ -611,4 +649,149 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
dialogFragment.show(requireActivity().getSupportFragmentManager(), "roomTitle");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftComboEvent(GiftComboEvent event) {
|
||||
if (event.getAction() == GiftComboEvent.Action.ACT_GIFT_BEGIN) {
|
||||
if (gameMainBinding.giftComboBtn.isInCombo()){
|
||||
gameMainBinding.giftComboBtn.waitStart();
|
||||
}
|
||||
} else if (event.getAction() == GiftComboEvent.Action.ACT_GIFT_END) {
|
||||
showComboBtn(event.getGiftNumber());
|
||||
}else if (event.getAction() == GiftComboEvent.Action.ACT_GIFT_CANCEL) {
|
||||
if (gameMainBinding.giftComboBtn.isInCombo()) {
|
||||
gameMainBinding.giftComboBtn.cancel();
|
||||
}
|
||||
}else if (event.getAction() == GiftComboEvent.Action.ACT_GIFT_POINT) {
|
||||
ComboUtil.INSTANCE.setPoint(gameMainBinding.giftComboBtn);
|
||||
}
|
||||
}
|
||||
|
||||
private void showComboBtn(int number) {
|
||||
if (gameMainBinding.giftComboBtn.getOnGiftComboEndListener() == null) {
|
||||
|
||||
gameMainBinding.giftComboBtn.setOnClickListener(v -> {
|
||||
ComboUtil.INSTANCE.setPoint(gameMainBinding.giftComboBtn);
|
||||
EventBus.getDefault().post(new GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_START));
|
||||
gameMainBinding.giftComboBtn.onBtnDown();
|
||||
});
|
||||
|
||||
|
||||
gameMainBinding.giftComboBtn.setOnGiftComboEndListener(new BonsellaJoinAttackButtonView.OnGiftComboEndListener() {
|
||||
@Override
|
||||
public void onGiftComboEnd() {
|
||||
gameMainBinding.giftComboBtn.showView(false);
|
||||
EventBus.getDefault().post(new GiftComboEvent(GiftComboEvent.Action.ACT_GIFT_SHOW));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
gameMainBinding.giftComboBtn.showView(true);
|
||||
gameMainBinding.giftComboBtn.start();
|
||||
gameMainBinding.giftComboBtn.updateNumber(number);
|
||||
}
|
||||
|
||||
|
||||
private void onLuckyGiftMsg(RoomEvent roomEvent) {
|
||||
MsgSuperLuckyGift msgSuperLuckyGift = roomEvent.getMsgSuperLuckyGift();
|
||||
if (msgSuperLuckyGift != null) {
|
||||
if (msgSuperLuckyGift.luckyGiftMsgAllBean != null) {
|
||||
showLuckyGiftDlg(msgSuperLuckyGift.luckyGiftMsgAllBean);
|
||||
}
|
||||
|
||||
if (msgSuperLuckyGift.luckyGiftMsgSelfBean != null) {
|
||||
showLuckyGiftDlgNotify(msgSuperLuckyGift.luckyGiftMsgSelfBean);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
private WeakPool<View> luckyGiftTipPool = new WeakPool<>(3);
|
||||
private void showLuckyGiftDlgNotify(LuckyGiftMsgSelfBean luckyGiftMsgBean) {
|
||||
if (luckyGiftMsgBean == null) return;
|
||||
if (luckyGiftMsgBean.getUid() != AuthModel.get().getCurrentUid()) return;
|
||||
if (luckyGiftMsgBean.getRoomId() != AvRoomDataManager.get().getRoomId()) return;
|
||||
if (luckyGiftMsgBean.getRoomUid() != AvRoomDataManager.get().getRoomUid()) return;
|
||||
|
||||
LogUtils.i(" showLuckyGiftDlgNotify = start");
|
||||
|
||||
View root = luckyGiftTipPool.acquire(() -> {
|
||||
return LayoutInflater.from(gameMainBinding.flLuckyGiftNotifyLayout.getContext()).inflate(R.layout.layout_room_notify_lucky_gift_tip, gameMainBinding.flLuckyGiftNotifyLayout, false);
|
||||
});
|
||||
LayoutRoomNotifyLuckyGiftTipBinding binding = LayoutRoomNotifyLuckyGiftTipBinding.bind(root);
|
||||
binding.coinNum.setText(NumberUtils.format(luckyGiftMsgBean.getCoins()));
|
||||
binding.winNum.setText(java.lang.String.valueOf(luckyGiftMsgBean.getTimes()));
|
||||
if (luckyGiftMsgBean.getLevel() > 1) {
|
||||
binding.rootView.setBackgroundResource(R.drawable.bg_lucky_gift_tip_2);
|
||||
}
|
||||
root.setAlpha(0f);
|
||||
root.setScaleX(0f);
|
||||
root.setScaleY(0f);
|
||||
gameMainBinding.flLuckyGiftNotifyLayout.addView(root);
|
||||
GiftAnimUtil.showAnimation(root);
|
||||
// GiftAnimUtil.expandAnimation(root);
|
||||
|
||||
handler.postDelayed(() -> {
|
||||
try {
|
||||
root.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(500)
|
||||
.withEndAction(() -> {
|
||||
gameMainBinding.flLuckyGiftNotifyLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
root.clearAnimation();
|
||||
gameMainBinding.flLuckyGiftNotifyLayout.removeView(root);
|
||||
luckyGiftTipPool.release(root);
|
||||
}
|
||||
});
|
||||
})
|
||||
.start();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}, 2300);
|
||||
}
|
||||
|
||||
BaseRoomNotifyeLuckGiftDialog allServiceLuckGiftDialog;
|
||||
private void showLuckyGiftDlg(LuckyGiftMsgAllBean luckyGiftMsgAllBean){
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDlg() ");
|
||||
mLuckyGiftList.add(luckyGiftMsgAllBean);
|
||||
if (!(allServiceLuckGiftDialog != null && allServiceLuckGiftDialog.isShowing())) {
|
||||
LuckyGiftMsgAllBean data = mLuckyGiftList.remove(0);
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDlg() -> showLuckyGiftDialog"+mLuckyGiftList.size());
|
||||
showLuckyGiftDialog(data);
|
||||
}
|
||||
}
|
||||
private void showLuckyGiftDialog(LuckyGiftMsgAllBean luckyGiftMsgAllBean){
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDialog() ");
|
||||
allServiceLuckGiftDialog = new BaseRoomNotifyeLuckGiftDialog(requireContext());
|
||||
allServiceLuckGiftDialog.setLuckyGiftMsgBean(luckyGiftMsgAllBean);
|
||||
allServiceLuckGiftDialog.setMCallBack(new BaseRoomNotifyeLuckGiftDialog.CallBack() {
|
||||
@Override
|
||||
public void onHide() {
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDialog() ->onHide");
|
||||
gameMainBinding.getRoot().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDialog() ->onHide->postDelayed");
|
||||
if (!mLuckyGiftList.isEmpty()){
|
||||
LuckyGiftMsgAllBean data = mLuckyGiftList.remove(0);
|
||||
LogUtils.d(" LuckyGiftDlg -- showLuckyGiftDialog() ->onHide->postDelayed-> "+mLuckyGiftList.size());
|
||||
showLuckyGiftDialog(data);
|
||||
}
|
||||
}
|
||||
},100);
|
||||
}
|
||||
});
|
||||
allServiceLuckGiftDialog.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -21,6 +21,7 @@ import com.example.lib_utils.ktx.singleClick
|
||||
|
||||
/**
|
||||
* 房间榜单入口
|
||||
* //todo-- 房间榜单入口
|
||||
*/
|
||||
class RoomRankNumberWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||
|
||||
|
@@ -261,6 +261,7 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
}
|
||||
|
||||
public void updateGameEntrance() {
|
||||
//todo-- game btn
|
||||
if (AvRoomDataManager.get().isManager() || SuperAdminUtil.isSuperAdmin()) {
|
||||
if (!AvRoomDataManager.get().isCpRoom()) {
|
||||
pkGameView.setVisibility(VISIBLE);
|
||||
@@ -273,6 +274,7 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
if (AvRoomDataManager.get().isSingleRoom() || AvRoomDataManager.get().isDatingMode()) {
|
||||
pkGameView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showHomePartyDownMicBottom() {
|
||||
|
@@ -23,6 +23,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chwl.core.utils.ComboUtil;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.example.lib_utils.UiUtils;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
@@ -89,6 +91,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
private int mScreenWidth;
|
||||
private int mScreenHeight;
|
||||
private Keyframe[] keyScale;
|
||||
private Keyframe[] keyScaleCombo;
|
||||
private Keyframe[] keyTrans;
|
||||
private SvgaObjectPool mMagicViewPool;
|
||||
|
||||
@@ -126,6 +129,13 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
keyScale[4] = (Keyframe.ofFloat(0.5f, 2f));
|
||||
keyScale[5] = (Keyframe.ofFloat(0.8f, 2f));
|
||||
keyScale[6] = (Keyframe.ofFloat(1f, 1f));
|
||||
|
||||
keyScaleCombo = new Keyframe[4];
|
||||
keyScaleCombo[0] = (Keyframe.ofFloat(0f, 0.25f));
|
||||
keyScaleCombo[1] = (Keyframe.ofFloat(0.25f, 0.5f));
|
||||
keyScaleCombo[2] = (Keyframe.ofFloat(0.5f, 0.75f));
|
||||
keyScaleCombo[3] = (Keyframe.ofFloat(1f, 1f));
|
||||
|
||||
keyTrans = new Keyframe[3];
|
||||
keyTrans[0] = (Keyframe.ofFloat(0f, 0));
|
||||
keyTrans[1] = (Keyframe.ofFloat(0.2f, 0));
|
||||
@@ -255,6 +265,14 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
}
|
||||
Point senderPoint = micViewPoint.get(senderPosition);
|
||||
Point receivePoint = micViewPoint.get(receivePosition);
|
||||
|
||||
// 连击 特殊动画
|
||||
if (giftReceiveInfo.getUid() == AuthModel.get().getCurrentUid()){
|
||||
if (ComboUtil.INSTANCE.isChangePoint()) {
|
||||
senderPoint = ComboUtil.INSTANCE.getPoint();
|
||||
}
|
||||
}
|
||||
|
||||
//设置动画结束的位置
|
||||
if (receivePoint == null || isGameRoomMoreThan6People()) { //这种情况就是接收者已经不在麦上
|
||||
//礼物送到中间的位置
|
||||
@@ -627,6 +645,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
return;
|
||||
}
|
||||
GiftInfo giftInfo = giftReceiveInfo.getGift();
|
||||
giftInfo.uid = giftReceiveInfo.getUid();
|
||||
if (giftInfo == null) {
|
||||
return;
|
||||
}
|
||||
@@ -668,8 +687,24 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
PropertyValuesHolder p1 = PropertyValuesHolder.ofKeyframe("translationY", keyTrans[0], keyTrans[1], keyTrans[2], keyTransY3, keyTransY4, keyTransY5);
|
||||
PropertyValuesHolder p2 = PropertyValuesHolder.ofKeyframe("scaleX", keyScale);
|
||||
PropertyValuesHolder p3 = PropertyValuesHolder.ofKeyframe("scaleY", keyScale);
|
||||
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2, p3, p1, p0);
|
||||
objectAnimator.setDuration(4000);
|
||||
|
||||
PropertyValuesHolder p0c = PropertyValuesHolder.ofKeyframe("translationX", keyTrans[0], keyTransX5);
|
||||
PropertyValuesHolder p1c = PropertyValuesHolder.ofKeyframe("translationY", keyTrans[0], keyTransY5);
|
||||
PropertyValuesHolder p2c = PropertyValuesHolder.ofKeyframe("scaleX", keyScaleCombo);
|
||||
PropertyValuesHolder p3c = PropertyValuesHolder.ofKeyframe("scaleY", keyScaleCombo);
|
||||
|
||||
long time;
|
||||
ObjectAnimator objectAnimator;
|
||||
// 连击 特殊动画
|
||||
if (ComboUtil.INSTANCE.isChangePoint() && giftInfo.uid == AuthModel.get().getCurrentUid()){
|
||||
objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2c, p3c, p1c, p0c);
|
||||
time = 600;
|
||||
}else {
|
||||
objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2, p3, p1, p0);
|
||||
time = 2000;
|
||||
}
|
||||
|
||||
objectAnimator.setDuration(time);
|
||||
objectAnimator.start();
|
||||
objectAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
118
app/src/main/java/com/chwl/app/avroom/widget/VDHLayout.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package com.chwl.app.avroom.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
|
||||
/**
|
||||
* 侧滑FrameLayout
|
||||
* 子View左滑删除,右滑弹起后复位
|
||||
*/
|
||||
public class VDHLayout extends FrameLayout {
|
||||
private final ViewDragHelper mDragHelper;
|
||||
|
||||
private final Point mAutoBackOriginPos = new Point();
|
||||
|
||||
private OnViewGoneListener listener;
|
||||
|
||||
public VDHLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mDragHelper = ViewDragHelper.create(this, 1.0f, new ViewDragHelper.Callback() {
|
||||
@Override
|
||||
public boolean tryCaptureView(@NonNull View child, int pointerId) {
|
||||
mAutoBackOriginPos.x = child.getLeft();
|
||||
mAutoBackOriginPos.y = child.getTop();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* view的left
|
||||
*/
|
||||
@Override
|
||||
public int clampViewPositionHorizontal(@NonNull View child, int left, int dx) {
|
||||
return left;
|
||||
}
|
||||
|
||||
/**
|
||||
* view的top
|
||||
*/
|
||||
@Override
|
||||
public int clampViewPositionVertical(@NonNull View child, int top, int dy) {
|
||||
return child.getTop();
|
||||
}
|
||||
|
||||
|
||||
//手指释放的时候回调
|
||||
@Override
|
||||
public void onViewReleased(@NonNull View releasedChild, float xvel, float yvel) {
|
||||
//mAutoBackView手指释放时可以自动回去
|
||||
if (releasedChild.getLeft() < 0 && ((Math.abs(releasedChild.getLeft()) >= releasedChild.getMeasuredWidth() * 0.2))) {
|
||||
releasedChild.setEnabled(false);
|
||||
releasedChild.animate()
|
||||
.setDuration(100L)
|
||||
.translationX(-ScreenUtil.getDisplayWidth())
|
||||
.alpha(0F)
|
||||
.withEndAction(() -> {
|
||||
releasedChild.setVisibility(GONE);
|
||||
if(listener != null){
|
||||
listener.onViewGone();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
mDragHelper.settleCapturedViewAt(mAutoBackOriginPos.x, mAutoBackOriginPos.y);
|
||||
ViewCompat.postInvalidateOnAnimation(VDHLayout.this);
|
||||
}
|
||||
}
|
||||
|
||||
//在边界拖动时回调
|
||||
@Override
|
||||
public void onEdgeDragStarted(int edgeFlags, int pointerId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewHorizontalDragRange(@NonNull View child) {
|
||||
return child.getMeasuredWidth();
|
||||
}
|
||||
|
||||
});
|
||||
mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return mDragHelper.shouldInterceptTouchEvent(event);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
mDragHelper.processTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void computeScroll() {
|
||||
if (mDragHelper.continueSettling(true)) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(OnViewGoneListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public interface OnViewGoneListener{
|
||||
void onViewGone();
|
||||
}
|
||||
}
|
62
app/src/main/java/com/chwl/app/ui/utils/SoftPool.kt
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.chwl.app.ui.utils
|
||||
|
||||
import com.opensource.svgaplayer.utils.Pools
|
||||
import java.lang.ref.SoftReference
|
||||
import java.util.LinkedList
|
||||
|
||||
class SoftPool <T:Any> (private var max:Int) : Pools.Pool<T> {
|
||||
|
||||
init {
|
||||
if (max <= 0){
|
||||
max = 8
|
||||
}
|
||||
}
|
||||
|
||||
private var mPool = LinkedList<SoftReference<T>>()
|
||||
|
||||
fun acquire(getItemEmpty:()->T):T{
|
||||
return acquire()?:getItemEmpty()
|
||||
}
|
||||
|
||||
|
||||
override fun acquire(): T? {
|
||||
if (mPool.size == 0){
|
||||
return null
|
||||
}
|
||||
|
||||
while (true){
|
||||
val item = mPool.poll()?:return null
|
||||
if (item.get() != null) {
|
||||
return item.get()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun release(instance: T): Boolean {
|
||||
if (mPool.size > max) {
|
||||
if (getRealSize() > max) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
mPool.addFirst(SoftReference(instance))
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
private fun getRealSize() : Int{
|
||||
val iterator = mPool.listIterator()
|
||||
while (iterator.hasNext()) {
|
||||
val item = iterator.next().get()
|
||||
if (item == null) iterator.remove()
|
||||
}
|
||||
return mPool.size
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
mPool.clear()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,180 @@
|
||||
package com.chwl.app.ui.widget
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.os.VibratorManager
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isGone
|
||||
import com.chwl.app.databinding.ViewBonsellaJoinAttackButtonBinding
|
||||
import com.chwl.core.utils.ComboUtil
|
||||
|
||||
class BonsellaJoinAttackButtonView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : FrameLayout(context, attrs) {
|
||||
|
||||
var onGiftComboEndListener: OnGiftComboEndListener? = null
|
||||
private var comboNum = 0
|
||||
private var comboCount = 0
|
||||
|
||||
private val objectAnimator: ObjectAnimator by lazy {
|
||||
ObjectAnimator.ofFloat(mBinding.pvBg, "percent", 100F, 0F).apply {
|
||||
duration = DOWN_COUNT_TIME
|
||||
}
|
||||
}
|
||||
|
||||
private val mBinding = ViewBonsellaJoinAttackButtonBinding.inflate(LayoutInflater.from(context), this)
|
||||
|
||||
private val vibrator by lazy {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
(context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager).defaultVibrator
|
||||
} else {
|
||||
context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
mBinding.ivBtn.isLongClickable = false
|
||||
mBinding.pvBg.setProgressChangeListener{
|
||||
if(it == 0f){
|
||||
isGone = true
|
||||
comboNum = 0
|
||||
comboCount = 0
|
||||
ComboUtil.comboCount = comboCount+1
|
||||
mBinding.tvNum.text = ""
|
||||
onGiftComboEndListener?.onGiftComboEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onBtnDown(){
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
vibrator.vibrate(VibrationEffect.createOneShot(100L, VibrationEffect.DEFAULT_AMPLITUDE))
|
||||
}else{
|
||||
vibrator.vibrate(100)
|
||||
}
|
||||
} catch (_: Exception) { }
|
||||
|
||||
// mBinding.ivBtn.animate().cancel()
|
||||
// mBinding.ivBtn.animate()
|
||||
// .scaleX(0.875f)
|
||||
// .scaleY(0.875f)
|
||||
// .setDuration(50)
|
||||
// .withEndAction {
|
||||
// onBtnUp()
|
||||
// }
|
||||
// .start()
|
||||
// mBinding.pvBg.animate().cancel()
|
||||
// mBinding.pvBg.animate()
|
||||
// .scaleX(0.875f)
|
||||
// .scaleY(0.875f)
|
||||
// .setDuration(50)
|
||||
// .start()
|
||||
// mBinding.ivBg.animate().cancel()
|
||||
// mBinding.ivBg.alpha = 0f
|
||||
// mBinding.ivBg.scaleX = 1f
|
||||
// mBinding.ivBg.scaleY = 1f
|
||||
|
||||
mBinding.svga.stopAnimation()
|
||||
mBinding.svga.startAnimation()
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun onBtnUp(){
|
||||
mBinding.ivBtn.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(50)
|
||||
.withEndAction { }
|
||||
.start()
|
||||
mBinding.pvBg.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(50)
|
||||
.start()
|
||||
mBinding.ivBg.alpha = 1f
|
||||
mBinding.ivBg.animate()
|
||||
.alpha(0f)
|
||||
.scaleX(1.3f)
|
||||
.scaleY(1.3f)
|
||||
.start()
|
||||
}
|
||||
|
||||
fun getComboNum():Int{
|
||||
return comboNum
|
||||
}
|
||||
|
||||
|
||||
fun isInCombo():Boolean{
|
||||
return comboNum > 0
|
||||
}
|
||||
|
||||
fun cancel() {
|
||||
objectAnimator.cancel()
|
||||
mBinding.pvBg.percent = 0f
|
||||
}
|
||||
|
||||
fun start() {
|
||||
objectAnimator.start()
|
||||
}
|
||||
|
||||
fun waitStart() {
|
||||
mBinding.pvBg.percent = 100f
|
||||
objectAnimator.pause()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
cancel()
|
||||
mBinding.svga.clear()
|
||||
objectAnimator.removeAllListeners()
|
||||
objectAnimator.removeAllUpdateListeners()
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于更新按钮上的文字
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun updateNumber(num: Int) {
|
||||
comboNum += num
|
||||
comboCount++
|
||||
mBinding.tvNum.text = "x$comboCount"
|
||||
mBinding.tvNum.scaleX = 1.3f
|
||||
mBinding.tvNum.scaleY = 1.3f
|
||||
mBinding.tvNum.animate()
|
||||
.setDuration(100)
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.start()
|
||||
ComboUtil.comboCount = comboCount+1
|
||||
}
|
||||
|
||||
fun interface OnGiftComboEndListener {
|
||||
fun onGiftComboEnd()
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 倒计时时间,毫秒为单位
|
||||
*/
|
||||
const val DOWN_COUNT_TIME = 5 * 1000L
|
||||
}
|
||||
|
||||
fun showView(isVis : Boolean){
|
||||
if (isVis) {
|
||||
if (visibility != View.VISIBLE) visibility = View.VISIBLE
|
||||
}else{
|
||||
if (visibility == View.VISIBLE) visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,349 @@
|
||||
package com.chwl.app.ui.widget
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.PropertyValuesHolder
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||
import com.chwl.app.ui.utils.SoftPool
|
||||
import com.chwl.core.gift.bean.BonsellaJoinAttack
|
||||
import com.chwl.core.gift.bean.GiftMultiReceiverInfo
|
||||
import com.chwl.core.utils.LogUtils
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.example.lib_utils.UiUtils
|
||||
import java.util.LinkedList
|
||||
|
||||
class BonsellaJoinAttackLayout @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
defStyleRes: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes){
|
||||
|
||||
private val showingList = LinkedList<BonsellaJoinAttack>()
|
||||
private val waitingList = LinkedList<BonsellaJoinAttack>()
|
||||
private val comboMap = linkedMapOf<BonsellaJoinAttack, View>()
|
||||
private val cacheView = SoftPool<View>(2)
|
||||
private val inflater = LayoutInflater.from(context)
|
||||
|
||||
private val handle = Handler(Looper.getMainLooper()) {
|
||||
if (it.what == 1) {
|
||||
viewOut(it.obj as? BonsellaJoinAttack, false)
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
init {
|
||||
if(isInEditMode){
|
||||
inflater.inflate(R.layout.item_bonsella_join_attack_view, this, true)
|
||||
inflater.inflate(R.layout.item_bonsella_join_attack_view, this, true)
|
||||
}
|
||||
orientation = VERTICAL
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*/
|
||||
private fun getComboChildView(): View {
|
||||
val view = cacheView.acquire {
|
||||
inflater.inflate(R.layout.item_bonsella_join_attack_view, this, false)
|
||||
}.apply {
|
||||
createViewHolder(this)
|
||||
isVisible = true
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
/**
|
||||
* add data
|
||||
*/
|
||||
fun add(bonsellaJoinAttack: BonsellaJoinAttack?) {
|
||||
//没有绑定之前不能添加
|
||||
if (!isAttachedToWindow) {
|
||||
return
|
||||
}
|
||||
if (bonsellaJoinAttack == null) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
var addToWaiting = true
|
||||
for (comboInfo in showingList) {
|
||||
if(comboInfo.sentUserid == bonsellaJoinAttack.sentUserid && comboInfo.giftId == bonsellaJoinAttack.giftId){
|
||||
comboInfo.giftNumber = bonsellaJoinAttack.giftNumber
|
||||
comboInfo.comboCount = bonsellaJoinAttack.comboCount
|
||||
comboInfo.receiverNumber = bonsellaJoinAttack.receiverNumber
|
||||
updateNum(comboInfo)
|
||||
addToWaiting = false
|
||||
}
|
||||
}
|
||||
|
||||
for (comboInfo in waitingList) {
|
||||
if(comboInfo.sentUserid == bonsellaJoinAttack.sentUserid && comboInfo.giftId == bonsellaJoinAttack.giftId){
|
||||
comboInfo.giftNumber = bonsellaJoinAttack.giftNumber
|
||||
comboInfo.comboCount = bonsellaJoinAttack.comboCount
|
||||
comboInfo.receiverNumber = bonsellaJoinAttack.receiverNumber
|
||||
addToWaiting = false
|
||||
}
|
||||
}
|
||||
|
||||
if(addToWaiting){
|
||||
waitingList.add(bonsellaJoinAttack)
|
||||
}
|
||||
|
||||
showNext()
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数量
|
||||
*/
|
||||
private fun updateNum(bonsellaJoinAttack: BonsellaJoinAttack) {
|
||||
val view = comboMap[bonsellaJoinAttack] ?: return
|
||||
val viewHolder = getViewHolder(view)
|
||||
viewHolder?.refreshNum(bonsellaJoinAttack, true)
|
||||
handle.removeMessages(1, bonsellaJoinAttack)
|
||||
handle.sendMessageDelayed(Message.obtain(handle, 1, bonsellaJoinAttack), COMBO_STAY_TIME * 1000L)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 显示下一个
|
||||
*/
|
||||
private fun showNext() {
|
||||
if(waitingList.isEmpty()){
|
||||
return
|
||||
}
|
||||
|
||||
val comboChildView = getComboChildView()
|
||||
addView(comboChildView,0)
|
||||
val giftComboInfo = waitingList.remove()
|
||||
showingList.add(giftComboInfo)
|
||||
|
||||
comboMap[giftComboInfo] = comboChildView
|
||||
val viewHolder = getViewHolder(comboChildView)
|
||||
viewHolder?.showUi(giftComboInfo)
|
||||
viewAnimationIn(comboChildView)
|
||||
|
||||
handle.sendMessageDelayed(Message.obtain(handle, 1, giftComboInfo), COMBO_STAY_TIME * 1000L)
|
||||
|
||||
if(showingList.size > MAX_SHOWING){
|
||||
handle.removeMessages(1, showingList[0])
|
||||
viewOut(showingList.remove(), true)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 移除动画
|
||||
*/
|
||||
private fun viewOut(bonsellaJoinAttack: BonsellaJoinAttack?, isDirectRemove: Boolean) {
|
||||
bonsellaJoinAttack ?: return
|
||||
val comboView = comboMap.remove(bonsellaJoinAttack) ?: return
|
||||
|
||||
val runnable = {
|
||||
val viewHolder = getViewHolder(comboView)
|
||||
viewHolder?.clear()
|
||||
if(!isDirectRemove){
|
||||
showingList.remove(bonsellaJoinAttack)
|
||||
}
|
||||
removeView(comboView)
|
||||
cacheView.release(comboView)
|
||||
showNext()
|
||||
}
|
||||
|
||||
if(isDirectRemove){
|
||||
comboView.isGone = true
|
||||
post(runnable)
|
||||
}else{
|
||||
val animOut = AnimationUtils.loadAnimation(context, R.anim.alpha_out)
|
||||
animOut.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
post(runnable)
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation?) {
|
||||
}
|
||||
})
|
||||
comboView.startAnimation(animOut)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 飞入动画
|
||||
*/
|
||||
private fun viewAnimationIn(view: View) {
|
||||
view.alpha = 1f
|
||||
val animIn = AnimationUtils.loadAnimation(context,if (UiUtils.isRtl(context)) R.anim.left_to_right else R.anim.right_to_left )
|
||||
// animIn.fillAfter = true
|
||||
// animIn.isFillEnabled = true
|
||||
view.startAnimation(animIn)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if(isInEditMode) return
|
||||
// RoomMsgManager.addCustomMsgListener(this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun onRoomCustomMsg(giftInfo: GiftMultiReceiverInfo?) {
|
||||
LogUtils.d(" GiftComboLayout onRoomCustomMsg " )
|
||||
if (giftInfo==null) return
|
||||
if (giftInfo.comboCount == 0) return
|
||||
val comboInfo = BonsellaJoinAttack().apply {
|
||||
giftId = giftInfo.giftId
|
||||
sentUserid = giftInfo.uid
|
||||
sentUserName = giftInfo.nick
|
||||
sentAvatar = giftInfo.avatar
|
||||
receiverUserName = giftInfo.targetUsers?.getOrNull(0)?.nick?:""
|
||||
receiverNumber = giftInfo.targetUsers?.size?: giftInfo.targetUids?.size?: 1
|
||||
giftNumber = giftInfo.giftNum
|
||||
giftImgUrl = giftInfo.gift?.giftUrl?:""
|
||||
comboCount = giftInfo.comboCount
|
||||
isMulti = giftInfo.isMulti
|
||||
}
|
||||
add(comboInfo)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
handle.removeCallbacksAndMessages(null)
|
||||
// RoomMsgManager.removeCustomMsgListener(this)
|
||||
}
|
||||
|
||||
private fun createViewHolder(view: View) {
|
||||
getViewHolder(view) ?: ViewHolder(view)
|
||||
}
|
||||
|
||||
private fun getViewHolder(view: View): ViewHolder? {
|
||||
return view.tag as? ViewHolder
|
||||
}
|
||||
|
||||
private inner class ViewHolder(view: View) {
|
||||
var tvNumber: AppCompatTextView = view.findViewById(R.id.giftComboNumber)
|
||||
var ivGift: ImageView = view.findViewById(R.id.giftImg)
|
||||
var tvNick: TextView = view.findViewById(R.id.sentUserName)
|
||||
var tvReceiverNick: TextView = view.findViewById(R.id.receiverUserName)
|
||||
var ivAvatar: ImageView = view.findViewById(R.id.sentUserAvatar)
|
||||
var ivLayoutBg: ImageView = view.findViewById(R.id.layoutBg)
|
||||
|
||||
init {
|
||||
view.tag = this
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun showUi(bonsellaJoinAttack: BonsellaJoinAttack) {
|
||||
if (UiUtils.isRtl(context)){
|
||||
ivLayoutBg.scaleX = -1f
|
||||
}
|
||||
|
||||
refreshNum(bonsellaJoinAttack)
|
||||
tvNick.text = bonsellaJoinAttack.sentUserName
|
||||
if (bonsellaJoinAttack.receiverNumber == 1) {
|
||||
tvReceiverNick.text = bonsellaJoinAttack.receiverUserName
|
||||
} else {
|
||||
if (bonsellaJoinAttack.isMulti) {
|
||||
tvReceiverNick.text = ResUtil.getString(R.string.Multiplayer)
|
||||
} else {
|
||||
tvReceiverNick.text = ResUtil.getString(R.string.All_mic)
|
||||
}
|
||||
}
|
||||
// tvNumber.text = "x${giftComboInfo.giftNumber * giftComboInfo.receiverNumber * giftComboInfo.comboCount}"
|
||||
ImageLoadUtils.loadImage(ivGift, bonsellaJoinAttack.giftImgUrl)
|
||||
ImageLoadUtils.loadImage(ivAvatar, bonsellaJoinAttack.sentAvatar)
|
||||
ivAvatar.tag = bonsellaJoinAttack
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于刷新数量
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun refreshNum(bonsellaJoinAttack: BonsellaJoinAttack, isAnim: Boolean = false) {
|
||||
val num = bonsellaJoinAttack.giftNumber * bonsellaJoinAttack.receiverNumber * bonsellaJoinAttack.comboCount
|
||||
if(num == 0){
|
||||
tvNumber.isVisible = false
|
||||
return
|
||||
}
|
||||
// val old = tvNumber.tag as? Int
|
||||
// //兼容上一个比下一个数还要大
|
||||
// if (old != null && old > num) {
|
||||
// return
|
||||
// }
|
||||
tvNumber.isVisible = true
|
||||
tvNumber.tag = num
|
||||
tvNumber.text = "x$num"
|
||||
if (isAnim) {
|
||||
tvNumber.animate().cancel()
|
||||
tvNumber.requestLayout()
|
||||
post {
|
||||
val scaleUp: ObjectAnimator = ObjectAnimator.ofPropertyValuesHolder(
|
||||
tvNumber,
|
||||
PropertyValuesHolder.ofFloat(SCALE_X, 1f, 1.3f, 1f),
|
||||
PropertyValuesHolder.ofFloat(SCALE_Y, 1f, 1.3f, 1f)
|
||||
)
|
||||
scaleUp.setDuration(100)
|
||||
scaleUp.start()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清空UI数据
|
||||
*/
|
||||
fun clear() {
|
||||
LogUtils.d(" ComboView clear -- clear ")
|
||||
tvNumber.animate().cancel()
|
||||
tvNumber.scaleX = 1f
|
||||
tvNumber.scaleY = 1f
|
||||
tvNumber.tag = 0
|
||||
ivAvatar.tag = null
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 最大显示个数
|
||||
*/
|
||||
const val MAX_SHOWING = 2
|
||||
|
||||
/**
|
||||
* 连击停留时间
|
||||
*/
|
||||
const val COMBO_STAY_TIME = 5
|
||||
}
|
||||
|
||||
// override fun onClick(v: View) {
|
||||
// val giftComboInfo = v.tag as? GiftComboInfo ?: return
|
||||
// val sendUid = giftComboInfo.senderUid
|
||||
// if (sendUid == 0L) {
|
||||
// return
|
||||
// }
|
||||
// RoomUserInfoDialog.show(sendUid)
|
||||
// }
|
||||
|
||||
}
|
@@ -0,0 +1,295 @@
|
||||
package com.chwl.app.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.annotation.Keep
|
||||
import com.chwl.app.R
|
||||
import com.chwl.library.utils.SizeUtils
|
||||
|
||||
class ColorfulRingProgressView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||
|
||||
private var mPercent = 0f
|
||||
|
||||
private var mStrokeWidth = 0f
|
||||
|
||||
private var mStartAngle = 0f
|
||||
|
||||
private var mFgColorStart = 0xffb900
|
||||
|
||||
private var mFgColorEnd = 0xffb900
|
||||
|
||||
private var widthDiff = 3
|
||||
|
||||
private var mBgColor = -0xa0a0b
|
||||
|
||||
private var mShader: LinearGradient? = null
|
||||
|
||||
private var mOval = RectF()
|
||||
|
||||
private val progressPaint = Paint()
|
||||
|
||||
private var mNegative = false //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>㵹<EFBFBD><E3B5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>100-0<><30>
|
||||
|
||||
private val circlePaint = Paint()
|
||||
|
||||
|
||||
|
||||
private var progressChangeListener: OnProgressChangeListener? = null
|
||||
|
||||
|
||||
|
||||
init {
|
||||
|
||||
val a = context.theme.obtainStyledAttributes(attrs, R.styleable.ColorfulRingProgressView, 0, 0)
|
||||
|
||||
try {
|
||||
|
||||
mFgColorEnd = a.getColor(R.styleable.ColorfulRingProgressView_fgColorEnd, 0xffb900)
|
||||
|
||||
mFgColorStart = a.getColor(R.styleable.ColorfulRingProgressView_fgColorStart, 0xffb900)
|
||||
|
||||
mPercent = a.getFloat(R.styleable.ColorfulRingProgressView_currentPercent, 75f)
|
||||
|
||||
mStartAngle = a.getFloat(R.styleable.ColorfulRingProgressView_ringProgress_startAngle, 0f) + 270
|
||||
|
||||
mStrokeWidth = a.getDimensionPixelSize(R.styleable.ColorfulRingProgressView_circleStrokeWidth, 21).toFloat()
|
||||
|
||||
widthDiff = a.getDimensionPixelSize(R.styleable.ColorfulRingProgressView_circle_width_diff, 3)
|
||||
|
||||
mBgColor = a.getColor(R.styleable.ColorfulRingProgressView_circle_bg_color, -0xa0a0b)
|
||||
|
||||
mNegative = a.getBoolean(R.styleable.ColorfulRingProgressView_crp_negative, false)
|
||||
|
||||
} finally {
|
||||
|
||||
a.recycle()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
progressPaint.isAntiAlias = true
|
||||
|
||||
progressPaint.style = Paint.Style.STROKE
|
||||
|
||||
progressPaint.strokeWidth = mStrokeWidth
|
||||
|
||||
progressPaint.strokeCap = Paint.Cap.ROUND
|
||||
|
||||
circlePaint.style = Paint.Style.STROKE
|
||||
|
||||
circlePaint.isAntiAlias = true
|
||||
|
||||
circlePaint.color = mBgColor
|
||||
|
||||
circlePaint.strokeWidth = mStrokeWidth + widthDiff
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
|
||||
super.onDraw(canvas)
|
||||
|
||||
|
||||
|
||||
canvas.drawCircle(
|
||||
|
||||
(mOval.right + mOval.left) / 2,
|
||||
|
||||
(mOval.bottom + mOval.top) / 2,
|
||||
|
||||
(mOval.bottom - mOval.top) / 2,
|
||||
|
||||
circlePaint
|
||||
|
||||
)
|
||||
|
||||
progressPaint.setShader(mShader)
|
||||
|
||||
if (mNegative) {
|
||||
|
||||
canvas.drawArc(mOval, mStartAngle + (100 - mPercent) * 3.6f, 360 - (100 - mPercent) * 3.6f, false, progressPaint)
|
||||
|
||||
} else {
|
||||
|
||||
canvas.drawArc(mOval, mStartAngle, mPercent * 3.6f, false, progressPaint)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
|
||||
updateOval()
|
||||
|
||||
mShader = LinearGradient(
|
||||
|
||||
mOval.left, mOval.top,
|
||||
|
||||
mOval.left, mOval.bottom, mFgColorStart, mFgColorEnd, Shader.TileMode.MIRROR
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@set:Keep
|
||||
var percent: Float
|
||||
get() = mPercent
|
||||
set(mPercent) {
|
||||
this.mPercent = mPercent
|
||||
postInvalidate()
|
||||
if (progressChangeListener != null) {
|
||||
progressChangeListener?.onProgressChange(mPercent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun setProgressChangeListener(progressChangeListener: OnProgressChangeListener?) {
|
||||
|
||||
this.progressChangeListener = progressChangeListener
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var strokeWidth: Float
|
||||
|
||||
get() = mStrokeWidth
|
||||
|
||||
set(mStrokeWidth) {
|
||||
|
||||
this.mStrokeWidth = mStrokeWidth
|
||||
|
||||
progressPaint.strokeWidth = mStrokeWidth
|
||||
|
||||
updateOval()
|
||||
|
||||
refreshTheLayout()
|
||||
|
||||
}
|
||||
private fun updateOval() {
|
||||
|
||||
val xp = paddingLeft + paddingRight
|
||||
|
||||
val yp = paddingBottom + paddingTop
|
||||
|
||||
mOval = RectF(
|
||||
|
||||
paddingLeft + mStrokeWidth, paddingTop + mStrokeWidth,
|
||||
|
||||
paddingLeft + (width - xp) - mStrokeWidth,
|
||||
|
||||
paddingTop + (height - yp) - mStrokeWidth
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun setStrokeWidthDp(dp: Float) {
|
||||
|
||||
this.mStrokeWidth = SizeUtils.dp2px(context,dp).toFloat()
|
||||
|
||||
progressPaint.strokeWidth = mStrokeWidth
|
||||
|
||||
updateOval()
|
||||
|
||||
refreshTheLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun refreshTheLayout() {
|
||||
|
||||
invalidate()
|
||||
|
||||
requestLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var fgColorStart: Int
|
||||
|
||||
get() = mFgColorStart
|
||||
|
||||
set(mFgColorStart) {
|
||||
|
||||
this.mFgColorStart = mFgColorStart
|
||||
|
||||
mShader = LinearGradient(
|
||||
|
||||
mOval.left, mOval.top,
|
||||
|
||||
mOval.left, mOval.bottom, mFgColorStart, mFgColorEnd, Shader.TileMode.MIRROR
|
||||
|
||||
)
|
||||
|
||||
refreshTheLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var fgColorEnd: Int
|
||||
|
||||
get() = mFgColorEnd
|
||||
|
||||
set(mFgColorEnd) {
|
||||
|
||||
this.mFgColorEnd = mFgColorEnd
|
||||
|
||||
mShader = LinearGradient(
|
||||
|
||||
mOval.left, mOval.top,
|
||||
|
||||
mOval.left, mOval.bottom, mFgColorStart, mFgColorEnd, Shader.TileMode.MIRROR
|
||||
|
||||
)
|
||||
|
||||
refreshTheLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var startAngle: Float
|
||||
|
||||
get() = mStartAngle
|
||||
|
||||
set(mStartAngle) {
|
||||
|
||||
this.mStartAngle = mStartAngle + 270
|
||||
|
||||
refreshTheLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun interface OnProgressChangeListener {
|
||||
|
||||
fun onProgressChange(mPercent: Float)
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -602,8 +602,10 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
|
||||
private List<GiftTab> updateTabs() {
|
||||
List<GiftTab> tabInfoList = new ArrayList<>();
|
||||
for (TagsInfo info: GiftModel.get().getTabList()) {
|
||||
tabInfoList.add(new GiftTab(swithGiftTypeToTabType(info), info.tagName(), info.tagName()));
|
||||
if (GiftModel.get().getTabList() != null) {
|
||||
for (TagsInfo info: GiftModel.get().getTabList()) {
|
||||
tabInfoList.add(new GiftTab(swithGiftTypeToTabType(info), info.tagName(), info.tagName()));
|
||||
}
|
||||
}
|
||||
return tabInfoList;
|
||||
}
|
||||
@@ -1775,4 +1777,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
void onFail();
|
||||
}
|
||||
|
||||
public void sendGift(){
|
||||
sendGiftButton.performClick();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,8 +51,7 @@ class AllServiceGiftLevelDialog : BaseDialog {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
val inflate =
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_gift_all_service_level, null)
|
||||
val inflate = LayoutInflater.from(context).inflate(R.layout.dialog_gift_all_service_level, null)
|
||||
setContentView(inflate.rootView)
|
||||
setCancelable(true)
|
||||
setCanceledOnTouchOutside(true)
|
||||
|
81
app/src/main/java/com/chwl/app/utils/GiftAnimUtil.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.chwl.app.utils;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
|
||||
public class GiftAnimUtil {
|
||||
|
||||
|
||||
public static void showAnimation(View view) {
|
||||
// 透明度从0到1
|
||||
ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha", 1f, 1f);
|
||||
fadeIn.setDuration(1000);
|
||||
|
||||
// 尺寸从0%到100%
|
||||
ObjectAnimator scaleUp = ObjectAnimator.ofPropertyValuesHolder(
|
||||
view,
|
||||
PropertyValuesHolder.ofFloat(View.SCALE_X, 0f, 1.2f,1f),
|
||||
PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f, 1.2f,1f)
|
||||
);
|
||||
scaleUp.setDuration(1000);
|
||||
|
||||
// 组合动画
|
||||
AnimatorSet appearSet = new AnimatorSet();
|
||||
appearSet.playTogether(fadeIn, scaleUp);
|
||||
|
||||
// // 设置动画结束监听器
|
||||
// appearSet.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// // 显示动画结束后触发扩展动画
|
||||
// expandAnimation(view);
|
||||
// }
|
||||
// });
|
||||
|
||||
// 开始显示动画
|
||||
appearSet.start();
|
||||
}
|
||||
|
||||
public static void expandAnimation(View view) {
|
||||
// 尺寸从100%到120%
|
||||
ObjectAnimator scaleExpand = ObjectAnimator.ofPropertyValuesHolder(
|
||||
view,
|
||||
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f,1f),
|
||||
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f,1f)
|
||||
);
|
||||
scaleExpand.setDuration(500);
|
||||
|
||||
// 循环执行3秒
|
||||
// scaleExpand.setRepeatCount(1);
|
||||
// scaleExpand.setRepeatMode(ValueAnimator.RESTART);
|
||||
// scaleExpand.setStartDelay(3000); // 确保在3秒后开始重复
|
||||
|
||||
// 设置动画结束监听器
|
||||
// scaleExpand.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// // 扩展动画结束后触发退出动画
|
||||
// fadeOutAnimation(view);
|
||||
// }
|
||||
// });
|
||||
|
||||
// 开始扩展动画
|
||||
scaleExpand.start();
|
||||
}
|
||||
|
||||
public static void fadeOutAnimation(View view) {
|
||||
// 透明度从1到0
|
||||
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f);
|
||||
fadeOut.setDuration(500);
|
||||
|
||||
// 开始退出动画
|
||||
fadeOut.start();
|
||||
}
|
||||
|
||||
}
|
108
app/src/main/java/com/chwl/app/utils/NumberUtils.kt
Normal file
@@ -0,0 +1,108 @@
|
||||
package com.chwl.app.utils
|
||||
|
||||
import java.math.RoundingMode
|
||||
import java.text.DecimalFormat
|
||||
import java.text.DecimalFormatSymbols
|
||||
import java.util.Locale
|
||||
import kotlin.math.roundToLong
|
||||
|
||||
|
||||
/**
|
||||
* @Author Vance
|
||||
* Date:2023/12/05 0005 13:59
|
||||
*/
|
||||
object NumberUtils {
|
||||
|
||||
private val df = DecimalFormat("0.##", DecimalFormatSymbols.getInstance(Locale.US))
|
||||
private val df2 = DecimalFormat("###,##0.##", DecimalFormatSymbols.getInstance(Locale.US))
|
||||
|
||||
@JvmStatic
|
||||
fun format(num:Long):String{
|
||||
return format(num.toDouble())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun format(num:Int):String{
|
||||
return format(num.toLong())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun format(num:Double):String{
|
||||
val longValue = num.roundToLong()
|
||||
return if(num < 10000){
|
||||
if(num - num.toLong() > 0){
|
||||
num.toString()
|
||||
}else {
|
||||
longValue.toString()
|
||||
}
|
||||
}else if(longValue < 1000000){
|
||||
format(longValue, "K")
|
||||
}else if(longValue < 1000000000){
|
||||
format(longValue/1000, "M")
|
||||
}else
|
||||
format(longValue/1000000, "B")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun format(numOfK:Long, suffix:String, roundUp:Boolean = true):String{
|
||||
df.roundingMode = if(roundUp) RoundingMode.HALF_UP else RoundingMode.DOWN
|
||||
return df.format(numOfK/1000.0)+suffix
|
||||
}
|
||||
|
||||
/**
|
||||
* 用逗号分隔
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun formatCommaSplit(number:Double, roundUp:Boolean = true):String {
|
||||
df.roundingMode = if(roundUp) RoundingMode.HALF_UP else RoundingMode.DOWN
|
||||
return df2.format(number)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun formatCommaSplit(number:Long):String {
|
||||
return df2.format(number)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun parseLong(str:String?, def:Long = 0):Long{
|
||||
if(str.isNullOrEmpty()){
|
||||
return def
|
||||
}
|
||||
|
||||
return try {
|
||||
str.toLong()
|
||||
} catch (e: Exception) {
|
||||
return def
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun parseInt(str:String?, def:Int = 0):Int{
|
||||
if(str.isNullOrEmpty()){
|
||||
return def
|
||||
}
|
||||
|
||||
return try {
|
||||
str.toInt()
|
||||
} catch (e: Exception) {
|
||||
return def
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun parseDouble(str:String?, def:Double = 0.0):Double{
|
||||
if(str.isNullOrEmpty()){
|
||||
return def
|
||||
}
|
||||
|
||||
return try {
|
||||
str.toDouble()
|
||||
} catch (e: Exception) {
|
||||
return def
|
||||
}
|
||||
}
|
||||
}
|
62
app/src/main/java/com/chwl/app/utils/WeakPool.kt
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.chwl.app.utils
|
||||
|
||||
import androidx.core.util.Pools.Pool
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.LinkedList
|
||||
|
||||
/**
|
||||
* @Author Vance
|
||||
* Date:2023/12/22 0022 14:26
|
||||
*/
|
||||
class WeakPool<T : Any>(private var maxPoolSize: Int):Pool<T> {
|
||||
|
||||
init {
|
||||
if(maxPoolSize <= 0){
|
||||
maxPoolSize = 8
|
||||
}
|
||||
}
|
||||
|
||||
private var mPool = LinkedList<WeakReference<T>>()
|
||||
|
||||
fun acquire(getIfEmpty :()->T): T {
|
||||
return acquire() ?: getIfEmpty()
|
||||
}
|
||||
|
||||
override fun acquire(): T? {
|
||||
if (mPool.size == 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
while (true){
|
||||
val item = mPool.poll() ?: return null
|
||||
if(item.get() != null){
|
||||
return item.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun release(instance: T): Boolean {
|
||||
if(mPool.size > maxPoolSize){
|
||||
if(getRealSize() > maxPoolSize){
|
||||
return false
|
||||
}
|
||||
}
|
||||
mPool.addFirst(WeakReference(instance))
|
||||
return true
|
||||
}
|
||||
|
||||
private fun getRealSize():Int{
|
||||
val iterator = mPool.listIterator()
|
||||
while (iterator.hasNext()){
|
||||
val item = iterator.next().get()
|
||||
if(item == null){
|
||||
iterator.remove()
|
||||
}
|
||||
}
|
||||
return mPool.size
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
mPool.clear()
|
||||
}
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:duration="200"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0" />
|
||||
</set>
|
||||
|
7
app/src/main/res/anim/left_to_right.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="100"
|
||||
android:fromXDelta="-100%p"
|
||||
android:toXDelta="0"/>
|
||||
</set>
|
7
app/src/main/res/anim/right_to_left.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="100"
|
||||
android:fromXDelta="100%p"
|
||||
android:toXDelta="0"/>
|
||||
</set>
|
9
app/src/main/res/anim/scale_number.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:duration="500"
|
||||
android:fromXScale="1.3"
|
||||
android:fromYScale="1.3"
|
||||
android:toXScale="1"
|
||||
android:toYScale="1"/>
|
||||
</set>
|
BIN
app/src/main/res/drawable-xxhdpi/all_service_gift_bg_luck.webp
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/drawable-xxhdpi/all_service_gift_bg_luck_2.webp
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/bg_lucky_gift_tip.webp
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-xxhdpi/bg_lucky_gift_tip_2.webp
Normal file
After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_coin_21.webp
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_coin_32.webp
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_coin_42.webp
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_coin_63.webp
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_coin_84.webp
Normal file
After Width: | Height: | Size: 7.9 KiB |
5
app/src/main/res/drawable/bg_circle_white.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="50dp" />
|
||||
</shape>
|
@@ -101,12 +101,14 @@
|
||||
app:layout_constraintDimensionRatio="345:48"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvMyDiamond">
|
||||
|
||||
<ImageView
|
||||
<com.chwl.app.common.widget.CircleImageView
|
||||
android:id="@+id/iv_coins"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_9"
|
||||
android:src="@drawable/convert_ic_coins"
|
||||
android:src="@drawable/ic_coin_84"
|
||||
android:padding="4dp"
|
||||
android:background="@drawable/bg_circle_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHeight_percent="0.58"
|
||||
|
@@ -54,7 +54,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_charge_diamond"
|
||||
android:drawableStart="@drawable/ic_coin_63"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
|
@@ -221,7 +221,7 @@
|
||||
android:id="@+id/tv_icon"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:src="@drawable/vip_center_purchase_coin"
|
||||
android:src="@drawable/ic_coin_63"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
<TextView
|
||||
|
@@ -495,7 +495,7 @@
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/ic_gift_diamond" />
|
||||
android:src="@drawable/ic_coin_21" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_plus"
|
||||
|
@@ -168,6 +168,36 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<com.chwl.app.ui.widget.BonsellaJoinAttackLayout
|
||||
android:id="@+id/giftComboLayout"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.chwl.app.ui.widget.BonsellaJoinAttackButtonView
|
||||
android:id="@+id/giftComboBtn"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_width="100dp"
|
||||
tools:layout_height="100dp"
|
||||
tools:background="@color/appColor"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="26dp"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_lucky_gift_notify_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="25dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
@@ -178,6 +178,7 @@
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- //todo game btn -->
|
||||
<ImageView
|
||||
android:onClick="@{click}"
|
||||
android:id="@+id/iv_game"
|
||||
|
@@ -257,7 +257,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:visibility="visible">
|
||||
tools:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
105
app/src/main/res/layout/item_bonsella_join_attack_view.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginStart="@dimen/dp_16">
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/layoutBg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
android:background="@mipmap/bg_item_gift_combo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.chwl.app.common.widget.CircleImageView
|
||||
android:id="@+id/sentUserAvatar"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/layoutBg"
|
||||
app:layout_constraintStart_toStartOf="@+id/layoutBg"
|
||||
app:layout_constraintTop_toTopOf="@+id/layoutBg"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sentUserName"
|
||||
android:layout_width="@dimen/dp_66"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ffdd5d"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@+id/sentUserAvatar"
|
||||
app:layout_constraintTop_toTopOf="@+id/sentUserAvatar"
|
||||
app:layout_constraintWidth_max="@dimen/dp_79"
|
||||
tools:text="sentUserName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sendTips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/send"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sentUserAvatar"
|
||||
app:layout_constraintStart_toStartOf="@+id/sentUserName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/receiverUserName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ffdd5d"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sendTips"
|
||||
app:layout_constraintStart_toEndOf="@+id/sendTips"
|
||||
app:layout_constraintWidth_max="60dp"
|
||||
tools:text="receiverUserName" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="end"
|
||||
tools:visibility="visible"
|
||||
app:constraint_referenced_ids="sentUserName,receiverUserName" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/giftImg"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/barrier"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/giftComboNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:shadowColor="#ff9900"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="3.0"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffe07b"
|
||||
android:textStyle="bold"
|
||||
android:textSize="36sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sentUserAvatar"
|
||||
app:layout_constraintStart_toEndOf="@+id/giftImg"
|
||||
app:layout_constraintTop_toTopOf="@id/sentUserAvatar"
|
||||
tools:text="x1111111" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -1,6 +1,7 @@
|
||||
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
@@ -43,6 +44,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="60dp"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone">
|
||||
|
||||
<FrameLayout
|
||||
|
@@ -0,0 +1,75 @@
|
||||
<?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:id="@+id/rootView"
|
||||
android:layout_width="@dimen/dp_162"
|
||||
android:layout_height="@dimen/dp_162"
|
||||
android:layout_gravity="top|center"
|
||||
android:layout_marginTop="@dimen/dp_110"
|
||||
android:background="@drawable/bg_lucky_gift_tip"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/win"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coinNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/dp_6"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:shadowColor="#ffa40e00"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="3.0"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
app:drawableStartCompat="@drawable/ic_coin_63"
|
||||
tools:text="666.52K" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/win"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/winNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="13sp"
|
||||
tools:text="500" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/times"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/time"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -66,7 +66,7 @@
|
||||
android:textColor="#ffc400"
|
||||
android:textSize="12dp"
|
||||
android:drawablePadding="5dp"
|
||||
android:drawableEnd="@drawable/icon_auction_corn"
|
||||
android:drawableEnd="@drawable/ic_coin_63"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
@@ -90,7 +90,7 @@
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:src="@drawable/ic_gift_diamond"
|
||||
android:src="@drawable/ic_coin_32"
|
||||
android:visibility="@{item.isFreeGift ? View.GONE : View.VISIBLE}" />
|
||||
</LinearLayout>
|
||||
|
||||
|
168
app/src/main/res/layout/room_notify_luck_gift_dlg.xml
Normal file
@@ -0,0 +1,168 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_width="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_82"
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="@drawable/all_service_gift_bg_luck"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bg2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/bg"
|
||||
android:src="@drawable/all_service_gift_bg_luck_2"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bg"
|
||||
android:layout_width="@dimen/dp_82"
|
||||
android:layout_height="@dimen/dp_82"/>
|
||||
|
||||
|
||||
<com.chwl.app.common.widget.CircleImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/dp_43"
|
||||
android:layout_height="@dimen/dp_43"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/bg"
|
||||
app:riv_border_color="#FFE375"
|
||||
app:riv_border_width="1dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/send"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/giftName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_3"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/send"
|
||||
app:layout_constraintTop_toTopOf="@id/send"
|
||||
app:layout_constraintBottom_toBottomOf="@id/send"
|
||||
tools:text="Lucky travel" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/win"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="@id/send" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/winNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/win"
|
||||
app:layout_constraintTop_toTopOf="@id/win"
|
||||
app:layout_constraintBottom_toBottomOf="@id/win"
|
||||
tools:text="500" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/times"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/time"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@id/winNum"
|
||||
app:layout_constraintBottom_toBottomOf="@id/winNum"
|
||||
app:layout_constraintTop_toTopOf="@id/win" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
app:barrierDirection="end"
|
||||
app:constraint_referenced_ids="giftName,times" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coinNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/dp_45"
|
||||
android:includeFontPadding="false"
|
||||
android:shadowColor="#ffa40e00"
|
||||
android:layout_marginTop="@dimen/dp_3"
|
||||
android:shadowDx="0"
|
||||
android:gravity="center_horizontal"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="3.0"
|
||||
android:textColor="#ffffe375"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="@+id/bg2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/bg2"
|
||||
app:layout_constraintTop_toTopOf="@+id/bg2"
|
||||
app:layout_constraintBottom_toTopOf="@id/coins"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="1000k" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coins"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/avroom_widget_messageview_027"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/coinNum"
|
||||
app:layout_constraintStart_toStartOf="@id/coinNum"
|
||||
app:layout_constraintTop_toBottomOf="@id/coinNum"
|
||||
app:layout_constraintBottom_toBottomOf="@id/bg2"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/clickArea"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="@id/bg"
|
||||
tools:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@id/bg"
|
||||
app:layout_constraintWidth_max="375dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/bg"
|
||||
app:layout_constraintTop_toTopOf="@id/bg" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
97
app/src/main/res/layout/view_bonsella_join_attack_button.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge 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/vg_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="306dp"
|
||||
android:clickable="true"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:focusable="true"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<com.chwl.library.widget.SVGAView
|
||||
android:id="@+id/svga"
|
||||
android:layout_width="136dp"
|
||||
android:layout_height="306dp"
|
||||
android:layout_gravity="bottom|center"
|
||||
app:autoPlay="true"
|
||||
app:loopCount="1"
|
||||
app:fillMode="Backward"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:source="svga/Combo_Boom.svga" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_bg"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:alpha="0"
|
||||
android:src="@color/transparent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_btn"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:layout_gravity="bottom|center" />
|
||||
|
||||
<com.chwl.app.ui.widget.ColorfulRingProgressView
|
||||
android:id="@+id/pv_bg"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_gravity="bottom|center"
|
||||
app:circleStrokeWidth="5dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
app:circle_bg_color="@color/transparent"
|
||||
app:circle_width_diff="0dp"
|
||||
app:currentPercent="50"
|
||||
app:fgColorEnd="#04d5c6"
|
||||
app:fgColorStart="#04d5c6" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_text"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:text="Combo"
|
||||
android:shadowColor="#ff9900"
|
||||
android:shadowDx="0"
|
||||
android:textSize="13sp"
|
||||
android:shadowDy="1"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:shadowRadius="3.0"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffe07b"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="bottom|center" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:rotation="-45"
|
||||
android:layout_marginBottom="89dp"
|
||||
android:layout_marginEnd="118dp"
|
||||
android:shadowColor="#ff9900"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="3.0"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffe07b"
|
||||
android:textStyle="bold"
|
||||
android:textSize="30sp"
|
||||
tools:text="X15" />
|
||||
</merge>
|
@@ -22,7 +22,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:src="@drawable/wallet_ic_coins"
|
||||
android:src="@drawable/ic_coin_84"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_bg"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_bg"
|
||||
|
BIN
app/src/main/res/mipmap-xxhdpi/bg_item_gift_combo.png
Normal file
After Width: | Height: | Size: 24 KiB |
@@ -5353,4 +5353,7 @@
|
||||
<string name="vip_center_7">التجديد</string>
|
||||
<string name="vip_center_8">لم يتم الحصول على VIP</string>
|
||||
<string name="vip_center_9">VIP %s فقط من خلال النشاط</string>
|
||||
<string name="All_mic">جميع الميكروفونات</string>
|
||||
<string name="changeRoomTips">هل أنت متأكد أنك تريد الذهاب إلى هذه الغرفة؟</string>
|
||||
<string name="Multiplayer">متعدد اللاعبين</string>
|
||||
</resources>
|
@@ -4927,7 +4927,7 @@
|
||||
<string name="settleable_gold_coin">可結算鑽石</string>
|
||||
<string name="please_input_withdraw_gold">請輸入提現鑽石</string>
|
||||
<string name="all">全部</string>
|
||||
<string name="time">次</string>
|
||||
<string name="time">倍</string>
|
||||
<string name="empty_data">暫無數據</string>
|
||||
<string name="select_area_code">選擇區号</string>
|
||||
<string name="login_input_code">輸入驗證碼</string>
|
||||
@@ -5294,5 +5294,8 @@
|
||||
<string name="vip_center_7">更新</string>
|
||||
<string name="vip_center_8">未取得 VIP</string>
|
||||
<string name="vip_center_9">VIP %s 僅透過活動獲得</string>
|
||||
<string name="All_mic">所有麥</string>
|
||||
<string name="changeRoomTips">你確定要去這個房間嗎?</string>
|
||||
<string name="Multiplayer">多人</string>
|
||||
|
||||
</resources>
|
@@ -436,4 +436,15 @@
|
||||
<attr name="shadowTop" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="ColorfulRingProgressView">
|
||||
<attr name="fgColorStart" format="color" />
|
||||
<attr name="fgColorEnd" format="color" />
|
||||
<attr name="circleStrokeWidth" format="dimension" />
|
||||
<attr name="currentPercent" format="float" />
|
||||
<attr name="ringProgress_startAngle" format="float" />
|
||||
<attr name="circle_width_diff" format="dimension" />
|
||||
<attr name="circle_bg_color" format="color" />
|
||||
<attr name="crp_negative" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
@@ -4909,7 +4909,7 @@
|
||||
<string name="settleable_gold_coin">Settleable Diamonds</string>
|
||||
<string name="please_input_withdraw_gold">Please enter the amount of diamonds to withdraw</string>
|
||||
<string name="all">All</string>
|
||||
<string name="time">Times</string>
|
||||
<string name="time">times</string>
|
||||
<string name="empty_data">No Data</string>
|
||||
<string name="select_area_code">Select Area Code</string>
|
||||
<string name="login_input_code">Enter Verification Code</string>
|
||||
@@ -5334,6 +5334,10 @@ You cannot join again within 24 hours after leaving</string>
|
||||
<string name="vip_center_8">Not obtained VIP</string>
|
||||
<string name="vip_center_9">VIP %s is only through activity</string>
|
||||
|
||||
<string name="All_mic">All mic</string>
|
||||
<string name="Multiplayer">Multiplayer</string>
|
||||
<string name="changeRoomTips">Are you sure you want to go to this room?</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
@@ -111,7 +111,7 @@
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:src="@drawable/game_ic_coins" />
|
||||
android:src="@drawable/ic_coin_84" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.chwl.app.game.ui.game.widgets.message.GameMessageWidget
|
||||
|
@@ -67,7 +67,7 @@
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginEnd="@dimen/dp_6"
|
||||
android:src="@drawable/game_ic_coins"
|
||||
android:src="@drawable/ic_coin_84"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_coins_bg"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_coins"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
|
@@ -67,7 +67,7 @@
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:src="@drawable/game_ic_coins" />
|
||||
android:src="@drawable/ic_coin_84" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_wallet_value"
|
||||
|
@@ -85,7 +85,7 @@
|
||||
android:id="@+id/iv_coins"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:src="@drawable/game_ic_coins"
|
||||
android:src="@drawable/ic_coin_84"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_coins"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@@ -16,6 +16,7 @@ import com.chwl.core.gift.bean.GiftPanelInfo;
|
||||
import com.chwl.core.gift.bean.TagsInfo;
|
||||
import com.chwl.core.home.bean.TabInfo;
|
||||
import com.chwl.core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.chwl.core.utils.ComboUtil;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
@@ -124,7 +125,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
private void addGiftMessage(CustomAttachment attachment) {
|
||||
giftQueue.add(attachment);
|
||||
if (giftQueue.size() == 1) {
|
||||
handler.sendEmptyMessageDelayed(0, 150);
|
||||
handler.sendEmptyMessageDelayed(0, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,6 +440,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
if (giftId != giftMultiReceiverInfo.getGiftId()) {
|
||||
return Single.error(RxHelper.createThrowable(serviceResult));
|
||||
}
|
||||
giftMultiReceiverInfo.setComboCount(ComboUtil.INSTANCE.getComboCount());
|
||||
switch (sendType) {
|
||||
case GiftSendType.TYPE_ANCHOR:
|
||||
case GiftSendType.TYPE_MIC:
|
||||
@@ -493,6 +495,8 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||
return Single.error(new RadishNotEnoughException(serviceResult.getMessage()));
|
||||
}
|
||||
|
||||
|
||||
return Single.error(RxHelper.createThrowable(serviceResult));
|
||||
}
|
||||
});
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
public class BonsellaJoinAttack {
|
||||
public long sentUserid;
|
||||
public String sentUserName;
|
||||
public String sentAvatar;
|
||||
public String giftImgUrl;
|
||||
public int giftId;
|
||||
public int giftNumber;
|
||||
public int receiverNumber;
|
||||
public String receiverUserName;
|
||||
public int comboCount;
|
||||
public boolean isMulti;
|
||||
|
||||
}
|
@@ -109,6 +109,8 @@ public class GiftInfo implements Serializable {
|
||||
|
||||
private I18N i18nGiftNameMap;
|
||||
|
||||
public long uid = -1; // combo
|
||||
|
||||
public String getFirstGiftName() {
|
||||
return I18N.getFirstOrDefault(i18nGiftNameMap, giftName);
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ public class GiftMultiReceiverInfo implements Serializable {
|
||||
private List<GiftReceiver> targetUsers;
|
||||
private int giftId;
|
||||
private int giftNum;
|
||||
private int comboCount;
|
||||
private GiftInfo gift;
|
||||
private List<GiftInfo> displayGift;
|
||||
private List<IndexGiftValue> giftValueVos;
|
||||
@@ -28,4 +29,5 @@ public class GiftMultiReceiverInfo implements Serializable {
|
||||
private List<Long> targetUids;
|
||||
private LuckyGiftList luckyGiftList;
|
||||
private WalletInfo userPurse;
|
||||
public boolean isMulti;
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ public class GiftReceiveInfo implements Serializable {
|
||||
private long targetUid;
|
||||
private int giftId;
|
||||
private int giftNum;
|
||||
private int comboCount;
|
||||
private String targetNick;
|
||||
private String targetAvatar;
|
||||
private String nick;
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package com.chwl.core.gift.bean
|
||||
|
||||
import com.chwl.core.bean.I18N
|
||||
|
||||
//{"data":{"times":"0","sender":{"avatar":"https://img.molistar.xyz/default_avatar_molistar.png",
|
||||
// "erbanNo":6247036,"gender":1,"nick":"测试","uid":3232},"coins":"99",
|
||||
// "giftNameMap":{"ar":"魔力水晶鞋","en":"魔力水晶鞋","zh":"魔力水晶鞋"}},"first":106,"second":1063}
|
||||
data class LuckyGiftMsgAllBean(
|
||||
var roomUid: Long = 0,
|
||||
var sender: Sender? = null,
|
||||
var giftNameMap: I18N?=null,
|
||||
var times: Int = 0,
|
||||
var coins: Int = 0
|
||||
)
|
@@ -0,0 +1,10 @@
|
||||
package com.chwl.core.gift.bean
|
||||
|
||||
//{"data":{"uid":3128,"times":"0","coins":"5","level":1,"roomUid":3133,"roomId":6066081032},"first":106,"second":1062}
|
||||
data class LuckyGiftMsgSelfBean(
|
||||
var roomUid: Long = 0,
|
||||
var roomId: Long = 0,
|
||||
var uid: Long = 0,
|
||||
var times: Int = 0,
|
||||
var level: Int = 0,
|
||||
var coins: Int = 0)
|
@@ -0,0 +1,6 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
public class MsgSuperLuckyGift {
|
||||
public LuckyGiftMsgSelfBean luckyGiftMsgSelfBean;
|
||||
public LuckyGiftMsgAllBean luckyGiftMsgAllBean;
|
||||
}
|
@@ -18,6 +18,7 @@ public class MultiGiftReceiveInfo implements Serializable {
|
||||
private List<GiftReceiver> targetUsers;
|
||||
private int giftId;
|
||||
private int giftNum;
|
||||
private int comboCount;
|
||||
private String nick;
|
||||
private String avatar;
|
||||
private GiftInfo gift;
|
||||
|
9
core/src/main/java/com/chwl/core/gift/bean/Sender.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
public class Sender {
|
||||
public String avatar;
|
||||
public String nick;
|
||||
public long erbanNo;
|
||||
public long uid;
|
||||
public int gender;
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.chwl.core.gift.event;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
//处理 礼物联机相关消息
|
||||
@Data
|
||||
public class GiftComboEvent {
|
||||
private int action ;
|
||||
|
||||
private int giftNumber;
|
||||
|
||||
|
||||
public int getGiftNumber() {
|
||||
return giftNumber;
|
||||
}
|
||||
|
||||
public void setGiftNumber(int giftNumber) {
|
||||
this.giftNumber = giftNumber;
|
||||
}
|
||||
|
||||
public GiftComboEvent() {
|
||||
}
|
||||
|
||||
public GiftComboEvent(int action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(int action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public @interface Action{
|
||||
int ACT_GIFT_BEGIN = 1; //准备送礼
|
||||
int ACT_GIFT_END = 2; //送礼完毕 显示连击按钮
|
||||
int ACT_GIFT_START = 3; // 连击按钮点击 发送礼物
|
||||
int ACT_GIFT_SHOW = 4; // 连击按钮消失 通知显示礼物弹窗
|
||||
int ACT_GIFT_CANCEL = 5; // 连击按钮消失
|
||||
int ACT_GIFT_POINT = 6; // 连击按钮消失
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
package com.chwl.core.gift.toolbox;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.chwl.core.gift.bean.GiftType;
|
||||
import com.google.gson.Gson;
|
||||
@@ -103,26 +104,66 @@ public class GiftToolbox {
|
||||
//礼物值
|
||||
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
|
||||
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
|
||||
giftReceiveInfo.setComboCount(giftMultiReceiverInfo.getComboCount());
|
||||
return giftReceiveInfo;
|
||||
}
|
||||
|
||||
public static GiftMultiReceiverInfo transformToGiftMultiReceiverInfo(MultiGiftReceiveInfo multiGiftReceiveInfo) {
|
||||
GiftMultiReceiverInfo giftMultiReceiverInfo = new GiftMultiReceiverInfo();
|
||||
try {
|
||||
giftMultiReceiverInfo.setUid(multiGiftReceiveInfo.getUid());
|
||||
giftMultiReceiverInfo.setAvatar(multiGiftReceiveInfo.getAvatar());
|
||||
giftMultiReceiverInfo.setNick(multiGiftReceiveInfo.getNick());
|
||||
giftMultiReceiverInfo.setGiftId(multiGiftReceiveInfo.getGiftId());
|
||||
giftMultiReceiverInfo.setGiftNum(multiGiftReceiveInfo.getGiftNum());
|
||||
giftMultiReceiverInfo.setGift(multiGiftReceiveInfo.getGift());
|
||||
giftMultiReceiverInfo.setLuckyBagGifts(multiGiftReceiveInfo.getLuckyBagGifts());
|
||||
giftMultiReceiverInfo.setDisplayGift(multiGiftReceiveInfo.getDisplayGift());
|
||||
giftMultiReceiverInfo.setTargetUsers(multiGiftReceiveInfo.getTargetUsers());
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
if (multiGiftReceiveInfo.getTargetUsers() != null){
|
||||
for (GiftReceiver targetUser : multiGiftReceiveInfo.getTargetUsers()) {
|
||||
targetUids.add(targetUser.getUid());
|
||||
}
|
||||
}else {
|
||||
if (multiGiftReceiveInfo.getTargetUids() != null) {
|
||||
targetUids.addAll(multiGiftReceiveInfo.getTargetUids());
|
||||
}
|
||||
}
|
||||
giftMultiReceiverInfo.setTargetUids(targetUids);
|
||||
//礼物值
|
||||
giftMultiReceiverInfo.setGiftValueVos(multiGiftReceiveInfo.getGiftValueVos());
|
||||
giftMultiReceiverInfo.setCurrentTime(multiGiftReceiveInfo.getCurrentTime());
|
||||
giftMultiReceiverInfo.setComboCount(multiGiftReceiveInfo.getComboCount());
|
||||
} catch (Exception e) {
|
||||
LogUtil.e( "ComboError : "+e.getMessage());
|
||||
}
|
||||
return giftMultiReceiverInfo;
|
||||
}
|
||||
|
||||
|
||||
public static GiftMultiReceiverInfo transformToGiftMultiReceiverInfo(GiftReceiveInfo giftReceiveInfo) {
|
||||
GiftMultiReceiverInfo giftMultiReceiverInfo = new GiftMultiReceiverInfo();
|
||||
giftMultiReceiverInfo.setUid(giftReceiveInfo.getUid());
|
||||
giftMultiReceiverInfo.setNick(giftReceiveInfo.getNick());
|
||||
giftMultiReceiverInfo.setAvatar(giftMultiReceiverInfo.getAvatar());
|
||||
giftMultiReceiverInfo.setGift(giftReceiveInfo.getGift());
|
||||
giftMultiReceiverInfo.setGiftId(giftReceiveInfo.getGiftId());
|
||||
giftMultiReceiverInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
|
||||
giftMultiReceiverInfo.setLuckyBagGifts(giftReceiveInfo.getLuckyBagGifts());
|
||||
giftMultiReceiverInfo.setDisplayGift(giftReceiveInfo.getDisplayGift());
|
||||
List<GiftReceiver> targetUsers = new ArrayList<>();
|
||||
GiftReceiver receiver = new GiftReceiver();
|
||||
receiver.setUid(giftReceiveInfo.getTargetUid());
|
||||
receiver.setNick(giftReceiveInfo.getTargetNick());
|
||||
receiver.setAvatar(giftMultiReceiverInfo.getAvatar());
|
||||
targetUsers.add(receiver);
|
||||
giftMultiReceiverInfo.setTargetUsers(targetUsers);
|
||||
try {
|
||||
giftMultiReceiverInfo.setUid(giftReceiveInfo.getUid());
|
||||
giftMultiReceiverInfo.setNick(giftReceiveInfo.getNick());
|
||||
giftMultiReceiverInfo.setAvatar(giftReceiveInfo.getAvatar());
|
||||
giftMultiReceiverInfo.setGift(giftReceiveInfo.getGift());
|
||||
giftMultiReceiverInfo.setGiftId(giftReceiveInfo.getGiftId());
|
||||
giftMultiReceiverInfo.setGiftNum(giftReceiveInfo.getGiftNum());
|
||||
giftMultiReceiverInfo.setLuckyBagGifts(giftReceiveInfo.getLuckyBagGifts());
|
||||
giftMultiReceiverInfo.setDisplayGift(giftReceiveInfo.getDisplayGift());
|
||||
giftMultiReceiverInfo.setComboCount(giftReceiveInfo.getComboCount());
|
||||
List<GiftReceiver> targetUsers = new ArrayList<>();
|
||||
GiftReceiver receiver = new GiftReceiver();
|
||||
receiver.setUid(giftReceiveInfo.getTargetUid());
|
||||
receiver.setNick(giftReceiveInfo.getTargetNick());
|
||||
receiver.setAvatar(giftReceiveInfo.getTargetAvatar());
|
||||
targetUsers.add(receiver);
|
||||
giftMultiReceiverInfo.setTargetUsers(targetUsers);
|
||||
} catch (Exception e) {
|
||||
LogUtil.e( "ComboError : "+e.getMessage());
|
||||
}
|
||||
return giftMultiReceiverInfo;
|
||||
}
|
||||
|
||||
@@ -144,9 +185,12 @@ public class GiftToolbox {
|
||||
giftReceiveInfo.setDisplayGift(giftMultiReceiverInfo.getDisplayGift());
|
||||
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
|
||||
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
|
||||
giftReceiveInfo.setComboCount(giftMultiReceiverInfo.getComboCount());
|
||||
return giftReceiveInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 转换 ServiceResult<GiftMultiReceiverInfo> 成 ServiceResult<GiftReceiveInfo>
|
||||
*/
|
||||
|
@@ -1,104 +1,6 @@
|
||||
package com.chwl.core.im.custom.bean;
|
||||
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_BAN_DELETE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_PASS;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_UNREADCOUNT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_CAR;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_ROOM_PK;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ASSISTANT_COMMON_MSG;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ASSISTANT_MSG;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHARM_LEVEL_UP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_ASK;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_DROP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_INIT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CLAN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAW_GIFT_EFFECT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP_NOTICE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_CREATE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DISMISS;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_INVITE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_APPLY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DEAL_APPLY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DEAL_INVITE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_REMOVE_MEMBER;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_SET_MANAGER;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_MEMBER_COUNT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_ROOM_NOTIFY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_TOPIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_ROOM_JOIN_NOTICE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_KICK_MIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEAD_SHIFT_OUT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_TIP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE_NOTICE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEVEL_UP;
|
||||
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_ROOM_NOTIFY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MENTORING_RELATIONSHIP;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MINI_WORLD;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MODULE_HALL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_PUBLIC_CHAT_HALL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_QUEUING_MIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RADISH;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_GIFT_VALUE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_FAMILY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_MINI_WORLD;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_ROOM;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_TEAM;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SIGN_IN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CLANAPPLY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CLANNORMAL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FAIRY_ASK_FOR;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FAIRY_SEND;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_APPLY_EXIT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_APPLY_JOIN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_MANAGER_INVITE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_NOTICE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_TO_BE_OWNER;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUBLIC_CHAT_HALL_AIT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUBLIC_CHAT_HALL_AIT_ME;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUBLIC_CHAT_HALL_FULL_SCREEN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUBLIC_CHAT_HALL_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_DIAMOND;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_DIAMOND2;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_MSG;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_DRAW_GIFT_EFFECT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ADD_BLACK;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_KICK_ROOM;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_MONEY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_MAGIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_SINGLE_MAGIC;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_AUDIO;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLEAN_SCREEN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_REDPACKAGE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_SCREEN;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_NOTICE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_HEAD;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_SUB_HEART;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_SUB_HELLO;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_SUB_TO_RECORDING;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_SUB_tO_MATCHING;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_ATTACK;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.ROOM_FREE_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.ROOM_FREE_GIFT_CHANGE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.ROOM_FREE_GIFT_REST;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.*;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -689,6 +591,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
||||
case CustomAttachment.CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE:
|
||||
if (second == CustomAttachment.CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE_SUB) {
|
||||
attachment = new TemplateMessageAttachment(first, second);
|
||||
}else if (second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ROOM
|
||||
|| second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ALL
|
||||
|| second == CUSTOM_MSG_SUPER_LUCKY_GIFT_SELF){
|
||||
attachment = new LuckyGiftNotifyAttachment(first,second);
|
||||
}
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_CRAZY_ZOO:
|
||||
|
@@ -499,6 +499,10 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE = 106;
|
||||
public static final int CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE_SUB = 1061;
|
||||
|
||||
public static final int CUSTOM_MSG_SUPER_LUCKY_GIFT_ROOM = 1063;// 幸运礼物 中奖 飘屏 单房间
|
||||
public static final int CUSTOM_MSG_SUPER_LUCKY_GIFT_ALL = 1063;// 幸运礼物 中奖 飘屏 全服
|
||||
public static final int CUSTOM_MSG_SUPER_LUCKY_GIFT_SELF = 1062;// 幸运礼物 中奖 提示弹窗
|
||||
|
||||
|
||||
// 头条-更新
|
||||
public static final int CUSTOM_MSG_HEADLINE_CHANGED = 108;
|
||||
|
@@ -50,6 +50,7 @@ public class GiftAttachment extends CustomAttachment {
|
||||
giftReceiveInfo.setNick(data.getString("nick"));
|
||||
giftReceiveInfo.setTargetUid(data.getLong("targetUid"));
|
||||
giftReceiveInfo.setGiftNum(data.getIntValue("giftNum"));
|
||||
giftReceiveInfo.setComboCount(data.getIntValue("comboCount"));
|
||||
giftReceiveInfo.setTargetNick(data.getString("targetNick"));
|
||||
giftReceiveInfo.setTargetAvatar(data.getString("targetAvatar"));
|
||||
if (data.containsKey("isRoomAlbum")) {
|
||||
@@ -92,6 +93,7 @@ public class GiftAttachment extends CustomAttachment {
|
||||
object.put("nick", giftReceiveInfo.getNick());
|
||||
object.put("targetUid", giftReceiveInfo.getTargetUid());
|
||||
object.put("giftNum", giftReceiveInfo.getGiftNum());
|
||||
object.put("comboCount", giftReceiveInfo.getComboCount());
|
||||
object.put("targetNick", giftReceiveInfo.getTargetNick());
|
||||
object.put("targetAvatar", giftReceiveInfo.getTargetAvatar());
|
||||
object.put("giftInfo", giftReceiveInfo.getGift());
|
||||
|
@@ -46,6 +46,7 @@ public class GiftBatchAttachment extends CustomAttachment {
|
||||
new TypeReference<List<GiftReceiver>>() {
|
||||
}));
|
||||
giftMultiReceiverInfo.setGiftNum(data.getIntValue("giftNum"));
|
||||
giftMultiReceiverInfo.setComboCount(data.getIntValue("comboCount"));
|
||||
JSONObject giftJson = null;
|
||||
if (data.containsKey("gift")) {
|
||||
giftJson = data.getJSONObject("gift");
|
||||
@@ -81,6 +82,7 @@ public class GiftBatchAttachment extends CustomAttachment {
|
||||
object.put("nick", giftMultiReceiverInfo.getNick());
|
||||
object.put("targetUsers", giftMultiReceiverInfo.getTargetUsers());
|
||||
object.put("giftNum", giftMultiReceiverInfo.getGiftNum());
|
||||
object.put("comboCount", giftMultiReceiverInfo.getComboCount());
|
||||
object.put("gift", giftMultiReceiverInfo.getGift());
|
||||
//礼物值
|
||||
if (giftMultiReceiverInfo.getGiftValueVos() != null) {
|
||||
|
@@ -0,0 +1,42 @@
|
||||
package com.chwl.core.im.custom.bean
|
||||
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.chwl.core.gift.bean.LuckyGiftMsgAllBean
|
||||
import com.chwl.core.gift.bean.LuckyGiftMsgSelfBean
|
||||
import com.google.gson.Gson
|
||||
|
||||
class LuckyGiftNotifyAttachment(first: Int, second: Int) : CustomAttachment(first, second) {
|
||||
@JvmField
|
||||
var luckyGiftMsgSelfBean: LuckyGiftMsgSelfBean? = null
|
||||
@JvmField
|
||||
var luckyGiftMsgAllBean: LuckyGiftMsgAllBean? = null
|
||||
|
||||
|
||||
override fun parseData(data: JSONObject?) {
|
||||
super.parseData(data)
|
||||
if (data != null) {
|
||||
try {
|
||||
if (second == CUSTOM_MSG_SUPER_LUCKY_GIFT_SELF){
|
||||
luckyGiftMsgSelfBean = Gson().fromJson<LuckyGiftMsgSelfBean>(
|
||||
data.toJSONString(),
|
||||
LuckyGiftMsgSelfBean::class.java
|
||||
)
|
||||
}else if (second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ROOM || second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ALL) {
|
||||
luckyGiftMsgAllBean = Gson().fromJson<LuckyGiftMsgAllBean>(
|
||||
data.toJSONString(),
|
||||
LuckyGiftMsgAllBean::class.java
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun packData(): JSONObject {
|
||||
val data = JSONObject()
|
||||
return data
|
||||
}
|
||||
|
||||
}
|
@@ -40,6 +40,7 @@ public class MultiGiftAttachment extends CustomAttachment {
|
||||
multiGiftReceiveInfo.setAvatar(data.getString("avatar"));
|
||||
multiGiftReceiveInfo.setNick(data.getString("nick"));
|
||||
multiGiftReceiveInfo.setGiftNum(data.getIntValue("giftNum"));
|
||||
multiGiftReceiveInfo.setComboCount(data.getIntValue("comboCount"));
|
||||
JSONArray jsonArray = data.getJSONArray("targetUids");
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
@@ -75,6 +76,7 @@ public class MultiGiftAttachment extends CustomAttachment {
|
||||
object.put("avatar", multiGiftReceiveInfo.getAvatar());
|
||||
object.put("nick", multiGiftReceiveInfo.getNick());
|
||||
object.put("giftNum", multiGiftReceiveInfo.getGiftNum());
|
||||
object.put("comboCount", multiGiftReceiveInfo.getComboCount());
|
||||
object.put("gift", multiGiftReceiveInfo.getGift());
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
|
@@ -16,9 +16,9 @@ import android.util.SparseArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chwl.core.gift.bean.GiftType;
|
||||
import com.chwl.core.gift.bean.MsgSuperLuckyGift;
|
||||
import com.chwl.core.im.custom.bean.LuckyGiftNotifyAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomSerialValueChangedAttachment;
|
||||
import com.chwl.core.initial.InitialModel;
|
||||
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
|
||||
@@ -59,11 +59,9 @@ import com.netease.nimlib.sdk.msg.attachment.NotificationAttachment;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.constant.NotificationType;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.netease.nimlib.sdk.msg.model.NIMAntiSpamOption;
|
||||
import com.netease.nimlib.sdk.util.Entry;
|
||||
import com.netease.nimlib.sdk.util.api.RequestResult;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.chwl.core.XConstants;
|
||||
import com.chwl.core.BuildConfig;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.R;
|
||||
@@ -1476,6 +1474,17 @@ public final class IMNetEaseManager {
|
||||
case CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE:
|
||||
if (second == CUSTOM_MSG_SUPER_LUCKY_GIFT_TEMPLATE_SUB) {
|
||||
addMessages(msg);
|
||||
} else if (second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ROOM
|
||||
|| second == CUSTOM_MSG_SUPER_LUCKY_GIFT_ALL
|
||||
|| second == CUSTOM_MSG_SUPER_LUCKY_GIFT_SELF){
|
||||
|
||||
LuckyGiftNotifyAttachment luckyGiftAttachment = (LuckyGiftNotifyAttachment) attachment;
|
||||
MsgSuperLuckyGift msgSuperLuckyGift = new MsgSuperLuckyGift();
|
||||
msgSuperLuckyGift.luckyGiftMsgSelfBean = luckyGiftAttachment.luckyGiftMsgSelfBean;
|
||||
msgSuperLuckyGift.luckyGiftMsgAllBean = luckyGiftAttachment.luckyGiftMsgAllBean;
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.MSG_SUPER_LUCKY_GIFT)
|
||||
.setMsgSuperLuckyGift(msgSuperLuckyGift));
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_TEMPLATE_NOTIFY:
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.chwl.core.manager;
|
||||
|
||||
import com.chwl.core.gift.bean.MsgSuperLuckyGift;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.chwl.core.bean.RoomQueueInfo;
|
||||
@@ -271,6 +272,10 @@ public class RoomEvent {
|
||||
//房间流水
|
||||
public static final int SERIAL_VALUE_CHANGED = 112;
|
||||
|
||||
|
||||
//幸运礼物中奖飘屏,弹窗
|
||||
public static final int MSG_SUPER_LUCKY_GIFT = 113;
|
||||
|
||||
private int event = NONE;
|
||||
private int micPosition = Integer.MIN_VALUE;
|
||||
private int posState = -1;
|
||||
@@ -298,6 +303,7 @@ public class RoomEvent {
|
||||
private CustomAttachment customAttachment;
|
||||
private GiftMultiReceiverInfo giftMultiReceiverInfo;
|
||||
private LuckyBagGifts LuckygiftMultiReceiverInfo;
|
||||
private MsgSuperLuckyGift msgSuperLuckyGift;
|
||||
|
||||
/**
|
||||
* 需要透传出去的消息
|
||||
@@ -554,4 +560,13 @@ public class RoomEvent {
|
||||
public LuckyBagGifts getLuckygiftMultiReceiverInfo() {
|
||||
return LuckygiftMultiReceiverInfo;
|
||||
}
|
||||
|
||||
public MsgSuperLuckyGift getMsgSuperLuckyGift() {
|
||||
return msgSuperLuckyGift;
|
||||
}
|
||||
|
||||
public RoomEvent setMsgSuperLuckyGift(MsgSuperLuckyGift msgSuperLuckyGift) {
|
||||
this.msgSuperLuckyGift = msgSuperLuckyGift;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
31
core/src/main/java/com/chwl/core/utils/ComboUtil.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.chwl.core.utils
|
||||
|
||||
import android.graphics.Point
|
||||
import android.view.View
|
||||
import com.chwl.library.utils.ScreenUtils
|
||||
import com.example.lib_utils.UiUtils.isRtl
|
||||
|
||||
object ComboUtil {
|
||||
var comboCount = 1
|
||||
var point = Point(0,0)
|
||||
fun setPoint(child: View) {
|
||||
if (point.x>0 || point.y>0) return
|
||||
val density: Float = child.context.resources.displayMetrics.density
|
||||
val giftWidth = (80 * density + 0.5).toInt()
|
||||
val location = IntArray(2)
|
||||
|
||||
child.getLocationInWindow(location)
|
||||
val x: Int
|
||||
if (isRtl(child.context)) {
|
||||
location[0] = ScreenUtils.getScreenWidth(child.context) - location[0]
|
||||
x = (location[0] - child.width / 2) - giftWidth / 2
|
||||
} else {
|
||||
x = (location[0] + child.width / 2) - giftWidth / 2
|
||||
}
|
||||
val y = (location[1] + child.height / 2) - giftWidth / 3
|
||||
point = Point(x, y)
|
||||
LogUtils.d("ComboUtil x= $x y= $y")
|
||||
}
|
||||
|
||||
fun isChangePoint() = comboCount > 1
|
||||
}
|