房间新增H5任务完成提示

This commit is contained in:
huangjian
2022-08-02 17:33:50 +08:00
parent f4421a08f5
commit bf94e46855
8 changed files with 94 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ import android.view.View;
import android.view.ViewStub;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -67,6 +68,7 @@ import com.yizhuan.erban.home.dialog.HelloMessageDialog;
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.erban.ui.widget.LoadingDialog;
import com.yizhuan.erban.ui.widget.NobleOpenNoticeView;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftDialog;
@@ -111,6 +113,7 @@ import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomModeType;
import com.yizhuan.xchat_android_core.room.dragonball.DragonBallModel;
import com.yizhuan.xchat_android_core.room.event.FinishAvRoomEvent;
import com.yizhuan.xchat_android_core.room.event.RoomTaskTipsEvent;
import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
@@ -175,6 +178,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
private CircleImageView avatar;
private ViewStub mVsNobleOpen;
private NobleOpenNoticeView mNobleOpenNoticeView;
private ViewStub vsTaskTips;
private LinearLayout llTaskTips;
private long roomUid;
@Nullable
private HomePartyFragment mCurrentFragment;
@@ -389,6 +395,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
initIntentExtra(getIntent());
mVsRoomOffline = findViewById(R.id.vs_room_offline);
mVsNobleOpen = findViewById(R.id.vs_noble_open_notice);
vsTaskTips = findViewById(R.id.vs_task_tips);
viewpager = findViewById(R.id.fragment_container);
IMNetEaseManager.get().getChatRoomEventObservable()
@@ -457,14 +464,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
protected void onResume() {
super.onResume();
AvRoomDataManager.get().roomNoDestory = true;
registerGiftBroadcastMessage(true);
if (giftList != null) {
giftList.clear();
}
if (!isResume) showRedPackage(AvRoomDataManager.get().mCurrentRoomInfo);
isResume = true;
}
private void onRoomEventReceive(RoomEvent roomEvent) {
@@ -1090,6 +1095,23 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRoomTaskTipsEvent(RoomTaskTipsEvent event) {
if (TextUtils.isEmpty(event.getTaskCompleteMsg()) || TextUtils.isEmpty(event.getTaskUrl()))
return;
if (llTaskTips == null) {
llTaskTips = (LinearLayout) vsTaskTips.inflate();
}
llTaskTips.setVisibility(VISIBLE);
llTaskTips.postDelayed(() -> llTaskTips.setVisibility(View.GONE), 3000);
TextView tvMsg = llTaskTips.findViewById(R.id.tv_tips_text);
tvMsg.setText(event.getTaskCompleteMsg());
llTaskTips.setOnClickListener(v -> {
llTaskTips.setVisibility(View.GONE);
CommonWebViewActivity.start(this, event.getTaskUrl());
});
}
public Single<String> giveUpDragonBar() {
return DragonBallModel.get()
.clearDragonBar()

View File

@@ -61,6 +61,7 @@ import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
import com.yizhuan.xchat_android_core.utils.LogUtils
import com.yizhuan.xchat_android_core.utils.StarUtils
import com.yizhuan.xchat_android_library.rxbus.RxBusHelper
import com.yizhuan.xchat_android_library.utils.FormatUtils
@@ -305,6 +306,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
super.onResume()
initUserDate()
requestUpdateUserInfo()
LogUtils.d("onResume")
}
private fun initUserDate() {

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#597a4b00" />
<corners android:radius="10dp" />
<stroke
android:width="1px"
android:color="#FFD436" />
</shape>

View File

@@ -30,10 +30,12 @@
android:layout="@layout/room_noble_open_viewstub_layout" />
<ViewStub
android:id="@+id/vs_gift_value_tips"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/vs_gift_value_first_show_layout"
android:visibility="gone" />
android:id="@+id/vs_task_tips"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="150dp"
android:layout="@layout/layout_vs_task_tips"
/>
</FrameLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_task_tips"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:background="@drawable/shape_room_task_tips"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_tips_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:includeFontPadding="false"
android:text="任务已完成"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="15dp"
android:includeFontPadding="false"
android:textColor="#FFBC51"
android:textSize="12sp"
android:text="查看奖励" />
</LinearLayout>

View File

@@ -384,6 +384,9 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_ROOM_RANK = 91;
public static final int CUSTOM_MSG_SUB_ROOM_RANK_TOP = 911;
public static final int CUSTOM_MSG_ROOM_TASK_TIPS = 92;
public static final int CUSTOM_MSG_SUB_ROOM_TASK_TIPS = 921;
/**
* 自定义消息附件的类型,根据该字段区分不同的自定义消息
*/

View File

@@ -39,6 +39,7 @@ import com.yizhuan.xchat_android_core.pay.event.ChargeCustomNotificationEvent;
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent;
import com.yizhuan.xchat_android_core.pay.event.FirstRechargeEvent;
import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent;
import com.yizhuan.xchat_android_core.room.event.RoomTaskTipsEvent;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;
@@ -56,6 +57,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_VISITOR;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_WORLD_DYNAMIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MINI_WORLD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_TASK_TIPS;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_TASK_TIPS;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_VISITOR_UNREAD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_SELF_OPEN;
@@ -303,7 +306,7 @@ public class IMSystemMsgManager {
event.setChargeProdTitle(firstChargeGoods.getChargeProdTitle());
event.setFirstChargeRewardList(firstChargeGoods.getFirstChargeRewardList());
EventBus.getDefault().post(event);
}else if (subType == CustomAttachment.CUSTOM_MSG_SUB_NEW_USER_CHARGE_PRIZE){
} else if (subType == CustomAttachment.CUSTOM_MSG_SUB_NEW_USER_CHARGE_PRIZE) {
FirstChargeGoods firstChargeGoods = data.toJavaObject(FirstChargeGoods.class);
NewUserChargeEvent event = new NewUserChargeEvent();
event.setChargeProdTitle(firstChargeGoods.getChargeProdTitle());
@@ -329,6 +332,11 @@ public class IMSystemMsgManager {
EventBus.getDefault().postSticky(new VisitorUnreadCountEvent(visitNum));
}
break;
case CUSTOM_MSG_ROOM_TASK_TIPS:
if (subType == CUSTOM_MSG_SUB_ROOM_TASK_TIPS) {
EventBus.getDefault().post(data.toJavaObject(RoomTaskTipsEvent.class));
}
break;
default:
break;
}

View File

@@ -0,0 +1,9 @@
package com.yizhuan.xchat_android_core.room.event;
import lombok.Data;
@Data
public class RoomTaskTipsEvent {
private String taskCompleteMsg;
private String taskUrl;
}