1.宝箱相关逻辑
2.关闭第三方推送 3.去掉读取手机信息权限
This commit is contained in:
@@ -22,7 +22,9 @@
|
|||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_PHONE_STATE"
|
||||||
|
tools:node="remove" />
|
||||||
|
|
||||||
<!-- 云信权限声明 -->
|
<!-- 云信权限声明 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||||
|
|
||||||
<!--vivo Push需要的权限-->
|
<!--vivo Push需要的权限-->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".application.XChatApplication"
|
android:name=".application.XChatApplication"
|
||||||
@@ -82,10 +84,10 @@
|
|||||||
android:icon="@mipmap/app_logo"
|
android:icon="@mipmap/app_logo"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:theme="@style/MyMaterialTheme"
|
android:theme="@style/MyMaterialTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
tools:replace="android:name, android:allowBackup">
|
tools:replace="android:name, android:allowBackup">
|
||||||
<!-- 高德地图 begin -->
|
<!-- 高德地图 begin -->
|
||||||
<meta-data
|
<meta-data
|
||||||
@@ -289,25 +291,25 @@
|
|||||||
<!--配置的service, activity, receiver-->
|
<!--配置的service, activity, receiver-->
|
||||||
<service
|
<service
|
||||||
android:name="com.vivo.push.sdk.service.CommandClientService"
|
android:name="com.vivo.push.sdk.service.CommandClientService"
|
||||||
android:exported="true"/>
|
android:exported="true" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.vivo.push.sdk.LinkProxyClientActivity"
|
android:name="com.vivo.push.sdk.LinkProxyClientActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
|
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||||
<receiver android:name="com.netease.nimlib.mixpush.vivo.VivoPushReceiver">
|
<receiver android:name="com.netease.nimlib.mixpush.vivo.VivoPushReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<!-- 接收 push 消息 -->
|
<!-- 接收 push 消息 -->
|
||||||
<action android:name="com.vivo.pushclient.action.RECEIVE"/>
|
<action android:name="com.vivo.pushclient.action.RECEIVE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<!--Vivo Push开放平台中应用的appid 和api key-->
|
<!--Vivo Push开放平台中应用的appid 和api key-->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.vivo.push.api_key"
|
android:name="com.vivo.push.api_key"
|
||||||
android:value="1a9cace2-da8a-4b49-a70d-9beefacf6096"/>
|
android:value="1a9cace2-da8a-4b49-a70d-9beefacf6096" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.vivo.push.app_id"
|
android:name="com.vivo.push.app_id"
|
||||||
android:value="16517"/>
|
android:value="16517" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_width"
|
android:name="design_width"
|
||||||
@@ -318,9 +320,9 @@
|
|||||||
<!-- Autolayout####################################################配置 -->
|
<!-- Autolayout####################################################配置 -->
|
||||||
|
|
||||||
<!-- LinkedMe ####################################################配置 -->
|
<!-- LinkedMe ####################################################配置 -->
|
||||||
<!-- <meta-data-->
|
<!-- <meta-data-->
|
||||||
<!-- android:name="linkedme.sdk.key"-->
|
<!-- android:name="linkedme.sdk.key"-->
|
||||||
<!-- android:value="978cd79c98264f836450afda1228762e" /> <!– LinkedMe####################################################配置 –>-->
|
<!-- android:value="978cd79c98264f836450afda1228762e" /> <!– LinkedMe####################################################配置 –>-->
|
||||||
<!-- TakePhoto申明 -->
|
<!-- TakePhoto申明 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="com.soundcloud.android.crop.CropImageActivity"
|
android:name="com.soundcloud.android.crop.CropImageActivity"
|
||||||
@@ -335,12 +337,12 @@
|
|||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider> <!-- 支付宝支付需要注册 -->
|
</provider> <!-- 支付宝支付需要注册 -->
|
||||||
<!-- 注释这个声明,禁用支付宝h5支付 -->
|
<!-- 注释这个声明,禁用支付宝h5支付 -->
|
||||||
<!-- <activity-->
|
<!-- <activity-->
|
||||||
<!-- android:name="com.alipay.sdk.app.H5PayActivity"-->
|
<!-- android:name="com.alipay.sdk.app.H5PayActivity"-->
|
||||||
<!-- android:configChanges="orientation|keyboardHidden|navigation|screenSize"-->
|
<!-- android:configChanges="orientation|keyboardHidden|navigation|screenSize"-->
|
||||||
<!-- android:exported="false"-->
|
<!-- android:exported="false"-->
|
||||||
<!-- android:screenOrientation="behind"-->
|
<!-- android:screenOrientation="behind"-->
|
||||||
<!-- android:windowSoftInputMode="adjustResize|stateHidden" />-->
|
<!-- android:windowSoftInputMode="adjustResize|stateHidden" />-->
|
||||||
<activity
|
<activity
|
||||||
android:name="com.alipay.sdk.auth.AuthActivity"
|
android:name="com.alipay.sdk.auth.AuthActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|navigation"
|
android:configChanges="orientation|keyboardHidden|navigation"
|
||||||
@@ -393,17 +395,17 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
<!-- <activity xmlns:tools="http://schemas.android.com/tools"-->
|
<!-- <activity xmlns:tools="http://schemas.android.com/tools"-->
|
||||||
<!-- android:name="cn.sharesdk.wechat.utils.WechatHandlerActivity"-->
|
<!-- android:name="cn.sharesdk.wechat.utils.WechatHandlerActivity"-->
|
||||||
<!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
|
<!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
|
||||||
<!-- android:exported="false"-->
|
<!-- android:exported="false"-->
|
||||||
<!-- tools:node="merge" />-->
|
<!-- tools:node="merge" />-->
|
||||||
|
|
||||||
<!-- <activity-alias xmlns:tools="http://schemas.android.com/tools"-->
|
<!-- <activity-alias xmlns:tools="http://schemas.android.com/tools"-->
|
||||||
<!-- android:name="${applicationId}.wxapi.WXEntryActivity"-->
|
<!-- android:name="${applicationId}.wxapi.WXEntryActivity"-->
|
||||||
<!-- android:exported="true"-->
|
<!-- android:exported="true"-->
|
||||||
<!-- android:targetActivity="cn.sharesdk.wechat.utils.WechatHandlerActivity"-->
|
<!-- android:targetActivity="cn.sharesdk.wechat.utils.WechatHandlerActivity"-->
|
||||||
<!-- tools:node="merge" />-->
|
<!-- tools:node="merge" />-->
|
||||||
<!-- 为了兼容小程序返回的问题,声明WXEntryActivity,并把之前的 WechatHandlerActivity注释 -->
|
<!-- 为了兼容小程序返回的问题,声明WXEntryActivity,并把之前的 WechatHandlerActivity注释 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="com.xuanyi.accompany.wxapi.WXEntryActivity"
|
android:name="com.xuanyi.accompany.wxapi.WXEntryActivity"
|
||||||
@@ -414,8 +416,6 @@
|
|||||||
<service
|
<service
|
||||||
android:name=".service.DaemonService"
|
android:name=".service.DaemonService"
|
||||||
android:enabled="true" />
|
android:enabled="true" />
|
||||||
<service android:name=".treasure_box.service.OpenBoxService" />
|
|
||||||
<service android:name=".treasure_box.service.OpenHonourBoxService" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".other.activity.SplashActivity"
|
android:name=".other.activity.SplashActivity"
|
||||||
@@ -1141,14 +1141,14 @@
|
|||||||
<!-- 社区 -->
|
<!-- 社区 -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".community.publish.view.PublishActivity"
|
android:name=".community.publish.view.PublishActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustNothing"
|
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="stateHidden|adjustNothing" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".community.dynamic.view.DynamicDetailActivity"
|
android:name=".community.dynamic.view.DynamicDetailActivity"
|
||||||
android:windowSoftInputMode="adjustResize"
|
android:screenOrientation="portrait"
|
||||||
android:screenOrientation="portrait" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".community.photo.PreviewPhotoActivity"
|
android:name=".community.photo.PreviewPhotoActivity"
|
||||||
@@ -1169,13 +1169,12 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.zhihu.matisse.internal.ui.SelectedPreviewActivity"
|
android:name="com.zhihu.matisse.internal.ui.SelectedPreviewActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait" />
|
||||||
/>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.wallet.sendgold.SendGoldActivity"
|
android:name=".ui.wallet.sendgold.SendGoldActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize"
|
android:screenOrientation="portrait"
|
||||||
android:screenOrientation="portrait" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
|
|
||||||
<!-- 隐私设置 -->
|
<!-- 隐私设置 -->
|
||||||
<activity
|
<activity
|
||||||
@@ -1192,8 +1191,9 @@
|
|||||||
android:label="一键登录"
|
android:label="一键登录"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".ui.webview.DialogWebViewActivity"
|
<activity
|
||||||
android:theme="@style/dialog_web_view_activity"/>
|
android:name=".ui.webview.DialogWebViewActivity"
|
||||||
|
android:theme="@style/dialog_web_view_activity" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@@ -9,9 +9,6 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.LongSparseArray;
|
import android.util.LongSparseArray;
|
||||||
@@ -21,6 +18,10 @@ import android.view.animation.LinearInterpolator;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import com.mcxiaoke.packer.helper.PackerNg;
|
import com.mcxiaoke.packer.helper.PackerNg;
|
||||||
import com.microquation.linkedme.android.LinkedME;
|
import com.microquation.linkedme.android.LinkedME;
|
||||||
import com.netease.nim.uikit.api.NimUIKit;
|
import com.netease.nim.uikit.api.NimUIKit;
|
||||||
@@ -82,8 +83,6 @@ import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
|
|||||||
import com.yizhuan.erban.radish.signin.SignDialogTimeManager;
|
import com.yizhuan.erban.radish.signin.SignDialogTimeManager;
|
||||||
import com.yizhuan.erban.service.DaemonService;
|
import com.yizhuan.erban.service.DaemonService;
|
||||||
import com.yizhuan.erban.share.viewholder.InAppSharingMsgViewHolder;
|
import com.yizhuan.erban.share.viewholder.InAppSharingMsgViewHolder;
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenBoxService;
|
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenHonourBoxService;
|
|
||||||
import com.yizhuan.erban.ui.im.RouterHandler;
|
import com.yizhuan.erban.ui.im.RouterHandler;
|
||||||
import com.yizhuan.erban.ui.im.actions.GiftAction;
|
import com.yizhuan.erban.ui.im.actions.GiftAction;
|
||||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||||
@@ -994,12 +993,6 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
@Override
|
@Override
|
||||||
public void exitRoom(RoomInfo roomInfo) {
|
public void exitRoom(RoomInfo roomInfo) {
|
||||||
closeOpenRoomAnimation();
|
closeOpenRoomAnimation();
|
||||||
if (OpenBoxService.isAutoOpenBox) {
|
|
||||||
OpenBoxService.stop(this);
|
|
||||||
}
|
|
||||||
if (OpenHonourBoxService.isAutoOpenBox) {
|
|
||||||
OpenHonourBoxService.stop(this);
|
|
||||||
}
|
|
||||||
//ktv退出的时候需要用到
|
//ktv退出的时候需要用到
|
||||||
if (RtcEngineManager.get().isOpenKtv() && roomInfo != null) {
|
if (RtcEngineManager.get().isOpenKtv() && roomInfo != null) {
|
||||||
KtvMusicManager.INSTANCE.deleteUserAllChooseMusic(roomInfo.getUid()).subscribe();
|
KtvMusicManager.INSTANCE.deleteUserAllChooseMusic(roomInfo.getUid()).subscribe();
|
||||||
|
@@ -313,7 +313,7 @@ public class XChatApplication extends Application {
|
|||||||
// // save cache,留做切换账号备用
|
// // save cache,留做切换账号备用
|
||||||
DemoCache.setNotificationConfig(config);
|
DemoCache.setNotificationConfig(config);
|
||||||
|
|
||||||
MixPushConfig mixPushConfig = new MixPushConfig();
|
/* MixPushConfig mixPushConfig = new MixPushConfig();
|
||||||
mixPushConfig.hwCertificateName = "tutuHuaweiAndroid";
|
mixPushConfig.hwCertificateName = "tutuHuaweiAndroid";
|
||||||
|
|
||||||
mixPushConfig.mzAppId = "125242";
|
mixPushConfig.mzAppId = "125242";
|
||||||
@@ -327,12 +327,12 @@ public class XChatApplication extends Application {
|
|||||||
mixPushConfig.vivoCertificateName = "qingxunVivoAndroid";
|
mixPushConfig.vivoCertificateName = "qingxunVivoAndroid";
|
||||||
|
|
||||||
// 下架状态,没有完成接入
|
// 下架状态,没有完成接入
|
||||||
// mixPushConfig.oppoAppId = "30156338";
|
mixPushConfig.oppoAppId = "30156338";
|
||||||
// mixPushConfig.oppoAppKey = "4659eff1cab747c48fb6f44e2f522e83";
|
mixPushConfig.oppoAppKey = "4659eff1cab747c48fb6f44e2f522e83";
|
||||||
// mixPushConfig.oppoAppSercet = "8c6a21854c8045068247c7e1168e29a8";
|
mixPushConfig.oppoAppSercet = "8c6a21854c8045068247c7e1168e29a8";
|
||||||
// mixPushConfig.oppoCertificateName = "qingxunOppoAndroid";
|
mixPushConfig.oppoCertificateName = "qingxunOppoAndroid";
|
||||||
|
|
||||||
options.mixPushConfig = mixPushConfig;
|
options.mixPushConfig = mixPushConfig;*/
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@@ -7,10 +7,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -23,6 +19,11 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
@@ -50,9 +51,7 @@ import com.yizhuan.erban.common.widget.CustomImageSpan;
|
|||||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||||
import com.yizhuan.erban.home.adapter.FragmentViewPagerAdapter;
|
import com.yizhuan.erban.home.adapter.FragmentViewPagerAdapter;
|
||||||
import com.yizhuan.erban.monsterhunting.MonsterHuntingActivity;
|
import com.yizhuan.erban.monsterhunting.MonsterHuntingActivity;
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenHonourBoxService;
|
|
||||||
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenBoxService;
|
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
@@ -96,13 +95,10 @@ import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent;
|
|||||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||||
import com.yizhuan.xchat_android_core.room.game.GameModel;
|
import com.yizhuan.xchat_android_core.room.game.GameModel;
|
||||||
import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent;
|
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.StatisticManager;
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
|
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
|
||||||
|
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||||
@@ -828,12 +824,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exitRoom(RoomInfo currentRoomInfo) {
|
public void exitRoom(RoomInfo currentRoomInfo) {
|
||||||
if (OpenBoxService.isAutoOpenBox) {
|
|
||||||
OpenBoxService.stop(this);
|
|
||||||
}
|
|
||||||
if (OpenHonourBoxService.isAutoOpenBox) {
|
|
||||||
OpenHonourBoxService.stop(this);
|
|
||||||
}
|
|
||||||
if (currentRoomInfo != null && currentRoomInfo.getUid() == roomUid) {
|
if (currentRoomInfo != null && currentRoomInfo.getUid() == roomUid) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import android.widget.RadioGroup;
|
|||||||
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseActivity;
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||||
import com.yizhuan.xchat_android_core.DemoCache;
|
import com.yizhuan.xchat_android_core.DemoCache;
|
||||||
import com.yizhuan.xchat_android_core.Env;
|
import com.yizhuan.xchat_android_core.Env;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
@@ -26,7 +27,10 @@ public class LabActivity extends BaseActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_lab);
|
setContentView(R.layout.activity_lab);
|
||||||
|
//h5测试地址
|
||||||
|
findViewById(R.id.rb_h5_test).setOnClickListener(v -> CommonWebViewActivity.start(context, "http://192.168.10.7:5503/"));
|
||||||
|
//vue测试地址
|
||||||
|
findViewById(R.id.rb_vue_test).setOnClickListener(v -> CommonWebViewActivity.start(context, "http://192.168.10.7:8080/"));
|
||||||
int enviroment = CommonPref.instance(BasicConfig.INSTANCE.getAppContext()).getInt(Env.KEY_ENVIRONMENT);
|
int enviroment = CommonPref.instance(BasicConfig.INSTANCE.getAppContext()).getInt(Env.KEY_ENVIRONMENT);
|
||||||
//根据ID找到RadioGroup实例
|
//根据ID找到RadioGroup实例
|
||||||
RadioGroup group = (RadioGroup) this.findViewById(R.id.radioGroup);
|
RadioGroup group = (RadioGroup) this.findViewById(R.id.radioGroup);
|
||||||
|
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yizhuan.erban.ui.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Path;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顶部圆角的LinearLayout,用户半屏的web view界面
|
||||||
|
* 注意需要设置背景才有效,没有背景ViewGroup不会调用draw方法
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TopRoundLinearLayout extends LinearLayout {
|
||||||
|
|
||||||
|
private Path mPath;
|
||||||
|
private int mRadius;
|
||||||
|
private int mWidth;
|
||||||
|
private int mHeight;
|
||||||
|
private int mLastRadius;
|
||||||
|
|
||||||
|
public TopRoundLinearLayout(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TopRoundLinearLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
mPath = new Path();
|
||||||
|
mPath.setFillType(Path.FillType.EVEN_ODD);
|
||||||
|
mRadius = ScreenUtil.dip2px(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkPathChanged() {
|
||||||
|
if (getWidth() == mWidth && getHeight() == mHeight && mLastRadius == mRadius) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mWidth = getWidth();
|
||||||
|
mHeight = getHeight();
|
||||||
|
mLastRadius = mRadius;
|
||||||
|
mPath.reset();
|
||||||
|
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight),
|
||||||
|
new float[]{mRadius, mRadius, mRadius, mRadius, 0, 0, 0, 0},
|
||||||
|
Path.Direction.CW);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas) {
|
||||||
|
int saveCount = canvas.save();
|
||||||
|
checkPathChanged();
|
||||||
|
canvas.clipPath(mPath);
|
||||||
|
super.draw(canvas);
|
||||||
|
canvas.restoreToCount(saveCount);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,17 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.yizhuan.erban.ui.widget.TopRoundLinearLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/shape_white_top_10dp"
|
android:background="@color/white"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:paddingTop="10dp">
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/layout_title_bar"
|
android:id="@+id/layout_title_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp">
|
android:layout_height="48dp">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -80,4 +84,4 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
</WebView>
|
</WebView>
|
||||||
</LinearLayout>
|
</com.yizhuan.erban.ui.widget.TopRoundLinearLayout>
|
||||||
|
@@ -35,5 +35,30 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="测试环境" />
|
android:text="测试环境" />
|
||||||
|
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rb_h5_test"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:text="h5测试入口"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@color/color_f5f5f5"
|
||||||
|
android:textColor="@color/color_333333"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rb_vue_test"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:text="vue测试入口"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@color/color_f5f5f5"
|
||||||
|
android:textColor="@color/color_333333"
|
||||||
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@@ -51,7 +51,7 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
|||||||
* 基本权限管理
|
* 基本权限管理
|
||||||
*/
|
*/
|
||||||
private final String[] BASIC_PERMISSIONS = new String[]{
|
private final String[] BASIC_PERMISSIONS = new String[]{
|
||||||
Manifest.permission.READ_PHONE_STATE,
|
// Manifest.permission.READ_PHONE_STATE,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
// Manifest.permission.CAMERA,
|
// Manifest.permission.CAMERA,
|
||||||
|
@@ -1,164 +1,133 @@
|
|||||||
package com.yizhuan.erban.treasure_box.activity;
|
package com.yizhuan.erban.treasure_box.activity;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.drawable.AnimationDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.AnimationUtils;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||||
import com.yizhuan.erban.databinding.ActivityTreasureBoxBinding;
|
import com.yizhuan.erban.databinding.ActivityTreasureBoxBinding;
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenBoxService;
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.PrizeFactor;
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog;
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BoxMoreDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.BoxMoreDialog;
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BuyKeyDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.BuyKeyDialog;
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.KeyDeficiencyDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.KeyDeficiencyDialog;
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||||
import com.yizhuan.treasure_box.model.BoxModel;
|
import com.yizhuan.treasure_box.model.BoxModel;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.treasure_box.model.IBoxModel;
|
||||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||||
import com.yizhuan.treasure_box.bean.KeyInfo;
|
|
||||||
import com.yizhuan.treasure_box.bean.OpenBoxResult;
|
|
||||||
import com.yizhuan.treasure_box.event.AutoOpenBoxEvent;
|
|
||||||
import com.yizhuan.treasure_box.event.BoxBuyKeyEvent;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BalanceNotEnoughExeption;
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||||
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.activity_treasure_box)
|
@ActLayoutRes(R.layout.activity_treasure_box)
|
||||||
public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBinding> implements View.OnClickListener {
|
public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBoxBinding> implements View.OnClickListener {
|
||||||
private volatile double gold;
|
|
||||||
private int price = 20;
|
private int price = 20;
|
||||||
private ImageView ivBox;
|
|
||||||
private volatile int keyNum;
|
private volatile int keyNum;
|
||||||
private AnimationDrawable eggAnim;
|
|
||||||
private ArrayList<PrizeInfo> cacheList = new ArrayList<>();
|
private ArrayList<PrizeInfo> cacheList = new ArrayList<>();
|
||||||
private Disposable disposable;
|
private ObjectAnimator translationXAnimator;
|
||||||
|
private ObjectAnimator translationYAnimator;
|
||||||
|
private int boxType = IBoxModel.BOX_TYPE_NORMAL;
|
||||||
|
|
||||||
public TreasureBoxActivity(Context context) {
|
|
||||||
super(context);
|
|
||||||
width = WindowManager.LayoutParams.MATCH_PARENT;
|
|
||||||
//这里用MATCH_PARENT 通知栏会变黑.......
|
|
||||||
height = ScreenUtil.screenHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start(Context context) {
|
public static void start(Context context) {
|
||||||
new TreasureBoxActivity(context).openDialog();
|
Intent starter = new Intent(context, TreasureBoxActivity.class);
|
||||||
/* Intent starter = new Intent(context, TreasureBoxActivity.class);
|
context.startActivity(starter);
|
||||||
//starter.putExtra();
|
|
||||||
context.startActivity(starter);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
// requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
// getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight);
|
||||||
|
getWindow().setGravity(Gravity.CENTER);
|
||||||
subscribeEvent();
|
subscribeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectAnimator objectAnimator;
|
|
||||||
ObjectAnimator objectAnimator1;
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
binding.setClick(this);
|
mBinding.setClick(this);
|
||||||
ivBox = binding.ivBox;
|
translationXAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationX", 0,
|
||||||
|
ScreenUtil.screenWidth / 2f - ScreenUtil.dip2px(15 + 19)).setDuration(500);
|
||||||
|
translationXAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
|
translationXAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mBinding.ivGiftAnim.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBinding.ivBox.post(() -> {
|
||||||
|
translationYAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationY", 0,
|
||||||
|
ScreenUtil.screenHeight - (mBinding.ivBox.getBottom() + mBinding.ivBox.getTop()) / 2f - ScreenUtil.dip2px(55)).setDuration(500);
|
||||||
|
translationYAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
|
});
|
||||||
|
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
||||||
|
if (walletInfo != null) {
|
||||||
|
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(walletInfo.getDiamondNum()));
|
||||||
|
}
|
||||||
|
loadKeyInfo();
|
||||||
|
looperPrize();
|
||||||
|
}
|
||||||
|
|
||||||
objectAnimator = ObjectAnimator.ofFloat(binding.ivGiftAnim,
|
@SuppressLint("CheckResult")
|
||||||
"translationX", 0, ScreenUtil.screenWidth / 2f).setDuration(500);
|
private void loadKeyInfo(){
|
||||||
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
|
||||||
objectAnimator1 = ObjectAnimator.ofFloat(binding.ivGiftAnim,
|
|
||||||
"translationY", 0, ScreenUtil.screenHeight / 2f + 100).setDuration(500);
|
|
||||||
objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator());
|
|
||||||
BoxModel.get()
|
BoxModel.get()
|
||||||
.getKeyInfo()
|
.getKeyInfo(boxType)
|
||||||
//.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.doOnError(throwable -> SingleToastUtil.showToast(throwable.getMessage()))
|
|
||||||
.subscribe(keyInfo -> {
|
.subscribe(keyInfo -> {
|
||||||
changeKeyNum(keyInfo.getKeyNum());
|
changeKeyNum(keyInfo.getKeyNum());
|
||||||
price = keyInfo.getKeyPrice();
|
price = keyInfo.getKeyPrice();
|
||||||
});
|
});
|
||||||
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
|
||||||
if (walletInfo != null) gold = walletInfo.getGoldNum();
|
|
||||||
binding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(gold));
|
|
||||||
binding.randomLayout.start();
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
looperPrize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
/* case R.id.stv_help:
|
case R.id.root_view:
|
||||||
BoxHelpActivity.start(this, binding.getRoot().getHeight(), binding.getRoot().getWidth());
|
finish();
|
||||||
break;
|
break;
|
||||||
case R.id.stv_jackpot:
|
|
||||||
BoxPrizeActivity.start(this, binding.getRoot().getHeight(), binding.getRoot().getWidth());
|
|
||||||
break;
|
|
||||||
case R.id.stv_record:
|
|
||||||
BoxPrizeRecordActivity.start(this, binding.getRoot().getHeight(), binding.getRoot().getWidth());
|
|
||||||
break;*/
|
|
||||||
case R.id.iv_more:
|
case R.id.iv_more:
|
||||||
new BoxMoreDialog(context).openDialog();
|
new BoxMoreDialog(context).openDialog();
|
||||||
break;
|
break;
|
||||||
|
case R.id.tv_rank:
|
||||||
|
DialogWebViewActivity.start(context, UriProvider.getBoxRank(), false);
|
||||||
|
break;
|
||||||
case R.id.iv_open:
|
case R.id.iv_open:
|
||||||
binding.svgaOpen.startAnimation();
|
openBox(StringUtils.toInt(mBinding.editNum.getText().toString(), 0));
|
||||||
binding.ivOpen.setEnabled(false);
|
break;
|
||||||
ivBox.setImageResource(R.drawable.box_close_normal);
|
case R.id.iv_sub:
|
||||||
openBox(StringUtils.toInt(binding.editNum.getText().toString()));
|
mBinding.editNum.setText(String.valueOf(Math.max(StringUtils.toInt(mBinding.editNum.getText().toString(), 0) - 1, 0)));
|
||||||
|
break;
|
||||||
|
case R.id.iv_add:
|
||||||
|
mBinding.editNum.setText(String.valueOf(StringUtils.toInt(mBinding.editNum.getText().toString(), 0) + 1));
|
||||||
|
break;
|
||||||
|
case R.id.view_bg:
|
||||||
|
case R.id.iv_title:
|
||||||
|
//do nothing
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -166,16 +135,9 @@ public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showBuyDialog() {
|
private void showBuyDialog() {
|
||||||
new BuyKeyDialog(getContext(), price).show();
|
new BuyKeyDialog(this, price).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
binding.randomLayout.stop();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查钥匙(锤子)数量
|
* 检查钥匙(锤子)数量
|
||||||
*
|
*
|
||||||
@@ -184,76 +146,56 @@ public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBi
|
|||||||
* false 表示数量没问题,可以继续操作
|
* false 表示数量没问题,可以继续操作
|
||||||
*/
|
*/
|
||||||
private boolean checkKeyNum(int count) {
|
private boolean checkKeyNum(int count) {
|
||||||
|
if (count == 0) {
|
||||||
|
SingleToastUtil.showToast("开启数量不能为0!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (keyNum == 0) {
|
if (keyNum == 0) {
|
||||||
showBuyDialog();
|
showBuyDialog();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (keyNum < count) {
|
if (keyNum < count) {
|
||||||
new KeyDeficiencyDialog(getContext(), count, count - keyNum).show();
|
new KeyDeficiencyDialog(this, count, count - keyNum).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable runnableClose = () -> binding.ivBox.setImageResource(R.drawable.box_close_normal);
|
|
||||||
|
|
||||||
private Runnable runnableOpen = () -> {
|
|
||||||
if (eggAnim == null) {
|
|
||||||
eggAnim = (AnimationDrawable) getContext().getResources().getDrawable(R.drawable.anim_egg);
|
|
||||||
} else {
|
|
||||||
eggAnim.stop();
|
|
||||||
}
|
|
||||||
binding.ivBox.setImageDrawable(eggAnim);
|
|
||||||
eggAnim.start();
|
|
||||||
};
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private void openBox(int count) {
|
private void openBox(int count) {
|
||||||
/* if (checkKeyNum(count)) {
|
mBinding.ivOpen.setEnabled(false);
|
||||||
binding.ivOpen.setEnabled(true);
|
if (checkKeyNum(count)) {
|
||||||
|
mBinding.ivOpen.setEnabled(true);
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
// changeBoxStatus();
|
mBinding.svgaOpen.startAnimation();
|
||||||
BoxModel.get()
|
BoxModel.get().openBox(boxType, count, true)
|
||||||
.openBox(count, true)
|
.compose(bindToLifecycle())
|
||||||
//.compose(bindToLifecycle())
|
|
||||||
//.delay(1, TimeUnit.SECONDS)
|
|
||||||
//delay后让转回主线程,不然刷新view会有问题
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.doOnError(throwable -> {
|
.doOnError(throwable -> {
|
||||||
binding.ivOpen.setEnabled(true);
|
mBinding.ivOpen.setEnabled(true);
|
||||||
if (throwable instanceof FailReasonException) {
|
|
||||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
|
||||||
switch (failReasonException.getCode()) {
|
|
||||||
case BoxModel.ERROR_CODE_KEY_NUM_NOT_ENOUGH:
|
|
||||||
break;
|
|
||||||
case BalanceNotEnoughExeption.code:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SingleToastUtil.showToast(throwable.getMessage());
|
SingleToastUtil.showToast(throwable.getMessage());
|
||||||
})
|
})
|
||||||
.subscribe(openBoxResult -> {
|
.subscribe(openBoxResult -> {
|
||||||
//binding.svgaOpen.stopAnimation();
|
|
||||||
//binding.randomLayout.addPrize(openBoxResult.getPrizeItemList());
|
|
||||||
changeKeyNum(openBoxResult.getRemainKeyNum());
|
changeKeyNum(openBoxResult.getRemainKeyNum());
|
||||||
binding.ivOpen.setEnabled(true);
|
mBinding.ivOpen.setEnabled(true);
|
||||||
cacheList.addAll(openBoxResult.getPrizeItemList());
|
cacheList.addAll(openBoxResult.getPrizeItemList());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
private void looperPrize() {
|
private void looperPrize() {
|
||||||
disposable = Observable.interval(0, 600, TimeUnit.MILLISECONDS)
|
Observable.interval(0, 600, TimeUnit.MILLISECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.filter(aLong -> cacheList.size() > 0)
|
.filter(aLong -> cacheList.size() > 0)
|
||||||
.subscribe(aLong -> {
|
.subscribe(aLong -> {
|
||||||
String url = cacheList.get(0).getPrizeImgUrl();
|
String url = cacheList.get(0).getPrizeImgUrl();
|
||||||
if (cacheList.size() > 0) cacheList.remove(0);
|
if (cacheList.size() > 0) cacheList.remove(0);
|
||||||
if (!TextUtils.isEmpty(url)) {
|
if (!TextUtils.isEmpty(url)) {
|
||||||
objectAnimator.start();
|
translationXAnimator.start();
|
||||||
objectAnimator1.start();
|
if (translationYAnimator != null) translationYAnimator.start();
|
||||||
binding.svgaGiftBg.startAnimation();
|
mBinding.ivGiftAnim.setVisibility(View.VISIBLE);
|
||||||
ImageLoadUtils.loadImage(context, url, binding.ivGiftAnim);
|
mBinding.svgaGiftBg.startAnimation();
|
||||||
|
ImageLoadUtils.loadImage(context, url, mBinding.ivGiftAnim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, e -> looperPrize());//出错了继续looper......
|
, e -> looperPrize());//出错了继续looper......
|
||||||
@@ -261,13 +203,6 @@ public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void changeBoxStatus() {
|
|
||||||
ivBox.removeCallbacks(runnableClose);
|
|
||||||
ivBox.removeCallbacks(runnableOpen);
|
|
||||||
ivBox.postDelayed(runnableOpen, 100);
|
|
||||||
ivBox.postDelayed(runnableClose, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新钥匙(锤子)数量
|
* 更新钥匙(锤子)数量
|
||||||
*
|
*
|
||||||
@@ -275,8 +210,7 @@ public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBi
|
|||||||
*/
|
*/
|
||||||
private void changeKeyNum(int num) {
|
private void changeKeyNum(int num) {
|
||||||
keyNum = num;
|
keyNum = num;
|
||||||
binding.tvKeyNum.setText(keyNum + "");
|
mBinding.tvKeyNum.setText(keyNum + "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,71 +219,26 @@ public class TreasureBoxActivity extends BaseBindingDialog<ActivityTreasureBoxBi
|
|||||||
* @param g
|
* @param g
|
||||||
*/
|
*/
|
||||||
private void setGold(double g) {
|
private void setGold(double g) {
|
||||||
gold = g;
|
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(g));
|
||||||
binding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(gold));
|
PayModel.get().getCurrentWalletInfo().setDiamondNum(g);
|
||||||
PayModel.get().getCurrentWalletInfo().setGoldNum(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void handleAutoOpenBoxEvent(AutoOpenBoxEvent event) {
|
|
||||||
if (event.isRunning()) {
|
|
||||||
OpenBoxResult openBoxResult = event.getOpenBoxResult();
|
|
||||||
binding.randomLayout.addPrize(openBoxResult.getPrizeItemList());
|
|
||||||
changeKeyNum(openBoxResult.getRemainKeyNum());
|
|
||||||
if (openBoxResult.getRemainKeyNum() == 0)
|
|
||||||
binding.ivOpen.setImageResource(R.drawable.auto_open_box_normal);
|
|
||||||
} else {
|
|
||||||
binding.ivOpen.setImageResource(R.drawable.auto_open_box_normal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void handleBuyKeyEvent(BoxBuyKeyEvent event) {
|
|
||||||
if (event.isSuccess()) {
|
|
||||||
KeyInfo keyInfo = event.getKeyInfo();
|
|
||||||
int goldNum = keyInfo.getGoldNum();
|
|
||||||
changeKeyNum(keyInfo.getKeyNum());
|
|
||||||
setGold(goldNum);
|
|
||||||
if (event.isKeyDeficiency()) {
|
|
||||||
openBox(event.getCount());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (event.getCode()) {
|
|
||||||
case BalanceNotEnoughExeption.code:
|
|
||||||
// 刷新钱包
|
|
||||||
PayModel.get()
|
|
||||||
.getWalletInfo(AuthModel.get().getCurrentUid())
|
|
||||||
.subscribe(walletInfo -> setGold(walletInfo.getGoldNum()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private void subscribeEvent() {
|
private void subscribeEvent() {
|
||||||
//更新金币数量和被踢出房间退出
|
//更新金币数量和被踢出房间退出
|
||||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||||
//.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(roomEvent -> {
|
.subscribe(roomEvent -> {
|
||||||
switch (roomEvent.getEvent()) {
|
switch (roomEvent.getEvent()) {
|
||||||
case RoomEvent.WALLET_UPDATE:
|
case RoomEvent.WALLET_UPDATE:
|
||||||
setGold(roomEvent.getWalletInfo().getGoldNum());
|
loadKeyInfo();
|
||||||
|
setGold(roomEvent.getWalletInfo().getDiamondNum());
|
||||||
break;
|
break;
|
||||||
case RoomEvent.KICK_OUT_ROOM:
|
case RoomEvent.KICK_OUT_ROOM:
|
||||||
closeDialog();
|
finish();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDetachedFromWindow() {
|
|
||||||
super.onDetachedFromWindow();
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
binding.randomLayout.stop();
|
|
||||||
ivBox.removeCallbacks(runnableOpen);
|
|
||||||
ivBox.removeCallbacks(runnableClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,121 +1,133 @@
|
|||||||
package com.yizhuan.erban.treasure_box.activity;
|
package com.yizhuan.erban.treasure_box.activity;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.AnimationDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||||
|
|
||||||
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||||
import com.yizhuan.erban.databinding.ActivityTreasureBoxHonourBinding;
|
import com.yizhuan.erban.databinding.ActivityTreasureBoxHonourBinding;
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenBoxService;
|
|
||||||
import com.yizhuan.erban.treasure_box.service.OpenHonourBoxService;
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BoxMoreDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.BoxMoreDialog;
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BuyKeyDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.BuyKeyDialog;
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.KeyDeficiencyDialog;
|
import com.yizhuan.erban.treasure_box.widget.dialog.KeyDeficiencyDialog;
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
import com.yizhuan.treasure_box.bean.HonourBuyKeyResultInfo;
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||||
import com.yizhuan.treasure_box.bean.OpenBoxHonourResult;
|
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||||
import com.yizhuan.treasure_box.bean.OpenBoxResult;
|
|
||||||
import com.yizhuan.treasure_box.event.AutoOpenHonourBoxEvent;
|
|
||||||
import com.yizhuan.treasure_box.event.HonourBoxBuyKeyEvent;
|
|
||||||
import com.yizhuan.treasure_box.model.BoxModel;
|
import com.yizhuan.treasure_box.model.BoxModel;
|
||||||
import com.yizhuan.treasure_box.model.IBoxModel;
|
import com.yizhuan.treasure_box.model.IBoxModel;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||||
import com.yizhuan.treasure_box.event.AutoOpenBoxEvent;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BalanceNotEnoughExeption;
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||||
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import java.util.ArrayList;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.activity_treasure_box_honour)
|
@ActLayoutRes(R.layout.activity_treasure_box_honour)
|
||||||
public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreasureBoxHonourBinding> {
|
public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreasureBoxHonourBinding> {
|
||||||
private volatile double gold;
|
|
||||||
private int price = 20;
|
private int price = 20;
|
||||||
private ImageView ivBox;
|
|
||||||
private volatile int keyNum;
|
private volatile int keyNum;
|
||||||
private AnimationDrawable eggAnim;
|
private ArrayList<PrizeInfo> cacheList = new ArrayList<>();
|
||||||
|
private ObjectAnimator translationXAnimator;
|
||||||
|
private ObjectAnimator translationYAnimator;
|
||||||
|
private int boxType = IBoxModel.BOX_TYPE_HONOUR;
|
||||||
|
|
||||||
public static void start(Context context) {
|
public static void start(Context context) {
|
||||||
Intent starter = new Intent(context, TreasureBoxHonourActivity.class);
|
Intent starter = new Intent(context, TreasureBoxHonourActivity.class);
|
||||||
//starter.putExtra();
|
|
||||||
context.startActivity(starter);
|
context.startActivity(starter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight);
|
||||||
|
getWindow().setGravity(Gravity.CENTER);
|
||||||
subscribeEvent();
|
subscribeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
mBinding.setClick(this);
|
mBinding.setClick(this);
|
||||||
ivBox = mBinding.ivBox;
|
translationXAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationX", 0,
|
||||||
|
ScreenUtil.screenWidth / 2f - ScreenUtil.dip2px(15 + 19)).setDuration(500);
|
||||||
|
translationXAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
|
translationXAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mBinding.ivGiftAnim.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBinding.ivBox.post(() -> {
|
||||||
|
translationYAnimator = ObjectAnimator.ofFloat(mBinding.ivGiftAnim, "translationY", 0,
|
||||||
|
ScreenUtil.screenHeight - (mBinding.ivBox.getBottom() + mBinding.ivBox.getTop()) / 2f - ScreenUtil.dip2px(55)).setDuration(500);
|
||||||
|
translationYAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
|
});
|
||||||
|
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
||||||
|
if (walletInfo != null) {
|
||||||
|
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(walletInfo.getGoldNum()));
|
||||||
|
}
|
||||||
|
loadKeyInfo();
|
||||||
|
looperPrize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@Override
|
private void loadKeyInfo() {
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
BoxModel.get()
|
BoxModel.get()
|
||||||
.getHonourKeyInfo(AuthModel.get().getCurrentUid())
|
.getKeyInfo(boxType)
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.doOnError(throwable -> toast(throwable.getMessage()))
|
|
||||||
.subscribe(keyInfo -> {
|
.subscribe(keyInfo -> {
|
||||||
changeKeyNum(keyInfo.getKeyNum());
|
changeKeyNum(keyInfo.getKeyNum());
|
||||||
price = keyInfo.getKeyPrice();
|
price = keyInfo.getKeyPrice();
|
||||||
});
|
});
|
||||||
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
|
||||||
if (walletInfo != null) gold = walletInfo.getGoldNum();
|
|
||||||
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(gold));
|
|
||||||
mBinding.ivOpen.setImageResource(OpenHonourBoxService.isAutoOpenBox ? R.drawable.stop_open_box : R.drawable.auto_open_box);
|
|
||||||
mBinding.randomLayout.start();
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.ib_close:
|
case R.id.root_view:
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
case R.id.iv_open:
|
case R.id.iv_open:
|
||||||
mBinding.ivOpen.setEnabled(false);
|
|
||||||
ivBox.setImageResource(R.drawable.box_close_normal);
|
|
||||||
openBox(StringUtils.toInt(mBinding.editNum.getText().toString()));
|
openBox(StringUtils.toInt(mBinding.editNum.getText().toString()));
|
||||||
break;
|
break;
|
||||||
case R.id.iv_more:
|
case R.id.iv_more:
|
||||||
new BoxMoreDialog(context).openDialog();
|
new BoxMoreDialog(context).openDialog();
|
||||||
break;
|
break;
|
||||||
|
case R.id.tv_rank:
|
||||||
|
DialogWebViewActivity.start(context, UriProvider.getBoxRank(), false);
|
||||||
|
break;
|
||||||
|
case R.id.iv_sub:
|
||||||
|
mBinding.editNum.setText(String.valueOf(Math.max(StringUtils.toInt(mBinding.editNum.getText().toString(), 0) - 1, 0)));
|
||||||
|
break;
|
||||||
|
case R.id.iv_add:
|
||||||
|
mBinding.editNum.setText(String.valueOf(StringUtils.toInt(mBinding.editNum.getText().toString(), 0) + 1));
|
||||||
|
break;
|
||||||
|
case R.id.view_bg:
|
||||||
|
case R.id.iv_title:
|
||||||
|
//do nothing
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -125,13 +137,6 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
new BuyKeyDialog(this, price, IBoxModel.BOX_TYPE_HONOUR).show();
|
new BuyKeyDialog(this, price, IBoxModel.BOX_TYPE_HONOUR).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
mBinding.randomLayout.stop();
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查钥匙(锤子)数量
|
* 检查钥匙(锤子)数量
|
||||||
*
|
*
|
||||||
@@ -140,6 +145,11 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
* false 表示数量没问题,可以继续操作
|
* false 表示数量没问题,可以继续操作
|
||||||
*/
|
*/
|
||||||
private boolean checkKeyNum(int count) {
|
private boolean checkKeyNum(int count) {
|
||||||
|
if (count == 0) {
|
||||||
|
SingleToastUtil.showToast("开启数量不能为0!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyNum == 0) {
|
if (keyNum == 0) {
|
||||||
showBuyDialog();
|
showBuyDialog();
|
||||||
return true;
|
return true;
|
||||||
@@ -151,60 +161,47 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable runnableClose = () -> mBinding.ivBox.setImageResource(R.drawable.box_close);
|
|
||||||
|
|
||||||
private Runnable runnableOpen = () -> {
|
|
||||||
if (eggAnim == null) {
|
|
||||||
eggAnim = (AnimationDrawable) getResources().getDrawable(R.drawable.anim_honour_egg);
|
|
||||||
} else {
|
|
||||||
eggAnim.stop();
|
|
||||||
}
|
|
||||||
mBinding.ivBox.setImageDrawable(eggAnim);
|
|
||||||
eggAnim.start();
|
|
||||||
};
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private void openBox(int count) {
|
private void openBox(int count) {
|
||||||
|
mBinding.ivOpen.setEnabled(false);
|
||||||
if (checkKeyNum(count)) {
|
if (checkKeyNum(count)) {
|
||||||
mBinding.ivOpen.setEnabled(true);
|
mBinding.ivOpen.setEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeBoxStatus();
|
mBinding.svgaOpen.startAnimation();
|
||||||
BoxModel.get()
|
BoxModel.get()
|
||||||
.openHonourBox(AuthModel.get().getCurrentUid(), false,
|
.openBox(boxType, count, false)
|
||||||
AvRoomDataManager.get().mCurrentRoomInfo.getUid(), count,
|
|
||||||
AuthModel.get().getTicket())
|
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.delay(1, TimeUnit.SECONDS)
|
|
||||||
//delay后让转回主线程,不然刷新view会有问题
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.doOnError(throwable -> {
|
.doOnError(throwable -> {
|
||||||
mBinding.ivOpen.setEnabled(true);
|
mBinding.ivOpen.setEnabled(true);
|
||||||
if (throwable instanceof FailReasonException) {
|
|
||||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
|
||||||
switch (failReasonException.getCode()) {
|
|
||||||
case BoxModel.ERROR_CODE_KEY_NUM_NOT_ENOUGH:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BalanceNotEnoughExeption.code:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toast(throwable.getMessage());
|
toast(throwable.getMessage());
|
||||||
})
|
})
|
||||||
.subscribe(openBoxResult -> {
|
.subscribe(openBoxResult -> {
|
||||||
mBinding.randomLayout.addPrize(openBoxResult.getPrizeItemList());
|
|
||||||
changeKeyNum(openBoxResult.getRemainKeyNum());
|
changeKeyNum(openBoxResult.getRemainKeyNum());
|
||||||
mBinding.ivOpen.setEnabled(true);
|
mBinding.ivOpen.setEnabled(true);
|
||||||
|
cacheList.addAll(openBoxResult.getPrizeItemList());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
private void looperPrize() {
|
||||||
|
Observable.interval(0, 600, TimeUnit.MILLISECONDS)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.filter(aLong -> cacheList.size() > 0)
|
||||||
|
.subscribe(aLong -> {
|
||||||
|
String url = cacheList.get(0).getPrizeImgUrl();
|
||||||
|
if (cacheList.size() > 0) cacheList.remove(0);
|
||||||
|
if (!TextUtils.isEmpty(url)) {
|
||||||
|
translationXAnimator.start();
|
||||||
|
if (translationYAnimator != null) translationYAnimator.start();
|
||||||
|
mBinding.ivGiftAnim.setVisibility(View.VISIBLE);
|
||||||
|
mBinding.svgaGiftBg.startAnimation();
|
||||||
|
ImageLoadUtils.loadImage(context, url, mBinding.ivGiftAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, e -> looperPrize());//出错了继续looper......
|
||||||
|
|
||||||
private void changeBoxStatus() {
|
|
||||||
ivBox.removeCallbacks(runnableClose);
|
|
||||||
ivBox.removeCallbacks(runnableOpen);
|
|
||||||
ivBox.postDelayed(runnableOpen, 100);
|
|
||||||
ivBox.postDelayed(runnableClose, 3000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,7 +212,6 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
private void changeKeyNum(int num) {
|
private void changeKeyNum(int num) {
|
||||||
keyNum = num;
|
keyNum = num;
|
||||||
mBinding.tvKeyNum.setText(keyNum + "");
|
mBinding.tvKeyNum.setText(keyNum + "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -224,44 +220,8 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
* @param g
|
* @param g
|
||||||
*/
|
*/
|
||||||
private void setGold(double g) {
|
private void setGold(double g) {
|
||||||
gold = g;
|
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(g));
|
||||||
mBinding.tvDiamondNum.setText(FormatUtils.formatBigDecimal(gold));
|
PayModel.get().getCurrentWalletInfo().setDiamondNum(g);
|
||||||
PayModel.get().getCurrentWalletInfo().setGoldNum(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void handleAutoOpenBoxEvent(AutoOpenHonourBoxEvent event) {
|
|
||||||
if (event.isRunning()) {
|
|
||||||
OpenBoxHonourResult openBoxResult = event.getOpenBoxResult();
|
|
||||||
mBinding.randomLayout.addPrize(openBoxResult.getPrizeItemList());
|
|
||||||
changeKeyNum(openBoxResult.getRemainKeyNum());
|
|
||||||
if (openBoxResult.getRemainKeyNum() == 0)
|
|
||||||
mBinding.ivOpen.setImageResource(R.drawable.auto_open_box);
|
|
||||||
} else {
|
|
||||||
mBinding.ivOpen.setImageResource(R.drawable.auto_open_box);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void handleBuyKeyEvent(HonourBoxBuyKeyEvent event) {
|
|
||||||
if (event.isSuccess()) {
|
|
||||||
HonourBuyKeyResultInfo keyInfo = event.getKeyInfo();
|
|
||||||
int goldNum = keyInfo.getGoldNum();
|
|
||||||
changeKeyNum(keyInfo.getKeyNum());
|
|
||||||
setGold(goldNum);
|
|
||||||
if (event.isKeyDeficiency()) {
|
|
||||||
openBox(event.getCount());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (event.getCode()) {
|
|
||||||
case BalanceNotEnoughExeption.code:
|
|
||||||
// 刷新钱包
|
|
||||||
PayModel.get()
|
|
||||||
.getWalletInfo(AuthModel.get().getCurrentUid())
|
|
||||||
.subscribe(walletInfo -> setGold(walletInfo.getGoldNum()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@@ -272,7 +232,8 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
.subscribe(roomEvent -> {
|
.subscribe(roomEvent -> {
|
||||||
switch (roomEvent.getEvent()) {
|
switch (roomEvent.getEvent()) {
|
||||||
case RoomEvent.WALLET_UPDATE:
|
case RoomEvent.WALLET_UPDATE:
|
||||||
setGold(roomEvent.getWalletInfo().getGoldNum());
|
loadKeyInfo();
|
||||||
|
setGold(roomEvent.getWalletInfo().getDiamondNum());
|
||||||
break;
|
break;
|
||||||
case RoomEvent.KICK_OUT_ROOM:
|
case RoomEvent.KICK_OUT_ROOM:
|
||||||
finish();
|
finish();
|
||||||
@@ -281,12 +242,5 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
mBinding.randomLayout.stop();
|
|
||||||
ivBox.removeCallbacks(runnableOpen);
|
|
||||||
ivBox.removeCallbacks(runnableClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,98 +0,0 @@
|
|||||||
package com.yizhuan.erban.treasure_box.service;
|
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.yizhuan.treasure_box.model.BoxModel;
|
|
||||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
|
||||||
import com.yizhuan.treasure_box.event.AutoOpenBoxEvent;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
public class OpenBoxService extends Service {
|
|
||||||
|
|
||||||
public static boolean isAutoOpenBox;
|
|
||||||
public static boolean isPublic;
|
|
||||||
|
|
||||||
private Disposable disposable;
|
|
||||||
private Disposable disposable2;
|
|
||||||
|
|
||||||
private int keyNum;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start(Context context) {
|
|
||||||
Intent starter = new Intent(context, OpenBoxService.class);
|
|
||||||
context.startActivity(starter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void stop(Context context) {
|
|
||||||
Intent stop = new Intent(context, OpenBoxService.class);
|
|
||||||
context.stopService(stop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
isAutoOpenBox = true;
|
|
||||||
disposable = Observable.interval(0, 2, TimeUnit.SECONDS)
|
|
||||||
.subscribe(this::openBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openBox(Long aLong) {
|
|
||||||
disposable2 = BoxModel.get()
|
|
||||||
.openBox(1, isPublic)
|
|
||||||
.doOnError(throwable -> {
|
|
||||||
if (throwable instanceof FailReasonException) {
|
|
||||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
|
||||||
switch (failReasonException.getCode()) {
|
|
||||||
case BoxModel.ERROR_CODE_KEY_NUM_NOT_ENOUGH:
|
|
||||||
EventBus.getDefault().post(new AutoOpenBoxEvent().setRunning(false));
|
|
||||||
stopAutoOpenBox();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SingleToastUtil.showToast(BasicConfig.INSTANCE.getAppContext(),throwable.getMessage());
|
|
||||||
})
|
|
||||||
.subscribe(openBoxResult -> {
|
|
||||||
keyNum = openBoxResult.getRemainKeyNum();
|
|
||||||
EventBus.getDefault().post(new AutoOpenBoxEvent().setRunning(true).setOpenBoxResult(openBoxResult));
|
|
||||||
if (keyNum == 0) {
|
|
||||||
stopAutoOpenBox();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopAutoOpenBox() {
|
|
||||||
disposable.dispose();
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
return super.onStartCommand(intent, flags, startId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
isAutoOpenBox = false;
|
|
||||||
if (disposable != null) disposable.dispose();
|
|
||||||
if (disposable2 != null) disposable2.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,102 +0,0 @@
|
|||||||
package com.yizhuan.erban.treasure_box.service;
|
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.yizhuan.treasure_box.event.AutoOpenHonourBoxEvent;
|
|
||||||
import com.yizhuan.treasure_box.model.BoxModel;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
public class OpenHonourBoxService extends Service {
|
|
||||||
|
|
||||||
public static boolean isAutoOpenBox;
|
|
||||||
public static boolean isPublic;
|
|
||||||
|
|
||||||
private Disposable disposable;
|
|
||||||
private Disposable disposable2;
|
|
||||||
|
|
||||||
private int keyNum;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start(Context context) {
|
|
||||||
Intent starter = new Intent(context, OpenHonourBoxService.class);
|
|
||||||
context.startActivity(starter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void stop(Context context) {
|
|
||||||
Intent stop = new Intent(context, OpenHonourBoxService.class);
|
|
||||||
context.stopService(stop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
isAutoOpenBox = true;
|
|
||||||
disposable = Observable.interval(0, 2, TimeUnit.SECONDS)
|
|
||||||
.subscribe(this::openBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openBox(Long aLong) {
|
|
||||||
disposable2 = BoxModel.get()
|
|
||||||
.openHonourBox(AuthModel.get().getCurrentUid(), isPublic,
|
|
||||||
AvRoomDataManager.get().mCurrentRoomInfo.getUid(), 1,
|
|
||||||
AuthModel.get().getTicket())
|
|
||||||
.doOnError(throwable -> {
|
|
||||||
if (throwable instanceof FailReasonException) {
|
|
||||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
|
||||||
switch (failReasonException.getCode()) {
|
|
||||||
case BoxModel.ERROR_CODE_KEY_NUM_NOT_ENOUGH:
|
|
||||||
EventBus.getDefault().post(new AutoOpenHonourBoxEvent().setRunning(false));
|
|
||||||
stopAutoOpenBox();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SingleToastUtil.showToast(BasicConfig.INSTANCE.getAppContext(),throwable.getMessage());
|
|
||||||
})
|
|
||||||
.subscribe(openBoxResult -> {
|
|
||||||
keyNum = openBoxResult.getRemainKeyNum();
|
|
||||||
EventBus.getDefault().post(new AutoOpenHonourBoxEvent().setRunning(true).setOpenBoxResult(openBoxResult));
|
|
||||||
if (keyNum == 0) {
|
|
||||||
stopAutoOpenBox();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopAutoOpenBox() {
|
|
||||||
disposable.dispose();
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
return super.onStartCommand(intent, flags, startId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
isAutoOpenBox = false;
|
|
||||||
if (disposable != null) disposable.dispose();
|
|
||||||
if (disposable2 != null) disposable2.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -7,6 +7,8 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.databinding.DialogBoxMoreBinding;
|
import com.yizhuan.erban.databinding.DialogBoxMoreBinding;
|
||||||
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||||
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.dialog_box_more)
|
@ActLayoutRes(R.layout.dialog_box_more)
|
||||||
@@ -33,9 +35,11 @@ public class BoxMoreDialog extends BaseBindingDialog<DialogBoxMoreBinding> {
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
binding.tvHistory.setOnClickListener(v -> {
|
binding.tvHistory.setOnClickListener(v -> {
|
||||||
|
DialogWebViewActivity.start(context, UriProvider.getBoxHistory(),false);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
});
|
});
|
||||||
binding.tvBoxRule.setOnClickListener(v -> {
|
binding.tvBoxRule.setOnClickListener(v -> {
|
||||||
|
DialogWebViewActivity.start(context, UriProvider.getBoxHelp(),false);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
});
|
});
|
||||||
binding.tvGetKey.setOnClickListener(v -> {
|
binding.tvGetKey.setOnClickListener(v -> {
|
||||||
|
BIN
app/src/module_treasure_box/res/drawable-xhdpi/choose_box_bg.png
Normal file
BIN
app/src/module_treasure_box/res/drawable-xhdpi/choose_box_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@@ -13,7 +13,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/root_view"
|
android:id="@+id/root_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:onClick="@{click}">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/view_bg"
|
android:id="@+id/view_bg"
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
android:layout_marginTop="17dp"
|
android:layout_marginTop="17dp"
|
||||||
android:layout_marginEnd="@dimen/dp_30"
|
android:layout_marginEnd="@dimen/dp_30"
|
||||||
android:background="@drawable/treasure_box_bg_normal"
|
android:background="@drawable/treasure_box_bg_normal"
|
||||||
|
android:onClick="@{click}"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
android:id="@+id/iv_title"
|
android:id="@+id/iv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/treasure_box_title_normal"
|
android:src="@drawable/treasure_box_title_normal"
|
||||||
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@@ -75,12 +78,12 @@
|
|||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="18dp"
|
||||||
android:drawableTop="@drawable/treasure_box_diamond"
|
android:drawableTop="@drawable/treasure_box_diamond"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="200"
|
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_more" />
|
app:layout_constraintTop_toBottomOf="@id/iv_more"
|
||||||
|
tools:text="200" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_key_num"
|
android:id="@+id/tv_key_num"
|
||||||
@@ -89,12 +92,12 @@
|
|||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:drawableTop="@drawable/treasure_box_meteor"
|
android:drawableTop="@drawable/treasure_box_meteor"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="200"
|
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_diamond_num" />
|
app:layout_constraintTop_toBottomOf="@id/tv_diamond_num"
|
||||||
|
tools:text="200" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_box"
|
android:id="@+id/iv_box"
|
||||||
@@ -160,35 +163,27 @@
|
|||||||
android:id="@+id/iv_add"
|
android:id="@+id/iv_add"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/treasure_box_add_normal"
|
android:src="@drawable/treasure_box_add_normal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/edit_num"
|
app:layout_constraintStart_toEndOf="@id/edit_num"
|
||||||
app:layout_constraintTop_toTopOf="@id/iv_sub" />
|
app:layout_constraintTop_toTopOf="@id/iv_sub" />
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_open"
|
android:id="@+id/iv_open"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="25dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="22dp"
|
android:layout_marginBottom="22dp"
|
||||||
android:onClick="@{click}"
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/auto_open_box_normal"
|
android:src="@drawable/auto_open_box_normal"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_sub" />
|
app:layout_constraintTop_toBottomOf="@id/iv_sub" />
|
||||||
|
|
||||||
<com.yizhuan.erban.treasure_box.widget.PrizeCover
|
|
||||||
android:id="@+id/random_layout"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:layout_marginTop="60dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
|
||||||
tools:visibility="gone" />
|
|
||||||
|
|
||||||
<com.opensource.svgaplayer.SVGAImageView
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
android:id="@+id/svga_open"
|
android:id="@+id/svga_open"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
|
@@ -13,27 +13,33 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/root_view"
|
android:id="@+id/root_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
android:onClick="@{click}">
|
||||||
android:layout_marginEnd="@dimen/dp_15">
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/view_bg"
|
android:id="@+id/view_bg"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="387dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_30"
|
||||||
android:layout_marginTop="17dp"
|
android:layout_marginTop="17dp"
|
||||||
|
android:layout_marginEnd="@dimen/dp_30"
|
||||||
android:background="@drawable/treasure_box_bg_normal"
|
android:background="@drawable/treasure_box_bg_normal"
|
||||||
|
android:onClick="@{click}"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_title"
|
android:id="@+id/iv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/treasure_box_title"
|
android:src="@drawable/treasure_box_title"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_rank"
|
android:id="@+id/tv_rank"
|
||||||
@@ -72,12 +78,12 @@
|
|||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="18dp"
|
||||||
android:drawableTop="@drawable/treasure_box_diamond"
|
android:drawableTop="@drawable/treasure_box_diamond"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="200"
|
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_more" />
|
app:layout_constraintTop_toBottomOf="@id/iv_more"
|
||||||
|
tools:text="200" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_key_num"
|
android:id="@+id/tv_key_num"
|
||||||
@@ -86,25 +92,33 @@
|
|||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:drawableTop="@drawable/treasure_box_meteor"
|
android:drawableTop="@drawable/treasure_box_meteor"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="200"
|
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
app:layout_constraintEnd_toEndOf="@id/iv_more"
|
||||||
app:layout_constraintStart_toStartOf="@id/iv_more"
|
app:layout_constraintStart_toStartOf="@id/iv_more"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_diamond_num" />
|
app:layout_constraintTop_toBottomOf="@id/tv_diamond_num"
|
||||||
|
tools:text="200" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_box"
|
android:id="@+id/iv_box"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="60dp"
|
android:layout_marginTop="45dp"
|
||||||
android:onClick="@{click}"
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/box_close_normal"
|
android:src="@drawable/box_close"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_gift_anim"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_box"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_box"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_box"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_box" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_continuous_open"
|
android:id="@+id/tv_continuous_open"
|
||||||
@@ -137,7 +151,7 @@
|
|||||||
android:background="@color/white_transparent_12"
|
android:background="@color/white_transparent_12"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:minWidth="40dp"
|
android:minWidth="40dp"
|
||||||
android:text="9999"
|
android:text="1"
|
||||||
android:textColor="#ffc33c98"
|
android:textColor="#ffc33c98"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/iv_sub"
|
app:layout_constraintBottom_toBottomOf="@id/iv_sub"
|
||||||
@@ -160,24 +174,45 @@
|
|||||||
android:id="@+id/iv_open"
|
android:id="@+id/iv_open"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="25dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="22dp"
|
android:layout_marginBottom="22dp"
|
||||||
|
android:onClick="@{click}"
|
||||||
android:src="@drawable/auto_open_box"
|
android:src="@drawable/auto_open_box"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_sub" />
|
app:layout_constraintTop_toBottomOf="@id/iv_sub" />
|
||||||
|
|
||||||
<com.yizhuan.erban.treasure_box.widget.PrizeCover
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
android:id="@+id/random_layout"
|
android:id="@+id/svga_open"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="175dp"
|
android:layout_height="200dp"
|
||||||
android:layout_marginTop="60dp"
|
android:layout_marginTop="60dp"
|
||||||
|
app:autoPlay="false"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||||
tools:visibility="invisible" />
|
app:loopCount="1"
|
||||||
|
app:source="svga/bubble_pack.svga"
|
||||||
|
tools:visibility="gone" />
|
||||||
|
|
||||||
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
|
android:id="@+id/svga_gift_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="80dp"
|
||||||
|
android:layout_marginTop="60dp"
|
||||||
|
app:autoPlay="false"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_box"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_box"
|
||||||
|
app:loopCount="1"
|
||||||
|
app:source="svga/bubble_tran_bg.svga"
|
||||||
|
tools:background="@color/white"
|
||||||
|
tools:visibility="gone" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
@@ -54,13 +54,17 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_title" />
|
app:layout_constraintTop_toBottomOf="@id/iv_title" />
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/iv_open"
|
android:id="@+id/iv_open"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:src="@drawable/bg_treasure_box_dialog_button"
|
android:background="@drawable/choose_box_bg_normal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="立即开启"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
@@ -110,13 +114,18 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_title_honour" />
|
app:layout_constraintTop_toBottomOf="@id/iv_title_honour" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
|
<TextView
|
||||||
android:id="@+id/iv_open_honour"
|
android:id="@+id/iv_open_honour"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:src="@drawable/bg_treasure_box_dialog_button"
|
android:background="@drawable/choose_box_bg"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="立即开启"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
@@ -301,5 +301,26 @@ public class UriProvider {
|
|||||||
public static String getPersonalCharismaRank() {
|
public static String getPersonalCharismaRank() {
|
||||||
return JAVA_WEB_URL.concat("/accompany/modules/charm/index.html");
|
return JAVA_WEB_URL.concat("/accompany/modules/charm/index.html");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 宝箱排行
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static String getBoxRank() {
|
||||||
|
return JAVA_WEB_URL.concat("/accompany/modules/rank/index.html#/wishingWellRank");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 宝箱帮助
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static String getBoxHelp() {
|
||||||
|
return JAVA_WEB_URL.concat("/accompany/modules/rank/index.html#/wishingWellRule");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 宝箱记录
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static String getBoxHistory() {
|
||||||
|
return JAVA_WEB_URL.concat("/accompany/modules/rank/index.html#/wishingWellRecord");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1273,8 +1273,8 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
//更新消息提醒配置
|
//更新消息提醒配置
|
||||||
initNotificationConfig();
|
initNotificationConfig();
|
||||||
|
|
||||||
Log.e(TAG, "onSuccess: ready to open push");
|
//暂时关闭云信第三方推送,以后再开
|
||||||
NIMClient.getService(MixPushService.class).enable(true).setCallback(new RequestCallbackWrapper<Void>() {
|
NIMClient.getService(MixPushService.class).enable(false).setCallback(new RequestCallbackWrapper<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResult(int code, Void result, Throwable exception) {
|
public void onResult(int code, Void result, Throwable exception) {
|
||||||
Log.e(TAG, "onResult() called with: code = [" + code + "], result = [" + result + "], exception = [" + exception + "]");
|
Log.e(TAG, "onResult() called with: code = [" + code + "], result = [" + result + "], exception = [" + exception + "]");
|
||||||
|
@@ -57,11 +57,11 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<OpenBoxResult> openBox(int keyNum, boolean sendMessage) {
|
public Single<OpenBoxResult> openBox(int boxType,int keyNum, boolean sendMessage) {
|
||||||
if (AvRoomDataManager.get().mCurrentRoomInfo == null) {
|
if (AvRoomDataManager.get().mCurrentRoomInfo == null) {
|
||||||
return Single.error(new Throwable("当前房间信息为空."));
|
return Single.error(new Throwable("当前房间信息为空."));
|
||||||
}
|
}
|
||||||
return api.openBox(keyNum, sendMessage, AuthModel.get().getCurrentUid(),
|
return api.openBox(boxType,keyNum, sendMessage, AuthModel.get().getCurrentUid(),
|
||||||
AvRoomDataManager.get().mCurrentRoomInfo.getUid())
|
AvRoomDataManager.get().mCurrentRoomInfo.getUid())
|
||||||
.compose(RxHelper.handleSchedulers())
|
.compose(RxHelper.handleSchedulers())
|
||||||
.flatMap(openBoxResultServiceResult -> {
|
.flatMap(openBoxResultServiceResult -> {
|
||||||
@@ -110,8 +110,8 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<KeyInfo> getKeyInfo() {
|
public Single<KeyInfo> getKeyInfo(int boxType) {
|
||||||
return api.getKeyInfo(AuthModel.get().getCurrentUid())
|
return api.getKeyInfo(boxType,AuthModel.get().getCurrentUid())
|
||||||
.compose(RxHelper.handleSchedulers())
|
.compose(RxHelper.handleSchedulers())
|
||||||
.compose(RxHelper.handleBeanData());
|
.compose(RxHelper.handleBeanData());
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<OpenBoxHonourResult> openHonourBox(long uid, boolean sendMessage, long roomUid,
|
public Single<OpenBoxHonourResult> openHonourBox(long uid, boolean sendMessage, long roomUid,
|
||||||
int keyNum, String ticket) {
|
int keyNum, String ticket) {
|
||||||
return api.openHonourBox(uid, sendMessage, roomUid, keyNum, ticket)
|
return api.openHonourBox(uid, sendMessage, roomUid, keyNum, ticket)
|
||||||
.compose(RxHelper.handleSchedulers())
|
.compose(RxHelper.handleSchedulers())
|
||||||
.compose(RxHelper.handleBeanData());
|
.compose(RxHelper.handleBeanData());
|
||||||
@@ -184,7 +184,8 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("box/draw")
|
@POST("box/draw")
|
||||||
Single<ServiceResult<OpenBoxResult>> openBox(@Field("keyNum") int keyNum,
|
Single<ServiceResult<OpenBoxResult>> openBox(@Field("boxType") int boxType,
|
||||||
|
@Field("keyNum") int keyNum,
|
||||||
@Field("sendMessage") boolean sendMessage,
|
@Field("sendMessage") boolean sendMessage,
|
||||||
@Field("uid") long uid,
|
@Field("uid") long uid,
|
||||||
@Field("roomUid") long roomUid);
|
@Field("roomUid") long roomUid);
|
||||||
@@ -208,7 +209,8 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("box/userkey")
|
@GET("box/userkey")
|
||||||
Single<ServiceResult<KeyInfo>> getKeyInfo(@Query("uid") long uid);
|
Single<ServiceResult<KeyInfo>> getKeyInfo(@Query("boxType") int boxType,
|
||||||
|
@Query("uid") long uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取开箱子配置图片
|
* 获取开箱子配置图片
|
||||||
@@ -244,10 +246,10 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("box/diamond/draw")
|
@POST("box/diamond/draw")
|
||||||
Single<ServiceResult<OpenBoxHonourResult>> openHonourBox(@Field("uid") long uid,
|
Single<ServiceResult<OpenBoxHonourResult>> openHonourBox(@Field("uid") long uid,
|
||||||
@Field("sendMessage") boolean sendMessage,
|
@Field("sendMessage") boolean sendMessage,
|
||||||
@Field("roomUid") long roomUid,
|
@Field("roomUid") long roomUid,
|
||||||
@Field("keyNum") int keyNum,
|
@Field("keyNum") int keyNum,
|
||||||
@Field("ticket") String ticket);
|
@Field("ticket") String ticket);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买钻石宝箱钥匙
|
* 购买钻石宝箱钥匙
|
||||||
@@ -255,8 +257,8 @@ public class BoxModel extends BaseModel implements IBoxModel {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("box/diamond/buykey")
|
@POST("box/diamond/buykey")
|
||||||
Single<ServiceResult<HonourBuyKeyResultInfo>> buyHonourKey(@Field("uid") long uid,
|
Single<ServiceResult<HonourBuyKeyResultInfo>> buyHonourKey(@Field("uid") long uid,
|
||||||
@Field("keyNum") int keyNum,
|
@Field("keyNum") int keyNum,
|
||||||
@Field("ticket") String ticket);
|
@Field("ticket") String ticket);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 至尊蛋本期奖池
|
* 至尊蛋本期奖池
|
||||||
|
@@ -31,7 +31,7 @@ public interface IBoxModel extends IModel {
|
|||||||
* @param sendMessage
|
* @param sendMessage
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Single<OpenBoxResult> openBox(int keyNum, boolean sendMessage);
|
Single<OpenBoxResult> openBox(int boxType,int keyNum, boolean sendMessage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取中奖记录
|
* 获取中奖记录
|
||||||
@@ -60,7 +60,7 @@ public interface IBoxModel extends IModel {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Single<KeyInfo> getKeyInfo();
|
Single<KeyInfo> getKeyInfo(int boxType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取奖品列表
|
* 获取奖品列表
|
||||||
|
@@ -57,7 +57,7 @@ public class ScreenUtil {
|
|||||||
DisplayMetrics dm = context.getApplicationContext().getResources().getDisplayMetrics();
|
DisplayMetrics dm = context.getApplicationContext().getResources().getDisplayMetrics();
|
||||||
screenWidth = dm.widthPixels;
|
screenWidth = dm.widthPixels;
|
||||||
screenHeight = dm.heightPixels;
|
screenHeight = dm.heightPixels;
|
||||||
screenMin = (screenWidth > screenHeight) ? screenHeight : screenWidth;
|
screenMin = Math.min(screenWidth, screenHeight);
|
||||||
density = dm.density;
|
density = dm.density;
|
||||||
scaleDensity = dm.scaledDensity;
|
scaleDensity = dm.scaledDensity;
|
||||||
xdpi = dm.xdpi;
|
xdpi = dm.xdpi;
|
||||||
|
Reference in New Issue
Block a user