Merge branch 'v2.2.0/red_package' into v2.2.0/test
# Conflicts: # app/src/main/res/values/strings.xml
This commit is contained in:
@@ -221,10 +221,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private GiftBroadcastObserver giftObserver;
|
||||
private Dialog giftDialog;
|
||||
private LinkedList<AllServiceGiftProtocol.DataBean> giftList;
|
||||
private boolean isResume = true;
|
||||
@Nullable
|
||||
private SingleRoomTipDialog singleRoomTipDialog;
|
||||
|
||||
// 通过红包进来时,有该参数
|
||||
private RedPackageNotifyInfo redPackageNotifyInfo;
|
||||
public static void start(Context context, long roomUid) {
|
||||
startForFromType(context, roomUid, FROM_TYPE_NORMAL, null, null);
|
||||
}
|
||||
@@ -408,6 +408,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
fromUid = intent.getStringExtra("fromUid");
|
||||
giftId = intent.getIntExtra("giftId", 0);
|
||||
mRoomInfo = intent.getParcelableExtra(Constants.ROOM_INFO);
|
||||
Object notifyInfo = intent.getSerializableExtra("notifyInfo");
|
||||
if (notifyInfo instanceof RedPackageNotifyInfo) {
|
||||
redPackageNotifyInfo = (RedPackageNotifyInfo) notifyInfo;
|
||||
}else{
|
||||
redPackageNotifyInfo = null;
|
||||
}
|
||||
if (mRoomInfo != null) {
|
||||
roomUid = mRoomInfo.getRoomUid();
|
||||
} else {
|
||||
@@ -506,7 +512,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (giftList != null) {
|
||||
giftList.clear();
|
||||
}
|
||||
isResume = true;
|
||||
}
|
||||
|
||||
private void onRoomEventReceive(RoomEvent roomEvent) {
|
||||
@@ -723,11 +728,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
*/
|
||||
private void tryShowSourceRedPackage() {
|
||||
try {
|
||||
RedPackageNotifyInfo inRoomNotifyInfo = (RedPackageNotifyInfo) getIntent().getSerializableExtra("notifyInfo");
|
||||
if (inRoomNotifyInfo != null) {
|
||||
if (redPackageNotifyInfo != null) {
|
||||
RedPackageHandler handler = getRoomContext().findAbility(RedPackageHandler.class.getSimpleName());
|
||||
if (handler != null) {
|
||||
long id = Long.parseLong(inRoomNotifyInfo.getRedEnvelopeId());
|
||||
long id = Long.parseLong(redPackageNotifyInfo.getRedEnvelopeId());
|
||||
handler.tryShowRedPackage(id);
|
||||
}
|
||||
}
|
||||
@@ -1326,10 +1330,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
registerGiftBroadcastMessage(false);
|
||||
isResume = false;
|
||||
}
|
||||
|
||||
|
||||
private void handlePmExitRoom() {
|
||||
EventBus.getDefault().post(new PmDismissAllLimitDialogEvent());
|
||||
getMvpPresenter().exitRoom();
|
||||
|
@@ -82,15 +82,18 @@ class RedPackageHandler : RoomHandler() {
|
||||
* 查找最新的厅内红包(新/旧版的厅内红包,非全服红包)
|
||||
*/
|
||||
private fun requestLatestRoomRedPackage() {
|
||||
logD("requestLatestRoomRedPackage()")
|
||||
val roomId = roomContext?.roomId ?: return
|
||||
logD("requestLatestRoomRedPackage() roomId:$roomId")
|
||||
RedPackageModel.getLatestRoomRedPackage(roomId)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({ data ->
|
||||
logD("requestLatestRoomRedPackage() data:$data")
|
||||
handleRoomRedPackage(data, false)
|
||||
}, {})
|
||||
}, {
|
||||
if (it.message == "No RedPackage") {
|
||||
updateIcon(null)
|
||||
} else {
|
||||
// 网络等原因的失败,不处理就好
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +155,7 @@ class RedPackageHandler : RoomHandler() {
|
||||
} else {
|
||||
if (!inOperation) {
|
||||
RedPackageGoRoomDialog.newInstance(data).show(context)
|
||||
}else{
|
||||
} else {
|
||||
// 需求:正在房间中领取红包时,不展示其他房间的全服红包
|
||||
}
|
||||
}
|
||||
|
@@ -163,7 +163,6 @@ class RedPackageWidget : ConstraintLayout, RoomWidget {
|
||||
* 更新数据
|
||||
*/
|
||||
private fun loadData(data: RedPackageNotifyInfo?) {
|
||||
logD("loadData() data:$data")
|
||||
this.data = data
|
||||
stopCountDown()
|
||||
if (data != null) {
|
||||
|
@@ -7,9 +7,7 @@ import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import androidx.core.view.isVisible
|
||||
@@ -181,40 +179,53 @@ class RedPackageOpenDialog2 : BaseDialog<RedPackageOpenDialogBinding>(), ILog {
|
||||
*/
|
||||
private fun loadTips(data: RedPackageData) {
|
||||
binding.tvOpenTips.isVisible = false
|
||||
when (data.kind) {
|
||||
2 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(
|
||||
text = R.string.red_package_open_tips_follow.toStringRes(),
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes()).apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
if (data.finish == true) {
|
||||
binding.tvOpenTips.setText(R.string.red_package_complete_tips)
|
||||
binding.tvOpenTips.isVisible = true
|
||||
} else {
|
||||
when (data.kind) {
|
||||
1 -> {
|
||||
binding.tvOpenTips.setText(R.string.red_package_quick_tips)
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
|
||||
3 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(
|
||||
text = R.string.red_package_open_tips_share.toStringRes(),
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes()).apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
2 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(
|
||||
text = R.string.red_package_open_tips_follow.toStringRes(),
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes())
|
||||
.apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
|
||||
4 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(text = R.string.red_package_open_tips_msg1.toStringRes())
|
||||
.appendText(
|
||||
text = data.message ?: "",
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes()).apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
3 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(
|
||||
text = R.string.red_package_open_tips_share.toStringRes(),
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes())
|
||||
.apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
|
||||
else -> {
|
||||
loadTips(data.message)
|
||||
4 -> {
|
||||
binding.tvOpenTips.spannableBuilder()
|
||||
.appendText(text = R.string.red_package_open_tips_msg1.toStringRes())
|
||||
.appendText(
|
||||
text = data.message ?: "",
|
||||
textColor = getColorById(R.color.color_FFF87A)
|
||||
)
|
||||
.appendText(text = R.string.red_package_open_tips_msg_end.toStringRes())
|
||||
.apply()
|
||||
binding.tvOpenTips.isVisible = true
|
||||
}
|
||||
|
||||
else -> {
|
||||
loadTips(data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,10 +290,26 @@ class RedPackageOpenDialog2 : BaseDialog<RedPackageOpenDialogBinding>(), ILog {
|
||||
binding.tvBtnMsg.text = ""
|
||||
}
|
||||
}
|
||||
startTimerForUncompletedState(gap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启定时器:未完成状态更新(倒计时结束时,更新对应View状态)
|
||||
*/
|
||||
private fun startTimerForUncompletedState(time: Long) {
|
||||
val d = Observable.timer(time, TimeUnit.MILLISECONDS)
|
||||
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
binding.tvBtnMsg.setText(R.string.red_package_open_btn_no)
|
||||
btnRunnable = {
|
||||
SingleToastUtil.showToast(R.string.red_package_open_no_tips)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始倒计时
|
||||
* @param time 开抢时间
|
||||
|
@@ -85,6 +85,10 @@ class RedPackageSendDialog2 : BaseDialog<RedPackageSendDialogBinding>() {
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
binding.vTopBlank.singleClick {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
binding.ivHelp.singleClick {
|
||||
DialogWebViewActivity.start(
|
||||
context,
|
||||
|
@@ -22,6 +22,14 @@
|
||||
android:src="@drawable/red_package_send_bg"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_top_blank"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_help"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_top" />
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -5182,6 +5182,8 @@
|
||||
<string name="red_package_open_tips_msg_end">可搶紅包</string>
|
||||
<string name="red_package_result_empty_tips">搶完了,下次早點來哦~</string>
|
||||
<string name="red_package_disabled_tips">該紅包已失效</string>
|
||||
<string name="red_package_quick_tips">快來搶紅包,手慢無哦!</string>
|
||||
<string name="red_package_complete_tips">已完成條件,可搶紅包</string>
|
||||
|
||||
<string name="all_service_gift_room_go_title">前往圍觀</string>
|
||||
<string name="all_service_gift_room_go_tips">是否離開當前房間前往</string>
|
||||
|
@@ -58,6 +58,9 @@ object RedPackageModel {
|
||||
.io2main()
|
||||
.handleBeanData()
|
||||
.toObservable().map {
|
||||
if (it.isEmpty()) {
|
||||
throw NullPointerException("No RedPackage")
|
||||
}
|
||||
val item = it.last()
|
||||
RedPackageNotifyInfo(
|
||||
redEnvelopeId = item.id,
|
||||
|
Reference in New Issue
Block a user