Compare commits

...

138 Commits

Author SHA1 Message Date
wzq
aaf16f62f6 Merge branch 'develop' into simulator 2023-09-27 23:47:59 +08:00
wzq
ca56ee0877 修复 寻爱 票据数量问题 2023-09-27 23:32:16 +08:00
wzq
23214de384 修复 寻爱 票据数量问题 2023-09-27 22:46:57 +08:00
wzq
da45a64af9 fixed "default constructor not found." 2023-09-27 22:14:43 +08:00
wzq
e236ef2aff fixed "default constructor not found." 2023-09-27 22:08:41 +08:00
wzq
7de533bf3f 混淆问题 2023-09-27 21:33:21 +08:00
wzq
e23363c736 混淆问题 2023-09-27 21:30:55 +08:00
wzq
4395951973 首页 跟随进房; UI问题 2023-09-27 20:52:51 +08:00
wzq
e02020577d 首页 ViewPager2 滑动冲突 2023-09-27 20:31:55 +08:00
wzq
61306e833a 充值页 UI适配 2023-09-27 20:04:31 +08:00
wzq
49ba0a2701 房间 关闭PK模式 不主动关麦 2023-09-27 19:55:26 +08:00
wzq
2e32184248 房间 寻爱 动态飘屏 进退场动画 2023-09-27 18:57:16 +08:00
wzq
bab64db25c 房间 合并 寻爱 动态/静态 飘屏 队列 2023-09-27 18:43:28 +08:00
wzq
612502153c 房间 PK模式 默认不闭麦 2023-09-27 18:01:00 +08:00
wzq
9cdb0eef53 性别图标 更换成 性别+年龄 2023-09-27 16:00:32 +08:00
wzq
6528ac407a 个人资料页 UI调整 2023-09-27 14:17:58 +08:00
wzq
94d18e6035 礼物面板 item 礼物标签 右对齐 2023-09-27 12:07:27 +08:00
wzq
08abf47890 调整 房间小游戏安全区域 2023-09-27 12:02:24 +08:00
wzq
cb89eccf23 显示 消息页 "发现萌新" 入口, 房间PK入口 2023-09-27 11:26:08 +08:00
wzq
b57622ad42 显示 消息页 "发现萌新" 入口, 房间PK入口 2023-09-27 10:35:41 +08:00
wzq
fd71af897f 修复 塔罗高级 未添加公屏通知 2023-09-26 19:34:40 +08:00
wzq
1998258bda 塔罗活动静态飘屏 只在本房间触发 2023-09-26 19:03:07 +08:00
wzq
5cce2cb68c 首页tab item 新增声音卡 2023-09-26 18:20:00 +08:00
wzq
08230c55a3 首页 UI字体调节 2023-09-26 14:38:07 +08:00
wzq
f51dec1101 Merge branch '1.10.6' into develop
# Conflicts:
#	core/src/diff_src_erban/java/com/yizhuan/xchat_android_constants/XChatConstants.java
#	gradle.properties
2023-09-26 14:27:54 +08:00
wzq
fba5087842 更换声网key 2023-09-26 14:22:59 +08:00
wzq
89faceebfc 升级 声网SDK 4.2.2; 更换key 2023-09-26 14:22:56 +08:00
wzq
1dd5d64a09 修复 寻爱bug 2023-09-26 11:34:05 +08:00
wzq
30d793d794 寻爱飘屏 UI优化 2023-09-25 19:54:42 +08:00
wzq
d2fb38f094 更换声网key 2023-09-25 19:38:09 +08:00
wzq
01958edd06 修复 "寻爱"活动 自定义购买爱心数量 未更新金额 2023-09-25 17:20:27 +08:00
wzq
5a2903d14d 礼物弹窗 标签优化 2023-09-25 17:12:45 +08:00
wzq
1bade9dd00 小时榜飘屏 更换背景图 2023-09-25 16:59:29 +08:00
wzq
8d7ab335e2 新增 H5 跳转 话题页 2023-09-25 16:37:48 +08:00
wzq
8bf25ad378 根据接口返回选择 跳转 原生/H5 充值页 2023-09-25 16:23:01 +08:00
wzq
6e11cfb30d 新增 充值页跳转私聊客服充值 2023-09-25 16:00:50 +08:00
wzq
0c2fd28f15 移除 网络代理 2023-09-22 19:07:04 +08:00
wzq
a2e0e9df53 升级 声网SDK 4.2.2 2023-09-22 18:03:05 +08:00
wzq
9e3ebfa541 升级 声网SDK 4.2.2 2023-09-22 17:27:04 +08:00
wzq
94a0575909 修复 "寻爱之旅"活动页面 UI 以及 余额不足未弹出充值弹窗 2023-09-22 10:20:35 +08:00
wzq
3d161b94e4 修复 "寻爱之旅"活动页面 购买数量问题 2023-09-21 17:50:21 +08:00
wzq
08d9534095 新增 首页房间item PK动画 2023-09-21 16:20:59 +08:00
wzq
ff1cd57d98 修复 首页"优质陪伴"tab UI 问题 2023-09-21 16:02:08 +08:00
wzq
2a57ad3145 增加首页顶部与状态栏之间的间距 2023-09-21 14:17:55 +08:00
wzq
92f2db36ae 修改 首页tab indicator 样式 2023-09-21 12:53:53 +08:00
wushaocheng
362c75f93c [Modify]小时榜和周榜逻辑修改 2023-09-20 18:34:30 +08:00
wzq
b9c3bbdbec 修复 首页tab切换导致SVGA停止播放 2023-09-20 17:56:55 +08:00
wushaocheng
0a24dc66e6 [Modify]更新版本号和寻爱逻辑修改 2023-09-20 17:17:50 +08:00
wushaocheng
ca62822bfb [Modify]首页和夺宝修改 2023-09-20 16:07:17 +08:00
wzq
5db5afa5ed 房间麦位魅力值UI适配 2023-09-20 16:03:45 +08:00
wzq
edad692309 修复 全服飘窗 2023-09-20 14:55:52 +08:00
wzq
23a34434a0 Merge remote-tracking branch 'origin/develop' into develop 2023-09-19 17:20:56 +08:00
wzq
8ad38583ff 新增 充值页 Banner, 个人信息页 "官方代充" 标识 2023-09-19 17:20:08 +08:00
wushaocheng
391fae9006 [Modify]安卓用户头像遮罩去掉 2023-09-19 16:02:23 +08:00
wzq
9854e91fe8 礼物弹窗 礼物标签图片 替换 2023-09-19 15:19:03 +08:00
wzq
d587f1b43d 寻爱飘屏 SVGA 文件替换 2023-09-19 15:01:18 +08:00
wzq
595d3a767a 登录页 默认勾选协议 2023-09-19 14:14:43 +08:00
wzq
4d13cf5e9c 星座 优化 2023-09-19 11:59:01 +08:00
wzq
62ce160dfa 性别图标 替换成 性别+年龄 2023-09-19 11:17:26 +08:00
wzq
c631c1d3a8 新增 H5活动通用飘屏 2023-09-18 15:32:59 +08:00
wushaocheng
27420aa51a [Modify]修改房间背景 2023-09-18 14:12:45 +08:00
wushaocheng
12c5344d72 [Modify]安卓用户头像遮罩去掉 2023-09-18 11:57:33 +08:00
wushaocheng
a716136090 [Modify]安卓13适配和谷歌充值页面加loading 2023-09-18 11:49:27 +08:00
wushaocheng
f860c96887 [Modify]安卓13适配和谷歌充值页面加loading 2023-09-18 11:49:23 +08:00
wushaocheng
873ecf1d2b [Modify]安卓13适配和谷歌充值页面加loading 2023-09-18 11:45:51 +08:00
wushaocheng
957b64476f [Modify]安卓13适配和谷歌充值页面加loading 2023-09-18 11:43:25 +08:00
wzq
306e0a99a0 [Modify]幸运塔罗新增公屏通知, 飘屏 2023-09-15 18:31:57 +08:00
wushaocheng
bfd619e8b5 [Modify]寻爱之旅完善 2023-09-15 17:44:07 +08:00
wushaocheng
4c0184c80b [Modify]寻爱之旅完善 2023-09-15 17:14:02 +08:00
wushaocheng
aeb47da0ee [Modify]首页逻辑调整 2023-09-14 15:56:38 +08:00
wushaocheng
d99ef80d2e [Modify]夺宝精灵和尋愛邏輯修改 2023-09-13 20:46:29 +08:00
wushaocheng
77dcc9d117 [Modify]夺宝精灵逻辑修改 2023-09-13 15:22:10 +08:00
wushaocheng
a7f17276c5 [Modify]夺宝精灵的精灵分解和精灵试炼功能完善 2023-09-12 18:59:35 +08:00
wushaocheng
63f1e02c6f [Modify]夺宝精灵修改 2023-09-12 10:03:24 +08:00
wushaocheng
5c6657c538 [Modify]增加fir渠道 2023-09-08 16:30:12 +08:00
wushaocheng
ba4edf2805 [Modify]模拟器专包修改,优化trtc直播 2023-09-08 14:32:25 +08:00
wushaocheng
cebabbcc18 [Modify]声网sdk集成方式修改 2023-09-08 11:58:56 +08:00
wushaocheng
7548b4174a [Modify]夺宝精灵功能修改 2023-09-08 11:55:52 +08:00
wushaocheng
068172bbd2 [Modify]首页ui和接口修改 2023-09-07 11:40:19 +08:00
wushaocheng
0dda893e1f [Modify]声网sdk修改成新的集成方式,避免模拟器的崩溃 2023-09-07 10:40:37 +08:00
wushaocheng
928857f97d [Modify]优质陪伴页面修改 2023-09-06 15:10:15 +08:00
wushaocheng
46a2dab191 [Modify]优质陪伴页面修改 2023-09-05 18:43:27 +08:00
wushaocheng
877c3d9361 [Modify]游戏房接入 2023-09-05 14:29:57 +08:00
wushaocheng
ef8ca0b939 [Modify]首页修改 2023-09-05 11:31:04 +08:00
wushaocheng
50a20f7822 [Modify]热门推荐修改 2023-09-04 15:23:34 +08:00
wushaocheng
9cc59dd275 [Modify]首页修改 2023-09-04 10:37:38 +08:00
wushaocheng
1ac47c055d [Modify]腾讯trtc修改 2023-09-02 15:39:31 +08:00
wushaocheng
24f1437418 [Modify]facebook参数修改 2023-09-01 16:11:49 +08:00
wushaocheng
f794fe960f [Modify]facebook登录修改 2023-08-29 18:19:10 +08:00
wushaocheng
282036bb20 [Modify]修复线上bug 2023-08-25 20:41:03 +08:00
wushaocheng
ffab260d6a [Modify]修复线上bug 2023-08-18 15:42:09 +08:00
wushaocheng
8c47c3e717 [Modify]修復測試提的bug 2023-08-16 23:57:28 +08:00
wushaocheng
c36f127bce [Modify]登錄功能修改和房間内送禮飄屏隱藏 2023-08-16 18:27:33 +08:00
wushaocheng
d46ec289ea [Modify]隐私政策弹窗移除 2023-08-16 17:19:15 +08:00
wushaocheng
a9405eb8f8 [BugFix]登录功能bug修复 2023-08-16 16:57:57 +08:00
wushaocheng
f5d3f45001 [Modify]登录页面功能修改 2023-08-15 20:29:35 +08:00
wushaocheng
49f2764344 [BugFix]修复生日小于1902的崩溃 2023-08-15 14:30:18 +08:00
wushaocheng
e2a477bd0d [BugFix]修复生日小于1902的崩溃 2023-08-15 14:26:25 +08:00
wushaocheng
0cc24f4adf [BugFix]修复firebase上1.9.6的崩溃 2023-08-15 11:55:53 +08:00
wushaocheng
44e918bd68 [Modify]facebook接入 2023-08-14 12:27:53 +08:00
wushaocheng
cc21e2969a [Modify]登录功能修改 2023-08-14 12:24:32 +08:00
wushaocheng
cbe2234c83 [Modify]公会页面图标修改 2023-08-10 19:00:52 +08:00
wushaocheng
68e091131d [Modify]公会图片高斯模糊 2023-08-10 18:28:16 +08:00
wushaocheng
346b535757 [Modify]修復公會數據和trtc的bug 2023-08-10 17:32:10 +08:00
wushaocheng
a16a918d06 [Modify]去掉房间id 2023-08-09 16:16:48 +08:00
wushaocheng
d3b6a16db9 [Modify]修改礼物弹窗逻辑 2023-08-09 15:22:29 +08:00
wushaocheng
c34e8b034d [Modify]修改公会数据页面 2023-08-09 11:42:35 +08:00
wushaocheng
d2b0e904c8 [Modify]1.9.5修改peko为piko 2023-08-09 10:20:00 +08:00
wushaocheng
b57e7afb6d [Modify]修复firebase上面的崩溃 2023-08-08 18:59:58 +08:00
wushaocheng
edcabd157d [Modify]去掉房间内的送礼飘屏 2023-08-08 15:25:39 +08:00
wushaocheng
384831effa [Modify]腾讯trtc预埋 2023-08-08 14:43:03 +08:00
wushaocheng
f8f0c2c59b [Modify]公会数据逻辑补全 2023-08-08 14:14:20 +08:00
wushaocheng
96e3c65f2f [Modify]公会数据页面修改 2023-08-07 10:52:12 +08:00
wushaocheng
d8c1a89005 [Modify]修改版本号为1.9.4 2023-07-24 17:49:24 +08:00
wushaocheng
e014e6a6b2 [BugFix]优化BaseDialog判空,周星榜ui调整,夺宝精灵闪退修复 2023-07-24 16:36:56 +08:00
wushaocheng
144fa832f1 [BugFix]优化房间外飘屏高度 2023-07-21 01:08:59 +08:00
wushaocheng
9b7c0cae6b [BugFix]优化飘屏展示逻辑 2023-07-21 00:34:02 +08:00
wushaocheng
f6f79f83dc [BugFix]修复谷歌充值显示问题 2023-07-20 22:42:26 +08:00
wushaocheng
09f0eac2b3 [BugFix]修復飄屏展示邏輯 2023-07-20 21:38:50 +08:00
wushaocheng
951c42592e [BugFix]福袋特效优化 2023-07-20 16:12:37 +08:00
wushaocheng
fdfec8610d [BugFix]修改测试提的bug 2023-07-19 22:03:01 +08:00
wushaocheng
fcf9f65984 [BugFix]修改测试提的bug 2023-07-19 20:16:50 +08:00
wushaocheng
2ef89535d5 [Modify]修改福袋礼物面板问题 2023-07-18 20:57:13 +08:00
wushaocheng
f742102a60 [Modify]全服玩法飘屏逻辑 2023-07-18 19:13:28 +08:00
wushaocheng
eb73898872 [BugFix]80级进场飘屏样式调整 2023-07-18 11:07:30 +08:00
wushaocheng
122f2d374f [Modify]兑换钻石放开 2023-07-17 19:06:35 +08:00
wushaocheng
7adefe8375 [Modify]礼物面板改造 2023-07-17 19:00:54 +08:00
wushaocheng
34b9233825 [Modify]贵族优化 2023-07-14 19:29:50 +08:00
wushaocheng
cd5b1728f8 [Modify]飘屏逻辑优化 2023-07-13 21:13:32 +08:00
wushaocheng
ac53bbd484 [Modify]奪寶精靈優化 2023-07-13 14:16:35 +08:00
wushaocheng
48a096a64a [Modify]礼物面板修改 2023-07-12 19:07:27 +08:00
wushaocheng
0dd0e131f2 [Modify]贵族调起支付增加弹窗 2023-07-12 19:01:11 +08:00
wushaocheng
4999c6e955 [Modify]谷歌充值修改 2023-07-12 16:00:52 +08:00
wushaocheng
259c3e408a [Modify]谷歌充值增加提醒 2023-07-12 15:10:22 +08:00
wushaocheng
58b66848d9 [Modify]版本号改为1.9.0 2023-07-11 16:55:59 +08:00
wushaocheng
bf805afdb5 [Modify]房间公屏优化 2023-07-11 16:51:38 +08:00
wushaocheng
a1221fa5a5 [Modify]修改为1.8.5 2023-06-07 19:55:57 +08:00
wushaocheng
7515f50095 [Modify]寻爱之旅消耗钻石改为可配置 2023-06-07 15:21:31 +08:00
632 changed files with 29033 additions and 5928 deletions

View File

@@ -23,11 +23,7 @@ android {
ndk {
//设置支持的SO库架构
if (onlyArm64) {
abiFilters "arm64-v8a"
} else {
abiFilters "armeabi-v7a", "arm64-v8a"
}
abiFilters "x86", "x86_64"
}
flavorDimensions 'default'
@@ -52,7 +48,7 @@ android {
variant ->
variant.outputs.all {
def date = new Date().format("MMddHHmm", TimeZone.getTimeZone("GMT+08"))
outputFileName = "peko_${buildType.name}_v${defaultConfig.versionName}-${date}.apk"
outputFileName = "piko_${buildType.name}_v${defaultConfig.versionName}-${date}.apk"
}
}
@@ -144,11 +140,12 @@ android {
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false // Firebase Crashlytics禁用更新构建ID
buildConfigField "String", "BASE_URL", "\"https://beta.api.pekolive.com/\""
buildConfigField "String", "BASE_URL", "\"http://beta.api.pekolive.com/\""
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
minifyEnabled false // 是否混淆
// shrinkResources true // 开了混淆的时候才能开启 是否去除无效的资源文件
crunchPngs false // 停用 PNG 压缩
signingConfig signingConfigs.v2
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@@ -287,6 +284,8 @@ dependencies {
//wheelView
implementation 'com.contrarywind:wheelview:4.1.0'
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
}
channel {
@@ -294,7 +293,7 @@ channel {
outputDir = new File(project.buildDir, "channelapk")
//多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}-${buildTime}
def only64 = onlyArm64 ? "-only64" : ""
apkNameFormat = 'peko-${buildType}only64-${flavorName}-v${versionName}-${buildTime}'.replace("only64", only64)
apkNameFormat = 'piko-${buildType}only64-${flavorName}-v${versionName}-${buildTime}'.replace("only64", only64)
//快速模式生成渠道包时不进行校验速度可以提升10倍以上默认为false
fastMode = false
//buildTime的时间格式默认格式yyyyMMdd-HHmmss

Binary file not shown.

View File

@@ -233,6 +233,7 @@
-keep class org.json.** {*;}
-dontwarn com.yizhuan.xchat_android_core.**
-keep class com.yizhuan.xchat_android_core.** {*;}
-keep class com.yizhuan.treasure_box.bean.** {*;}
#百度统计

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -51,8 +51,15 @@
tools:node="remove" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" /> <!-- 如果需要实时音视频通话模块,下面的权限也是必须的。否则,可以不加 -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- SDK 权限申明, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 -->
@@ -72,6 +79,9 @@
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<!-- AppsFlyer需要参考https://dev.appsflyer.com/hc/docs/install-android-sdk#setting-required-permissions -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- 对于 Android 12.0 及以上设备,还需要添加如下权限: -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<application
android:name=".application.XChatApplication"
@@ -85,6 +95,7 @@
android:theme="@style/MyMaterialTheme"
tools:replace="android:name,android:allowBackup"
tools:targetApi="n">
<activity
android:name=".other.activity.SplashActivity"
android:exported="true"
@@ -111,7 +122,7 @@
<data
android:host="main"
android:scheme="pekoapp" />
android:scheme="pikoapp" />
</intent-filter>
</activity>
@@ -211,7 +222,7 @@
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="Peko"
android:label="Piko"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> <!-- 配置的service和receiver -->
@@ -243,6 +254,10 @@
android:name=".avroom.activity.RoomBlackListActivity"
android:label="@string/main_androidmanifest_09"
android:screenOrientation="portrait" />
<activity
android:name=".module_hall.hall.activity.RoomIncomeActivity"
android:label="房间流水"
android:screenOrientation="portrait" />
<activity
android:name="com.yizhuan.tutu.music.activity.AddLocalMusicListActivity"
android:label="@string/main_androidmanifest_010"
@@ -969,15 +984,14 @@
android:screenOrientation="portrait" />
<activity
android:name=".treasurefairy.HomeFairyActivity"
android:configChanges="screenSize|orientation|keyboardHidden|mcc|mnc|locale|touchscreen|screenLayout|keyboard|navigation|fontScale|uiMode|smallestScreenSize|layoutDirection"
android:exported="false"
android:theme="@style/dialog_web_view_activity" />
android:theme="@style/transparent_activity" />
<activity
android:name=".ui.webview.FairyDialogWebViewActivity"
android:configChanges="screenSize|orientation|keyboardHidden|mcc|mnc|locale|touchscreen|screenLayout|keyboard|navigation|fontScale|uiMode|smallestScreenSize|layoutDirection"
android:exported="false"
android:theme="@style/dialog_web_view_activity" />
android:theme="@style/transparent_activity" />
<meta-data
android:name="notch.config"
@@ -1001,6 +1015,8 @@
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="Mob-Https" android:value="yes"/>
<provider
android:name="com.netease.nimlib.ipc.NIMContentProvider"
android:authorities="${applicationId}.ipc.provider"
@@ -1018,8 +1034,7 @@
android:name="com.netease.nimlib.service.NimReceiver"
android:exported="false"
android:process=":core"
tools:node="remove">
</receiver>
tools:node="remove"></receiver>
<receiver android:name="com.netease.nimlib.service.ResponseReceiver" />
<receiver
android:name=".reciever.IncomingCallReceiver"
@@ -1029,6 +1044,7 @@
</intent-filter>
</receiver>
<receiver android:name=".reciever.NotificationClickReceiver" />
<service
android:name="com.netease.nimlib.service.NimService"
android:process=":core" />
@@ -1043,6 +1059,31 @@
<service
android:name=".service.DaemonService"
android:enabled="true" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -214,6 +214,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
!TextUtils.isEmpty(linkedInfo.getDynamicId())) {
DynamicDetailActivity.start(context, JavaUtil.str2long(linkedInfo.getDynamicId()),
JavaUtil.str2long(linkedInfo.getWorldId()), 6);
} else if (linkedInfo.getType().equals("7") && !TextUtils.isEmpty(linkedInfo.getUid())) {
NimP2PMessageActivity.start(context, linkedInfo.getUid());
} else {
return false;
}

View File

@@ -9,7 +9,7 @@ import com.yizhuan.erban.relation.cp.dialog.CpGlobalDialog;
import com.yizhuan.erban.ui.widget.LevelUpDialog;
import com.yizhuan.erban.ui.widget.RecallDialog;
import com.yizhuan.erban.ui.widget.lottery_dialog.LotteryDialogManager;
import com.yizhuan.erban.vip.VipUpgradeDialog;
import com.yizhuan.erban.vip.dialog.VipUpgradeDialog;
import com.yizhuan.xchat_android_core.activity.bean.LotteryInfo;
import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent;
import com.yizhuan.xchat_android_core.level.event.LevelUpEvent;
@@ -27,8 +27,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.ref.WeakReference;
/**
* 全局处理比如App弹窗
* create by lvzebiao @2019/8/14

View File

@@ -48,7 +48,6 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.common.app.ActivityStack;
import com.yizhuan.erban.common.util.AppLifeCycleHelper;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.other.activity.SplashActivity;
import com.yizhuan.erban.radish.wallet.RadishWalletManager;
import com.yizhuan.erban.utils.PushMessageHandler;
import com.yizhuan.xchat_android_constants.XChatConstants;
@@ -162,6 +161,11 @@ public class XChatApplication extends BaseApp {
public String makeRevokeMsgTip(String s, IMMessage imMessage) {
return null;
}
@Override
public String makeCategory(IMMessage message) {
return null;
}
};
private static XChatApplication instance;
//生命周期监听
@@ -413,11 +417,11 @@ public class XChatApplication extends BaseApp {
SVGAParser.Companion.shareParser().init(BasicConfig.INSTANCE.getAppContext());
try {
/** svga动画缓存路径 */
File cacheDir = new File(BasicConfig.INSTANCE.getAppContext().getApplicationContext().getExternalCacheDir(), "http");
if (!cacheDir.exists()) cacheDir.mkdirs();
HttpResponseCache.install(cacheDir, 1024 * 1024 * 128);
String cacheDirPath = FileHelper.getRootCacheDir().getAbsolutePath();
File cacheFie = new File(cacheDirPath, "cacheDir");
HttpResponseCache.install(cacheFie, 1024 * 1024 * 128);
} catch (IOException e) {
Log.e(TAG, "testtest", e);
Log.e(TAG, "HttpResponseCache install error :" + e.getMessage());
}
initRxNet(BasicConfig.INSTANCE.getAppContext(), UriProvider.JAVA_WEB_URL);
@@ -503,10 +507,7 @@ public class XChatApplication extends BaseApp {
BasicConfig.INSTANCE.setAppContext(this.getApplicationContext());
SharedPreferenceUtils.init(this);
ResUtil.init(this);
boolean isShowPrivacyAgreement = (boolean) SharedPreferenceUtils.get(SplashActivity.SHOW_PRIVACY_AGREEMENT, true);
if (!isShowPrivacyAgreement) {
initOtherSDK();
}
initOtherSDK();
initContext(this);
//首次启动事件
HashMap<String, Object> map = new HashMap<>(2);

View File

@@ -109,6 +109,9 @@ public class AudioPlayerHelper {
}
public void endPlay() {
if (listener != null) {
listener.onCompletion();
}
handler.removeMessages(WHAT_STATUS.COUNT_PLAY);
if (player != null) {
if (preparing) {

View File

@@ -18,7 +18,7 @@ import com.yizhuan.erban.ui.im.avtivity.NimFriendModel;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.widget.ButtonItem;
import com.yizhuan.erban.ui.widget.GiftDialog;
import com.yizhuan.erban.vip.VipHelper;
import com.yizhuan.erban.vip.util.VipHelper;
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;

View File

@@ -2,10 +2,17 @@ package com.yizhuan.erban.avroom.activity;
import static android.view.View.VISIBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_PK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
import android.annotation.SuppressLint;
@@ -90,9 +97,19 @@ import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FairyMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Attachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Info;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
import com.yizhuan.xchat_android_core.initial.InitialModel;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
@@ -123,6 +140,7 @@ import com.yizhuan.xchat_android_core.room.event.RoomTaskTipsEvent;
import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent;
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
@@ -146,6 +164,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import io.reactivex.Single;
@@ -1177,10 +1196,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
baseProtocol = null;
}
if (baseProtocol == null) return;
if (!isValid()) return;
switch (baseProtocol.getFirst()) {
case CUSTOM_MSG_HEADER_TYPE_GIFT:
if (!isValid()) return;
if (giftList == null) {
giftList = new LinkedList<>();
}
@@ -1203,8 +1221,72 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
}
}
break;
case CUSTOM_MSG_LUCKY_GIFT:
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY) {
case CUSTOM_MSG_BOX://寻爱之旅
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
if (AvRoomDataManager.get().isOpenPureMode()) {
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
IMNetEaseManager.get().addMessages(message);
}
} else {
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
IMNetEaseManager.get().addMessages(message);
IMNetEaseManager.get().getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.BOX_NOTIFY_SVGA)
.setChatRoomMessage(message));
}
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
TarotAttachment tarotAttachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT,
CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING);
tarotAttachment.setTarotMsgBean(tarotMsgBean);
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
String.valueOf(AvRoomDataManager.get().getRoomId()), tarotAttachment);
IMNetEaseManager.get().getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.TAROT_NOTIFY_SVGA)
.setChatRoomMessage(message));
AvRoomDataManager.get().addChatRoomMessage(message);
}
break;
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5:
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE) {
NotifyH5Info bean = JSON.parseObject(String.valueOf(baseProtocol.getData()), NotifyH5Info.class);
NotifyH5Attachment notifyH5Attachment = new NotifyH5Attachment(baseProtocol.getSecond());
notifyH5Attachment.setBean(bean);
ChatRoomMessage notifyH5Msg = ChatRoomMessageBuilder.createChatRoomCustomMessage(
String.valueOf(AvRoomDataManager.get().getRoomId()), notifyH5Attachment);
IMNetEaseManager.get().getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.NOTIFY_H5)
.setChatRoomMessage(notifyH5Msg));
}
break;
case CUSTOM_MSG_LUCKY_SEA://星级厨房
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
attachment.setRoomLuckySeaMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class));
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
IMNetEaseManager.get().addMessages(message);
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
}
break;
case CUSTOM_MSG_LUCKY_GIFT://福袋
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class));
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
@@ -1212,6 +1294,14 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
IMNetEaseManager.get().addMessages(message);
}
break;
case CUSTOM_MSG_FAIRY://夺宝精灵
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5) {
FairyMsgAttachment attachment = new FairyMsgAttachment(CUSTOM_MSG_FAIRY, CUSTOM_MSG_SUB_DRAW_GIFT_L5);
attachment.setFairyMsgInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), FairyMsgInfoBean.class));
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.FAIRY_DRAW_GIFT_L5);
}
break;
case CUSTOM_MSG_ROOM_PK:
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_ROOM_PK_NOTIFY) {
RoomPKAttachment attachment = new RoomPKAttachment(CUSTOM_MSG_SUB_ROOM_PK_NOTIFY);

View File

@@ -60,7 +60,7 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
protected static final int TYPE_BOSS = 1;
protected static final int TYPE_NORMAL = 0;
protected static final int TYPE_INVALID = -2;
protected OnMicroItemClickListener onMicroItemClickListener;
protected OnMicroItemClickListener onMicroItemClickListener = null;
protected Context context;
public BaseMicroViewAdapter(Context context) {

View File

@@ -12,7 +12,7 @@ class RoomPKSearchAdapter :
override fun convert(helper: BaseViewHolder, item: SimpleRoomInfo) {
helper.setText(R.id.tv_room_title,item.title.subAndReplaceDot(7))
.setText(R.id.tv_room_id,"Peko号:${item.erbanNo}")
.setText(R.id.tv_room_id,"Piko号:${item.erbanNo}")
.setChecked(R.id.check_box,item.checked)
ImageLoadUtils.loadImage(mContext,item.avatar,helper.getView(R.id.iv_avatar))
helper.addOnClickListener(R.id.iv_avatar,R.id.check_box)

View File

@@ -30,71 +30,71 @@ class RoomPkFinishDialog : BaseDialog<DialogRoomPkFinishBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.tvTitleRed.text = roomPkBean.cTitle.subAndReplaceDot(7)
binding.tvValueRed.text = "${roomPkBean.cAmount}"
binding.ivRedWin.isVisible = roomPkBean.cUid == roomPkBean.winUid && roomPkBean.winUid != 0L
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.tvTitleRed?.text = roomPkBean.cTitle.subAndReplaceDot(7)
binding?.tvValueRed?.text = "${roomPkBean.cAmount}"
binding?.ivRedWin?.isVisible = roomPkBean.cUid == roomPkBean.winUid && roomPkBean.winUid != 0L
ImageLoadUtils.loadImage(
context,
roomPkBean.cAvatar,
binding.ivAvatarRed,
binding?.ivAvatarRed,
R.drawable.default_avatar
)
binding.tvTitleBlue.text = roomPkBean.aTitle.subAndReplaceDot(7)
binding.tvValueBlue.text = "${roomPkBean.aAmount}"
binding.ivBlueWin.isVisible =
binding?.tvTitleBlue?.text = roomPkBean.aTitle.subAndReplaceDot(7)
binding?.tvValueBlue?.text = "${roomPkBean.aAmount}"
binding?.ivBlueWin?.isVisible =
roomPkBean.cUid != roomPkBean.winUid && roomPkBean.winUid != 0L
ImageLoadUtils.loadImage(
context,
roomPkBean.aAvatar,
binding.ivAvatarBlue,
binding?.ivAvatarBlue,
R.drawable.default_avatar
)
roomPkBean.csRank.getOrNull(0)?.let {
binding.tvNickContribute.text = it.nick.subAndReplaceDot(7)
binding.tvValueContribute.text = "神豪值:${it.amount}"
binding?.tvNickContribute?.text = it.nick.subAndReplaceDot(7)
binding?.tvValueContribute?.text = "神豪值:${it.amount}"
ImageLoadUtils.loadImage(
context,
it.avatar,
binding.ivAvatarContribute,
binding?.ivAvatarContribute,
R.drawable.default_avatar
)
}
roomPkBean.crRank.getOrNull(0)?.let {
binding.tvNickCharm.text = it.nick.subAndReplaceDot(7)
binding.tvValueCharm.text = "魅力值:${it.amount}"
binding?.tvNickCharm?.text = it.nick.subAndReplaceDot(7)
binding?.tvValueCharm?.text = "魅力值:${it.amount}"
ImageLoadUtils.loadImage(
context,
it.avatar,
binding.ivAvatarCharm,
binding?.ivAvatarCharm,
R.drawable.default_avatar
)
}
when (roomPkBean.winUid) {
0L -> {
binding.viewBg.setBackgroundResource(R.drawable.bg_719cea_radius_10)
binding.clRoot.setBackgroundResource(R.drawable.bg_room_pk_finish_deuce)
binding.viewContribute.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_deuce)
binding.viewCharm.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_deuce)
binding.ivClose.setImageResource(R.drawable.ic_room_pk_finish_close_deuce)
binding?.viewBg?.setBackgroundResource(R.drawable.bg_719cea_radius_10)
binding?.clRoot?.setBackgroundResource(R.drawable.bg_room_pk_finish_deuce)
binding?.viewContribute?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_deuce)
binding?.viewCharm?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_deuce)
binding?.ivClose?.setImageResource(R.drawable.ic_room_pk_finish_close_deuce)
}
roomPkBean.cUid -> {
binding.viewBg.setBackgroundResource(R.drawable.bg_edbf89_radius_10)
binding.clRoot.setBackgroundResource(R.drawable.bg_room_pk_finish_win)
binding.viewContribute.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_win)
binding.viewCharm.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_win)
binding.ivClose.setImageResource(R.drawable.ic_room_pk_finish_close_win)
binding?.viewBg?.setBackgroundResource(R.drawable.bg_edbf89_radius_10)
binding?.clRoot?.setBackgroundResource(R.drawable.bg_room_pk_finish_win)
binding?.viewContribute?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_win)
binding?.viewCharm?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_win)
binding?.ivClose?.setImageResource(R.drawable.ic_room_pk_finish_close_win)
}
else -> {
binding.viewBg.setBackgroundResource(R.drawable.bg_bfabf6_radius_10)
binding.clRoot.setBackgroundResource(R.drawable.bg_room_pk_finish_failed)
binding.viewContribute.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_failed)
binding.viewCharm.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_failed)
binding.ivClose.setImageResource(R.drawable.ic_room_pk_finish_close_failed)
binding?.viewBg?.setBackgroundResource(R.drawable.bg_bfabf6_radius_10)
binding?.clRoot?.setBackgroundResource(R.drawable.bg_room_pk_finish_failed)
binding?.viewContribute?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_failed)
binding?.viewCharm?.setBackgroundResource(R.drawable.bg_room_pk_finish_rank_failed)
binding?.ivClose?.setImageResource(R.drawable.ic_room_pk_finish_close_failed)
}
}

View File

@@ -29,23 +29,23 @@ class RoomPkForceFinishDialog : BaseDialog<DialogRoomPkForceFinishBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.tvTitleRed.text = roomPkBean.cTitle.subAndReplaceDot(7)
binding.tvValueRed.text = "${roomPkBean.cAmount}"
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.tvTitleRed?.text = roomPkBean.cTitle.subAndReplaceDot(7)
binding?.tvValueRed?.text = "${roomPkBean.cAmount}"
ImageLoadUtils.loadImage(
context,
roomPkBean.cAvatar,
binding.ivAvatarRed,
binding?.ivAvatarRed,
R.drawable.default_avatar
)
binding.tvTitleBlue.text = roomPkBean.aTitle.subAndReplaceDot(7)
binding.tvValueBlue.text = "${roomPkBean.aAmount}"
binding?.tvTitleBlue?.text = roomPkBean.aTitle.subAndReplaceDot(7)
binding?.tvValueBlue?.text = "${roomPkBean.aAmount}"
ImageLoadUtils.loadImage(
context,
roomPkBean.aAvatar,
binding.ivAvatarBlue,
binding?.ivAvatarBlue,
R.drawable.default_avatar
)

View File

@@ -36,26 +36,26 @@ class RoomPkReceivedDialog : BaseDialog<DialogRoomPkReceivedBinding>() {
@SuppressLint("CheckResult")
override fun init() {
binding.tvNick.text = pkBean.inviteRoomTitle.subAndReplaceDot(7)
binding.tvTime.text = "${pkBean.pkDuration}分鐘"
binding?.tvNick?.text = pkBean.inviteRoomTitle.subAndReplaceDot(7)
binding?.tvTime?.text = "${pkBean.pkDuration}分鐘"
pkBean.pkDesc.ifNotNullOrEmpty {
binding.tvDescTitle.isVisible = true
binding.tvDesc.isVisible = true
binding.tvDesc.text = it
binding?.tvDescTitle?.isVisible = true
binding?.tvDesc?.isVisible = true
binding?.tvDesc?.text = it
}
disposable = Observable.intervalRange(0, 10, 0, 1, TimeUnit.SECONDS)
.compose(bindToLifecycle())
.observeOn(AndroidSchedulers.mainThread())
.doOnComplete { dismissAllowingStateLoss() }
.subscribe {
binding.tvCloseTime.text = "${10 - it}"
binding?.tvCloseTime?.text = "${10 - it}"
}
binding.tvReceived.setOnClickListener {
binding?.tvReceived?.setOnClickListener {
commit(true)
}
binding.tvRefuse.setOnClickListener {
binding?.tvRefuse?.setOnClickListener {
commit(false)
}
}

View File

@@ -14,6 +14,6 @@ class RoomPkRuleDialog : BaseDialog<DialogRoomPkRuleBinding>() {
}
override fun init() {
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
}
}

View File

@@ -0,0 +1,8 @@
package com.yizhuan.erban.avroom.bean
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
data class RoomPlayBean(
val event: Int,
val chatRoomMessage: ChatRoomMessage
)

View File

@@ -33,10 +33,10 @@ class CreateGameRoomDialog : BaseDialog<DialogCreateGameRoomBinding>() {
@SuppressLint("CheckResult")
override fun init() {
binding.rvGame.itemAnimator = null
binding?.rvGame?.itemAnimator = null
rvDelegate = RVDelegate.Builder<GameInfo>()
.setAdapter(gameAdapter)
.setRecyclerView(binding.rvGame)
.setRecyclerView(binding?.rvGame)
.setLayoutManager(GridLayoutManager(context, 2))
.build()
@@ -48,7 +48,7 @@ class CreateGameRoomDialog : BaseDialog<DialogCreateGameRoomBinding>() {
)
}
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}

View File

@@ -33,14 +33,14 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
@SuppressLint("CheckResult")
override fun init() {
if(isHomeGame){
binding.tvPlayType.isVisible = false
binding.rgType.isVisible = false
binding.rvGame.isVisible = true
binding?.tvPlayType?.isVisible = false
binding?.rgType?.isVisible = false
binding?.rvGame?.isVisible = true
}
binding.rvGame.itemAnimator = null
binding?.rvGame?.itemAnimator = null
rvDelegate = RVDelegate.Builder<GameInfo>()
.setAdapter(gameAdapter)
.setRecyclerView(binding.rvGame)
.setRecyclerView(binding?.rvGame)
.setLayoutManager(LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false))
.build()
@@ -55,22 +55,22 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
checkCreateEnable()
}
binding.rbGameRoom.setOnCheckedChangeListener { _, isChecked ->
binding?.rbGameRoom?.setOnCheckedChangeListener { _, isChecked ->
checkCreateEnable()
if (isChecked) {
binding.rvGame.isVisible = true
binding?.rvGame?.isVisible = true
}
}
binding.rbPartyRoom.setOnCheckedChangeListener { _, isChecked ->
binding?.rbPartyRoom?.setOnCheckedChangeListener { _, isChecked ->
checkCreateEnable()
if (isChecked) {
binding.rvGame.isInvisible = true
binding?.rvGame?.isInvisible = true
}
}
binding.tvCreate.setOnClickListener {
binding?.tvCreate?.setOnClickListener {
dismissAllowingStateLoss()
if (binding.rbPartyRoom.isChecked) {
if (binding?.rbPartyRoom?.isChecked == true) {
OpenRoomHelper.openHomePartyRoom(requireActivity() as BaseActivity)
} else {
if (selectIndex != -1) {
@@ -84,7 +84,7 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
}
}
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}
@@ -105,10 +105,10 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
private fun checkCreateEnable() {
if(isHomeGame){
binding.tvCreate.isEnabled = selectIndex != -1
binding?.tvCreate?.isEnabled = selectIndex != -1
}else {
binding.tvCreate.isEnabled = binding.rbPartyRoom.isChecked ||
(binding.rbGameRoom.isChecked && selectIndex != -1)
binding?.tvCreate?.isEnabled = binding?.rbPartyRoom?.isChecked == true ||
(binding?.rbGameRoom?.isChecked == true && selectIndex != -1)
}
}
}

View File

@@ -9,11 +9,11 @@ class NewUserGiftDialog(val giftInfo: GiftInfo) :
BaseDialog<DialogNewUserGiftBinding>() {
override fun init() {
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.ivGift.load(giftInfo.giftUrl)
binding.tvGiftName.text = "${giftInfo.giftName}*${giftInfo.count}"
binding?.ivGift?.load(giftInfo.giftUrl)
binding?.tvGiftName?.text = "${giftInfo.giftName}*${giftInfo.count}"
}
}

View File

@@ -30,7 +30,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.ui.widget.ButtonItem;
import com.yizhuan.erban.ui.widget.recyclerview.decoration.ColorDecoration;
import com.yizhuan.erban.ui.widget.recyclerview.layoutmanager.FullyGridLayoutManager;
import com.yizhuan.erban.vip.VipBroadcastDialog;
import com.yizhuan.erban.vip.dialog.VipBroadcastDialog;
import com.yizhuan.tutu.room_chat.activity.RoomInviteFansActivity;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.auth.AuthModel;
@@ -113,9 +113,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
rvOPtList.setLayoutManager(new FullyGridLayoutManager(getContext(), 5));
optAdapter = new OptAdapter(context, null);
addDatingAction(optAdapter);
// addPKAction(optAdapter);
addPKAction(optAdapter);
addRoomPKAction(optAdapter);
// addSingleRoomPKAction(optAdapter);
addSingleRoomPKAction(optAdapter);
addSendBroadcastAction(optAdapter);
// addInviteFansOptAdapter();
addVipSendBroadcastAction(optAdapter);

View File

@@ -44,31 +44,31 @@ class SendBroadcastDialog : BaseDialog<DialogSendBroadcastBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}
adapter = SendBroadcastAdapter()
rvDelegate = RVDelegate.Builder<String>()
.setAdapter(adapter)
.setRecyclerView(binding.rvRecommend)
.setRecyclerView(binding?.rvRecommend)
.setLayoutManager(LinearLayoutManager(context))
.build()
adapter.setOnItemClickListener { _, _, position ->
binding.editContent.setText(adapter.getItem(position))
binding?.editContent?.setText(adapter.getItem(position))
}
binding.editContent.addTextChangedListener(object : TextWatcherWrapper() {
binding?.editContent?.addTextChangedListener(object : TextWatcherWrapper() {
override fun afterTextChanged(editable: Editable?) {
val contentLength = editable?.length ?: 0
binding.tvContentNumLimit.text =
binding?.tvContentNumLimit?.text =
"${contentLength}/${broadcastInfo?.maxWords ?: 20}"
binding.tvSend.isEnabled = contentLength != 0
binding?.tvSend?.isEnabled = contentLength != 0
}
})
binding.tvSend.setOnClickListener {
binding?.tvSend?.setOnClickListener {
if (CommonUtils.isFastDoubleClick(1000)) return@setOnClickListener
sendBroadcast()
}
@@ -90,13 +90,13 @@ class SendBroadcastDialog : BaseDialog<DialogSendBroadcastBinding>() {
private fun initData(info: BroadcastInfo) {
broadcastInfo = info
rvDelegate.setNewData(info.recommends)
binding.tvAvailableCountNum.text = "${info.availableTimes}/${info.total}"
binding.editContent.hint = "输入内容不能少于${info.minWords}个字,请文明发言哦~"
binding.tvContentNumLimit.text = "0/${info.maxWords}"
binding?.tvAvailableCountNum?.text = "${info.availableTimes}/${info.total}"
binding?.editContent?.hint = "输入内容不能少于${info.minWords}个字,请文明发言哦~"
binding?.tvContentNumLimit?.text = "0/${info.maxWords}"
if (info.seconds > 0) {
beginIntervalTime(info)
} else {
binding.tvSendHint.text = "发布后,${info.minutes}分钟内不可再发布广播"
binding?.tvSendHint?.text = "发布后,${info.minutes}分钟内不可再发布广播"
}
}
@@ -107,10 +107,10 @@ class SendBroadcastDialog : BaseDialog<DialogSendBroadcastBinding>() {
.observeOn(AndroidSchedulers.mainThread())
.compose(bindToLifecycle())
.doOnComplete {
binding.tvSendHint.text = "发布后,${info.minutes}分钟内不可再发布广播"
binding?.tvSendHint?.text = "发布后,${info.minutes}分钟内不可再发布广播"
}
.subscribe {
binding.tvSendHint.text = SpannableBuilder()
binding?.tvSendHint?.text = SpannableBuilder()
.append(
"${info.seconds - it}",
ForegroundColorSpan(Color.parseColor("#FFFDA615"))
@@ -127,7 +127,7 @@ class SendBroadcastDialog : BaseDialog<DialogSendBroadcastBinding>() {
return
}
broadcastInfo?.let {
val msg = binding.editContent.text
val msg = binding?.editContent?.text
if (msg.isNullOrEmpty() || msg.length < it.minWords) {
"输入内容不能少于${it.minWords}个字!".toast()
return@let

View File

@@ -9,7 +9,7 @@ class SingleRoomTipDialog :
BaseDialog<DialogSingleRoomTipBinding>() {
@SuppressLint("ClickableViewAccessibility")
override fun init() {
binding.root.setOnClickListener {
binding?.root?.setOnClickListener {
dismissAllowingStateLoss()
}
dialog?.window?.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)

View File

@@ -292,18 +292,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
GiftValueMrg.get().handleReconnect(false)
}
}
RoomEvent.ROOM_EXIT -> {
// 退出房間,把標誌置為 false
AvRoomDataManager.get().isFromMentoring = false
// 退出房間的時候,要停止倒計時
EventBus.getDefault().post(MentoringStopCountingEvent())
}
RoomEvent.DOWN_CROWDED_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
toast(R.string.crowded_down)
}
RoomEvent.ROOM_MANAGER_ADD, RoomEvent.ROOM_MANAGER_REMOVE -> {
updateView()
}
RoomEvent.ROOM_INFO_UPDATE -> {
Logger.i(ResUtil.getString(R.string.avroom_fragment_baseroomfragment_01))
addOpenDatingTips() //一定要放在updateView之前!!!
@@ -313,6 +317,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
updateRemoteMuteBtn()
openOrCloseGiftValue(false)
}
RoomEvent.ENTER_ROOM -> {
Logger.i(ResUtil.getString(R.string.avroom_fragment_baseroomfragment_02))
updateView()
@@ -320,6 +325,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
openOrCloseGiftValue(true)
GiftValueMrg.get().updateRoomGiftValue(false)
}
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
RoomEvent.MIC_QUEUE_STATE_CHANGE -> onQueueMicStateChange()
RoomEvent.KICK_DOWN_MIC_BY_S_ADMIN, RoomEvent.KICK_DOWN_MIC -> if (event == RoomEvent.KICK_DOWN_MIC) {
@@ -335,16 +341,20 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
)
)
}
RoomEvent.DOWN_MIC -> {
onDownMicro()
}
RoomEvent.UP_MIC -> {
onUpMicro()
}
RoomEvent.INVITE_UP_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
//自己的消息
onInviteUpMic(roomEvent.micPosition)
}
RoomEvent.KICK_OUT_ROOM -> {
val reason = roomEvent.reason
if (reason != null && reason.reason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
@@ -362,6 +372,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
AvRoomDataManager.get().removeChatRoomMember(targetUid)
}
}
RoomEvent.LEAVE_MODE -> microView.adapter.notifyDataSetChanged()
RoomEvent.ROOM_CLEAN_SCREEN -> messageView.clear()
}
@@ -544,7 +555,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
} else {
val roomQueueInfo = AvRoomDataManager.get()
.getRoomQueueMemberInfoByAccount(myUid.toString())
if (roomQueueInfo?.mChatRoomMember != null
if (roomQueueInfo?.mChatRoomMember?.isNoProhibitMic == true && roomQueueInfo.mRoomMicInfo?.isMicMute == false) {
bottomView.setMicBtnEnable(true)
bottomView.setMicBtnOpen(true)
} else if (roomQueueInfo?.mChatRoomMember != null
&& myUid.toString() == roomQueueInfo.mChatRoomMember.account
&& roomQueueInfo.mRoomMicInfo?.isMicMute == true
) {
@@ -632,13 +646,16 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
R.id.input_send -> {
sendMsg()
}
R.id.contribute_list -> {
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
mvpPresenter?.loadRoomRank()
}
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
R.id.iv_treasure_box,
R.id.iv_treasure_box_cp -> GoldBoxHelper.handleBoxClick(mContext)
R.id.iv_radish_entrance -> PullRadishActivity.start(mContext)
}
}
@@ -1208,7 +1225,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
AudioEngineManager.get().isMute = !AudioEngineManager.get().isMute
updateMicBtn()
if (AudioEngineManager.get().isMute) {
AudioEngineManager.get().stopLocalAudio()
} else if (AvRoomDataManager.get().isOnMic(myUid)) {
AudioEngineManager.get().setRole(Constants.CLIENT_ROLE_BROADCASTER)
}

View File

@@ -0,0 +1,196 @@
package com.yizhuan.erban.avroom.fragment
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.avroom.adapter.GameMicroViewAdapter
import com.yizhuan.erban.avroom.adapter.GameMiniMicroViewAdapter
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog
import com.yizhuan.erban.avroom.game.GameDelegate
import com.yizhuan.erban.avroom.game.OnGameStatusChangeListener
import com.yizhuan.erban.avroom.presenter.GameRoomPresenter
import com.yizhuan.erban.avroom.view.IGameRoomView
import com.yizhuan.erban.databinding.FragmentGameRoomBinding
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.music.model.PlayerModel
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
import com.yizhuan.xchat_android_core.room.event.FinishAvRoomEvent
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
/**
* 轰趴房间
*
* @author chenran
* @date 2017/7/26
*/
@CreatePresenter(GameRoomPresenter::class)
class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
View.OnClickListener, OnGiftDialogBtnClickListener, IGameRoomView, OnMicroItemClickListener,
OnGameStatusChangeListener {
companion object {
@JvmStatic
fun newInstance(): GameRoomFragment {
val roomFragment = GameRoomFragment()
val bundle = Bundle()
roomFragment.arguments = bundle
return roomFragment
}
}
private lateinit var gameBinding: FragmentGameRoomBinding
private lateinit var gameDelegate: GameDelegate
private var isShowMiniMic = false
override fun getRootLayoutId(): Int {
return R.layout.fragment_game_room
}
override fun onFindViews() {
super.onFindViews()
gameBinding = DataBindingUtil.bind(mView)!!
gameBinding.lifecycleOwner = this
gameBinding.click = this
gameBinding.ktvModel = false
gameDelegate = GameDelegate(
requireActivity(),
gameBinding.flGameContainer,
AvRoomDataManager.get().mCurrentRoomInfo?.mgId
)
gameDelegate.setOnGameStatusChangeListener(this)
}
@SuppressLint("CheckResult")
override fun initiate() {
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
super.initiate()
//游戏模式暂时不需要这个
PlayerModel.get().stop()
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
mvpPresenter?.getBannerList()
gameBinding.tvShowMiniMic.setOnClickListener { showMiniMic() }
gameBinding.ivShowMic.setOnClickListener { showMic() }
}
private fun showMiniMic() {
if (isShowMiniMic) return
isShowMiniMic = true
gameBinding.microView.bindAdapter(GameMiniMicroViewAdapter(context).apply {
setOnClick { showMic() }
})
gameBinding.tvShowMiniMic.isVisible = false
gameBinding.microView.postDelayed({
gameBinding.ivShowMic.isVisible = true
gameBinding.llMicView.setBackgroundResource(R.drawable.bg_mini_mic_entrance)
}, 100)
}
private fun showMic() {
if (!isShowMiniMic) return
isShowMiniMic = false
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
gameBinding.tvShowMiniMic.isVisible = true
gameBinding.llMicView.background = null
gameBinding.ivShowMic.isVisible = false
}
override fun onSetListener() {
super.onSetListener()
bottomView.setBottomViewListener(BaseRoomBottomViewWrapper())
}
override fun updateView() {
super.updateView()
gameDelegate.updateGame(AvRoomDataManager.get().mCurrentRoomInfo?.mgId)
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
if (isSixMic()) {
gameBinding.tvShowMiniMic.isVisible = !isShowMiniMic
gameBinding.ivShowMic.isVisible = isShowMiniMic
} else {
showMic()
gameBinding.tvShowMiniMic.isInvisible = true
gameBinding.ivShowMic.isVisible = false
}
gameBinding.microView.adapter.notifyDataSetChanged()
}
override fun onGameStart() {
if (isSixMic()) {
showMiniMic()
}
}
override fun onGameEnd() {
if (isSixMic()) {
showMic()
}
}
private fun isSixMic(): Boolean {
return AvRoomDataManager.get().mgMicNum == AvRoomDataManager.GAME_DEF_MIC_COUNT
}
override fun onSendMsgSuccess(msg: String?) {
super.onSendMsgSuccess(msg)
msg?.let {
if (AvRoomDataManager.get().isSelfGamePlaying) {
gameDelegate.hitTheMark(msg)
}
}
}
override fun onShowBanner(dialogInfos: List<BannerInfo>) {
initRoomAct(gameBinding.activityImg, dialogInfos)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onFinishAvRoomEvent(event: FinishAvRoomEvent) {
gameDelegate.exitGame()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onFirstRechargeEvent(event: FirstChargeEvent) {
FirstChargePrizeDialog(
requireContext(),
event.chargeProdTitle,
event.firstChargeRewardList
).openDialog()
}
override fun onStart() {
super.onStart()
gameDelegate.onStart()
}
override fun onResume() {
super.onResume()
gameDelegate.onResume()
}
override fun onPause() {
super.onPause()
gameDelegate.onPause()
}
override fun onStop() {
super.onStop()
gameDelegate.onStop()
}
override fun onDestroy() {
gameDelegate.onDestroy()
super.onDestroy()
}
}

View File

@@ -32,6 +32,7 @@ import com.yizhuan.erban.avroom.activity.RoomOnlineUserActivity;
import com.yizhuan.erban.avroom.adapter.SelectGameAdapter;
import com.yizhuan.erban.avroom.dialog.ExitRoomPopupWindow;
import com.yizhuan.erban.avroom.widget.GiftV2View;
import com.yizhuan.erban.avroom.widget.RoomEffectView;
import com.yizhuan.erban.base.BaseFragment;
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
import com.yizhuan.erban.friend.view.SelectFriendActivity;
@@ -78,6 +79,7 @@ import cn.sharesdk.framework.Platform;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import kotlin.jvm.functions.Function0;
/**
* 轰趴房
@@ -98,6 +100,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
private ImageView ivRoomShare;
private GiftV2View giftView;
private ViewStub mVsGift2View;
private RoomEffectView mRoomEffectView;
private SVGAImageView svgaRoomBg;
private String[] bgPicture = new String[]{""};
@@ -178,6 +181,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
mIvGoodNumber = mView.findViewById(R.id.iv_good_number);
ivFollowRoom = mView.findViewById(R.id.iv_follow_room);
svgaRoomBg = mView.findViewById(R.id.svga_image_view_bg);
mRoomEffectView = mView.findViewById(R.id.room_effect_view);
}
/**
@@ -209,6 +213,13 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
ivRoomShare.setOnClickListener(this);
gameMainBinding.llRoomInfo.setOnClickListener(this);
gameMainBinding.ivBack.setOnClickListener(this);
mRoomEffectView.setOnPlayAnimCallback(new Function0<Boolean>() {
@Override
public Boolean invoke() {
return getIsAnim();
}
});
}
@SuppressLint("CheckResult")
@@ -344,6 +355,24 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
});
}
/**
* 获取礼物飘屏是否展示
*
* @return
*/
private boolean getIsAnim() {
if (giftView != null) {
return giftView.getIsPlayAnim();
}
return false;
}
/**
* 获取玩法飘屏是否展示
*/
private boolean getIsPlayAnim() {
return mRoomEffectView.getIsPlayAnim();
}
private void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
if (giftMultiReceiverInfo == null || !isResumed()) return;
@@ -405,7 +434,9 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
Fragment tempFragment = roomFragment;
switch (currentRoomInfo.getType()) {
case RoomInfo.ROOMTYPE_GAME:
toast(getString(R.string.room_game_is_not_open_yet));
if (!(tempFragment instanceof GameRoomFragment)) {
tempFragment = GameRoomFragment.newInstance();
}
break;
case RoomInfo.ROOM_TYPE_SINGLE:
if (!(tempFragment instanceof SingleRoomFragment)) {

View File

@@ -60,7 +60,6 @@ import com.yizhuan.xchat_android_core.room.queuing_mic.bean.RespQueuingMicListIn
import com.yizhuan.xchat_android_core.room.queuing_mic.event.QueuingMicEmptyEvent;
import com.yizhuan.xchat_android_core.room.queuing_mic.event.QueuingMicNotEmptyEvent;
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils;
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
import com.yizhuan.xchat_android_library.utils.ResUtil;
@@ -453,7 +452,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
if (!microType.equals(BaseMicroViewAdapter.MICRO_TYPE_CP)) {
microView.bindAdapter(new CpMicroViewAdapter(mContext));
}
} else if (AvRoomDataManager.get().isDatingMode()) {
} else if (AvRoomDataManager.get().isDatingMode()) {
if (!microType.equals(BaseMicroViewAdapter.MICRO_TYPE_DATING)) {
microView.bindAdapter(new DatingMicroViewAdapter(mContext));
}
@@ -965,9 +964,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
@Override
public void onShowBanner(List<BannerInfo> bannerInfos) {
initRoomAct(gameBinding.activityImg, bannerInfos, 11f);
AvRoomModel.get().getRoomActTimer(AvRoomDataManager.get().getRoomUid())
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.subscribe();
}

View File

@@ -0,0 +1,15 @@
/*
Copyright © Sud.Tech
https://sud.tech
*/
package com.yizhuan.erban.avroom.game;
import com.yizhuan.xchat_android_library.BuildConfig;
public class AppConfig {
protected static final String APP_ID = "1578948593831571457";
protected static final String APP_KEY = "J9lHOXvFWkAZiTfl4SK7IGt0wDnW3fWd";
protected static boolean isTestEnv = BuildConfig.DEBUG;
}

View File

@@ -0,0 +1,671 @@
package com.yizhuan.erban.avroom.game
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.ViewTreeObserver.OnGlobalLayoutListener
import android.widget.FrameLayout
import com.google.gson.Gson
import com.yizhuan.erban.R
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.room.game.GameCfg
import com.yizhuan.xchat_android_core.room.game.GameModel
import com.yizhuan.xchat_android_core.room.game.GameStatus
import com.yizhuan.xchat_android_core.room.model.HomePartyModel
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.utils.LogUtils
import com.yizhuan.xchat_android_core.utils.net.RxHelper
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
import okhttp3.*
import org.json.JSONException
import org.json.JSONObject
import tech.sud.mgp.core.*
import java.util.*
class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId: Long?) {
private val TAG = "GameDelegate"
private var APP_CODE = ""
private val mRoomID = AvRoomDataManager.get().roomUid.toString()
private val mLanguage = "zh-TW" //語言
//調用遊戲SDK的接口,成功加載遊戲後可用:
private var iSudFSTAPP: ISudFSTAPP? = null
private val gson = Gson()
//小遊戲ID
private var mMGID = 0L
//通用狀態-遊戲,關鍵詞
private var mKeyWord: String? = null
private val mUid = AuthModel.get().currentUid.toString()
private val homePartyModel = HomePartyModel()
private var onGameStatusChangeListener: OnGameStatusChangeListener? = null
fun setOnGameStatusChangeListener(onGameStatusChangeListener: OnGameStatusChangeListener) {
this.onGameStatusChangeListener = onGameStatusChangeListener
}
private val loginCallback: AppLoginListener =
object : AppLoginListener {
override fun onLoginFailure(err: String?) {
SingleToastUtil.showToast(err)
}
override fun onLoginSuccess(new_code: String, expire_Date: Long) {
APP_CODE = new_code
Handler(Looper.getMainLooper()).post {
//初始化遊戲SDK
initGameSDK(
activity,
AppConfig.APP_ID,
AppConfig.APP_KEY,
AppConfig.isTestEnv
)
}
}
}
init {
mMGID = mgId ?: 0L
login(loginCallback)
}
fun updateGame(mgId: Long?) {
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
mMGID = mgId
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
}
fun exitGame() {
UserModel.get().cacheLoginUserInfo?.gameStatus = GameStatus.STATUS_NOT_JOIN
notifySelfPlayingState(false)
notifySelfInState(false)
}
/**
* 例如"你畫我猜"遊戲的文字命中
*/
fun hitTheMark(msg: String) {
mKeyWord?.let {
if (msg.contains(it)) {
notifySelfTextHit(it, msg)
}
}
}
/**
* "接入方客戶端"登陸接口, 從"接入方服務端"獲得Code
* "接入方服務端"是通過"服務端接入SDK"獲得Code來返回給"接入方客戶端"的
* @param listener
*/
@SuppressLint("CheckResult")
private fun login(listener: AppLoginListener) {
GameModel.getGameCode()
.compose(RxHelper.bindContext(activity))
.subscribe({
listener.onLoginSuccess(it.code, it.expireDate)
}, {
listener.onLoginFailure(it.message)
})
}
/**
* 1初始化遊戲SDK
*
* @param context 上下文
* @param appID appID
* @param appKey appKey
* @param isTestEnv 是否是測試環境true測試環境false正式環境
*/
private fun initGameSDK(context: Context, appID: String, appKey: String, isTestEnv: Boolean) {
SudMGP.initSDK(context, appID, appKey, isTestEnv, object : ISudListenerInitSDK {
override fun onSuccess() {
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
}
override fun onFailure(code: Int, errInfo: String) {
showToast("初始化遊戲SDK失敗:$code--errInfo:$errInfo")
}
})
}
/**
* 2加載遊戲
*
* @param activity 上下文Activity
* @param userID 用戶ID業務系統保證每個用戶擁有唯一ID
* @param roomID 房間ID進入同一房間內的
* @param code 令牌
* @param mgID 小遊戲ID
* @param language 遊戲語言 現支持簡體zh-CN 繁體zh-TW 英語en-US 馬來語ms-MY
*/
private fun loadMG(
activity: Activity,
userID: String,
roomID: String,
code: String,
mgID: Long,
language: String
) {
iSudFSTAPP?.destroyMG()
iSudFSTAPP = SudMGP.loadMG(activity, userID, roomID, code, mgID, language, mISudFSMMG)
addGameView(iSudFSTAPP!!.gameView)
}
/**
* 3將遊戲view添加到我們的布局當中
*
* @param gameView
*/
private fun addGameView(gameView: View) {
container.removeAllViews()
container.addView(gameView)
}
private fun showToast(content: String?) {
SingleToastUtil.showToast(content)
}
/**
* 通知"文字命中狀態"到遊戲端
*
* @param iSudFSTAPP
* @param keyWord
*/
private fun notifySelfTextHit(keyWord: String?, msg: String) {
LogUtils.d("notifySelfTextHit")
try {
//狀態名稱
val state: String = SudMGPAPPState.APP_COMMON_SELF_TEXT_HIT
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("isHit", true) // true 命中false 未命中
jsonObject.put("keyWord", keyWord) // true 命中false 未命中
jsonObject.put("text", msg) // 聊天原始內容,這裏的值只是一個示例,意指內容當中包含關鍵詞則命中,具體按業務規則定。
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 設置當前關鍵詞
*
* @param keyWord
*/
private fun setKeyWord(keyWord: String?) {
mKeyWord = keyWord
}
/**
* 遊戲SDK調用app的接口
*/
private val mISudFSMMG: ISudFSMMG = object : ISudFSMMG {
override fun onGameLog(p0: String?) {
LogUtils.d(p0)
}
override fun onGameLoadingProgress(p0: Int, p1: Int, p2: Int) {
}
override fun onGameStarted() {
}
override fun onGameDestroyed() {
}
/**
* 回調此方法表示令牌過期此時需要刷新令牌並使用ISudFSMStateHandle回調
* @param handle
* @param dataJson
*/
override fun onExpireCode(handle: ISudFSMStateHandle, dataJson: String) {
login(object : AppLoginListener {
override fun onLoginFailure(err: String?) {
}
override fun onLoginSuccess(new_code: String, expire_Date: Long) {
APP_CODE = new_code
try {
val jsonObject = JSONObject()
jsonObject.put("ret_code", 0)
jsonObject.put("ret_msg", "success")
handle.success(jsonObject.toString())
} catch (e: JSONException) {
e.printStackTrace()
}
iSudFSTAPP?.updateCode(APP_CODE, null)
}
})
}
/**
* 處理獲取遊戲視圖信息
* @param handle
* @param dataJson
*/
override fun onGetGameViewInfo(handle: ISudFSMStateHandle, dataJson: String) {
//拿到遊戲View的寬高
val gameViewWidth = container.measuredWidth
val gameViewHeight = container.measuredHeight
if (gameViewWidth > 0 && gameViewHeight > 0) {
notifyGameViewInfo(handle, gameViewWidth, gameViewHeight)
return
}
//如果遊戲View未加載完成則監聽加載完成時回調
container.viewTreeObserver.addOnGlobalLayoutListener(object : OnGlobalLayoutListener {
override fun onGlobalLayout() {
container.viewTreeObserver.removeOnGlobalLayoutListener(this)
val width = container.measuredWidth
val height = container.measuredHeight
notifyGameViewInfo(handle, width, height)
}
})
}
override fun onGetGameCfg(handle: ISudFSMStateHandle?, p1: String?) {
handle?.success(gson.toJson(GameCfg()))
}
/**
* 通知遊戲,遊戲視圖信息
* @param handle
* @param gameViewWidth
* @param gameViewHeight
*/
private fun notifyGameViewInfo(
handle: ISudFSMStateHandle,
gameViewWidth: Int,
gameViewHeight: Int
) {
try {
val jsonObject = JSONObject()
jsonObject.put("ret_code", 0)
jsonObject.put("ret_msg", "success")
//遊戲View大小
val viewSize = JSONObject()
viewSize.put("width", gameViewWidth)
viewSize.put("height", gameViewHeight)
jsonObject.put("view_size", viewSize)
//遊戲安全操作區域
val viewGameRect = JSONObject()
viewGameRect.put("left", 0)
viewGameRect.put("top", container.context.resources.getDimensionPixelOffset(R.dimen.dp_180))
viewGameRect.put("right", 0)
viewGameRect.put("bottom", container.context.resources.getDimensionPixelOffset(R.dimen.dp_150))
jsonObject.put("view_game_rect", viewGameRect)
//通知遊戲
val json = jsonObject.toString()
Log.d(TAG, "notifyGameViewInfo:$json")
handle.success(json)
} catch (e: JSONException) {
e.printStackTrace()
}
}
/**
* 遊戲狀態變化
* @param handle
* @param state 狀態名
* @param dataJson 狀態數據json字符串
*/
override fun onGameStateChange(
handle: ISudFSMStateHandle,
state: String,
dataJson: String
) {
Log.d(TAG, "onGameStateChange state:$state--dataJson:$dataJson")
when (state) {
//SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE -> showToast("遊戲:公屏消息")
SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT -> {
if (TextUtils.isEmpty(dataJson)) {
setKeyWord(null)
} else {
try {
val jsonObject = JSONObject(dataJson)
if (jsonObject.isNull("word")) {
setKeyWord(null)
} else {
val keyWord = jsonObject.getString("word")
setKeyWord(keyWord)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_JOIN_BTN -> {
try {
val jsonObject = JSONObject(dataJson)
val seatIndex = jsonObject.optInt("seatIndex", -1)
updateMyMicQueue(GameStatus.STATUS_NOT_READY, true, seatIndex)
} catch (e: Exception) {
e.printStackTrace()
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_START_BTN -> {
notifySelfPlayingState(true)
}
SudMGPMGState.MG_COMMON_GAME_STATE -> handleGameState(dataJson)
}
}
/**
* 玩家狀態變化
* @param handle
* @param userId 玩家用戶ID
* @param state 狀態名
* @param dataJson 狀態數據json字符串。參考文檔
*/
override fun onPlayerStateChange(
handle: ISudFSMStateHandle,
userId: String,
state: String,
dataJson: String
) {
Log.d(TAG, "onPlayerStateChange userId:$userId--state:$state--dataJson:$dataJson")
when (state) {
SudMGPMGState.MG_COMMON_PLAYER_IN -> handlePlayerIn(userId, dataJson)
SudMGPMGState.MG_COMMON_PLAYER_READY -> handlePlayerReady(userId, dataJson)
SudMGPMGState.MG_COMMON_PLAYER_CAPTAIN -> handlePlayerCaptain(dataJson)
SudMGPMGState.MG_COMMON_PLAYER_PLAYING -> handlePlayerPlaying(userId, dataJson)
}
}
}
private fun handlePlayerIn(userId: String, dataJson: String) {
if (userId != mUid) return
try {
val jsonObject = JSONObject(dataJson)
val retCode = jsonObject.getInt("retCode")
val isIn = jsonObject.getBoolean("isIn")
if (retCode != 0) {
return
}
if (isIn) { // 已加入
if (AvRoomDataManager.get().isRoomOwner) {
notifySelfCaptainState(mUid)
}
} else { // 未加入
var reason = 0
if (jsonObject.has("reason")) {
reason = jsonObject.getInt("reason")
}
if (reason == 0) {
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
} else if (reason == 1) {
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun updateMyMicQueue(gameStatus: Int, isJoin: Boolean = false, seatIndex: Int = -1) {
UserModel.get().cacheLoginUserInfo?.gameStatus = gameStatus
val position = AvRoomDataManager.get().getMicPosition(mUid)
if (position != AvRoomDataManager.POSITON_NOT_ON_MIC) {
if (isJoin) notifySelfInState(true, seatIndex)
homePartyModel.updateMyMicQueue(
position,
AvRoomDataManager.get().roomId.toString(),
UserModel.get().cacheLoginUserInfo
).subscribe()
} else if (isJoin) {
val upPosition = AvRoomDataManager.get().findGamePosition()
if (upPosition == Int.MIN_VALUE) {
showToast("當前遊戲人數已滿!")
} else {
UserModel.get().cacheLoginUserInfo?.gameStatus = 1
homePartyModel.upMicroPhone(upPosition,
mUid,
AvRoomDataManager.get().roomId.toString(),
false, object : CallBack<String> {
override fun onSuccess(data: String?) {
notifySelfInState(true, seatIndex)
}
override fun onFail(code: Int, error: String?) {
showToast(error)
}
})
}
}
}
private fun handlePlayerReady(userId: String, dataJson: String) {
if (userId != mUid) return
try {
val jsonObject = JSONObject(dataJson)
val retCode = jsonObject.getInt("retCode")
val isReady = jsonObject.getBoolean("isReady")
if (retCode != 0) {
return
}
updateMyMicQueue(if (isReady) GameStatus.STATUS_READY else GameStatus.STATUS_NOT_READY)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun handlePlayerCaptain(dataJson: String) {
try {
val jsonObject = JSONObject(dataJson)
val retCode = jsonObject.getInt("retCode")
if (retCode != 0) {
return
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun handleGameState(dataJson: String) {
try {
val jsonObject = JSONObject(dataJson)
val gameState = jsonObject.getInt("gameState")
if (gameState == 0) {
onGameStatusChangeListener?.onGameEnd()
} else if (gameState == 2) {
onGameStatusChangeListener?.onGameStart()
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun handlePlayerPlaying(userId: String, dataJson: String) {
if (userId != mUid) return
try {
val jsonObject = JSONObject(dataJson)
val retCode = jsonObject.getInt("retCode")
if (retCode != 0) {
return
}
val isPlaying = jsonObject.getBoolean("isPlaying")
if (isPlaying) {
updateMyMicQueue(GameStatus.STATUS_PLAYING)
} else {
updateMyMicQueue(GameStatus.STATUS_NOT_READY)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfInState(isIn: Boolean, seatIndex: Int = -1) {
try {
if (!isIn) {
notifySelfReadyState(false)
}
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_IN
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("isIn", isIn) // true 加入遊戲false 退出遊戲
if (seatIndex != -1) {
jsonObject.put("seatIndex", seatIndex)
}
jsonObject.put("teamId", 1) //哪一隊伍(2v2,4v4)
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfReadyState(isReady: Boolean) {
try {
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_READY
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("isReady", isReady) // true 準備false 取消準備
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfPlayingState(isPlaying: Boolean) {
try {
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_PLAYING
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("isPlaying", isPlaying) // true 開始遊戲false 結束遊戲
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfCaptainState(uid: String) {
try {
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_CAPTAIN
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("curCaptainUID", uid) // 必填指定隊長uid
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfKickState(uid: String) {
try {
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_KICK
//狀態數據
val jsonObject = JSONObject()
jsonObject.put("kickedUID", uid) // 被踢用戶uid
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun notifySelfEndState() {
try {
//狀態名稱
val state = SudMGPAPPState.APP_COMMON_SELF_END
//狀態數據
val jsonObject = JSONObject()
val dataJson = jsonObject.toString()
//調用接口
iSudFSTAPP?.notifyStateChange(state, dataJson, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun onStart() {
iSudFSTAPP?.startMG() //啟動遊戲
}
fun onResume() {
iSudFSTAPP?.playMG() //開始遊戲
}
fun onPause() {
iSudFSTAPP?.pauseMG() //暫停遊戲
}
fun onStop() {
iSudFSTAPP?.stopMG() //停止遊戲
}
fun onDestroy() {
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
iSudFSTAPP?.destroyMG()
}
}
internal interface AppLoginListener {
/**
* App Server 登陸失敗, App Server 不能返回CODE
*/
fun onLoginFailure(err: String?)
/**
* App Server 登陸成功, App Server調用服務端接入SDK的API獲取Code 返回給 App
* App 就要用CODE和自己生成的UserID去調用SDK的初始化函數登陸小遊戲
* 小遊戲登陸成功後其UserID就是App傳的UserID
*/
fun onLoginSuccess(new_code: String, expire_Date: Long)
}

View File

@@ -0,0 +1,13 @@
package com.yizhuan.erban.avroom.game
interface OnGameStatusChangeListener {
/**
* 游戏开始
*/
fun onGameStart()
/**
* 游戏结束
*/
fun onGameEnd()
}

View File

@@ -0,0 +1,61 @@
/*
Copyright © Sud.Tech
https://sud.tech
*/
package com.yizhuan.erban.avroom.game;
/**
* Time:2021/10/19
* Description: APP to MG 的状态定义
*/
public class SudMGPAPPState {
// region 通用状态
/**
* 加入状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_IN = "app_common_self_in";
/**
* 准备状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_READY = "app_common_self_ready";
/**
* 游戏状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_PLAYING = "app_common_self_playing";
/**
* 队长状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_CAPTAIN = "app_common_self_captain";
/**
* 踢人
* v1.1.30.xx
*/
public static final String APP_COMMON_SELF_KICK = "app_common_self_kick";
/**
* 结束游戏
* v1.1.30.xx
*/
public static final String APP_COMMON_SELF_END = "app_common_self_end";
/**
* 麦克风状态
*/
public static final String APP_COMMON_SELF_MICROPHONE = "app_common_self_microphone";
/**
* 文字命中状态
*/
public static final String APP_COMMON_SELF_TEXT_HIT = "app_common_self_text_hit";
}

View File

@@ -0,0 +1,125 @@
/*
Copyright © Sud.Tech
https://sud.tech
*/
package com.yizhuan.erban.avroom.game;
/**
* Time:2021/10/19
* Description: MG to APP 的状态定义
*/
public class SudMGPMGState {
// region 通用状态-游戏
/**
* 公屏消息 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PUBLIC_MESSAGE = "mg_common_public_message";
/**
* 关键词状态
*/
public static final String MG_COMMON_KEY_WORD_TO_HIT = "mg_common_key_word_to_hit";
// endregion 通用状态-游戏
// region 通用状态-玩家
/**
* 加入状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_IN = "mg_common_player_in";
/**
* 准备状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_READY = "mg_common_player_ready";
/**
* 队长状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_CAPTAIN = "mg_common_player_captain";
/**
* 游戏状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_PLAYING = "mg_common_player_playing";
/**
* 游戏状态(已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_GAME_STATE = "mg_common_game_state";
// endregion 通用状态-玩家
// region 碰碰我最强
// endregion 碰碰我最强
// region 飞刀达人
// endregion 飞刀达人
// region 你画我猜
/**
* 选词中
*/
public static final String MG_DG_SELECTING = "mg_dg_selecting";
/**
* 作画中
*/
public static final String MG_DG_PAINTING = "mg_dg_painting";
/**
* 错误答案
*/
public static final String MG_DG_ERRORANSWER = "mg_dg_erroranswer";
/**
* 总积分
*/
public static final String MG_DG_TOTALSCORE = "mg_dg_totalscore";
/**
* 本次积分
*/
public static final String MG_DG_SCORE = "mg_dg_score";
// endregion 你画我猜
/**
* 加入游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_JOIN_BTN = "mg_common_self_click_join_btn";
/**
* 取消加入游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_CANCEL_JOIN_BTN = "mg_common_self_click_cancel_join_btn";
/**
* 准备按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_READY_BTN = "mg_common_self_click_ready_btn";
/**
* 取消准备按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_CANCEL_READY_BTN = "mg_common_self_click_cancel_ready_btn";
/**
* 开始游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_START_BTN = "mg_common_self_click_start_btn";
/**
* 分享按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_SHARE_BTN = "mg_common_self_click_share_btn";
}

View File

@@ -482,7 +482,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
public void onNext(Long aLong) {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null) return;
Log.d(TAG, "onNext: roomInfo in startGetOnlineMemberNumberJob: " + roomInfo);
Log.d(TAG, "onNext: has login in IM: " + AuthModel.get().isImLogin());
Disposable subscribe = mAvRoomModel.startGetOnlineMemberNumberJob(roomInfo.getRoomId())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -42,15 +42,15 @@ class RedPackageGoRoomDialog : BaseDialog<DialogRedPackageGoRoomBinding>() {
override fun init() {
AnimationUtils.loadAnimation(context, R.anim.anim_all_red_package).apply {
binding.clRed.animation = this
binding?.clRed?.animation = this
start()
}
AnimationUtils.loadAnimation(context, R.anim.anim_all_red_package_in_btn).let {
binding.ivGoRoom.animation = it
binding?.ivGoRoom?.animation = it
it.start()
}
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivGoRoom.setOnClickListener {
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.ivGoRoom?.setOnClickListener {
val jump = {
AVRoomActivity.start(context, redPackageNotifyInfo.roomUid,
AVRoomActivity.FROM_TYPE_ALL_RED, redPackageNotifyInfo.sendUserNick, redPackageNotifyInfo)
@@ -69,10 +69,10 @@ class RedPackageGoRoomDialog : BaseDialog<DialogRedPackageGoRoomBinding>() {
}
redPackageNotifyInfo.let {
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding.ivAvatar)
binding.tvContent.text = it.redEnvelopeMessage
binding.tvNickname.text = it.sendUserNick.subAndReplaceDot()
binding.tvRoomName.text = it.roomTitle.subAndReplaceDot()
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding?.ivAvatar)
binding?.tvContent?.text = it.redEnvelopeMessage
binding?.tvNickname?.text = it.sendUserNick.subAndReplaceDot()
binding?.tvRoomName?.text = it.roomTitle.subAndReplaceDot()
}
// StatUtil.onEvent("gethongbao", ResUtil.getString(R.string.avroom_redpackage_redpackagegoroomdialog_03))
}

View File

@@ -62,15 +62,15 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
override fun init() {
dialog?.setCanceledOnTouchOutside(false)
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivOpen.setOnClickListener {
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.ivOpen?.setOnClickListener {
startRedPacketAnim(it)
it.isEnabled = false
}
redPackageNotifyInfo.let {
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding.ivAvatar)
binding.tvContent.text = it.redEnvelopeMessage
binding.tvNickname.text = it.sendUserNick
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding?.ivAvatar)
binding?.tvContent?.text = it.redEnvelopeMessage
binding?.tvNickname?.text = it.sendUserNick
}
// StatUtil.onEvent("openhongbao", ResUtil.getString(R.string.avroom_redpackage_redpackageopendialog_01))
}
@@ -85,7 +85,7 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
}
}
, {
binding.ivOpen.isEnabled = true
binding?.ivOpen?.isEnabled = true
mObjectAnimator?.cancel()
SingleToastUtil.showToast(it.message)
})
@@ -97,11 +97,11 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
it.addListener(object : AnimatorListenerAdapter() {
var isCanceled = false
override fun onAnimationCancel(animation: Animator?) {
override fun onAnimationCancel(animation: Animator) {
isCanceled = true
}
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
if (!isCanceled) {
openRedPackage()
}
@@ -117,32 +117,32 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
if (isOpened) return
redPackageInfo?.let { packageInfo ->
isOpened = true
binding.clOpened.visibility = View.VISIBLE
binding.clRed.visibility = View.GONE
binding.tvNicknameOpened.text = redPackageNotifyInfo.sendUserNick
ImageLoadUtils.loadAvatar(context, redPackageNotifyInfo.sendUserAvatar, binding.ivAvatarOpened)
binding?.clOpened?.visibility = View.VISIBLE
binding?.clRed?.visibility = View.GONE
binding?.tvNicknameOpened?.text = redPackageNotifyInfo.sendUserNick
ImageLoadUtils.loadAvatar(context, redPackageNotifyInfo.sendUserAvatar, binding?.ivAvatarOpened)
packageInfo.redEnvelopeVO?.apply {
binding.tvContentOpened.text = message
binding?.tvContentOpened?.text = message
when (packageInfo.redEnvelopeState) {
SUCCESS -> {
packageInfo.redEnvelopeItemVOs?.firstOrNull { item -> item.userVO.uid == UserUtils.getUserUid() }?.let {
it.redEnvelopeGiftItemVOs?.apply {
if (!isEmpty()) {
val adapter = RedPackageGiftAdapter(R.layout.item_red_package_gift_top)
binding.rvGift.visibility = View.VISIBLE
binding.tvDiamondNum.visibility = View.GONE
binding.rvGift.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding.rvGift.adapter = adapter
binding?.rvGift?.visibility = View.VISIBLE
binding?.tvDiamondNum?.visibility = View.GONE
binding?.rvGift?.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding?.rvGift?.adapter = adapter
adapter.setNewData(this)
binding.tvTips.setTextColor(Color.WHITE)
binding.tvTips.text = MessageView.SpannableBuilder(binding.tvTips)
binding?.tvTips?.setTextColor(Color.WHITE)
binding?.tvTips?.text = MessageView.SpannableBuilder(binding?.tvTips)
.append(ResUtil.getString(R.string.avroom_redpackage_redpackageopendialog_03))
.append(it.amount, ForegroundColorSpan(Color.parseColor("#FDCD00")))
.append(ResUtil.getString(R.string.avroom_redpackage_redpackageopendialog_04))
.build()
}
}
binding.tvDiamondNum.text = it.amount.substringBefore(".")
binding?.tvDiamondNum?.text = it.amount.substringBefore(".")
}
if (!AvRoomDataManager.get().isRoomFans){
AvRoomDataManager.get().roomUid.let {
@@ -155,20 +155,20 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
}
}
TIME_OUT, REMAIN_ZERO, TIME_OUT_BACK -> {
binding.clOpened.setBackgroundResource(R.drawable.room_red_package_get_bg)
binding.tvDiamondNum.visibility = View.GONE
binding.tvTips.visibility = View.GONE
binding.tvNoGet.visibility = View.VISIBLE
binding?.clOpened?.setBackgroundResource(R.drawable.room_red_package_get_bg)
binding?.tvDiamondNum?.visibility = View.GONE
binding?.tvTips?.visibility = View.GONE
binding?.tvNoGet?.visibility = View.VISIBLE
}
}
binding.tvRedNum.text = "已領取${pickNum}/${totalNum}"
binding?.tvRedNum?.text = "已領取${pickNum}/${totalNum}"
if (type == ALL_GIFT || type == ALL_DIAMOND) {
DemoCache.saveRedPackage(id)
}
}
val adapter = RedPackageOpenAdapter()
binding.rvUsers.adapter = adapter
binding.rvUsers.layoutManager = LinearLayoutManager(context)
binding?.rvUsers?.adapter = adapter
binding?.rvUsers?.layoutManager = LinearLayoutManager(context)
adapter.setNewData(packageInfo.redEnvelopeItemVOs)
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
}

View File

@@ -59,7 +59,7 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
EventBus.getDefault().register(this)
PayModel.get().currentWalletInfo?.let {
binding.tvBalanceNum.text = it.diamondNum.toInt().toString()
binding?.tvBalanceNum?.text = it.diamondNum.toInt().toString()
}
if (InitialModel.get().cacheInitInfo == null) {
InitialModel.get().init(true)
@@ -74,12 +74,12 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
*/
fun changeToNotAll() {
isAll = false
binding.tvAllRed.alpha = 0.5f
binding.tvRoomRed.alpha = 1f
binding.indicatorAllRed.visibility = View.GONE
binding.indicatorRoomRed.visibility = View.VISIBLE
binding.tvGoldNumHint.text = "紅包總金額不低於${initInfo.redEnvelopeConfig.roomRedEnvelopeMinAmount}鉆石且必須為10的倍數"
binding.editRedNum.hint = "${initInfo.redEnvelopeConfig.roomRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.roomRedEnvelopeMaxNum}"
binding?.tvAllRed?.alpha = 0.5f
binding?.tvRoomRed?.alpha = 1f
binding?.indicatorAllRed?.visibility = View.GONE
binding?.indicatorRoomRed?.visibility = View.VISIBLE
binding?.tvGoldNumHint?.text = "紅包總金額不低於${initInfo.redEnvelopeConfig.roomRedEnvelopeMinAmount}鉆石且必須為10的倍數"
binding?.editRedNum?.hint = "${initInfo.redEnvelopeConfig.roomRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.roomRedEnvelopeMaxNum}"
}
/**
@@ -87,39 +87,39 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
*/
fun changeToAll() {
isAll = true
binding.tvAllRed.alpha = 1f
binding.tvRoomRed.alpha = 0.5f
binding.indicatorAllRed.visibility = View.VISIBLE
binding.indicatorRoomRed.visibility = View.GONE
binding.tvGoldNumHint.text = "紅包總金額不低於${initInfo.redEnvelopeConfig.serverRedEnvelopeMinAmount}鉆石且必須為100的倍數"
binding.editRedNum.hint = "${initInfo.redEnvelopeConfig.serverRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.serverRedEnvelopeMaxNum}"
binding?.tvAllRed?.alpha = 1f
binding?.tvRoomRed?.alpha = 0.5f
binding?.indicatorAllRed?.visibility = View.VISIBLE
binding?.indicatorRoomRed?.visibility = View.GONE
binding?.tvGoldNumHint?.text = "紅包總金額不低於${initInfo.redEnvelopeConfig.serverRedEnvelopeMinAmount}鉆石且必須為100的倍數"
binding?.editRedNum?.hint = "${initInfo.redEnvelopeConfig.serverRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.serverRedEnvelopeMaxNum}"
}
when (initInfo.redEnvelopedPosition) {
2 -> changeToAll()
else -> changeToNotAll()
}
binding.tvCharge.paint.flags = Paint.UNDERLINE_TEXT_FLAG
binding.tvCharge.paint.isAntiAlias = true
binding.tvChangeType.paint.flags = Paint.UNDERLINE_TEXT_FLAG
binding.tvChangeType.paint.isAntiAlias = true
binding.tvChangeType.setOnClickListener {
binding?.tvCharge?.paint?.flags = Paint.UNDERLINE_TEXT_FLAG
binding?.tvCharge?.paint?.isAntiAlias = true
binding?.tvChangeType?.paint?.flags = Paint.UNDERLINE_TEXT_FLAG
binding?.tvChangeType?.paint?.isAntiAlias = true
binding?.tvChangeType?.setOnClickListener {
if (isGift) {
isGift = false
binding.tvRedTypeHint.text = "當前為手氣紅包,"
binding.tvChangeType.text = "改為禮物紅包"
binding?.tvRedTypeHint?.text = "當前為手氣紅包,"
binding?.tvChangeType?.text = "改為禮物紅包"
} else {
isGift = true
binding.tvRedTypeHint.text = "當前為禮物紅包,"
binding.tvChangeType.text = "改為手氣紅包"
binding?.tvRedTypeHint?.text = "當前為禮物紅包,"
binding?.tvChangeType?.text = "改為手氣紅包"
}
}
//默認就已經是手氣紅包,如果後臺配置為了禮物紅包就在這裏改下
if (initInfo.redEnvelopeType == 2 && !isGift) {
binding.tvChangeType.callOnClick()
binding?.tvChangeType?.callOnClick()
}
binding.tvCharge.setOnClickListener {
binding?.tvCharge?.setOnClickListener {
if (!CommonUtils.isFastDoubleClick(800)) {
if (AppMetaDataUtil.getChannelID() == Constants.GOOGLE) {
ChargeActivity.start(context)
@@ -133,9 +133,9 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
}
}
}
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivHelp.setOnClickListener { DialogWebViewActivity.start(context, UriProvider.getRedPacketRule()) }
binding.ivSend.setOnClickListener {
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.ivHelp?.setOnClickListener { DialogWebViewActivity.start(context, UriProvider.getRedPacketRule()) }
binding?.ivSend?.setOnClickListener {
UserModel.get().cacheLoginUserInfo?.let {
if (!it.isBindPaymentPwd) {
ModifyPwdActivity.start(context, ModifyPwdActivity.PAY_PWD)
@@ -148,12 +148,12 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
val maxGold = if (isAll) initInfo.redEnvelopeConfig.serverRedEnvelopeMaxAmount else initInfo.redEnvelopeConfig.roomRedEnvelopeMaxAmount
val rate = if (initInfo.redEnvelopeConfig.exchangeDiamondsRate == 0.0) 0.68 else initInfo.redEnvelopeConfig.exchangeDiamondsRate
val redNum = binding.editRedNum.text.toString().toIntOrDef()
val redNum = binding?.editRedNum?.text.toString().toIntOrDef()
if (redNum < minNum || redNum > maxNum) {
SingleToastUtil.showToast("紅包數量不能小於${minNum}或大於${maxNum}!")
return@setOnClickListener
}
val goldNum = binding.editGoldNum.text.toString().toIntOrDef()
val goldNum = binding?.editGoldNum?.text.toString().toIntOrDef()
if (isAll) {
if (goldNum % 100 != 0) {
@@ -179,22 +179,22 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
SingleToastUtil.showToast("單個紅包金額過低")
return@setOnClickListener
}
GiveGoldPassWordFragment.newInstance(childFragmentManager, binding.editGoldNum.text.toString()).apply {
GiveGoldPassWordFragment.newInstance(childFragmentManager, binding?.editGoldNum?.text.toString()).apply {
setListener(this@RedPackageSendDialog)
passWordFragment = this
}
};
binding.tvAllRed.setOnClickListener {
binding?.tvAllRed?.setOnClickListener {
if (isAll) return@setOnClickListener
changeToAll()
}
binding.tvRoomRed.setOnClickListener {
binding?.tvRoomRed?.setOnClickListener {
if (!isAll) return@setOnClickListener
changeToNotAll()
}
binding.editRedText.addTextChangedListener(this)
binding?.editRedText?.addTextChangedListener(this)
binding.editRedText.setOnEditorActionListener { _, _, event ->
binding?.editRedText?.setOnEditorActionListener { _, _, event ->
event.keyCode == KeyEvent.KEYCODE_ENTER
}
@@ -210,7 +210,7 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
}
override fun onDestroyView() {
binding.editRedText.removeTextChangedListener(this)
binding?.editRedText?.removeTextChangedListener(this)
super.onDestroyView()
}
@@ -220,9 +220,9 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
val password = passWordFragment?.password?.password ?: ""
if (password.length == 6) {
dialogManager.showProgressDialog(context)
RedPackageModel.sendRedPackage(binding.editGoldNum.text.toString(),
binding.editRedText.text.toString().ifEmpty { "恭喜發財,大吉大利!" },
binding.editRedNum.text.toString(),
RedPackageModel.sendRedPackage(binding?.editGoldNum?.text.toString(),
binding?.editRedText?.text.toString().ifEmpty { "恭喜發財,大吉大利!" },
binding?.editRedNum?.text.toString(),
AvRoomDataManager.get().mCurrentRoomInfo?.uid.toString(), getRedType(), DESUtils.DESAndBase64(password))
.doOnError {
dialogManager.dismissDialog()
@@ -241,7 +241,7 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
@Subscribe(threadMode = ThreadMode.MAIN)
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
binding.tvBalanceNum.text = PayModel.get().currentWalletInfo?.diamondNum?.toString()
binding?.tvBalanceNum?.text = PayModel.get().currentWalletInfo?.diamondNum?.toString()
?: "0"
}
@@ -256,7 +256,7 @@ class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPass
@SuppressLint("SetTextI18n")
override fun afterTextChanged(s: Editable) {
binding.tvRedTextLimit.text = "${s.length}/20"
binding?.tvRedTextLimit?.text = "${s.length}/20"
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

View File

@@ -33,37 +33,37 @@ class SingleRoomPkFinishDialog : BaseDialog<DialogSingleRoomPkFinishBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.tvClose.setOnClickListener { dismissAllowingStateLoss() }
binding.tvTitleRed.text = roomPkBean.cNick.subAndReplaceDot(7)
binding.tvValueRed.text = "${roomPkBean.cAmount}"
binding.ivAvatarRed.load(roomPkBean.cAvatar, defaultRes = R.drawable.default_avatar)
binding?.tvClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.tvTitleRed?.text = roomPkBean.cNick.subAndReplaceDot(7)
binding?.tvValueRed?.text = "${roomPkBean.cAmount}"
binding?.ivAvatarRed?.load(roomPkBean.cAvatar, defaultRes = R.drawable.default_avatar)
roomPkBean.csRank.getOrNull(0)?.let {
binding.groupRank1.isVisible = true
binding.tvRankNick1.text = it.nick.subAndReplaceDot(7)
binding.tvRankValue1.text = "PK值:${it.amount}"
binding.ivAvatar1.load(it.avatar, defaultRes = R.drawable.default_avatar)
binding?.groupRank1?.isVisible = true
binding?.tvRankNick1?.text = it.nick.subAndReplaceDot(7)
binding?.tvRankValue1?.text = "PK值:${it.amount}"
binding?.ivAvatar1?.load(it.avatar, defaultRes = R.drawable.default_avatar)
} ?: run {
binding.groupRank1.isVisible = false
binding.tvEmptyTip.isVisible = true
binding?.groupRank1?.isVisible = false
binding?.tvEmptyTip?.isVisible = true
}
roomPkBean.csRank.getOrNull(1)?.let {
binding.groupRank2.isVisible = true
binding.tvRankNick2.text = it.nick.subAndReplaceDot(7)
binding.tvRankValue2.text = "PK值:${it.amount}"
binding.ivAvatar2.load(it.avatar, defaultRes = R.drawable.default_avatar)
binding?.groupRank2?.isVisible = true
binding?.tvRankNick2?.text = it.nick.subAndReplaceDot(7)
binding?.tvRankValue2?.text = "PK值:${it.amount}"
binding?.ivAvatar2?.load(it.avatar, defaultRes = R.drawable.default_avatar)
} ?: run {
binding.groupRank2.isVisible = false
binding?.groupRank2?.isVisible = false
}
roomPkBean.csRank.getOrNull(2)?.let {
binding.groupRank3.isVisible = true
binding.tvRankNick3.text = it.nick.subAndReplaceDot(7)
binding.tvRankValue3.text = "PK值:${it.amount}"
binding.ivAvatar3.load(it.avatar, defaultRes = R.drawable.default_avatar)
binding?.groupRank3?.isVisible = true
binding?.tvRankNick3?.text = it.nick.subAndReplaceDot(7)
binding?.tvRankValue3?.text = "PK值:${it.amount}"
binding?.ivAvatar3?.load(it.avatar, defaultRes = R.drawable.default_avatar)
} ?: run {
binding.groupRank3.isVisible = false
binding?.groupRank3?.isVisible = false
}
Observable.intervalRange(0, 6, 0, 1, TimeUnit.SECONDS)
@@ -71,24 +71,24 @@ class SingleRoomPkFinishDialog : BaseDialog<DialogSingleRoomPkFinishBinding>() {
.observeOn(AndroidSchedulers.mainThread())
.doOnComplete { dismissAllowingStateLoss() }
.subscribe {
binding.tvClose.text = "關閉(${5 - it})"
binding?.tvClose?.text = "關閉(${5 - it})"
}
when (roomPkBean.winUid) {
0L -> {
binding.viewBg.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce)
binding.viewBgAvatar.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce_avatar)
binding.tvContributeTitle.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce_contribute)
binding?.viewBg?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce)
binding?.viewBgAvatar?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce_avatar)
binding?.tvContributeTitle?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_deuce_contribute)
}
roomPkBean.cUid -> {
binding.viewBg.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win)
binding.viewBgAvatar.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win_avatar)
binding.tvContributeTitle.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win_contribute)
binding?.viewBg?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win)
binding?.viewBgAvatar?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win_avatar)
binding?.tvContributeTitle?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_win_contribute)
}
else -> {
binding.viewBg.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed)
binding.viewBgAvatar.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed_avatar)
binding.tvContributeTitle.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed_contribute)
binding?.viewBg?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed)
binding?.viewBgAvatar?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed_avatar)
binding?.tvContributeTitle?.setBackgroundResource(R.drawable.single_room_pk_bg_finish_failed_contribute)
}
}

View File

@@ -29,23 +29,23 @@ class SingleRoomPkForceFinishDialog : BaseDialog<DialogSingleRoomPkForceFinishBi
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.tvTitleRed.text = roomPkBean.cNick.subAndReplaceDot(7)
binding.tvValueRed.text = "${roomPkBean.cAmount}"
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.tvTitleRed?.text = roomPkBean.cNick.subAndReplaceDot(7)
binding?.tvValueRed?.text = "${roomPkBean.cAmount}"
ImageLoadUtils.loadImage(
context,
roomPkBean.cAvatar,
binding.ivAvatarRed,
binding?.ivAvatarRed,
R.drawable.default_avatar
)
binding.tvTitleBlue.text = roomPkBean.aNick.subAndReplaceDot(7)
binding.tvValueBlue.text = "${roomPkBean.aAmount}"
binding?.tvTitleBlue?.text = roomPkBean.aNick.subAndReplaceDot(7)
binding?.tvValueBlue?.text = "${roomPkBean.aAmount}"
ImageLoadUtils.loadImage(
context,
roomPkBean.aAvatar,
binding.ivAvatarBlue,
binding?.ivAvatarBlue,
R.drawable.default_avatar
)

View File

@@ -36,26 +36,26 @@ class SingleRoomPkReceivedDialog : BaseDialog<DialogSingleRoomPkReceivedBinding>
@SuppressLint("CheckResult")
override fun init() {
binding.tvNick.text = pkBean.inviteRoomTitle.subAndReplaceDot(7)
binding.tvTime.text = "${pkBean.pkDuration}分鐘"
binding?.tvNick?.text = pkBean.inviteRoomTitle.subAndReplaceDot(7)
binding?.tvTime?.text = "${pkBean.pkDuration}分鐘"
pkBean.pkDesc.ifNotNullOrEmpty {
binding.tvDescTitle.isVisible = true
binding.tvDesc.isVisible = true
binding.tvDesc.text = it
binding?.tvDescTitle?.isVisible = true
binding?.tvDesc?.isVisible = true
binding?.tvDesc?.text = it
}
disposable = Observable.intervalRange(0, 10, 0, 1, TimeUnit.SECONDS)
.compose(bindToLifecycle())
.observeOn(AndroidSchedulers.mainThread())
.doOnComplete { dismissAllowingStateLoss() }
.subscribe {
binding.tvCloseTime.text = "${10 - it}"
binding?.tvCloseTime?.text = "${10 - it}"
}
binding.tvReceived.setOnClickListener {
binding?.tvReceived?.setOnClickListener {
commit(true)
}
binding.tvRefuse.setOnClickListener {
binding?.tvRefuse?.setOnClickListener {
commit(false)
}
}

View File

@@ -17,12 +17,12 @@ class SingleRoomPkRuleDialog : BaseDialog<DialogSingleRoomPkRuleBinding>() {
}
override fun init() {
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.tvContent.movementMethod = ScrollingMovementMethod.getInstance()
binding?.ivClose?.setOnClickListener { dismissAllowingStateLoss() }
binding?.tvContent?.movementMethod = ScrollingMovementMethod.getInstance()
SingleRoomPKModel.getSingleRoomPkRule()
.compose(bindToLifecycle())
.doOnSuccess {
binding.tvContent.text = it.replace("\\n", "\n").replace("\\r", "\r")
binding?.tvContent?.text = it.replace("\\n", "\n").replace("\\r", "\r")
}
.doOnError { it?.message.toast() }
.subscribe()

View File

@@ -4,7 +4,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Point;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
@@ -12,9 +11,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -29,19 +25,14 @@ import com.tencent.qgame.animplayer.AnimView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.common.widget.CircleImageView;
import com.yizhuan.erban.ui.utils.ImageLoadKt;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftEffectInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiver;
import com.yizhuan.xchat_android_core.initial.InitialModel;
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.ResolutionUtils;
import java.lang.ref.WeakReference;
@@ -72,9 +63,9 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
private GiftEffectListener giftEffectListener;
private EffectHandler effectHandler;
private boolean isAnim;
private boolean isPlayAnim;
private boolean isHideCarEffect;
public GiftEffectView(Context context) {
super(context);
init();
@@ -94,6 +85,10 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
return isAnim;
}
public boolean isPlayAnim() {
return isPlayAnim;
}
public void setGiftEffectListener(GiftEffectListener giftEffectListener) {
this.giftEffectListener = giftEffectListener;
}
@@ -126,60 +121,9 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
giftInfo = giftEffectInfo.getGift();
}
if (giftInfo != null) {
int totalCoin = giftInfo.getGoldPrice() * giftEffectInfo.getGiftNum() * giftEffectInfo.getTargetUsers().size();
if (totalCoin >= 520 &&
giftEffectInfo.getGiftReceiveType() != GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY
&& !AvRoomDataManager.get().isSelfGamePlaying()) {//礼物栏
ImageLoadUtils.loadImage(benefactorAvatar.getContext(), giftEffectInfo.getAvatar(), benefactorAvatar);
ImageLoadUtils.loadImage(giftImg.getContext(), giftInfo.getGiftUrl(), giftImg);
benefactorNick.setText(giftEffectInfo.getNick());
giftNumber.setText("X" + giftEffectInfo.getGiftNum());
giftName.setText(giftInfo.getGiftName());
container.setVisibility(VISIBLE);
if (giftEffectInfo.getGiftReceiveType() == GiftEffectInfo.GIFT_RECEIVE_TYPE_SINGLE) {
GiftReceiver giftReceiver = giftEffectInfo.getTargetUsers().get(0);
ImageLoadUtils.loadAvatar(receiverAvatar.getContext(), giftReceiver.getAvatar(), receiverAvatar);
receiverNick.setText(giftReceiver.getNick());
} else if (giftEffectInfo.getGiftReceiveType() == GiftEffectInfo.GIFT_RECEIVE_TYPE_ALL) {
receiverAvatar.setImageResource(R.drawable.about_logo);
receiverNick.setText(ResUtil.getString(R.string.avroom_widget_gifteffectview_01));
} else if (giftEffectInfo.getGiftReceiveType() == GiftEffectInfo.GIFT_RECEIVE_TYPE_MULTI) {
receiverAvatar.setImageResource(R.drawable.about_logo);
StringBuilder sb = new StringBuilder();
for (GiftReceiver targetUser : giftEffectInfo.getTargetUsers()) {
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().getRoomQueueMemberInfoByAccount(targetUser.getUid() + "");
if (roomQueueInfo == null) continue;
sb.append(roomQueueInfo.mRoomMicInfo.getPosition() + 1).append(ResUtil.getString(R.string.avroom_widget_gifteffectview_02)).append(",");
}
if (sb.length() > 0) {
sb.replace(sb.lastIndexOf(","), sb.length(), "");
}
receiverNick.setText(sb.toString());
}
Animation operatingAnim = AnimationUtils.loadAnimation(getContext(), R.anim.light_bg_rotate_anim);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
giftLightBg.setAnimation(operatingAnim);
final Point center = new Point();
center.x = ResolutionUtils.getScreenWidth(getContext()) / 2;
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", -UIUtil.dip2px(getContext(), 400), center.x - container.getWidth() / 2).setDuration(500);
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator.start();
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 0.0F, 1.0F).setDuration(500);
objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator1.start();
if (totalCoin < 4999) {
imgBg.setImageResource(R.drawable.icon_gift_effect_bg_1);
} else if (totalCoin < 9999) {
imgBg.setImageResource(R.drawable.icon_gift_effect_bg_2);
} else {
imgBg.setImageResource(R.drawable.icon_gift_effect_bg_3);
}
}
effectHandler.sendEmptyMessageDelayed(0, 6000);
isPlayAnim = false;
container.setVisibility(INVISIBLE);
effectHandler.sendEmptyMessageDelayed(0, 4000);
if (giftInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(giftInfo.getViewUrl())) {
drawVAPEffect(giftInfo.getViewUrl());
} else if (giftInfo.isHasVggPic() && !StringUtil.isEmpty(giftInfo.getVggUrl())) {
@@ -209,7 +153,7 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
svgaImageView.setImageDrawable(drawable);
svgaImageView.startAnimation();
svgaBg.setVisibility(VISIBLE);
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(svgaBg, "alpha", 0.0F, 2.0F).setDuration(800);
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(svgaBg, "alpha", 0.0F, 2.0F).setDuration(1250);
objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator1.start();
}
@@ -230,11 +174,11 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
}
private void deleteAnim() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", container.getX(), ResolutionUtils.getScreenWidth(getContext())).setDuration(500);
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", container.getX(), ResolutionUtils.getScreenWidth(getContext())).setDuration(1250);
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator.start();
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 1.0F, 0.0F).setDuration(500);
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 1.0F, 0.0F).setDuration(1250);
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
@@ -246,6 +190,7 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
}
if (giftEffectListener != null) {
isAnim = false;
isPlayAnim = false;
giftEffectListener.onGiftEffectEnd();
}
}

View File

@@ -9,9 +9,7 @@ import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.Point;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
@@ -36,7 +34,6 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.common.svga.SimpleSvgaParseCompletion;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.fansteam.FansTeamMsgInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftEffectInfo;
@@ -53,9 +50,6 @@ import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
import com.yizhuan.xchat_android_core.magic.bean.MagicReceivedInfo;
import com.yizhuan.xchat_android_core.magic.bean.MultiMagicReceivedInfo;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterAttackInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.ResolutionUtils;
@@ -65,9 +59,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import javax.annotation.Nullable;
@@ -98,8 +90,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
private Keyframe[] keyScale;
private Keyframe[] keyTrans;
private SvgaObjectPool mMagicViewPool;
private volatile Hashtable<Integer, MonsterAttackInfo> currentAnimationMap = new Hashtable<>();
public GiftV2View(Context context) {
this(context, null);
@@ -301,7 +291,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
}
private void drawLuckyGift(GiftReceiveInfo giftReceiveInfos, int giftReceiveType, boolean isShowAnimation, String svgaUrl) {
private void drawLuckyGift(GiftReceiveInfo giftReceiveInfos, int giftReceiveType, boolean isShowAnimation, String svgaUrl, int pos) {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo != null) {
List<GiftReceiver> targetUsers = new ArrayList<>();
@@ -316,11 +306,11 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}, 1800);
}
handler.postDelayed(() -> drawLuckyGiftAnimation(roomInfo, giftReceiveInfos, totalCoin, targetUsers, giftReceiveType, isShowAnimation), 1200);
handler.postDelayed(() -> drawLuckyGiftAnimation(roomInfo, giftReceiveInfos, totalCoin, targetUsers, giftReceiveType, isShowAnimation, pos), 1200);
}
}
private void drawLuckyGiftAnimation(RoomInfo roomInfo, GiftReceiveInfo giftReceiveInfo, int totalCoin, List<GiftReceiver> targetUsers, int giftReceiveType, boolean isShowAnimation) {
private void drawLuckyGiftAnimation(RoomInfo roomInfo, GiftReceiveInfo giftReceiveInfo, int totalCoin, List<GiftReceiver> targetUsers, int giftReceiveType, boolean isShowAnimation, int pos) {
SparseArray<Point> micViewPoint = AvRoomDataManager.get().mMicPointMap;
GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId());
if (giftInfo == null || TextUtils.isEmpty(giftInfo.getGiftUrl())) {
@@ -363,7 +353,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
giftReceiver.setNick(giftReceiveInfo.getTargetNick());
targetUsers.add(giftReceiver);
if (!isShowAnimation) return;
giftInfo = giftReceiveInfo.getDisplayGift().get(0);
giftInfo = giftReceiveInfo.getDisplayGift().get(pos);
if (totalCoin >= 520 || (giftInfo != null && giftInfo.isHasEffect())) {
Message msg = Message.obtain();
msg.what = 0;
@@ -371,14 +361,13 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
giftEffectInfo.setUid(giftReceiveInfo.getUid());
giftEffectInfo.setNick(giftReceiveInfo.getNick());
giftEffectInfo.setAvatar(giftReceiveInfo.getAvatar());
giftEffectInfo.setGiftId(giftReceiveInfo.getDisplayGift().get(0).getGiftId());
giftEffectInfo.setGiftId(giftReceiveInfo.getDisplayGift().get(pos).getGiftId());
giftEffectInfo.setGiftNum(giftReceiveInfo.getGiftNum());
giftEffectInfo.setGift(giftInfo);
giftEffectInfo.setTargetUsers(targetUsers);
giftEffectInfo.setGiftReceiveType(giftReceiveType);
msg.obj = giftEffectInfo;
handler.sendMessageDelayed(msg, 200);
}
}
@@ -435,25 +424,24 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
public void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
if (giftMultiReceiverInfo != null) {
setVisibility(VISIBLE);
// List<GiftReceiveInfo> giftReceiveInfos = new ArrayList<>();
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid());
giftReceiveInfo.setTargetNick(giftMultiReceiverInfo.getUser().getNick());
giftReceiveInfo.setTargetUid(giftMultiReceiverInfo.getUser().getUid());
giftReceiveInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
giftReceiveInfo.setDisplayGift(giftMultiReceiverInfo.getDisplayGift());
giftReceiveInfo.setNick(giftMultiReceiverInfo.getNick());
giftReceiveInfo.setGiftId(giftMultiReceiverInfo.getGiftList().get(0).getGiftId());
giftReceiveInfo.setGift(giftMultiReceiverInfo.getDisplayGift().get(0));
//礼物值
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
// giftReceiveInfos.add(giftReceiveInfo);
drawLuckyGift(giftReceiveInfo, GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY, giftMultiReceiverInfo.isShowAnimation(), giftMultiReceiverInfo.getLuckyGiftSvgaUrl());
int size = Math.min(giftMultiReceiverInfo.getDisplayGift().size(), 6);
for (int i = 0; i < size; i++) {
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid());
giftReceiveInfo.setTargetNick(giftMultiReceiverInfo.getUser().getNick());
giftReceiveInfo.setTargetUid(giftMultiReceiverInfo.getUser().getUid());
giftReceiveInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
giftReceiveInfo.setDisplayGift(giftMultiReceiverInfo.getDisplayGift());
giftReceiveInfo.setNick(giftMultiReceiverInfo.getNick());
giftReceiveInfo.setGiftId(giftMultiReceiverInfo.getGiftList().get(0).getGiftId());
giftReceiveInfo.setGift(giftMultiReceiverInfo.getDisplayGift().get(i));
//礼物值
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
drawLuckyGift(giftReceiveInfo, GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY, giftMultiReceiverInfo.isShowAnimation(), giftMultiReceiverInfo.getLuckyGiftSvgaUrl(), i);
}
}
}
@@ -471,13 +459,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
return magicInfo.getPathAnim();
}
// private boolean isCenter(MonsterAttackReceiveInfo monsterAttackReceiveInfo) {
// int magicId = Integer.parseInt(monsterAttackReceiveInfo.getMagicId());
// MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicId);
// if (magicInfo == null) return monsterAttackReceiveInfo.getPosition() == MagicInfo.POS_CENTER;
// return magicInfo.getPosition() == MagicInfo.POS_CENTER;
// }
private String getValidExplodeAnimationUrl(int magicId, String url) {
if (!TextUtils.isEmpty(url)) return url;
MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicId);
@@ -497,13 +478,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
drawMagicAnimation(magicReceivedInfos);
}
public void onReceiveMonsterAttackMsg(MonsterAttackInfo monsterAttackReceiveInfo, View monsterView) {
drawMonsterMagicView(monsterAttackReceiveInfo, monsterView);
// List<MonsterAttackInfo> monsterAttackReceiveInfos = new ArrayList<>();
// monsterAttackReceiveInfos.add(monsterAttackReceiveInfo);
// drawMonsterAttackAnimation(monsterAttackReceiveInfos, monsterView);
}
public void onReceiveMultiMagicMsg(MultiMagicReceivedInfo multiMagicReceivedInfo) {
if (multiMagicReceivedInfo != null) {
setVisibility(VISIBLE);
@@ -576,70 +550,12 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
/**
* 打怪兽时使用的动画效果
* 获取当前是否有飘屏正在显示
*
* @param monsterAttackReceiveInfo
* @param monsterView
* @return
*/
private void drawMonsterMagicView(MonsterAttackInfo monsterAttackReceiveInfo, View monsterView) {
Point senderPoint = null;
if (Objects.equals(Long.valueOf(monsterAttackReceiveInfo.getUid()), AuthModel.get().getCurrentUid())) {
senderPoint = new Point(mScreenWidth - giftWidth, mScreenHeight - UIUtil.dip2px(context, 50));
} else {
senderPoint = new Point(new Random().nextInt(mScreenWidth), mScreenHeight);
}
SVGAImageView imageView = mMagicViewPool.borrowGiftObject(senderPoint);
imageView.setVisibility(GONE);
ImageLoadUtils.loadImage(context, monsterAttackReceiveInfo.getMagicIcon(), imageView);
int[] location = new int[2];
monsterView.getLocationInWindow(location);
int x = (location[0] + monsterView.getWidth() / 2) - giftWidth / 2;
int y = (location[1] + monsterView.getHeight() / 2) - giftHeight / 2;
Point receivePoint = new Point(x, y);
Path path = getBezierCurvePath(senderPoint, receivePoint, false);
ValueAnimator pathAnimator;
// 当前版本小于21需要
if (Build.VERSION_CODES.LOLLIPOP > Build.VERSION.SDK_INT) {
pathAnimator = ObjectAnimator.ofFloat(0.0f, 1.0f);
pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
float[] point = new float[2];
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float val = animation.getAnimatedFraction();
PathMeasure pathMeasure = new PathMeasure(path, false);
pathMeasure.getPosTan(pathMeasure.getLength() * val, point, null);
imageView.setTranslationX(point[0]);
imageView.setTranslationY(point[1]);
}
});
} else {
pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path);
}
pathAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
imageView.setVisibility(VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
mMagicViewPool.returnObject(imageView);
currentAnimationMap.remove(monsterAttackReceiveInfo.getSequence());
IMNetEaseManager.get().getChatRoomEventObservable().onNext(new RoomEvent()
.setEvent(RoomEvent.MONSTER_HUNTING_ANIMATION_FINISHED)
.setMonsterAttackReceiveInfo(monsterAttackReceiveInfo));
}
});
pathAnimator.setDuration(1000);
currentAnimationMap.put(monsterAttackReceiveInfo.getSequence(), monsterAttackReceiveInfo);
if (currentAnimationMap.size() >= 10) {
postDelayed(pathAnimator::start, 500);
} else {
pathAnimator.start();
}
public boolean getIsPlayAnim() {
return giftEffectView.isPlayAnim();
}
private void drawMagicView(Point senderPoint, Point receivePoint, MagicReceivedInfo magicReceivedInfo) {
@@ -675,24 +591,8 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
Path path = getBezierCurvePath(senderPoint, receivePoint, isCenter(magicReceivedInfo));
ValueAnimator pathAnimator;
// 当前版本小于21需要
if (Build.VERSION_CODES.LOLLIPOP > Build.VERSION.SDK_INT) {
pathAnimator = ObjectAnimator.ofFloat(0.0f, 1.0f);
pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
float[] point = new float[2];
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float val = animation.getAnimatedFraction();
PathMeasure pathMeasure = new PathMeasure(path, false);
pathMeasure.getPosTan(pathMeasure.getLength() * val, point, null);
imageView.setTranslationX(point[0]);
imageView.setTranslationY(point[1]);
}
});
} else {
pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path);
}
pathAnimator.setDuration(1000);
pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path);
pathAnimator.setDuration(1250);
pathAnimator.start();
}
@@ -754,7 +654,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
PropertyValuesHolder p2 = PropertyValuesHolder.ofKeyframe("scaleX", keyScale);
PropertyValuesHolder p3 = PropertyValuesHolder.ofKeyframe("scaleY", keyScale);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2, p3, p1, p0);
objectAnimator.setDuration(3200);
objectAnimator.setDuration(4000);
objectAnimator.start();
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
@@ -898,10 +798,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
if (mImageView == null) return;
mImageView.stopAnimation(true);
giftV2View.mMagicViewPool.returnObject(mImageView);
// ViewParent parent = this.mImageView.getParent();
// if (parent != null && parent instanceof ViewGroup) {
// ((ViewGroup) parent).removeView(mImageView);
// }
}
@Override
@@ -911,10 +807,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
if (mImageView == null) return;
mImageView.stopAnimation(true);
giftV2View.mMagicViewPool.returnObject(mImageView);
// ViewParent parent = this.mImageView.getParent();
// if (parent != null && parent instanceof ViewGroup) {
// ((ViewGroup) parent).removeViewInLayout(mImageView);
// }
}
@Override

View File

@@ -162,7 +162,7 @@ import com.yizhuan.xchat_android_core.room.pk.bean.RoomPKInvitedUpMicMember;
import com.yizhuan.xchat_android_core.room.pk.bean.RoomPkData;
import com.yizhuan.xchat_android_core.room.queuing_mic.attachment.QueuingMicAttachment;
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.QueuingMicInfo;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.ExtensionUtil;
@@ -296,9 +296,9 @@ public class MessageView extends FrameLayout {
sysIconHeight = Utils.dip2px(context, 14);
smallFace = Utils.dip2px(context, 22);
bigFace = Utils.dip2px(context, 30);
//經驗等級圖片後臺已經更換尺寸了,公屏同步下,尺寸是26:20
expLevelHeight = Utils.dip2px(context, 20);
expLevelWidth = expLevelHeight * 26 / 20;//expLevelHeight * 114 / 45
//經驗等級圖片後臺已經更換尺寸了,公屏同步下,尺寸是36:18
expLevelHeight = Utils.dip2px(context, 18);
expLevelWidth = expLevelHeight * 36 / 18;//expLevelHeight * 114 / 45
giftLength = Utils.dip2px(context, 35);
// 內容區域
layoutManger = new LinearLayoutManager(context, RecyclerView.VERTICAL, false);
@@ -1011,7 +1011,7 @@ public class MessageView extends FrameLayout {
private void setFairyMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
if (chatRoomMessage.getAttachment() instanceof FairyMsgAttachment) {
FairyMsgAttachment attachment = (FairyMsgAttachment) chatRoomMessage.getAttachment();
FairyMsgInfo fairyMsgInfo = attachment.getFairyMsgInfo();
FairyMsgInfoBean fairyMsgInfo = attachment.getFairyMsgInfo();
if (fairyMsgInfo == null) return;
SpannableBuilder builder = null;
switch (attachment.getSecond()) {
@@ -1055,7 +1055,7 @@ public class MessageView extends FrameLayout {
}
private SpannableBuilder builderConvertMsg(TextView textView, @NonNull FairyMsgInfo fairyMsgInfo, String type) {
private SpannableBuilder builderConvertMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String type) {
return new SpannableBuilder(textView)
.append("厲害了!", new ForegroundColorSpan(whiteColor))
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new OriginalDrawStatusClickSpan(roomTipNickColor, false) {
@@ -1069,7 +1069,7 @@ public class MessageView extends FrameLayout {
.append(fairyMsgInfo.getRewardShowValue() + "" + fairyMsgInfo.getRewardName(), new ForegroundColorSpan(roomTipColor));
}
private SpannableBuilder builderDrawMsg(TextView textView, @NonNull FairyMsgInfo fairyMsgInfo, String desc) {
private SpannableBuilder builderDrawMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String desc) {
SpannableBuilder builder = new SpannableBuilder(textView)
.append(desc, new ForegroundColorSpan(whiteColor))
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new OriginalDrawStatusClickSpan(roomTipNickColor, false) {
@@ -1310,15 +1310,26 @@ public class MessageView extends FrameLayout {
private void setTarotMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
TarotAttachment attachment = (TarotAttachment) chatRoomMessage.getAttachment();
if (attachment.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS) {
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
SpannableBuilder text = new SpannableBuilder(tvContent)
.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
SpannableBuilder text = new SpannableBuilder(tvContent);
switch (attachment.getSecond()) {
case CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS:
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
break;
case CustomAttachment.CUSTOM_MESS_TAROT_JUNIOR_PRIZE_WINNING:
case CustomAttachment.CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING:
case CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING:
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(ResUtil.getString(R.string.avroom_widget_messageview_0160), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
break;
}
}
@@ -2101,7 +2112,7 @@ public class MessageView extends FrameLayout {
builder.append(ivOfficialMask, SizeUtils.dp2px(tvContent.getContext(), 62), expLevelHeight);
}
//等級
builder.append(userLevel, expLevelWidth, expLevelHeight);
builder.append(userLevel, expLevelHeight);
//銘牌
String tvNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_WORD, chatRoomMessage).trim();
String ivNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_PIC, chatRoomMessage);

View File

@@ -65,7 +65,7 @@ public class MicroView extends LinearLayout implements View.OnLayoutChangeListen
private boolean isNeedResetMicCenterPoint = true;
private DatingItemDecoration datingItemDecoration;
private OnMicroItemClickListener onMicroItemClickListener;
private OnMicroItemClickListener onMicroItemClickListener = null;
public MicroView(Context context) {
this(context, null);
@@ -224,7 +224,7 @@ public class MicroView extends LinearLayout implements View.OnLayoutChangeListen
}
if (isNeedSetBackground) {
AnimFactory.getSpeakingAnimation(mContext, speakState.getWidth(), speakState.getHeight(),
NobleUtil.getColor(halo), speakState.getWidth() * 3 / 4)
NobleUtil.getColor(halo), speakState.getWidth() * 3 / 4)
.subscribe((animationDrawable, throwable) -> {
speakState.setBackground(animationDrawable);
animationDrawable.start();

View File

@@ -424,6 +424,8 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
pkScoreBoardDialog.show();
}
break;
default:
break;
}
}

View File

@@ -41,9 +41,12 @@ import com.yizhuan.xchat_android_constants.XChatConstants
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo
import com.yizhuan.xchat_android_core.im.custom.bean.*
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
import com.yizhuan.xchat_android_core.manager.RoomEvent
import com.yizhuan.xchat_android_core.monsterhunting.SimpleAnimationListener
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil
import com.yizhuan.xchat_android_core.user.UserModel
@@ -51,6 +54,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
import com.yizhuan.xchat_android_library.utils.ListUtils
import com.yizhuan.xchat_android_library.utils.ResUtil
import com.yizhuan.xchat_android_library.utils.StringUtils
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
@@ -72,7 +76,8 @@ class RoomEffectBoxView @JvmOverloads constructor(
private val mCarEffectList: MutableList<CarInfo?> by lazy { ArrayList() }
//頂部飄屏總展示時間
private val SHOW_TIME = 3500
private val SHOW_TIME = 4500
private val CLOSE_TIME = 5000
//頂部飄屏周期
private val PERIOD = 1000
@@ -85,9 +90,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
private var boxDisposable: Disposable? = null
private val messagesBox: MutableList<ChatRoomMessage> by lazy { ArrayList() }
private var boxSVGADisposable: Disposable? = null
private val messagesBoxSVGA: MutableList<ChatRoomMessage> by lazy { ArrayList() }
private var animationLuckyGift: Animation? = null
private var disposableLuckyGift: Disposable? = null
private val messagesLuckyGift: MutableList<ChatRoomMessage> by lazy { ArrayList() }
@@ -150,21 +152,21 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
when (roomEvent.event) {
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotifyBySVGA(roomEvent.chatRoomMessage)
RoomEvent.RADISH_NOTIFY,
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
RoomEvent.ROOM_GIFT_COMPOUND -> addGiftCompoundNotify(roomEvent.chatRoomMessage)
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> //全服福袋
//廳內福袋
addLuckyBagNotify(roomEvent.chatRoomMessage)
RoomEvent.DATING_PUBLISH_RESULT -> showHandAnim((roomEvent.chatRoomMessage.attachment as DatingAttachment).datingNotifyInfo)
RoomEvent.RECEIVE_MEMBER_IN_NOTICE -> //進入房間
addMemberInNotify(roomEvent.chatRoomMessage)
RoomEvent.RECEIVE_EXPER_LEVEL_UP_NOTICE -> addLevelUpNotify(roomEvent.chatRoomMessage)
RoomEvent.ENTER_ROOM -> if (!SuperAdminUtil.isSuperAdmin()) {
playCarSvga(AuthModel.get().currentUid.toString(), null, true)
}
RoomEvent.CAR_MEMBER_IN -> if (roomEvent.mRoomCarMsgAttachment != null) {
playCarSvga(
null,
@@ -176,17 +178,20 @@ class RoomEffectBoxView @JvmOverloads constructor(
false
)
}
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showSingleRoomRankNotify(roomEvent.chatRoomMessage)
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
RoomEvent.ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
RoomEvent.ROOM_CAR_EFFECT_HIDE -> {
isHideCarEffect = true
loopCarAnim()
}
RoomEvent.ROOM_CAR_EFFECT_SHOW -> {
isHideCarEffect = false
}
RoomEvent.DRAW_GIFT_EFFECT -> {
val drawGiftAttachment =
(roomEvent.chatRoomMessage?.attachment as? DrawGiftAttachment)
@@ -197,6 +202,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
false
)
}
else -> {}
}
}
@@ -225,11 +231,13 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableDatingAll == null || messagesDatingAll.size == 1) {
disposableDatingAll = Observable.interval(0, 3, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesDatingAll.size > 0 }
.takeWhile { messagesDatingAll.size > 0 && !mContext.isDestroyed() }
.subscribe {
showDatingAllNotify(
messagesDatingAll.removeAt(0)
)
if (binding.flDatingAllNotify.childCount == 0) {
showDatingAllNotify(
messagesDatingAll.removeAt(0)
)
}
}
}
}
@@ -292,115 +300,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
) + ""
}
/**
* 開福袋飄屏
*
* @param chatRoomMessage
*/
private fun addLuckyBagNotify(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {
binding.clNotify.visibility = VISIBLE
}
messagesLuckyGift.add(chatRoomMessage)
if (disposableLuckyGift == null || messagesLuckyGift.size == 1) {
disposableLuckyGift = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesLuckyGift.size > 0 }
.subscribe {
showLuckyBagNotify(
messagesLuckyGift.removeAt(0)
)
}
}
}
private fun showLuckyBagNotify(message: ChatRoomMessage?) {
val attachment = message?.attachment as? RoomReceivedLuckyGiftAttachment ?: return
val noticeInfo = attachment.luckyBagNoticeInfo ?: return
val text = SpannableBuilder()
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_04),
ForegroundColorSpan(Color.WHITE)
)
.append(
noticeInfo.nick.subAndReplaceDot(6) + " ",
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
ForegroundColorSpan(Color.WHITE)
)
.append(
noticeInfo.luckyBagName + " ",
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_06),
ForegroundColorSpan(Color.WHITE)
)
.append(
noticeInfo.goldPrice + " ",
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_07),
ForegroundColorSpan(Color.WHITE)
)
.append(
noticeInfo.giftName,
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
val svgaImageView = SVGAImageView(mContext)
svgaImageView.loops = 1
svgaImageView.clearsAfterStop = true
shareParser().decodeFromAssets(
"svga/lucky_gift_notify.svga",
object : SVGAParser.ParseCompletion {
override fun onComplete(videoItem: SVGAVideoEntity) {
binding.flLuckyGiftNotify.addView(svgaImageView)
val dynamicEntity = SVGADynamicEntity()
val textPaint = TextPaint()
textPaint.color = Color.WHITE //字體顏色
textPaint.textSize = 24f //字體大小
dynamicEntity.setDynamicText(
StaticLayout(
text.build(),
0,
text.build().length,
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "fdpp_copywriting"
)
if (AvRoomDataManager.get().roomUid == noticeInfo.roomUid) {
dynamicEntity.setHidden(true, "img_206")
} else {
svgaImageView.setOnClickListener {
//跳轉房間要移除監聽,不然可能NPE
svgaImageView.callback = null
AVRoomActivity.start(mContext, noticeInfo.roomUid)
}
}
val drawable = SVGADrawable(videoItem, dynamicEntity)
svgaImageView.setImageDrawable(drawable)
svgaImageView.stepToFrame(0, true)
}
override fun onError() {}
})
svgaImageView.callback = object : SimpleSvgaCallback() {
override fun onFinished() {
binding.flLuckyGiftNotify.post {
binding.flLuckyGiftNotify.removeView(svgaImageView)
}
}
}
}
/**
* 幸運池飄屏
*
@@ -414,11 +313,20 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (boxDisposable == null || messagesBox.size == 1) {
boxDisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesBox.size > 0 }
.takeWhile { messagesBox.size > 0 && !mContext.isDestroyed() }
.subscribe {
showBoxNotify(
messagesBox.removeAt(0)
)
if (binding.flBoxNotify.childCount == 0) {
val msg = messagesBox.removeAt(0)
val attachment = msg.attachment
if (attachment is CustomAttachment) {
if (attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY) {
showBoxNotify(msg)
} else if(attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
showBoxNotifyBySVGA(msg)
}
}
}
}
}
}
@@ -433,7 +341,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
ForegroundColorSpan(Color.WHITE)
)
.append(
attachment.nick + " ",
attachment.nick.subAndReplaceDot(8),
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
@@ -443,7 +351,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
)
.append(
attachment.prizeName,
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
if (attachment.prizeNum > 1) {
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
@@ -453,31 +361,15 @@ class RoomEffectBoxView @JvmOverloads constructor(
binding.flBoxNotify.addView(textView)
textView.startAnimation(animationBox)
binding.flBoxNotify.postDelayed(
{ binding.flBoxNotify.removeView(textView) },
{
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
textView.startAnimation(animationBox)
},
SHOW_TIME.toLong()
)
}
/**
* 幸運池飄屏 五級 SVGA背景的
*
* @param chatRoomMessage
*/
private fun addBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {
binding.clNotify.visibility = VISIBLE
}
messagesBoxSVGA.add(chatRoomMessage)
if (boxSVGADisposable == null || messagesBoxSVGA.size == 1) {
boxSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesBoxSVGA.size > 0 }
.subscribe {
showBoxNotifyBySVGA(
messagesBoxSVGA.removeAt(0)
)
}
}
binding.flBoxNotify.postDelayed({
binding.flBoxNotify.removeView(textView)
}, CLOSE_TIME.toLong())
}
private fun showBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
@@ -488,7 +380,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
ForegroundColorSpan(Color.WHITE)
)
.append(
attachment.nick + " ",
StringUtils.abbreviate(attachment.nick, 8) + " ",
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
@@ -498,22 +390,31 @@ class RoomEffectBoxView @JvmOverloads constructor(
)
.append(
attachment.prizeName,
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
if (attachment.prizeNum > 1) {
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
}
val svgaImageView = SVGAImageView(mContext)
svgaImageView.loops = 1
svgaImageView.clearsAfterStop = true
svgaImageView.clearsAfterDetached = true
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
svgaImageView.layoutParams = params
svgaImageView.callback = object : SimpleSvgaCallback() {
override fun onFinished() {
binding.flSvgaBoxNotify.post { binding.flSvgaBoxNotify.removeView(svgaImageView) }
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
animationBox!!.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationEnd(animation: Animation?) {
binding.flBoxNotify.removeView(svgaImageView)
}
})
binding.flBoxNotify.startAnimation(animationBox)
}
}
binding.flSvgaBoxNotify.addView(svgaImageView)
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
binding.flBoxNotify.addView(svgaImageView)
binding.flBoxNotify.startAnimation(animationBox)
shareParser().decodeFromAssets("svga/box_notify.svga", object : SVGAParser.ParseCompletion {
override fun onComplete(videoItem: SVGAVideoEntity) {
val dynamicEntity = SVGADynamicEntity()
@@ -531,7 +432,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
1.0f,
0.0f,
false
), "noble_text_tx"
), "bg"
)
val drawable = SVGADrawable(videoItem, dynamicEntity)
svgaImageView.setImageDrawable(drawable)
@@ -555,9 +456,11 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (radishDisposable == null || messagesRadish.size == 1) {
radishDisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesRadish.size > 0 }
.takeWhile { messagesRadish.size > 0 && !mContext.isDestroyed() }
.subscribe {
showRadishNotify(messagesRadish.removeAt(0))
if (binding.flRadishNotify.childCount == 0) {
showRadishNotify(messagesRadish.removeAt(0))
}
}
}
}
@@ -633,9 +536,11 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (radishSVGADisposable == null || messagesRadishSVGA.size == 1) {
radishSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesRadishSVGA.size > 0 }
.takeWhile { messagesRadishSVGA.size > 0 && !mContext.isDestroyed() }
.subscribe {
showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0))
if (binding.flSvgaRadishNotify.childCount == 0) {
showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0))
}
}
}
}
@@ -719,11 +624,11 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableGiftCompound == null || messagesGiftCompound.size == 1) {
disposableGiftCompound = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesGiftCompound.size > 0 }
.takeWhile { messagesGiftCompound.size > 0 && !mContext.isDestroyed() }
.subscribe {
showGiftCompoundNotify(
messagesGiftCompound.removeAt(0)
)
if (binding.flGiftCompoundNotify.childCount == 0) {
showGiftCompoundNotify(messagesGiftCompound.removeAt(0))
}
}
}
}
@@ -795,11 +700,9 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableMemberIn == null || messagesMemberIn.size == 1) {
disposableMemberIn = Observable.interval(0, 6, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesMemberIn.size > 0 }
.takeWhile { messagesMemberIn.size > 0 && !mContext.isDestroyed() }
.subscribe {
showMemberInNotify(
messagesMemberIn.removeAt(0)
)
showMemberInNotify(messagesMemberIn.removeAt(0))
}
}
}
@@ -929,11 +832,9 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableLevelUp == null || messagesLevelUp.size == 1) {
disposableLevelUp = Observable.interval(0, 6, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesLevelUp.size > 0 }
.takeWhile { messagesLevelUp.size > 0 && !mContext.isDestroyed() }
.subscribe {
showLevelUpNotify(
messagesLevelUp.removeAt(0)
)
showLevelUpNotify(messagesLevelUp.removeAt(0))
}
}
}
@@ -1230,11 +1131,11 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableRoomPK == null || messagesRoomPK.size == 1) {
disposableRoomPK = Observable.interval(0, 4, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesRoomPK.size > 0 }
.takeWhile { messagesRoomPK.size > 0 && !mContext.isDestroyed() }
.subscribe {
showRoomPKNotify(
messagesRoomPK.removeAt(0)
)
if (binding.flRoomPkNotify.childCount == 0) {
showRoomPKNotify(messagesRoomPK.removeAt(0))
}
}
}
}
@@ -1276,11 +1177,11 @@ class RoomEffectBoxView @JvmOverloads constructor(
if (disposableSingleRoomPK == null || messagesSingleRoomPK.size == 1) {
disposableSingleRoomPK = Observable.interval(0, 4, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesSingleRoomPK.size > 0 }
.takeWhile { messagesSingleRoomPK.size > 0 && !mContext.isDestroyed() }
.subscribe {
showSingleRoomPKNotify(
messagesSingleRoomPK.removeAt(0)
)
if (binding.flSingleRoomPkNotify.childCount == 0) {
showSingleRoomPKNotify(messagesSingleRoomPK.removeAt(0))
}
}
}
}
@@ -1310,27 +1211,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
)
}
private fun showSingleRoomRankNotify(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {
binding.clNotify.visibility = VISIBLE
}
val roomPkBean = (chatRoomMessage.attachment as SingleRoomRankAttachment).msgBean
val rootView =
LayoutInflater.from(mContext).inflate(R.layout.layout_single_room_rank_notify, null)
(rootView.findViewById<View>(R.id.tv_nick) as TextView).text =
roomPkBean.nick.subAndReplaceDot(6)
(rootView.findViewById<View>(R.id.tv_desc) as TextView).text = roomPkBean.desc
rootView.findViewById<ImageView>(R.id.iv_avatar).load(roomPkBean.avatar)
rootView.setOnClickListener { AVRoomActivity.start(context, roomPkBean.uid) }
binding.flSingleRoomRankNotify.addView(rootView)
animationLuckyGift = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
rootView.startAnimation(animationLuckyGift)
binding.flSingleRoomRankNotify.postDelayed({
binding.flSingleRoomRankNotify.removeView(
rootView
)
}, SHOW_TIME.toLong())
}
private fun showRoomRankNotify(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {

View File

@@ -4,7 +4,18 @@ import static com.yizhuan.xchat_android_core.Constants.DEBUG_MAX_UID;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_NOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_USER_ALL_UPGRADE;
@@ -12,6 +23,7 @@ import static com.yizhuan.xchat_android_library.utils.UIUtils.getActivityByConte
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -23,6 +35,7 @@ import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -65,6 +78,8 @@ import com.yizhuan.erban.common.permission.PermissionActivity;
import com.yizhuan.erban.common.widget.StatusLayout;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.common.widget.dialog.DialogUiHelper;
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity;
import com.yizhuan.erban.treasurefairy.HomeFairyActivity;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
import com.yizhuan.erban.ui.login.LoginCodeActivity;
@@ -73,6 +88,11 @@ import com.yizhuan.erban.ui.pay.ChargeActivity;
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.erban.ui.widget.DefaultToolBar;
import com.yizhuan.erban.ui.widget.dialog.AllPlayEffectDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftLevelOneDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftLevelThreeDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftLevelTwoDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceVipLevelUPDialog;
import com.yizhuan.erban.ui.widget.dialog.OpenNobleGlobalNoticeDialog;
import com.yizhuan.erban.utils.UserUtils;
@@ -81,12 +101,21 @@ import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Attachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Info;
import com.yizhuan.xchat_android_core.im.custom.bean.PlayEffectInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.mentoring_relationship.event.GrabApprenticesEvent;
import com.yizhuan.xchat_android_core.newbie.NewbieHelloInfo;
import com.yizhuan.xchat_android_core.newbie.event.NewbieHelloDialogEvent;
import com.yizhuan.xchat_android_core.noble.AllServiceGiftProtocol;
import com.yizhuan.xchat_android_core.noble.NobleInfo;
import com.yizhuan.xchat_android_core.noble.NobleProtocol;
import com.yizhuan.xchat_android_core.pay.PayModel;
@@ -94,12 +123,14 @@ import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_core.vip.VipMessageInfo;
import com.yizhuan.xchat_android_library.common.util.DeviceUtil;
import com.yizhuan.xchat_android_library.rxbus.RxBus;
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
import com.yizhuan.xchat_android_library.utils.JavaUtil;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
@@ -116,6 +147,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import io.reactivex.Observable;
@@ -147,6 +179,12 @@ public abstract class BaseActivity extends RxAppCompatActivity
private OpenNobleGlobalNoticeDialog mNoticeDialog;
private boolean isShowingChargeDialog;
private Dialog giftDialog;
private LinkedList<AllServiceGiftProtocol.DataBean> giftList;
private Dialog playEffectDialog;
private LinkedList<PlayEffectInfo> playEffectList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -160,7 +198,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
if (roomEvent == null) return;
onReceiveChatRoomEvent(roomEvent);
}));
registerNimBroadcastMessage(true);
}
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
@@ -330,24 +367,45 @@ public abstract class BaseActivity extends RxAppCompatActivity
@Override
protected void onStart() {
super.onStart();
registerNimBroadcastMessage(true);
}
@Override
protected void onStop() {
super.onStop();
registerNimBroadcastMessage(false);
}
@Override
protected void onDestroy() {
registerNimBroadcastMessage(false);
if (mCompositeDisposable != null) {
mCompositeDisposable.dispose();
mCompositeDisposable = null;
}
if (mNoticeDialog != null && mNoticeDialog.isShowing()) {
mNoticeDialog.dismiss();
mNoticeDialog = null;
try {
if (mNoticeDialog != null && mNoticeDialog.isShowing()) {
mNoticeDialog.dismiss();
mNoticeDialog = null;
}
if (giftDialog != null && giftDialog.isShowing()) {
giftDialog.setOnDismissListener(null);
giftDialog.dismiss();
giftDialog = null;
}
if (playEffectDialog != null && playEffectDialog.isShowing()) {
playEffectDialog.setOnDismissListener(null);
playEffectDialog.dismiss();
playEffectDialog = null;
}
if (giftList != null) {
giftList.clear();
}
if(playEffectList != null){
playEffectList.clear();
}
} catch (Exception e){
Logger.i("关闭弹窗失败" + e.getMessage());
}
super.onDestroy();
@@ -506,6 +564,12 @@ public abstract class BaseActivity extends RxAppCompatActivity
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onRoomEventReceived);
if (giftList != null) {
giftList.clear();
}
if(playEffectList != null){
playEffectList.clear();
}
}
@Override
@@ -908,11 +972,271 @@ public abstract class BaseActivity extends RxAppCompatActivity
}
}
break;
case CUSTOM_MSG_HEADER_TYPE_GIFT:
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (giftList == null) {
giftList = new LinkedList<>();
}
int second2 = baseProtocol.getSecond();
AllServiceGiftProtocol.DataBean data = JSON.parseObject(String.valueOf(baseProtocol.getData()), AllServiceGiftProtocol.DataBean.class);
if (data == null || data.getGiftUrl() == null) return;
giftList.add(data);
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
if (giftDialog != null && giftDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
if (dataBean != null) {
return;
} else {
giftDialog.dismiss();
}
} else {
showGiftDialog();
}
}
break;
case CUSTOM_MSG_BOX://寻爱之旅
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
RoomBoxPrizeInfo roomBoxPrizeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
if (roomBoxPrizeInfo == null) return;
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
playEffectInfo.setRoomBoxPrizeInfo(roomBoxPrizeInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING);
playEffectInfo.setTarotMsgBean(tarotMsgBean);
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5:
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE) {
NotifyH5Info bean = JSON.parseObject(String.valueOf(baseProtocol.getData()), NotifyH5Info.class);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE);
playEffectInfo.setNotifyH5(bean);
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_LUCKY_SEA://星级厨房
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
RoomLuckySeaMsgBean roomLuckySeaMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class);
if (roomLuckySeaMsgBean == null) return;
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
playEffectInfo.setRoomLuckySeaMsgBean(roomLuckySeaMsgBean);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_LUCKY_GIFT://福袋
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
LuckyBagNoticeInfo luckyBagNoticeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class);
if (luckyBagNoticeInfo == null) return;
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL);
playEffectInfo.setLuckyBagNoticeInfo(luckyBagNoticeInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_FAIRY://夺宝精灵
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|| UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
FairyMsgInfoBean fairyMsgInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), FairyMsgInfoBean.class);
if (fairyMsgInfo == null) return;
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5) {
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_SUB_DRAW_GIFT_L5);
playEffectInfo.setFairyMsgInfo(fairyMsgInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
default:
break;
}
}
private void showPlayEffectDialog() {
if (playEffectList.size() == 0) return;
playEffectDialog = new AllPlayEffectDialog(this, playEffectList.peekFirst());
playEffectDialog.setOnDismissListener(dialog -> {
playEffectList.pollFirst();
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
if (isValid()) {
showPlayEffectDialog();
} else {
playEffectList.clear();
}
}
});
try {
playEffectDialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
private void showGiftDialog() {
if (giftList.size() == 0) return;
if (giftList.peekFirst() != null && !giftList.peekFirst().isHomeShow()) return;
giftDialog = generateAllServiceGiftDialog(this, giftList.peekFirst());
giftDialog.setOnDismissListener(dialog -> {
giftList.pollFirst();
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
if (dataBean != null) {
if (isValid()) {
showGiftDialog();
} else {
giftList.clear();
}
}
});
try {
giftDialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
private AllServiceGiftDialog generateAllServiceGiftDialog(Context context, AllServiceGiftProtocol.DataBean dataBean) {
switch (JavaUtil.str2int(dataBean.getLevelNum())) {
default:
case AllServiceGiftDialog.ALL_SERVICE_GIFT_LEVEL_1:
return new AllServiceGiftLevelOneDialog(context, dataBean);
case AllServiceGiftDialog.ALL_SERVICE_GIFT_LEVEL_2:
return new AllServiceGiftLevelTwoDialog(context, dataBean);
case AllServiceGiftDialog.ALL_SERVICE_GIFT_LEVEL_3:
return new AllServiceGiftLevelThreeDialog(context, dataBean);
}
}
public void onGrabApprenticesEvent(GrabApprenticesEvent event) {
if (!isTopActivity()) return;
if (dialog != null && dialog.isAdded()) {

View File

@@ -16,7 +16,7 @@ abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
private var _binding: T? = null
private var onDismissListener: (() -> Unit)? = null
val binding get() = _binding!!
val binding get() = _binding
open var width = ScreenUtil.getDialogWidth()
open var height = WindowManager.LayoutParams.WRAP_CONTENT
open var gravity = Gravity.CENTER
@@ -42,7 +42,7 @@ abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
val aClass = type.actualTypeArguments[0] as Class<*>
val method = aClass.getDeclaredMethod("inflate", LayoutInflater::class.java)
_binding = method.invoke(null, layoutInflater) as T
return binding.root
return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View File

@@ -20,6 +20,7 @@ import com.netease.nim.uikit.support.glide.GlideApp;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.erban.view.GenderAgeTextView;
import com.yizhuan.xchat_android_core.utils.StarUtils;
import com.yizhuan.xchat_android_library.utils.TimeUtils;
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
@@ -83,17 +84,6 @@ public class ViewAdapter {
ImageLoadUtils.loadImage(imageView.getContext(), url, imageView);
}
@BindingAdapter(value = {"date"}, requireAll = false)
public static void setConstellation(TextView textView, long date) {
String star = StarUtils.getConstellation(new Date(date));
if (null == star) {
textView.setVisibility(View.GONE);
} else {
textView.setText(star);
textView.setVisibility(View.VISIBLE);
}
}
@BindingAdapter(value = {"isOn"}, requireAll = false)
public static void setIsOn(IOSSwitchView iosSwitchView, boolean isOn) {
iosSwitchView.setOn(isOn);
@@ -177,4 +167,14 @@ public class ViewAdapter {
params.height = (int) height;
v.setLayoutParams(params);
}
@BindingAdapter(value = {"birthday"}, requireAll = false)
public static void setBirthday(GenderAgeTextView v, long birthday) {
v.setBirthDay(birthday);
}
@BindingAdapter(value = {"gender"}, requireAll = false)
public static void setGender(GenderAgeTextView v, int gender) {
v.setGender(gender);
}
}

View File

@@ -22,6 +22,14 @@ public class EmptyViewHelper {
return view;
}
public static View createEmptyTextViewHeight(Context context, String text) {
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
View view = LayoutInflater.from(context).inflate(R.layout.layout_wrap_empty, null);
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
return view;
}
public static View createEmptyTextViewNoImage(Context context, String text) {
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
View view = LayoutInflater.from(context).inflate(R.layout.layout_text_empty, null);

View File

@@ -3,6 +3,7 @@ package com.yizhuan.erban.common.dialog
import android.Manifest
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.text.TextUtils
@@ -73,16 +74,14 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
private fun checkStoragePermission1() {
if (!EasyPermissions.hasPermissions(
XChatApplication.gContext, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
XChatApplication.gContext, if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
) {
EasyPermissions.requestPermissions(
this,
getString(R.string.permission_storage_rationale),
PERMISSION_CODE_STORAGE_1,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProviderNew.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
@@ -90,7 +89,11 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
}
private fun checkCameraPermission() {
if (!EasyPermissions.hasPermissions(XChatApplication.gContext, Manifest.permission.CAMERA)) {
if (!EasyPermissions.hasPermissions(
XChatApplication.gContext,
Manifest.permission.CAMERA
)
) {
EasyPermissions.requestPermissions(
this,
getString(R.string.permission_camera_rationale),
@@ -104,16 +107,15 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
private fun checkStoragePermission2() {
if (!EasyPermissions.hasPermissions(
XChatApplication.gContext, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
XChatApplication.gContext, if (Build.VERSION.SDK_INT >= 33)
Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
) {
EasyPermissions.requestPermissions(
this,
getString(R.string.permission_storage_rationale),
PERMISSION_CODE_STORAGE_2,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProviderNew.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)

View File

@@ -40,10 +40,6 @@ class DecorationViewModel : BaseViewModel() {
block = {
_decorationInfoListLiveData.value =
ListResult.success(DecorationModel.getDecorationInfoList(dressType), 1)
},
onError = {
it.message.toast()
_decorationInfoListLiveData.value = ListResult.failed(1)
}
)
}
@@ -54,7 +50,7 @@ class DecorationViewModel : BaseViewModel() {
block = {
DecorationModel.buyDecoration(dressType, dressId)
ResUtil.getString(R.string.decoration_viewmodel_decorationviewmodel_01).toast()
},
}
)
}

View File

@@ -14,6 +14,7 @@ import com.yizhuan.erban.ui.pay.ChargeActivity
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
import com.yizhuan.xchat_android_core.Constants
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.earn.bean.RoomTypeInfo
import com.yizhuan.xchat_android_library.common.util.DeviceUtil
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil
@@ -26,6 +27,7 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
View.OnClickListener {
private val earnRecordModel: EarnRecordViewModel by viewModels()
private var roomTypeInfo: RoomTypeInfo ?= null
companion object {
@JvmStatic
@@ -58,23 +60,13 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
earnRecordModel.queryRoomTypeLiveData.observe(this) {
it?.let {
if (it.roomType == 4) {
binding.csGoldBg.visibility = View.GONE
}
roomTypeInfo = it
binding.tvDiamondNum.text = String.format(it.diamonds.toString())
binding.tvGoldNum.text = String.format(it.golds.toString())
if (it.isClanElder) {
binding.tvGoldDetail.visibility = View.VISIBLE
binding.tvConvertDiamond.visibility = View.GONE
binding.csGoldBg.background =
ContextCompat.getDrawable(this, R.drawable.bg_gold_detail)
} else {
binding.tvGoldDetail.visibility = View.GONE
if (it.hasGoldExchangeAuth) {
binding.tvConvertDiamond.visibility = View.VISIBLE
} else {
binding.tvConvertDiamond.visibility = View.GONE
}
binding.csGoldBg.background =
ContextCompat.getDrawable(this, R.drawable.bg_earn_gold)
}
@@ -113,7 +105,7 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
CommonWebViewActivity.start(context, UriProvider.getDiamondDetail())
}
R.id.tvGoldDetail -> {//金币明细
GoldDetailActivity.start(this)
CommonWebViewActivity.start(context, UriProvider.getGoldDetail())
}
R.id.tvConvertDiamond -> {//兑换钻石
earnRecordModel.getGoldToDiamondInfo()

View File

@@ -4,12 +4,10 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.yizhuan.erban.base.BaseViewModel
import com.yizhuan.xchat_android_core.bean.response.ListResult
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
import com.yizhuan.xchat_android_core.home.bean.*
import com.yizhuan.xchat_android_core.home.model.HomeModel
import com.yizhuan.xchat_android_core.room.bean.AnchorInfo
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.utils.toast
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
@@ -22,6 +20,15 @@ class HomeViewModel : BaseViewModel() {
private val _bannerLiveData = MutableLiveData<List<BannerInfo>?>()
val bannerLiveData: MutableLiveData<List<BannerInfo>?> = _bannerLiveData
private val _currentResourceLiveData = MutableLiveData<List<CurrentResourceInfo>?>()
val currentResourceLiveData: MutableLiveData<List<CurrentResourceInfo>?> = _currentResourceLiveData
private val _resourceJumpLiveData = MutableLiveData<HomeRoomInfo?>()
val resourceJumpLiveData: LiveData<HomeRoomInfo?> = _resourceJumpLiveData
private val _homeChatPickLiveData = MutableLiveData<String?>()
val homeChatPickLiveData: LiveData<String?> = _homeChatPickLiveData
private val _gameRoomLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
val gameRoomLiveData: LiveData<ListResult<HomeRoomInfo>> = _gameRoomLiveData
@@ -49,8 +56,11 @@ class HomeViewModel : BaseViewModel() {
private val _homePlayInfoLiveData = MutableLiveData<List<HomeRoomInfo>?>()
val homePlayInfoData: MutableLiveData<List<HomeRoomInfo>?> = _homePlayInfoLiveData
private val _homeHotRoomLiveData = MutableLiveData<List<HomeRoomInfo>?>()
val homeHotRoomLiveData: LiveData<List<HomeRoomInfo>?> = _homeHotRoomLiveData
private val _homeHotRoomLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
val homeHotRoomLiveData: LiveData<ListResult<HomeRoomInfo>> = _homeHotRoomLiveData
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
fun getHomeTabName() {
safeLaunch(
@@ -63,6 +73,44 @@ class HomeViewModel : BaseViewModel() {
)
}
/**
* 首页改版资源位
*/
fun getCurrentResourceInfo() {
safeLaunch(
onError = {
_currentResourceLiveData.value = null
},
block = {
_currentResourceLiveData.value = HomeModel.getCurrentResource()
}
)
}
fun getResourceJumpInfo(id: Int) {
safeLaunch(
onError = {
_resourceJumpLiveData.value = null
it.message.toast()
},
block = {
_resourceJumpLiveData.value = HomeModel.getResourceJumpInfo(id)
}
)
}
fun getHomeChatPick() {
safeLaunch(
onError = {
_homeChatPickLiveData.value = null
it.message.toast()
},
block = {
_homeChatPickLiveData.value = HomeModel.getHomeChatPick()
}
)
}
fun getBannerInfo() {
safeLaunch(
onError = {
@@ -177,10 +225,23 @@ class HomeViewModel : BaseViewModel() {
fun getHotRoom() {
safeLaunch(
onError = {
_homeHotRoomLiveData.value = null
_homeHotRoomLiveData.value = ListResult.failed(1)
},
block = {
_homeHotRoomLiveData.value = HomeModel.getHotRoom()
val result = HomeModel.getHotRoom()
_homeHotRoomLiveData.value = ListResult.success(result, 1)
}
)
}
fun getNewFriendList(gender: Int? = null) {
safeLaunch(
onError = {
_newFriendLiveData.value = ListResult.failed(1)
},
block = {
val result = HomeModel.getNewFriendList(gender)
_newFriendLiveData.value = ListResult.success(result, 1)
}
)
}

View File

@@ -0,0 +1,22 @@
package com.yizhuan.erban.home.adapter
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
import com.zhpan.bannerview.BaseBannerAdapter
import com.zhpan.bannerview.BaseViewHolder
class HomeBannerAdapter : BaseBannerAdapter<BannerInfo?>() {
override fun getLayoutId(viewType: Int): Int {
return R.layout.activity_home_banner
}
override fun bindData(
helper: BaseViewHolder<BannerInfo?>,
item: BannerInfo?,
position: Int,
pageSize: Int
) {
ImageLoadUtilsV2.loadImage(helper.findViewById(R.id.iv_cover), item?.bannerPic)
}
}

View File

@@ -1,12 +1,15 @@
package com.yizhuan.erban.home.adapter
import android.view.View
import androidx.core.content.ContextCompat
import androidx.constraintlayout.widget.Group
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.opensource.svgaplayer.SVGAImageView
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.erban.ui.utils.loadFromAssets
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
/**
* create by lvzebiao @2019/11/13
@@ -15,17 +18,21 @@ class HomeChatAdapter :
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_home_chat) {
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
when(item.gender){
0 ->{
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
}
1 ->{
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
}
2 ->{
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_women)
}
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_avatar), item.avatar)
helper.setText(R.id.tv_name, item.title.subAndReplaceDot(6))
if (item.mgId == 0L) {
helper.getView<Group>(R.id.group_game).visibility = View.INVISIBLE
} else {
helper.getView<Group>(R.id.group_game).visibility = View.VISIBLE
}
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.mCirImage), item.avatar)
svgaLiving.loadFromAssets("svga/home_living.svga")
}
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
super.onViewAttachedToWindow(holder)
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
svgaLiving?.loadFromAssets("svga/home_living.svga")
}
}

View File

@@ -1,12 +1,16 @@
package com.yizhuan.erban.home.adapter
import android.view.View
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.view.isGone
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.opensource.svgaplayer.SVGAImageView
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.erban.ui.utils.load
import com.yizhuan.erban.ui.utils.loadFromAssets
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.utils.TextUtils
@@ -14,18 +18,57 @@ import com.yizhuan.xchat_android_core.utils.TextUtils
* create by lvzebiao @2019/11/13
*/
class HomeHotAdapter :
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_room_common) {
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_room_recommend) {
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
helper.apply {
getView<ImageView>(R.id.iv_room_image).load(item.avatar)
setText(R.id.tv_online_number, "${item.onlineNum}")
setText(R.id.tv_room_title, item.title)
setText(R.id.tv_id, "ID:${item.erbanNo}")
}
helper.setVisible(R.id.tv_in_pk, item.isCrossPking)
helper.setGone(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
val icTopList = helper.getView<AppCompatImageView>(R.id.iv_top_list)
if(item.isHourTop1 == 1){
icTopList.visibility = View.VISIBLE
icTopList.setImageResource(R.drawable.bg_recommend_hour_list)
} else if(item.isWeekTop1 == 1){
icTopList.visibility = View.VISIBLE
icTopList.setImageResource(R.drawable.bg_recommend_weekly_list)
} else {
icTopList.visibility = View.INVISIBLE
}
val avatars: Array<ImageView> = arrayOf(
helper.getView(R.id.iv_avatar_0),
helper.getView(R.id.iv_avatar_1),
helper.getView(R.id.iv_avatar_2),
helper.getView(R.id.iv_avatar_3),
helper.getView(R.id.iv_avatar_4)
)
for (i in avatars.indices) {
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
avatars[i].isGone = avatarUrl.isNullOrBlank()
avatars[i].load(avatarUrl)
}
val svgaPk = helper.getView<SVGAImageView>(R.id.svga_pk)
if (item.isCrossPking) {
svgaPk.visibility = View.VISIBLE
svgaPk.loadFromAssets("svga/svga_home_pk.svga")
} else {
svgaPk.visibility = View.GONE
}
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
svgaLiving.loadFromAssets("svga/home_white_living.svga")
}
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
super.onViewAttachedToWindow(holder)
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
svgaLiving?.loadFromAssets("svga/home_white_living.svga")
}
}

View File

@@ -0,0 +1,234 @@
package com.yizhuan.erban.home.adapter
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.google.android.flexbox.AlignItems
import com.google.android.flexbox.FlexDirection
import com.opensource.svgaplayer.SVGAImageView
import com.yizhuan.erban.R
import com.yizhuan.erban.audio.helper.AudioPlayerHelper
import com.yizhuan.erban.audio.helper.OnPlayListener
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
import com.yizhuan.erban.ui.user.activity.UserInfoActivity
import com.yizhuan.erban.ui.user.adapter.UserInfoLabelAdapter
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.ui.utils.loadAvatar
import com.yizhuan.erban.ui.utils.loadFromAssets
import com.yizhuan.erban.view.GenderAgeTextView
import com.yizhuan.xchat_android_core.Constants
import com.yizhuan.xchat_android_core.manager.AudioEngineManager
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.utils.StarUtils
import com.yizhuan.xchat_android_core.utils.ifNullOrEmpty
import com.yizhuan.xchat_android_library.common.widget.LinesFlexBoxLayoutManager
import com.yizhuan.xchat_android_library.utils.ListUtils
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.Date
import java.util.concurrent.TimeUnit
class RoomNewFriendsAdapter :
BaseQuickAdapter<UserInfo, BaseViewHolder>(R.layout.item_room_new_friends) {
private var disposable: Disposable? = null
private var isMute = false
private var isRemoteMute = false
override fun convert(helper: BaseViewHolder, item: UserInfo) {
helper.getView<ImageView>(R.id.iv_avatar).loadAvatar(item.avatar)
helper.setText(R.id.tv_desc, item.userDesc.ifNullOrEmpty { "我是个默认签名" })
val tvGenderAge = helper.getView<GenderAgeTextView>(R.id.tv_gender_age)
tvGenderAge.setBirthDay(item.birth)
tvGenderAge.setGender(item.gender)
//设置星座
val star = StarUtils.getConstellationString(Date(item.birth))
helper.setText(R.id.tv_constellation, star)
val tvTalk = helper.getView<TextView>(R.id.tv_talk)
helper.setVisible(
R.id.view_online, if (item.inMic) {
false
} else item.inOnline
)
helper.setVisible(R.id.group_party, item.inMic)
if (item.inRoomUid != 0L) {
tvTalk.text = "去找TA"
tvTalk.setOnClickListener {
AVRoomActivity.startForFromType(
mContext,
item.inRoomUid,
AVRoomActivity.FROM_TYPE_USER,
item.nick,
item.uid.toString()
)
}
} else {
tvTalk.text = "和TA聊"
tvTalk.setOnClickListener {
NimP2PMessageActivity.start(mContext, item.uid.toString())
}
}
helper.getView<View>(R.id.iv_avatar).setOnClickListener {
UserInfoActivity.Companion.start(mContext, item.uid)
}
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
tvNickname.text = item.nick
val ivUserLevel: AppCompatImageView = helper.getView(R.id.iv_user_level)
ivUserLevel.visibility = View.GONE
if (item.userLevelVo != null && !TextUtils.isEmpty(item.userLevelVo.getExperUrl())) {
ivUserLevel.visibility = View.VISIBLE
ImageLoadUtils.loadImage(mContext, item.userLevelVo.getExperUrl(), ivUserLevel)
}
val ivCharmLevel: AppCompatImageView = helper.getView(R.id.iv_charm_level)
ivCharmLevel.visibility = View.GONE
if (item.userLevelVo != null && !TextUtils.isEmpty(item.userLevelVo.getCharmUrl())) {
ivCharmLevel.visibility = View.VISIBLE
ImageLoadUtils.loadImage(
mContext,
item.userLevelVo.getCharmUrl(),
ivCharmLevel
)
}
if (item.userVoice.isNullOrBlank()) {
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.VISIBLE
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.GONE
} else {
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.GONE
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.VISIBLE
helper.getView<AppCompatTextView>(R.id.tvAudio).text = item.voiceDura.toString()
helper.getView<LinearLayout>(R.id.llAudio)
.setOnClickListener { toggleAudio(helper, item) }
helper.setImageResource(R.id.liv_user, R.drawable.ic_sound_wave)
}
val mLabelRecyclerView = helper.getView<RecyclerView>(R.id.mLabelRecyclerView)
if (!ListUtils.isListEmpty(item.labels)) {
mLabelRecyclerView.visibility = View.VISIBLE
val userInfoLabelAdapter = UserInfoLabelAdapter()
val labelLayoutManager = LinesFlexBoxLayoutManager(mContext)
labelLayoutManager.flexDirection = FlexDirection.ROW
labelLayoutManager.alignItems = AlignItems.FLEX_START
labelLayoutManager.setMaxLines(1)
mLabelRecyclerView.layoutManager = labelLayoutManager
mLabelRecyclerView.adapter = userInfoLabelAdapter
userInfoLabelAdapter.setNewData(item.labels)
} else {
mLabelRecyclerView.visibility = View.GONE
}
}
private fun toggleAudio(holder: BaseViewHolder, item: UserInfo) {
if (item.isVoicePlaying) {
stopAudio()
} else {
playAudio(holder, item)
}
}
private fun stopAudio() {
AudioPlayerHelper.get().endPlay()
}
private fun resetAudioUI(holder: BaseViewHolder, item: UserInfo) {
item.isVoicePlaying = false
disposable?.dispose()
holder.setImageResource(R.id.iv_audio_control, R.drawable.ic_sound_pause)
holder.setText(R.id.tvAudio, item.voiceDura.toString())
val svgaImageView = holder.getView<SVGAImageView>(R.id.liv_user)
svgaImageView.stopAnimation()
svgaImageView.setImageResource(R.drawable.ic_sound_wave)
AvRoomDataManager.get().mCurrentRoomInfo?.run {
AudioEngineManager.get().isRemoteMute = isRemoteMute //非靜音
AudioEngineManager.get().isMute = isMute //能説話
AudioEngineManager.get().setRole(
if (isRemoteMute) Constants.CLIENT_ROLE_AUDIENCE else Constants.CLIENT_ROLE_BROADCASTER
)
}
}
private fun playAudio(holder: BaseViewHolder, item: UserInfo) {
AudioPlayerHelper.get().endPlay()
item.isVoicePlaying = true
holder.setImageResource(R.id.iv_audio_control, R.drawable.ic_sound_start)
val svgaImageView = holder.getView<SVGAImageView>(R.id.liv_user)
svgaImageView.loadFromAssets("svga/home_voice_playing.svga")
disposable = Observable.interval(1L, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.map { it + 1 }
.takeUntil { it == item.voiceDura.toLong() }
.subscribe {
holder.setText(R.id.tvAudio, (item.voiceDura - it).toString())
}
AvRoomDataManager.get().mCurrentRoomInfo?.run {
isRemoteMute = AudioEngineManager.get().isRemoteMute
isMute = AudioEngineManager.get().isMute
AudioEngineManager.get().isRemoteMute = true //設置靜音
AudioEngineManager.get().isMute = true //不能説話
AudioEngineManager.get().setRole(Constants.CLIENT_ROLE_AUDIENCE)
}
AudioPlayerHelper.get().playInThread(item.userVoice, object : OnPlayListener {
override fun onError(error: String) {
SingleToastUtil.showToast(mContext.getString(R.string.me_error_playing))
resetAudioUI(holder, item)
}
override fun onPrepared() {}
override fun onPlaying(currDuration: Long) {}
override fun onCompletion() {
resetAudioUI(holder, item)
}
})
}
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
super.onViewDetachedFromWindow(holder)
val position = holder.absoluteAdapterPosition
if (position < 0 || position >= data.size) {
return
}
val item = data[position]
if (item.isVoicePlaying) {
stopAudio()
}
}
}

View File

@@ -39,22 +39,22 @@ class HelloMessageDialog : BaseDialog<DialogHelloMessageBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
val avatarList = listOf<ImageView>(binding.ivAvatar0, binding.ivAvatar1, binding.ivAvatar2)
val avatarList = listOf<ImageView>(binding!!.ivAvatar0, binding!!.ivAvatar1, binding!!.ivAvatar2)
avatarList.forEachIndexed { index, imageView ->
val avatarUrl = helloMessageInfo.sayHelloUserAvatarList?.getOrNull(index)
imageView.load(avatarUrl)
imageView.isGone = avatarUrl.isNullOrEmpty()
}
binding.tvContent.text = if (helloMessageInfo.sayHelloUserAvatarList?.size == 1) {
binding?.tvContent?.text = if (helloMessageInfo.sayHelloUserAvatarList?.size == 1) {
ResUtil.getString(R.string.home_dialog_hellomessagedialog_01)
} else {
ResUtil.getString(R.string.home_dialog_hellomessagedialog_02)
}
binding.tvView.setOnClickListener {
binding?.tvView?.setOnClickListener {
RoomMsgActivity.start(context)
dismissAllowingStateLoss()
}
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}

View File

@@ -33,13 +33,13 @@ class NewUserHelloDialog : BaseDialog<DialogNewUserHelloBinding>() {
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.ivAvatar.load(newUserHelloInfo.sayHelloUserAvatar)
binding.tvId.text = "ID:${newUserHelloInfo.sayHelloUserErbanNo}"
binding.tvNick.text = newUserHelloInfo.sayHelloUserNickname.subAndReplaceDot(8)
binding.tvGoRoom.setOnClickListener {
binding?.ivAvatar?.load(newUserHelloInfo.sayHelloUserAvatar)
binding?.tvId?.text = "ID:${newUserHelloInfo.sayHelloUserErbanNo}"
binding?.tvNick?.text = newUserHelloInfo.sayHelloUserNickname.subAndReplaceDot(8)
binding?.tvGoRoom?.setOnClickListener {
AVRoomActivity.startForFromType(
requireContext(),
newUserHelloInfo.roomUid,

View File

@@ -26,15 +26,15 @@ class RecommendRoomDialog : BaseDialog<DialogRecommendRoomBinding>() {
@SuppressLint("CheckResult")
override fun init() {
binding.ivClose.setOnClickListener {
binding?.ivClose?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.tvGo.setOnClickListener {
binding?.tvGo?.setOnClickListener {
dismissAllowingStateLoss()
AVRoomActivity.start(context, roomInfo.uid)
}
binding.tvRoomTitle.text = roomInfo.title
ImageLoadUtils.loadImage(context, roomInfo.avatar, binding.ivAvatar)
binding?.tvRoomTitle?.text = roomInfo.title
ImageLoadUtils.loadImage(context, roomInfo.avatar, binding?.ivAvatar)
}
}

View File

@@ -0,0 +1,184 @@
package com.yizhuan.erban.home.fragment
import android.os.Bundle
import android.view.View
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
import com.yizhuan.erban.base.BaseActivity
import com.yizhuan.erban.base.BaseViewBindingFragment
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.databinding.FragmentAccompanyBinding
import com.yizhuan.erban.home.HomeViewModel
import com.yizhuan.erban.home.adapter.HomeChatAdapter
import com.yizhuan.erban.home.adapter.RoomNewFriendsAdapter
import com.yizhuan.erban.home.helper.OpenRoomHelper
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
import com.yizhuan.xchat_android_core.room.event.RoomShieldEvent
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
/**
* Peko首页
*/
class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
private lateinit var charAdapter: HomeChatAdapter
private lateinit var roomNewFriendsAdapter: RoomNewFriendsAdapter
private val homeViewModel: HomeViewModel by activityViewModels()
private lateinit var rvDelegate: RVDelegate<UserInfo>
//是否需要刷新接口进行屏蔽房间操作
private var isShield = false
override fun init() {
initRefreshView()
initChatTab()
initHotRoomTab()
showGameGuide()
binding.ivGameGuide.setOnClickListener {
//首页_扩列聊天-创建游戏房
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.NINE),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
CreateRoomDialog().apply { setGameVisible() }.show(context)
}
}
private fun initRefreshView() {
binding.refreshLayout.setOnRefreshListener {
binding.refreshLayout.finishRefresh()
EventBus.getDefault().post(RefreshHomeDataEvent())
}
binding.refreshLayout.isEnableLoadmore = false
binding.refreshLayout.isEnableOverScrollBounce = false
}
private fun initChatTab() {
charAdapter = HomeChatAdapter()
charAdapter.onItemClickListener =
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
val homePlayInfo: HomeRoomInfo? = charAdapter.getItem(position)
if (homePlayInfo != null) {
//首页_扩列聊天-用户房间
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SEVEN),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
AVRoomActivity.startForFromType(
mContext,
homePlayInfo.uid,
AVRoomActivity.FROM_TYPE_RECOMMEND
)
}
}
binding.mRecyclerChat.adapter = charAdapter
binding.mLiCreateRoom.setOnClickListener {
//首页_扩列聊天-创建普通房
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.EIGHT),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
OpenRoomHelper.openRoom(context as BaseActivity?)
}
homeViewModel.homePlayInfoData.observe(this) {
it?.let {
if (it.isNotEmpty()) {
binding.mLiCreateRoom.visibility = View.GONE
binding.nsHost.visibility = View.VISIBLE
charAdapter.setNewData(it)
} else {
binding.mLiCreateRoom.visibility = View.VISIBLE
binding.nsHost.visibility = View.GONE
}
}
}
}
private fun initHotRoomTab() {
roomNewFriendsAdapter = RoomNewFriendsAdapter()
rvDelegate = RVDelegate.Builder<UserInfo>()
.setAdapter(roomNewFriendsAdapter)
.setRecyclerView(binding.recyclerView)
.setEmptyView(EmptyViewHelper.createEmptyTextView(context, "暂无新朋友"))
.setLayoutManager(LinearLayoutManager(mContext))
.build()
homeViewModel.newFriendLiveData.observe(this) {
rvDelegate.loadData(it)
}
}
override fun onLazyLoad() {
super.onLazyLoad()
loadData()
}
override fun onResume() {
super.onResume()
if (isShield) {
loadData()
isShield = false
}
}
private fun loadData() {
homeViewModel.getHomePlayV2()
homeViewModel.getNewFriendList()
}
private fun showGameGuide(){
val userInfo = UserModel.get().cacheLoginUserInfo
if (userInfo?.isHasPermitRoom == true) {
binding.ivGameGuide.visibility = View.GONE
} else {
binding.ivGameGuide.visibility = View.GONE
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onLoginUserInfoUpdateEvent(event: LoginUserInfoUpdateEvent?) {
showGameGuide()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
if (isResumed) {
loadData()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EventBus.getDefault().register(this)
}
override fun onDestroyView() {
super.onDestroyView()
EventBus.getDefault().unregister(this)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onRoomShieldEvent(event: RoomShieldEvent?) {
isShield = true
}
}

View File

@@ -1,60 +1,138 @@
package com.yizhuan.erban.home.fragment
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.avroom.adapter.CommonVPAdapter
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.base.BaseViewBindingFragment
import com.yizhuan.erban.databinding.FragmentHomeBinding
import com.yizhuan.erban.home.HomeViewModel
import com.yizhuan.erban.home.adapter.PartyMagicIndicatorAdapter
import com.yizhuan.erban.home.adapter.HomeBannerAdapter
import com.yizhuan.erban.home.dialog.RecommendRoomDialog
import com.yizhuan.erban.home.helper.OpenRoomHelper
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
import com.yizhuan.erban.ui.search.SearchActivity
import com.yizhuan.erban.ui.user.adapter.MainIndicatorAdapter
import com.yizhuan.erban.ui.utils.load
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
import com.yizhuan.erban.utils.CommonJumpHelper
import com.yizhuan.xchat_android_core.DemoCache
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
import com.yizhuan.xchat_android_library.common.SpConstants
import com.yizhuan.xchat_android_library.common.util.Logger
import com.yizhuan.xchat_android_library.common.util.SPUtils
import com.yizhuan.xchat_android_library.utils.ListUtils
import com.yizhuan.xchat_android_library.utils.ResUtil
import com.zhpan.bannerview.BannerViewPager
/**
* Peko首页
*/
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener,
PartyMagicIndicatorAdapter.OnItemSelectListener {
MainIndicatorAdapter.OnItemSelectListener {
private val mFragments = mutableListOf<Class<out Fragment>>()
private val mTabInfoList = mutableListOf<HomeTagInfo>()
private val homeViewModel: HomeViewModel by activityViewModels()
private var mBanner: BannerViewPager<BannerInfo>? = null
companion object {
private const val TAG = "HomeFragment"
}
override fun init() {
mBanner = view?.findViewById(R.id.banner)
initTitleTab()
initListener()
homeViewModel.tagLiveData.observe(this) {
homeViewModel.bannerLiveData.observe(this) {
it?.let {
onGetHomeTagSuccess(it)
if (ListUtils.isListEmpty(it)) {
mBanner?.visibility = View.GONE
return@let
}
mBanner?.visibility = View.VISIBLE
mBanner?.adapter = HomeBannerAdapter()
mBanner?.post {
mBanner?.apply {
this.setPageMargin(UIUtil.dip2px(mContext, 8.0))
.setScrollDuration(800)
.setOnPageClickListener { _: View?, position: Int ->
//首页_banner
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
CommonJumpHelper.bannerJump(context, it[position])
}
.create(it)
}
}
}
}
homeViewModel.getTagInfo()
homeViewModel.currentResourceLiveData.observe(this) {
it?.let {
if(it.size != 2){
binding.csResource.visibility = View.GONE
return@observe
}
binding.csResource.visibility = View.VISIBLE
val resourceViews = arrayOf(
binding.ivResource0,
binding.ivResource1
)
for (i in resourceViews.indices) {
resourceViews[i].load(it[i].icon)
resourceViews[i].setOnClickListener { _ ->
when {
it[i].resourceType == 5 -> {
CommonWebViewActivity.start(context, it[i].resourceContent)
}
i == 3 -> {
dialogManager.showProgressDialog(mContext)
homeViewModel.getHomeChatPick()
}
else -> {
dialogManager.showProgressDialog(mContext)
homeViewModel.getResourceJumpInfo(it[i].id)
}
}
}
}
}
}
homeViewModel.resourceJumpLiveData.observe(this) {
dialogManager.dismissDialog()
it?.let {
if (it.isPick) {
AVRoomActivity.start(context, it.uid)
} else {
RecommendRoomDialog.newInstance(it).show(context)
}
}
}
homeViewModel.homeChatPickLiveData.observe(viewLifecycleOwner) {
dialogManager.dismissDialog()
it?.let {
if (it.isNotEmpty()) {
NimP2PMessageActivity.start(context, it)
}
}
}
homeViewModel.getBannerInfo()
homeViewModel.getCurrentResourceInfo()
}
private fun initListener() {
@@ -113,57 +191,28 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
0
)
)
mTabInfoList.add(
HomeTagInfo(
7,
ResUtil.getString(R.string.home_fragment_homefragment_07),
0
)
)
mFragments.add(RecommendFragment::class.java)
val homeTabInfo = SPUtils.getString(SpConstants.TAB_INFO_LIST, "")
if (!TextUtils.isEmpty(homeTabInfo)) {
val homeTagInfoList: List<HomeTagInfo> =
Gson().fromJson(homeTabInfo, object : TypeToken<List<HomeTagInfo?>?>() {}.type)
if (homeTagInfoList.isNotEmpty()) {
for (i in homeTagInfoList.indices) {
//过滤对象是空和没有标签名同时也没有子标签的情况
var title: CharSequence?
var name = homeTagInfoList[i].name
if (name != null) {
name = name.trim { it <= ' ' }
}
title = name
mTabInfoList.add(homeTagInfoList[i])
val fragment: Class<out Fragment> = when (title) {
getString(R.string.home_fragment_partyfragment_01) -> {
RoomLikeFragment::class.java
}
getString(R.string.home_fragment_partyfragment_02) -> {
RoomGameFragment::class.java
}
else -> {
RoomCommonFragment::class.java
}
}
mFragments.add(fragment)
}
}
}
mFragments.add(AccompanyFragment::class.java)
val commonNavigator = CommonNavigator(context)
commonNavigator.setTitleWrapContent(false)
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
val magicIndicatorAdapter = PartyMagicIndicatorAdapter(mTabInfoList.map { it.name })
magicIndicatorAdapter.textSize = 14
val magicIndicatorAdapter = MainIndicatorAdapter(context, mTabInfoList.map { it.name })
magicIndicatorAdapter.setOnItemSelectListener(this)
commonNavigator.adapter = magicIndicatorAdapter
binding.magicIndicator.navigator = commonNavigator
binding.viewPager.adapter =
object : FragmentStateAdapter(childFragmentManager, lifecycle) {
override fun createFragment(position: Int): Fragment {
val tabEntity = mFragments[position].newInstance()
val bundle = Bundle()
if (mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_01)
&& mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_02)
) {
bundle.putInt("tab_id", mTabInfoList[position].id)
}
tabEntity.arguments = bundle
return tabEntity
return mFragments[position].newInstance()
}
override fun getItemCount(): Int {
@@ -172,96 +221,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
}
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
}
private fun onGetHomeTagSuccess(tagInfo: List<HomeTagInfo>) {
var changed = false
mTabInfoList.filter { it.id != 6 }
val homeTabInfo = SPUtils.getString(SpConstants.TAB_INFO_LIST, "")
if (!TextUtils.isEmpty(homeTabInfo)) {
val homeTagInfoList: List<HomeTagInfo> =
Gson().fromJson(homeTabInfo, object : TypeToken<List<HomeTagInfo?>?>() {}.type)
if (homeTagInfoList.isNotEmpty()) {
if (homeTagInfoList != tagInfo) {
changed = true
}
} else {
changed = true
}
} else {
changed = true
}
//只有HomeTagInfo发生改变才刷新数据
if (changed) {
Logger.info(TAG, "oldTabInfoList:change");
mTabInfoList.clear()
mFragments.clear()
mTabInfoList.add(
HomeTagInfo(
6,
ResUtil.getString(R.string.home_fragment_homefragment_04),
0
)
)
mFragments.add(RecommendFragment::class.java)
for (i in tagInfo.indices) {
//过滤对象是空和没有标签名同时也没有子标签的情况
var title: CharSequence?
var name = tagInfo[i].name
if (name != null) {
name = name.trim { it <= ' ' }
}
title = name
mTabInfoList.add(tagInfo[i])
val fragment: Class<out Fragment> = when (title) {
getString(R.string.home_fragment_partyfragment_01) -> {
RoomLikeFragment::class.java
}
getString(R.string.home_fragment_partyfragment_02) -> {
RoomGameFragment::class.java
}
else -> {
RoomCommonFragment::class.java
}
}
mFragments.add(fragment)
}
SPUtils.putString(
SpConstants.TAB_INFO_LIST,
Gson().toJson(mTabInfoList.filter { it.id != 6 })
)
val commonNavigator = CommonNavigator(context)
commonNavigator.setTitleWrapContent(false)
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
val magicIndicatorAdapter = PartyMagicIndicatorAdapter(mTabInfoList.map { it.name })
magicIndicatorAdapter.textSize = 14
magicIndicatorAdapter.setOnItemSelectListener(this)
commonNavigator.adapter = magicIndicatorAdapter
binding.magicIndicator.navigator = commonNavigator
binding.viewPager.adapter =
object : FragmentStateAdapter(childFragmentManager, lifecycle) {
override fun createFragment(position: Int): Fragment {
val tabEntity = mFragments[position].newInstance()
val bundle = Bundle()
if (mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_01)
&& mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_02)
) {
bundle.putInt("tab_id", mTabInfoList[position].id)
}
tabEntity.arguments = bundle
return tabEntity
}
override fun getItemCount(): Int {
return mFragments.size
}
}
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
}
binding.viewPager.offscreenPageLimit = 1
}
override fun onItemSelect(position: Int, view: TextView?) {

View File

@@ -241,7 +241,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
copyName(it.erbanNo.toString())
}
val star = StarUtils.getConstellation(Date(it.birth))
mBinding.tvConstellation.text = star
mBinding.ivConstellation.setImageResource(star)
setUserLevel(it.userLevelVo)
setWalletInfo()
@@ -396,6 +396,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
when (v.id) {
R.id.iv_user_head, R.id.rl_user_info ->
mUserInfo?.let { UIHelper.showUserInfoAct(mContext, it.uid) }
R.id.iv_edit ->
mUserInfo?.let { UIHelper.showUserInfoModifyAct(mContext, it.uid) }
@@ -405,12 +406,14 @@ class MeFragment : BaseFragment(), View.OnClickListener {
AttentionListActivity::class.java
)
)
R.id.ll_user_fans -> startActivity(
Intent(
mContext,
FansListActivity::class.java
)
)
R.id.me_item_wallet -> {
//进入充值页面埋点
val goldWalletInfo = PayModel.get().currentWalletInfo
@@ -421,17 +424,10 @@ class MeFragment : BaseFragment(), View.OnClickListener {
}
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
ChargeActivity.start(mContext)
} else {
CommonWebViewActivity.start(
context, UriProvider.getOfficialPay(
4,
DeviceUtil.getDeviceId(context)
)
)
}
jumpChargePage()
}
R.id.me_item_vip -> {
VipMainActivity.start(mContext)
//进入贵族中心埋点
@@ -444,17 +440,42 @@ class MeFragment : BaseFragment(), View.OnClickListener {
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
}
R.id.ll_room -> {
OpenRoomHelper.openRoom(context as BaseActivity?)
}
R.id.ll_gain -> {
context?.let { EarnRecordActivity.start(it) }
}
R.id.ll_clean_diamonds -> {
GiveGoldActivity.start(mContext)
}
else -> {}
}
}
@SuppressLint("CheckResult")
private fun jumpChargePage() {
PayModel.get().chargeChannel
.compose(bindToLifecycle())
.subscribe({
if (it.isNative) {
ChargeActivity.start(mContext)
return@subscribe
}
CommonWebViewActivity.start(
context,
UriProvider.getOfficialPay(4, DeviceUtil.getDeviceId(context))
)
}, {
toast(it.message)
ChargeActivity.start(mContext)
})
}
}

View File

@@ -3,30 +3,20 @@ package com.yizhuan.erban.home.fragment
import android.os.Bundle
import android.view.View
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.GridLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.yizhuan.erban.R
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
import com.yizhuan.erban.base.BaseActivity
import com.yizhuan.erban.base.BaseViewBindingFragment
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.databinding.FragmentRecommendBinding
import com.yizhuan.erban.home.HomeViewModel
import com.yizhuan.erban.home.adapter.HomeChatAdapter
import com.yizhuan.erban.home.adapter.HomeHotAdapter
import com.yizhuan.erban.home.adapter.HomeTopAdapter
import com.yizhuan.erban.home.helper.BannerHelper
import com.yizhuan.erban.home.helper.OpenRoomHelper
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
import com.yizhuan.xchat_android_core.room.event.RoomShieldEvent
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
import com.yizhuan.xchat_android_library.utils.ListUtils
import com.zhpan.bannerview.BannerViewPager
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@@ -35,65 +25,19 @@ import org.greenrobot.eventbus.ThreadMode
* Peko首页
*/
class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
private lateinit var charAdapter: HomeChatAdapter
private lateinit var roomHotAdapter: HomeHotAdapter
private lateinit var rvDelegate: RVDelegate<HomeRoomInfo>
private val homeViewModel: HomeViewModel by activityViewModels()
//是否需要刷新接口进行屏蔽房间操作
private var isShield = false
private var mRecommendBanner: BannerViewPager<HomeTabMapInfo>? = null
override fun init() {
mRecommendBanner = view?.findViewById(R.id.mRecommendBanner)
initRefreshView()
initChatTab()
initHotRoomTab()
showGameGuide()
homeViewModel.tabHomeLiveData.observe(this) {
it?.let {
if (ListUtils.isListEmpty(it)) {
mRecommendBanner?.visibility = View.GONE
return@observe
} else {
mRecommendBanner?.visibility = View.VISIBLE
}
val roomsList: List<HomeTabMapInfo> = ArrayList(it)
for (i in roomsList.indices) {
roomsList[i].itemType = HomeTabMapInfo.TYPE_NORMAL //对原始数据设置type
}
refreshRoomData(roomsList)
}
}
homeViewModel.bannerLiveData.observe(this) {
it?.let {
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
//首页_banner
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
}
}
}
binding.ivGameGuide.setOnClickListener {
//首页_扩列聊天-创建游戏房
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.NINE),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
CreateRoomDialog().apply { setGameVisible() }.show(context)
}
}
private fun initRefreshView() {
@@ -105,51 +49,6 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
binding.refreshLayout.isEnableOverScrollBounce = false
}
private fun initChatTab() {
charAdapter = HomeChatAdapter()
charAdapter.onItemClickListener =
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
val homePlayInfo: HomeRoomInfo? = charAdapter.getItem(position)
if (homePlayInfo != null) {
//首页_扩列聊天-用户房间
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SEVEN),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
AVRoomActivity.startForFromType(
mContext,
homePlayInfo.uid,
AVRoomActivity.FROM_TYPE_RECOMMEND
)
}
}
binding.mRecyclerChat.adapter = charAdapter
binding.mLiCreateRoom.setOnClickListener {
//首页_扩列聊天-创建普通房
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.EIGHT),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
OpenRoomHelper.openRoom(context as BaseActivity?)
}
homeViewModel.homePlayInfoData.observe(this) {
it?.let {
if (it.isNotEmpty()) {
binding.mLiCreateRoom.visibility = View.GONE
binding.mRecyclerChat.visibility = View.VISIBLE
charAdapter.setNewData(it)
} else {
binding.mLiCreateRoom.visibility = View.VISIBLE
binding.mRecyclerChat.visibility = View.GONE
}
}
}
}
private fun initHotRoomTab() {
roomHotAdapter = HomeHotAdapter()
roomHotAdapter.onItemClickListener =
@@ -166,57 +65,14 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
AVRoomActivity.start(mContext, homePlayInfo.uid)
}
}
binding.mRecyclerRoom.adapter = roomHotAdapter
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
.setAdapter(roomHotAdapter)
.setRecyclerView(binding.mRecyclerRoom)
.setEmptyView(EmptyViewHelper.createEmptyTextViewHeight(context, "暂无熱門推薦"))
.setLayoutManager(GridLayoutManager(mContext, 2))
.build()
homeViewModel.homeHotRoomLiveData.observe(this) {
it?.let {
roomHotAdapter.setNewData(it)
}
}
}
/**
* 刷新数据
*/
private fun refreshRoomData(roomList: List<HomeTabMapInfo>) {
mRecommendBanner?.adapter = HomeTopAdapter()
mRecommendBanner?.post {
val width =
UIUtil.getScreenWidth(mContext) - UIUtil.dip2px(mContext, 10.0) * 3
val revealWidth = width / 3
val bannerLayoutParams = mRecommendBanner?.layoutParams
bannerLayoutParams?.height = revealWidth + UIUtil.dip2px(mContext, 32.0)
mRecommendBanner?.layoutParams = bannerLayoutParams
setupBanner(
revealWidth,
revealWidth,
roomList
)
}
}
private fun setupBanner(
leftRevealWidth: Int,
rightRevealWidth: Int,
list: List<HomeTabMapInfo>
) {
mRecommendBanner?.apply {
setLifecycleRegistry(lifecycle)
setPageMargin(UIUtil.dip2px(mContext, 10.0))
setScrollDuration(800)
setRevealWidth(leftRevealWidth, rightRevealWidth)
setOnPageClickListener { _: View?, position: Int ->
//首页_热门房间
val map = HashMap<String, Any>(3)
map[IReportConstants.HOMEPAGE_TYPE] = IReportConstants.FIVE
map[IReportConstants.MODULE] = IReportConstants.PEKO_HOMEPAGE
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, map)
AVRoomActivity.startForFromType(
mContext,
list[position].roomUid.toLong(),
AVRoomActivity.FROM_TYPE_RECOMMEND
)
}
create(list)
rvDelegate.loadData(it)
}
}
@@ -234,26 +90,9 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
}
private fun loadData() {
homeViewModel.getBannerInfo()
homeViewModel.getHomeTabName()
homeViewModel.getHomePlayV2()
homeViewModel.getHotRoom()
}
private fun showGameGuide(){
val userInfo = UserModel.get().cacheLoginUserInfo
if (userInfo?.isHasPermitRoom == true) {
binding.ivGameGuide.visibility = View.GONE
} else {
binding.ivGameGuide.visibility = View.GONE
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onLoginUserInfoUpdateEvent(event: LoginUserInfoUpdateEvent?) {
showGameGuide()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
if (isResumed) {

View File

@@ -1,6 +1,12 @@
package com.yizhuan.erban.main.helper;
import static android.Manifest.permission.POST_NOTIFICATIONS;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.core.app.ActivityCompat;
import com.yizhuan.erban.R;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
@@ -35,23 +41,35 @@ public class NoticationsUiHelper {
private static final long CACHE_DISTANCE_TIME = 3 * TimeUtils.MILLIS_OF_A_DAY;
public static void handle(Activity activity, DialogManager dialogManager) {
if (NotificationsUtils.isNotificationEnabled(activity)) {
if (Build.VERSION.SDK_INT >= 33) {
if (ActivityCompat.checkSelfPermission(activity, POST_NOTIFICATIONS) == PackageManager.PERMISSION_DENIED) {
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, POST_NOTIFICATIONS)) {
enableNotification(activity, dialogManager);
} else {
ActivityCompat.requestPermissions(activity, new String[]{POST_NOTIFICATIONS}, 100);
}
}
} else if (NotificationsUtils.isNotificationEnabled(activity)) {
return;
}
enableNotification(activity, dialogManager);
}
private static void enableNotification(Activity activity, DialogManager dialogManager) {
Single.create(new SingleOnSubscribe<String>() {
@Override
public void subscribe(SingleEmitter<String> emitter) throws Exception {
long lastDialogTime = (long) SharedPreferenceUtils
.get(KEY_NOTICATIONS_DIALOG_TIME, 0L);
long currTime = System.currentTimeMillis();
if (lastDialogTime == 0L || currTime - lastDialogTime >= CACHE_DISTANCE_TIME) {
//超过三天需要重新弹窗
emitter.onSuccess("");
return;
}
emitter.onError(new Throwable("no need to show notications dialog"));
}
})
@Override
public void subscribe(SingleEmitter<String> emitter) throws Exception {
long lastDialogTime = (long) SharedPreferenceUtils
.get(KEY_NOTICATIONS_DIALOG_TIME, 0L);
long currTime = System.currentTimeMillis();
if (lastDialogTime == 0L || currTime - lastDialogTime >= CACHE_DISTANCE_TIME) {
//超过三天需要重新弹窗
emitter.onSuccess("");
return;
}
emitter.onError(new Throwable("no need to show notications dialog"));
}
})
.flatMap(new Function<String, SingleSource<String>>() {
@Override
public SingleSource<String> apply(String s) throws Exception {

View File

@@ -35,7 +35,7 @@ import com.yizhuan.xchat_android_library.common.util.DeviceUtil;
* @author xiaoyu
* @date 2017/12/30
*/
public class SplashActivity extends AppCompatActivity implements View.OnClickListener, PrivacyAgreementDialog.OnCallBack {
public class SplashActivity extends AppCompatActivity implements View.OnClickListener {
public static final String SHOW_PRIVACY_AGREEMENT = "show_privacy_agreement";
private static final int COUNT_DOWN_TIME = 3;
@@ -84,18 +84,10 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
@SuppressLint("CheckResult")
protected void initiate() {
checkPrivacyAgreement();
}
private void checkPrivacyAgreement() {
boolean isShowPrivacyAgreement = (boolean) SharedPreferenceUtils.get(SHOW_PRIVACY_AGREEMENT, true);
if (isShowPrivacyAgreement) {
PrivacyAgreementDialog privacyAgreementDialog = new PrivacyAgreementDialog(this);
privacyAgreementDialog.setCancelable(false);
privacyAgreementDialog.setCanceledOnTouchOutside(false);
privacyAgreementDialog.setOnCallBack(this);
privacyAgreementDialog.show();
showSplash(true);
SharedPreferenceUtils.put(SHOW_PRIVACY_AGREEMENT, false);
} else {
showSplash(false);
}
@@ -103,7 +95,7 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
private void showSplash(boolean first) {
if(!TextUtils.isEmpty(DeviceUtil.getAndroidID())){
if (!TextUtils.isEmpty(DeviceUtil.getAndroidID())) {
OaidUtil.setOaid(DeviceUtil.getAndroidID());
if (first) ChannelPageModel.get().checkAd();
}
@@ -185,14 +177,4 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
}
@Override
public void onFinish(boolean isConfirm) {
if (isConfirm) {
SharedPreferenceUtils.put(SHOW_PRIVACY_AGREEMENT, false);
XChatApplication.initOtherSDK();
showSplash(true);
} else {
finish();
}
}
}

View File

@@ -210,14 +210,14 @@ class GiveGoldToUserActivity : BaseViewBindingActivity<ActivityGiveGoldToUserBin
}
private fun initDiamond() {
if(binding.tvDiamondTab.visibility == View.GONE){
if (binding.tvDiamondTab.visibility == View.GONE) {
return
}else if (binding.tvGiftTab.visibility == View.VISIBLE) {
} else if (binding.tvGiftTab.visibility == View.VISIBLE) {
binding.tvGiftTab.isSelected = false
binding.groupGift.visibility = View.GONE
}
val initInfo = DemoCache.readInitInfo()
val length = initInfo.giveDiamondOnceLimitNum.toInt().toString().length
val length = initInfo?.giveDiamondOnceLimitNum?.toInt()?.toString()?.length ?: 0
binding.mEditGold.text.filters = arrayOf<InputFilter>(LengthFilter(length))
binding.mTvDiamond.text = getString(
R.string.my_diamond,
@@ -237,7 +237,7 @@ class GiveGoldToUserActivity : BaseViewBindingActivity<ActivityGiveGoldToUserBin
@SuppressLint("CheckResult")
private fun initGift() {
if(binding.tvGiftTab.visibility == View.GONE){
if (binding.tvGiftTab.visibility == View.GONE) {
return
}
val giftList = GiftModel.get().knapList
@@ -254,10 +254,10 @@ class GiveGoldToUserActivity : BaseViewBindingActivity<ActivityGiveGoldToUserBin
binding.tvSure.isEnabled = true
}
}
if(giftList.size == 0){
if (giftList.size == 0) {
binding.tvEmptyTip.visibility = View.VISIBLE
return
}else{
} else {
binding.tvEmptyTip.visibility = View.GONE
}
val list = transformList(giftList, 8)

View File

@@ -1,7 +1,12 @@
package com.yizhuan.erban.pay.presenter;
import android.annotation.SuppressLint;
import com.hjq.toast.ToastUtils;
import com.yizhuan.erban.pay.view.IChargeView;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_library.base.PresenterEvent;
import com.yizhuan.xchat_android_library.utils.ListUtils;
/**
* Created by MadisonRong on 05/01/2018.
@@ -21,7 +26,16 @@ public class ChargePresenter extends PayPresenter<IChargeView> {
refreshWalletInfo(false);
}
@SuppressLint("CheckResult")
public void loadBanner() {
payModel.loadChargeBanner()
.compose(bindUntilEvent(PresenterEvent.DESTROY))
.subscribe(list -> {
if (ListUtils.isListEmpty(list)) {
return;
}
getMvpView().onLoadedBanners(list);
},
error -> ToastUtils.show(error.getMessage()));
}
}

View File

@@ -1,11 +1,16 @@
package com.yizhuan.erban.pay.view;
import com.yizhuan.xchat_android_core.pay.bean.Banner;
import java.util.List;
/**
* Created by MadisonRong on 05/01/2018.
*/
public interface IChargeView extends IPayView {
void onLoadedBanners(List<Banner> banners);
}

View File

@@ -54,7 +54,8 @@ class FairyViewModel : BaseViewModel() {
val sendFairyRecordLiveData: LiveData<ListResult<SendFairyInfo>> = _sendFairyRecordLiveData
private val _compoundFairyInfosLiveData = MutableLiveData<SparseArray<FairyInfo>?>()
val compoundFairyInfosLiveData: MutableLiveData<SparseArray<FairyInfo>?> = _compoundFairyInfosLiveData
val compoundFairyInfosLiveData: MutableLiveData<SparseArray<FairyInfo>?> =
_compoundFairyInfosLiveData
private val _testResultLiveData = MutableLiveData<Event<FairyInfo>?>()
val testResultLiveData: MutableLiveData<Event<FairyInfo>?> = _testResultLiveData
@@ -62,17 +63,26 @@ class FairyViewModel : BaseViewModel() {
private val _testLegendResultLiveData = MutableLiveData<Event<FairyInfo>?>()
val testLegendResultLiveData: MutableLiveData<Event<FairyInfo>?> = _testLegendResultLiveData
private val _resolveResultLiveData = MutableLiveData<Event<ResolveInfo>?>()
val resolveResultLiveData: MutableLiveData<Event<ResolveInfo>?> = _resolveResultLiveData
private val _testRecordLiveData = MutableLiveData<ListResult<TestFairyRecordInfo>>()
val testRecordLiveData: LiveData<ListResult<TestFairyRecordInfo>> = _testRecordLiveData
private val _exchangeGiftListLiveData = MutableLiveData<List<ExchangeGiftInfo>?>()
val exchangeGiftListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> = _exchangeGiftListLiveData
val exchangeGiftListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> =
_exchangeGiftListLiveData
private val _exchangeGiftLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
val exchangeGiftLiveData: LiveData<Event<ExchangeGiftInfo>> = _exchangeGiftLiveData
//精灵召唤列表
private val _fairyCallInfoLiveData = MutableLiveData<List<ExchangeGiftInfo>?>()
val fairyCallInfoLiveData: MutableLiveData<List<ExchangeGiftInfo>?> = _fairyCallInfoLiveData
private val _debrisExchangeListLiveData = MutableLiveData<List<ExchangeGiftInfo>?>()
val debrisExchangeListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> = _debrisExchangeListLiveData
val debrisExchangeListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> =
_debrisExchangeListLiveData
private val _debrisExchangeLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
val debrisExchangeLiveData: LiveData<Event<ExchangeGiftInfo>> = _debrisExchangeLiveData
@@ -85,6 +95,9 @@ class FairyViewModel : BaseViewModel() {
val exchangeDebrisRecordLiveData: LiveData<ListResult<ExchangeGiftInfo>> =
_exchangeDebrisRecordLiveData
private val _buyDebrisLiveData = MutableLiveData<String?>()
val buyDebrisLiveData: LiveData<String?> = _buyDebrisLiveData
init {
initPrizeInfoList()
}
@@ -197,6 +210,21 @@ class FairyViewModel : BaseViewModel() {
)
}
/**
* 精灵召唤列表
*/
fun getFairyCallInfo() {
safeLaunch(
onError = {
_myFairyInfoLiveData.value = null
it.message.toast()
},
block = {
_myFairyInfoLiveData.value = TreasureFairyModel.getMyFairyInfo()
}
)
}
fun getFriendsList(nick: String? = null) {
safeLaunch(
onError = {
@@ -258,20 +286,21 @@ class FairyViewModel : BaseViewModel() {
_compoundFairyInfosLiveData.value = null
_testLegendResultLiveData.value = null
_testResultLiveData.value = null
_resolveResultLiveData.value = null
val myFairyInfo = _myFairyInfoLiveData.value
myFairyInfo?.lowElves?.forEach {
it.selectedNum = 0
}
myFairyInfo?.middleElves?.forEach {
myFairyInfo?.highElves?.forEach {
it.selectedNum = 0
}
_myFairyInfoLiveData.value = myFairyInfo
}
fun addTestFairy(fairyInfo: FairyInfo) {
fun addTestFairy(fairyInfo: FairyInfo, size: Int) {
val array = _compoundFairyInfosLiveData.value ?: SparseArray()
if (array.size() >= 3) {
if (array.size() >= size) {
"試煉爐已滿!".toast()
} else {
if (fairyInfo.elfNum == 0) {
@@ -313,9 +342,9 @@ class FairyViewModel : BaseViewModel() {
}
}
fun oneKeyAdd(fairyInfos: List<FairyInfo>) {
fun oneKeyAdd(fairyInfos: List<FairyInfo>, size: Int) {
val compoundFairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
var needNum = 3 - compoundFairyInfos.size()
var needNum = size - compoundFairyInfos.size()
if (needNum == 0) {
"試煉爐已滿!".toast()
return
@@ -327,7 +356,7 @@ class FairyViewModel : BaseViewModel() {
compoundFairyInfos.put(nextIndex(compoundFairyInfos), it)
}
}
if (needNum <= 3 && needNum != 0) {
if (needNum <= size && needNum != 0) {
"精靈數量不足".toast()
return
}
@@ -342,21 +371,27 @@ class FairyViewModel : BaseViewModel() {
fairyInfos.get(1) == null -> {
1
}
else -> {
fairyInfos.get(2) == null -> {
2
}
fairyInfos.get(3) == null -> {
3
}
else -> {
4
}
}
}
fun testFairy(level: Int): Boolean {
val fairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
if (fairyInfos.size() != 3) {
if (fairyInfos.size() != 5) {
"精靈數量不足".toast()
return false
}
safeLaunch(
onError = {
if (level == MyFairyItemView.EPIC) {
if (level == MyFairyItemView.LEGEND) {
_testLegendResultLiveData.value = null
} else {
_testResultLiveData.value = null
@@ -371,7 +406,7 @@ class FairyViewModel : BaseViewModel() {
}
fairyTestParam.level = level
val result = TreasureFairyModel.testFairy(fairyTestParam)
(if (level == MyFairyItemView.EPIC) {
(if (level == MyFairyItemView.LEGEND) {
_testLegendResultLiveData
} else {
_testResultLiveData
@@ -382,6 +417,30 @@ class FairyViewModel : BaseViewModel() {
return true
}
fun resolveFairy(): Boolean {
val fairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
if (fairyInfos.size() != 1) {
"精靈數量不足".toast()
return false
}
safeLaunch(
onError = {
_resolveResultLiveData.value = null
it.message.toast()
},
block = {
val fairyTestParam = FairyResolveParam()
fairyInfos.forEach { _, value ->
fairyTestParam.expendList.add(Compound(value.elfId, 1))
}
val result = TreasureFairyModel.resolveFairy(fairyTestParam)
_resolveResultLiveData.value = result?.let { Event(it[0]) }
getMyFairyInfo()
}
)
return true
}
fun getTestFairyRecordList(
page: Int,
pageSize: Int
@@ -409,6 +468,18 @@ class FairyViewModel : BaseViewModel() {
)
}
//精灵召唤列表
fun getFairyCallList() {
safeLaunch(
onError = {
_fairyCallInfoLiveData.value = null
},
block = {
val result = TreasureFairyModel.getFairyCallList()
_fairyCallInfoLiveData.value = result
}
)
}
fun getDebrisExchangeList() {
safeLaunch(
@@ -468,4 +539,13 @@ class FairyViewModel : BaseViewModel() {
)
}
fun buyDebris(num: String, uid: String) {
safeLaunch(
block = {
val result = TreasureFairyModel.buyDebris(num, uid)
_buyDebrisLiveData.value = result
}
)
}
}

View File

@@ -15,22 +15,32 @@ import android.widget.TextView
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.graphics.toColorInt
import com.alibaba.fastjson.JSON
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseViewBindingActivity
import com.yizhuan.erban.common.widget.dialog.DialogManager
import com.yizhuan.erban.databinding.TreasureFairyDialogHomeBinding
import com.yizhuan.erban.treasurefairy.dialog.ForestFairyDialog
import com.yizhuan.erban.treasurefairy.dialog.HomeMorePopupWindow
import com.yizhuan.erban.treasurefairy.dialog.HomePrizeDialog
import com.yizhuan.erban.treasurefairy.dialog.MyFairyDialog
import com.yizhuan.erban.treasurefairy.dialog.*
import com.yizhuan.erban.treasurefairy.view.CustomDrawable
import com.yizhuan.erban.ui.webview.FairyDialogWebViewActivity
import com.yizhuan.erban.utils.SpannableBuilder
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_core.bean.BaseProtocol
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo
import com.yizhuan.xchat_android_core.im.custom.bean.*
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
import com.yizhuan.xchat_android_core.manager.RoomEvent
import com.yizhuan.xchat_android_core.treasurefairy.DrawInfo
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean
import com.yizhuan.xchat_android_core.treasurefairy.PrizeInfo
import com.yizhuan.xchat_android_library.common.SpConstants
import com.yizhuan.xchat_android_library.common.util.SPUtils
import com.yizhuan.xchat_android_library.utils.FormatUtils
import com.yizhuan.xchat_android_library.utils.TimeUtils
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@@ -47,12 +57,17 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
private val removeRunnable = Runnable { binding.llPrizeHint.removeAllViews() }
private val hintPrizeCacheList = ArrayList<PrizeInfo>()
private var disposable: Disposable? = null
private val viewModel: FairyViewModel by viewModels()
private var drawInfo: DrawInfo? = null
private var isCheck = false
private var isSelect = false
private var mPrice = -1
companion object {
@JvmStatic
fun start(context: Context) {
@@ -85,16 +100,44 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(this)
)
window.setGravity(Gravity.BOTTOM)
binding.fairyItem0.isSelected = true
looperHintPrize()
binding.tvKeyNum.setOnClickListener {
FairyDialogWebViewActivity.start(this, UriProvider.getFairyKey())
binding.viewPrice1.setOnClickListener {
setFairyPriceSelect(1)
}
binding.viewPrice2.setOnClickListener {
setFairyPriceSelect(2)
}
binding.viewPrice3.setOnClickListener {
setFairyPriceSelect(3)
}
binding.tvBuy.setOnClickListener {
if (!isSelect) {
toast("請選擇購買的碎片數量")
} else {
val date = SPUtils.getLong(SpConstants.FAIRY_BUY_DEBRIS, 0L)
if (date != 0L) {
if (TimeUtils.isToday(date)) {
viewModel.buyDebris(
mPrice.toString(),
AuthModel.get().currentUid.toString()
)
} else {
FairyBuyDebrisDialog.newInstance(mPrice).show(context)
}
} else {
FairyBuyDebrisDialog.newInstance(mPrice).show(context)
}
}
}
binding.ivMyFairy.setOnClickListener {
MyFairyDialog.newInstance().show(this)
}
binding.ivFairyTreasure.setOnClickListener {
ForestFairyDialog.newInstance().show(this)
binding.ivFairyStore.setOnClickListener {
ExchangeFairyDialog.newInstance().show(context)
}
binding.ivOpen1.setOnClickListener {
if (checkKeyNum(1)) {
@@ -137,6 +180,18 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
}
}
binding.cbWinResult.setOnCheckedChangeListener { _, isChecked ->
isCheck = isChecked
}
binding.ivRefresh.setOnClickListener {
viewModel.initDrawInfo()
}
viewModel.buyDebrisLiveData.observe(this) {
toast("購買碎片成功")
}
viewModel.prizeInfoListLiveData.observe(this) {
it?.forEachIndexed { index, prizeInfo ->
if (index < fairyItems.size) {
@@ -169,9 +224,9 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
binding.tvShortLuckyValue.text =
SpannableBuilder()
.append("幸運值達到", ForegroundColorSpan("#59FDFF".toColorInt()))
.append("還差", ForegroundColorSpan("#59FDFF".toColorInt()))
.append("${it.needLuckyNum}", ForegroundColorSpan("#FFE8AA".toColorInt()))
.append("后,下次奪寶獲贈精靈", ForegroundColorSpan("#59FDFF".toColorInt()))
.append("幸運值,額外獲贈傳説精靈", ForegroundColorSpan("#59FDFF".toColorInt()))
.build()
binding.ivLuckyStone.post {
val drawable =
@@ -205,6 +260,48 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
}
}
private fun setFairyPriceSelect(pos: Int) {
isSelect = true
when (pos) {
1 -> {
mPrice = 1
binding.viewPrice1.isSelected = true
binding.viewPrice2.isSelected = false
binding.viewPrice3.isSelected = false
binding.ivDebris1.alpha = 1f
binding.ivDebris2.alpha = 0.4f
binding.ivDebris3.alpha = 0.4f
binding.tvOne.alpha = 1f
binding.tvTwo.alpha = 0.4f
binding.tvThree.alpha = 0.4f
}
2 -> {
mPrice = 10
binding.viewPrice1.isSelected = false
binding.viewPrice2.isSelected = true
binding.viewPrice3.isSelected = false
binding.ivDebris1.alpha = 0.4f
binding.ivDebris2.alpha = 1f
binding.ivDebris3.alpha = 0.4f
binding.tvOne.alpha = 0.4f
binding.tvTwo.alpha = 1f
binding.tvThree.alpha = 0.4f
}
3 -> {
mPrice = 100
binding.viewPrice1.isSelected = false
binding.viewPrice2.isSelected = false
binding.viewPrice3.isSelected = true
binding.ivDebris1.alpha = 0.4f
binding.ivDebris2.alpha = 0.4f
binding.ivDebris3.alpha = 1f
binding.tvOne.alpha = 0.4f
binding.tvTwo.alpha = 0.4f
binding.tvThree.alpha = 1f
}
}
}
private fun checkKeyNum(num: Int): Boolean {
val keyNum = drawInfo?.drawTicketNum ?: 0
if (keyNum >= num) {
@@ -238,7 +335,9 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
fairyItems[selectIndex].isSelected = true
}
if ((selectIndex == targetIndex || targetIndex == -2) && minCount >= 24) {
HomePrizeDialog.newInstance().show(context)
if (!isCheck) {
HomePrizeDialog.newInstance().show(context)
}
disposable?.dispose()
}
}
@@ -296,4 +395,107 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
"x" + prizeInfo.rewardNum
}
/**
* 接收到全局广播信息
*
* @param body 信息实体
*/
override fun onReceivedNimBroadcastMessage(body: String?) {
val baseProtocol: BaseProtocol<*> = try {
JSON.parseObject(body, BaseProtocol::class.java)
} catch (e: Exception) {
null
} ?: return
when (baseProtocol.first) {
CustomAttachment.CUSTOM_MSG_BOX -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
val roomBoxPrizeAttachment = RoomBoxPrizeAttachment(
CustomAttachment.CUSTOM_MSG_BOX,
CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
)
val roomBoxPrizeBean = JSON.parseObject(
baseProtocol.data.toString(),
RoomBoxPrizeInfo::class.java
)
roomBoxPrizeAttachment.uid = roomBoxPrizeBean.uid
roomBoxPrizeAttachment.prizeName = roomBoxPrizeBean.prizeName
roomBoxPrizeAttachment.nick = roomBoxPrizeBean.nick
roomBoxPrizeAttachment.boxTypeStr = roomBoxPrizeBean.boxTypeStr
roomBoxPrizeAttachment.roomUid = roomBoxPrizeBean.roomUid
roomBoxPrizeAttachment.prizeNum = roomBoxPrizeBean.prizeNum
roomBoxPrizeAttachment.userLevelLimit = roomBoxPrizeBean.userLevelLimit
if (AvRoomDataManager.get().isOpenPureMode) {
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
if (roomBoxPrizeAttachment.uid == AuthModel.get().currentUid) {
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
AvRoomDataManager.get().roomId.toString(),
roomBoxPrizeAttachment
)
IMNetEaseManager.get().addMessages(message)
}
} else {
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
AvRoomDataManager.get().roomId.toString(),
roomBoxPrizeAttachment
)
IMNetEaseManager.get().addMessages(message)
IMNetEaseManager.get().chatRoomEventObservable
.onNext(
RoomEvent()
.setEvent(RoomEvent.BOX_NOTIFY_SVGA)
.setChatRoomMessage(message)
)
}
}
CustomAttachment.CUSTOM_MSG_LUCKY_SEA -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
val attachment = RoomLuckySeaAttachment(
CustomAttachment.CUSTOM_MSG_LUCKY_SEA,
CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL
)
attachment.setRoomLuckySeaMsgBean(
JSON.parseObject(
baseProtocol.data.toString(),
RoomLuckySeaMsgBean::class.java
)
)
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
AvRoomDataManager.get().roomId.toString(),
attachment
)
IMNetEaseManager.get().addMessages(message)
IMNetEaseManager.get()
.noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY)
}
CustomAttachment.CUSTOM_MSG_LUCKY_GIFT -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.second == CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
val attachment =
RoomReceivedLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY)
attachment.luckyBagNoticeInfo = JSON.parseObject(
baseProtocol.data.toString(),
LuckyBagNoticeInfo::class.java
)
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
AvRoomDataManager.get().roomId.toString(),
attachment
)
IMNetEaseManager.get().noticeServiceLuckyBagNotice(message)
IMNetEaseManager.get().addMessages(message)
}
CustomAttachment.CUSTOM_MSG_FAIRY -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5) {
val attachment = FairyMsgAttachment(
CustomAttachment.CUSTOM_MSG_FAIRY,
CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5
)
attachment.fairyMsgInfo = JSON.parseObject(
baseProtocol.data.toString(),
FairyMsgInfoBean::class.java
)
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
AvRoomDataManager.get().roomId.toString(),
attachment
)
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.FAIRY_DRAW_GIFT_L5)
}
else -> {}
}
}
}

View File

@@ -12,7 +12,7 @@ class ExchangeDebrisAdapter :
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_prize_icon), item.rewardPicUrl)
helper.setText(R.id.tv_prize_name, item.getPrizeName())
helper.setText(R.id.tv_need_num, "${item.expendNum}")
helper.addOnClickListener(R.id.tv_exchange)
}

View File

@@ -0,0 +1,33 @@
package com.yizhuan.erban.treasurefairy.adapter
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.xchat_android_core.treasurefairy.ExchangeGiftInfo
import com.yizhuan.xchat_android_core.treasurefairy.PropItemInfo
class ExchangeSummonAdapter :
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_exchange_summon) {
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_prize_icon), item.rewardPicUrl)
helper.setText(R.id.tv_prize_name, item.getPrizeName())
val adapter: BaseQuickAdapter<PropItemInfo, BaseViewHolder> =
object : BaseQuickAdapter<PropItemInfo, BaseViewHolder>(R.layout.item_exchange_debris) {
override fun convert(helper: BaseViewHolder, item: PropItemInfo) {
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_icon), item.picUrl)
helper.setText(R.id.tv_num, "${item.propName}x${item.propNum}")
}
}
helper.getView<RecyclerView>(R.id.mRecyclerView).adapter = adapter
item.propItems?.let {
adapter.setNewData(it)
}
helper.addOnClickListener(R.id.tv_exchange)
}
}

View File

@@ -0,0 +1,25 @@
package com.yizhuan.erban.treasurefairy.adapter
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.load
import com.yizhuan.xchat_android_core.treasurefairy.FairyInfo
import java.util.*
class ResolveFairyAdapter :
BaseQuickAdapter<FairyInfo, BaseViewHolder>(R.layout.treasure_fairy_item_resolve_fairy) {
override fun convert(helper: BaseViewHolder, item: FairyInfo) {
helper.getView<ImageView>(R.id.iv_fairy_icon).load(item.elfPicUrl)
helper.setText(R.id.tv_fairy_num, "${item.selectedNum}/${item.elfNum}")
helper.setText(R.id.tv_fairy_name, item.elfName)
helper.setBackgroundRes(
R.id.ll_root,
if (item.selectedNum > 0) R.drawable.treasure_fairy_bg_test_fairy_item_select else 0
)
}
}

View File

@@ -0,0 +1,15 @@
package com.yizhuan.erban.treasurefairy.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R
import com.yizhuan.xchat_android_core.treasurefairy.ResolveInfo
class ResolveFairyResultAdapter :
BaseQuickAdapter<ResolveInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prize_single_resolve) {
override fun convert(helper: BaseViewHolder, item: ResolveInfo) {
helper.setText(R.id.tv_prize_name, "x${item.pieceNum}")
}
}

View File

@@ -13,6 +13,7 @@ import com.yizhuan.erban.databinding.TreasureFairyDialogExchangeBinding
import com.yizhuan.erban.treasurefairy.FairyViewModel
import com.yizhuan.erban.treasurefairy.fragment.ExchangeDebrisFragment
import com.yizhuan.erban.treasurefairy.fragment.ExchangeFairyFragment
import com.yizhuan.erban.treasurefairy.fragment.ExchangeSummonFragment
class ExchangeFairyDialog : BaseDialog<TreasureFairyDialogExchangeBinding>() {
@@ -32,31 +33,31 @@ class ExchangeFairyDialog : BaseDialog<TreasureFairyDialogExchangeBinding>() {
@SuppressLint("CheckResult")
override fun init() {
binding.ivBack.setOnClickListener {
binding?.ivBack?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.tvRecord.setOnClickListener {
binding?.tvRecord?.setOnClickListener {
ExchangeRecordDialog.newInstance().show(context)
}
binding.rg.setOnCheckedChangeListener { _, checkedId ->
binding?.rg?.setOnCheckedChangeListener { _, checkedId ->
when (checkedId) {
R.id.rb_epic -> binding.viewPager.currentItem = 0
R.id.rb_legend -> binding.viewPager.currentItem = 1
R.id.rb_epic -> binding?.viewPager?.currentItem = 0
R.id.rb_legend -> binding?.viewPager?.currentItem = 1
}
}
binding.viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
binding?.viewPager?.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
when (position) {
0 -> binding.rg.check(R.id.rb_epic)
1 -> binding.rg.check(R.id.rb_legend)
0 -> binding?.rg?.check(R.id.rb_epic)
1 -> binding?.rg?.check(R.id.rb_legend)
}
}
})
binding.viewPager.adapter = RoomVPAdapter(
binding?.viewPager?.adapter = RoomVPAdapter(
childFragmentManager,
listOf(
ExchangeFairyFragment.newInstance(),
ExchangeSummonFragment.newInstance(),
ExchangeDebrisFragment.newInstance()
)
)

View File

@@ -34,7 +34,7 @@ class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultB
@SuppressLint("CheckResult")
override fun init() {
binding.tvClose.setOnClickListener {
binding?.tvClose?.setOnClickListener {
dismissAllowingStateLoss()
}
val prizeInfoList = viewModel.exchangeGiftLiveData.value
@@ -46,7 +46,7 @@ class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultB
prizeAdapter = ExchangeFairyResultAdapter()
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
.setAdapter(prizeAdapter)
.setRecyclerView(binding.recyclerView)
.setRecyclerView(binding?.recyclerView)
.setLayoutManager(
LinearLayoutManager(context)
)

View File

@@ -30,24 +30,24 @@ class ExchangeRecordDialog : BaseDialog<TreasureFairyDialogExchangeRecordBinding
@SuppressLint("CheckResult")
override fun init() {
binding.rootView.setOnClickListener {
binding?.rootView?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.rg.setOnCheckedChangeListener { _, checkedId ->
binding?.rg?.setOnCheckedChangeListener { _, checkedId ->
when (checkedId) {
R.id.rb_prizes -> binding.viewPager.currentItem = 0
R.id.rb_record -> binding.viewPager.currentItem = 1
R.id.rb_prizes -> binding?.viewPager?.currentItem = 0
R.id.rb_record -> binding?.viewPager?.currentItem = 1
}
}
binding.viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
binding?.viewPager?.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
when (position) {
0 -> binding.rg.check(R.id.rb_prizes)
1 -> binding.rg.check(R.id.rb_record)
0 -> binding?.rg?.check(R.id.rb_prizes)
1 -> binding?.rg?.check(R.id.rb_record)
}
}
})
binding.viewPager.adapter = RoomVPAdapter(
binding?.viewPager?.adapter = RoomVPAdapter(
childFragmentManager,
listOf(
ExchangeFairyRecordFragment.newInstance(),

View File

@@ -0,0 +1,73 @@
package com.yizhuan.erban.treasurefairy.dialog
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.fragment.app.viewModels
import com.hjq.toast.ToastUtils
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.databinding.TreasureFairyDialogBuyDebrisBinding
import com.yizhuan.erban.treasurefairy.FairyViewModel
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_library.common.SpConstants
import com.yizhuan.xchat_android_library.common.util.SPUtils
import com.yizhuan.xchat_android_library.utils.TimeUtils
/**
* 购买碎片
*/
class FairyBuyDebrisDialog : BaseDialog<TreasureFairyDialogBuyDebrisBinding>() {
override var width = WindowManager.LayoutParams.MATCH_PARENT
override var height = WindowManager.LayoutParams.WRAP_CONTENT
override var gravity = Gravity.CENTER
private val viewModel: FairyViewModel by viewModels()
companion object {
fun newInstance(num: Int): FairyBuyDebrisDialog {
val args = Bundle()
args.putInt("num", num)
val fragment = FairyBuyDebrisDialog()
fragment.arguments = args
return fragment
}
}
private val num by lazy { requireArguments().getInt("num") }
@SuppressLint("CheckResult")
override fun init() {
binding?.tvDebrisNum?.text = getString(R.string.buy_debris, num)
binding?.tvPrizeName?.text = (num * 100).toString()
binding?.cbPay?.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
SPUtils.putLong(SpConstants.FAIRY_BUY_DEBRIS, System.currentTimeMillis())
} else {
SPUtils.putLong(SpConstants.FAIRY_BUY_DEBRIS, 0L)
}
}
binding?.tvBuy?.setOnClickListener {
viewModel.buyDebris(num.toString(), AuthModel.get().currentUid.toString())
}
viewModel.buyDebrisLiveData.observe(this) {
val date = SPUtils.getLong(SpConstants.FAIRY_BUY_SUCCESS, 0L)
if (date != 0L) {
if (TimeUtils.isToday(date)) {
ToastUtils.show("購買碎片成功")
} else {
FairyBuySuccessDialog.newInstance(num).show(context)
}
} else {
FairyBuySuccessDialog.newInstance(num).show(context)
}
dismissAllowingStateLoss()
}
}
}

View File

@@ -0,0 +1,48 @@
package com.yizhuan.erban.treasurefairy.dialog
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.fragment.app.activityViewModels
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.databinding.TreasureFairyDialogBuySuccessBinding
import com.yizhuan.erban.treasurefairy.FairyViewModel
import com.yizhuan.xchat_android_library.common.SpConstants
import com.yizhuan.xchat_android_library.common.util.SPUtils
/**
* 购买碎片成功
*/
class FairyBuySuccessDialog : BaseDialog<TreasureFairyDialogBuySuccessBinding>() {
override var width = WindowManager.LayoutParams.MATCH_PARENT
override var height = WindowManager.LayoutParams.WRAP_CONTENT
override var gravity = Gravity.CENTER
companion object {
fun newInstance(num: Int): FairyBuySuccessDialog {
val args = Bundle()
args.putSerializable("num", num)
val fragment = FairyBuySuccessDialog()
fragment.arguments = args
return fragment
}
}
private val num by lazy { requireArguments().getInt("num") }
@SuppressLint("CheckResult", "SetTextI18n")
override fun init() {
binding?.tvDebrisNum?.text = "x${num}"
binding?.cbPay?.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
SPUtils.putLong(SpConstants.FAIRY_BUY_SUCCESS, System.currentTimeMillis())
} else {
SPUtils.putLong(SpConstants.FAIRY_BUY_SUCCESS, 0L)
}
}
}
}

View File

@@ -50,51 +50,51 @@ class ForestFairyDialog : BaseDialog<TreasureFairyDialogForestBinding>() {
@SuppressLint("CheckResult")
override fun init() {
binding.ivBack.setOnClickListener {
binding?.ivBack?.setOnClickListener {
dismissAllowingStateLoss()
}
binding.ivRecord.setOnClickListener {
binding?.ivRecord?.setOnClickListener {
ForestRecordDialog.newInstance().show(context)
}
binding.ivMyFairy.setOnClickListener {
binding?.ivMyFairy?.setOnClickListener {
MyFairyDialog.newInstance().show(context)
}
binding.ivFairyTest.setOnClickListener {
binding?.ivFairyTest?.setOnClickListener {
TestFairyDialog.newInstance().show(context)
}
binding.ivFairyStore.setOnClickListener {
binding?.ivFairyStore?.setOnClickListener {
ExchangeFairyDialog.newInstance().show(context)
}
binding.ivPrevious.setOnClickListener {
binding?.ivPrevious?.setOnClickListener {
currentType--
switchType()
}
binding.ivNext.setOnClickListener {
binding?.ivNext?.setOnClickListener {
currentType++
switchType()
}
binding.viewBgGrab1.setOnClickListener {
binding?.viewBgGrab1?.setOnClickListener {
if (checkBallNum(1)) {
enabledOpenBtn(false)
binding.animView.startPlay(requireContext().assets, "vap/fairy_anim_once.mp4")
binding.animView.postDelayed(showResultRunnable, 1900)
binding?.animView?.startPlay(requireContext().assets, "vap/fairy_anim_once.mp4")
binding?.animView?.postDelayed(showResultRunnable, 1900)
viewModel.drawForestFairy(1, currentType)
}
}
binding.viewBgGrab10.setOnClickListener {
binding?.viewBgGrab10?.setOnClickListener {
if (checkBallNum(10)) {
enabledOpenBtn(false)
binding.animView.startPlay(requireContext().assets, "vap/fairy_anim_ten.mp4")
binding.animView.postDelayed(showResultRunnable, 1900)
binding?.animView?.startPlay(requireContext().assets, "vap/fairy_anim_ten.mp4")
binding?.animView?.postDelayed(showResultRunnable, 1900)
viewModel.drawForestFairy(10, currentType)
}
}
binding.animView.setOnClickListener {
binding?.animView?.setOnClickListener {
if (canShowResult) {
binding.animView.removeCallbacks(showResultRunnable)
binding?.animView?.removeCallbacks(showResultRunnable)
showResultRunnable.run()
}
}
@@ -114,11 +114,11 @@ class ForestFairyDialog : BaseDialog<TreasureFairyDialogForestBinding>() {
viewModel.forestInfoLiveData.observe(viewLifecycleOwner) {
it?.let {
binding.ivAvatar.loadAvatar(it.avatar)
binding.tvNickname.text = it.nick.subAndReplaceDot(7)
binding.tvKeyNumBase.text = it.lowBallNum
binding.tvKeyNumEpic.text = it.middleBallNum
binding.tvKeyNumLegend.text = it.highBallNum
binding?.ivAvatar?.loadAvatar(it.avatar)
binding?.tvNickname?.text = it.nick.subAndReplaceDot(7)
binding?.tvKeyNumBase?.text = it.lowBallNum
binding?.tvKeyNumEpic?.text = it.middleBallNum
binding?.tvKeyNumLegend?.text = it.highBallNum
}
}
@@ -141,34 +141,34 @@ class ForestFairyDialog : BaseDialog<TreasureFairyDialogForestBinding>() {
}
private fun enabledOpenBtn(enable: Boolean) {
binding.viewBgGrab1.isEnabled = enable
binding.viewBgGrab10.isEnabled = enable
binding?.viewBgGrab1?.isEnabled = enable
binding?.viewBgGrab10?.isEnabled = enable
}
@SuppressLint("SetTextI18n")
private fun switchType() {
when (currentType) {
BASE -> {
binding.ivPrevious.isInvisible = true
binding.tvGrabText1.text = "(初級球X1)"
binding.tvGrabText10.text = "(初級球X10)"
binding.tvTips.text = "使用初級球有一定幾率抓到初級精靈"
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_base)
binding?.ivPrevious?.isInvisible = true
binding?.tvGrabText1?.text = "(初級球X1)"
binding?.tvGrabText10?.text = "(初級球X10)"
binding?.tvTips?.text = "使用初級球有一定幾率抓到初級精靈"
binding?.viewBgForestBase?.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_base)
}
EPIC -> {
binding.ivNext.isInvisible = false
binding.ivPrevious.isInvisible = false
binding.tvGrabText1.text = "(超級球X1)"
binding.tvGrabText10.text = "(超級球X10)"
binding.tvTips.text = "使用超級球有一定幾率抓到史詩精靈"
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_epic)
binding?.ivNext?.isInvisible = false
binding?.ivPrevious?.isInvisible = false
binding?.tvGrabText1?.text = "(超級球X1)"
binding?.tvGrabText10?.text = "(超級球X10)"
binding?.tvTips?.text = "使用超級球有一定幾率抓到史詩精靈"
binding?.viewBgForestBase?.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_epic)
}
LEGEND -> {
binding.ivNext.isInvisible = true
binding.tvGrabText1.text = "(大師球X1)"
binding.tvGrabText10.text = "(大師球X10)"
binding.tvTips.text = "使用大師球必定抓到傳說精靈"
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_legend)
binding?.ivNext?.isInvisible = true
binding?.tvGrabText1?.text = "(大師球X1)"
binding?.tvGrabText10?.text = "(大師球X10)"
binding?.tvTips?.text = "使用大師球必定抓到傳說精靈"
binding?.viewBgForestBase?.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_legend)
}
}
}

Some files were not shown because too many files have changed in this diff Show More