新增新用户进房礼物弹窗
This commit is contained in:
@@ -49,6 +49,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.dialog.NewUserGiftDialog;
|
||||
import com.yizhuan.erban.avroom.dialog.SingleRoomTipDialog;
|
||||
import com.yizhuan.erban.avroom.fragment.FakeSingleRoomFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
@@ -81,6 +82,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
@@ -1020,6 +1022,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
//获取管理员
|
||||
getMvpPresenter().getNormalChatMember();
|
||||
getMvpPresenter().getSuperAdminList();
|
||||
getMvpPresenter().checkNewUserGift();
|
||||
if (fromType == FROM_TYPE_HELLO) {
|
||||
getMvpPresenter().checkHelloMessage();
|
||||
}
|
||||
@@ -1232,6 +1235,11 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
this::handlePmExitRoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNewUserDialog(GiftInfo giftInfo) {
|
||||
new NewUserGiftDialog(giftInfo).show(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onImPushMsgPmLimitTimeEvent(ImPushMsgPmLimitTimeEvent event) {
|
||||
//时间到限制时间段之后,后台推送im消息
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package com.yizhuan.erban.avroom.dialog
|
||||
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.DialogNewUserGiftBinding
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo
|
||||
|
||||
class NewUserGiftDialog(val giftInfo: GiftInfo) :
|
||||
BaseDialog<DialogNewUserGiftBinding>() {
|
||||
|
||||
override fun init() {
|
||||
|
||||
binding.ivClose.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
binding.ivGift.load(giftInfo.giftUrl)
|
||||
binding.tvGiftName.text = "${giftInfo.giftName}*1"
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -22,6 +22,7 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.view.IAvRoomView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
@@ -437,6 +438,25 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否需要显示新用户礼弹窗
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkNewUserGift() {
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo == null || !DemoCache.readNewUserGift())
|
||||
return;
|
||||
|
||||
Single.timer(3, TimeUnit.SECONDS)
|
||||
.flatMap(aLong -> AvRoomModel.get().getNewUserGift())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(giftInfo -> {
|
||||
DemoCache.saveNewUserGift(false);
|
||||
if (getMvpView() != null && !TextUtils.isEmpty(giftInfo.getGiftUrl())) {
|
||||
getMvpView().showNewUserDialog(giftInfo);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void startGetOnlineMemberNumberJob() {
|
||||
Observable.interval(1, 10, TimeUnit.SECONDS, Schedulers.from(ThreadPoolManager.instance().getScheduleExecutor()))
|
||||
|
@@ -2,6 +2,7 @@ package com.yizhuan.erban.avroom.view;
|
||||
|
||||
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
|
||||
import com.yizhuan.xchat_android_core.redPacket.bean.ActionDialogInfo;
|
||||
@@ -83,4 +84,6 @@ public interface IAvRoomView extends IMvpBaseView {
|
||||
* @param throwable -
|
||||
*/
|
||||
void recoverRoomMinWhenPmLimit(Throwable throwable);
|
||||
|
||||
void showNewUserDialog(GiftInfo giftInfo);
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_new_user_gift.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_new_user_gift.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_new_user_close.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_new_user_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
8
app/src/main/res/drawable/shape_white_12dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_white_12dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FFFFFF" />
|
||||
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
71
app/src/main/res/layout/dialog_new_user_gift.xml
Normal file
71
app/src/main/res/layout/dialog_new_user_gift.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="320dp"
|
||||
android:background="@drawable/bg_new_user_gift"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="130dp"
|
||||
android:baselineAligned="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="获得新人礼物 "
|
||||
android:textColor="#EEFEEC"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="@string/new_user_task_title"
|
||||
android:textColor="#EEFEEC"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/shape_white_12dp_round"
|
||||
android:src="@drawable/ic_new_user_task_radish"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="已放入背包,尽快使用吧~"
|
||||
android:textColor="#EEFEEC"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:src="@drawable/ic_new_user_close"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
@@ -63,6 +63,7 @@ public class DemoCache {
|
||||
private static final String KEY_AT_MSG_UUID = "AtMsgUuid";
|
||||
private static final String KEY_BGM_SINGLE_CYCLE = "key_bgm_single_cycle";
|
||||
private static final String KEY_SINGLE_ROOM_TIP = "key_single_room_tip";
|
||||
private static final String KEY_NEW_USER_GIFT = "key_new_user_gift";
|
||||
/**
|
||||
* 保存网页域名
|
||||
*/
|
||||
@@ -356,5 +357,13 @@ public class DemoCache {
|
||||
return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_SINGLE_ROOM_TIP, true);
|
||||
}
|
||||
|
||||
public static void saveNewUserGift(boolean value) {
|
||||
SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_SINGLE_ROOM_TIP , value);
|
||||
}
|
||||
|
||||
public static Boolean readNewUserGift() {
|
||||
return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_SINGLE_ROOM_TIP, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
|
||||
@@ -628,6 +629,13 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<GiftInfo> getNewUserGift() {
|
||||
return mRoomService.getNewUserGift(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 公屏历史消息
|
||||
*/
|
||||
|
@@ -28,6 +28,7 @@ import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.exception.ErrorThrowable;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
@@ -1146,6 +1147,15 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@GET("/single/broadcast/room/page")
|
||||
Single<RoomResult> getNextSingleRoomInfo(@Query("roomUid") long roomUid);
|
||||
|
||||
/**
|
||||
* 获取新用户进房礼物
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@GET("/gift/newUser/inRoom")
|
||||
Single<ServiceResult<GiftInfo>> getNewUserGift(@Query("roomUid") long roomUid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.google.gson.JsonElement;
|
||||
import com.netease.nimlib.sdk.chatroom.model.EnterChatRoomResultData;
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.activitytimer.TimerBean;
|
||||
@@ -180,5 +181,7 @@ public interface IAvRoomModel extends IModel {
|
||||
|
||||
Single<RoomInfo> getNextSingleRoomInfo();
|
||||
|
||||
Single<GiftInfo> getNewUserGift();
|
||||
|
||||
void loadMessageHistory(long startTime);
|
||||
}
|
||||
|
Reference in New Issue
Block a user