Compare commits
104 Commits
dev/app_bo
...
peko_relea
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cae5ccce7a | ||
![]() |
6bd857b97d | ||
![]() |
502a2f20b9 | ||
![]() |
74a7ccecfc | ||
![]() |
d4f65da89e | ||
![]() |
bbb6a21cb9 | ||
![]() |
098bf777d7 | ||
![]() |
6f1165dc37 | ||
![]() |
5c4c4cc284 | ||
![]() |
6b7adc5950 | ||
![]() |
87b81b7761 | ||
![]() |
842bf98958 | ||
![]() |
f110a47c0e | ||
![]() |
160e5025b8 | ||
![]() |
9ec8385544 | ||
![]() |
13106a62e4 | ||
![]() |
7a677c96cd | ||
![]() |
7093cfa7f3 | ||
![]() |
3747c10dc1 | ||
![]() |
d9e3c32f1b | ||
![]() |
9891c6f9d0 | ||
![]() |
f721e34139 | ||
![]() |
069eb3e89c | ||
![]() |
8ae154cf09 | ||
![]() |
6b90fedb8b | ||
![]() |
cee6060d62 | ||
![]() |
0acd6f9c88 | ||
![]() |
9a075db5d5 | ||
![]() |
592dbc78f3 | ||
![]() |
c3bf0b9451 | ||
![]() |
82ad02f2a7 | ||
![]() |
fb6d784c1d | ||
![]() |
3e4d9654c9 | ||
![]() |
923e598344 | ||
![]() |
5de48352c5 | ||
![]() |
5140a70569 | ||
![]() |
0e405f5bda | ||
![]() |
d5be4ace02 | ||
![]() |
4475d622fd | ||
![]() |
03faea9138 | ||
![]() |
37afa710fe | ||
![]() |
6a71670b84 | ||
![]() |
615089d1e1 | ||
![]() |
47b38458df | ||
![]() |
91be03ea07 | ||
![]() |
f7a500770a | ||
![]() |
d82bb55c4e | ||
![]() |
dc1383be70 | ||
![]() |
368ed2bf70 | ||
![]() |
d595ed469e | ||
![]() |
792ad5141c | ||
![]() |
de6a4fe524 | ||
![]() |
d0cb9e43b1 | ||
![]() |
ef8d9b0b6f | ||
![]() |
e781369be1 | ||
![]() |
3bd13e732a | ||
![]() |
67babbaebd | ||
![]() |
c392b20f21 | ||
![]() |
0a1ae82d42 | ||
![]() |
6dc63e1d26 | ||
![]() |
2dcbcf7179 | ||
![]() |
bcd6faf213 | ||
![]() |
072c837c99 | ||
![]() |
067f97d6be | ||
![]() |
15b317d5d0 | ||
![]() |
16712197e3 | ||
![]() |
24ccadc593 | ||
![]() |
88767208bd | ||
![]() |
91bb8f7871 | ||
![]() |
dedb075c56 | ||
![]() |
1b1f477494 | ||
![]() |
9a015aff0b | ||
![]() |
9500554550 | ||
![]() |
23e05ccab1 | ||
![]() |
0417e53b85 | ||
![]() |
df96cfe5d4 | ||
![]() |
213efcba31 | ||
![]() |
9e36225b77 | ||
![]() |
da3d72ebff | ||
![]() |
fd3dc7cb3c | ||
![]() |
eebe231a45 | ||
![]() |
276f2002f9 | ||
![]() |
2942e2f0bb | ||
![]() |
406077b43b | ||
![]() |
55a8d037e0 | ||
![]() |
ba58b0bd40 | ||
![]() |
151b1c37d0 | ||
![]() |
4a7af141aa | ||
![]() |
cec6e00e09 | ||
![]() |
bf6ef26eca | ||
![]() |
07845b5e60 | ||
![]() |
097ead1327 | ||
![]() |
2b45d35d40 | ||
![]() |
e6f4b40e66 | ||
![]() |
c46f19f03f | ||
![]() |
37196025cc | ||
![]() |
9096a9b57f | ||
![]() |
c46c49715c | ||
![]() |
31b785c511 | ||
![]() |
6f01c5ddad | ||
![]() |
306f15f7f9 | ||
![]() |
0babbedeb9 | ||
![]() |
d09e60d206 | ||
![]() |
e37796286b |
@@ -60,7 +60,7 @@ android {
|
|||||||
if (abi == null) {
|
if (abi == null) {
|
||||||
abi = "universal"
|
abi = "universal"
|
||||||
}
|
}
|
||||||
outputFileName = "piko_${buildType.name}_v${defaultConfig.versionName}_${abi}_${date}.apk"
|
outputFileName = "piko_${buildType.name}_v${defaultConfig.versionName}_${defaultConfig.versionCode}_${abi}_${date}.apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'com.github.fodroid:XRadioGroup:v1.5'
|
implementation 'com.github.fodroid:XRadioGroup:v1.5'
|
||||||
|
|
||||||
api 'com.tencent.vasdolly:helper:3.0.3'
|
api 'com.tencent.vasdolly:helper:3.0.6'
|
||||||
implementation "io.github.tencent:vap:2.0.24"
|
implementation "io.github.tencent:vap:2.0.24"
|
||||||
|
|
||||||
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
|
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
|
||||||
@@ -303,6 +303,7 @@ dependencies {
|
|||||||
implementation 'com.contrarywind:wheelview:4.1.0'
|
implementation 'com.contrarywind:wheelview:4.1.0'
|
||||||
|
|
||||||
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
|
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
|
||||||
|
implementation 'com.google.android.material:material:1.9.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
channel {
|
channel {
|
||||||
|
@@ -355,6 +355,24 @@
|
|||||||
android:name=".ui.webview.CommonWebViewActivity"
|
android:name=".ui.webview.CommonWebViewActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.wallet.PaymentResultActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/transparent_activity"
|
||||||
|
android:windowSoftInputMode="adjustPan">
|
||||||
|
<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:host="payment"
|
||||||
|
android:path="/result"
|
||||||
|
android:scheme="pekoapp" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.webview.SimpleWebViewActivity"
|
android:name=".ui.webview.SimpleWebViewActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
@@ -521,7 +539,7 @@
|
|||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".treasure_box.activity.TreasureBoxActivity"
|
android:name=".treasure_box.activity.TreasureBoxActivity"
|
||||||
android:theme="@style/dialog_web_view_activity" />
|
android:theme="@style/transparent_activity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".treasure_box.activity.BoxRankingActivity"
|
android:name=".treasure_box.activity.BoxRankingActivity"
|
||||||
android:theme="@style/room_message_activity" />
|
android:theme="@style/room_message_activity" />
|
||||||
@@ -825,10 +843,18 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.webview.DialogWebViewActivity"
|
android:name=".ui.webview.DialogWebViewActivity"
|
||||||
android:theme="@style/dialog_web_view_activity"
|
android:theme="@style/dialog_web_view_activity"
|
||||||
android:windowSoftInputMode="adjustPan" /> <!-- 隐私政策 -->
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.webview.room_banner.RoomWebDialogActivity"
|
||||||
|
android:theme="@style/room_dialog_web_view_activity"
|
||||||
|
android:windowSoftInputMode="adjustPan" /><!-- 隐私政策 -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.webview.DatingRuleWebViewActivity"
|
android:name=".ui.webview.DatingRuleWebViewActivity"
|
||||||
android:theme="@style/dialog_web_view_activity" />
|
android:theme="@style/dialog_web_view_activity" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.webview.room_banner.RoomBannerWebDialogActivity"
|
||||||
|
android:theme="@style/dialog_web_view_activity"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.webview.TarotPayWebViewActivity"
|
android:name=".ui.webview.TarotPayWebViewActivity"
|
||||||
android:theme="@style/dialog_web_view_activity" />
|
android:theme="@style/dialog_web_view_activity" />
|
||||||
|
1
app/src/main/assets/hot_region.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[{"name":"Taiwan","abbr":"TW","mcc":"466","code":"886"},{"name":"Hong Kong","abbr":"HK","mcc":"454","code":"852"},{"name":"Singapore","abbr":"SG","mcc":"525","code":"65"},{"name":"Malaysia","abbr":"MY","mcc":"502","code":"60"},{"name":"China","abbr":"CN","mcc":"460","code":"86"}]
|
1
app/src/main/assets/region.json
Normal file
BIN
app/src/main/assets/svga/room_bg_single.svga
Normal file
BIN
app/src/main/assets/svga/zoo_notify.svga
Normal file
@@ -410,6 +410,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
}
|
}
|
||||||
onParseIntent();
|
onParseIntent();
|
||||||
handleNimIntent();
|
handleNimIntent();
|
||||||
|
InitialModel.get().regionCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onParseIntent() {
|
private void onParseIntent() {
|
||||||
@@ -519,6 +520,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
||||||
firstLoadedUserInfo();
|
firstLoadedUserInfo();
|
||||||
|
InitialModel.get().regionCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLogout() {
|
public void onLogout() {
|
||||||
|
@@ -16,6 +16,8 @@ import android.util.Log;
|
|||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
|
|
||||||
import com.bumptech.glide.request.target.ViewTarget;
|
import com.bumptech.glide.request.target.ViewTarget;
|
||||||
|
import com.chuhai.utils.LanguageUtils;
|
||||||
|
import com.chuhai.utils.ServiceTime;
|
||||||
import com.coorchice.library.utils.LogUtils;
|
import com.coorchice.library.utils.LogUtils;
|
||||||
import com.facebook.stetho.Stetho;
|
import com.facebook.stetho.Stetho;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
@@ -114,6 +116,9 @@ import io.realm.RealmConfiguration;
|
|||||||
public class XChatApplication extends BaseApp {
|
public class XChatApplication extends BaseApp {
|
||||||
public static final String TAG = "XChatApplication";
|
public static final String TAG = "XChatApplication";
|
||||||
public static Application gContext;
|
public static Application gContext;
|
||||||
|
|
||||||
|
// 接收到退出登录事件(跳转到登录页了)
|
||||||
|
private static long logoutEventTime = 0;
|
||||||
private static final MessageNotifierCustomization messageNotifierCustomization = new MessageNotifierCustomization() {
|
private static final MessageNotifierCustomization messageNotifierCustomization = new MessageNotifierCustomization() {
|
||||||
@Override
|
@Override
|
||||||
public String makeNotifyContent(String nick, IMMessage message) {
|
public String makeNotifyContent(String nick, IMMessage message) {
|
||||||
@@ -202,10 +207,11 @@ public class XChatApplication extends BaseApp {
|
|||||||
|
|
||||||
String channel = "";
|
String channel = "";
|
||||||
channel = ChannelReaderUtil.getChannel(instance);
|
channel = ChannelReaderUtil.getChannel(instance);
|
||||||
|
Log.d(TAG, "localChannel:" + channel);
|
||||||
if (TextUtils.isEmpty(channel)) {
|
if (TextUtils.isEmpty(channel)) {
|
||||||
channel = Constants.GOOGLE;
|
channel = Constants.GOOGLE;
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "finalChannel:" + channel);
|
||||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||||
|
|
||||||
BasicConfig.INSTANCE.setChannel(channel);
|
BasicConfig.INSTANCE.setChannel(channel);
|
||||||
@@ -244,6 +250,13 @@ public class XChatApplication extends BaseApp {
|
|||||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||||
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
||||||
throw new ServerException(serviceResult.getMessage(), serviceResult.getCode());
|
throw new ServerException(serviceResult.getMessage(), serviceResult.getCode());
|
||||||
|
} else if (serviceResult.getCode() == 401) {
|
||||||
|
if ((ServiceTime.INSTANCE.getTime() - logoutEventTime) > 800) {
|
||||||
|
logoutEventTime = ServiceTime.INSTANCE.getTime();
|
||||||
|
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||||
|
AuthModel.get().cleanLogInfo();
|
||||||
|
}
|
||||||
|
throw new ServerException(serviceResult.getMessage(), serviceResult.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -403,6 +416,7 @@ public class XChatApplication extends BaseApp {
|
|||||||
httpParams.put("deviceId", DeviceUuidFactory.getDeviceId(context));
|
httpParams.put("deviceId", DeviceUuidFactory.getDeviceId(context));
|
||||||
httpParams.put("androidId", MD5Utils.getMD5String(Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID)));
|
httpParams.put("androidId", MD5Utils.getMD5String(Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID)));
|
||||||
httpParams.put("channel", AppMetaDataUtil.getChannelID());
|
httpParams.put("channel", AppMetaDataUtil.getChannelID());
|
||||||
|
httpParams.put("lang", LanguageUtils.INSTANCE.getSystemLanguage().toLanguageTag());
|
||||||
RxNet.init(context)
|
RxNet.init(context)
|
||||||
.debug(BuildConfig.DEBUG)
|
.debug(BuildConfig.DEBUG)
|
||||||
.setBaseUrl(url)
|
.setBaseUrl(url)
|
||||||
|
@@ -3,6 +3,8 @@ package com.yizhuan.erban.avroom.activity;
|
|||||||
import static android.view.View.VISIBLE;
|
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_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_BOX;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CRAZY_ZOO;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM;
|
||||||
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_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_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;
|
||||||
@@ -14,6 +16,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
|||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
|
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_DRAW_GIFT_L5;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -107,6 +111,8 @@ 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.RoomPKAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
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.RoomReceivedLuckyGiftAttachment;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTemplateNotifyAttachment;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTemplateNotifyMsgBean;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
|
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.im.custom.bean.TarotMsgBean;
|
||||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||||
@@ -140,6 +146,7 @@ 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.super_admin.util.SuperAdminUtil;
|
||||||
import com.yizhuan.xchat_android_core.support.room.RoomContext;
|
import com.yizhuan.xchat_android_core.support.room.RoomContext;
|
||||||
import com.yizhuan.xchat_android_core.support.room.RoomView;
|
import com.yizhuan.xchat_android_core.support.room.RoomView;
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomWidget;
|
||||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
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.FirstChargeInfo;
|
||||||
@@ -225,6 +232,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
private SingleRoomTipDialog singleRoomTipDialog;
|
private SingleRoomTipDialog singleRoomTipDialog;
|
||||||
// 通过红包进来时,有该参数
|
// 通过红包进来时,有该参数
|
||||||
private RedPackageNotifyInfo redPackageNotifyInfo;
|
private RedPackageNotifyInfo redPackageNotifyInfo;
|
||||||
|
|
||||||
|
// 是否禁用VP滑动(true:不允许滑动;false:某些条件下可以滑动)
|
||||||
|
private boolean viewPagerInputDisable;
|
||||||
|
|
||||||
public static void start(Context context, long roomUid) {
|
public static void start(Context context, long roomUid) {
|
||||||
startForFromType(context, roomUid, FROM_TYPE_NORMAL, null, null);
|
startForFromType(context, roomUid, FROM_TYPE_NORMAL, null, null);
|
||||||
}
|
}
|
||||||
@@ -319,7 +330,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
}
|
}
|
||||||
} else if (roomInfo.getType() == RoomInfo.ROOM_TYPE_SINGLE) {
|
} else if (roomInfo.getType() == RoomInfo.ROOM_TYPE_SINGLE) {
|
||||||
bgPicture[0] = "";
|
bgPicture[0] = "";
|
||||||
svgaRoomBg.setImageResource(R.drawable.bg_room_single_pic);
|
// svgaRoomBg.setImageResource(R.drawable.bg_room_single_pic);
|
||||||
|
playSvgaBg(svgaRoomBg, "svga/room_bg_single.svga");
|
||||||
} else {
|
} else {
|
||||||
bgPicture[0] = "";
|
bgPicture[0] = "";
|
||||||
if (roomInfo.getRoomModeType() == RoomModeType.OPEN_PK_MODE) {
|
if (roomInfo.getRoomModeType() == RoomModeType.OPEN_PK_MODE) {
|
||||||
@@ -396,7 +408,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
public void setCurrentItem(int item) {
|
public void setCurrentItem(int item) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
if (viewpager != null) {
|
if (viewpager != null) {
|
||||||
viewpager.setUserInputEnabled(true);
|
tryEnabledViewPagerInput();
|
||||||
viewpager.setCurrentItem(item, false);
|
viewpager.setCurrentItem(item, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,7 +423,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
Object notifyInfo = intent.getSerializableExtra("notifyInfo");
|
Object notifyInfo = intent.getSerializableExtra("notifyInfo");
|
||||||
if (notifyInfo instanceof RedPackageNotifyInfo) {
|
if (notifyInfo instanceof RedPackageNotifyInfo) {
|
||||||
redPackageNotifyInfo = (RedPackageNotifyInfo) notifyInfo;
|
redPackageNotifyInfo = (RedPackageNotifyInfo) notifyInfo;
|
||||||
}else{
|
} else {
|
||||||
redPackageNotifyInfo = null;
|
redPackageNotifyInfo = null;
|
||||||
}
|
}
|
||||||
if (mRoomInfo != null) {
|
if (mRoomInfo != null) {
|
||||||
@@ -445,7 +457,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
viewpager.setOffscreenPageLimit(2);
|
viewpager.setOffscreenPageLimit(2);
|
||||||
viewpager.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
|
viewpager.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
|
||||||
viewpager.getChildAt(0).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
viewpager.getChildAt(0).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||||
viewpager.setUserInputEnabled(false);
|
disableViewPagerInput();
|
||||||
viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
@@ -472,11 +484,11 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
if (state == 0 && viewpager.getCurrentItem() == 2) {
|
if (state == 0 && viewpager.getCurrentItem() == 2) {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
((FakeSingleRoomFragment) mAdapter.getItem(2)).tryJumpRoom();
|
((FakeSingleRoomFragment) mAdapter.getItem(2)).tryJumpRoom();
|
||||||
viewpager.setUserInputEnabled(false);
|
disableViewPagerInput();
|
||||||
} else if (state == 0 && viewpager.getCurrentItem() == 0) {
|
} else if (state == 0 && viewpager.getCurrentItem() == 0) {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
((FakeSingleRoomBackFragment) mAdapter.getItem(0)).tryJumpRoom();
|
((FakeSingleRoomBackFragment) mAdapter.getItem(0)).tryJumpRoom();
|
||||||
viewpager.setUserInputEnabled(false);
|
disableViewPagerInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -615,6 +627,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
case RoomEvent.MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN:
|
case RoomEvent.MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN:
|
||||||
toBack(true);
|
toBack(true);
|
||||||
break;
|
break;
|
||||||
|
case RoomEvent.FAIRY_DRAW_GIFT_L5:
|
||||||
|
ChatRoomMessage message = roomEvent.getChatRoomMessage();
|
||||||
|
if (message != null) {
|
||||||
|
IMNetEaseManager.get().addMessages(message);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,7 +681,14 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
*/
|
*/
|
||||||
private void showRoomFragment(boolean isRoomMin) {
|
private void showRoomFragment(boolean isRoomMin) {
|
||||||
mCurrentFragment = (HomePartyFragment) mAdapter.getItem(1);
|
mCurrentFragment = (HomePartyFragment) mAdapter.getItem(1);
|
||||||
viewpager.setUserInputEnabled(AvRoomDataManager.get().isSingleRoom());
|
mCurrentFragment.getPlayNotifyState().observe(getLifecycleOwner(), aBoolean -> {
|
||||||
|
if (!aBoolean) {
|
||||||
|
if (isValid()) {
|
||||||
|
showGiftDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tryEnabledViewPagerInput();
|
||||||
viewpager.setCurrentItem(1, false);
|
viewpager.setCurrentItem(1, false);
|
||||||
if (isRoomMin) {
|
if (isRoomMin) {
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
@@ -1196,17 +1221,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
return;
|
return;
|
||||||
giftList.add(data);
|
giftList.add(data);
|
||||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||||
if (giftDialog != null && giftDialog.isShowing()) {
|
if (mCurrentFragment != null && mCurrentFragment.isShowingPlayNotify()) {
|
||||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
return;
|
||||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
|
||||||
if (dataBean != null) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
giftDialog.dismiss();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showGiftDialog();
|
|
||||||
}
|
}
|
||||||
|
showGiftDialog();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CUSTOM_MSG_BOX://寻爱之旅
|
case CUSTOM_MSG_BOX://寻爱之旅
|
||||||
@@ -1273,6 +1291,22 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
|
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_MSG_CRAZY_ZOO://疯狂动物园
|
||||||
|
if (baseProtocol.getSecond() == CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM) {
|
||||||
|
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_CRAZY_ZOO, CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM);
|
||||||
|
attachment.setRoomLuckySeaMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class));
|
||||||
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
||||||
|
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.CRAZY_ZOO_ALL_ROOM_NOTIFY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CUSTOM_MSG_TEMPLATE_NOTIFY://通用飘屏
|
||||||
|
if (baseProtocol.getSecond() == CUSTOM_MSG_TEMPLATE_NOTIFY_ALL) {
|
||||||
|
RoomTemplateNotifyAttachment attachment = new RoomTemplateNotifyAttachment(CUSTOM_MSG_TEMPLATE_NOTIFY, CUSTOM_MSG_TEMPLATE_NOTIFY_ALL);
|
||||||
|
attachment.setMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomTemplateNotifyMsgBean.class));
|
||||||
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
||||||
|
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.TEMPLATE_NOTIFY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CUSTOM_MSG_LUCKY_GIFT://福袋
|
case CUSTOM_MSG_LUCKY_GIFT://福袋
|
||||||
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
|
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);
|
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
|
||||||
@@ -1303,10 +1337,23 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowingGiftNotify() {
|
||||||
|
if (giftDialog != null && giftDialog.isShowing()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showGiftDialog() {
|
private void showGiftDialog() {
|
||||||
|
if (!isValid()) return;
|
||||||
|
if (giftList == null) return;
|
||||||
if (giftList.size() == 0) return;
|
if (giftList.size() == 0) return;
|
||||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
if (giftDialog != null && giftDialog.isShowing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
giftDialog = generateAllServiceGiftDialog(this, data);
|
giftDialog = generateAllServiceGiftDialog(this, data);
|
||||||
giftDialog.setOnDismissListener(dialog -> {
|
giftDialog.setOnDismissListener(dialog -> {
|
||||||
giftList.pollFirst();
|
giftList.pollFirst();
|
||||||
@@ -1395,6 +1442,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public RoomWidget findWidget(@NonNull String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static class GiftBroadcastObserver implements Observer<BroadcastMessage> {
|
private static class GiftBroadcastObserver implements Observer<BroadcastMessage> {
|
||||||
private WeakReference<AVRoomActivity> mReference;
|
private WeakReference<AVRoomActivity> mReference;
|
||||||
|
|
||||||
@@ -1427,4 +1480,41 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
|
||||||
|
super.onReceiveChatRoomEvent(roomEvent);
|
||||||
|
switch (roomEvent.getEvent()) {
|
||||||
|
case RoomEvent.UP_MIC:
|
||||||
|
case RoomEvent.DOWN_MIC:
|
||||||
|
resetViewPagerInputEnabled();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用VP滑动
|
||||||
|
*/
|
||||||
|
private void disableViewPagerInput() {
|
||||||
|
this.viewPagerInputDisable = true;
|
||||||
|
resetViewPagerInputEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tryEnabledViewPagerInput() {
|
||||||
|
this.viewPagerInputDisable = false;
|
||||||
|
resetViewPagerInputEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetViewPagerInputEnabled() {
|
||||||
|
if (viewPagerInputDisable) {
|
||||||
|
viewpager.setUserInputEnabled(false);
|
||||||
|
} else {
|
||||||
|
if (AvRoomDataManager.get().isSingleRoom() && !AvRoomDataManager.get().isOwnerOnMic()) {
|
||||||
|
// 个播+没在麦位=可以滑动
|
||||||
|
viewpager.setUserInputEnabled(true);
|
||||||
|
} else {
|
||||||
|
viewpager.setUserInputEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@@ -21,6 +21,7 @@ import com.yizhuan.erban.base.BaseMvpActivity;
|
|||||||
import com.yizhuan.xchat_android_core.Constants;
|
import com.yizhuan.xchat_android_core.Constants;
|
||||||
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomOnlineUserBean;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||||
@@ -107,10 +108,11 @@ public class RoomInviteActivity extends BaseMvpActivity<IRoomInviteView, RoomInv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestChatMemberByPageSuccess(List<OnlineChatMember> memberList, int page) {
|
public void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
||||||
mPage = page;
|
mPage = page;
|
||||||
|
@@ -527,7 +527,7 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
/**
|
/**
|
||||||
* 主席位特有
|
* 主席位特有
|
||||||
*/
|
*/
|
||||||
FrameLayout frTitle;
|
View frTitle;
|
||||||
TextView tvRoomDesc;
|
TextView tvRoomDesc;
|
||||||
ImageView ivTag;
|
ImageView ivTag;
|
||||||
TextView tvLabelLeaveMode;
|
TextView tvLabelLeaveMode;
|
||||||
|
@@ -12,27 +12,20 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.netease.nim.uikit.impl.cache.NimUserInfoCache;
|
|
||||||
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
|
||||||
import com.netease.nimlib.sdk.uinfo.constant.GenderEnum;
|
|
||||||
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
||||||
|
import com.yizhuan.erban.utils.NamePlateHelper;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.level.UserLevelResourceType;
|
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||||
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
|
||||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
|
||||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
import com.yizhuan.xchat_android_core.room.bean.RoomOnlineUserBean;
|
||||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,19 +34,17 @@ import io.reactivex.disposables.Disposable;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @date 2017/12/4
|
* @date 2017/12/4
|
||||||
*/
|
*/
|
||||||
public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMember, BaseViewHolder> {
|
public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<RoomOnlineUserBean, BaseViewHolder> {
|
||||||
|
|
||||||
private boolean mIsHomeParty;
|
private boolean mIsHomeParty;
|
||||||
private Disposable mDisposable;
|
private Disposable mDisposable;
|
||||||
private Context context;
|
|
||||||
private OnRoomOnlineNumberChangeListener mListener;
|
private OnRoomOnlineNumberChangeListener mListener;
|
||||||
|
|
||||||
public OnlineUserAdapter(Context context, boolean isHomeParty) {
|
public OnlineUserAdapter(Context context, boolean isHomeParty) {
|
||||||
super(null);
|
super(null);
|
||||||
addItemType(OnlineChatMember.NORMAL, R.layout.list_item_online_user);
|
addItemType(RoomOnlineUserBean.NORMAL, R.layout.list_item_online_user);
|
||||||
addItemType(OnlineChatMember.NOBLE, R.layout.list_item_online_user_mystery);
|
addItemType(RoomOnlineUserBean.NOBLE, R.layout.list_item_online_user_mystery);
|
||||||
mIsHomeParty = isHomeParty;
|
mIsHomeParty = isHomeParty;
|
||||||
this.context = context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,147 +54,76 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void convert(@NonNull BaseViewHolder baseViewHolder, OnlineChatMember onlineChatMember) {
|
protected void convert(@NonNull BaseViewHolder helper, RoomOnlineUserBean item) {
|
||||||
if (onlineChatMember != null && onlineChatMember.chatRoomMember != null) {
|
if (item.getItemType() == OnlineChatMember.NOBLE) {
|
||||||
if (onlineChatMember.getItemType() == OnlineChatMember.NORMAL) {
|
return;
|
||||||
setNormalData(baseViewHolder, onlineChatMember);
|
}
|
||||||
} else {
|
// 性别
|
||||||
setMysteryData();
|
final ImageView sexImage = helper.getView(R.id.sex);
|
||||||
}
|
if (item.getGender() == 1) {
|
||||||
|
sexImage.setVisibility(View.VISIBLE);
|
||||||
|
sexImage.setImageResource(R.drawable.ic_gender_male);
|
||||||
|
} else if (item.getGender() == 2) {
|
||||||
|
sexImage.setVisibility(View.VISIBLE);
|
||||||
|
sexImage.setImageResource(R.drawable.ic_gender_female);
|
||||||
|
} else {
|
||||||
|
sexImage.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setMysteryData() {
|
// 昵称
|
||||||
//do nothing
|
helper.setText(R.id.nick, RegexUtil.getPrintableString(item.getNick()));
|
||||||
}
|
|
||||||
|
|
||||||
private void setNormalData(BaseViewHolder baseViewHolder, OnlineChatMember onlineChatMember) {
|
// 头像
|
||||||
setSexData(baseViewHolder, onlineChatMember);
|
NobleAvatarView nobleAvatarView = helper.getView(R.id.noble_avatar_view);
|
||||||
|
|
||||||
ImageView roomOnlineTag = baseViewHolder.getView(R.id.room_online_tag);
|
|
||||||
ImageView managerLogo = baseViewHolder.getView(R.id.manager_logo);
|
|
||||||
roomOnlineTag.setVisibility(onlineChatMember.isOnMic ? View.VISIBLE : View.GONE);
|
|
||||||
managerLogo.setVisibility((onlineChatMember.isAdmin || onlineChatMember.isRoomOwer)
|
|
||||||
? View.VISIBLE : View.GONE);
|
|
||||||
managerLogo.setImageResource(onlineChatMember.isAdmin ? R.drawable.icon_admin_logo
|
|
||||||
: R.drawable.icon_user_list_room_ownner);
|
|
||||||
|
|
||||||
baseViewHolder.setText(R.id.nick, RegexUtil.getPrintableString(onlineChatMember.chatRoomMember.getNick()));
|
|
||||||
|
|
||||||
NobleAvatarView nobleAvatarView = baseViewHolder.getView(R.id.noble_avatar_view);
|
|
||||||
nobleAvatarView.setSize(37, 54, 0);
|
nobleAvatarView.setSize(37, 54, 0);
|
||||||
nobleAvatarView.setData(onlineChatMember.chatRoomMember);
|
nobleAvatarView.setData(item);
|
||||||
|
|
||||||
// 官字
|
// 官字
|
||||||
baseViewHolder.getView(R.id.iv_user_official).setVisibility(onlineChatMember.isOfficial() ? View.VISIBLE : View.GONE);
|
helper.getView(R.id.iv_user_official).setVisibility(item.isOfficial() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
// 管理
|
||||||
|
ImageView ivManager = helper.getView(R.id.manager_logo);
|
||||||
|
if (item.getMemberType() != null && item.getMemberType().equals("MANAGER")) {
|
||||||
|
ivManager.setVisibility(View.VISIBLE);
|
||||||
|
ivManager.setImageResource(R.drawable.icon_admin_logo);
|
||||||
|
} else if (item.getMemberType() != null && item.getMemberType().equals("CREATOR")) {
|
||||||
|
ivManager.setVisibility(View.VISIBLE);
|
||||||
|
ivManager.setImageResource(R.drawable.icon_user_list_room_ownner);
|
||||||
|
} else {
|
||||||
|
ivManager.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在麦
|
||||||
|
ImageView ivMic = helper.getView(R.id.room_online_tag);
|
||||||
|
ivMic.setVisibility(item.isInMic() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
|
||||||
|
//等级
|
||||||
|
UserLevelVo levelVo = item.getUserLevelVo();
|
||||||
|
String experLevelUrl = null;
|
||||||
|
String charmLevelUrl = null;
|
||||||
|
if (levelVo != null) {
|
||||||
|
experLevelUrl = levelVo.getExperUrl();
|
||||||
|
charmLevelUrl = levelVo.getCharmUrl();
|
||||||
|
}
|
||||||
//经验等级
|
//经验等级
|
||||||
AppCompatImageView ivUserExper = baseViewHolder.getView(R.id.iv_user_exper);
|
AppCompatImageView ivUserExper = helper.getView(R.id.iv_user_exper);
|
||||||
String experLevelUrl = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, onlineChatMember.chatRoomMember);
|
|
||||||
boolean isExperLevelUrlEmpty = TextUtils.isEmpty(experLevelUrl);
|
boolean isExperLevelUrlEmpty = TextUtils.isEmpty(experLevelUrl);
|
||||||
ivUserExper.setVisibility(!isExperLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
ivUserExper.setVisibility(!isExperLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
||||||
if (!isExperLevelUrlEmpty) {
|
if (!isExperLevelUrlEmpty) {
|
||||||
ImageLoadUtils.loadImage(mContext, experLevelUrl, ivUserExper);
|
ImageLoadUtils.loadImage(mContext, experLevelUrl, ivUserExper);
|
||||||
}
|
}
|
||||||
//魅力等级
|
//魅力等级
|
||||||
AppCompatImageView ivUserCharm = baseViewHolder.getView(R.id.iv_user_charm);
|
AppCompatImageView ivUserCharm = helper.getView(R.id.iv_user_charm);
|
||||||
String charmLevelUrl = NobleUtil.getLevel(UserLevelResourceType.CHARM_URL, onlineChatMember.chatRoomMember);
|
|
||||||
boolean isCharmLevelUrlEmpty = TextUtils.isEmpty(charmLevelUrl);
|
boolean isCharmLevelUrlEmpty = TextUtils.isEmpty(charmLevelUrl);
|
||||||
ivUserCharm.setVisibility(!isCharmLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
ivUserCharm.setVisibility(!isCharmLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
||||||
if (!isCharmLevelUrlEmpty) {
|
if (!isCharmLevelUrlEmpty) {
|
||||||
ImageLoadUtils.loadImage(mContext, charmLevelUrl, ivUserCharm);
|
ImageLoadUtils.loadImage(mContext, charmLevelUrl, ivUserCharm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 官方主播铭牌标识
|
|
||||||
String fixWord = NobleUtil.getLevel(UserInfo.OAC_NAME, onlineChatMember.chatRoomMember);
|
|
||||||
String iconPic = NobleUtil.getLevel(UserInfo.OAC_ICON, onlineChatMember.chatRoomMember);
|
|
||||||
View inOfficialMask = baseViewHolder.getView(R.id.in_official_mask);
|
|
||||||
if (!TextUtils.isEmpty(fixWord) && !TextUtils.isEmpty(iconPic)) {
|
|
||||||
inOfficialMask.setVisibility(View.VISIBLE);
|
|
||||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
|
||||||
if (tvOfficialMask != null) {
|
|
||||||
tvOfficialMask.setText(fixWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
|
||||||
if (ivOfficialMask != null) {
|
|
||||||
ImageLoadUtils.loadImage(mContext, iconPic, ivOfficialMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
inOfficialMask.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 铭牌
|
// 铭牌
|
||||||
String namePlateWord = NobleUtil.getLevel(UserInfo.NAMEPLATE_WORD, onlineChatMember.chatRoomMember);
|
View inNamePlate = helper.getView(R.id.in_nameplate);
|
||||||
String namePlatePic = NobleUtil.getLevel(UserInfo.NAMEPLATE_PIC, onlineChatMember.chatRoomMember);
|
NamePlateHelper.INSTANCE.load(inNamePlate, inNamePlate.findViewById(R.id.tv_official_mask), inNamePlate.findViewById(R.id.iv_official_mask), item);
|
||||||
View inNamePlate = baseViewHolder.getView(R.id.in_nameplate);
|
|
||||||
if (!TextUtils.isEmpty(namePlateWord) && !TextUtils.isEmpty(namePlatePic)) {
|
|
||||||
inNamePlate.setVisibility(View.VISIBLE);
|
|
||||||
TextView tvNamePlate = inNamePlate.findViewById(R.id.tv_official_mask);
|
|
||||||
if (tvNamePlate != null) {
|
|
||||||
tvNamePlate.setText(namePlateWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView ivNamePlate = inNamePlate.findViewById(R.id.iv_official_mask);
|
|
||||||
if (ivNamePlate != null) {
|
|
||||||
ImageLoadUtils.loadImage(mContext, namePlatePic, ivNamePlate);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
inNamePlate.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
AppCompatImageView ivUserLevel = baseViewHolder.getView(R.id.iv_noble_level);
|
|
||||||
String resource = (String) NobleUtil.getResource(NobleResourceType.KEY_BADGE, onlineChatMember.chatRoomMember);
|
|
||||||
if (TextUtils.isEmpty(resource)) {
|
|
||||||
ivUserLevel.setVisibility(View.GONE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ivUserLevel.setVisibility(View.VISIBLE);
|
|
||||||
NobleUtil.loadResource(resource, ivUserLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSexData(BaseViewHolder baseViewHolder, OnlineChatMember onlineChatMember) {
|
|
||||||
final ImageView sexImage = baseViewHolder.getView(R.id.sex);
|
|
||||||
String gender = NobleUtil.getLevel(UserInfo.GENDER, onlineChatMember.chatRoomMember);
|
|
||||||
if ("1".equals(gender)) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_male);
|
|
||||||
} else if ("2".equals(gender)) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_female);
|
|
||||||
} else {
|
|
||||||
NimUserInfo nimUserInfo = NimUserInfoCache.getInstance().getUserInfo(onlineChatMember.chatRoomMember.getAccount());
|
|
||||||
if (nimUserInfo == null) {
|
|
||||||
NimUserInfoCache.getInstance().getUserInfoFromRemote(onlineChatMember.chatRoomMember.getAccount(),
|
|
||||||
new RequestCallbackWrapper<NimUserInfo>() {
|
|
||||||
@Override
|
|
||||||
public void onResult(int i, NimUserInfo nimUserInfo, Throwable throwable) {
|
|
||||||
if (nimUserInfo != null) {
|
|
||||||
if (nimUserInfo.getGenderEnum() == GenderEnum.MALE) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_male);
|
|
||||||
} else if (nimUserInfo.getGenderEnum() == GenderEnum.FEMALE) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_female);
|
|
||||||
} else {
|
|
||||||
sexImage.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (nimUserInfo.getGenderEnum() == GenderEnum.MALE) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_male);
|
|
||||||
} else if (nimUserInfo.getGenderEnum() == GenderEnum.FEMALE) {
|
|
||||||
sexImage.setVisibility(View.VISIBLE);
|
|
||||||
sexImage.setImageResource(R.drawable.ic_gender_female);
|
|
||||||
} else {
|
|
||||||
sexImage.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerRoomEvent() {
|
private void registerRoomEvent() {
|
||||||
@@ -240,7 +160,7 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
|||||||
updateMemberIn(roomEvent);
|
updateMemberIn(roomEvent);
|
||||||
} else if (event == RoomEvent.ROOM_MEMBER_EXIT) {
|
} else if (event == RoomEvent.ROOM_MEMBER_EXIT) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onMemberExit(roomEvent.getAccount(), mData);
|
mListener.onMemberExit(roomEvent.getAccount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -248,19 +168,19 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
|||||||
|
|
||||||
private void updateMemberIn(RoomEvent roomEvent) {
|
private void updateMemberIn(RoomEvent roomEvent) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onMemberIn(roomEvent.getAccount(), mData);
|
mListener.onMemberIn(roomEvent.getAccount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateManager(RoomEvent roomEvent) {
|
private void updateManager(RoomEvent roomEvent) {
|
||||||
if (mListener != null)
|
if (mListener != null)
|
||||||
mListener.onUpdateMemberManager(roomEvent.getAccount(),
|
mListener.onUpdateMemberManager(roomEvent.getAccount(),
|
||||||
roomEvent.getEvent() == RoomEvent.ROOM_MANAGER_REMOVE, mData);
|
roomEvent.getEvent() == RoomEvent.ROOM_MANAGER_REMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDownUpMic(String account, boolean isUpMic) {
|
private void updateDownUpMic(String account, boolean isUpMic) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onMemberDownUpMic(account, isUpMic, mData);
|
mListener.onMemberDownUpMic(account, isUpMic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,34 +201,29 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
|||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
*/
|
*/
|
||||||
void onMemberIn(String account, List<OnlineChatMember> dataList);
|
void onMemberIn(String account);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成员出去回调
|
* 成员出去回调
|
||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
* @param dataList
|
|
||||||
*/
|
*/
|
||||||
void onMemberExit(String account, List<OnlineChatMember> dataList);
|
void onMemberExit(String account);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成员上下麦更新
|
* 成员上下麦更新
|
||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
* @param isUpMic
|
* @param isUpMic
|
||||||
* @param dataList
|
|
||||||
*/
|
*/
|
||||||
void onMemberDownUpMic(String account, boolean isUpMic,
|
void onMemberDownUpMic(String account, boolean isUpMic);
|
||||||
List<OnlineChatMember> dataList);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置管理员回调
|
* 设置管理员回调
|
||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
* @param dataList
|
|
||||||
*/
|
*/
|
||||||
void onUpdateMemberManager(String account, boolean isRemoveManager,
|
void onUpdateMemberManager(String account, boolean isRemoveManager);
|
||||||
List<OnlineChatMember> dataList);
|
|
||||||
|
|
||||||
void addMemberBlack();
|
void addMemberBlack();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
package com.yizhuan.erban.avroom.banner
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.core.util.Consumer
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||||
|
import com.yizhuan.erban.ui.widget.rollviewpager.adapter.StaticPagerAdapter
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
|
||||||
|
class RoomBannerAdapter(private val mContext: Context, private val data: List<RoomIcon>) :
|
||||||
|
StaticPagerAdapter() {
|
||||||
|
|
||||||
|
var onItemClickListener: Consumer<RoomIcon>? = null
|
||||||
|
|
||||||
|
override fun getView(container: ViewGroup, position: Int): View {
|
||||||
|
val view = LayoutInflater.from(mContext).inflate(R.layout.item_room_act, container, false)
|
||||||
|
val ivCover = view.findViewById<ImageView>(R.id.iv_cover)
|
||||||
|
val bannerInfo = data[position]
|
||||||
|
val actId = bannerInfo.id?.toString()
|
||||||
|
ivCover.scaleType = ImageView.ScaleType.CENTER_CROP
|
||||||
|
ImageLoadUtils.loadImage(
|
||||||
|
mContext,
|
||||||
|
bannerInfo.icon,
|
||||||
|
ivCover,
|
||||||
|
R.drawable.default_cover
|
||||||
|
)
|
||||||
|
ivCover.setOnClickListener { v: View? ->
|
||||||
|
onItemClickListener?.accept(bannerInfo)
|
||||||
|
}
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getCount(): Int {
|
||||||
|
return data.size
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,194 @@
|
|||||||
|
package com.yizhuan.erban.avroom.banner
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog
|
||||||
|
import com.yizhuan.erban.databinding.RoomBannerWidgetBinding
|
||||||
|
import com.yizhuan.erban.shipantics.PullRadishActivity
|
||||||
|
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper
|
||||||
|
import com.yizhuan.erban.treasurefairy.HomeFairyActivity
|
||||||
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||||
|
import com.yizhuan.erban.ui.webview.room_banner.RoomBannerWebDialogActivity
|
||||||
|
import com.yizhuan.erban.ui.webview.room_banner.RoomWebDialogActivity
|
||||||
|
import com.yizhuan.erban.ui.widget.rollviewpager.Util
|
||||||
|
import com.yizhuan.erban.ui.widget.rollviewpager.hintview.ColorPointHintView
|
||||||
|
import com.yizhuan.erban.utils.CommonJumpHelper
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo
|
||||||
|
import com.yizhuan.xchat_android_core.room.model.AvRoomModel
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.FrameLayoutRoomWidget
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomContext
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomView
|
||||||
|
import okhttp3.internal.filterList
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 10:42
|
||||||
|
* Desc:玩法活动
|
||||||
|
**/
|
||||||
|
class RoomBannerWidget : FrameLayoutRoomWidget {
|
||||||
|
private val binding: RoomBannerWidgetBinding =
|
||||||
|
DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(
|
||||||
|
context
|
||||||
|
), R.layout.room_banner_widget, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
private var indicatorVisible = false
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
setIndicatorEnabled(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitialize(roomView: RoomView, roomContext: RoomContext) {
|
||||||
|
super.onInitialize(roomView, roomContext)
|
||||||
|
refreshData()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun disabledIndicator() {
|
||||||
|
setIndicatorEnabled(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun refreshData() {
|
||||||
|
if (RoomContext.get()?.getRoomInfo()?.type == RoomInfo.ROOMTYPE_GAME) {
|
||||||
|
refreshData(true)
|
||||||
|
} else {
|
||||||
|
refreshData(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refreshData(isGameRoom: Boolean) {
|
||||||
|
val disposable = if (isGameRoom) {
|
||||||
|
AvRoomModel.get().gameRoomBannerList
|
||||||
|
} else {
|
||||||
|
AvRoomModel.get().roomBannerList
|
||||||
|
}.subscribe { list: List<RoomIcon> ->
|
||||||
|
loadData(list)
|
||||||
|
}
|
||||||
|
getCompositeDisposable().add(disposable)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData(list: List<RoomIcon>?) {
|
||||||
|
if (list.isNullOrEmpty()) {
|
||||||
|
this.isVisible = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.isVisible = true
|
||||||
|
// 只有一個圖標,隱藏底部指示器
|
||||||
|
indicatorVisible = list.size > 1
|
||||||
|
|
||||||
|
val bannerAdapter = RoomBannerAdapter(context, list)
|
||||||
|
bannerAdapter.onItemClickListener = androidx.core.util.Consumer<RoomIcon> {
|
||||||
|
if (it.isSeizeTreasure()) {
|
||||||
|
HomeFairyActivity.start(context)
|
||||||
|
} else if (it.isFirstCharge()) {
|
||||||
|
FirstChargeDialog.start(context)
|
||||||
|
} else if (it.isFindLove()) {
|
||||||
|
GoldBoxHelper.handleBoxClick(context)
|
||||||
|
} else if (it.isNauticalAdventure()) {
|
||||||
|
PullRadishActivity.start(context)
|
||||||
|
} else {
|
||||||
|
AvRoomModel.get().activityClickLog("2", it.id?.toString()).subscribe()
|
||||||
|
|
||||||
|
if (it.skipType == 3) {
|
||||||
|
if (it.tag == RoomIcon.TAG_GAMEPLAY) {
|
||||||
|
if (it.showType == 2) {
|
||||||
|
RoomWebDialogActivity.start(context, it.skipContent ?: "", false)
|
||||||
|
} else {
|
||||||
|
CommonWebViewActivity.start(context, it.skipContent ?: "")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val newList = list.filterList {
|
||||||
|
skipType == 3 && tag != RoomIcon.TAG_GAMEPLAY
|
||||||
|
}
|
||||||
|
val newPosition = newList.indexOfFirst { item ->
|
||||||
|
item == it
|
||||||
|
}
|
||||||
|
RoomBannerWebDialogActivity.start(context, newPosition, newList)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CommonJumpHelper.bannerJump(context, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.pagerView.adapter = bannerAdapter
|
||||||
|
binding.pagerView.setPlayDelay(3000)
|
||||||
|
//設置透明度
|
||||||
|
binding.pagerView.setAnimationDurtion(500)
|
||||||
|
bannerAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
val viewPager = binding.pagerView.viewPager
|
||||||
|
viewPager.offscreenPageLimit = list.size
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setIndicatorEnabled(isEnabled: Boolean) {
|
||||||
|
// 模擬指示器在viewpager底部效果
|
||||||
|
val viewPager = binding.pagerView.viewPager
|
||||||
|
val layoutParams = viewPager.layoutParams as RelativeLayout.LayoutParams
|
||||||
|
if (isEnabled) {
|
||||||
|
layoutParams.setMargins(0, 0, 0, Util.dip2px(context, 7f))
|
||||||
|
binding.pagerView.setHintView(object : ColorPointHintView(
|
||||||
|
context, Color.WHITE, ContextCompat.getColor(
|
||||||
|
context,
|
||||||
|
R.color.color_66FFFFFF
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun makeFocusDrawable(): Drawable? {
|
||||||
|
val dotFocus = GradientDrawable()
|
||||||
|
dotFocus.setColor(Color.WHITE)
|
||||||
|
dotFocus.cornerRadius = Util.dip2px(
|
||||||
|
context, 2f
|
||||||
|
).toFloat()
|
||||||
|
dotFocus.setSize(
|
||||||
|
Util.dip2px(context, 9f), Util.dip2px(
|
||||||
|
context, 4f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return if (indicatorVisible) dotFocus else null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun makeNormalDrawable(): Drawable? {
|
||||||
|
val dotNormal = GradientDrawable()
|
||||||
|
dotNormal.setColor(ContextCompat.getColor(context, R.color.color_66FFFFFF))
|
||||||
|
dotNormal.cornerRadius = Util.dip2px(
|
||||||
|
context, 2f
|
||||||
|
).toFloat()
|
||||||
|
dotNormal.setSize(
|
||||||
|
Util.dip2px(context, 4f), Util.dip2px(
|
||||||
|
context, 4f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return if (indicatorVisible) dotNormal else null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
layoutParams.setMargins(0, 0, 0, 0)
|
||||||
|
binding.pagerView.setHintView(null)
|
||||||
|
}
|
||||||
|
viewPager.layoutParams = layoutParams
|
||||||
|
}
|
||||||
|
}
|
@@ -6,9 +6,6 @@ import android.app.Activity
|
|||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.graphics.drawable.GradientDrawable
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
@@ -47,7 +44,6 @@ import com.yizhuan.erban.avroom.dialog.AttentionHintDialog
|
|||||||
import com.yizhuan.erban.avroom.dialog.DatingVipRuleDialog
|
import com.yizhuan.erban.avroom.dialog.DatingVipRuleDialog
|
||||||
import com.yizhuan.erban.avroom.dialog.RoomFreeGiftDialog
|
import com.yizhuan.erban.avroom.dialog.RoomFreeGiftDialog
|
||||||
import com.yizhuan.erban.avroom.dialog.RoomOperationDialog
|
import com.yizhuan.erban.avroom.dialog.RoomOperationDialog
|
||||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog
|
|
||||||
import com.yizhuan.erban.avroom.presenter.BaseRoomPresenter
|
import com.yizhuan.erban.avroom.presenter.BaseRoomPresenter
|
||||||
import com.yizhuan.erban.avroom.redpackage.send.RedPackageSendDialog
|
import com.yizhuan.erban.avroom.redpackage.send.RedPackageSendDialog
|
||||||
import com.yizhuan.erban.avroom.room_album.RoomAlbumModel
|
import com.yizhuan.erban.avroom.room_album.RoomAlbumModel
|
||||||
@@ -59,34 +55,24 @@ import com.yizhuan.erban.base.BaseMvpActivity
|
|||||||
import com.yizhuan.erban.base.BaseMvpFragment
|
import com.yizhuan.erban.base.BaseMvpFragment
|
||||||
import com.yizhuan.erban.event.OpenRoomIntroEvent
|
import com.yizhuan.erban.event.OpenRoomIntroEvent
|
||||||
import com.yizhuan.erban.friend.view.SelectFriendActivity
|
import com.yizhuan.erban.friend.view.SelectFriendActivity
|
||||||
import com.yizhuan.erban.home.adapter.RoomActAdapter
|
|
||||||
import com.yizhuan.erban.shipantics.PullRadishActivity
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper
|
|
||||||
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
|
|
||||||
import com.yizhuan.erban.ui.widget.ButtonItem
|
import com.yizhuan.erban.ui.widget.ButtonItem
|
||||||
import com.yizhuan.erban.ui.widget.GiftDialog
|
import com.yizhuan.erban.ui.widget.GiftDialog
|
||||||
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
||||||
import com.yizhuan.erban.ui.widget.GiftDialog.SenGiftCallback
|
import com.yizhuan.erban.ui.widget.GiftDialog.SenGiftCallback
|
||||||
import com.yizhuan.erban.ui.widget.UserInfoDialog
|
import com.yizhuan.erban.ui.widget.UserInfoDialog
|
||||||
import com.yizhuan.erban.ui.widget.dynamicface.DynamicFaceDialog
|
import com.yizhuan.erban.ui.widget.dynamicface.DynamicFaceDialog
|
||||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
|
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.Util
|
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.hintview.ColorPointHintView
|
|
||||||
import com.yizhuan.erban.utils.KeyBoardUtils
|
import com.yizhuan.erban.utils.KeyBoardUtils
|
||||||
import com.yizhuan.tutu.music.widget.MusicPlayerView
|
import com.yizhuan.tutu.music.widget.MusicPlayerView
|
||||||
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity
|
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants
|
import com.yizhuan.xchat_android_constants.XChatConstants
|
||||||
import com.yizhuan.xchat_android_core.Constants
|
import com.yizhuan.xchat_android_core.Constants
|
||||||
import com.yizhuan.xchat_android_core.DemoCache
|
import com.yizhuan.xchat_android_core.DemoCache
|
||||||
import com.yizhuan.xchat_android_core.UriProvider
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo
|
import com.yizhuan.xchat_android_core.bean.RoomMicInfo
|
||||||
import com.yizhuan.xchat_android_core.gift.GiftModel
|
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.GiftInfo
|
||||||
import com.yizhuan.xchat_android_core.gift.event.RoomFreeGiftEvent
|
import com.yizhuan.xchat_android_core.gift.event.RoomFreeGiftEvent
|
||||||
import com.yizhuan.xchat_android_core.helper.AtProxy
|
import com.yizhuan.xchat_android_core.helper.AtProxy
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
|
||||||
import com.yizhuan.xchat_android_core.home.event.OpenRoomMessageInputEvent
|
import com.yizhuan.xchat_android_core.home.event.OpenRoomMessageInputEvent
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2
|
||||||
@@ -97,7 +83,6 @@ import com.yizhuan.xchat_android_core.manager.RoomEvent
|
|||||||
import com.yizhuan.xchat_android_core.mentoring_relationship.event.MentoringStopCountingEvent
|
import com.yizhuan.xchat_android_core.mentoring_relationship.event.MentoringStopCountingEvent
|
||||||
import com.yizhuan.xchat_android_core.room.anotherroompk.ShowGiftDialogEvent
|
import com.yizhuan.xchat_android_core.room.anotherroompk.ShowGiftDialogEvent
|
||||||
import com.yizhuan.xchat_android_core.room.anotherroompk.ShowUserInfoDialogEvent
|
import com.yizhuan.xchat_android_core.room.anotherroompk.ShowUserInfoDialogEvent
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomContributeUserInfo
|
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo
|
||||||
import com.yizhuan.xchat_android_core.room.event.RoomAtEvent
|
import com.yizhuan.xchat_android_core.room.event.RoomAtEvent
|
||||||
import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent
|
import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent
|
||||||
@@ -147,7 +132,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
protected lateinit var inputSend: ImageView
|
protected lateinit var inputSend: ImageView
|
||||||
protected lateinit var microView: MicroView
|
protected lateinit var microView: MicroView
|
||||||
private var musicPlayerView: MusicPlayerView? = null
|
private var musicPlayerView: MusicPlayerView? = null
|
||||||
private var ivRadishEntrance: View? = null
|
|
||||||
private var mVsMusicPlayer: ViewStub? = null
|
private var mVsMusicPlayer: ViewStub? = null
|
||||||
private var mDisposable: Disposable? = null
|
private var mDisposable: Disposable? = null
|
||||||
private var isCloseScreen = false
|
private var isCloseScreen = false
|
||||||
@@ -207,7 +191,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
inputSend = mView.findViewById(R.id.input_send)
|
inputSend = mView.findViewById(R.id.input_send)
|
||||||
microView = mView.findViewById(R.id.micro_view)
|
microView = mView.findViewById(R.id.micro_view)
|
||||||
mVsMusicPlayer = mView.findViewById(R.id.vs_music_player)
|
mVsMusicPlayer = mView.findViewById(R.id.vs_music_player)
|
||||||
ivRadishEntrance = mView.findViewById(R.id.iv_radish_entrance)
|
|
||||||
messageView.setClickConsumer {
|
messageView.setClickConsumer {
|
||||||
if (!TextUtils.isEmpty(it) && it != "0") {
|
if (!TextUtils.isEmpty(it) && it != "0") {
|
||||||
showUserCardDialog(it)
|
showUserCardDialog(it)
|
||||||
@@ -287,13 +270,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
// 刷新禮物列表,獲取房間專屬禮物列表
|
// 刷新禮物列表,獲取房間專屬禮物列表
|
||||||
GiftModel.get().refreshGiftList(AvRoomDataManager.get().roomUid.toString()).subscribe()
|
GiftModel.get().refreshGiftList(AvRoomDataManager.get().roomUid.toString()).subscribe()
|
||||||
checkFollowOwner()
|
checkFollowOwner()
|
||||||
mvpPresenter?.loadRoomRank()
|
|
||||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||||
|
|
||||||
//先隐藏航海冒险
|
|
||||||
// ivRadishEntrance?.isVisible =
|
|
||||||
// !GoldBoxHelper.needIntegrateBoxEntrance() && GoldBoxHelper.isShowRadish()
|
|
||||||
|
|
||||||
//获取免费礼物详情
|
//获取免费礼物详情
|
||||||
mvpPresenter?.queryFreeFlower()
|
mvpPresenter?.queryFreeFlower()
|
||||||
initRoomAlbum()
|
initRoomAlbum()
|
||||||
@@ -355,6 +333,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
updateRemoteMuteBtn()
|
updateRemoteMuteBtn()
|
||||||
openOrCloseGiftValue(true)
|
openOrCloseGiftValue(true)
|
||||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||||
|
onEnterRoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
||||||
@@ -464,68 +443,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initRoomAct(
|
|
||||||
rollPagerView: RollPagerView,
|
|
||||||
dialogInfo: List<BannerInfo>,
|
|
||||||
bottomDp: Float = 0f
|
|
||||||
) {
|
|
||||||
if (!ListUtils.isListEmpty(dialogInfo)) {
|
|
||||||
rollPagerView.visibility = View.VISIBLE
|
|
||||||
// 只有一個圖標,隱藏底部指示器
|
|
||||||
val show = dialogInfo.size > 1
|
|
||||||
rollPagerView.setHintView(object : ColorPointHintView(
|
|
||||||
mContext, Color.WHITE, ContextCompat.getColor(
|
|
||||||
mContext,
|
|
||||||
R.color.color_66FFFFFF
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun makeFocusDrawable(): Drawable? {
|
|
||||||
val dotFocus = GradientDrawable()
|
|
||||||
dotFocus.setColor(Color.WHITE)
|
|
||||||
dotFocus.cornerRadius = Util.dip2px(
|
|
||||||
context, 2f
|
|
||||||
).toFloat()
|
|
||||||
dotFocus.setSize(
|
|
||||||
Util.dip2px(context, 9f), Util.dip2px(
|
|
||||||
context, 4f
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return if (show) dotFocus else null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun makeNormalDrawable(): Drawable? {
|
|
||||||
val dotNormal = GradientDrawable()
|
|
||||||
dotNormal.setColor(ContextCompat.getColor(mContext, R.color.color_66FFFFFF))
|
|
||||||
dotNormal.cornerRadius = Util.dip2px(
|
|
||||||
context, 2f
|
|
||||||
).toFloat()
|
|
||||||
dotNormal.setSize(
|
|
||||||
Util.dip2px(context, 4f), Util.dip2px(
|
|
||||||
context, 4f
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return if (show) dotNormal else null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
val bannerAdapter = RoomActAdapter(mContext, dialogInfo)
|
|
||||||
rollPagerView.adapter = bannerAdapter
|
|
||||||
rollPagerView.setPlayDelay(3000)
|
|
||||||
//設置透明度
|
|
||||||
rollPagerView.setAnimationDurtion(500)
|
|
||||||
bannerAdapter.notifyDataSetChanged()
|
|
||||||
bannerAdapter.setRoomActClickListener { url ->
|
|
||||||
DialogWebViewActivity.start(mContext, url)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 模擬指示器在viewpager底部效果
|
|
||||||
val viewPager = rollPagerView.viewPager
|
|
||||||
viewPager.offscreenPageLimit = dialogInfo.size
|
|
||||||
val layoutParams = viewPager.layoutParams as RelativeLayout.LayoutParams
|
|
||||||
layoutParams.setMargins(0, 0, 0, UIUtil.dip2px(mContext, bottomDp.toDouble()))
|
|
||||||
viewPager.layoutParams = layoutParams
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun releaseView() {
|
private fun releaseView() {
|
||||||
roomFreeGiftDialog?.dismiss()
|
roomFreeGiftDialog?.dismiss()
|
||||||
messageView.release()
|
messageView.release()
|
||||||
@@ -557,6 +474,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
if (isOnMic) {
|
if (isOnMic) {
|
||||||
if (musicPlayerView == null) {
|
if (musicPlayerView == null) {
|
||||||
musicPlayerView = mVsMusicPlayer?.inflate() as? MusicPlayerView
|
musicPlayerView = mVsMusicPlayer?.inflate() as? MusicPlayerView
|
||||||
|
musicPlayerView?.let {
|
||||||
|
onInitMusicPlayerView(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
musicPlayerView?.visibility = View.VISIBLE
|
musicPlayerView?.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
@@ -586,10 +506,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
} else {
|
} else {
|
||||||
val roomQueueInfo = AvRoomDataManager.get()
|
val roomQueueInfo = AvRoomDataManager.get()
|
||||||
.getRoomQueueMemberInfoByAccount(myUid.toString())
|
.getRoomQueueMemberInfoByAccount(myUid.toString())
|
||||||
if (roomQueueInfo?.mChatRoomMember?.isNoProhibitMic == true && roomQueueInfo.mRoomMicInfo?.isMicMute == false) {
|
if (roomQueueInfo?.mChatRoomMember != null
|
||||||
bottomView.setMicBtnEnable(true)
|
|
||||||
bottomView.setMicBtnOpen(true)
|
|
||||||
} else if (roomQueueInfo?.mChatRoomMember != null
|
|
||||||
&& myUid.toString() == roomQueueInfo.mChatRoomMember.account
|
&& myUid.toString() == roomQueueInfo.mChatRoomMember.account
|
||||||
&& roomQueueInfo.mRoomMicInfo?.isMicMute == true
|
&& roomQueueInfo.mRoomMicInfo?.isMicMute == true
|
||||||
) {
|
) {
|
||||||
@@ -678,17 +595,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
R.id.input_send -> {
|
R.id.input_send -> {
|
||||||
sendMsg()
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,18 +1067,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
microView.adapter.notifyDataSetChanged()
|
microView.adapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateRoomRanks(data: List<RoomContributeUserInfo>) {
|
|
||||||
// val avatarList = arrayListOf<ImageView?>(
|
|
||||||
// mView.findViewById(R.id.iv_rank_0),
|
|
||||||
// mView.findViewById(R.id.iv_rank_1),
|
|
||||||
// mView.findViewById(R.id.iv_rank_2)
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// for (i in 0 until avatarList.size) {
|
|
||||||
// avatarList[i]?.loadAvatar(data.getOrNull(i)?.avatar)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onSendGiftBtnClick(giftId: Int = 0) {
|
private fun onSendGiftBtnClick(giftId: Int = 0) {
|
||||||
if (giftDialog == null) {
|
if (giftDialog == null) {
|
||||||
GiftDialog.GIFT_DIALOG_FROM = getString(R.string.room)
|
GiftDialog.GIFT_DIALOG_FROM = getString(R.string.room)
|
||||||
@@ -1337,6 +1231,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun findWidget(name: String): RoomWidget? {
|
||||||
|
return widgets[name]
|
||||||
|
}
|
||||||
|
|
||||||
open fun initWidget() {
|
open fun initWidget() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1365,4 +1263,12 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
inputEdit.requestFocus()
|
inputEdit.requestFocus()
|
||||||
KeyBoardUtils.showKeyBoard(context, inputEdit)
|
KeyBoardUtils.showKeyBoard(context, inputEdit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun onEnterRoom(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@@ -10,15 +10,16 @@ import com.yizhuan.erban.R
|
|||||||
import com.yizhuan.erban.avroom.adapter.GameMicroViewAdapter
|
import com.yizhuan.erban.avroom.adapter.GameMicroViewAdapter
|
||||||
import com.yizhuan.erban.avroom.adapter.GameMiniMicroViewAdapter
|
import com.yizhuan.erban.avroom.adapter.GameMiniMicroViewAdapter
|
||||||
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
|
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
|
||||||
|
import com.yizhuan.erban.avroom.banner.RoomBannerWidget
|
||||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog
|
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog
|
||||||
import com.yizhuan.erban.avroom.game.GameDelegate
|
import com.yizhuan.erban.avroom.game.GameDelegate
|
||||||
import com.yizhuan.erban.avroom.game.OnGameStatusChangeListener
|
import com.yizhuan.erban.avroom.game.OnGameStatusChangeListener
|
||||||
import com.yizhuan.erban.avroom.presenter.GameRoomPresenter
|
import com.yizhuan.erban.avroom.presenter.GameRoomPresenter
|
||||||
|
import com.yizhuan.erban.avroom.rank.RoomRankWidget
|
||||||
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget
|
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget
|
||||||
import com.yizhuan.erban.avroom.view.IGameRoomView
|
import com.yizhuan.erban.avroom.view.IGameRoomView
|
||||||
import com.yizhuan.erban.databinding.FragmentGameRoomBinding
|
import com.yizhuan.erban.databinding.FragmentGameRoomBinding
|
||||||
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
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.manager.AvRoomDataManager
|
||||||
import com.yizhuan.xchat_android_core.music.model.PlayerModel
|
import com.yizhuan.xchat_android_core.music.model.PlayerModel
|
||||||
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
||||||
@@ -68,9 +69,9 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
|||||||
AvRoomDataManager.get().mCurrentRoomInfo?.mgId
|
AvRoomDataManager.get().mCurrentRoomInfo?.mgId
|
||||||
)
|
)
|
||||||
gameDelegate.setOnGameStatusChangeListener(this)
|
gameDelegate.setOnGameStatusChangeListener(this)
|
||||||
|
gameBinding.rankWidget.setContentBackgroundResource(R.drawable.room_rank_widget_bg_game)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
override fun initiate() {
|
override fun initiate() {
|
||||||
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
||||||
@@ -78,7 +79,6 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
|||||||
//游戏模式暂时不需要这个
|
//游戏模式暂时不需要这个
|
||||||
PlayerModel.get().stop()
|
PlayerModel.get().stop()
|
||||||
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
|
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
|
||||||
mvpPresenter?.getBannerList()
|
|
||||||
gameBinding.tvShowMiniMic.setOnClickListener { showMiniMic() }
|
gameBinding.tvShowMiniMic.setOnClickListener { showMiniMic() }
|
||||||
gameBinding.ivShowMic.setOnClickListener { showMic() }
|
gameBinding.ivShowMic.setOnClickListener { showMic() }
|
||||||
}
|
}
|
||||||
@@ -150,10 +150,6 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowBanner(dialogInfos: List<BannerInfo>) {
|
|
||||||
initRoomAct(gameBinding.activityImg, dialogInfos)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onFinishAvRoomEvent(event: FinishAvRoomEvent) {
|
fun onFinishAvRoomEvent(event: FinishAvRoomEvent) {
|
||||||
gameDelegate.exitGame()
|
gameDelegate.exitGame()
|
||||||
@@ -161,6 +157,8 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
||||||
|
// banner里可能有首充入口:刷新下
|
||||||
|
gameBinding.bannerWidget.refreshData()
|
||||||
FirstChargePrizeDialog(
|
FirstChargePrizeDialog(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
event.chargeProdTitle,
|
event.chargeProdTitle,
|
||||||
@@ -196,6 +194,9 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
|||||||
|
|
||||||
override fun initWidget() {
|
override fun initWidget() {
|
||||||
super.initWidget()
|
super.initWidget()
|
||||||
|
gameBinding.bannerWidget.disabledIndicator()
|
||||||
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
||||||
|
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||||
|
registerWidget(RoomBannerWidget::class.java.simpleName, gameBinding.bannerWidget)
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,8 +16,11 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.util.Consumer;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||||
@@ -37,7 +40,9 @@ import com.yizhuan.erban.base.BaseFragment;
|
|||||||
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
|
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
|
||||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||||
import com.yizhuan.erban.home.helper.OpenRoomHelper;
|
import com.yizhuan.erban.home.helper.OpenRoomHelper;
|
||||||
|
import com.yizhuan.erban.ui.widget.GiftDialog;
|
||||||
import com.yizhuan.erban.ui.widget.ShareDialog;
|
import com.yizhuan.erban.ui.widget.ShareDialog;
|
||||||
|
import com.yizhuan.erban.ui.widget.UserInfoDialog;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
|
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
||||||
@@ -114,6 +119,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
|||||||
private String FOLLOW_ROOM_TYPE = "";
|
private String FOLLOW_ROOM_TYPE = "";
|
||||||
private SelectGameAdapter gameAdapter;
|
private SelectGameAdapter gameAdapter;
|
||||||
|
|
||||||
|
public final MutableLiveData<Boolean> playNotifyStateLiveData = new MutableLiveData<Boolean>(false);
|
||||||
|
|
||||||
public static HomePartyFragment newInstance() {
|
public static HomePartyFragment newInstance() {
|
||||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||||
@@ -213,11 +219,22 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
|||||||
ivRoomShare.setOnClickListener(this);
|
ivRoomShare.setOnClickListener(this);
|
||||||
gameMainBinding.llRoomInfo.setOnClickListener(this);
|
gameMainBinding.llRoomInfo.setOnClickListener(this);
|
||||||
gameMainBinding.ivBack.setOnClickListener(this);
|
gameMainBinding.ivBack.setOnClickListener(this);
|
||||||
|
mRoomEffectView.setShowUserCardAction(s -> {
|
||||||
|
if (roomFragment instanceof GiftDialog.OnGiftDialogBtnClickListener) {
|
||||||
|
UserInfoDialog.showNewUserInfoDialog(
|
||||||
|
mContext,
|
||||||
|
JavaUtil.str2long(s),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true, (GiftDialog.OnGiftDialogBtnClickListener) roomFragment
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mRoomEffectView.setPlayNotifyStateListener(playNotifyStateLiveData);
|
||||||
mRoomEffectView.setOnPlayAnimCallback(new Function0<Boolean>() {
|
mRoomEffectView.setOnPlayAnimCallback(new Function0<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean invoke() {
|
public Boolean invoke() {
|
||||||
return getIsAnim();
|
return isShowingGiftNotify();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -360,18 +377,22 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean getIsAnim() {
|
private boolean isShowingGiftNotify() {
|
||||||
if (giftView != null) {
|
if ((getActivity() instanceof AVRoomActivity)) {
|
||||||
return giftView.getIsPlayAnim();
|
return ((AVRoomActivity) getActivity()).isShowingGiftNotify();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public LiveData<Boolean> getPlayNotifyState(){
|
||||||
* 获取玩法飘屏是否展示
|
return playNotifyStateLiveData;
|
||||||
*/
|
}
|
||||||
private boolean getIsPlayAnim() {
|
|
||||||
return mRoomEffectView.getIsPlayAnim();
|
public boolean isShowingPlayNotify(){
|
||||||
|
if(playNotifyStateLiveData.getValue()==null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return playNotifyStateLiveData.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
|
private void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
|
||||||
|
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
@@ -19,13 +20,17 @@ import com.yizhuan.erban.avroom.adapter.MicroViewAdapter;
|
|||||||
import com.yizhuan.erban.avroom.anotherroompk.RoomPkFinishDialog;
|
import com.yizhuan.erban.avroom.anotherroompk.RoomPkFinishDialog;
|
||||||
import com.yizhuan.erban.avroom.anotherroompk.RoomPkForceFinishDialog;
|
import com.yizhuan.erban.avroom.anotherroompk.RoomPkForceFinishDialog;
|
||||||
import com.yizhuan.erban.avroom.anotherroompk.RoomPkReceivedDialog;
|
import com.yizhuan.erban.avroom.anotherroompk.RoomPkReceivedDialog;
|
||||||
|
import com.yizhuan.erban.avroom.banner.RoomBannerWidget;
|
||||||
import com.yizhuan.erban.avroom.dialog.MicQueueDialog;
|
import com.yizhuan.erban.avroom.dialog.MicQueueDialog;
|
||||||
import com.yizhuan.erban.avroom.dialog.PKMicQueueDialog;
|
import com.yizhuan.erban.avroom.dialog.PKMicQueueDialog;
|
||||||
import com.yizhuan.erban.avroom.dialog.PKResultDialog;
|
import com.yizhuan.erban.avroom.dialog.PKResultDialog;
|
||||||
import com.yizhuan.erban.avroom.dialog.PKScoreBoardDialog;
|
import com.yizhuan.erban.avroom.dialog.PKScoreBoardDialog;
|
||||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog;
|
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog;
|
||||||
|
import com.yizhuan.erban.avroom.gameplay.RoomGameplayListWidget;
|
||||||
|
import com.yizhuan.erban.avroom.gameplay.RoomGameplayWidget;
|
||||||
import com.yizhuan.erban.avroom.giftvalue.GiftValueDialogUiHelper;
|
import com.yizhuan.erban.avroom.giftvalue.GiftValueDialogUiHelper;
|
||||||
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
|
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
|
||||||
|
import com.yizhuan.erban.avroom.rank.RoomRankWidget;
|
||||||
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget;
|
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget;
|
||||||
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
||||||
import com.yizhuan.erban.avroom.widget.PKBoardView;
|
import com.yizhuan.erban.avroom.widget.PKBoardView;
|
||||||
@@ -36,6 +41,7 @@ import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
|||||||
import com.yizhuan.erban.ui.webview.DatingRuleWebViewActivity;
|
import com.yizhuan.erban.ui.webview.DatingRuleWebViewActivity;
|
||||||
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||||
import com.yizhuan.erban.utils.UserUtils;
|
import com.yizhuan.erban.utils.UserUtils;
|
||||||
|
import com.yizhuan.tutu.music.widget.MusicPlayerView;
|
||||||
import com.yizhuan.xchat_android_core.Constants;
|
import com.yizhuan.xchat_android_core.Constants;
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
@@ -138,6 +144,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
public void initWidget() {
|
public void initWidget() {
|
||||||
super.initWidget();
|
super.initWidget();
|
||||||
registerWidget(RedPackageWidget.class.getSimpleName(), gameBinding.redPackageWidget);
|
registerWidget(RedPackageWidget.class.getSimpleName(), gameBinding.redPackageWidget);
|
||||||
|
registerWidget(RoomRankWidget.class.getSimpleName(), gameBinding.rankWidget);
|
||||||
|
registerWidget(RoomBannerWidget.class.getSimpleName(), gameBinding.bannerWidget);
|
||||||
|
registerWidget(RoomGameplayListWidget.class.getSimpleName(), gameBinding.gameplayListWidget);
|
||||||
|
registerWidget(RoomGameplayWidget.class.getSimpleName(), gameBinding.gameplayWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@@ -151,7 +161,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
updateQueuingMicBtn();
|
updateQueuingMicBtn();
|
||||||
updatePkScoreBoard();
|
updatePkScoreBoard();
|
||||||
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
||||||
getMvpPresenter().getBannerList();
|
|
||||||
// if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
// if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
||||||
// UserModel.get().getCurrentUserInfo()
|
// UserModel.get().getCurrentUserInfo()
|
||||||
// .compose(bindToLifecycle())
|
// .compose(bindToLifecycle())
|
||||||
@@ -603,7 +612,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
getMvpPresenter().cancelDragon();
|
getMvpPresenter().cancelDragon();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case R.id.tv_hour_rank:
|
case R.id.layout_hour_rank:
|
||||||
DialogWebViewActivity.start(
|
DialogWebViewActivity.start(
|
||||||
mContext,
|
mContext,
|
||||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
||||||
@@ -787,7 +796,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
|
|
||||||
private void hideKtvRelaView() {
|
private void hideKtvRelaView() {
|
||||||
gameBinding.setKtvModel(false);
|
gameBinding.setKtvModel(false);
|
||||||
gameBinding.contributeList.setVisibility(View.VISIBLE);
|
|
||||||
changeModelShowView();
|
changeModelShowView();
|
||||||
gameBinding.bottomView.showKtvBottom(false);
|
gameBinding.bottomView.showKtvBottom(false);
|
||||||
}
|
}
|
||||||
@@ -799,40 +807,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AvRoomDataManager.get().mCurrentRoomInfo.getIsPermitRoom() == 1) {
|
if (AvRoomDataManager.get().mCurrentRoomInfo.getIsPermitRoom() == 1) {
|
||||||
gameBinding.tvHourRank.setVisibility(View.VISIBLE);
|
gameBinding.layoutHourRank.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
gameBinding.tvHourRank.setVisibility(View.GONE);
|
gameBinding.layoutHourRank.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
|
||||||
GoldBoxHelper.isHideBox().subscribe(
|
|
||||||
hide -> {
|
|
||||||
if (hide != null && !hide) {
|
|
||||||
if (AvRoomDataManager.get().isCpRoom()) {
|
|
||||||
gameBinding.ivTreasureBoxCp.setVisibility(View.VISIBLE);
|
|
||||||
gameBinding.ivTreasureBox.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
|
|
||||||
gameBinding.ivTreasureBox.setVisibility(View.VISIBLE);
|
|
||||||
GlideApp.with(BasicConfig.INSTANCE.getAppContext())
|
|
||||||
.load(GoldBoxHelper.getBoxIcon())
|
|
||||||
.error(R.drawable.icon_room_treasure_box)
|
|
||||||
.into(gameBinding.ivTreasureBox);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
|
|
||||||
gameBinding.ivTreasureBox.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
throwable -> {
|
|
||||||
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
|
|
||||||
gameBinding.ivTreasureBox.setVisibility(View.GONE);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
|
|
||||||
gameBinding.ivTreasureBox.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
setDragonView();
|
setDragonView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -966,15 +944,11 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
return pkMicQueueDialog != null && pkMicQueueDialog.isShowing();
|
return pkMicQueueDialog != null && pkMicQueueDialog.isShowing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShowBanner(List<BannerInfo> bannerInfos) {
|
|
||||||
initRoomAct(gameBinding.activityImg, bannerInfos, 11f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onFirstRechargeEvent(FirstChargeEvent event) {
|
public void onFirstRechargeEvent(FirstChargeEvent event) {
|
||||||
gameBinding.ivFirstChargeEnter.setVisibility(View.GONE);
|
// banner里可能有首充入口:刷新下
|
||||||
|
gameBinding.bannerWidget.refreshData();
|
||||||
new FirstChargePrizeDialog(requireContext(), event.getChargeProdTitle(), event.getFirstChargeRewardList()).openDialog();
|
new FirstChargePrizeDialog(requireContext(), event.getChargeProdTitle(), event.getFirstChargeRewardList()).openDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,4 +1044,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onInitMusicPlayerView(@NonNull MusicPlayerView view) {
|
||||||
|
super.onInitMusicPlayerView(view);
|
||||||
|
view.linkIconView(gameBinding.ivMusic, gameBinding.ivMusic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,28 +7,23 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.netease.nim.uikit.common.util.sys.NetworkUtil;
|
import com.netease.nim.uikit.common.util.sys.NetworkUtil;
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadmoreListener;
|
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.avroom.adapter.OnlineUserAdapter;
|
import com.yizhuan.erban.avroom.adapter.OnlineUserAdapter;
|
||||||
import com.yizhuan.erban.avroom.presenter.HomePartyUserListPresenter;
|
import com.yizhuan.erban.avroom.presenter.HomePartyUserListPresenter;
|
||||||
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
||||||
import com.yizhuan.erban.base.BaseMvpFragment;
|
import com.yizhuan.erban.base.BaseMvpFragment;
|
||||||
import com.yizhuan.erban.ui.widget.UserInfoDialog;
|
import com.yizhuan.erban.ui.widget.UserInfoDialog;
|
||||||
import com.yizhuan.xchat_android_core.Constants;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
import com.yizhuan.xchat_android_core.room.bean.RoomOnlineUserBean;
|
||||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +39,6 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
|||||||
private SmartRefreshLayout mRefreshLayout;
|
private SmartRefreshLayout mRefreshLayout;
|
||||||
|
|
||||||
private OnlineUserAdapter mOnlineUserAdapter;
|
private OnlineUserAdapter mOnlineUserAdapter;
|
||||||
private int mPage = Constants.PAGE_START;
|
|
||||||
private boolean isShowToUser = false;
|
private boolean isShowToUser = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,24 +52,12 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
|||||||
public void onFindViews() {
|
public void onFindViews() {
|
||||||
mRecyclerView = mView.findViewById(R.id.recycler_view);
|
mRecyclerView = mView.findViewById(R.id.recycler_view);
|
||||||
mRefreshLayout = mView.findViewById(R.id.refresh_layout);
|
mRefreshLayout = mView.findViewById(R.id.refresh_layout);
|
||||||
|
mRefreshLayout.setEnableLoadmore(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSetListener() {
|
public void onSetListener() {
|
||||||
mRefreshLayout.setOnRefreshLoadmoreListener(new OnRefreshLoadmoreListener() {
|
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||||
@Override
|
|
||||||
public void onLoadmore(RefreshLayout refreshLayout) {
|
|
||||||
if (!NetworkUtil.isNetAvailable(mContext)) {
|
|
||||||
mRefreshLayout.finishLoadmore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<OnlineChatMember> data = mOnlineUserAdapter.getData();
|
|
||||||
if (ListUtils.isListEmpty(data)) {
|
|
||||||
mRefreshLayout.finishLoadmore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loadData(data.get(data.size() - 1).chatRoomMember.getEnterTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh(RefreshLayout refreshLayout) {
|
public void onRefresh(RefreshLayout refreshLayout) {
|
||||||
@@ -106,53 +88,24 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
|||||||
|
|
||||||
|
|
||||||
public void firstLoad() {
|
public void firstLoad() {
|
||||||
mPage = Constants.PAGE_START;
|
loadData();
|
||||||
loadData(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadData(long time) {
|
private void loadData() {
|
||||||
getMvpPresenter().requestChatMemberByPage(mPage, time,
|
getMvpPresenter().requestRoomOnlineList(AvRoomDataManager.get().getRoomUid());
|
||||||
mOnlineUserAdapter == null ? null : mOnlineUserAdapter.getData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestChatMemberByPageSuccess(List<OnlineChatMember> chatRoomMemberList, int page) {
|
public void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list) {
|
||||||
mPage = page;
|
mOnlineUserAdapter.setNewData(list);
|
||||||
if (!ListUtils.isListEmpty(chatRoomMemberList)) {
|
mRefreshLayout.finishRefresh();
|
||||||
//超管不显示
|
|
||||||
Iterator<OnlineChatMember> iterator = chatRoomMemberList.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
OnlineChatMember member = iterator.next();
|
|
||||||
if (member != null && SuperAdminUtil.isSuperAdmin(member.chatRoomMember)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mOnlineUserAdapter.setNewData(chatRoomMemberList);
|
|
||||||
if (mPage == Constants.PAGE_START) {
|
|
||||||
mRefreshLayout.finishRefresh();
|
|
||||||
} else {
|
|
||||||
mRefreshLayout.finishLoadmore(0);
|
|
||||||
}
|
|
||||||
mPage++;
|
|
||||||
} else {
|
|
||||||
if (mPage == Constants.PAGE_START) {
|
|
||||||
mRefreshLayout.finishRefresh();
|
|
||||||
} else {
|
|
||||||
mRefreshLayout.finishLoadmore(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
||||||
Logger.i(ResUtil.getString(R.string.avroom_fragment_onlineuserfragment_01) + page);
|
Logger.i(ResUtil.getString(R.string.avroom_fragment_onlineuserfragment_01) + page);
|
||||||
mPage = page;
|
mRefreshLayout.finishRefresh();
|
||||||
if (mPage == Constants.PAGE_START) {
|
|
||||||
mRefreshLayout.finishRefresh();
|
|
||||||
} else {
|
|
||||||
mRefreshLayout.finishLoadmore(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -166,16 +119,12 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
|||||||
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
|
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
|
||||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
if (currentRoom != null) {
|
if (currentRoom != null) {
|
||||||
List<OnlineChatMember> chatRoomMembers = mOnlineUserAdapter.getData();
|
List<RoomOnlineUserBean> chatRoomMembers = mOnlineUserAdapter.getData();
|
||||||
if (ListUtils.isListEmpty(chatRoomMembers)) return;
|
if (ListUtils.isListEmpty(chatRoomMembers)) return;
|
||||||
OnlineChatMember onlineChatMember = chatRoomMembers.get(position);
|
RoomOnlineUserBean onlineChatMember = chatRoomMembers.get(position);
|
||||||
ChatRoomMember chatRoomMember = onlineChatMember.chatRoomMember;
|
if (onlineChatMember != null) {
|
||||||
if (chatRoomMember != null) {
|
|
||||||
if (onlineChatMember.getItemType() == OnlineChatMember.NOBLE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UserInfoDialog.showNewUserInfoDialog(mContext,
|
UserInfoDialog.showNewUserInfoDialog(mContext,
|
||||||
JavaUtil.str2long(chatRoomMember.getAccount()),
|
onlineChatMember.getUid(),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
@@ -185,28 +134,25 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMemberIn(String account, List<OnlineChatMember> dataList) {
|
public void onMemberIn(String account) {
|
||||||
// if (!isResumed()) return;
|
|
||||||
// getMvpPresenter().onMemberInRefreshData(account, dataList, mPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMemberExit(String account, List<OnlineChatMember> dataList) {
|
public void onMemberExit(String account) {
|
||||||
// if (!isResumed()) return;
|
// if (!isResumed()) return;
|
||||||
// if (!isShowToUser()) return;
|
// if (!isShowToUser()) return;
|
||||||
// firstLoad();
|
// firstLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMemberDownUpMic(String account, boolean isUpMic, List<OnlineChatMember> dataList) {
|
public void onMemberDownUpMic(String account, boolean isUpMic) {
|
||||||
if (!isResumed()) return;
|
|
||||||
getMvpPresenter().onMemberDownUpMic(account, isUpMic, dataList, mPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdateMemberManager(String account, boolean isRemoveManager, List<OnlineChatMember> dataList) {
|
public void onUpdateMemberManager(String account, boolean isRemoveManager) {
|
||||||
if (!isResumed()) return;
|
|
||||||
getMvpPresenter().onUpdateMemberManager(account, dataList, isRemoveManager, mPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -13,9 +13,13 @@ import com.yizhuan.erban.R
|
|||||||
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
|
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
|
||||||
import com.yizhuan.erban.avroom.adapter.SingleAnchorMicroViewAdapter
|
import com.yizhuan.erban.avroom.adapter.SingleAnchorMicroViewAdapter
|
||||||
import com.yizhuan.erban.avroom.adapter.SingleRoomPKMicroViewAdapter
|
import com.yizhuan.erban.avroom.adapter.SingleRoomPKMicroViewAdapter
|
||||||
|
import com.yizhuan.erban.avroom.banner.RoomBannerWidget
|
||||||
import com.yizhuan.erban.avroom.dialog.RequestUpMicDialog
|
import com.yizhuan.erban.avroom.dialog.RequestUpMicDialog
|
||||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog
|
import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog
|
||||||
|
import com.yizhuan.erban.avroom.gameplay.RoomGameplayListWidget
|
||||||
|
import com.yizhuan.erban.avroom.gameplay.RoomGameplayWidget
|
||||||
import com.yizhuan.erban.avroom.presenter.SingleRoomPresenter
|
import com.yizhuan.erban.avroom.presenter.SingleRoomPresenter
|
||||||
|
import com.yizhuan.erban.avroom.rank.RoomRankWidget
|
||||||
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget
|
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget
|
||||||
import com.yizhuan.erban.avroom.singleroompk.SingleRoomPkFinishDialog
|
import com.yizhuan.erban.avroom.singleroompk.SingleRoomPkFinishDialog
|
||||||
import com.yizhuan.erban.avroom.singleroompk.SingleRoomPkForceFinishDialog
|
import com.yizhuan.erban.avroom.singleroompk.SingleRoomPkForceFinishDialog
|
||||||
@@ -25,14 +29,12 @@ import com.yizhuan.erban.databinding.FragmentSingleRoomBinding
|
|||||||
import com.yizhuan.erban.fansteam.FansTeamJoinActivity
|
import com.yizhuan.erban.fansteam.FansTeamJoinActivity
|
||||||
import com.yizhuan.erban.fansteam.FansTeamJoinedActivity
|
import com.yizhuan.erban.fansteam.FansTeamJoinedActivity
|
||||||
import com.yizhuan.erban.fansteam.FansTeamViewModel
|
import com.yizhuan.erban.fansteam.FansTeamViewModel
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper
|
|
||||||
import com.yizhuan.erban.ui.utils.load
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||||
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
|
||||||
|
import com.yizhuan.tutu.music.widget.MusicPlayerView
|
||||||
import com.yizhuan.xchat_android_core.UriProvider
|
import com.yizhuan.xchat_android_core.UriProvider
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.fansteam.FansTeamInitInfo
|
import com.yizhuan.xchat_android_core.fansteam.FansTeamInitInfo
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment
|
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RequestUpmicAttachment
|
import com.yizhuan.xchat_android_core.im.custom.bean.RequestUpmicAttachment
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment
|
||||||
@@ -83,24 +85,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
override fun initiate() {
|
override fun initiate() {
|
||||||
super.initiate()
|
super.initiate()
|
||||||
mvpPresenter?.getBannerList()
|
|
||||||
initSpeedyMessage(gameBinding.flSpeedyMessage)
|
initSpeedyMessage(gameBinding.flSpeedyMessage)
|
||||||
GoldBoxHelper.isHideBox().subscribe(
|
|
||||||
{
|
|
||||||
if (it == false) {
|
|
||||||
gameBinding.ivTreasureBox.visibility = View.VISIBLE
|
|
||||||
gameBinding.ivTreasureBox.load(
|
|
||||||
GoldBoxHelper.getBoxIcon(),
|
|
||||||
defaultRes = R.drawable.icon_room_treasure_box
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
gameBinding.ivTreasureBox.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
gameBinding.ivTreasureBox.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
fansTeamViewModel.loadFansTeamInitInfo()
|
fansTeamViewModel.loadFansTeamInitInfo()
|
||||||
|
|
||||||
fansTeamViewModel.fansTeamInitInfoLiveData.observe(viewLifecycleOwner) {
|
fansTeamViewModel.fansTeamInitInfoLiveData.observe(viewLifecycleOwner) {
|
||||||
@@ -109,7 +94,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameBinding.tvHourRank.setOnClickListener {
|
gameBinding.layoutHourRank.setOnClickListener {
|
||||||
DialogWebViewActivity.start(
|
DialogWebViewActivity.start(
|
||||||
mContext,
|
mContext,
|
||||||
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||||
@@ -120,16 +105,10 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
private fun updateFansTeamInfo(initInfo: FansTeamInitInfo) {
|
private fun updateFansTeamInfo(initInfo: FansTeamInitInfo) {
|
||||||
var clickListener: View.OnClickListener? = null
|
var clickListener: View.OnClickListener? = null
|
||||||
if (!AvRoomDataManager.get().isRoomOwner && !initInfo.isAnchorFans && initInfo.hasFansTeamCurrentRoom) {
|
|
||||||
gameBinding.flFansTeamJoinTip.isVisible = true
|
|
||||||
gameBinding.tvFansTeamOpt.isVisible = false
|
|
||||||
} else {
|
|
||||||
gameBinding.flFansTeamJoinTip.isVisible = false
|
|
||||||
gameBinding.tvFansTeamOpt.isVisible = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initInfo.hasFansTeamCurrentRoom) {
|
if (initInfo.hasFansTeamCurrentRoom) {
|
||||||
if (AvRoomDataManager.get().isRoomOwner) {
|
if (AvRoomDataManager.get().isRoomOwner) {
|
||||||
|
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||||
|
gameBinding.tvFansTeamOpt.isVisible = true
|
||||||
gameBinding.tvFansTeamOpt.text = "粉絲團(${initInfo.anchorFansNum})"
|
gameBinding.tvFansTeamOpt.text = "粉絲團(${initInfo.anchorFansNum})"
|
||||||
clickListener = View.OnClickListener {
|
clickListener = View.OnClickListener {
|
||||||
DialogWebViewActivity.start(
|
DialogWebViewActivity.start(
|
||||||
@@ -139,12 +118,16 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (initInfo.isAnchorFans) {
|
if (initInfo.isAnchorFans) {
|
||||||
|
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||||
|
gameBinding.tvFansTeamOpt.isVisible = true
|
||||||
gameBinding.tvFansTeamOpt.text =
|
gameBinding.tvFansTeamOpt.text =
|
||||||
"粉絲LV.${if (initInfo.fansLevelSeq == 0) 1 else initInfo.fansLevelSeq}"
|
"粉絲LV.${if (initInfo.fansLevelSeq == 0) 1 else initInfo.fansLevelSeq}"
|
||||||
clickListener = View.OnClickListener {
|
clickListener = View.OnClickListener {
|
||||||
FansTeamJoinedActivity.start(requireContext())
|
FansTeamJoinedActivity.start(requireContext())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
gameBinding.flFansTeamJoinTip.isVisible = true
|
||||||
|
gameBinding.tvFansTeamOpt.isVisible = false
|
||||||
clickListener = View.OnClickListener {
|
clickListener = View.OnClickListener {
|
||||||
FansTeamJoinActivity.start(requireContext())
|
FansTeamJoinActivity.start(requireContext())
|
||||||
}
|
}
|
||||||
@@ -152,6 +135,8 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (AvRoomDataManager.get().isRoomOwner) {
|
if (AvRoomDataManager.get().isRoomOwner) {
|
||||||
|
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||||
|
gameBinding.tvFansTeamOpt.isVisible = true
|
||||||
gameBinding.tvFansTeamOpt.text = "開通粉絲團"
|
gameBinding.tvFansTeamOpt.text = "開通粉絲團"
|
||||||
clickListener = View.OnClickListener {
|
clickListener = View.OnClickListener {
|
||||||
CommonWebViewActivity.start(
|
CommonWebViewActivity.start(
|
||||||
@@ -160,7 +145,9 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameBinding.tvFansTeamOpt.text = "該主播暫未開通粉絲團"
|
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||||
|
gameBinding.tvFansTeamOpt.isVisible = true
|
||||||
|
gameBinding.tvFansTeamOpt.text = "TA暫未開通粉絲團"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameBinding.flFansTeam.setOnClickListener(clickListener)
|
gameBinding.flFansTeam.setOnClickListener(clickListener)
|
||||||
@@ -230,6 +217,11 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
bottomView.setBottomViewListener(BaseRoomBottomViewWrapper())
|
bottomView.setBottomViewListener(BaseRoomBottomViewWrapper())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onEnterRoom() {
|
||||||
|
super.onEnterRoom()
|
||||||
|
fansTeamViewModel.loadFansTeamInitInfo()
|
||||||
|
}
|
||||||
|
|
||||||
override fun updateView() {
|
override fun updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
if (AvRoomDataManager.get().isOpenAnotherPKMode && gameBinding.microView.adapter !is SingleRoomPKMicroViewAdapter) {
|
if (AvRoomDataManager.get().isOpenAnotherPKMode && gameBinding.microView.adapter !is SingleRoomPKMicroViewAdapter) {
|
||||||
@@ -249,13 +241,10 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowBanner(dialogInfos: List<BannerInfo>) {
|
|
||||||
initRoomAct(gameBinding.activityImg, dialogInfos, 10f)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
||||||
gameBinding.ivFirstChargeEnter.visibility = View.GONE
|
// banner里可能有首充入口:刷新下
|
||||||
|
gameBinding.bannerWidget.refreshData()
|
||||||
FirstChargePrizeDialog(
|
FirstChargePrizeDialog(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
event.chargeProdTitle,
|
event.chargeProdTitle,
|
||||||
@@ -266,5 +255,14 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
override fun initWidget() {
|
override fun initWidget() {
|
||||||
super.initWidget()
|
super.initWidget()
|
||||||
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
||||||
|
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||||
|
registerWidget(RoomBannerWidget::class.java.simpleName, gameBinding.bannerWidget)
|
||||||
|
registerWidget(RoomGameplayListWidget::class.java.simpleName, gameBinding.gameplayListWidget)
|
||||||
|
registerWidget(RoomGameplayWidget::class.java.simpleName, gameBinding.gameplayWidget)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitMusicPlayerView(view: MusicPlayerView) {
|
||||||
|
super.onInitMusicPlayerView(view)
|
||||||
|
view.linkIconView(gameBinding.ivMusic, gameBinding.ivMusic)
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -34,7 +34,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
private val TAG = "GameDelegate"
|
private val TAG = "GameDelegate"
|
||||||
private var APP_CODE = ""
|
private var APP_CODE = ""
|
||||||
|
|
||||||
private val mRoomID = AvRoomDataManager.get().roomUid.toString()
|
private val mRoomID :String get() = AvRoomDataManager.get().roomUid.toString()
|
||||||
private val mLanguage = "zh-TW" //語言
|
private val mLanguage = "zh-TW" //語言
|
||||||
|
|
||||||
//調用遊戲SDK的接口,成功加載遊戲後可用:
|
//調用遊戲SDK的接口,成功加載遊戲後可用:
|
||||||
@@ -84,7 +84,10 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateGame(mgId: Long?) {
|
fun updateGame(mgId: Long?) {
|
||||||
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
|
if (mgId == null || mgId == 0L) return
|
||||||
|
if (mgId == mMGID && iSudFSTAPP != null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
mMGID = mgId
|
mMGID = mgId
|
||||||
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
|
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
|
||||||
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
|
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
package com.yizhuan.erban.avroom.gameplay
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/23 16:09
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class GameplayRecyclerView : RecyclerView {
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun onInterceptTouchEvent(e: MotionEvent?): Boolean {
|
||||||
|
parent.requestDisallowInterceptTouchEvent(true)
|
||||||
|
return super.onInterceptTouchEvent(e)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,70 @@
|
|||||||
|
package com.yizhuan.erban.avroom.gameplay
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewConfiguration
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.databinding.RoomGameplayListWidgetBinding
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.FrameLayoutRoomWidget
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 10:42
|
||||||
|
* Desc:玩法活动
|
||||||
|
**/
|
||||||
|
class RoomGameplayListWidget : FrameLayoutRoomWidget {
|
||||||
|
private val adapter = RoomPlayListAdapter()
|
||||||
|
private val binding: RoomGameplayListWidgetBinding =
|
||||||
|
DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(
|
||||||
|
context
|
||||||
|
), R.layout.room_gameplay_list_widget, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
binding.recyclerView.adapter = adapter
|
||||||
|
binding.ivSwitch.setOnClickListener {
|
||||||
|
getGameplayIconWidget()?.switchUI(false)
|
||||||
|
}
|
||||||
|
adapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
(adapter.getItem(position) as? RoomIcon)?.let {
|
||||||
|
getGameplayIconWidget()?.jump(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getGameplayIconWidget(): RoomGameplayWidget? {
|
||||||
|
return roomView?.findWidget(
|
||||||
|
RoomGameplayWidget::class.simpleName ?: ""
|
||||||
|
) as? RoomGameplayWidget
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadData(list: List<RoomIcon>) {
|
||||||
|
adapter.setNewData(list)
|
||||||
|
if (list.size > 6) {
|
||||||
|
binding.recyclerView.isScrollbarFadingEnabled = false
|
||||||
|
binding.recyclerView.scrollBarFadeDuration = 0
|
||||||
|
} else {
|
||||||
|
binding.recyclerView.isScrollbarFadingEnabled = true
|
||||||
|
binding.recyclerView.scrollBarFadeDuration =
|
||||||
|
ViewConfiguration.getScrollBarFadeDuration()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,131 @@
|
|||||||
|
package com.yizhuan.erban.avroom.gameplay
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.chuhai.utils.ktx.singleClick
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog
|
||||||
|
import com.yizhuan.erban.databinding.RoomGameplayWidgetBinding
|
||||||
|
import com.yizhuan.erban.shipantics.PullRadishActivity
|
||||||
|
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper
|
||||||
|
import com.yizhuan.erban.treasurefairy.HomeFairyActivity
|
||||||
|
import com.yizhuan.erban.ui.utils.load
|
||||||
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||||
|
import com.yizhuan.erban.ui.webview.room_banner.RoomWebDialogActivity
|
||||||
|
import com.yizhuan.erban.utils.CommonJumpHelper
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
import com.yizhuan.xchat_android_core.room.model.AvRoomModel
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.FrameLayoutRoomWidget
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomContext
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomView
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 10:42
|
||||||
|
* Desc:玩法活动
|
||||||
|
**/
|
||||||
|
class RoomGameplayWidget : FrameLayoutRoomWidget {
|
||||||
|
private val binding: RoomGameplayWidgetBinding =
|
||||||
|
DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(
|
||||||
|
context
|
||||||
|
), R.layout.room_gameplay_widget, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
private var isOpened = false
|
||||||
|
|
||||||
|
private var list: List<RoomIcon>? = null
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
binding.ivSwitch.setOnClickListener {
|
||||||
|
switchUI(!isOpened)
|
||||||
|
}
|
||||||
|
binding.ivIcon.singleClick {
|
||||||
|
list?.getOrNull(0)?.let {
|
||||||
|
jump(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitialize(roomView: RoomView, roomContext: RoomContext) {
|
||||||
|
super.onInitialize(roomView, roomContext)
|
||||||
|
refreshData()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refreshData() {
|
||||||
|
val disposable = AvRoomModel.get().roomGamePlayList
|
||||||
|
.subscribe { list: List<RoomIcon> ->
|
||||||
|
loadData(list)
|
||||||
|
}
|
||||||
|
getCompositeDisposable().add(disposable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun switchUI(openListWidget: Boolean) {
|
||||||
|
this.isOpened = openListWidget
|
||||||
|
if (openListWidget) {
|
||||||
|
this.visibility = View.INVISIBLE
|
||||||
|
getGameplayListWidget()?.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
this.visibility = View.VISIBLE
|
||||||
|
getGameplayListWidget()?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData(list: List<RoomIcon>) {
|
||||||
|
this.list = list
|
||||||
|
this.isVisible = list.isNotEmpty()
|
||||||
|
val listWidget = getGameplayListWidget()
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
listWidget?.isVisible = false
|
||||||
|
}
|
||||||
|
listWidget?.loadData(list)
|
||||||
|
binding.ivIcon.load(list.firstOrNull()?.icon)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun jump(data: RoomIcon) {
|
||||||
|
if (data.isSeizeTreasure()) {
|
||||||
|
HomeFairyActivity.start(context)
|
||||||
|
} else if (data.isFirstCharge()) {
|
||||||
|
FirstChargeDialog.start(context)
|
||||||
|
} else if (data.isFindLove()) {
|
||||||
|
GoldBoxHelper.handleBoxClick(context)
|
||||||
|
} else if (data.isNauticalAdventure()) {
|
||||||
|
PullRadishActivity.start(context)
|
||||||
|
} else {
|
||||||
|
val url = data.skipContent
|
||||||
|
if (data.skipType == 3 && !url.isNullOrEmpty()) {
|
||||||
|
if (data.showType == 2) {
|
||||||
|
RoomWebDialogActivity.start(context, url, false)
|
||||||
|
} else {
|
||||||
|
CommonWebViewActivity.start(context, url)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CommonJumpHelper.bannerJump(context, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getGameplayListWidget(): RoomGameplayListWidget? {
|
||||||
|
return roomView?.findWidget(
|
||||||
|
RoomGameplayListWidget::class.simpleName ?: ""
|
||||||
|
) as? RoomGameplayListWidget
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.yizhuan.erban.avroom.gameplay
|
||||||
|
|
||||||
|
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.room.bean.RoomIcon
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 11:38
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class RoomPlayListAdapter :
|
||||||
|
BaseQuickAdapter<RoomIcon, BaseViewHolder>(R.layout.room_gameplay_item) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RoomIcon?) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_icon).load(item?.icon)
|
||||||
|
}
|
||||||
|
}
|
@@ -21,6 +21,7 @@ import com.netease.nimlib.sdk.util.Entry;
|
|||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||||
import com.yizhuan.erban.avroom.core.AudioRoomContext;
|
import com.yizhuan.erban.avroom.core.AudioRoomContext;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||||
import com.yizhuan.xchat_android_core.support.room.RoomContext;
|
import com.yizhuan.xchat_android_core.support.room.RoomContext;
|
||||||
import com.yizhuan.erban.avroom.view.IAvRoomView;
|
import com.yizhuan.erban.avroom.view.IAvRoomView;
|
||||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||||
@@ -120,7 +121,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
|||||||
exitRoom();
|
exitRoom();
|
||||||
}
|
}
|
||||||
AvRoomDataManager.get().updateServiceRoomInfo(roomInfo);
|
AvRoomDataManager.get().updateServiceRoomInfo(roomInfo);
|
||||||
initAnotherPKData();
|
|
||||||
mAvRoomModel.enterRoom(roomInfo.getRoomId(), 3, fromType, fromNick, fromUid)
|
mAvRoomModel.enterRoom(roomInfo.getRoomId(), 3, fromType, fromNick, fromUid)
|
||||||
.flatMap(this::dealServerMicInfo)
|
.flatMap(this::dealServerMicInfo)
|
||||||
.map(this::dealMicMemberFromIMNet)
|
.map(this::dealMicMemberFromIMNet)
|
||||||
@@ -143,6 +143,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
|||||||
.subscribe((stringServiceResult) -> EventBus.getDefault().post(new AudioPartyOpenEvent()));
|
.subscribe((stringServiceResult) -> EventBus.getDefault().post(new AudioPartyOpenEvent()));
|
||||||
mAvRoomModel.loadMessageHistory(AvRoomDataManager.get().clearScreenTime);
|
mAvRoomModel.loadMessageHistory(AvRoomDataManager.get().clearScreenTime);
|
||||||
IMNetEaseManager.get().joinAvRoom();
|
IMNetEaseManager.get().joinAvRoom();
|
||||||
|
initAnotherPKData();
|
||||||
}, this::dealEnterRoomError);
|
}, this::dealEnterRoomError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +152,15 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
|||||||
if (AvRoomDataManager.get().isOpenAnotherPKMode()) {
|
if (AvRoomDataManager.get().isOpenAnotherPKMode()) {
|
||||||
RoomPKModel.INSTANCE.getRoomPKData(AvRoomDataManager.get().getRoomUid())
|
RoomPKModel.INSTANCE.getRoomPKData(AvRoomDataManager.get().getRoomUid())
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(roomPkBean -> AvRoomDataManager.get().roomPkLiveData.setValue(roomPkBean));
|
.subscribe(roomPkBean -> {
|
||||||
|
AvRoomDataManager.get().roomPkLiveData.setValue(roomPkBean);
|
||||||
|
if (AvRoomDataManager.get().isSingleRoom()){
|
||||||
|
AudioEngineManager.get().setRemoteMute(roomPkBean.getAUid(), roomPkBean.getAMicStatus() == 0);
|
||||||
|
if (AvRoomDataManager.get().isRoomOwner()) {
|
||||||
|
AudioEngineManager.get().connectOtherRoom(String.valueOf(roomPkBean.getARoomId()), roomPkBean.getAUid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -525,20 +525,6 @@ public class BaseRoomPresenter<V extends IBaseRoomView> extends BaseMvpPresenter
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
public void loadRoomRank() {
|
|
||||||
String type = AvRoomDataManager.get().isSingleRoom() ? RoomContributeDataInfo.TYPE_ROOM_WEEK_RANKING : RoomContributeDataInfo.TYPE_ROOM_DAY_RANKING;
|
|
||||||
RoomContributeListModel.get().getSingleRoomRanking(1, type)
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.compose(RxHelper.handleBeanData())
|
|
||||||
.subscribe(roomContributeDataInfo -> {
|
|
||||||
if (getMvpView() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getMvpView().updateRoomRanks(roomContributeDataInfo.getRankings());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 發送房間消息
|
* 發送房間消息
|
||||||
* @param message
|
* @param message
|
||||||
|
@@ -1,15 +1,7 @@
|
|||||||
package com.yizhuan.erban.avroom.presenter;
|
package com.yizhuan.erban.avroom.presenter;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.avroom.view.IGameRoomView;
|
import com.yizhuan.erban.avroom.view.IGameRoomView;
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
|
||||||
import com.yizhuan.erban.utils.UserUtils;
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,37 +12,4 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class GameRoomPresenter extends BaseRoomPresenter<IGameRoomView> {
|
public class GameRoomPresenter extends BaseRoomPresenter<IGameRoomView> {
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
public void getBannerList() {
|
|
||||||
AvRoomModel.get().getRoomBanner()
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe(bannerInfos -> {
|
|
||||||
if (bannerInfos == null) bannerInfos = new ArrayList<>();
|
|
||||||
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
|
|
||||||
if (firstCharge) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFirstCharge(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
if(GoldBoxHelper.isShowFairy()){
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFairy(true);
|
|
||||||
bannerInfos.add(firstCharge ? 1 : 0, bannerInfo);
|
|
||||||
}
|
|
||||||
List<BannerInfo> finalBannerInfos = bannerInfos;
|
|
||||||
GoldBoxHelper.isHideBox()
|
|
||||||
.subscribe(isHide -> {
|
|
||||||
if (!isHide) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setBox(true);
|
|
||||||
int index = 0;
|
|
||||||
if (firstCharge) index++;
|
|
||||||
if (GoldBoxHelper.isShowFairy()) index++;
|
|
||||||
finalBannerInfos.add(index, bannerInfo);
|
|
||||||
}
|
|
||||||
getMvpView().onShowBanner(finalBannerInfos);
|
|
||||||
}, throwable -> getMvpView().onShowBanner(finalBannerInfos));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -12,12 +12,10 @@ import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
|||||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
|
||||||
import com.yizhuan.erban.utils.UserUtils;
|
import com.yizhuan.erban.utils.UserUtils;
|
||||||
import com.yizhuan.xchat_android_core.Constants;
|
import com.yizhuan.xchat_android_core.Constants;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||||
@@ -297,49 +295,4 @@ public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
|
|||||||
.subscribe(s -> SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_presenter_homepartypresenter_01))
|
.subscribe(s -> SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_presenter_homepartypresenter_01))
|
||||||
, e -> SingleToastUtil.showToast(e.getMessage()));
|
, e -> SingleToastUtil.showToast(e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
public void getBannerList() {
|
|
||||||
mAvRoomModel.getRoomBanner()
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe(bannerInfos -> {
|
|
||||||
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
|
|
||||||
if (GoldBoxHelper.needIntegrateBoxEntrance()) {
|
|
||||||
if (firstCharge) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFirstCharge(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
if (GoldBoxHelper.isShowRadish()) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setRadish(true);
|
|
||||||
bannerInfos.add(firstCharge ? 1 : 0, bannerInfo);
|
|
||||||
}
|
|
||||||
GoldBoxHelper.isHideBox()
|
|
||||||
.subscribe(isHide -> {
|
|
||||||
if (!isHide) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setBox(true);
|
|
||||||
int index = 0;
|
|
||||||
if (firstCharge) index++;
|
|
||||||
if (GoldBoxHelper.isShowRadish()) index++;
|
|
||||||
bannerInfos.add(index, bannerInfo);
|
|
||||||
}
|
|
||||||
getMvpView().onShowBanner(bannerInfos);
|
|
||||||
}, throwable -> getMvpView().onShowBanner(bannerInfos));
|
|
||||||
} else {
|
|
||||||
if(GoldBoxHelper.isShowFairy()){
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFairy(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
if (firstCharge) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFirstCharge(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
getMvpView().onShowBanner(bannerInfos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -2,15 +2,9 @@ package com.yizhuan.erban.avroom.presenter;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
||||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
|
||||||
import com.yizhuan.xchat_android_core.room.model.HomePartyUserListModel;
|
import com.yizhuan.xchat_android_core.room.model.HomePartyUserListModel;
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> </p>
|
* <p> </p>
|
||||||
@@ -26,49 +20,17 @@ public class HomePartyUserListPresenter extends BaseMvpPresenter<IHomePartyUserL
|
|||||||
mHomePartyUserListMode = new HomePartyUserListModel();
|
mHomePartyUserListMode = new HomePartyUserListModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页获取房间成员:第一页包含队列成员,固定成员,游客50人,之后每一页获取游客50人
|
|
||||||
*
|
|
||||||
* @param page 页数
|
|
||||||
* @param time 固定成员列表用updateTime,
|
|
||||||
* 游客列表用进入enterTime,
|
|
||||||
* 填0会使用当前服务器最新时间开始查询,即第一页,单位毫秒
|
|
||||||
*/
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
public void requestChatMemberByPage(final int page, long time, List<OnlineChatMember> oldList) {
|
public void requestRoomOnlineList(long roomUid){
|
||||||
mHomePartyUserListMode.getOnLinePageMembers(page, time, oldList)
|
mHomePartyUserListMode.getRoomOnlineList(roomUid).compose(bindToLifecycle()).subscribe((data, throwable) -> {
|
||||||
.subscribe(onlineChatMembers -> {
|
if (getMvpView() != null) {
|
||||||
Logger.i(ResUtil.getString(R.string.avroom_presenter_homepartyuserlistpresenter_01), page, onlineChatMembers.size());
|
if (data != null) {
|
||||||
if (getMvpView() != null) {
|
getMvpView().onRequestRoomOnlineListSuccess(data);
|
||||||
getMvpView().onRequestChatMemberByPageSuccess(onlineChatMembers, page);
|
} else {
|
||||||
}
|
getMvpView().onRequestChatMemberByPageFail(throwable.getMessage(), 1);
|
||||||
}, throwable -> {
|
}
|
||||||
throwable.printStackTrace();
|
}
|
||||||
Logger.i(ResUtil.getString(R.string.avroom_presenter_homepartyuserlistpresenter_02), page, throwable.getMessage());
|
});
|
||||||
if (getMvpView() != null) {
|
|
||||||
getMvpView().onRequestChatMemberByPageFail(throwable.getMessage(), page);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMemberDownUpMic(String account, boolean isUpMic, List<OnlineChatMember> dataList,
|
|
||||||
final int page) {
|
|
||||||
mHomePartyUserListMode.onMemberDownUpMic(account, isUpMic, dataList)
|
|
||||||
.subscribe(onlineChatMembers -> {
|
|
||||||
if (getMvpView() != null)
|
|
||||||
getMvpView().onRequestChatMemberByPageSuccess(onlineChatMembers, page);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onUpdateMemberManager(String account, List<OnlineChatMember> dataList,
|
|
||||||
boolean isRemoveManager, final int page) {
|
|
||||||
mHomePartyUserListMode.onUpdateMemberManager(account, isRemoveManager, dataList)
|
|
||||||
.subscribe(onlineChatMembers -> {
|
|
||||||
if (getMvpView() != null)
|
|
||||||
getMvpView().onRequestChatMemberByPageSuccess(onlineChatMembers, page);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -70,10 +70,20 @@ public class RoomManagerPresenter extends BaseMvpPresenter<IRoomManagerView> {
|
|||||||
Iterator<ChatRoomMember> iterator = paramList.iterator();
|
Iterator<ChatRoomMember> iterator = paramList.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ChatRoomMember member = iterator.next();
|
ChatRoomMember member = iterator.next();
|
||||||
if (member != null
|
if (member != null && !TextUtils.isEmpty(member.getAccount())) {
|
||||||
&& !TextUtils.isEmpty(member.getAccount())
|
if (map.containsKey(member.getAccount())) {
|
||||||
&& map.containsKey(member.getAccount())) {
|
iterator.remove();
|
||||||
iterator.remove();
|
} else {
|
||||||
|
if (member.getNick() == null || member.getAvatar() == null) {
|
||||||
|
for (UserInfo info : userInfos) {
|
||||||
|
if (String.valueOf(info.getUid()).equals(member.getAccount())) {
|
||||||
|
member.setNick(info.getNick());
|
||||||
|
member.setAvatar(info.getAvatar());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return paramList;
|
return paramList;
|
||||||
|
@@ -1,11 +1,7 @@
|
|||||||
package com.yizhuan.erban.avroom.presenter;
|
package com.yizhuan.erban.avroom.presenter;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.avroom.view.ISingleRoomView;
|
import com.yizhuan.erban.avroom.view.ISingleRoomView;
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
|
||||||
import com.yizhuan.erban.utils.UserUtils;
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> </p>
|
* <p> </p>
|
||||||
@@ -14,50 +10,4 @@ import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|||||||
* @date 2017/12/8
|
* @date 2017/12/8
|
||||||
*/
|
*/
|
||||||
public class SingleRoomPresenter extends BaseRoomPresenter<ISingleRoomView> {
|
public class SingleRoomPresenter extends BaseRoomPresenter<ISingleRoomView> {
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
public void getBannerList() {
|
|
||||||
mAvRoomModel.getRoomBanner()
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe(bannerInfos -> {
|
|
||||||
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
|
|
||||||
if (GoldBoxHelper.needIntegrateBoxEntrance()) {
|
|
||||||
if (firstCharge) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFirstCharge(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
if (GoldBoxHelper.isShowRadish()) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setRadish(true);
|
|
||||||
bannerInfos.add(firstCharge ? 1 : 0, bannerInfo);
|
|
||||||
}
|
|
||||||
GoldBoxHelper.isHideBox()
|
|
||||||
.subscribe(isHide -> {
|
|
||||||
if (!isHide) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setBox(true);
|
|
||||||
int index = 0;
|
|
||||||
if (firstCharge) index++;
|
|
||||||
if (GoldBoxHelper.isShowRadish()) index++;
|
|
||||||
bannerInfos.add(index, bannerInfo);
|
|
||||||
}
|
|
||||||
getMvpView().onShowBanner(bannerInfos);
|
|
||||||
}, throwable -> getMvpView().onShowBanner(bannerInfos));
|
|
||||||
} else {
|
|
||||||
if(GoldBoxHelper.isShowFairy()){
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFairy(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
if (firstCharge) {
|
|
||||||
BannerInfo bannerInfo = new BannerInfo();
|
|
||||||
bannerInfo.setFirstCharge(true);
|
|
||||||
bannerInfos.add(0, bannerInfo);
|
|
||||||
}
|
|
||||||
getMvpView().onShowBanner(bannerInfos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,94 @@
|
|||||||
|
package com.yizhuan.erban.avroom.rank
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.chuhai.utils.ktx.singleClick
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.databinding.RoomRankWidgetBinding
|
||||||
|
import com.yizhuan.erban.ui.utils.loadAvatar
|
||||||
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.FrameLayoutRoomWidget
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomContext
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomView
|
||||||
|
import com.yizhuan.xchat_android_core.support.room.RoomWidget
|
||||||
|
import com.yizhuan.xchat_android_core.UriProvider
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomContributeDataInfo
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomContributeUserInfo
|
||||||
|
import com.yizhuan.xchat_android_core.room.model.RoomContributeListModel
|
||||||
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间榜单入口
|
||||||
|
*/
|
||||||
|
class RoomRankWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||||
|
|
||||||
|
private val binding: RoomRankWidgetBinding =
|
||||||
|
DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(
|
||||||
|
context
|
||||||
|
), R.layout.room_rank_widget, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
this.singleClick {
|
||||||
|
DialogWebViewActivity.start(context, UriProvider.getRoomRanking())
|
||||||
|
refreshData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitialize(roomView: RoomView, roomContext: RoomContext) {
|
||||||
|
super.onInitialize(roomView, roomContext)
|
||||||
|
refreshData()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUnbindContext() {
|
||||||
|
super.onUnbindContext()
|
||||||
|
updateView(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refreshData() {
|
||||||
|
val disposable = RoomContributeListModel.get()
|
||||||
|
.getSingleRoomRanking(1, RoomContributeDataInfo.TYPE_ROOM_DAY_RANKING)
|
||||||
|
.compose(RxHelper.handleBeanData())
|
||||||
|
.subscribe { roomContributeDataInfo: RoomContributeDataInfo ->
|
||||||
|
updateView(roomContributeDataInfo.rankings)
|
||||||
|
}
|
||||||
|
getCompositeDisposable().add(disposable)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateView(list: List<RoomContributeUserInfo>?) {
|
||||||
|
arrayListOf(
|
||||||
|
binding.ivRank0, binding.ivRank1, binding.ivRank2
|
||||||
|
).forEachIndexed { index, imageView ->
|
||||||
|
val url = list?.getOrNull(index)?.avatar
|
||||||
|
if (url.isNullOrEmpty()) {
|
||||||
|
imageView.isVisible = false
|
||||||
|
} else {
|
||||||
|
imageView.loadAvatar(url)
|
||||||
|
imageView.isVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setContentBackgroundResource(resId: Int) {
|
||||||
|
binding.layoutRoot.setBackgroundResource(resId)
|
||||||
|
}
|
||||||
|
}
|
@@ -56,8 +56,6 @@ class RedPackageWidget : FrameLayoutRoomWidget, RoomWidget {
|
|||||||
), R.layout.red_package_widget, this, true
|
), R.layout.red_package_widget, this, true
|
||||||
)
|
)
|
||||||
|
|
||||||
private var compositeDisposable: CompositeDisposable? = null
|
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
@@ -218,26 +216,14 @@ class RedPackageWidget : FrameLayoutRoomWidget, RoomWidget {
|
|||||||
getCompositeDisposable().add(disposable)
|
getCompositeDisposable().add(disposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCompositeDisposable(): CompositeDisposable {
|
|
||||||
var disposable = compositeDisposable
|
|
||||||
if (disposable == null) {
|
|
||||||
disposable = CompositeDisposable()
|
|
||||||
compositeDisposable = disposable
|
|
||||||
}
|
|
||||||
return disposable
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
this.dialogManager?.dismissDialog()
|
this.dialogManager?.dismissDialog()
|
||||||
this.dialogManager = null
|
this.dialogManager = null
|
||||||
this.roomView = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUnbindContext() {
|
override fun onUnbindContext() {
|
||||||
super.onUnbindContext()
|
super.onUnbindContext()
|
||||||
compositeDisposable?.dispose()
|
|
||||||
compositeDisposable = null
|
|
||||||
loadData(null)
|
loadData(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,8 +17,10 @@ import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
|||||||
import com.yizhuan.erban.ui.utils.load
|
import com.yizhuan.erban.ui.utils.load
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||||
|
import com.yizhuan.xchat_android_core.room.anotherroompk.SingleRoomPKModel
|
||||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||||
|
import com.yizhuan.xchat_android_core.utils.toast
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
@@ -30,7 +32,7 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
|||||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
private val binding = LayoutSingleRoomPkBoardViewBinding.inflate(LayoutInflater.from(context))
|
private val binding = LayoutSingleRoomPkBoardViewBinding.inflate(LayoutInflater.from(context))
|
||||||
private val observer = Observer<RoomPkBean> { updateView(it) }
|
private val observer = Observer<RoomPkBean?> { updateView(it) }
|
||||||
private var disposable: Disposable? = null
|
private var disposable: Disposable? = null
|
||||||
private var roomPkBean: RoomPkBean? = null
|
private var roomPkBean: RoomPkBean? = null
|
||||||
|
|
||||||
@@ -55,6 +57,20 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
|||||||
SingleRoomPkRuleDialog.newInstance().show(context)
|
SingleRoomPkRuleDialog.newInstance().show(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.ivMuteAnother.setOnClickListener {
|
||||||
|
if (AvRoomDataManager.get().isRoomOwner) {
|
||||||
|
roomPkBean?.let {
|
||||||
|
if (it.roundId == null) {
|
||||||
|
return@let
|
||||||
|
}
|
||||||
|
SingleRoomPKModel
|
||||||
|
.muteSingleRoomPkOtherMic(it.roundId, it.aMicStatus xor 1)
|
||||||
|
.subscribe()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"主播已關閉對方房間的聲音".toast()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
override fun onDetachedFromWindow() {
|
||||||
@@ -118,7 +134,13 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
|||||||
binding.ivPkResult.isVisible = true
|
binding.ivPkResult.isVisible = true
|
||||||
binding.ivPkResult.setImageResource(R.drawable.single_room_pk_ic_result_win)
|
binding.ivPkResult.setImageResource(R.drawable.single_room_pk_ic_result_win)
|
||||||
}
|
}
|
||||||
|
if (roomPkBean?.aMicStatus == 0) {
|
||||||
|
binding.ivMuteAnother.isVisible = true
|
||||||
|
binding.ivMuteAnother.setImageResource(R.drawable.single_room_pk_ic_another_mic_close)
|
||||||
|
} else {
|
||||||
|
binding.ivMuteAnother.setImageResource(R.drawable.single_room_pk_ic_another_mic_open)
|
||||||
|
binding.ivMuteAnother.isVisible = AvRoomDataManager.get().isRoomOwner
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -20,6 +20,7 @@ import com.yizhuan.xchat_android_core.utils.ifNotNullOrEmpty
|
|||||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||||
import com.yizhuan.xchat_android_core.utils.toIntOrDef
|
import com.yizhuan.xchat_android_core.utils.toIntOrDef
|
||||||
import com.yizhuan.xchat_android_core.utils.toast
|
import com.yizhuan.xchat_android_core.utils.toast
|
||||||
|
import com.yizhuan.xchat_android_library.common.application.Env
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||||
|
|
||||||
class SingleRoomPKCreateActivity : BaseViewBindingActivity<ActivitySingleRoomPkCreateBinding>() {
|
class SingleRoomPKCreateActivity : BaseViewBindingActivity<ActivitySingleRoomPkCreateBinding>() {
|
||||||
@@ -94,7 +95,8 @@ class SingleRoomPKCreateActivity : BaseViewBindingActivity<ActivitySingleRoomPkC
|
|||||||
|
|
||||||
binding.tvOk.setOnClickListener {
|
binding.tvOk.setOnClickListener {
|
||||||
if (pkTime < 5 || pkTime > 30) {
|
if (pkTime < 5 || pkTime > 30) {
|
||||||
ResUtil.getString(R.string.avroom_singleroompk_singleroompkcreateactivity_01).toast()
|
ResUtil.getString(R.string.avroom_singleroompk_singleroompkcreateactivity_01)
|
||||||
|
.toast()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
currSimpleRoomInfo?.let {
|
currSimpleRoomInfo?.let {
|
||||||
|
@@ -71,6 +71,4 @@ interface IBaseRoomView : IMvpBaseView {
|
|||||||
|
|
||||||
fun updateMicView()
|
fun updateMicView()
|
||||||
|
|
||||||
fun updateRoomRanks(data: List<RoomContributeUserInfo>)
|
|
||||||
|
|
||||||
}
|
}
|
@@ -1,8 +1,5 @@
|
|||||||
package com.yizhuan.erban.avroom.view;
|
package com.yizhuan.erban.avroom.view;
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> 轰趴房View层 </p>
|
* <p> 轰趴房View层 </p>
|
||||||
@@ -12,6 +9,4 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IGameRoomView extends IBaseRoomView {
|
public interface IGameRoomView extends IBaseRoomView {
|
||||||
|
|
||||||
void onShowBanner(List<BannerInfo> dialogInfos);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ package com.yizhuan.erban.avroom.view;
|
|||||||
|
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomOnlineUserBean;
|
||||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,7 +15,8 @@ import java.util.List;
|
|||||||
* @date 2017/12/8
|
* @date 2017/12/8
|
||||||
*/
|
*/
|
||||||
public interface IHomePartyUserListView extends IMvpBaseView {
|
public interface IHomePartyUserListView extends IMvpBaseView {
|
||||||
void onRequestChatMemberByPageSuccess(List<OnlineChatMember> memberList, int page);
|
|
||||||
|
void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list);
|
||||||
|
|
||||||
void onRequestChatMemberByPageFail(String errorStr, int page);
|
void onRequestChatMemberByPageFail(String errorStr, int page);
|
||||||
|
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
package com.yizhuan.erban.avroom.view;
|
package com.yizhuan.erban.avroom.view;
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> 轰趴房View层 </p>
|
* <p> 轰趴房View层 </p>
|
||||||
@@ -20,6 +18,4 @@ public interface IHomePartyView extends IBaseRoomView {
|
|||||||
* 礼物值模式下换麦
|
* 礼物值模式下换麦
|
||||||
*/
|
*/
|
||||||
void onGiftValueChangeMic(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo);
|
void onGiftValueChangeMic(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo);
|
||||||
|
|
||||||
void onShowBanner(List<BannerInfo> bannerInfos);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
package com.yizhuan.erban.avroom.view;
|
package com.yizhuan.erban.avroom.view;
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> 轰趴房View层 </p>
|
* <p> 轰趴房View层 </p>
|
||||||
@@ -12,6 +9,4 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISingleRoomView extends IBaseRoomView {
|
public interface ISingleRoomView extends IBaseRoomView {
|
||||||
|
|
||||||
void onShowBanner(List<BannerInfo> dialogInfos);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,8 +2,10 @@ package com.yizhuan.erban.avroom.widget;
|
|||||||
|
|
||||||
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_FAIRY;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GIFT_COMPOUND;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GIFT_COMPOUND;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GUARDIAN_PLANET;
|
||||||
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_RED_PACKAGE;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_ALBUM;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_ALBUM;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_TEMPLATE;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L1;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L1;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L2;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L2;
|
||||||
@@ -119,6 +121,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
|
|||||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftBatchAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.GiftBatchAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftCompoundAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.GiftCompoundAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftCompoundMsgBean;
|
import com.yizhuan.xchat_android_core.im.custom.bean.GiftCompoundMsgBean;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.GuardianPlanetAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.JoinMiniWorldAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.JoinMiniWorldAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.JoinMiniWorldNoticeAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.JoinMiniWorldNoticeAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.MagicAllMicAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.MagicAllMicAttachment;
|
||||||
@@ -143,6 +146,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttach
|
|||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
|
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.im.custom.bean.TarotMsgBean;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.TemplateMessageAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.User;
|
import com.yizhuan.xchat_android_core.im.custom.bean.User;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.VipMessageAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.VipMessageAttachment;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
|
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
|
||||||
@@ -253,6 +257,7 @@ public class MessageView extends FrameLayout {
|
|||||||
private OnClick onClick;
|
private OnClick onClick;
|
||||||
|
|
||||||
private OnMsgLongClickListener onLongClickListener;
|
private OnMsgLongClickListener onLongClickListener;
|
||||||
|
private TemplateMessageAdapter templateMessageAdapter;
|
||||||
|
|
||||||
public MessageView(Context context) {
|
public MessageView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -433,7 +438,17 @@ public class MessageView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private TemplateMessageAdapter getTemplateMessageAdapter() {
|
||||||
|
if (templateMessageAdapter == null) {
|
||||||
|
templateMessageAdapter = new TemplateMessageAdapter(uid -> {
|
||||||
|
if (clickConsumer != null) {
|
||||||
|
Single.just(String.valueOf(uid)).subscribe(clickConsumer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return templateMessageAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCurrentRoomReceiveNewMsg(List<ChatRoomMessage> messages) {
|
public void onCurrentRoomReceiveNewMsg(List<ChatRoomMessage> messages) {
|
||||||
@@ -617,6 +632,19 @@ public class MessageView extends FrameLayout {
|
|||||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param drawable -icon url
|
||||||
|
* @return -返回一個spannableStringBuilder
|
||||||
|
*/
|
||||||
|
public SpannableBuilder appendImg(String drawable, Object what) {
|
||||||
|
if (TextUtils.isEmpty(drawable)) return this;
|
||||||
|
int start = builder.length();
|
||||||
|
builder.append("-");
|
||||||
|
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable);
|
||||||
|
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param drawable -icon url
|
* @param drawable -icon url
|
||||||
@@ -633,6 +661,16 @@ public class MessageView extends FrameLayout {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SpannableBuilder append(String drawable, int width, int height, Object what) {
|
||||||
|
if (TextUtils.isEmpty(drawable)) return this;
|
||||||
|
int start = builder.length();
|
||||||
|
builder.append("-");
|
||||||
|
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, width, height);
|
||||||
|
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文本和背景分離的情況
|
* 文本和背景分離的情況
|
||||||
*/
|
*/
|
||||||
@@ -674,6 +712,16 @@ public class MessageView extends FrameLayout {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SpannableBuilder append(String imgUrl, int height, Object what) {
|
||||||
|
if (TextUtils.isEmpty(imgUrl)) return this;
|
||||||
|
int start = builder.length();
|
||||||
|
builder.append("-");
|
||||||
|
builder.setSpan(new CustomAutoWidthImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, imgUrl, height)
|
||||||
|
, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param drawable -icon
|
* @param drawable -icon
|
||||||
* @param width 寬
|
* @param width 寬
|
||||||
@@ -1032,6 +1080,15 @@ public class MessageView extends FrameLayout {
|
|||||||
setFairyMsg(chatRoomMessage, tvContent);
|
setFairyMsg(chatRoomMessage, tvContent);
|
||||||
} else if (first == CUSTOM_MSG_ROOM_ALBUM) {
|
} else if (first == CUSTOM_MSG_ROOM_ALBUM) {
|
||||||
setRoomAlbumMsg(chatRoomMessage, baseViewHolder);
|
setRoomAlbumMsg(chatRoomMessage, baseViewHolder);
|
||||||
|
} else if (first == CUSTOM_MSG_GUARDIAN_PLANET) {
|
||||||
|
setGuardianPlanetMsg(chatRoomMessage, tvContent);
|
||||||
|
} else if (first == CUSTOM_MSG_ROOM_TEMPLATE) {
|
||||||
|
TemplateMessageAttachment templateMessageAttachment = (TemplateMessageAttachment) chatRoomMessage.getAttachment();
|
||||||
|
if (templateMessageAttachment != null) {
|
||||||
|
getTemplateMessageAdapter().convert(tvContent, templateMessageAttachment.getTemplateMessage());
|
||||||
|
} else {
|
||||||
|
getTemplateMessageAdapter().convert(tvContent, null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tvContent.setTextColor(Color.WHITE);
|
tvContent.setTextColor(Color.WHITE);
|
||||||
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
||||||
@@ -1948,6 +2005,37 @@ public class MessageView extends FrameLayout {
|
|||||||
tvContent.setText(text.build());
|
tvContent.setText(text.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setGuardianPlanetMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||||
|
GuardianPlanetAttachment attachment = (GuardianPlanetAttachment) chatRoomMessage.getAttachment();
|
||||||
|
// 內容
|
||||||
|
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||||
|
.append(ResUtil.getString(R.string.congratulation), new ForegroundColorSpan(greyColor))
|
||||||
|
.append(attachment.getNick(), new ForegroundColorSpan(roomTipNickColor),
|
||||||
|
new OriginalDrawStatusClickSpan() {
|
||||||
|
@Override
|
||||||
|
public void onClick(@NonNull View widget) {
|
||||||
|
if (clickConsumer != null) {
|
||||||
|
Single.just(String.valueOf(attachment.getUid())).subscribe(clickConsumer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.guardian_planet_msg_1),
|
||||||
|
new ForegroundColorSpan(greyColor)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
String.valueOf(attachment.getDiamonds()),
|
||||||
|
new ForegroundColorSpan(whiteColor)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.guardian_planet_msg_2),
|
||||||
|
new ForegroundColorSpan(greyColor)
|
||||||
|
);
|
||||||
|
tvContent.setText(text.build());
|
||||||
|
tvContent.setOnClickListener(null);
|
||||||
|
tvContent.setMovementMethod(new LinkMovementMethod());
|
||||||
|
}
|
||||||
|
|
||||||
private void setLuckySeaMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
private void setLuckySeaMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||||
RoomLuckySeaAttachment attachment = (RoomLuckySeaAttachment) chatRoomMessage.getAttachment();
|
RoomLuckySeaAttachment attachment = (RoomLuckySeaAttachment) chatRoomMessage.getAttachment();
|
||||||
RoomLuckySeaMsgBean bean = attachment.getRoomLuckySeaMsgInfo();
|
RoomLuckySeaMsgBean bean = attachment.getRoomLuckySeaMsgInfo();
|
||||||
@@ -2248,8 +2336,12 @@ public class MessageView extends FrameLayout {
|
|||||||
//等級
|
//等級
|
||||||
builder.append(userLevel, expLevelHeight);
|
builder.append(userLevel, expLevelHeight);
|
||||||
//銘牌
|
//銘牌
|
||||||
|
boolean isCustom = NobleUtil.getExtBoolean( chatRoomMessage,UserInfo.NAMEPLATE_IS_CUSTOM,false);
|
||||||
String tvNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_WORD, chatRoomMessage).trim();
|
String tvNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_WORD, chatRoomMessage).trim();
|
||||||
String ivNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_PIC, chatRoomMessage);
|
String ivNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_PIC, chatRoomMessage);
|
||||||
|
if (isCustom) {
|
||||||
|
tvNamePlate = null;
|
||||||
|
}
|
||||||
if (!TextUtils.isEmpty(tvNamePlate) && !TextUtils.isEmpty(ivNamePlate)) { // extension != null 表示自己
|
if (!TextUtils.isEmpty(tvNamePlate) && !TextUtils.isEmpty(ivNamePlate)) { // extension != null 表示自己
|
||||||
builder.appendBgAndContent(ivNamePlate, tvNamePlate);
|
builder.appendBgAndContent(ivNamePlate, tvNamePlate);
|
||||||
} else if (!TextUtils.isEmpty(ivNamePlate)) {
|
} else if (!TextUtils.isEmpty(ivNamePlate)) {
|
||||||
|
@@ -151,8 +151,8 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
|||||||
.subscribe { roomEvent: RoomEvent? ->
|
.subscribe { roomEvent: RoomEvent? ->
|
||||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||||
when (roomEvent.event) {
|
when (roomEvent.event) {
|
||||||
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
// RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
// RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.RADISH_NOTIFY,
|
RoomEvent.RADISH_NOTIFY,
|
||||||
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
||||||
|
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
import android.text.Layout
|
import android.text.Layout
|
||||||
import android.text.StaticLayout
|
import android.text.StaticLayout
|
||||||
import android.text.TextPaint
|
import android.text.TextPaint
|
||||||
@@ -19,34 +20,49 @@ import android.view.animation.AnimationUtils
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.annotation.NonNull
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
|
import androidx.core.util.Consumer
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.bumptech.glide.request.target.CustomTarget
|
||||||
|
import com.bumptech.glide.request.transition.Transition
|
||||||
|
import com.chuhai.utils.UiUtils
|
||||||
|
import com.chuhai.utils.ktx.setPadding2
|
||||||
import com.coorchice.library.SuperTextView
|
import com.coorchice.library.SuperTextView
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||||
|
import com.netease.nim.uikit.support.glide.GlideApp
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomNotificationAttachment
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomNotificationAttachment
|
||||||
import com.opensource.svgaplayer.*
|
import com.opensource.svgaplayer.*
|
||||||
import com.opensource.svgaplayer.SVGAParser.Companion.shareParser
|
import com.opensource.svgaplayer.SVGAParser.Companion.shareParser
|
||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.application.XChatApplication
|
||||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||||
import com.yizhuan.erban.avroom.bean.RoomPlayBean
|
import com.yizhuan.erban.avroom.bean.RoomPlayBean
|
||||||
import com.yizhuan.erban.avroom.helper.AnimHelper
|
import com.yizhuan.erban.avroom.helper.AnimHelper
|
||||||
|
import com.yizhuan.erban.base.TitleBar
|
||||||
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
|
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
|
||||||
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
|
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
|
||||||
|
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||||
import com.yizhuan.erban.ui.utils.isDestroyed
|
import com.yizhuan.erban.ui.utils.isDestroyed
|
||||||
import com.yizhuan.erban.ui.utils.load
|
import com.yizhuan.erban.ui.utils.load
|
||||||
import com.yizhuan.erban.ui.utils.loadAnim
|
import com.yizhuan.erban.ui.utils.loadAnim
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||||
import com.yizhuan.erban.ui.widget.SimpleAnimListener
|
import com.yizhuan.erban.ui.widget.SimpleAnimListener
|
||||||
|
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftGoRoomTipsDialog
|
||||||
|
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftGoRoomTipsDialog.Companion.isNeedTips
|
||||||
import com.yizhuan.erban.ui.widget.drawgift.DrawGiftPlayHelper
|
import com.yizhuan.erban.ui.widget.drawgift.DrawGiftPlayHelper
|
||||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
import com.yizhuan.erban.utils.CommonJumpHelper
|
||||||
import com.yizhuan.erban.utils.MsgBuilder
|
import com.yizhuan.erban.utils.MsgBuilder
|
||||||
import com.yizhuan.erban.utils.RegexUtil
|
import com.yizhuan.erban.utils.RegexUtil
|
||||||
import com.yizhuan.erban.utils.SpannableBuilder
|
import com.yizhuan.erban.utils.SpannableBuilder
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants
|
import com.yizhuan.xchat_android_constants.XChatConstants
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo
|
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo
|
||||||
|
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.*
|
import com.yizhuan.xchat_android_core.im.custom.bean.*
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
|
||||||
@@ -134,14 +150,37 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
|
|
||||||
private val drawGiftPlayHelper: DrawGiftPlayHelper by lazy { DrawGiftPlayHelper(context as Activity) }
|
private val drawGiftPlayHelper: DrawGiftPlayHelper by lazy { DrawGiftPlayHelper(context as Activity) }
|
||||||
|
|
||||||
private var isPlayAnim = false
|
private var playNotifyStateLiveData: MutableLiveData<Boolean>? = null
|
||||||
|
|
||||||
|
private var showUserCardAction: ((String) -> Unit)? = null
|
||||||
|
|
||||||
|
private val templateMessageAdapter =
|
||||||
|
TemplateMessageAdapter(listener = object : TemplateMessageAdapter.Listener {
|
||||||
|
override fun onShowUserCard(uid: String) {
|
||||||
|
showUserCardAction?.invoke(uid)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
private var onPlayAnimCallback: (() -> Boolean)? = null
|
private var onPlayAnimCallback: (() -> Boolean)? = null
|
||||||
|
fun setPlayNotifyStateListener(stateLiveData: MutableLiveData<Boolean>) {
|
||||||
|
this.playNotifyStateLiveData = stateLiveData
|
||||||
|
}
|
||||||
|
|
||||||
fun setOnPlayAnimCallback(onPlayAnimCallback: (() -> Boolean)) {
|
fun setOnPlayAnimCallback(onPlayAnimCallback: (() -> Boolean)) {
|
||||||
this.onPlayAnimCallback = onPlayAnimCallback
|
this.onPlayAnimCallback = onPlayAnimCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setShowUserCardAction(call: Consumer<String>) {
|
||||||
|
this.showUserCardAction = {
|
||||||
|
call.accept(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private fun isShowingGiftNotify(): Boolean {
|
||||||
|
return onPlayAnimCallback?.invoke() ?: false
|
||||||
|
}
|
||||||
|
|
||||||
private fun loopCarAnim() {
|
private fun loopCarAnim() {
|
||||||
if (context.isDestroyed()) return
|
if (context.isDestroyed()) return
|
||||||
isSvgaPlaying = false
|
isSvgaPlaying = false
|
||||||
@@ -194,6 +233,18 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoomEvent.CRAZY_ZOO_ROOM_NOTIFY -> {// 疯狂动物园-房间
|
||||||
|
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomEvent.CRAZY_ZOO_ALL_ROOM_NOTIFY -> {// 疯狂动物园-全服
|
||||||
|
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomEvent.TEMPLATE_NOTIFY -> {// 通用模版飘屏
|
||||||
|
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||||
|
}
|
||||||
|
|
||||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||||
RoomEvent.FAIRY_CONVERT_L1,
|
RoomEvent.FAIRY_CONVERT_L1,
|
||||||
@@ -230,7 +281,7 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
|
|
||||||
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
|
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
|
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showSingleRoomRankNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
RoomEvent.ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
||||||
RoomEvent.ROOM_CAR_EFFECT_HIDE -> {
|
RoomEvent.ROOM_CAR_EFFECT_HIDE -> {
|
||||||
isHideCarEffect = true
|
isHideCarEffect = true
|
||||||
@@ -265,6 +316,11 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
loopCarAnim()
|
loopCarAnim()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
var statusBarHeight = TitleBar.getStatusBarHeight()
|
||||||
|
if (statusBarHeight == 0) {
|
||||||
|
statusBarHeight = UiUtils.dip2px(25f)
|
||||||
|
}
|
||||||
|
binding.clNotify.setPadding2(top = binding.clNotify.paddingTop + statusBarHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,29 +341,18 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
if (binding.flPlayNotify.childCount != 0) {
|
if (binding.flPlayNotify.childCount != 0) {
|
||||||
return@subscribe
|
return@subscribe
|
||||||
}
|
}
|
||||||
|
if (binding.flTemplateNotify.childCount != 0) {
|
||||||
|
return@subscribe
|
||||||
|
}
|
||||||
|
if (binding.flLuckyBagNotify.childCount != 0) {
|
||||||
|
return@subscribe
|
||||||
|
}
|
||||||
|
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||||
when (messagesPlay[0].event) {
|
when (messagesPlay[0].event) {
|
||||||
RoomEvent.BOX_NOTIFY -> {//寻爱
|
RoomEvent.BOX_NOTIFY -> {//寻爱
|
||||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
if ((mContext as AVRoomActivity).isTopActivity || XChatApplication.gStack.topActivity is TreasureBoxActivity) {
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 180.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 60.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showBoxNotify(
|
showBoxNotify(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
@@ -315,51 +360,17 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱
|
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱
|
||||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
if ((mContext as AVRoomActivity).isTopActivity || XChatApplication.gStack.topActivity is TreasureBoxActivity) {
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 180.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 60.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
|
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.TAROT_NOTIFY -> {
|
RoomEvent.TAROT_NOTIFY -> {
|
||||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 180.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 60.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showTarotNotify(
|
showTarotNotify(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
@@ -368,25 +379,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
|
|
||||||
RoomEvent.TAROT_NOTIFY_SVGA -> {
|
RoomEvent.TAROT_NOTIFY_SVGA -> {
|
||||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 180.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, 60.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
|
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,17 +389,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
if (!(mContext as AVRoomActivity).isTopActivity) {
|
if (!(mContext as AVRoomActivity).isTopActivity) {
|
||||||
return@subscribe
|
return@subscribe
|
||||||
}
|
}
|
||||||
|
playNotifyStateLiveData?.value = true
|
||||||
isPlayAnim = true
|
resetPlayNotifyMargin()
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
|
||||||
margin(
|
|
||||||
binding.clNotify,
|
|
||||||
0,
|
|
||||||
UIUtil.dip2px(context, if (isPlay) 180.0 else 60.0),
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
|
|
||||||
val msg = messagesPlay.removeAt(0)
|
val msg = messagesPlay.removeAt(0)
|
||||||
val attachment = msg.chatRoomMessage.attachment as NotifyH5Attachment
|
val attachment = msg.chatRoomMessage.attachment as NotifyH5Attachment
|
||||||
val bean = attachment.bean ?: return@subscribe
|
val bean = attachment.bean ?: return@subscribe
|
||||||
@@ -418,56 +403,58 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> {//福袋
|
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> {//福袋
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 180.0), 0, 0)
|
|
||||||
} else {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
|
||||||
}
|
|
||||||
showLuckyBagNotify(
|
showLuckyBagNotify(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
|
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 180.0), 0, 0)
|
|
||||||
} else {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
|
||||||
}
|
|
||||||
showLuckySeaNotify(
|
showLuckySeaNotify(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
|
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 180.0), 0, 0)
|
|
||||||
} else {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
|
||||||
}
|
|
||||||
showLuckySeaNotifyBySVGA(
|
showLuckySeaNotifyBySVGA(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoomEvent.CRAZY_ZOO_ROOM_NOTIFY -> {//疯狂动物园-房间(静态)
|
||||||
|
playNotifyStateLiveData?.value = true
|
||||||
|
resetPlayNotifyMargin()
|
||||||
|
showZooNotify(
|
||||||
|
messagesPlay.removeAt(0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomEvent.CRAZY_ZOO_ALL_ROOM_NOTIFY -> {//疯狂动物园-全服(动态)
|
||||||
|
playNotifyStateLiveData?.value = true
|
||||||
|
resetPlayNotifyMargin()
|
||||||
|
showZooNotifyBySVGA(
|
||||||
|
messagesPlay.removeAt(0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomEvent.TEMPLATE_NOTIFY -> {//通用模版飘屏
|
||||||
|
resetPlayNotifyMargin()
|
||||||
|
showTemplateNotify(
|
||||||
|
messagesPlay.removeAt(0)
|
||||||
|
)
|
||||||
|
}
|
||||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||||
RoomEvent.FAIRY_CONVERT_L1,
|
RoomEvent.FAIRY_CONVERT_L1,
|
||||||
RoomEvent.FAIRY_CONVERT_L2,
|
RoomEvent.FAIRY_CONVERT_L2,
|
||||||
RoomEvent.FAIRY_CONVERT_L3 -> {//夺宝
|
RoomEvent.FAIRY_CONVERT_L3 -> {//夺宝
|
||||||
isPlayAnim = true
|
playNotifyStateLiveData?.value = true
|
||||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
resetPlayNotifyMargin()
|
||||||
if (isPlay) {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 180.0), 0, 0)
|
|
||||||
} else {
|
|
||||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
|
||||||
}
|
|
||||||
showFairyNotify(
|
showFairyNotify(
|
||||||
messagesPlay.removeAt(0)
|
messagesPlay.removeAt(0)
|
||||||
)
|
)
|
||||||
@@ -494,8 +481,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
textView.startAnimation(animationPlay)
|
textView.startAnimation(animationPlay)
|
||||||
binding.flPlayNotify.postDelayed(
|
binding.flPlayNotify.postDelayed(
|
||||||
{
|
{
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(textView)
|
binding.flPlayNotify.removeView(textView)
|
||||||
isPlayAnim = false
|
|
||||||
},
|
},
|
||||||
SHOW_TIME.toLong()
|
SHOW_TIME.toLong()
|
||||||
)
|
)
|
||||||
@@ -521,8 +508,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
override fun onFinished() {
|
override fun onFinished() {
|
||||||
binding.flPlayNotify.post {
|
binding.flPlayNotify.post {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
isPlayAnim = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -641,6 +628,19 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
) + "…"
|
) + "…"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置玩法飘窗间距
|
||||||
|
*/
|
||||||
|
private fun resetPlayNotifyMargin() {
|
||||||
|
var top = 0
|
||||||
|
if (isShowingGiftNotify()) {
|
||||||
|
// 有礼物飘窗展示时,需要在它下面展示
|
||||||
|
// 间距 = 礼物飘窗高度(375:69) + 10DP间距
|
||||||
|
top = (width / 375f * 69).toInt() + UiUtils.dip2px(10f)
|
||||||
|
}
|
||||||
|
margin(binding.clNotify, 0, top, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
private fun margin(v: View, l: Int, t: Int, r: Int, b: Int) {
|
private fun margin(v: View, l: Int, t: Int, r: Int, b: Int) {
|
||||||
if (v.layoutParams is MarginLayoutParams) {
|
if (v.layoutParams is MarginLayoutParams) {
|
||||||
val params = v.layoutParams as MarginLayoutParams
|
val params = v.layoutParams as MarginLayoutParams
|
||||||
@@ -653,89 +653,69 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
val message = roomPlayBean.chatRoomMessage
|
val message = roomPlayBean.chatRoomMessage
|
||||||
val attachment = message.attachment as? RoomReceivedLuckyGiftAttachment ?: return
|
val attachment = message.attachment as? RoomReceivedLuckyGiftAttachment ?: return
|
||||||
val noticeInfo = attachment.luckyBagNoticeInfo ?: return
|
val noticeInfo = attachment.luckyBagNoticeInfo ?: return
|
||||||
|
val roomView = LayoutInflater.from(mContext)
|
||||||
|
.inflate(R.layout.layout_room_lucky_bag_notify, null)
|
||||||
|
val bagImageView = roomView.findViewById<ImageView>(R.id.iv_bag)
|
||||||
|
bagImageView.load(noticeInfo.luckyBagGiftPic)
|
||||||
|
val giftImageView = roomView.findViewById<ImageView>(R.id.iv_gift)
|
||||||
|
giftImageView.load(noticeInfo.giftPic)
|
||||||
|
val messageTextView = roomView.findViewById<TextView>(R.id.tv_message)
|
||||||
val text = SpannableBuilder()
|
val text = SpannableBuilder()
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_04),
|
noticeInfo.nick.subAndReplaceDot(6),
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FFF45E))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_027),
|
||||||
ForegroundColorSpan(Color.WHITE)
|
ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
noticeInfo.nick.subAndReplaceDot(6) + " ",
|
noticeInfo.luckyBagName,
|
||||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FFF45E))
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_028),
|
||||||
ForegroundColorSpan(Color.WHITE)
|
ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
noticeInfo.luckyBagName + " ",
|
noticeInfo.goldPrice + ResUtil.getString(R.string.diamond_name),
|
||||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.notice_nick))
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_06),
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_029),
|
||||||
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)
|
ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
noticeInfo.giftName,
|
noticeInfo.giftName,
|
||||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.notice_nick))
|
||||||
|
)
|
||||||
|
if (noticeInfo.giftNum > 1) {
|
||||||
|
text.append(
|
||||||
|
"X" + noticeInfo.giftNum,
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.white))
|
||||||
)
|
)
|
||||||
|
|
||||||
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.flPlayNotify.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.flPlayNotify.post {
|
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
|
||||||
isPlayAnim = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
messageTextView.text = text.build()
|
||||||
|
bagImageView.setOnClickListener {
|
||||||
|
goRoom(noticeInfo.roomTitle, noticeInfo.roomUid)
|
||||||
|
}
|
||||||
|
giftImageView.setOnClickListener {
|
||||||
|
goRoom(noticeInfo.roomTitle, noticeInfo.roomUid)
|
||||||
|
}
|
||||||
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||||
|
binding.flLuckyBagNotify.addView(roomView)
|
||||||
|
roomView.startAnimation(animationPlay)
|
||||||
|
binding.flLuckyBagNotify.postDelayed(
|
||||||
|
{
|
||||||
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||||
|
roomView.startAnimation(animationPlay)
|
||||||
|
},
|
||||||
|
6500
|
||||||
|
)
|
||||||
|
binding.flLuckyBagNotify.postDelayed({
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
|
binding.flLuckyBagNotify.removeView(roomView)
|
||||||
|
}, 7000)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showLuckySeaNotify(roomPlayBean: RoomPlayBean) {
|
private fun showLuckySeaNotify(roomPlayBean: RoomPlayBean) {
|
||||||
@@ -780,13 +760,212 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
textView.startAnimation(animationPlay)
|
textView.startAnimation(animationPlay)
|
||||||
binding.flPlayNotify.postDelayed(
|
binding.flPlayNotify.postDelayed(
|
||||||
{
|
{
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(textView)
|
binding.flPlayNotify.removeView(textView)
|
||||||
isPlayAnim = false
|
|
||||||
},
|
},
|
||||||
SHOW_TIME.toLong()
|
SHOW_TIME.toLong()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showZooNotify(roomPlayBean: RoomPlayBean) {
|
||||||
|
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||||
|
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
|
||||||
|
val bean = attachment.roomLuckySeaMsgInfo
|
||||||
|
val textView =
|
||||||
|
LayoutInflater.from(mContext)
|
||||||
|
.inflate(R.layout.layout_room_zoo_notify, null) as TextView
|
||||||
|
val text = SpannableBuilder()
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.congratulation),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.nick,
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FEF23E))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.in_the_zoo),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.itemMultiple.toString(),
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.times_reward_get),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.diamonds.toString(),
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.diamond_point),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
textView.text = text.build()
|
||||||
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||||
|
binding.flPlayNotify.addView(textView)
|
||||||
|
textView.startAnimation(animationPlay)
|
||||||
|
binding.flPlayNotify.postDelayed(
|
||||||
|
{
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
|
binding.flPlayNotify.removeView(textView)
|
||||||
|
},
|
||||||
|
SHOW_TIME.toLong()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showTemplateNotify(roomPlayBean: RoomPlayBean) {
|
||||||
|
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||||
|
val attachment =
|
||||||
|
chatRoomMessage.attachment as? RoomTemplateNotifyAttachment
|
||||||
|
val msgBean = attachment?.getTemplateMsg()
|
||||||
|
val resourceType = msgBean?.resourceType
|
||||||
|
if (resourceType == "IMAGE") {
|
||||||
|
showTemplateImageNotify(msgBean)
|
||||||
|
} else if (resourceType == "SVGA") {
|
||||||
|
showTemplateSvgaNotify(msgBean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showTemplateImageNotify(msgBean: RoomTemplateNotifyMsgBean) {
|
||||||
|
if (msgBean.resourceType != "IMAGE") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val resourceContent = msgBean.resourceContent
|
||||||
|
if (resourceContent.isNullOrEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
playNotifyStateLiveData?.value = true
|
||||||
|
val rootView = LayoutInflater.from(mContext)
|
||||||
|
.inflate(R.layout.layout_room_template_notify_image, null)
|
||||||
|
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
||||||
|
val textSize = msgBean.fontSize?.toFloat() ?: 12f
|
||||||
|
val textColor =
|
||||||
|
templateMessageAdapter.parseColor(msgBean.textColor) ?: Color.WHITE
|
||||||
|
textView.textSize = textSize
|
||||||
|
textView.setTextColor(textColor)
|
||||||
|
val bgView = rootView.findViewById<ImageView>(R.id.iv_bg)
|
||||||
|
val params = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
binding.flTemplateNotify.addView(rootView, params)
|
||||||
|
val endAction = {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
|
binding.flTemplateNotify.removeView(rootView)
|
||||||
|
}
|
||||||
|
GlideApp.with(bgView)
|
||||||
|
.load(resourceContent).into(object : CustomTarget<Drawable>() {
|
||||||
|
override fun onResourceReady(
|
||||||
|
resource: Drawable,
|
||||||
|
transition: Transition<in Drawable>?
|
||||||
|
) {
|
||||||
|
templateMessageAdapter.convert(textView, msgBean)
|
||||||
|
bgView.setImageDrawable(resource)
|
||||||
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||||
|
rootView.startAnimation(animationPlay)
|
||||||
|
val skipType = msgBean.skipType
|
||||||
|
if (skipType != null) {
|
||||||
|
val clickAction = View.OnClickListener {
|
||||||
|
if (skipType == BannerInfo.SKIP_TYPE_ROOM_USER_CARD) {
|
||||||
|
showUserCardAction?.invoke(msgBean.skipContent ?: "")
|
||||||
|
} else {
|
||||||
|
CommonJumpHelper.bannerJump(context, skipType, msgBean.skipContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootView.setOnClickListener(clickAction)
|
||||||
|
textView.setOnClickListener(clickAction)
|
||||||
|
}
|
||||||
|
binding.flTemplateNotify.postDelayed(endAction, SHOW_TIME.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
|
endAction.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||||
|
super.onLoadFailed(errorDrawable)
|
||||||
|
endAction.invoke()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showTemplateSvgaNotify(msgBean: RoomTemplateNotifyMsgBean) {
|
||||||
|
if (msgBean.resourceType != "SVGA") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val resourceContent = msgBean.resourceContent
|
||||||
|
if (resourceContent.isNullOrEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
playNotifyStateLiveData?.value = true
|
||||||
|
val svgaImageView = SVGAImageView(mContext)
|
||||||
|
val endAction = {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
|
binding.flTemplateNotify.removeView(svgaImageView)
|
||||||
|
}
|
||||||
|
svgaImageView.loops = 1
|
||||||
|
svgaImageView.clearsAfterDetached = true
|
||||||
|
val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, 0)
|
||||||
|
params.dimensionRatio = msgBean.getDimensionRatio() ?: "75:11"
|
||||||
|
svgaImageView.layoutParams = params
|
||||||
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
|
override fun onFinished() {
|
||||||
|
endAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.flTemplateNotify.addView(svgaImageView)
|
||||||
|
shareParser().decodeFromURL(
|
||||||
|
URL(resourceContent),
|
||||||
|
object : SVGAParser.ParseCompletion {
|
||||||
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||||
|
val text = templateMessageAdapter.parse(context, msgBean) ?: ""
|
||||||
|
val textKey = msgBean.getSvgaTextKey()
|
||||||
|
val textSize = msgBean.fontSize?.toFloat() ?: 24f
|
||||||
|
val textColor =
|
||||||
|
templateMessageAdapter.parseColor(msgBean.textColor) ?: Color.WHITE
|
||||||
|
val dynamicEntity = SVGADynamicEntity()
|
||||||
|
val textPaint = TextPaint()
|
||||||
|
textPaint.color = textColor //字體顏色
|
||||||
|
textPaint.textSize = textSize //字體大小
|
||||||
|
dynamicEntity.setDynamicText(
|
||||||
|
StaticLayout(
|
||||||
|
text,
|
||||||
|
0,
|
||||||
|
text.length,
|
||||||
|
textPaint,
|
||||||
|
0,
|
||||||
|
Layout.Alignment.ALIGN_CENTER,
|
||||||
|
1.0f,
|
||||||
|
0.0f,
|
||||||
|
false
|
||||||
|
), textKey
|
||||||
|
)
|
||||||
|
val skipType = msgBean.skipType
|
||||||
|
if (skipType != null) {
|
||||||
|
svgaImageView.setOnClickListener {
|
||||||
|
if (skipType == BannerInfo.SKIP_TYPE_ROOM_USER_CARD) {
|
||||||
|
showUserCardAction?.invoke(msgBean.skipContent?:"")
|
||||||
|
} else {
|
||||||
|
CommonJumpHelper.bannerJump(context, skipType, msgBean.skipContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||||
|
svgaImageView.setImageDrawable(drawable)
|
||||||
|
svgaImageView.stepToFrame(0, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError() {
|
||||||
|
endAction.invoke()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun showLuckySeaNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
private fun showLuckySeaNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
||||||
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||||
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
|
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
|
||||||
@@ -828,8 +1007,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
override fun onFinished() {
|
override fun onFinished() {
|
||||||
binding.flPlayNotify.post {
|
binding.flPlayNotify.post {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
isPlayAnim = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -871,9 +1050,93 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showZooNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
||||||
|
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||||
|
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
|
||||||
|
val bean = attachment.roomLuckySeaMsgInfo
|
||||||
|
val text = SpannableBuilder()
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.congratulation),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.nick + " ",
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FEF23E))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.in_the_zoo),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.itemMultiple.toString(),
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.times_reward_get),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
bean.diamonds.toString(),
|
||||||
|
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.diamond_point),
|
||||||
|
ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
val svgaImageView = SVGAImageView(mContext)
|
||||||
|
svgaImageView.loops = 1
|
||||||
|
svgaImageView.clearsAfterDetached = true
|
||||||
|
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||||
|
svgaImageView.layoutParams = params
|
||||||
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
|
override fun onFinished() {
|
||||||
|
binding.flPlayNotify.post {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.flPlayNotify.addView(svgaImageView)
|
||||||
|
shareParser().decodeFromAssets(
|
||||||
|
"svga/zoo_notify.svga",
|
||||||
|
object : SVGAParser.ParseCompletion {
|
||||||
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||||
|
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
|
||||||
|
), "noble_text_tx"
|
||||||
|
)
|
||||||
|
svgaImageView.setOnClickListener {
|
||||||
|
if (!TextUtils.isEmpty(bean.skipUrl)) {
|
||||||
|
CommonWebViewActivity.start(mContext, bean.skipUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||||
|
svgaImageView.setImageDrawable(drawable)
|
||||||
|
svgaImageView.stepToFrame(0, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError() {}
|
||||||
|
},
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun showNotifyH5(data: NotifyH5Info) {
|
private fun showNotifyH5(data: NotifyH5Info) {
|
||||||
val textView = LayoutInflater.from(mContext)
|
val textView = LayoutInflater.from(mContext)
|
||||||
.inflate(R.layout.layout_notify_h5, null) as TextView
|
.inflate(R.layout.layout_notify_h5, null) as TextView
|
||||||
textView.text = data.content
|
textView.text = data.content
|
||||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||||
binding.flPlayNotify.addView(textView)
|
binding.flPlayNotify.addView(textView)
|
||||||
@@ -886,8 +1149,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
SHOW_TIME.toLong()
|
SHOW_TIME.toLong()
|
||||||
)
|
)
|
||||||
binding.flPlayNotify.postDelayed({
|
binding.flPlayNotify.postDelayed({
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(textView)
|
binding.flPlayNotify.removeView(textView)
|
||||||
isPlayAnim = false
|
|
||||||
}, CLOSE_TIME.toLong())
|
}, CLOSE_TIME.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,8 +1164,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
override fun onFinished() {
|
override fun onFinished() {
|
||||||
binding.flPlayNotify.post {
|
binding.flPlayNotify.post {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
isPlayAnim = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -962,8 +1225,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
SHOW_TIME.toLong()
|
SHOW_TIME.toLong()
|
||||||
)
|
)
|
||||||
binding.flPlayNotify.postDelayed({
|
binding.flPlayNotify.postDelayed({
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(textView)
|
binding.flPlayNotify.removeView(textView)
|
||||||
isPlayAnim = false
|
|
||||||
}, CLOSE_TIME.toLong())
|
}, CLOSE_TIME.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1005,8 +1268,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
SHOW_TIME.toLong()
|
SHOW_TIME.toLong()
|
||||||
)
|
)
|
||||||
binding.flPlayNotify.postDelayed({
|
binding.flPlayNotify.postDelayed({
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(textView)
|
binding.flPlayNotify.removeView(textView)
|
||||||
isPlayAnim = false
|
|
||||||
}, CLOSE_TIME.toLong())
|
}, CLOSE_TIME.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1028,8 +1291,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||||
override fun onFinished() {
|
override fun onFinished() {
|
||||||
binding.flPlayNotify.post {
|
binding.flPlayNotify.post {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
isPlayAnim = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1100,8 +1363,8 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||||
animationPlay!!.setAnimationListener(object : SimpleAnimationListener() {
|
animationPlay!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||||
override fun onAnimationEnd(animation: Animation?) {
|
override fun onAnimationEnd(animation: Animation?) {
|
||||||
|
playNotifyStateLiveData?.value = false
|
||||||
binding.flPlayNotify.removeView(svgaImageView)
|
binding.flPlayNotify.removeView(svgaImageView)
|
||||||
isPlayAnim = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
binding.flPlayNotify.startAnimation(animationPlay)
|
binding.flPlayNotify.startAnimation(animationPlay)
|
||||||
@@ -1907,6 +2170,27 @@ class RoomEffectView @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) {
|
private fun showRoomRankNotify(chatRoomMessage: ChatRoomMessage) {
|
||||||
if (binding.clNotify.visibility == GONE) {
|
if (binding.clNotify.visibility == GONE) {
|
||||||
@@ -1935,10 +2219,6 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
}, SHOW_TIME.toLong())
|
}, SHOW_TIME.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIsPlayAnim(): Boolean {
|
|
||||||
return isPlayAnim
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
override fun onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow()
|
super.onDetachedFromWindow()
|
||||||
playDisposable?.dispose()
|
playDisposable?.dispose()
|
||||||
@@ -1952,7 +2232,20 @@ class RoomEffectView @JvmOverloads constructor(
|
|||||||
disposableRoomPK?.dispose()
|
disposableRoomPK?.dispose()
|
||||||
disposableSingleRoomPK?.dispose()
|
disposableSingleRoomPK?.dispose()
|
||||||
disposableGiftCompound?.dispose()
|
disposableGiftCompound?.dispose()
|
||||||
isPlayAnim = false
|
playNotifyStateLiveData?.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun goRoom(roomTitle: String, roomUid: Long) {
|
||||||
|
if (roomUid <= 0L) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (roomUid == AvRoomDataManager.get().roomUid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isNeedTips()) {
|
||||||
|
AllServiceGiftGoRoomTipsDialog(context, roomTitle, roomUid).show()
|
||||||
|
} else {
|
||||||
|
AVRoomActivity.start(context, roomUid)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,179 @@
|
|||||||
|
package com.yizhuan.erban.avroom.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.text.method.LinkMovementMethod
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.chuhai.utils.UiUtils
|
||||||
|
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan
|
||||||
|
import com.yizhuan.erban.utils.CommonJumpHelper
|
||||||
|
import com.yizhuan.erban.utils.SpannableBuilder
|
||||||
|
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.TemplateMessage
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.TemplateMessage.TemplateNode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/22 17:20
|
||||||
|
* Desc:模版消息适配器
|
||||||
|
**/
|
||||||
|
class TemplateMessageAdapter(val listener: Listener?) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析为文本(子节点只支持TEXT类型)
|
||||||
|
*/
|
||||||
|
fun parse(context: Context, attachment: TemplateMessage?): SpannableStringBuilder? {
|
||||||
|
val builder = SpannableBuilder()
|
||||||
|
if (attachment == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
val nodeList = attachment.getNodeList()
|
||||||
|
nodeList.forEach {
|
||||||
|
if (it is TemplateNode.NormalNode) {
|
||||||
|
val textColor = parseColor(it.textColor)
|
||||||
|
if (textColor != null) {
|
||||||
|
builder.append(it.text, ForegroundColorSpan(textColor))
|
||||||
|
} else {
|
||||||
|
builder.append(it.text)
|
||||||
|
}
|
||||||
|
} else if (it is TemplateNode.SpecialNode) {
|
||||||
|
when (it.content.type) {
|
||||||
|
TemplateMessage.Content.TEXT -> {
|
||||||
|
val text = it.content.text?.getFirstText()
|
||||||
|
if (!text.isNullOrEmpty()) {
|
||||||
|
val textColor = parseColor(it.content.textColor)
|
||||||
|
val clickSpan = createClickSpan(context, it.content, listener)
|
||||||
|
val list = ArrayList<Any>()
|
||||||
|
if (textColor != null) {
|
||||||
|
list.add(ForegroundColorSpan(textColor))
|
||||||
|
}
|
||||||
|
if (clickSpan != null) {
|
||||||
|
list.add(clickSpan)
|
||||||
|
}
|
||||||
|
builder.append(text, *list.toArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun convert(textView: TextView, attachment: TemplateMessage?) {
|
||||||
|
if (attachment == null) {
|
||||||
|
textView.text = ""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val nodeList = attachment.getNodeList()
|
||||||
|
val textBuilder = MessageView.SpannableBuilder(textView)
|
||||||
|
nodeList.forEach {
|
||||||
|
if (it is TemplateNode.NormalNode) {
|
||||||
|
val textColor = parseColor(it.textColor)
|
||||||
|
if (textColor != null) {
|
||||||
|
textBuilder.append(it.text, ForegroundColorSpan(textColor))
|
||||||
|
} else {
|
||||||
|
textBuilder.append(it.text)
|
||||||
|
}
|
||||||
|
} else if (it is TemplateNode.SpecialNode) {
|
||||||
|
when (it.content.type) {
|
||||||
|
TemplateMessage.Content.TEXT -> {
|
||||||
|
val text = it.content.text?.getFirstText()
|
||||||
|
if (!text.isNullOrEmpty()) {
|
||||||
|
val textColor = parseColor(it.content.textColor)
|
||||||
|
val clickSpan = createClickSpan(textView.context, it.content, listener)
|
||||||
|
val list = ArrayList<Any>()
|
||||||
|
if (textColor != null) {
|
||||||
|
list.add(ForegroundColorSpan(textColor))
|
||||||
|
}
|
||||||
|
if (clickSpan != null) {
|
||||||
|
list.add(clickSpan)
|
||||||
|
}
|
||||||
|
textBuilder.append(text, *list.toArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TemplateMessage.Content.IMAGE -> {
|
||||||
|
val image = it.content.image
|
||||||
|
val width = it.content.width ?: 0
|
||||||
|
val height = it.content.height ?: 0
|
||||||
|
val clickSpan = createClickSpan(textView.context, it.content, listener)
|
||||||
|
if (height > 0 && width == 0) {
|
||||||
|
if (clickSpan != null) {
|
||||||
|
textBuilder.append(
|
||||||
|
image,
|
||||||
|
UiUtils.dip2px(height.toFloat()),
|
||||||
|
clickSpan
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
textBuilder.append(image, UiUtils.dip2px(height.toFloat()))
|
||||||
|
}
|
||||||
|
} else if (height > 0 && width > 0) {
|
||||||
|
if (clickSpan != null) {
|
||||||
|
textBuilder.append(
|
||||||
|
image,
|
||||||
|
UiUtils.dip2px(width.toFloat()),
|
||||||
|
UiUtils.dip2px(height.toFloat()), clickSpan
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
textBuilder.append(
|
||||||
|
image,
|
||||||
|
UiUtils.dip2px(width.toFloat()),
|
||||||
|
UiUtils.dip2px(height.toFloat())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (clickSpan != null) {
|
||||||
|
textBuilder.appendImg(image, clickSpan)
|
||||||
|
} else {
|
||||||
|
textBuilder.appendImg(image)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textView.text = textBuilder.build()
|
||||||
|
textView.setOnClickListener(null)
|
||||||
|
textView.movementMethod = LinkMovementMethod()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createClickSpan(
|
||||||
|
context: Context,
|
||||||
|
content: TemplateMessage.Content,
|
||||||
|
listener: Listener?
|
||||||
|
): OriginalDrawStatusClickSpan? {
|
||||||
|
val skipType = content.getSkipType()
|
||||||
|
val skipUri = content.getSkipUri()
|
||||||
|
if (skipType > 0 && !skipUri.isNullOrEmpty()) {
|
||||||
|
return object : OriginalDrawStatusClickSpan() {
|
||||||
|
override fun onClick(widget: View) {
|
||||||
|
if (skipType == BannerInfo.SKIP_TYPE_ROOM_USER_CARD) {
|
||||||
|
listener?.onShowUserCard(skipUri)
|
||||||
|
} else {
|
||||||
|
CommonJumpHelper.bannerJump(context, content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun parseColor(color: String?): Int? {
|
||||||
|
if (color == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Color.parseColor(color)
|
||||||
|
} catch (e: java.lang.Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Listener {
|
||||||
|
fun onShowUserCard(uid: String)
|
||||||
|
}
|
||||||
|
}
|
@@ -6,6 +6,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
|||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
|
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_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_BOX;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CRAZY_ZOO;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM;
|
||||||
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_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_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;
|
||||||
@@ -17,6 +19,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
|||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
|
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_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_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY;
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL;
|
||||||
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;
|
||||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_USER_ALL_UPGRADE;
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_USER_ALL_UPGRADE;
|
||||||
import static com.yizhuan.xchat_android_library.utils.UIUtils.getActivityByContext;
|
import static com.yizhuan.xchat_android_library.utils.UIUtils.getActivityByContext;
|
||||||
@@ -105,6 +109,7 @@ 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.PlayEffectInfo;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
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.RoomLuckySeaMsgBean;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTemplateNotifyMsgBean;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
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.AvRoomDataManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||||
@@ -883,6 +888,10 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
return rxPermissions.request(mPerms);
|
return rxPermissions.request(mPerms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RxPermissions getRxPermissions(){
|
||||||
|
return rxPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收到全局广播信息
|
* 接收到全局广播信息
|
||||||
*
|
*
|
||||||
@@ -992,17 +1001,10 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
if (data == null || data.getGiftUrl() == null) return;
|
if (data == null || data.getGiftUrl() == null) return;
|
||||||
giftList.add(data);
|
giftList.add(data);
|
||||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||||
if (giftDialog != null && giftDialog.isShowing()) {
|
if (isShowingPlayNotify()) {
|
||||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
return;
|
||||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
|
||||||
if (dataBean != null) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
giftDialog.dismiss();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showGiftDialog();
|
|
||||||
}
|
}
|
||||||
|
showGiftDialog();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CUSTOM_MSG_BOX://寻爱之旅
|
case CUSTOM_MSG_BOX://寻爱之旅
|
||||||
@@ -1106,7 +1108,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
if (roomLuckySeaMsgBean == null) return;
|
if (roomLuckySeaMsgBean == null) return;
|
||||||
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
||||||
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||||
playEffectInfo.setSecond(CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
|
playEffectInfo.setSecond(baseProtocol.getSecond());
|
||||||
playEffectInfo.setRoomLuckySeaMsgBean(roomLuckySeaMsgBean);
|
playEffectInfo.setRoomLuckySeaMsgBean(roomLuckySeaMsgBean);
|
||||||
playEffectList.add(playEffectInfo);
|
playEffectList.add(playEffectInfo);
|
||||||
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||||
@@ -1122,6 +1124,64 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_MSG_CRAZY_ZOO://疯狂动物园
|
||||||
|
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 roomLuckySeaMsgBean2 = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class);
|
||||||
|
if (roomLuckySeaMsgBean2 == null) return;
|
||||||
|
if (baseProtocol.getSecond() == CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM) {
|
||||||
|
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||||
|
playEffectInfo.setSecond(baseProtocol.getSecond());
|
||||||
|
playEffectInfo.setRoomLuckySeaMsgBean(roomLuckySeaMsgBean2);
|
||||||
|
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_TEMPLATE_NOTIFY://通用飘屏
|
||||||
|
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<>();
|
||||||
|
}
|
||||||
|
RoomTemplateNotifyMsgBean templateNotifyMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomTemplateNotifyMsgBean.class);
|
||||||
|
if (templateNotifyMsgBean == null) return;
|
||||||
|
if (baseProtocol.getSecond() == CUSTOM_MSG_TEMPLATE_NOTIFY_ALL) {
|
||||||
|
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||||
|
playEffectInfo.setSecond(baseProtocol.getSecond());
|
||||||
|
playEffectInfo.setTemplateNotifyMsgBean(templateNotifyMsgBean);
|
||||||
|
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://福袋
|
case CUSTOM_MSG_LUCKY_GIFT://福袋
|
||||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||||
@@ -1187,8 +1247,11 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
|
|
||||||
private void showPlayEffectDialog() {
|
private void showPlayEffectDialog() {
|
||||||
if (playEffectList.size() == 0) return;
|
if (playEffectList.size() == 0) return;
|
||||||
playEffectDialog = new AllPlayEffectDialog(this, playEffectList.peekFirst());
|
PlayEffectInfo info = playEffectList.peekFirst();
|
||||||
|
if (info == null) return;
|
||||||
|
playEffectDialog = new AllPlayEffectDialog(this, info, isShowingGiftNotify());
|
||||||
playEffectDialog.setOnDismissListener(dialog -> {
|
playEffectDialog.setOnDismissListener(dialog -> {
|
||||||
|
tryShowGiftDialog();
|
||||||
playEffectList.pollFirst();
|
playEffectList.pollFirst();
|
||||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||||
if (dataBean != null) {
|
if (dataBean != null) {
|
||||||
@@ -1206,12 +1269,20 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tryShowGiftDialog() {
|
||||||
|
showGiftDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void showGiftDialog() {
|
private void showGiftDialog() {
|
||||||
|
if (giftList == null) return;
|
||||||
if (giftList.size() == 0) return;
|
if (giftList.size() == 0) return;
|
||||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (giftDialog != null && giftDialog.isShowing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!data.isHomeShow()) {
|
if (!data.isHomeShow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1234,6 +1305,20 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isShowingGiftNotify() {
|
||||||
|
if (giftDialog != null && giftDialog.isShowing()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isShowingPlayNotify() {
|
||||||
|
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private AllServiceGiftLevelDialog generateAllServiceGiftDialog(@NonNull Context context, @NonNull AllServiceGiftProtocol.DataBean dataBean) {
|
private AllServiceGiftLevelDialog generateAllServiceGiftDialog(@NonNull Context context, @NonNull AllServiceGiftProtocol.DataBean dataBean) {
|
||||||
return new AllServiceGiftLevelDialog(context, dataBean);
|
return new AllServiceGiftLevelDialog(context, dataBean);
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ import java.lang.reflect.ParameterizedType
|
|||||||
abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
|
abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
|
||||||
|
|
||||||
val isViewLoaded: Boolean get() = _binding != null
|
val isViewLoaded: Boolean get() = _binding != null
|
||||||
private var _binding: T? = null
|
protected var _binding: T? = null
|
||||||
private var onDismissListener: (() -> Unit)? = null
|
private var onDismissListener: (() -> Unit)? = null
|
||||||
val binding get() = _binding!!
|
val binding get() = _binding!!
|
||||||
open var width = ScreenUtil.getDialogWidth()
|
open var width = ScreenUtil.getDialogWidth()
|
||||||
|
@@ -2,33 +2,24 @@ package com.yizhuan.erban.common.widget;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Outline;
|
||||||
import android.graphics.Bitmap.Config;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.PorterDuffXfermode;
|
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.widget.ImageView;
|
import android.view.View;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
|
|
||||||
|
import com.google.android.material.imageview.ShapeableImageView;
|
||||||
|
import com.google.android.material.shape.CornerFamily;
|
||||||
|
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义View,实现圆角,圆形等效果
|
* 自定义View,实现圆角,圆形等效果
|
||||||
*
|
*
|
||||||
* @author zhy
|
* @author zhy
|
||||||
*/
|
*/
|
||||||
public class RectRoundImageView extends ImageView {
|
public class RectRoundImageView extends ShapeableImageView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TYPE_CIRCLE / TYPE_ROUND
|
* TYPE_CIRCLE / TYPE_ROUND
|
||||||
@@ -37,42 +28,11 @@ public class RectRoundImageView extends ImageView {
|
|||||||
public static final int TYPE_CIRCLE = 0;
|
public static final int TYPE_CIRCLE = 0;
|
||||||
public static final int TYPE_ROUND = 1;
|
public static final int TYPE_ROUND = 1;
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片
|
|
||||||
*/
|
|
||||||
private Bitmap mSrc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 圆角的大小
|
* 圆角的大小
|
||||||
*/
|
*/
|
||||||
private int mRadius = 8;
|
private int mRadius = 8;
|
||||||
|
|
||||||
/**
|
|
||||||
* 控件的宽度
|
|
||||||
*/
|
|
||||||
private int mWidth;
|
|
||||||
/**
|
|
||||||
* 控件的高度
|
|
||||||
*/
|
|
||||||
private int mHeight;
|
|
||||||
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(int type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getmRadius() {
|
|
||||||
return mRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setmRadius(int mRadius) {
|
|
||||||
this.mRadius = mRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RectRoundImageView(Context context, AttributeSet attrs) {
|
public RectRoundImageView(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
}
|
}
|
||||||
@@ -98,17 +58,6 @@ public class RectRoundImageView extends ImageView {
|
|||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int attr = a.getIndex(i);
|
int attr = a.getIndex(i);
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case R.styleable.RectRoundImageView_src:
|
|
||||||
// mSrc = BitmapFactory.decodeResource(getResources(),
|
|
||||||
// a.getResourceId(attr, 0));
|
|
||||||
InputStream is = getResources().openRawResource(a.getResourceId(attr, 0));
|
|
||||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
|
||||||
opts.inTempStorage = new byte[100 * 1024];
|
|
||||||
opts.inPreferredConfig = Config.RGB_565;
|
|
||||||
opts.inPurgeable = true;
|
|
||||||
opts.inSampleSize = 4;
|
|
||||||
mSrc = BitmapFactory.decodeStream(is, null, opts);
|
|
||||||
break;
|
|
||||||
case R.styleable.RectRoundImageView_type:
|
case R.styleable.RectRoundImageView_type:
|
||||||
type = a.getInt(attr, 0);// 默认为Circle
|
type = a.getInt(attr, 0);// 默认为Circle
|
||||||
break;
|
break;
|
||||||
@@ -121,197 +70,25 @@ public class RectRoundImageView extends ImageView {
|
|||||||
}
|
}
|
||||||
setScaleType(ScaleType.CENTER_CROP);
|
setScaleType(ScaleType.CENTER_CROP);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
setup(type, mRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setup(int type, int cornerSize) {
|
||||||
/**
|
if (type == TYPE_CIRCLE) {
|
||||||
* 计算控件的高度和宽度
|
setOutlineProvider(new ViewOutlineProvider() {
|
||||||
*/
|
@Override
|
||||||
@Override
|
public void getOutline(View view, Outline outline) {
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
int min = Math.min(view.getWidth(), view.getHeight());
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
int left = (view.getWidth() - min) / 2;
|
||||||
Drawable drawable = getDrawable();
|
int top = (view.getHeight() - min) / 2;
|
||||||
if (null != drawable) {
|
outline.setOval(left, top, min, min);
|
||||||
mSrc = drawableToBitmap(getDrawable());
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置宽度
|
|
||||||
*/
|
|
||||||
int specMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
||||||
int specSize = MeasureSpec.getSize(widthMeasureSpec);
|
|
||||||
|
|
||||||
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
|
||||||
{
|
|
||||||
mWidth = specSize;
|
|
||||||
} else {
|
|
||||||
// 由图片决定的宽
|
|
||||||
int desireByImg = getPaddingLeft() + getPaddingRight()
|
|
||||||
+ mSrc.getWidth();
|
|
||||||
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
|
||||||
{
|
|
||||||
mWidth = Math.min(desireByImg, specSize);
|
|
||||||
} else
|
|
||||||
mWidth = desireByImg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 设置高度
|
|
||||||
*/
|
|
||||||
|
|
||||||
specMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
||||||
specSize = MeasureSpec.getSize(heightMeasureSpec);
|
|
||||||
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
|
||||||
{
|
|
||||||
mHeight = specSize;
|
|
||||||
} else {
|
|
||||||
int desire = getPaddingTop() + getPaddingBottom()
|
|
||||||
+ mSrc.getHeight();
|
|
||||||
|
|
||||||
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
|
||||||
{
|
|
||||||
mHeight = Math.min(desire, specSize);
|
|
||||||
} else
|
|
||||||
mHeight = desire;
|
|
||||||
}
|
|
||||||
|
|
||||||
setMeasuredDimension(mWidth, mHeight);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onDraw(Canvas canvas) {
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
// 如果是TYPE_CIRCLE绘制圆形
|
|
||||||
case TYPE_CIRCLE:
|
|
||||||
int min = Math.min(mWidth, mHeight);
|
|
||||||
/**
|
|
||||||
* 长度如果不一致,按小的值进行压缩
|
|
||||||
*/
|
|
||||||
if (null != mSrc) {
|
|
||||||
mSrc = Bitmap.createScaledBitmap(mSrc, min, min, false);
|
|
||||||
canvas.drawBitmap(createCircleImage(mSrc, min), 0, 0, null);
|
|
||||||
}
|
}
|
||||||
break;
|
});
|
||||||
case TYPE_ROUND:
|
setClipToOutline(true);
|
||||||
canvas.drawBitmap(createFramedPhoto(mWidth, mHeight, mSrc, mRadius), 0, 0, null);
|
} else if (type == TYPE_ROUND) {
|
||||||
break;
|
setShapeAppearanceModel(ShapeAppearanceModel.builder()
|
||||||
|
.setAllCorners(CornerFamily.ROUNDED, cornerSize)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Drawable → Bitmap
|
|
||||||
*
|
|
||||||
* @param drawable
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static Bitmap drawableToBitmap(Drawable drawable) {
|
|
||||||
|
|
||||||
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
|
|
||||||
|
|
||||||
drawable.getIntrinsicHeight(),
|
|
||||||
|
|
||||||
drawable.getOpacity() != PixelFormat.OPAQUE ? Config.ARGB_8888
|
|
||||||
|
|
||||||
: Config.RGB_565);
|
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
|
||||||
|
|
||||||
//canvas.setBitmap(bitmap);
|
|
||||||
|
|
||||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
|
||||||
|
|
||||||
drawable.draw(canvas);
|
|
||||||
|
|
||||||
return bitmap;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据原图和变长绘制圆形图片
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* @param min
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Bitmap createCircleImage(Bitmap source, int min) {
|
|
||||||
final Paint paint = new Paint();
|
|
||||||
paint.setAntiAlias(true);
|
|
||||||
Bitmap target = Bitmap.createBitmap(min, min, Config.RGB_565);
|
|
||||||
/**
|
|
||||||
* 产生一个同样大小的画布
|
|
||||||
*/
|
|
||||||
Canvas canvas = new Canvas(target);
|
|
||||||
/**
|
|
||||||
* 首先绘制圆形
|
|
||||||
*/
|
|
||||||
canvas.drawCircle(min / 2, min / 2, min / 2, paint);
|
|
||||||
/**
|
|
||||||
* 使用SRC_IN,参考上面的说明
|
|
||||||
*/
|
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
|
||||||
/**
|
|
||||||
* 绘制图片
|
|
||||||
*/
|
|
||||||
canvas.drawBitmap(source, 0, 0, paint);
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据原图添加圆角
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Bitmap createRoundConerImage(Bitmap source) {
|
|
||||||
final Paint paint = new Paint();
|
|
||||||
paint.setAntiAlias(true);
|
|
||||||
Bitmap target = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
|
|
||||||
Canvas canvas = new Canvas(target);
|
|
||||||
RectF rect = new RectF(0, 0, source.getWidth(), source.getHeight());
|
|
||||||
canvas.drawRoundRect(rect, mRadius, mRadius, paint);
|
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
|
||||||
canvas.drawBitmap(source, 0, 0, paint);
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param x 图像的宽度
|
|
||||||
* @param y 图像的高度
|
|
||||||
* @param image 源图片
|
|
||||||
* @param outerRadiusRat 圆角的大小
|
|
||||||
* @return 圆角图片
|
|
||||||
*/
|
|
||||||
Bitmap createFramedPhoto(int x, int y, Bitmap image, float outerRadiusRat) {
|
|
||||||
//根据源文件新建一个darwable对象
|
|
||||||
Drawable imageDrawable = new BitmapDrawable(image);
|
|
||||||
// 新建一个新的输出图片
|
|
||||||
Bitmap output = Bitmap.createBitmap(x, y, Config.ARGB_8888);
|
|
||||||
|
|
||||||
Canvas canvas = new Canvas(output);
|
|
||||||
|
|
||||||
// 新建一个矩形
|
|
||||||
RectF outerRect = new RectF(0, 0, x, y);
|
|
||||||
|
|
||||||
// 产生一个红色的圆角矩形
|
|
||||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
||||||
paint.setColor(Color.RED);
|
|
||||||
canvas.drawRoundRect(outerRect, outerRadiusRat, outerRadiusRat, paint);
|
|
||||||
|
|
||||||
// 将源图片绘制到这个圆角矩形上
|
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
|
||||||
imageDrawable.setBounds(0, 0, x, y);
|
|
||||||
canvas.saveLayer(outerRect, paint, Canvas.ALL_SAVE_FLAG);
|
|
||||||
imageDrawable.draw(canvas);
|
|
||||||
canvas.restore();
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ class FansTeamJoinActivity : BaseViewBindingActivity<ActivityFansTeamJoinBinding
|
|||||||
?.let { privilegeConfig ->
|
?.let { privilegeConfig ->
|
||||||
binding.ivJoinLogo.load(privilegeConfig.icon)
|
binding.ivJoinLogo.load(privilegeConfig.icon)
|
||||||
binding.tvJoin.text = privilegeConfig.name
|
binding.tvJoin.text = privilegeConfig.name
|
||||||
binding.tvJoin.setOnClickListener {
|
binding.bgJoin.setOnClickListener {
|
||||||
privilegeConfig.giftVo?.let { giftInfo ->
|
privilegeConfig.giftVo?.let { giftInfo ->
|
||||||
GiftModel.get().sendFansTeamGift(
|
GiftModel.get().sendFansTeamGift(
|
||||||
giftInfo.giftId,
|
giftInfo.giftId,
|
||||||
|
@@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import com.yizhuan.erban.base.BaseViewModel
|
import com.yizhuan.erban.base.BaseViewModel
|
||||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||||
import com.yizhuan.xchat_android_core.fansteam.*
|
import com.yizhuan.xchat_android_core.fansteam.*
|
||||||
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||||
import com.yizhuan.xchat_android_core.utils.toast
|
import com.yizhuan.xchat_android_core.utils.toast
|
||||||
|
|
||||||
class FansTeamViewModel : BaseViewModel() {
|
class FansTeamViewModel : BaseViewModel() {
|
||||||
@@ -37,6 +38,9 @@ class FansTeamViewModel : BaseViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun loadFansTeamInitInfo() {
|
fun loadFansTeamInitInfo() {
|
||||||
|
if (AvRoomDataManager.get().roomUid == 0L) {
|
||||||
|
return
|
||||||
|
}
|
||||||
safeLaunch {
|
safeLaunch {
|
||||||
_fansTeamInitInfoLiveData.value = FansTeamModel.getFansTeamInitInfo()
|
_fansTeamInitInfoLiveData.value = FansTeamModel.getFansTeamInitInfo()
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,8 @@ import kotlinx.coroutines.async
|
|||||||
|
|
||||||
class HomeViewModel : BaseViewModel() {
|
class HomeViewModel : BaseViewModel() {
|
||||||
|
|
||||||
private val _tabHomeLiveData = MutableLiveData<List<HomeTabMapInfo>?>()
|
private val _tabHomeLiveData = MutableLiveData<ListResult<HomeRoomInfo>?>()
|
||||||
val tabHomeLiveData: MutableLiveData<List<HomeTabMapInfo>?> = _tabHomeLiveData
|
val tabHomeLiveData: MutableLiveData<ListResult<HomeRoomInfo>?> = _tabHomeLiveData
|
||||||
|
|
||||||
private val _bannerLiveData = MutableLiveData<List<BannerInfo>?>()
|
private val _bannerLiveData = MutableLiveData<List<BannerInfo>?>()
|
||||||
val bannerLiveData: MutableLiveData<List<BannerInfo>?> = _bannerLiveData
|
val bannerLiveData: MutableLiveData<List<BannerInfo>?> = _bannerLiveData
|
||||||
@@ -47,6 +47,8 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
private val _tagLiveData = MutableLiveData<List<HomeTagInfo>>()
|
private val _tagLiveData = MutableLiveData<List<HomeTagInfo>>()
|
||||||
val tagLiveData: LiveData<List<HomeTagInfo>> = _tagLiveData
|
val tagLiveData: LiveData<List<HomeTagInfo>> = _tagLiveData
|
||||||
|
|
||||||
|
val homeTagLiveData: MutableLiveData<List<HomeTagInfo>> = MutableLiveData<List<HomeTagInfo>>()
|
||||||
|
|
||||||
private val _emptyLiveData = MutableLiveData<Boolean>()
|
private val _emptyLiveData = MutableLiveData<Boolean>()
|
||||||
val emptyLiveData: LiveData<Boolean> = _emptyLiveData
|
val emptyLiveData: LiveData<Boolean> = _emptyLiveData
|
||||||
|
|
||||||
@@ -62,13 +64,14 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
|
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
|
||||||
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
|
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
|
||||||
|
|
||||||
fun getHomeTabName() {
|
fun getHomeTabName(tabId: Int, pageNum: Int) {
|
||||||
safeLaunch(
|
safeLaunch(
|
||||||
onError = {
|
onError = {
|
||||||
_tabHomeLiveData.value = null
|
_tabHomeLiveData.value = ListResult.failed(pageNum)
|
||||||
},
|
},
|
||||||
block = {
|
block = {
|
||||||
_tabHomeLiveData.value = HomeModel.getHomeTabHome()
|
val result = HomeModel.getHomeTabHome(tabId, pageNum, 20)
|
||||||
|
_tabHomeLiveData.value = ListResult.success(result, pageNum)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -122,6 +125,12 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getHomeTagInfo() {
|
||||||
|
safeLaunch {
|
||||||
|
homeTagLiveData.value = HomeModel.getNewHomeTag()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getTagInfo() {
|
fun getTagInfo() {
|
||||||
safeLaunch {
|
safeLaunch {
|
||||||
_tagLiveData.value = HomeModel.getHomeTag()
|
_tagLiveData.value = HomeModel.getHomeTag()
|
||||||
|
@@ -1,95 +0,0 @@
|
|||||||
package com.yizhuan.erban.home.adapter;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog;
|
|
||||||
import com.yizhuan.erban.shipantics.PullRadishActivity;
|
|
||||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
|
||||||
import com.yizhuan.erban.treasurefairy.HomeFairyActivity;
|
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.adapter.StaticPagerAdapter;
|
|
||||||
import com.yizhuan.erban.utils.CommonJumpHelper;
|
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
|
||||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RoomActAdapter extends StaticPagerAdapter {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
private List<BannerInfo> data;
|
|
||||||
private RoomActClickListener listener;
|
|
||||||
|
|
||||||
public RoomActAdapter(Context context, List<BannerInfo> data) {
|
|
||||||
this.data = data;
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(ViewGroup container, int position) {
|
|
||||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_room_act, container, false);
|
|
||||||
ImageView ivCover = view.findViewById(R.id.iv_cover);
|
|
||||||
BannerInfo bannerInfo = data.get(position);
|
|
||||||
String actId = String.valueOf(bannerInfo.getBannerId());
|
|
||||||
ivCover.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
||||||
if (bannerInfo.isFairy()) {
|
|
||||||
ivCover.setImageResource(R.drawable.ic_fairy_entrance);
|
|
||||||
} else if (bannerInfo.isFirstCharge()) {
|
|
||||||
ivCover.setImageResource(R.drawable.ic_first_charge_enter);
|
|
||||||
} else if (bannerInfo.isBox()) {
|
|
||||||
GlideApp.with(BasicConfig.INSTANCE.getAppContext())
|
|
||||||
.load(GoldBoxHelper.getBoxIcon())
|
|
||||||
.error(R.drawable.icon_room_treasure_box)
|
|
||||||
.into(ivCover);
|
|
||||||
} else if (bannerInfo.isRadish()) {
|
|
||||||
ivCover.setImageResource(R.drawable.ic_radish_entrance);
|
|
||||||
} else {
|
|
||||||
ImageLoadUtils.loadImage(mContext, bannerInfo.getBannerPic(), ivCover, R.drawable.default_cover);
|
|
||||||
}
|
|
||||||
ivCover.setOnClickListener(v -> {
|
|
||||||
if (bannerInfo.isFairy()) {
|
|
||||||
HomeFairyActivity.start(mContext);
|
|
||||||
} else if (bannerInfo.isFirstCharge()) {
|
|
||||||
FirstChargeDialog.start(mContext);
|
|
||||||
} else if (bannerInfo.isBox()) {
|
|
||||||
GoldBoxHelper.handleBoxClick(mContext);
|
|
||||||
} else if (bannerInfo.isRadish()) {
|
|
||||||
PullRadishActivity.start(mContext);
|
|
||||||
} else {
|
|
||||||
AvRoomModel.get().activityClickLog("2", actId).subscribe();
|
|
||||||
if (bannerInfo.getSkipType() == 3 && bannerInfo.getShowType() != 1) {
|
|
||||||
if (listener != null) {
|
|
||||||
listener.onWebClick(bannerInfo.getSkipUri());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CommonJumpHelper.bannerJump(mContext, bannerInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCount() {
|
|
||||||
if (data != null) {
|
|
||||||
return data.size();
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomActClickListener(RoomActClickListener listener) {
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface RoomActClickListener {
|
|
||||||
void onWebClick(String url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -87,10 +87,6 @@ class RoomNewFriendsAdapter :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.getView<View>(R.id.iv_avatar).setOnClickListener {
|
|
||||||
UserInfoActivity.Companion.start(mContext, item.uid)
|
|
||||||
}
|
|
||||||
|
|
||||||
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
|
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
|
||||||
tvNickname.text = item.nick
|
tvNickname.text = item.nick
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@ import com.yizhuan.erban.home.HomeViewModel
|
|||||||
import com.yizhuan.erban.home.adapter.HomeChatAdapter
|
import com.yizhuan.erban.home.adapter.HomeChatAdapter
|
||||||
import com.yizhuan.erban.home.adapter.RoomNewFriendsAdapter
|
import com.yizhuan.erban.home.adapter.RoomNewFriendsAdapter
|
||||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||||
|
import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
||||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
||||||
@@ -116,6 +117,11 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
|||||||
|
|
||||||
private fun initHotRoomTab() {
|
private fun initHotRoomTab() {
|
||||||
roomNewFriendsAdapter = RoomNewFriendsAdapter()
|
roomNewFriendsAdapter = RoomNewFriendsAdapter()
|
||||||
|
roomNewFriendsAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
(adapter.getItem(position) as? UserInfo)?.let {
|
||||||
|
UserInfoActivity.Companion.start(context, it.uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
rvDelegate = RVDelegate.Builder<UserInfo>()
|
rvDelegate = RVDelegate.Builder<UserInfo>()
|
||||||
.setAdapter(roomNewFriendsAdapter)
|
.setAdapter(roomNewFriendsAdapter)
|
||||||
.setRecyclerView(binding.recyclerView)
|
.setRecyclerView(binding.recyclerView)
|
||||||
|
@@ -40,20 +40,22 @@ import com.zhpan.bannerview.BannerViewPager
|
|||||||
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener,
|
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener,
|
||||||
MainIndicatorAdapter.OnItemSelectListener {
|
MainIndicatorAdapter.OnItemSelectListener {
|
||||||
|
|
||||||
private val mFragments = mutableListOf<Class<out Fragment>>()
|
private val TAB_ID_RECOMMEND = Int.MAX_VALUE - 1
|
||||||
private val mTabInfoList = mutableListOf<HomeTagInfo>()
|
|
||||||
|
private val TAB_ID_ACCOMPANY = Int.MAX_VALUE - 2
|
||||||
|
|
||||||
|
private val tabList = mutableListOf<HomeTagInfo>()
|
||||||
|
private val tabTitleList = mutableListOf<String>()
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
|
|
||||||
private var mBanner: BannerViewPager<BannerInfo>? = null
|
private var mBanner: BannerViewPager<BannerInfo>? = null
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "HomeFragment"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
mBanner = view?.findViewById(R.id.banner)
|
mBanner = view?.findViewById(R.id.banner)
|
||||||
initTitleTab()
|
initTab()
|
||||||
initListener()
|
initListener()
|
||||||
|
homeViewModel.homeTagLiveData.observe(this) {
|
||||||
|
loadTabList(transformTabList(it))
|
||||||
|
}
|
||||||
homeViewModel.bannerLiveData.observe(this) {
|
homeViewModel.bannerLiveData.observe(this) {
|
||||||
it?.let {
|
it?.let {
|
||||||
if (ListUtils.isListEmpty(it)) {
|
if (ListUtils.isListEmpty(it)) {
|
||||||
@@ -71,7 +73,10 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
ReportManager.get().reportEvent(
|
ReportManager.get().reportEvent(
|
||||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
Pair(
|
||||||
|
IReportConstants.MODULE,
|
||||||
|
IReportConstants.PEKO_HOMEPAGE
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
CommonJumpHelper.bannerJump(context, it[position])
|
CommonJumpHelper.bannerJump(context, it[position])
|
||||||
@@ -83,7 +88,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
}
|
}
|
||||||
homeViewModel.currentResourceLiveData.observe(this) {
|
homeViewModel.currentResourceLiveData.observe(this) {
|
||||||
it?.let {
|
it?.let {
|
||||||
if(it.size != 2){
|
if (it.size != 2) {
|
||||||
binding.csResource.visibility = View.GONE
|
binding.csResource.visibility = View.GONE
|
||||||
return@observe
|
return@observe
|
||||||
}
|
}
|
||||||
@@ -99,10 +104,12 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
it[i].resourceType == 5 -> {
|
it[i].resourceType == 5 -> {
|
||||||
CommonWebViewActivity.start(context, it[i].resourceContent)
|
CommonWebViewActivity.start(context, it[i].resourceContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
i == 3 -> {
|
i == 3 -> {
|
||||||
dialogManager.showProgressDialog(mContext)
|
dialogManager.showProgressDialog(mContext)
|
||||||
homeViewModel.getHomeChatPick()
|
homeViewModel.getHomeChatPick()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
dialogManager.showProgressDialog(mContext)
|
dialogManager.showProgressDialog(mContext)
|
||||||
homeViewModel.getResourceJumpInfo(it[i].id)
|
homeViewModel.getResourceJumpInfo(it[i].id)
|
||||||
@@ -131,6 +138,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
homeViewModel.getHomeTagInfo()
|
||||||
homeViewModel.getBannerInfo()
|
homeViewModel.getBannerInfo()
|
||||||
homeViewModel.getCurrentResourceInfo()
|
homeViewModel.getCurrentResourceInfo()
|
||||||
}
|
}
|
||||||
@@ -157,6 +165,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
DemoCache.saveAnchorCardView(1)
|
DemoCache.saveAnchorCardView(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.iv_ranking -> {
|
R.id.iv_ranking -> {
|
||||||
//首页_排行榜
|
//首页_排行榜
|
||||||
ReportManager.get().reportEvent(
|
ReportManager.get().reportEvent(
|
||||||
@@ -167,6 +176,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
)
|
)
|
||||||
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
|
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.iv_my_room -> {
|
R.id.iv_my_room -> {
|
||||||
//首页_创建房间
|
//首页_创建房间
|
||||||
ReportManager.get().reportEvent(
|
ReportManager.get().reportEvent(
|
||||||
@@ -180,63 +190,100 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化推荐
|
|
||||||
*/
|
|
||||||
private fun initTitleTab() {
|
|
||||||
mTabInfoList.add(
|
|
||||||
HomeTagInfo(
|
|
||||||
6,
|
|
||||||
ResUtil.getString(R.string.home_fragment_homefragment_04),
|
|
||||||
0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
mTabInfoList.add(
|
|
||||||
HomeTagInfo(
|
|
||||||
7,
|
|
||||||
ResUtil.getString(R.string.home_fragment_homefragment_07),
|
|
||||||
0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
mFragments.add(RecommendFragment::class.java)
|
|
||||||
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 = 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 {
|
|
||||||
return mFragments[position].newInstance()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
return mFragments.size
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
|
||||||
binding.viewPager.offscreenPageLimit = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemSelect(position: Int, view: TextView?) {
|
override fun onItemSelect(position: Int, view: TextView?) {
|
||||||
binding.viewPager.currentItem = position
|
binding.viewPager.currentItem = position
|
||||||
//点击顶部tab上报
|
//点击顶部tab上报
|
||||||
val map = HashMap<String, Any>(3)
|
val map = HashMap<String, Any>(3)
|
||||||
map[IReportConstants.HOMEPAGE_TAB] = mTabInfoList[position].id
|
map[IReportConstants.HOMEPAGE_TAB] = tabList[position].id
|
||||||
map[IReportConstants.MODULE] = IReportConstants.PEKO_HOMEPAGE
|
map[IReportConstants.MODULE] = IReportConstants.PEKO_HOMEPAGE
|
||||||
ReportManager.get().reportEvent(IReportConstants.TAB_HOMEPAGE_CLICK, map)
|
ReportManager.get().reportEvent(IReportConstants.TAB_HOMEPAGE_CLICK, map)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
mTabInfoList.clear()
|
tabList.clear()
|
||||||
mFragments.clear()
|
tabTitleList.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initTab() {
|
||||||
|
val commonNavigator = CommonNavigator(context)
|
||||||
|
commonNavigator.setTitleWrapContent(false)
|
||||||
|
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
||||||
|
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
||||||
|
val magicIndicatorAdapter = MainIndicatorAdapter(context, tabTitleList)
|
||||||
|
magicIndicatorAdapter.setOnItemSelectListener(this)
|
||||||
|
commonNavigator.adapter = magicIndicatorAdapter
|
||||||
|
binding.magicIndicator.navigator = commonNavigator
|
||||||
|
binding.viewPager.adapter =
|
||||||
|
object : FragmentStateAdapter(childFragmentManager, lifecycle) {
|
||||||
|
override fun getItemId(position: Int): Long {
|
||||||
|
return tabList[position].id.toLong()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun containsItem(itemId: Long): Boolean {
|
||||||
|
return tabList.firstOrNull { it.id.toLong() == itemId } != null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createFragment(position: Int): Fragment {
|
||||||
|
val itemId = getItemId(position)
|
||||||
|
return when (itemId) {
|
||||||
|
TAB_ID_RECOMMEND.toLong() -> {
|
||||||
|
RecommendFragment()
|
||||||
|
}
|
||||||
|
|
||||||
|
TAB_ID_ACCOMPANY.toLong() -> {
|
||||||
|
AccompanyFragment()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
HomeTabFragment.newInstance(itemId.toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount(): Int {
|
||||||
|
return tabList.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
||||||
|
loadTabList(transformTabList(emptyList()))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun transformTabList(list: List<HomeTagInfo>): List<HomeTagInfo> {
|
||||||
|
val finalList = ArrayList<HomeTagInfo>()
|
||||||
|
finalList.add(
|
||||||
|
HomeTagInfo(
|
||||||
|
TAB_ID_RECOMMEND,
|
||||||
|
ResUtil.getString(R.string.home_fragment_homefragment_04),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
finalList.addAll(list)
|
||||||
|
finalList.add(
|
||||||
|
HomeTagInfo(
|
||||||
|
TAB_ID_ACCOMPANY,
|
||||||
|
ResUtil.getString(R.string.home_fragment_homefragment_07),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return finalList
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadTabList(list: List<HomeTagInfo>) {
|
||||||
|
// 预防脏数据导致fragment复用问题
|
||||||
|
val newList = list.distinctBy {
|
||||||
|
it.id
|
||||||
|
}
|
||||||
|
val currentListId = tabList.joinToString { it.id.toString() }
|
||||||
|
val newListId = newList.joinToString { it.id.toString() }
|
||||||
|
if (currentListId == newListId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tabList.clear()
|
||||||
|
tabList.addAll(newList)
|
||||||
|
tabTitleList.clear()
|
||||||
|
tabTitleList.addAll(tabList.map { it.name })
|
||||||
|
binding.magicIndicator.navigator.notifyDataSetChanged()
|
||||||
|
binding.viewPager.adapter?.notifyDataSetChanged()
|
||||||
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,141 @@
|
|||||||
|
package com.yizhuan.erban.home.fragment
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
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.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.HomeHotAdapter
|
||||||
|
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 org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peko首页
|
||||||
|
*/
|
||||||
|
class HomeTabFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||||
|
|
||||||
|
private lateinit var roomHotAdapter: HomeHotAdapter
|
||||||
|
|
||||||
|
private lateinit var rvDelegate: RVDelegate<HomeRoomInfo>
|
||||||
|
|
||||||
|
private val homeViewModel: HomeViewModel by viewModels()
|
||||||
|
|
||||||
|
//是否需要刷新接口进行屏蔽房间操作
|
||||||
|
private var isShield = false
|
||||||
|
|
||||||
|
private var pageNum = 1
|
||||||
|
private var tabId: Int? = null
|
||||||
|
companion object {
|
||||||
|
fun newInstance(tabId: Int): HomeTabFragment {
|
||||||
|
return HomeTabFragment().apply {
|
||||||
|
arguments = Bundle().apply {
|
||||||
|
putInt("tabId", tabId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun init() {
|
||||||
|
tabId = arguments?.getInt("tabId")
|
||||||
|
initRefreshView()
|
||||||
|
initHotRoomTab()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initRefreshView() {
|
||||||
|
binding.refreshLayout.setOnRefreshListener {
|
||||||
|
loadData(true)
|
||||||
|
}
|
||||||
|
binding.refreshLayout.isEnableLoadmore = false
|
||||||
|
binding.refreshLayout.isEnableOverScrollBounce = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initHotRoomTab() {
|
||||||
|
roomHotAdapter = HomeHotAdapter()
|
||||||
|
roomHotAdapter.onItemClickListener =
|
||||||
|
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||||
|
val homePlayInfo: HomeRoomInfo? = roomHotAdapter.getItem(position)
|
||||||
|
if (homePlayInfo != null) {
|
||||||
|
//首页_房间派对
|
||||||
|
ReportManager.get().reportEvent(
|
||||||
|
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||||
|
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TEN),
|
||||||
|
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
AVRoomActivity.start(mContext, homePlayInfo.uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
|
||||||
|
.setPageSize(20)
|
||||||
|
.setAdapter(roomHotAdapter)
|
||||||
|
.setRecyclerView(binding.mRecyclerRoom)
|
||||||
|
.setEmptyView(EmptyViewHelper.createEmptyTextViewHeight(context, "暂无數據"))
|
||||||
|
.setLayoutManager(GridLayoutManager(mContext, 2))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
roomHotAdapter.setOnLoadMoreListener({
|
||||||
|
loadData(false)
|
||||||
|
}, binding.mRecyclerRoom)
|
||||||
|
|
||||||
|
homeViewModel.tabHomeLiveData.observe(this) {
|
||||||
|
binding.refreshLayout.finishRefresh()
|
||||||
|
rvDelegate.loadData(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLazyLoad() {
|
||||||
|
super.onLazyLoad()
|
||||||
|
loadData(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
if (isShield) {
|
||||||
|
loadData(true)
|
||||||
|
isShield = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData(isRefresh: Boolean) {
|
||||||
|
if (isRefresh) {
|
||||||
|
pageNum = 1
|
||||||
|
} else {
|
||||||
|
pageNum++
|
||||||
|
}
|
||||||
|
homeViewModel.getHomeTabName(tabId ?: 0, pageNum)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
||||||
|
if (isResumed) {
|
||||||
|
loadData(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -533,6 +533,42 @@ class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding
|
|||||||
.noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY)
|
.noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomAttachment.CUSTOM_MSG_CRAZY_ZOO -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM) {
|
||||||
|
val attachment = RoomLuckySeaAttachment(
|
||||||
|
CustomAttachment.CUSTOM_MSG_CRAZY_ZOO,
|
||||||
|
CustomAttachment.CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM
|
||||||
|
)
|
||||||
|
attachment.setRoomLuckySeaMsgBean(
|
||||||
|
JSON.parseObject(
|
||||||
|
baseProtocol.data.toString(),
|
||||||
|
RoomLuckySeaMsgBean::class.java
|
||||||
|
)
|
||||||
|
)
|
||||||
|
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||||
|
AvRoomDataManager.get().roomId.toString(),
|
||||||
|
attachment
|
||||||
|
)
|
||||||
|
IMNetEaseManager.get()
|
||||||
|
.noticeRoomEvent(message, RoomEvent.CRAZY_ZOO_ALL_ROOM_NOTIFY)
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY -> if (baseProtocol.second == CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL) {
|
||||||
|
val attachment = RoomTemplateNotifyAttachment(
|
||||||
|
CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY,
|
||||||
|
CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL
|
||||||
|
)
|
||||||
|
attachment.msgBean = JSON.parseObject(
|
||||||
|
baseProtocol.data.toString(),
|
||||||
|
RoomTemplateNotifyMsgBean::class.java
|
||||||
|
)
|
||||||
|
val message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||||
|
AvRoomDataManager.get().roomId.toString(),
|
||||||
|
attachment
|
||||||
|
)
|
||||||
|
IMNetEaseManager.get()
|
||||||
|
.noticeRoomEvent(message, RoomEvent.TEMPLATE_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) {
|
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 =
|
val attachment =
|
||||||
RoomReceivedLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY)
|
RoomReceivedLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY)
|
||||||
|
@@ -53,6 +53,7 @@ import com.netease.nimlib.sdk.robot.model.RobotMsgType;
|
|||||||
import com.tbruyelle.rxpermissions2.RxPermissions;
|
import com.tbruyelle.rxpermissions2.RxPermissions;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||||
|
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||||
import com.yizhuan.erban.ui.im.GreetPresenter;
|
import com.yizhuan.erban.ui.im.GreetPresenter;
|
||||||
import com.yizhuan.erban.ui.im.MessageListPanelEx;
|
import com.yizhuan.erban.ui.im.MessageListPanelEx;
|
||||||
import com.yizhuan.erban.ui.im.chat.MVHChatterBoxStart;
|
import com.yizhuan.erban.ui.im.chat.MVHChatterBoxStart;
|
||||||
@@ -104,6 +105,8 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
protected AitManager aitManager;
|
protected AitManager aitManager;
|
||||||
protected String recordId = "";
|
protected String recordId = "";
|
||||||
|
|
||||||
|
private DialogManager dialogManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息接收观察者
|
* 消息接收观察者
|
||||||
*/
|
*/
|
||||||
@@ -189,6 +192,10 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
if (aitManager != null) {
|
if (aitManager != null) {
|
||||||
aitManager.reset();
|
aitManager.reset();
|
||||||
}
|
}
|
||||||
|
if (dialogManager != null) {
|
||||||
|
dialogManager.dismissDialog();
|
||||||
|
}
|
||||||
|
dialogManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -333,7 +340,37 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
if (!isAllowSendMessage(message)) {
|
if (!isAllowSendMessage(message)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
MsgTypeEnum msgTypeEnum = message.getMsgType();
|
||||||
|
String content = null;
|
||||||
|
if (msgTypeEnum == MsgTypeEnum.text) {
|
||||||
|
content = message.getContent();
|
||||||
|
} else if (msgTypeEnum == MsgTypeEnum.audio) {
|
||||||
|
content = "";
|
||||||
|
} else if (msgTypeEnum == MsgTypeEnum.image) {
|
||||||
|
content = "";
|
||||||
|
}
|
||||||
|
if (content != null) {
|
||||||
|
showLoading();
|
||||||
|
Disposable disposable = IMCustomModel.get().privateChatCheck(message.getContent(), sessionId).subscribe(((privateChatLimitInfo, throwable) -> {
|
||||||
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dismissLoading();
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
SingleToastUtil.showToast(throwable.getMessage());
|
||||||
|
} else {
|
||||||
|
sendMessageImpl(message);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
compositeDisposable.add(disposable);
|
||||||
|
} else {
|
||||||
|
sendMessageImpl(message);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessageImpl(IMMessage message) {
|
||||||
appendTeamMemberPush(message);
|
appendTeamMemberPush(message);
|
||||||
message = changeToRobotMsg(message);
|
message = changeToRobotMsg(message);
|
||||||
Map<String, Object> payload = new HashMap<>();
|
Map<String, Object> payload = new HashMap<>();
|
||||||
@@ -357,7 +394,6 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
NIMClient.getService(MsgService.class).sendMessage(message, false).setCallback(new RequestCallback<Void>() {
|
NIMClient.getService(MsgService.class).sendMessage(message, false).setCallback(new RequestCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void param) {
|
public void onSuccess(Void param) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -376,7 +412,6 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
if (aitManager != null) {
|
if (aitManager != null) {
|
||||||
aitManager.reset();
|
aitManager.reset();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -599,7 +634,10 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
tvChatLimit.setVisibility(View.GONE);
|
tvChatLimit.setVisibility(View.GONE);
|
||||||
inputPanel.setLimitLevel(true, "");
|
inputPanel.setLimitLevel(true, "");
|
||||||
} else {
|
} else {
|
||||||
IMCustomModel.get().getPrivateChatLimit(sessionId).subscribe(((privateChatLimitInfo, throwable) -> {
|
Disposable disposable = IMCustomModel.get().getPrivateChatLimit(sessionId).subscribe(((privateChatLimitInfo, throwable) -> {
|
||||||
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
@@ -642,6 +680,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
tvChatLimit.setVisibility(isChat ? View.GONE : View.VISIBLE);
|
tvChatLimit.setVisibility(isChat ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
compositeDisposable.add(disposable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,4 +724,19 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
public void setCurrentLevel(int currentLevel) {
|
public void setCurrentLevel(int currentLevel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showLoading(){
|
||||||
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dialogManager == null) {
|
||||||
|
dialogManager = new DialogManager(getContext());
|
||||||
|
}
|
||||||
|
dialogManager.showProgressDialog(getContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dismissLoading(){
|
||||||
|
if (dialogManager != null) {
|
||||||
|
dialogManager.dismissDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.yizhuan.erban.ui.im.model;
|
package com.yizhuan.erban.ui.im.model;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.yizhuan.xchat_android_core.bean.PrivateChatLimitInfo;
|
import com.yizhuan.xchat_android_core.bean.PrivateChatLimitInfo;
|
||||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||||
import com.yizhuan.xchat_android_core.manager.BaseMvpModel;
|
import com.yizhuan.xchat_android_core.manager.BaseMvpModel;
|
||||||
@@ -31,6 +32,12 @@ public class IMCustomModel extends BaseMvpModel {
|
|||||||
.compose(RxHelper.handleSchedulers());
|
.compose(RxHelper.handleSchedulers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Single<String> privateChatCheck(String content, String receiverUid) {
|
||||||
|
return api.privateChatCheck(content, receiverUid)
|
||||||
|
.compose(RxHelper.handleIgnoreData())
|
||||||
|
.compose(RxHelper.handleSchedulers());
|
||||||
|
}
|
||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
/**
|
/**
|
||||||
* 获取是否可以发送私聊
|
* 获取是否可以发送私聊
|
||||||
@@ -38,5 +45,11 @@ public class IMCustomModel extends BaseMvpModel {
|
|||||||
*/
|
*/
|
||||||
@GET("/privateChat/limit")
|
@GET("/privateChat/limit")
|
||||||
Single<ServiceResult<PrivateChatLimitInfo>> getPrivateChatLimit(@Query("receiverUid") String receiverUid);
|
Single<ServiceResult<PrivateChatLimitInfo>> getPrivateChatLimit(@Query("receiverUid") String receiverUid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私聊发送消息时检测
|
||||||
|
*/
|
||||||
|
@GET("/privateChat/check")
|
||||||
|
Single<ServiceResult<JsonElement>> privateChatCheck(@Query("content") String content, @Query("toUid") String toUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,196 @@
|
|||||||
|
package com.yizhuan.erban.ui.invite
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.view.drawToBitmap
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import androidx.lifecycle.LifecycleCoroutineScope
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import com.bumptech.glide.request.target.CustomTarget
|
||||||
|
import com.bumptech.glide.request.transition.Transition
|
||||||
|
import com.chuhai.utils.ktx.saveToAlbum
|
||||||
|
import com.netease.nim.uikit.support.glide.GlideApp
|
||||||
|
import com.tbruyelle.rxpermissions2.RxPermissions
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
||||||
|
import com.yizhuan.erban.databinding.ShareInviteImageLayoutBinding
|
||||||
|
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||||
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
import kotlin.jvm.Throws
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/3/11 15:57
|
||||||
|
* Desc:邀请图片
|
||||||
|
**/
|
||||||
|
class InviteImageHelper {
|
||||||
|
|
||||||
|
fun saveToAlbum(
|
||||||
|
activity: FragmentActivity,
|
||||||
|
rxPermissions: RxPermissions,
|
||||||
|
data: ShareInviteInfo,
|
||||||
|
success: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
checkStoragePermissions(rxPermissions) {
|
||||||
|
if (it) {
|
||||||
|
saveToAlbumImpl(activity, activity.lifecycleScope, data, success)
|
||||||
|
} else {
|
||||||
|
SingleToastUtil.showToast(activity.getString(R.string.ask_again))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkStoragePermissions(rxPermissions: RxPermissions, call: (Boolean) -> Unit) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
call.invoke(true)
|
||||||
|
} else {
|
||||||
|
val permissions = arrayOf(
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||||
|
)
|
||||||
|
val d = rxPermissions.request(*permissions)?.subscribe({
|
||||||
|
if (it) {
|
||||||
|
call.invoke(true)
|
||||||
|
} else {
|
||||||
|
call.invoke(false)
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
it.printStackTrace()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun saveToAlbumImpl(
|
||||||
|
context: Activity,
|
||||||
|
lifecycleCoroutineScope: LifecycleCoroutineScope,
|
||||||
|
data: ShareInviteInfo,
|
||||||
|
success: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
lifecycleCoroutineScope.launch {
|
||||||
|
val dialogManager = DialogManager(context)
|
||||||
|
dialogManager.showProgressDialog(context, false)
|
||||||
|
try {
|
||||||
|
val result = saveToAlbum(context, data)
|
||||||
|
if (result) {
|
||||||
|
SingleToastUtil.showToast(R.string.community_photo_bigphotoactivity_05)
|
||||||
|
success?.invoke()
|
||||||
|
} else {
|
||||||
|
SingleToastUtil.showToast(R.string.community_photo_bigphotoactivity_06)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
SingleToastUtil.showToast(e.message)
|
||||||
|
} finally {
|
||||||
|
dialogManager.dismissDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws
|
||||||
|
suspend fun saveToAlbum(context: Context, data: ShareInviteInfo): Boolean {
|
||||||
|
val bitmap = generateBitmap(context, data)
|
||||||
|
return saveToAlbum(context, bitmap)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws
|
||||||
|
suspend fun generateBitmap(context: Context, data: ShareInviteInfo): Bitmap {
|
||||||
|
val qrcodeUrl = data.qrCodeUrl
|
||||||
|
if (qrcodeUrl.isNullOrEmpty()) {
|
||||||
|
throw IllegalArgumentException(context.getString(R.string.utils_net_beanobserver_05))
|
||||||
|
}
|
||||||
|
val bitmap: Bitmap
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
val qrCode = loadQrcode(context, data.qrCodeUrl)
|
||||||
|
data.qrcodeDrawable = qrCode
|
||||||
|
val binding = createView(context)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
bindView(binding, data)
|
||||||
|
}
|
||||||
|
bitmap = viewToBitmap(binding.root, UIUtil.dip2px(context, 375.0))
|
||||||
|
}
|
||||||
|
return bitmap
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun saveToAlbum(context: Context, bitmap: Bitmap): Boolean {
|
||||||
|
val uri: Uri?
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
val fileName = "piko_invite_${System.currentTimeMillis()}.jpg"
|
||||||
|
uri = bitmap.saveToAlbum(
|
||||||
|
context = context,
|
||||||
|
fileName = fileName,
|
||||||
|
relativePath = null,
|
||||||
|
quality = 90
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return uri != null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun bindView(
|
||||||
|
binding: ShareInviteImageLayoutBinding,
|
||||||
|
data: ShareInviteInfo
|
||||||
|
) {
|
||||||
|
binding.ivQrcode.setImageDrawable(data.qrcodeDrawable)
|
||||||
|
if (data.text.isNullOrEmpty()) {
|
||||||
|
binding.tvQrcodeTips.isVisible = false
|
||||||
|
} else {
|
||||||
|
binding.tvQrcodeTips.isVisible = true
|
||||||
|
binding.tvQrcodeTips.text = data.text
|
||||||
|
}
|
||||||
|
binding.tvCode.text =
|
||||||
|
binding.tvCode.context.getString(R.string.invite_code) + data.invitationCode
|
||||||
|
}
|
||||||
|
|
||||||
|
private suspend fun loadQrcode(context: Context, url: String): Drawable? {
|
||||||
|
return suspendCancellableCoroutine {
|
||||||
|
val target = GlideApp.with(context.applicationContext).load(url)
|
||||||
|
.into(object : CustomTarget<Drawable>() {
|
||||||
|
override fun onResourceReady(
|
||||||
|
resource: Drawable,
|
||||||
|
transition: Transition<in Drawable>?
|
||||||
|
) {
|
||||||
|
it.resume(resource)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||||
|
super.onLoadFailed(errorDrawable)
|
||||||
|
it.resumeWithException(Exception(context.getString(R.string.utils_net_beanobserver_03)))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it.invokeOnCancellation {
|
||||||
|
it?.printStackTrace()
|
||||||
|
GlideApp.with(context.applicationContext).clear(target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createView(context: Context): ShareInviteImageLayoutBinding {
|
||||||
|
return ShareInviteImageLayoutBinding.inflate(LayoutInflater.from(context))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun viewToBitmap(view: View, width: Int): Bitmap {
|
||||||
|
val widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY)
|
||||||
|
val heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||||
|
view.measure(widthMeasureSpec, heightMeasureSpec)
|
||||||
|
val measureWidth = view.measuredWidth
|
||||||
|
val measureHeight = view.measuredHeight
|
||||||
|
view.layout(0, 0, measureWidth, measureHeight)
|
||||||
|
return view.drawToBitmap()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,134 @@
|
|||||||
|
package com.yizhuan.erban.ui.invite
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import cn.sharesdk.facebook.Facebook
|
||||||
|
import cn.sharesdk.framework.Platform
|
||||||
|
import cn.sharesdk.framework.PlatformActionListener
|
||||||
|
import cn.sharesdk.line.Line
|
||||||
|
import com.chuhai.utils.ktx.singleClick
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
|
import com.tbruyelle.rxpermissions2.RxPermissions
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.databinding.ShareInviteDialogBinding
|
||||||
|
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||||
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/3/11 15:29
|
||||||
|
* Desc:分享邀请
|
||||||
|
**/
|
||||||
|
class ShareInviteDialog(val data: ShareInviteInfo) : BottomSheetDialogFragment() {
|
||||||
|
private var binding: ShareInviteDialogBinding? = null
|
||||||
|
|
||||||
|
private var rxPermissions: RxPermissions? = null
|
||||||
|
|
||||||
|
private val inviteImageHelper = InviteImageHelper()
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
super.onAttach(context)
|
||||||
|
rxPermissions = RxPermissions(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
initEvent()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initEvent() {
|
||||||
|
binding?.let { binding ->
|
||||||
|
binding.tvCancel.singleClick {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
binding.tvSaveToAlbum.singleClick {
|
||||||
|
rxPermissions?.let {
|
||||||
|
inviteImageHelper.saveToAlbum(requireActivity(), it, data) {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.tvShareLink.singleClick {
|
||||||
|
copyLink(data.toUrl ?: "")
|
||||||
|
}
|
||||||
|
binding.tvLine.singleClick {
|
||||||
|
share(Line(), data)
|
||||||
|
}
|
||||||
|
binding.tvFacebook.singleClick {
|
||||||
|
share(Facebook(), data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun copyLink(data: String) {
|
||||||
|
try {
|
||||||
|
val cm =
|
||||||
|
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
||||||
|
cm?.setPrimaryClip(ClipData.newPlainText("text", data))
|
||||||
|
SingleToastUtil.showToast(R.string.have_copy)
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
SingleToastUtil.showToast(R.string.avroom_activity_roomblacklistactivity_015)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun share(platform: Platform, data: ShareInviteInfo) {
|
||||||
|
val url = data.toUrl
|
||||||
|
val sp = Platform.ShareParams()
|
||||||
|
sp.imageUrl = data.shareImg
|
||||||
|
when (platform.name) {
|
||||||
|
Facebook.NAME -> {
|
||||||
|
sp.title = data.shareTitle
|
||||||
|
sp.text = data.shareText
|
||||||
|
sp.url = url
|
||||||
|
sp.shareType = Platform.SHARE_WEBPAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
Line.NAME -> {
|
||||||
|
sp.text = "${data.shareTitle}[$url]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
platform.platformActionListener = object : PlatformActionListener {
|
||||||
|
override fun onComplete(platform: Platform, i: Int, hashMap: HashMap<String, Any>) {
|
||||||
|
SingleToastUtil.showToast(R.string.xchat_android_core_share_sharemodel_01)
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(platform: Platform, i: Int, throwable: Throwable) {
|
||||||
|
val errorMsg: String
|
||||||
|
if (throwable.message?.contains("not installed") == true) {
|
||||||
|
errorMsg =
|
||||||
|
ResUtil.getString(R.string.not_install_app)
|
||||||
|
} else {
|
||||||
|
errorMsg =
|
||||||
|
ResUtil.getString(R.string.xchat_android_core_share_sharemodel_02)
|
||||||
|
}
|
||||||
|
SingleToastUtil.showToast(errorMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCancel(platform: Platform, i: Int) {
|
||||||
|
SingleToastUtil.showToast(R.string.xchat_android_core_share_sharemodel_03)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
platform.share(sp)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTheme(): Int {
|
||||||
|
return R.style.ErbanBottomSheetDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
binding = ShareInviteDialogBinding.inflate(inflater)
|
||||||
|
return binding?.root
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.yizhuan.erban.ui.invite
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/3/11 18:56
|
||||||
|
* Desc:分享邀请相关信息
|
||||||
|
**/
|
||||||
|
@Keep
|
||||||
|
data class ShareInviteInfo(
|
||||||
|
// 二维码图片
|
||||||
|
val qrCodeUrl: String? = null,
|
||||||
|
// 邀请码
|
||||||
|
val invitationCode: String? = null,
|
||||||
|
// 页面文案
|
||||||
|
val text: String? = null,
|
||||||
|
// 分享文案
|
||||||
|
val shareText: String? = null,
|
||||||
|
// 分享图片
|
||||||
|
val shareImg: String? = null,
|
||||||
|
// 分享标题
|
||||||
|
val shareTitle: String? = null,
|
||||||
|
// 跳转网页地址
|
||||||
|
val toUrl: String? = null,
|
||||||
|
// (1分享2保存)
|
||||||
|
val type: Int? = null,
|
||||||
|
@Transient
|
||||||
|
var qrcodeDrawable: Drawable? = null
|
||||||
|
) : Serializable
|
@@ -3,17 +3,19 @@ package com.yizhuan.erban.ui.login
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.BaseViewHolder
|
import com.chuhai.utils.UiUtils
|
||||||
|
import com.chuhai.utils.ktx.getColorById
|
||||||
import com.netease.nim.uikit.StatusBarUtil
|
import com.netease.nim.uikit.StatusBarUtil
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent
|
|
||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||||
import com.yizhuan.erban.databinding.ActivityAreaCodeBinding
|
import com.yizhuan.erban.databinding.ActivityAreaCodeBinding
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.erban.ui.widget.SideBarView
|
||||||
import com.yizhuan.xchat_android_core.auth.bean.AreaInfoBean
|
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||||
import com.yizhuan.xchat_android_core.utils.Logger
|
import kotlinx.coroutines.Dispatchers
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区号
|
* 区号
|
||||||
@@ -22,7 +24,9 @@ import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
|||||||
*/
|
*/
|
||||||
class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
||||||
|
|
||||||
private val mCountries = ArrayList<AreaInfoBean>()
|
private val regionRepository = RegionHelper()
|
||||||
|
|
||||||
|
private val adapter = RegionListAdapter()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val COUNTRY_NUMBER = "country_number"
|
const val COUNTRY_NUMBER = "country_number"
|
||||||
@@ -39,55 +43,51 @@ class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
|||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
initTitleBar(getString(R.string.select_area_code))
|
initTitleBar(getString(R.string.select_area_code))
|
||||||
initCountryData()
|
|
||||||
initListView()
|
initListView()
|
||||||
|
initSideBar()
|
||||||
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initCountryData() {
|
private fun initSideBar() {
|
||||||
val countryList = resources.getStringArray(R.array.country_code_list_ch)
|
binding.sideBarView.setTextColor(context.getColorById(R.color.color_5caaff))
|
||||||
for (s in countryList) {
|
binding.sideBarView.setTextSize(UiUtils.dip2px(12f).toFloat())
|
||||||
val country = s.split("*").toTypedArray()
|
binding.sideBarView.setListener(object : SideBarView.Listener {
|
||||||
val countryName = country[0]
|
override fun onSideBarScroll(word: String) {
|
||||||
val countryNumber = country[1]
|
val index = adapter.data.indexOfFirst {
|
||||||
val c = AreaInfoBean(
|
it.itemType == RegionListAdapter.ITEM_TYPE_GROUP && it.groupName?.toString() == word
|
||||||
name = countryName,
|
}
|
||||||
phoneAreaCode = countryNumber
|
if (index >= 0) {
|
||||||
)
|
binding.mRecyclerView.scrollToPosition(index)
|
||||||
mCountries.add(c)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSideBarScrollEnd() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData() {
|
||||||
|
lifecycleScope.launch {
|
||||||
|
val list = regionRepository.getRegionSelectorList(RegionListAdapter.ITEM_TYPE_GROUP)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
adapter.setNewData(list)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListView() {
|
private fun initListView() {
|
||||||
val mAdapter = object :
|
binding.mRecyclerView.adapter = adapter
|
||||||
BaseQuickAdapter<AreaInfoBean, BaseViewHolder>(R.layout.item_country) {
|
|
||||||
override fun convert(helper: BaseViewHolder, item: AreaInfoBean) {
|
|
||||||
helper.setText(R.id.tv_name, item.name)
|
|
||||||
helper.setText(R.id.tv_country_code, "+${item.phoneAreaCode}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.mRecyclerView.adapter = mAdapter
|
|
||||||
mAdapter.setNewData(mCountries)
|
|
||||||
//返回国家
|
//返回国家
|
||||||
mAdapter.setOnItemClickListener { adapter: BaseQuickAdapter<*, *>?, view: View?, position: Int ->
|
adapter.setOnItemClickListener { adapter: BaseQuickAdapter<*, *>?, view: View?, position: Int ->
|
||||||
val country = mAdapter.data[position]
|
val region = this.adapter.getItem(position)
|
||||||
|
if (region?.code.isNullOrEmpty()) {
|
||||||
|
return@setOnItemClickListener
|
||||||
|
}
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.putExtra(COUNTRY_NUMBER, "+${country.phoneAreaCode}")
|
intent.putExtra(COUNTRY_NUMBER, region?.fullCode)
|
||||||
setResult(RESULT_OK, intent)
|
setResult(RESULT_OK, intent)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthModel.get()
|
|
||||||
.areaCodeList
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(object : BeanObserver<List<AreaInfoBean>>() {
|
|
||||||
override fun onErrorMsg(error: String) {
|
|
||||||
Logger.error("areaCode", error)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(list: List<AreaInfoBean>) {
|
|
||||||
mAdapter.setNewData(list)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun needSteepStateBar() = true
|
override fun needSteepStateBar() = true
|
||||||
@@ -97,5 +97,4 @@ class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
|||||||
StatusBarUtil.transparencyBar(this)
|
StatusBarUtil.transparencyBar(this)
|
||||||
StatusBarUtil.StatusBarLightMode(this)
|
StatusBarUtil.StatusBarLightMode(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -16,9 +16,9 @@ import com.trello.rxlifecycle3.android.ActivityEvent
|
|||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||||
import com.yizhuan.erban.databinding.ActivityBindPhoneBinding
|
import com.yizhuan.erban.databinding.ActivityBindPhoneBinding
|
||||||
import com.yizhuan.erban.ui.login.BindPhoneActivity
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType
|
import com.yizhuan.xchat_android_core.code.CodeType
|
||||||
|
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel
|
import com.yizhuan.xchat_android_core.user.UserModel
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||||
import com.yizhuan.xchat_android_library.utils.NetworkUtils
|
import com.yizhuan.xchat_android_library.utils.NetworkUtils
|
||||||
@@ -50,6 +50,7 @@ class BindPhoneActivity : BaseViewBindingActivity<ActivityBindPhoneBinding>(),
|
|||||||
override fun init() {
|
override fun init() {
|
||||||
initTitleBar(getString(R.string.text_bind_phone))
|
initTitleBar(getString(R.string.text_bind_phone))
|
||||||
initListener()
|
initListener()
|
||||||
|
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
private fun initListener() {
|
||||||
|
@@ -35,7 +35,7 @@ import com.yizhuan.xchat_android_core.code.CodeType;
|
|||||||
import com.yizhuan.xchat_android_library.common.SpConstants;
|
import com.yizhuan.xchat_android_library.common.SpConstants;
|
||||||
import com.yizhuan.xchat_android_library.common.util.SPUtils;
|
import com.yizhuan.xchat_android_library.common.util.SPUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
|
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
|
||||||
|
import com.yizhuan.xchat_android_core.region.RegionHelper;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
@@ -90,6 +90,7 @@ public class LoginPasswordActivity extends BaseActivity {
|
|||||||
setContentView(R.layout.activity_login_password);
|
setContentView(R.layout.activity_login_password);
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
initView();
|
initView();
|
||||||
|
new RegionHelper().loadRecommendRegion(getLifecycle(), tvAreaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkInput() {
|
private void checkInput() {
|
||||||
|
@@ -16,6 +16,7 @@ import com.yizhuan.erban.databinding.ActivityLoginPhoneBinding
|
|||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent
|
import com.yizhuan.xchat_android_core.auth.event.LoginEvent
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType
|
import com.yizhuan.xchat_android_core.code.CodeType
|
||||||
|
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||||
import io.reactivex.SingleObserver
|
import io.reactivex.SingleObserver
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
@@ -43,6 +44,7 @@ class LoginPhoneActivity : BaseViewBindingActivity<ActivityLoginPhoneBinding>(),
|
|||||||
override fun init() {
|
override fun init() {
|
||||||
EventBus.getDefault().register(this)
|
EventBus.getDefault().register(this)
|
||||||
initListener()
|
initListener()
|
||||||
|
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
private fun initListener() {
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
package com.yizhuan.erban.ui.login
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.xchat_android_core.region.bean.RegionBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/7 19:34
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class RegionListAdapter() :
|
||||||
|
BaseMultiItemQuickAdapter<RegionBean, BaseViewHolder>(ArrayList<RegionBean>()) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val ITEM_TYPE_GROUP = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addItemType(0, R.layout.region_item_def)
|
||||||
|
addItemType(ITEM_TYPE_GROUP, R.layout.region_item_group)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RegionBean?) {
|
||||||
|
if (helper.itemViewType == ITEM_TYPE_GROUP) {
|
||||||
|
helper.setText(R.id.tv_group, item?.groupName?.toString() ?: "")
|
||||||
|
}
|
||||||
|
helper.setText(R.id.tv_name, item?.name ?: "")
|
||||||
|
helper.setText(R.id.tv_country_code, "+${item?.code}")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
package com.yizhuan.erban.ui.search;
|
package com.yizhuan.erban.ui.search;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@@ -15,6 +16,7 @@ import com.yizhuan.erban.R;
|
|||||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||||
import com.yizhuan.erban.ui.user.activity.UserInfoActivity;
|
import com.yizhuan.erban.ui.user.activity.UserInfoActivity;
|
||||||
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||||
@@ -112,16 +114,17 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
|||||||
holder.mNobleAvatarView.setData(item.getAvatar(), item.nobleUsers);
|
holder.mNobleAvatarView.setData(item.getAvatar(), item.nobleUsers);
|
||||||
holder.erbanNo.setText(context.getString(R.string.me_user_id, item.getErbanNo()));
|
holder.erbanNo.setText(context.getString(R.string.me_user_id, item.getErbanNo()));
|
||||||
|
|
||||||
if (item.getGender() == 1) {
|
holder.wealthLevelView.setVisibility(View.GONE);
|
||||||
holder.mIvSex.setVisibility(View.VISIBLE);
|
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getExperUrl())) {
|
||||||
holder.mIvSex.setImageResource(R.drawable.ic_gender_male);
|
holder.wealthLevelView.setVisibility(View.VISIBLE);
|
||||||
} else if (item.getGender() == 2) {
|
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getExperUrl(), holder.wealthLevelView);
|
||||||
holder.mIvSex.setVisibility(View.VISIBLE);
|
|
||||||
holder.mIvSex.setImageResource(R.drawable.ic_gender_female);
|
|
||||||
} else {
|
|
||||||
holder.mIvSex.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.charmLevelView.setVisibility(View.GONE);
|
||||||
|
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getCharmUrl())) {
|
||||||
|
holder.charmLevelView.setVisibility(View.VISIBLE);
|
||||||
|
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getCharmUrl(), holder.charmLevelView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ViewHolder extends BaseViewHolder {
|
static class ViewHolder extends BaseViewHolder {
|
||||||
@@ -132,7 +135,8 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
|||||||
private ImageView ivLive;
|
private ImageView ivLive;
|
||||||
RelativeLayout container;
|
RelativeLayout container;
|
||||||
private NobleAvatarView mNobleAvatarView;
|
private NobleAvatarView mNobleAvatarView;
|
||||||
private ImageView mIvSex;
|
private ImageView wealthLevelView;
|
||||||
|
private ImageView charmLevelView;
|
||||||
private SuperTextView stvOp;
|
private SuperTextView stvOp;
|
||||||
|
|
||||||
public ViewHolder(View itemView) {
|
public ViewHolder(View itemView) {
|
||||||
@@ -142,7 +146,8 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
|||||||
erbanNo = itemView.findViewById(R.id.erban_no);
|
erbanNo = itemView.findViewById(R.id.erban_no);
|
||||||
container = itemView.findViewById(R.id.container);
|
container = itemView.findViewById(R.id.container);
|
||||||
mNobleAvatarView = itemView.findViewById(R.id.noble_avatar_view);
|
mNobleAvatarView = itemView.findViewById(R.id.noble_avatar_view);
|
||||||
mIvSex = itemView.findViewById(R.id.sex);
|
wealthLevelView = itemView.findViewById(R.id.iv_user_level);
|
||||||
|
charmLevelView = itemView.findViewById(R.id.iv_user_charm);
|
||||||
ivLive = itemView.findViewById(R.id.iv_living);
|
ivLive = itemView.findViewById(R.id.iv_living);
|
||||||
tvOnlineNum = itemView.findViewById(R.id.tv_online_num);
|
tvOnlineNum = itemView.findViewById(R.id.tv_online_num);
|
||||||
stvOp = itemView.findViewById(R.id.stv_op);
|
stvOp = itemView.findViewById(R.id.stv_op);
|
||||||
|
@@ -20,6 +20,7 @@ import com.yizhuan.erban.ui.login.BindPhoneActivity
|
|||||||
import com.yizhuan.erban.ui.login.helper.LogoutHelper
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType
|
import com.yizhuan.xchat_android_core.code.CodeType
|
||||||
|
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel
|
import com.yizhuan.xchat_android_core.user.UserModel
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||||
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper
|
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper
|
||||||
@@ -59,6 +60,7 @@ class ResetPasswordActivity : BaseViewBindingActivity<ActivityResetLoginPwdBindi
|
|||||||
// binding.etAccount.isEnabled = false
|
// binding.etAccount.isEnabled = false
|
||||||
// }
|
// }
|
||||||
initListener()
|
initListener()
|
||||||
|
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
private fun initListener() {
|
||||||
|
@@ -16,6 +16,9 @@ import com.yizhuan.erban.base.BaseViewBindingActivity
|
|||||||
import com.yizhuan.erban.common.widget.dialog.DialogManager.OkCancelDialogListener
|
import com.yizhuan.erban.common.widget.dialog.DialogManager.OkCancelDialogListener
|
||||||
import com.yizhuan.erban.databinding.ActivitySettingBinding
|
import com.yizhuan.erban.databinding.ActivitySettingBinding
|
||||||
import com.yizhuan.erban.ui.im.avtivity.BlackListManageActivity
|
import com.yizhuan.erban.ui.im.avtivity.BlackListManageActivity
|
||||||
|
import com.yizhuan.erban.ui.invite.InviteImageHelper
|
||||||
|
import com.yizhuan.erban.ui.invite.ShareInviteDialog
|
||||||
|
import com.yizhuan.erban.ui.invite.ShareInviteInfo
|
||||||
import com.yizhuan.erban.ui.login.BindPhoneActivity
|
import com.yizhuan.erban.ui.login.BindPhoneActivity
|
||||||
import com.yizhuan.erban.ui.login.ShowBindPhoneActivity
|
import com.yizhuan.erban.ui.login.ShowBindPhoneActivity
|
||||||
import com.yizhuan.erban.ui.login.helper.LogoutHelper
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper
|
||||||
@@ -43,7 +46,8 @@ import kotlin.random.Random
|
|||||||
* 设置页
|
* 设置页
|
||||||
* Created by wushaocheng on 2023/2/1.
|
* Created by wushaocheng on 2023/2/1.
|
||||||
*/
|
*/
|
||||||
class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.OnClickListener,ILog {
|
class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.OnClickListener,
|
||||||
|
ILog {
|
||||||
override fun init() {
|
override fun init() {
|
||||||
EventBus.getDefault().register(this)
|
EventBus.getDefault().register(this)
|
||||||
initWhiteTitleBar(ResUtil.getString(R.string.ui_setting_settingactivity_01))
|
initWhiteTitleBar(ResUtil.getString(R.string.ui_setting_settingactivity_01))
|
||||||
@@ -217,8 +221,28 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun debug() {
|
private fun debug() {
|
||||||
|
// CommonWebViewActivity.start(
|
||||||
|
// this,
|
||||||
|
// "http://192.168.19.136:5502/view/peko/activity/2024-invitationFission/share.html"
|
||||||
|
// )
|
||||||
|
val qrcodeUrl =
|
||||||
|
"https://img0.baidu.com/it/u=4220524728,2310074610&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1710349200&t=39faa005691f3ebde5b8bf2b99708f1b"
|
||||||
|
val data = ShareInviteInfo(
|
||||||
|
qrCodeUrl = qrcodeUrl,
|
||||||
|
invitationCode = Random.nextInt().toString(),
|
||||||
|
text = "扫码下载PiKO并填写我的邀请码,立得1000钻石!!",
|
||||||
|
shareTitle = "分享标题",
|
||||||
|
shareText = "分享文本",
|
||||||
|
shareImg = qrcodeUrl,
|
||||||
|
toUrl = "https://www.baidu.com",
|
||||||
|
)
|
||||||
|
// InviteImageHelper().saveToAlbum(this, rxPermissions, data)
|
||||||
|
ShareInviteDialog(data).show(supportFragmentManager, "A")
|
||||||
|
// val json = "{\"data\":{\"diamonds\":225000,\"itemId\":32,\"itemMultiple\":45,\"nick\":\"XG001\",\"roomUid\":2881,\"uid\":2881},\"first\":95,\"second\":955}"
|
||||||
// RedPackageOpenDialog2().show(this)
|
// RedPackageOpenDialog2().show(this)
|
||||||
val json = "{\"first\":3,\"second\":32,\"data\":{\"recvUserUid\":2735,\"recvUserAvatar\":\"https://img.pekolive.com/default_avatar.png\",\"recvUserNick\":\"66丢丢丢丢丢多多多的hhhh\",\"sendUserNick\":\"11的ass\",\"sendUserAvatar\":\"http://beta.img.pekolive.com/Fk7aur-1RBqKXC-qqBwMTjivZ3lV?imageslim\",\"sendUserUid\":2737,\"giftUrl\":\"http://beta.img.pekolive.com/Fn6h_gPFD5MwA-Ql_kcWqNpKp0JM?imageslim\",\"giftName\":\"幽靈糖果\",\"giftId\":2075,\"giftNum\":${Random.nextInt(1,1000)},\"giftGolds\":33440,\"notifyStaySecond\":5,\"isHomeShow\":true,\"isSkipRoom\":true,\"isFullScreen\":false,\"isSendMsg\":false,\"roomUid\":2737,\"roomErbanNo\":11,\"roomTitle\":\"11的工会\",\"levelNum\":${Random.nextInt(1,4)}}}"
|
// val json = "{\"first\":85,\"second\":855,\"data\":{\"nick\":\"66丢丢丢丢丢多多多的hhhh\",\"preVipName\":\"子爵\",\"floatPic\":\"https://image.hfighting.com/Fq3JtbK2acO3FN-3vWZo8ldtHfse\",\"uid\":2735,\"currVipName\":\"侯爵\",\"erbanNo\":66,\"roomUid\":2734,\"avatar\":\"https://img.pekolive.com/default_avatar.png\",\"currVipLevel\":5}}"
|
||||||
onReceivedNimBroadcastMessage(json)
|
// onReceivedNimBroadcastMessage(json)
|
||||||
|
// CommonWebViewActivity.start(this,"https://api.anan.chat/anan_vestBag/modules/rank/index.html#/rank")
|
||||||
|
// CommonWebViewActivity.start(this,"https://api.anan.chat/anan_vestBag/modules/myincome/index.html#/DiamondLog")
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -19,6 +19,7 @@ import com.yizhuan.erban.ui.login.BindPhoneActivity
|
|||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType
|
import com.yizhuan.xchat_android_core.code.CodeType
|
||||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||||
|
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ class VerifyPhoneActivity : BaseViewBindingActivity<ActivityVerifyPhoneBinding>(
|
|||||||
resetPwd = intent.getBooleanExtra("resetPwd", false)
|
resetPwd = intent.getBooleanExtra("resetPwd", false)
|
||||||
|
|
||||||
initListener()
|
initListener()
|
||||||
|
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
private fun initListener() {
|
||||||
|
@@ -65,6 +65,7 @@ import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.Commo
|
|||||||
import com.yizhuan.erban.ui.widget.rollviewpager.HintView;
|
import com.yizhuan.erban.ui.widget.rollviewpager.HintView;
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView;
|
import com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView;
|
||||||
import com.yizhuan.erban.ui.widget.rollviewpager.adapter.StaticPagerAdapterWrapper;
|
import com.yizhuan.erban.ui.widget.rollviewpager.adapter.StaticPagerAdapterWrapper;
|
||||||
|
import com.yizhuan.erban.utils.NamePlateHelper;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.erban.vip.util.VipHelper;
|
import com.yizhuan.erban.vip.util.VipHelper;
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||||
@@ -317,7 +318,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
|||||||
//等级魅力值
|
//等级魅力值
|
||||||
setUserLevel(userInfo.getUserLevelVo());
|
setUserLevel(userInfo.getUserLevelVo());
|
||||||
//铭牌
|
//铭牌
|
||||||
setOfficialMask(userInfo.getNameplateWord(), userInfo.getNameplatePic());
|
NamePlateHelper.INSTANCE.load(mBinding.inOfficialMask, tvOfficialMask, ivOfficialMask, userInfo);
|
||||||
if (AuthModel.get().getCurrentUid() != userInfo.getUid()) {
|
if (AuthModel.get().getCurrentUid() != userInfo.getUid()) {
|
||||||
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), userInfo.getUid()).subscribe();
|
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), userInfo.getUid()).subscribe();
|
||||||
}
|
}
|
||||||
@@ -626,19 +627,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
|||||||
setLikedText(event.isPraise());
|
setLikedText(event.isPraise());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOfficialMask(String name, String icon) {
|
|
||||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
|
||||||
mBinding.inOfficialMask.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if (tvOfficialMask != null && ivOfficialMask != null) {
|
|
||||||
tvOfficialMask.setText(name);
|
|
||||||
ImageLoadUtils.loadImage(this, icon, ivOfficialMask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mBinding.inOfficialMask.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initVoiceShow(UserInfo.SoundBean audioCard) {
|
public void initVoiceShow(UserInfo.SoundBean audioCard) {
|
||||||
if (audioCard != null && !TextUtils.isEmpty(audioCard.getAudioUrl())) {
|
if (audioCard != null && !TextUtils.isEmpty(audioCard.getAudioUrl())) {
|
||||||
if (AuthModel.get().getCurrentUid() == userId) {//主态
|
if (AuthModel.get().getCurrentUid() == userId) {//主态
|
||||||
|
@@ -427,6 +427,11 @@ public class ImageLoadUtils {
|
|||||||
GlideApp.with(context.getApplicationContext()).load(url).dontAnimate().into(imageView);
|
GlideApp.with(context.getApplicationContext()).load(url).dontAnimate().into(imageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadImage(ImageView imageView, String url) {
|
||||||
|
GlideApp.with(imageView).load(url).dontAnimate().into(imageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void loadImage1(Context context, String url, ImageView imageView) {
|
public static void loadImage1(Context context, String url, ImageView imageView) {
|
||||||
GlideApp.with(context).load(url).optionalFitCenter().into(new SimpleTarget<Drawable>() {
|
GlideApp.with(context).load(url).optionalFitCenter().into(new SimpleTarget<Drawable>() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
package com.yizhuan.erban.ui.wallet
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.chuhai.utils.log.ILog
|
||||||
|
import com.yizhuan.erban.application.XChatApplication
|
||||||
|
import com.yizhuan.erban.other.activity.SplashActivity
|
||||||
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
|
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/1/31 10:50
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class PaymentResultActivity : Activity(), ILog {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
logD("onCreate()")
|
||||||
|
handler(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handler(intent: Intent?) {
|
||||||
|
val uri = intent?.data
|
||||||
|
logD("handler() uri:${uri}")
|
||||||
|
if (XChatApplication.gStack.activityNum == 1) {
|
||||||
|
logD("handler() open->splash")
|
||||||
|
SplashActivity.start(this)
|
||||||
|
finish()
|
||||||
|
} else {
|
||||||
|
val status = uri?.getQueryParameter("status")?.toIntOrNull()
|
||||||
|
logD("handler() status:$status")
|
||||||
|
val uid = AuthModel.get().currentUid
|
||||||
|
if (status == 1 && uid != 0L) {
|
||||||
|
PayModel.get().getWalletInfo(uid).subscribe()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNewIntent(intent: Intent?) {
|
||||||
|
super.onNewIntent(intent)
|
||||||
|
logD("onNewIntent()")
|
||||||
|
handler(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
logD("onDestroy()")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLogTag(): String {
|
||||||
|
return super.getLogTag()
|
||||||
|
}
|
||||||
|
}
|
@@ -9,11 +9,11 @@ import android.content.ClipboardManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.http.SslError;
|
import android.net.http.SslError;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.SslErrorHandler;
|
import android.webkit.SslErrorHandler;
|
||||||
@@ -54,12 +54,12 @@ import com.yizhuan.xchat_android_core.web.bean.WebJsBeanInfo;
|
|||||||
import com.yizhuan.xchat_android_core.web.event.WebViewRefreshEvent;
|
import com.yizhuan.xchat_android_core.web.event.WebViewRefreshEvent;
|
||||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||||
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -99,32 +99,6 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
private static final String POSITION = "position";
|
private static final String POSITION = "position";
|
||||||
private int mPosition;
|
private int mPosition;
|
||||||
|
|
||||||
private int mProgress;
|
|
||||||
|
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
private ProgressRunnable mProgressRunnable = new ProgressRunnable(this);
|
|
||||||
|
|
||||||
private static class ProgressRunnable implements Runnable {
|
|
||||||
private WeakReference<CommonWebViewActivity> mWeakReference;
|
|
||||||
|
|
||||||
ProgressRunnable(CommonWebViewActivity activity) {
|
|
||||||
mWeakReference = new WeakReference<>(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
CommonWebViewActivity activity = mWeakReference.get();
|
|
||||||
if (activity == null) return;
|
|
||||||
if (activity.mProgress < 96) {
|
|
||||||
activity.mProgress += 3;
|
|
||||||
activity.mProgressBar.setProgress(activity.mProgress);
|
|
||||||
activity.mHandler.postDelayed(activity.mProgressRunnable, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void start(Context context, String url) {
|
public static void start(Context context, String url) {
|
||||||
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
||||||
intent.putExtra("url", url);
|
intent.putExtra("url", url);
|
||||||
@@ -222,7 +196,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
private void initData() {
|
private void initData() {
|
||||||
mHandler.post(mProgressRunnable);
|
webView.getSettings().setAllowFileAccess(true);
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
webView.getSettings().setUseWideViewPort(true);
|
webView.getSettings().setUseWideViewPort(true);
|
||||||
webView.getSettings().setLoadWithOverviewMode(true);
|
webView.getSettings().setLoadWithOverviewMode(true);
|
||||||
@@ -238,14 +212,13 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
webView.addJavascriptInterface(jsInterface, "androidJsObj");
|
webView.addJavascriptInterface(jsInterface, "androidJsObj");
|
||||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
String packageName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
Logger.e("shouldOverrideUrlLoading--------" + url);
|
Logger.e("shouldOverrideUrlLoading--------" + url);
|
||||||
LogUtil.e("shouldOverrideUrlLoading" + url);
|
LogUtil.e("shouldOverrideUrlLoading" + url);
|
||||||
targetUrl = url;
|
targetUrl = url;
|
||||||
|
|
||||||
if (url.contains("tel:")) {
|
if (url.contains("tel:")) {
|
||||||
//删除直接拨打电话的功能
|
//删除直接拨打电话的功能
|
||||||
return true;
|
return true;
|
||||||
@@ -253,6 +226,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
// ------- 处理结束 -------
|
// ------- 处理结束 -------
|
||||||
|
|
||||||
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
||||||
|
handleIntent(url);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,9 +264,56 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleIntent(String url) {
|
||||||
|
Intent intent;
|
||||||
|
try {
|
||||||
|
if (url.startsWith("intent://")) {
|
||||||
|
//MyCard、Line
|
||||||
|
intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
|
||||||
|
packageName = intent.getPackage();
|
||||||
|
} else { //第三方支付
|
||||||
|
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
|
}
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
handleCatch(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCatch(Exception ex) {
|
||||||
|
if (packageName != null) {
|
||||||
|
toGooglePaly(packageName);
|
||||||
|
} else {
|
||||||
|
SingleToastUtil.showToast(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toGooglePaly(String packageName) {
|
||||||
|
try {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)));
|
||||||
|
} catch (android.content.ActivityNotFoundException anfe) {
|
||||||
|
try {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//获取webviewtitle作为titlebar的title
|
//获取webviewtitle作为titlebar的title
|
||||||
wvcc = new WebChromeClient() {
|
wvcc = new WebChromeClient() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(WebView view, int newProgress) {
|
||||||
|
super.onProgressChanged(view, newProgress);
|
||||||
|
mProgressBar.setProgress(newProgress);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedTitle(WebView view, String title) {
|
public void onReceivedTitle(WebView view, String title) {
|
||||||
@@ -520,11 +541,6 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (mHandler != null) {
|
|
||||||
mHandler.removeCallbacks(mProgressRunnable);
|
|
||||||
mProgressRunnable = null;
|
|
||||||
mHandler = null;
|
|
||||||
}
|
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
|
|
||||||
if (webViewCallBack != null) {
|
if (webViewCallBack != null) {
|
||||||
|
@@ -3,8 +3,8 @@ package com.yizhuan.erban.ui.webview;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||||
@@ -28,8 +28,17 @@ public class DialogWebViewActivity extends CommonWebViewActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight / 3 * 2);
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
getWindow().setGravity(Gravity.BOTTOM);
|
View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
|
);
|
||||||
|
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
View topView = findViewById(R.id.v_top);
|
||||||
|
topView.setOnClickListener(v -> finish());
|
||||||
|
ViewGroup.LayoutParams params = topView.getLayoutParams();
|
||||||
|
params.height = getTopMargin();
|
||||||
showTitleBar = getIntent().getBooleanExtra("showTitleBar", true);
|
showTitleBar = getIntent().getBooleanExtra("showTitleBar", true);
|
||||||
if (!showTitleBar) {
|
if (!showTitleBar) {
|
||||||
layoutTitleBar.setVisibility(View.GONE);
|
layoutTitleBar.setVisibility(View.GONE);
|
||||||
@@ -40,4 +49,8 @@ public class DialogWebViewActivity extends CommonWebViewActivity {
|
|||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.activity_dialog_web_view;
|
return R.layout.activity_dialog_web_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getTopMargin() {
|
||||||
|
return ScreenUtil.screenHeight / 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@ import android.webkit.WebView;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
import com.yizhuan.erban.UIHelper;
|
import com.yizhuan.erban.UIHelper;
|
||||||
@@ -27,6 +28,9 @@ import com.yizhuan.erban.family.view.activity.FamilyHomeActivity;
|
|||||||
import com.yizhuan.erban.public_chat_hall.activity.PublicChatHallHomeActivity;
|
import com.yizhuan.erban.public_chat_hall.activity.PublicChatHallHomeActivity;
|
||||||
import com.yizhuan.erban.ui.im.RouterHandler;
|
import com.yizhuan.erban.ui.im.RouterHandler;
|
||||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||||
|
import com.yizhuan.erban.ui.invite.InviteImageHelper;
|
||||||
|
import com.yizhuan.erban.ui.invite.ShareInviteDialog;
|
||||||
|
import com.yizhuan.erban.ui.invite.ShareInviteInfo;
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||||
import com.yizhuan.erban.ui.webview.event.H5NotifyClientEvent;
|
import com.yizhuan.erban.ui.webview.event.H5NotifyClientEvent;
|
||||||
import com.yizhuan.erban.ui.webview.event.ShowNavEvent;
|
import com.yizhuan.erban.ui.webview.event.ShowNavEvent;
|
||||||
@@ -63,6 +67,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> html js 与webview 交互接口</p>
|
* <p> html js 与webview 交互接口</p>
|
||||||
* Created by ${user} on 2017/11/6.
|
* Created by ${user} on 2017/11/6.
|
||||||
@@ -179,6 +184,31 @@ public class JSInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void savePictureShare(String json) {
|
||||||
|
Logger.e("savePictureShare: " + json);
|
||||||
|
try {
|
||||||
|
CommonWebViewActivity activity = mActivity;
|
||||||
|
if (activity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ShareInviteInfo info = new Gson().fromJson(json,ShareInviteInfo.class);
|
||||||
|
if (info.getType() != null) {
|
||||||
|
if (info.getType() == 1) {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
new ShareInviteDialog(info).show(activity.getSupportFragmentManager(), "SHARE_INVITE#JS");
|
||||||
|
});
|
||||||
|
} else if (info.getType() == 2) {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
new InviteImageHelper().saveToAlbum(activity, activity.getRxPermissions(), info, null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调转钱包页
|
* 调转钱包页
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1,48 @@
|
|||||||
|
package com.yizhuan.erban.ui.webview.room_banner
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.core.view.isInvisible
|
||||||
|
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.home.bean.BannerInfo
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/11/17 12:30
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class RoomBannerTabAdapter :
|
||||||
|
BaseQuickAdapter<RoomIcon, BaseViewHolder>(R.layout.room_banner_item_tab) {
|
||||||
|
|
||||||
|
private var selectedPosition = -1
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RoomIcon?) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_content).load(item?.url)
|
||||||
|
convertState(helper, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convertPayloads(
|
||||||
|
helper: BaseViewHolder,
|
||||||
|
item: RoomIcon?,
|
||||||
|
payloads: MutableList<Any>
|
||||||
|
) {
|
||||||
|
super.convertPayloads(helper, item, payloads)
|
||||||
|
convertState(helper, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun convertState(helper: BaseViewHolder, item: RoomIcon?) {
|
||||||
|
helper.getView<View>(R.id.v_selector).isInvisible =
|
||||||
|
helper.absoluteAdapterPosition != selectedPosition
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSelectedPosition(): Int {
|
||||||
|
return selectedPosition
|
||||||
|
}
|
||||||
|
|
||||||
|
fun select(position: Int) {
|
||||||
|
this.selectedPosition = position
|
||||||
|
notifyItemRangeChanged(0, itemCount, true)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,91 @@
|
|||||||
|
package com.yizhuan.erban.ui.webview.room_banner
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chuhai.utils.UiUtils
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomIcon
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/11/17 11:38
|
||||||
|
* Desc:房间内-Banner-WEB展示页面
|
||||||
|
**/
|
||||||
|
class RoomBannerWebDialogActivity : CommonWebViewActivity() {
|
||||||
|
|
||||||
|
private var recyclerView: RecyclerView? = null
|
||||||
|
private var adapter: RoomBannerTabAdapter? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun start(context: Context, position: Int, list: List<RoomIcon>) {
|
||||||
|
val newList = ArrayList<RoomIcon>()
|
||||||
|
newList.addAll(list)
|
||||||
|
val intent = Intent(context, RoomBannerWebDialogActivity::class.java)
|
||||||
|
intent.putExtra("position", position)
|
||||||
|
intent.putExtra("list", newList)
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.room_banner_dialog
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
|
||||||
|
window.setLayout(
|
||||||
|
WindowManager.LayoutParams.MATCH_PARENT,
|
||||||
|
WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
val topView = findViewById<View>(R.id.v_top)
|
||||||
|
topView.setOnClickListener { v: View? -> finish() }
|
||||||
|
val params = topView.layoutParams
|
||||||
|
params.height = UiUtils.dip2px(168f)
|
||||||
|
topView.layoutParams = params
|
||||||
|
webView.setBackgroundColor(Color.parseColor("#C9CBD1"))
|
||||||
|
recyclerView = findViewById(R.id.recyclerView)
|
||||||
|
val position = 0.coerceAtLeast(intent.getIntExtra("position", 0))
|
||||||
|
val list = intent.getSerializableExtra("list") as? ArrayList<RoomIcon>
|
||||||
|
// if ((list?.size ?: 0) <= 1) {
|
||||||
|
// recyclerView?.isVisible = false
|
||||||
|
// }
|
||||||
|
adapter = RoomBannerTabAdapter().apply {
|
||||||
|
setOnItemClickListener { adapter, view, position ->
|
||||||
|
if (this@RoomBannerWebDialogActivity.adapter?.getSelectedPosition() == position) {
|
||||||
|
return@setOnItemClickListener
|
||||||
|
}
|
||||||
|
switchTab(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recyclerView?.adapter = adapter
|
||||||
|
adapter?.setNewData(list)
|
||||||
|
switchTab(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun switchTab(position: Int) {
|
||||||
|
val url = adapter?.getItem(position)?.skipContent
|
||||||
|
showWebView(url)
|
||||||
|
adapter?.select(position)
|
||||||
|
recyclerView?.post {
|
||||||
|
recyclerView?.scrollToPosition(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showWebView(url: String?) {
|
||||||
|
if (url.isNullOrEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
super.showWebView(url)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,26 @@
|
|||||||
|
package com.yizhuan.erban.ui.webview.room_banner
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
|
||||||
|
import com.yizhuan.erban.ui.widget.rollviewpager.Util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 17:47
|
||||||
|
* Desc:房间半屏Web弹窗
|
||||||
|
**/
|
||||||
|
class RoomWebDialogActivity : DialogWebViewActivity() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun start(context: Context, url: String, showTitleBar: Boolean) {
|
||||||
|
val intent = Intent(context, RoomWebDialogActivity::class.java)
|
||||||
|
intent.putExtra("url", url)
|
||||||
|
intent.putExtra("showTitleBar", showTitleBar)
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTopMargin(): Int {
|
||||||
|
return Util.dip2px(this, 168f)
|
||||||
|
}
|
||||||
|
}
|
@@ -408,6 +408,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, ResUtil.getString(R.string.ui_widget_giftdialog_05), ResUtil.getString(R.string.ui_widget_giftdialog_06)));
|
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, ResUtil.getString(R.string.ui_widget_giftdialog_05), ResUtil.getString(R.string.ui_widget_giftdialog_06)));
|
||||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, ResUtil.getString(R.string.ui_widget_giftdialog_07), ResUtil.getString(R.string.ui_widget_giftdialog_08)));
|
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, ResUtil.getString(R.string.ui_widget_giftdialog_07), ResUtil.getString(R.string.ui_widget_giftdialog_08)));
|
||||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_DRAW_GIFT, ResUtil.getString(R.string.ui_widget_giftdialog_09), ResUtil.getString(R.string.ui_widget_giftdialog_010)));
|
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_DRAW_GIFT, ResUtil.getString(R.string.ui_widget_giftdialog_09), ResUtil.getString(R.string.ui_widget_giftdialog_010)));
|
||||||
|
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_SING_ROOM, ResUtil.getString(R.string.ui_widget_giftdialog_hot), ResUtil.getString(R.string.ui_widget_giftdialog_hot)));
|
||||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, ResUtil.getString(R.string.ui_widget_giftdialog_011), ResUtil.getString(R.string.ui_widget_giftdialog_012)));
|
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, ResUtil.getString(R.string.ui_widget_giftdialog_011), ResUtil.getString(R.string.ui_widget_giftdialog_012)));
|
||||||
giftIndicator = root.findViewById(R.id.gift_indicator);
|
giftIndicator = root.findViewById(R.id.gift_indicator);
|
||||||
giftIndicator.initTab(
|
giftIndicator.initTab(
|
||||||
@@ -492,6 +493,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
giftIndicator.setPosition(indicatorType);
|
giftIndicator.setPosition(indicatorType);
|
||||||
updateGiftView(giftIndicator.getCurrrentType(), giftInfo);
|
updateGiftView(giftIndicator.getCurrrentType(), giftInfo);
|
||||||
}
|
}
|
||||||
|
if (AvRoomDataManager.get().isSingleRoom()) {
|
||||||
|
giftIndicator.showPosition(GiftIndicator.TYPE_SING_ROOM);
|
||||||
|
} else {
|
||||||
|
giftIndicator.hidePosition(GiftIndicator.TYPE_SING_ROOM);
|
||||||
|
}
|
||||||
|
|
||||||
View descLayout = root.findViewById(R.id.desc_layout);
|
View descLayout = root.findViewById(R.id.desc_layout);
|
||||||
|
|
||||||
@@ -620,6 +626,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
currentGiftInfoList = getWeekStarGiftInfos();
|
currentGiftInfoList = getWeekStarGiftInfos();
|
||||||
} else if (position == GiftIndicator.TYPE_DRAW_GIFT) {
|
} else if (position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||||
currentGiftInfoList = getDrawGiftInfos();
|
currentGiftInfoList = getDrawGiftInfos();
|
||||||
|
} else if (position == GiftIndicator.TYPE_SING_ROOM) {
|
||||||
|
currentGiftInfoList = getSingleRoomGiftInfos();
|
||||||
}
|
}
|
||||||
// 有贵族礼物才显示贵族礼物的tab
|
// 有贵族礼物才显示贵族礼物的tab
|
||||||
if (ListUtils.isListEmpty(nobleGiftInfos)) {
|
if (ListUtils.isListEmpty(nobleGiftInfos)) {
|
||||||
@@ -643,6 +651,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
showEmptyView();
|
showEmptyView();
|
||||||
} else if (position == GiftIndicator.TYPE_LUCKY ||
|
} else if (position == GiftIndicator.TYPE_LUCKY ||
|
||||||
position == GiftIndicator.TYPE_WEEK ||
|
position == GiftIndicator.TYPE_WEEK ||
|
||||||
|
position == GiftIndicator.TYPE_SING_ROOM ||
|
||||||
position == GiftIndicator.TYPE_DRAW_GIFT) {
|
position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||||
showEmptyView();
|
showEmptyView();
|
||||||
updateWeekStarDesc();
|
updateWeekStarDesc();
|
||||||
@@ -657,7 +666,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
if (currentGiftInfo.isSendMsg()) {
|
if (currentGiftInfo.isSendMsg()) {
|
||||||
etSendMessage.setVisibility(View.VISIBLE);
|
etSendMessage.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, position == GiftIndicator.TYPE_WEEK ? 4 : 8, selectGiftInfo);
|
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, position == GiftIndicator.TYPE_WEEK ? 4 : 8, currentGiftInfo);
|
||||||
setGridViewData(pagerList);
|
setGridViewData(pagerList);
|
||||||
if (isKnap) {
|
if (isKnap) {
|
||||||
tvGiftValue.setVisibility(View.VISIBLE);
|
tvGiftValue.setVisibility(View.VISIBLE);
|
||||||
@@ -1093,6 +1102,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
GiftType.GIFT_TYPE_DRAW_GIFT);
|
GiftType.GIFT_TYPE_DRAW_GIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<GiftInfo> getSingleRoomGiftInfos() {
|
||||||
|
return GiftModel.get().getGiftInfosByType(
|
||||||
|
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||||
|
GiftType.GIFT_TYPE_SINGLE_ROOM);
|
||||||
|
}
|
||||||
|
|
||||||
private List<GiftInfo> getNobleGiftInfos() {
|
private List<GiftInfo> getNobleGiftInfos() {
|
||||||
return GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_VIP);
|
return GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_VIP);
|
||||||
}
|
}
|
||||||
@@ -1409,7 +1424,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
|||||||
if (throwable == null) {
|
if (throwable == null) {
|
||||||
// 返回结果时,当前选中选项与请求时的选项一样时才显示
|
// 返回结果时,当前选中选项与请求时的选项一样时才显示
|
||||||
if (currentType == giftIndicator.getCurrrentType()) {
|
if (currentType == giftIndicator.getCurrrentType()) {
|
||||||
updateGiftView(giftIndicator.getCurrrentType());
|
updateGiftView(giftIndicator.getCurrrentType(), currentGiftInfo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (needShowLoading) showLoadFailedView();
|
if (needShowLoading) showLoadFailedView();
|
||||||
|
146
app/src/main/java/com/yizhuan/erban/ui/widget/SideBarView.kt
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
package com.yizhuan.erban.ui.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Canvas
|
||||||
|
import android.graphics.Paint
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewParent
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/8 10:43
|
||||||
|
* Desc:字母索引
|
||||||
|
**/
|
||||||
|
class SideBarView : View {
|
||||||
|
private var selectIndex = 0
|
||||||
|
private var textSize = 0f
|
||||||
|
private var textColor = 0
|
||||||
|
private var textSizeFocus = 0f
|
||||||
|
private var textColorFocus = 0
|
||||||
|
|
||||||
|
//标记 避免重复调用
|
||||||
|
private var isDown = false
|
||||||
|
|
||||||
|
//这里也可以传入数组方式
|
||||||
|
private var list = listOf(
|
||||||
|
"A", "B", "C", "D", "E", "F", "G", "H", "I",
|
||||||
|
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
|
||||||
|
"W", "X", "Y", "Z", "#"
|
||||||
|
)
|
||||||
|
private var paint = Paint()
|
||||||
|
|
||||||
|
private var listener: Listener? = null
|
||||||
|
|
||||||
|
constructor(context: Context?) : super(context)
|
||||||
|
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context?,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
fun setTextColor(textColor: Int, focusTextColor: Int = textColor) {
|
||||||
|
this.textColor = textColor
|
||||||
|
this.textColorFocus = focusTextColor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTextSize(textSize: Float, focusTextSize: Float = textSize) {
|
||||||
|
this.textSize = textSize
|
||||||
|
this.textSizeFocus = focusTextSize
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDraw(canvas: Canvas?) {
|
||||||
|
super.onDraw(canvas)
|
||||||
|
paintText(canvas)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun paintText(canvas: Canvas?) {
|
||||||
|
//计算每一个字母的高度,总告诉除以字母集合的高度就可以
|
||||||
|
val height: Int = height / list.size
|
||||||
|
for (i in list.indices) {
|
||||||
|
if (i == selectIndex) {
|
||||||
|
paint.color = textColorFocus
|
||||||
|
paint.textSize = textSizeFocus
|
||||||
|
} else {
|
||||||
|
paint.color = textColor
|
||||||
|
paint.textSize = textSize
|
||||||
|
}
|
||||||
|
paint.isAntiAlias = true //设置抗锯齿
|
||||||
|
paint.typeface = Typeface.DEFAULT_BOLD
|
||||||
|
//计算每一个字母x轴
|
||||||
|
val paintX = width / 2f - paint.measureText(list[i]) / 2
|
||||||
|
//计算每一个字母Y轴
|
||||||
|
val paintY = height * i + height
|
||||||
|
//绘画出来这个TextView
|
||||||
|
canvas?.drawText(list[i], paintX, paintY.toFloat(), paint)
|
||||||
|
//画完一个以后重置画笔
|
||||||
|
paint.reset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
|
val parent: ViewParent?
|
||||||
|
when (event.action) {
|
||||||
|
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_MOVE -> {
|
||||||
|
val index = (event.y / height * list.size).toInt()
|
||||||
|
if (index >= 0 && index < list.size && selectIndex != index) {
|
||||||
|
listener?.onSideBarScroll(list[index])
|
||||||
|
selectIndex = index
|
||||||
|
invalidate()
|
||||||
|
//改变标记状态
|
||||||
|
isDown = true
|
||||||
|
}
|
||||||
|
parent = getParent()
|
||||||
|
parent?.requestDisallowInterceptTouchEvent(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||||
|
listener?.onSideBarScrollEnd()
|
||||||
|
//改变标记状态
|
||||||
|
isDown = false
|
||||||
|
parent = getParent()
|
||||||
|
parent?.requestDisallowInterceptTouchEvent(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Listener {
|
||||||
|
//滚动位置
|
||||||
|
fun onSideBarScroll(word: String)
|
||||||
|
|
||||||
|
//隐藏提示文本
|
||||||
|
fun onSideBarScrollEnd()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setListener(listener: Listener?) {
|
||||||
|
this.listener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item滚动 更新侧边栏字母
|
||||||
|
*
|
||||||
|
* @param word 字母
|
||||||
|
*/
|
||||||
|
fun onUpdateSideBarText(word: String?) {
|
||||||
|
//手指没触摸才调用
|
||||||
|
if (!isDown) {
|
||||||
|
for (i in list.indices) {
|
||||||
|
if (list[i] == word && selectIndex != i) {
|
||||||
|
selectIndex = i
|
||||||
|
invalidate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -44,6 +44,7 @@ import com.yizhuan.erban.ui.user.activity.UserInfoActivity;
|
|||||||
import com.yizhuan.erban.ui.user.adapter.SkillPicsAdapter;
|
import com.yizhuan.erban.ui.user.adapter.SkillPicsAdapter;
|
||||||
import com.yizhuan.erban.ui.user.decorationsend.UserInfoSkillDecoration;
|
import com.yizhuan.erban.ui.user.decorationsend.UserInfoSkillDecoration;
|
||||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||||
|
import com.yizhuan.erban.utils.NamePlateHelper;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||||
import com.yizhuan.erban.vip.util.VipHelper;
|
import com.yizhuan.erban.vip.util.VipHelper;
|
||||||
@@ -574,11 +575,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
//铭牌
|
//铭牌
|
||||||
if (!TextUtils.isEmpty(userInfo.getNameplatePic()) && !TextUtils.isEmpty(userInfo.getNameplateWord())) {
|
NamePlateHelper.INSTANCE.load(inNamePlate, inNamePlate.findViewById(R.id.tv_official_mask), inNamePlate.findViewById(R.id.iv_official_mask), userInfo);
|
||||||
setNamePlate(userInfo.getNameplatePic(), userInfo.getNameplateWord());
|
|
||||||
} else {
|
|
||||||
setNamePlate(null, null);
|
|
||||||
}
|
|
||||||
// 改变贵族
|
// 改变贵族
|
||||||
updateNobleView();
|
updateNobleView();
|
||||||
UserInfo.NamePlate namePlate = userInfo.getNameplate();
|
UserInfo.NamePlate namePlate = userInfo.getNameplate();
|
||||||
@@ -660,26 +657,6 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNamePlate(String nameplatePic, String nameplateWord) {
|
|
||||||
if (!TextUtils.isEmpty(nameplateWord) && !TextUtils.isEmpty(nameplatePic)) {
|
|
||||||
inNamePlate.setVisibility(View.VISIBLE);
|
|
||||||
TextView tvNamePlate;
|
|
||||||
tvNamePlate = inNamePlate.findViewById(R.id.tv_official_mask);
|
|
||||||
if (tvNamePlate != null) {
|
|
||||||
tvNamePlate.setText(nameplateWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView ivNamePlate;
|
|
||||||
ivNamePlate = inNamePlate.findViewById(R.id.iv_official_mask);
|
|
||||||
if (ivNamePlate != null) {
|
|
||||||
ImageLoadUtils.loadImage(context, nameplatePic, ivNamePlate);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
inNamePlate.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setOfficialMask(String name, String icon) {
|
private void setOfficialMask(String name, String icon) {
|
||||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||||
inOfficialMask.setVisibility(View.VISIBLE);
|
inOfficialMask.setVisibility(View.VISIBLE);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.yizhuan.erban.ui.widget.dialog;
|
package com.yizhuan.erban.ui.widget.dialog;
|
||||||
|
|
||||||
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM;
|
||||||
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_ALL;
|
||||||
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_LUCKY_SEA_GIFT_SERVER_ALL;
|
||||||
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_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
|
||||||
@@ -8,6 +9,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
@@ -20,12 +22,21 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
|
||||||
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||||
import com.opensource.svgaplayer.SVGADrawable;
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
import com.opensource.svgaplayer.SVGADynamicEntity;
|
import com.opensource.svgaplayer.SVGADynamicEntity;
|
||||||
import com.opensource.svgaplayer.SVGAImageView;
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
@@ -33,9 +44,12 @@ import com.opensource.svgaplayer.SVGAParser;
|
|||||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||||
|
import com.yizhuan.erban.avroom.widget.TemplateMessageAdapter;
|
||||||
import com.yizhuan.erban.common.svga.SimpleSvgaCallback;
|
import com.yizhuan.erban.common.svga.SimpleSvgaCallback;
|
||||||
import com.yizhuan.erban.databinding.DialogAllPlayEffectBinding;
|
import com.yizhuan.erban.databinding.DialogAllPlayEffectBinding;
|
||||||
|
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||||
|
import com.yizhuan.erban.utils.CommonJumpHelper;
|
||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.erban.utils.SpannableBuilder;
|
import com.yizhuan.erban.utils.SpannableBuilder;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||||
@@ -44,23 +58,36 @@ 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.PlayEffectInfo;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
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.RoomLuckySeaMsgBean;
|
||||||
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTemplateNotifyMsgBean;
|
||||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
||||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
|
||||||
public class AllPlayEffectDialog extends BaseDialog {
|
public class AllPlayEffectDialog extends BaseDialog {
|
||||||
|
|
||||||
private final PlayEffectInfo playEffectInfo;
|
private final PlayEffectInfo playEffectInfo;
|
||||||
private DialogAllPlayEffectBinding binding;
|
private DialogAllPlayEffectBinding binding;
|
||||||
|
|
||||||
public AllPlayEffectDialog(Context context, @NonNull PlayEffectInfo playEffectInfo) {
|
private CompositeDisposable disposable = null;
|
||||||
|
private boolean belowGiftNotify;
|
||||||
|
|
||||||
|
public AllPlayEffectDialog(Context context, @NonNull PlayEffectInfo playEffectInfo, boolean belowGiftNotify) {
|
||||||
super(context, R.style.FullScreenDialog);
|
super(context, R.style.FullScreenDialog);
|
||||||
this.playEffectInfo = playEffectInfo;
|
this.playEffectInfo = playEffectInfo;
|
||||||
|
this.belowGiftNotify = belowGiftNotify;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
disposable = new CompositeDisposable();
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
binding = DialogAllPlayEffectBinding.inflate(LayoutInflater.from(getContext()));
|
binding = DialogAllPlayEffectBinding.inflate(LayoutInflater.from(getContext()));
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
@@ -80,6 +107,9 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
window.setAttributes(windowParams);
|
window.setAttributes(windowParams);
|
||||||
window.setWindowAnimations(R.style.anim_left);
|
window.setWindowAnimations(R.style.anim_left);
|
||||||
}
|
}
|
||||||
|
if (belowGiftNotify) {
|
||||||
|
binding.vGiftNotifyPlaceholder.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
switch (playEffectInfo.getSecond()) {
|
switch (playEffectInfo.getSecond()) {
|
||||||
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
|
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
|
||||||
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
||||||
@@ -87,6 +117,9 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
case CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL:
|
case CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL:
|
||||||
showLuckySeaNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
|
showLuckySeaNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_MSG_CRAZY_ZOO_SUB_ALL_ROOM:
|
||||||
|
showZooNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
|
||||||
|
break;
|
||||||
case CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL:
|
case CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL:
|
||||||
showLuckyBagNotify(playEffectInfo.getLuckyBagNoticeInfo());
|
showLuckyBagNotify(playEffectInfo.getLuckyBagNoticeInfo());
|
||||||
break;
|
break;
|
||||||
@@ -99,6 +132,9 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE:
|
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE:
|
||||||
showNotifyH5BySvga(playEffectInfo.getNotifyH5());
|
showNotifyH5BySvga(playEffectInfo.getNotifyH5());
|
||||||
break;
|
break;
|
||||||
|
case CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL:
|
||||||
|
showTemplateNotify(playEffectInfo.getTemplateNotifyMsgBean());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -260,39 +296,35 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showLuckyBagNotify(LuckyBagNoticeInfo luckyBagNoticeInfo) {
|
private void showZooNotifyBySVGA(RoomLuckySeaMsgBean roomLuckySeaMsgBean) {
|
||||||
SpannableBuilder text = new SpannableBuilder()
|
SpannableBuilder text = new SpannableBuilder()
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_04),
|
ResUtil.getString(R.string.congratulation),
|
||||||
new ForegroundColorSpan(Color.WHITE)
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
subAndReplaceDot(luckyBagNoticeInfo.getNick(), 6) + " ",
|
roomLuckySeaMsgBean.getNick() + " ",
|
||||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(),R.color.notice_nick))
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_FEF23E))
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
|
ResUtil.getString(R.string.in_the_zoo),
|
||||||
new ForegroundColorSpan(Color.WHITE)
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
luckyBagNoticeInfo.getLuckyBagName() + " ",
|
String.valueOf(roomLuckySeaMsgBean.getItemMultiple()),
|
||||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_06),
|
ResUtil.getString(R.string.times_reward_get),
|
||||||
new ForegroundColorSpan(Color.WHITE)
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
luckyBagNoticeInfo.getGoldPrice() + " ",
|
String.valueOf(roomLuckySeaMsgBean.getDiamonds()),
|
||||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
|
||||||
)
|
)
|
||||||
.append(
|
.append(
|
||||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_07),
|
ResUtil.getString(R.string.diamond_point),
|
||||||
new ForegroundColorSpan(Color.WHITE)
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
)
|
|
||||||
.append(
|
|
||||||
luckyBagNoticeInfo.getGiftName(),
|
|
||||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
|
||||||
);
|
);
|
||||||
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
||||||
svgaImageView.setLoops(1);
|
svgaImageView.setLoops(1);
|
||||||
@@ -307,7 +339,7 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
});
|
});
|
||||||
binding.flSvgaNotify.addView(svgaImageView);
|
binding.flSvgaNotify.addView(svgaImageView);
|
||||||
try {
|
try {
|
||||||
SVGAParser.Companion.shareParser().decodeFromAssets("svga/lucky_gift_notify.svga", new SVGAParser.ParseCompletion() {
|
SVGAParser.Companion.shareParser().decodeFromAssets("svga/zoo_notify.svga", new SVGAParser.ParseCompletion() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||||
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||||
@@ -324,13 +356,13 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
1.0f,
|
1.0f,
|
||||||
0.0f,
|
0.0f,
|
||||||
false
|
false
|
||||||
), "fdpp_copywriting");
|
), "noble_text_tx");
|
||||||
svgaImageView.setOnClickListener(new View.OnClickListener() {
|
svgaImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//跳轉房間要移除監聽,不然可能NPE
|
if (!TextUtils.isEmpty(roomLuckySeaMsgBean.getSkipUrl())) {
|
||||||
svgaImageView.setCallback(null);
|
CommonWebViewActivity.start(getContext(), roomLuckySeaMsgBean.getSkipUrl());
|
||||||
AVRoomActivity.start(getContext(), luckyBagNoticeInfo.getRoomUid());
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||||
@@ -349,6 +381,66 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showLuckyBagNotify(LuckyBagNoticeInfo noticeInfo) {
|
||||||
|
View roomView = LayoutInflater.from(getContext())
|
||||||
|
.inflate(R.layout.layout_room_lucky_bag_notify, null);
|
||||||
|
ImageView bagImageView = roomView.findViewById(R.id.iv_bag);
|
||||||
|
bagImageView.setOnClickListener(view -> goRoom(noticeInfo.getRoomTitle(),noticeInfo.getRoomUid()));
|
||||||
|
ImageLoadUtilsV2.loadImage(bagImageView, noticeInfo.getLuckyBagGiftPic());
|
||||||
|
ImageView giftImageView = roomView.findViewById(R.id.iv_gift);
|
||||||
|
giftImageView.setOnClickListener(view -> goRoom(noticeInfo.getRoomTitle(),noticeInfo.getRoomUid()));
|
||||||
|
ImageLoadUtilsV2.loadImage(giftImageView, noticeInfo.getGiftPic());
|
||||||
|
TextView messageTextView = roomView.findViewById(R.id.tv_message);
|
||||||
|
SpannableBuilder text = new SpannableBuilder()
|
||||||
|
.append(
|
||||||
|
subAndReplaceDot(noticeInfo.getNick(), 6),
|
||||||
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_FFF45E))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_027),
|
||||||
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
noticeInfo.getLuckyBagName(),
|
||||||
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_FFF45E))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_028),
|
||||||
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
noticeInfo.getGoldPrice() + ResUtil.getString(R.string.diamond_name),
|
||||||
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
ResUtil.getString(R.string.avroom_widget_roomeffectview_029),
|
||||||
|
new ForegroundColorSpan(Color.WHITE)
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
noticeInfo.getGiftName(),
|
||||||
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||||
|
);
|
||||||
|
if (noticeInfo.getGiftNum() > 1) {
|
||||||
|
text.append(
|
||||||
|
"X" + noticeInfo.getGiftNum(),
|
||||||
|
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.white))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
messageTextView.setText(text.build());
|
||||||
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) binding.flSvgaNotify.getLayoutParams();
|
||||||
|
layoutParams.dimensionRatio = "375:71";
|
||||||
|
binding.flSvgaNotify.setLayoutParams(layoutParams);
|
||||||
|
binding.flSvgaNotify.addView(roomView,params);
|
||||||
|
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.anim_box_notify);
|
||||||
|
roomView.startAnimation(animation);
|
||||||
|
disposable.add(Observable.timer(6500, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> {
|
||||||
|
Animation animation1 = AnimationUtils.loadAnimation(getContext(), R.anim.anim_box_notify_close);
|
||||||
|
roomView.startAnimation(animation1);
|
||||||
|
}));
|
||||||
|
disposable.add(Observable.timer(7000, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> closeSelf()));
|
||||||
|
}
|
||||||
|
|
||||||
private void showNotifyH5BySvga(NotifyH5Info info) {
|
private void showNotifyH5BySvga(NotifyH5Info info) {
|
||||||
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
||||||
svgaImageView.setLoops(1);
|
svgaImageView.setLoops(1);
|
||||||
@@ -509,19 +601,208 @@ public class AllPlayEffectDialog extends BaseDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showTemplateNotify(RoomTemplateNotifyMsgBean msgBean) {
|
||||||
|
if (msgBean == null) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String resourceType = msgBean.getResourceType();
|
||||||
|
if (resourceType == null) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (resourceType.equals("IMAGE")) {
|
||||||
|
showTemplateImageNotify(msgBean);
|
||||||
|
} else if (resourceType.equals("SVGA")) {
|
||||||
|
showTemplateSvgaNotify(msgBean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showTemplateImageNotify(@NonNull RoomTemplateNotifyMsgBean msgBean) {
|
||||||
|
if (msgBean.getResourceType() == null || !msgBean.getResourceType().equals("IMAGE")) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String resourceContent = msgBean.getResourceContent();
|
||||||
|
if (resourceContent == null || resourceContent.isEmpty()) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Runnable endAction = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
closeSelf();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
View rootView = LayoutInflater.from(getContext())
|
||||||
|
.inflate(R.layout.layout_room_template_notify_image, null);
|
||||||
|
TemplateMessageAdapter adapter = new TemplateMessageAdapter(null);
|
||||||
|
TextView textView = rootView.findViewById(R.id.tv_text);
|
||||||
|
Integer textSize = msgBean.getFontSize();
|
||||||
|
if (textSize == null) {
|
||||||
|
textSize = 12;
|
||||||
|
}
|
||||||
|
textView.setTextSize(textSize);
|
||||||
|
Integer textColor = adapter.parseColor(msgBean.getTextColor());
|
||||||
|
if (textColor == null) {
|
||||||
|
textColor = Color.WHITE;
|
||||||
|
}
|
||||||
|
textView.setTextColor(textColor);
|
||||||
|
ImageView bgView = rootView.findViewById(R.id.iv_bg);
|
||||||
|
ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
binding.flTemplateNotify.addView(rootView, params);
|
||||||
|
GlideApp.with(bgView)
|
||||||
|
.load(resourceContent).into(new CustomTarget<Drawable>() {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
|
adapter.convert(textView, msgBean);
|
||||||
|
bgView.setImageDrawable(resource);
|
||||||
|
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.anim_box_notify);
|
||||||
|
rootView.startAnimation(animation);
|
||||||
|
View.OnClickListener clickAction = v -> {
|
||||||
|
Integer skipType = msgBean.getSkipType();
|
||||||
|
if (skipType == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CommonJumpHelper.bannerJump(getContext(), skipType, msgBean.getSkipContent());
|
||||||
|
};
|
||||||
|
rootView.setOnClickListener(clickAction);
|
||||||
|
textView.setOnClickListener(clickAction);
|
||||||
|
disposable.add(Observable.timer(6500, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> {
|
||||||
|
Animation animation1 = AnimationUtils.loadAnimation(getContext(), R.anim.anim_box_notify_close);
|
||||||
|
rootView.startAnimation(animation1);
|
||||||
|
}));
|
||||||
|
disposable.add(Observable.timer(7000, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> endAction.run()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
endAction.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||||
|
super.onLoadFailed(errorDrawable);
|
||||||
|
endAction.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showTemplateSvgaNotify(@NonNull RoomTemplateNotifyMsgBean msgBean) {
|
||||||
|
if (msgBean.getResourceType() == null || !msgBean.getResourceType().equals("SVGA")) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String resourceContent = msgBean.getResourceContent();
|
||||||
|
if (resourceContent == null || resourceContent.isEmpty()) {
|
||||||
|
closeSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Runnable endAction = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
closeSelf();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
||||||
|
svgaImageView.setLoops(1);
|
||||||
|
svgaImageView.setClearsAfterDetached(true);
|
||||||
|
svgaImageView.setCallback(new SimpleSvgaCallback() {
|
||||||
|
@Override
|
||||||
|
public void onFinished() {
|
||||||
|
endAction.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, 0);
|
||||||
|
params.dimensionRatio = msgBean.getDimensionRatio();
|
||||||
|
if (params.dimensionRatio == null) {
|
||||||
|
params.dimensionRatio = "75:11";
|
||||||
|
}
|
||||||
|
binding.flTemplateNotify.addView(svgaImageView, params);
|
||||||
|
try {
|
||||||
|
SVGAParser.Companion.shareParser().decodeFromURL(new URL(resourceContent), new SVGAParser.ParseCompletion() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||||
|
TemplateMessageAdapter adapter = new TemplateMessageAdapter(null);
|
||||||
|
CharSequence text = adapter.parse(getContext(), msgBean);
|
||||||
|
if (text == null) {
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
String textKey = msgBean.getSvgaTextKey();
|
||||||
|
int textSize = 24;
|
||||||
|
if (msgBean.getFontSize() != null) {
|
||||||
|
textSize = msgBean.getFontSize();
|
||||||
|
}
|
||||||
|
int textColor = Color.WHITE;
|
||||||
|
Integer color = adapter.parseColor(msgBean.getTextColor());
|
||||||
|
if (color != null) {
|
||||||
|
textColor = color;
|
||||||
|
}
|
||||||
|
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||||
|
TextPaint textPaint = new TextPaint();
|
||||||
|
textPaint.setColor(textColor);//字体颜色
|
||||||
|
textPaint.setTextSize(textSize);//字体大小
|
||||||
|
dynamicEntity.setDynamicText(new StaticLayout(
|
||||||
|
text,
|
||||||
|
0,
|
||||||
|
text.length(),
|
||||||
|
textPaint,
|
||||||
|
0,
|
||||||
|
Layout.Alignment.ALIGN_CENTER,
|
||||||
|
1.0f,
|
||||||
|
0.0f,
|
||||||
|
false
|
||||||
|
), textKey);
|
||||||
|
svgaImageView.setOnClickListener(v -> {
|
||||||
|
Integer skipType = msgBean.getSkipType();
|
||||||
|
if (skipType == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CommonJumpHelper.bannerJump(getContext(), skipType, msgBean.getSkipContent());
|
||||||
|
});
|
||||||
|
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||||
|
svgaImageView.setImageDrawable(drawable);
|
||||||
|
svgaImageView.stepToFrame(0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
endAction.run();
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
endAction.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String subAndReplaceDot(String nick, int maxLength) {
|
private String subAndReplaceDot(String nick, int maxLength) {
|
||||||
if(nick.length() > maxLength){
|
if (nick.length() > maxLength) {
|
||||||
return nick.substring(0,maxLength)+"...";
|
return nick.substring(0, maxLength) + "...";
|
||||||
}else {
|
} else {
|
||||||
return nick;
|
return nick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeSelf() {
|
private void closeSelf() {
|
||||||
try {
|
try {
|
||||||
|
if (disposable != null) {
|
||||||
|
disposable.dispose();
|
||||||
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void goRoom(String roomTitle, long roomUid) {
|
||||||
|
if (roomUid <= 0L) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (AllServiceGiftGoRoomTipsDialog.Companion.isNeedTips()) {
|
||||||
|
new AllServiceGiftGoRoomTipsDialog(getContext(), roomTitle, roomUid).show();
|
||||||
|
} else {
|
||||||
|
AVRoomActivity.start(getContext(), roomUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@ import android.widget.FrameLayout;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.chuhai.utils.ServiceTime;
|
||||||
import com.opensource.svgaplayer.SVGADrawable;
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
import com.opensource.svgaplayer.SVGADynamicEntity;
|
import com.opensource.svgaplayer.SVGADynamicEntity;
|
||||||
import com.opensource.svgaplayer.SVGAImageView;
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
@@ -41,6 +42,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
|||||||
|
|
||||||
private final VipMessageInfo vipMessageInfo;
|
private final VipMessageInfo vipMessageInfo;
|
||||||
private DialogVipAllServiceLevelUpBinding binding;
|
private DialogVipAllServiceLevelUpBinding binding;
|
||||||
|
private long startTime = 0;
|
||||||
|
private int frameCount = 0;
|
||||||
|
|
||||||
public AllServiceVipLevelUPDialog(Context context, @NonNull VipMessageInfo vipMessageInfo) {
|
public AllServiceVipLevelUPDialog(Context context, @NonNull VipMessageInfo vipMessageInfo) {
|
||||||
super(context, R.style.FullScreenDialog);
|
super(context, R.style.FullScreenDialog);
|
||||||
@@ -77,7 +80,7 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
|||||||
.append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_01), new ForegroundColorSpan(Color.WHITE))
|
.append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_01), new ForegroundColorSpan(Color.WHITE))
|
||||||
.append("-", new CircleImageSpan(new ColorDrawable(Color.TRANSPARENT), vipMessageInfo.getAvatar(), 50, 50))
|
.append("-", new CircleImageSpan(new ColorDrawable(Color.TRANSPARENT), vipMessageInfo.getAvatar(), 50, 50))
|
||||||
.append(" " + StringExtensionKt.sub(vipMessageInfo.getNick(), 6) + " ", new ForegroundColorSpan(getContext().getResources().getColor(R.color.notice_nick)))
|
.append(" " + StringExtensionKt.sub(vipMessageInfo.getNick(), 6) + " ", new ForegroundColorSpan(getContext().getResources().getColor(R.color.notice_nick)))
|
||||||
.append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_02) + vipMessageInfo.getCurrVipName(), new ForegroundColorSpan(Color.WHITE)+"!");
|
.append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_02) + vipMessageInfo.getCurrVipName(), new ForegroundColorSpan(Color.WHITE) + "!");
|
||||||
|
|
||||||
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
||||||
svgaImageView.setLoops(1);
|
svgaImageView.setLoops(1);
|
||||||
@@ -87,7 +90,19 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
|||||||
svgaImageView.setCallback(new SimpleSvgaCallback() {
|
svgaImageView.setCallback(new SimpleSvgaCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinished() {
|
public void onFinished() {
|
||||||
closeSelf();
|
long offset = ServiceTime.INSTANCE.getTime() - startTime;
|
||||||
|
if (offset < 6000) {
|
||||||
|
int centerFrame = frameCount / 2;
|
||||||
|
if (centerFrame > 0) {
|
||||||
|
// 目前的SVGA资源最后一帧是半透明的,这里强制跳到中间帧,最大程度避免这种情况
|
||||||
|
svgaImageView.stepToFrame(centerFrame, false);
|
||||||
|
}
|
||||||
|
svgaImageView.postDelayed(() -> {
|
||||||
|
closeSelf();
|
||||||
|
}, 6000 - offset);
|
||||||
|
} else {
|
||||||
|
closeSelf();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
binding.flSvgaVipNotify.addView(svgaImageView);
|
binding.flSvgaVipNotify.addView(svgaImageView);
|
||||||
@@ -95,6 +110,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
|||||||
SVGAParser.Companion.shareParser().decodeFromURL(new URL(vipMessageInfo.getFloatPic()), new SVGAParser.ParseCompletion() {
|
SVGAParser.Companion.shareParser().decodeFromURL(new URL(vipMessageInfo.getFloatPic()), new SVGAParser.ParseCompletion() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||||
|
frameCount = svgaVideoEntity.getFrames();
|
||||||
|
startTime = ServiceTime.INSTANCE.getTime();
|
||||||
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||||
TextPaint textPaint = new TextPaint();
|
TextPaint textPaint = new TextPaint();
|
||||||
textPaint.setColor(Color.WHITE);//字体颜色
|
textPaint.setColor(Color.WHITE);//字体颜色
|
||||||
|
@@ -48,6 +48,11 @@ public class GiftIndicator extends LinearLayout {
|
|||||||
/**背包礼物*/
|
/**背包礼物*/
|
||||||
public static final int TYPE_KNAP = 5;
|
public static final int TYPE_KNAP = 5;
|
||||||
|
|
||||||
|
|
||||||
|
/**个播人气礼物*/
|
||||||
|
public static final int TYPE_SING_ROOM = 6;
|
||||||
|
|
||||||
|
|
||||||
private Map<String, String> map = new HashMap<>();
|
private Map<String, String> map = new HashMap<>();
|
||||||
|
|
||||||
public GiftIndicator(Context context, @Nullable AttributeSet attrs) {
|
public GiftIndicator(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
@@ -14,6 +14,7 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
|||||||
import com.yizhuan.erban.ui.im.RouterHandler;
|
import com.yizhuan.erban.ui.im.RouterHandler;
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||||
|
import com.yizhuan.xchat_android_core.home.bean.IRouterData;
|
||||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,38 +28,48 @@ public class CommonJumpHelper {
|
|||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
*/
|
*/
|
||||||
public static void bannerJump(Context context, BannerInfo bannerInfo) {
|
public static void bannerJump(Context context, IRouterData bannerInfo) {
|
||||||
|
int skipType = bannerInfo.getSkipType();
|
||||||
|
if (skipType == SKIP_TYPE_ROUTER) {
|
||||||
|
bannerJump(context, JavaUtil.str2int(bannerInfo.getRouterType()), bannerInfo.getRouterValue());
|
||||||
|
} else {
|
||||||
|
bannerJump(context, skipType, bannerInfo.getSkipUri());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
if (null == context || null == bannerInfo) {
|
* 通用跳转
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public static void bannerJump(Context context, int skipType, String skipContent) {
|
||||||
|
if (null == context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int skipType = bannerInfo.getSkipType();
|
|
||||||
String url = bannerInfo.getSkipUri();
|
|
||||||
switch (skipType) {
|
switch (skipType) {
|
||||||
case SKIP_TYP_APP:
|
case SKIP_TYP_APP:
|
||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(skipContent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RouterHandler.handle(context, JavaUtil.str2int(url), null);
|
RouterHandler.handle(context, JavaUtil.str2int(skipContent), null);
|
||||||
break;
|
break;
|
||||||
case SKIP_TYP_CHAT_ROOM:
|
case SKIP_TYP_CHAT_ROOM:
|
||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(skipContent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AVRoomActivity.start(context, JavaUtil.str2long(url));
|
AVRoomActivity.start(context, JavaUtil.str2long(skipContent));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SKIP_TYP_H5:
|
case SKIP_TYP_H5:
|
||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(skipContent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
||||||
intent.putExtra("url", url);
|
intent.putExtra("url", skipContent);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case SKIP_TYPE_ROUTER:
|
case SKIP_TYPE_ROUTER:
|
||||||
RouterHandler.handle(context, JavaUtil.str2int(bannerInfo.getRouterType()), bannerInfo.getRouterValue());
|
RouterHandler.handle(context, skipType, skipContent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
78
app/src/main/java/com/yizhuan/erban/utils/NamePlateHelper.kt
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package com.yizhuan.erban.utils
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||||
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/1/2 16:34
|
||||||
|
* Desc:铭牌助手
|
||||||
|
**/
|
||||||
|
object NamePlateHelper {
|
||||||
|
|
||||||
|
fun load(
|
||||||
|
viewGroup: View?,
|
||||||
|
textView: TextView,
|
||||||
|
imageView: ImageView, userInfo: UserInfo?
|
||||||
|
) {
|
||||||
|
load(
|
||||||
|
viewGroup,
|
||||||
|
textView,
|
||||||
|
imageView,
|
||||||
|
userInfo?.nameplateWord,
|
||||||
|
userInfo?.nameplatePic,
|
||||||
|
userInfo?.isCustomWord
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载数据
|
||||||
|
* @param viewGroup 铭牌View-Layout
|
||||||
|
* @param textView 铭牌View-文本
|
||||||
|
* @param imageView 铭牌View-图片/背景
|
||||||
|
* @param word 铭牌文字
|
||||||
|
* @param pic 铭牌图片
|
||||||
|
* @param isCustom 是否自定义铭牌
|
||||||
|
*/
|
||||||
|
fun load(
|
||||||
|
viewGroup: View?,
|
||||||
|
textView: TextView,
|
||||||
|
imageView: ImageView,
|
||||||
|
word: String?,
|
||||||
|
pic: String?,
|
||||||
|
isCustom: Boolean?
|
||||||
|
) {
|
||||||
|
if (isCustom == true) {
|
||||||
|
// 自定义模式:不展示文字
|
||||||
|
load(viewGroup, textView, imageView, null, pic)
|
||||||
|
} else {
|
||||||
|
load(viewGroup, textView, imageView, word, pic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun load(
|
||||||
|
viewGroup: View?,
|
||||||
|
textView: TextView,
|
||||||
|
imageView: ImageView,
|
||||||
|
word: String?,
|
||||||
|
pic: String?
|
||||||
|
) {
|
||||||
|
// 图片优先:无图片时都不展示
|
||||||
|
if (pic.isNullOrEmpty()) {
|
||||||
|
viewGroup?.isVisible = false
|
||||||
|
} else {
|
||||||
|
imageView.isVisible = true
|
||||||
|
ImageLoadUtils.loadImage(imageView, pic)
|
||||||
|
if (!word.isNullOrEmpty()) {
|
||||||
|
textView.text = word
|
||||||
|
textView.isVisible = true
|
||||||
|
} else {
|
||||||
|
textView.isVisible = false
|
||||||
|
}
|
||||||
|
viewGroup?.isVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -42,6 +42,27 @@ public class SpannableBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支持多個spannable 對同一段文字修改
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
* @param what
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SpannableBuilder append(CharSequence text, Object... what) {
|
||||||
|
if (TextUtils.isEmpty(text)) return this;
|
||||||
|
int start = builder.length();
|
||||||
|
builder.append(text);
|
||||||
|
for (int i = 0; i < what.length; i++) {
|
||||||
|
Object o = what[i];
|
||||||
|
if (o == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
builder.setSpan(what[i], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public SpannableStringBuilder build() {
|
public SpannableStringBuilder build() {
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@@ -57,8 +57,10 @@ class VipUpgradeDialog : BaseDialog<DialogVipUpgradeBinding>() {
|
|||||||
.decodeFromURL(URL(vipInfo.vipLogo), object : SVGAParser.ParseCompletion {
|
.decodeFromURL(URL(vipInfo.vipLogo), object : SVGAParser.ParseCompletion {
|
||||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||||
val drawable = SVGADrawable(videoItem)
|
val drawable = SVGADrawable(videoItem)
|
||||||
binding?.ivVipIcon?.setImageDrawable(drawable)
|
if (isViewLoaded) {
|
||||||
binding?.ivVipIcon?.startAnimation()
|
_binding?.ivVipIcon?.setImageDrawable(drawable)
|
||||||
|
_binding?.ivVipIcon?.startAnimation()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError() {
|
override fun onError() {
|
||||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_zoo_notice.webp
Normal file
After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_share_save_to_album.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1017 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/fans_team_ic_room_entrance.webp
Normal file
After Width: | Height: | Size: 2.4 KiB |