Compare commits
91 Commits
habu_relea
...
peko_relea
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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) {
|
||||
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'
|
||||
|
||||
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 'com.github.mmin18:realtimeblurview:1.2.1'
|
||||
@@ -303,6 +303,7 @@ dependencies {
|
||||
implementation 'com.contrarywind:wheelview:4.1.0'
|
||||
|
||||
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
}
|
||||
|
||||
channel {
|
||||
|
@@ -355,6 +355,24 @@
|
||||
android:name=".ui.webview.CommonWebViewActivity"
|
||||
android:screenOrientation="portrait"
|
||||
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
|
||||
android:name=".ui.webview.SimpleWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@@ -521,7 +539,7 @@
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxActivity"
|
||||
android:theme="@style/dialog_web_view_activity" />
|
||||
android:theme="@style/transparent_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.BoxRankingActivity"
|
||||
android:theme="@style/room_message_activity" />
|
||||
@@ -825,10 +843,18 @@
|
||||
<activity
|
||||
android:name=".ui.webview.DialogWebViewActivity"
|
||||
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
|
||||
android:name=".ui.webview.DatingRuleWebViewActivity"
|
||||
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
|
||||
android:name=".ui.webview.TarotPayWebViewActivity"
|
||||
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
@@ -410,6 +410,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
}
|
||||
onParseIntent();
|
||||
handleNimIntent();
|
||||
InitialModel.get().regionCheck();
|
||||
}
|
||||
|
||||
private void onParseIntent() {
|
||||
@@ -519,6 +520,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
||||
firstLoadedUserInfo();
|
||||
InitialModel.get().regionCheck();
|
||||
}
|
||||
|
||||
public void onLogout() {
|
||||
|
@@ -16,6 +16,8 @@ import android.util.Log;
|
||||
import androidx.multidex.MultiDex;
|
||||
|
||||
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.facebook.stetho.Stetho;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
@@ -114,6 +116,9 @@ import io.realm.RealmConfiguration;
|
||||
public class XChatApplication extends BaseApp {
|
||||
public static final String TAG = "XChatApplication";
|
||||
public static Application gContext;
|
||||
|
||||
// 接收到退出登录事件(跳转到登录页了)
|
||||
private static long logoutEventTime = 0;
|
||||
private static final MessageNotifierCustomization messageNotifierCustomization = new MessageNotifierCustomization() {
|
||||
@Override
|
||||
public String makeNotifyContent(String nick, IMMessage message) {
|
||||
@@ -202,10 +207,11 @@ public class XChatApplication extends BaseApp {
|
||||
|
||||
String channel = "";
|
||||
channel = ChannelReaderUtil.getChannel(instance);
|
||||
Log.d(TAG, "localChannel:" + channel);
|
||||
if (TextUtils.isEmpty(channel)) {
|
||||
channel = Constants.GOOGLE;
|
||||
}
|
||||
|
||||
Log.d(TAG, "finalChannel:" + channel);
|
||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
@@ -244,6 +250,13 @@ public class XChatApplication extends BaseApp {
|
||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
||||
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;
|
||||
@@ -403,6 +416,7 @@ public class XChatApplication extends BaseApp {
|
||||
httpParams.put("deviceId", DeviceUuidFactory.getDeviceId(context));
|
||||
httpParams.put("androidId", MD5Utils.getMD5String(Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID)));
|
||||
httpParams.put("channel", AppMetaDataUtil.getChannelID());
|
||||
httpParams.put("lang", LanguageUtils.INSTANCE.getSystemLanguage().toLanguageTag());
|
||||
RxNet.init(context)
|
||||
.debug(BuildConfig.DEBUG)
|
||||
.setBaseUrl(url)
|
||||
|
@@ -140,6 +140,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.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.treasurefairy.FairyMsgInfoBean;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
@@ -225,6 +226,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private SingleRoomTipDialog singleRoomTipDialog;
|
||||
// 通过红包进来时,有该参数
|
||||
private RedPackageNotifyInfo redPackageNotifyInfo;
|
||||
|
||||
// 是否禁用VP滑动(true:不允许滑动;false:某些条件下可以滑动)
|
||||
private boolean viewPagerInputDisable;
|
||||
|
||||
public static void start(Context context, long roomUid) {
|
||||
startForFromType(context, roomUid, FROM_TYPE_NORMAL, null, null);
|
||||
}
|
||||
@@ -319,7 +324,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
} else if (roomInfo.getType() == RoomInfo.ROOM_TYPE_SINGLE) {
|
||||
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 {
|
||||
bgPicture[0] = "";
|
||||
if (roomInfo.getRoomModeType() == RoomModeType.OPEN_PK_MODE) {
|
||||
@@ -396,7 +402,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
public void setCurrentItem(int item) {
|
||||
dismissLoadingDialog();
|
||||
if (viewpager != null) {
|
||||
viewpager.setUserInputEnabled(true);
|
||||
tryEnabledViewPagerInput();
|
||||
viewpager.setCurrentItem(item, false);
|
||||
}
|
||||
}
|
||||
@@ -411,7 +417,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
Object notifyInfo = intent.getSerializableExtra("notifyInfo");
|
||||
if (notifyInfo instanceof RedPackageNotifyInfo) {
|
||||
redPackageNotifyInfo = (RedPackageNotifyInfo) notifyInfo;
|
||||
}else{
|
||||
} else {
|
||||
redPackageNotifyInfo = null;
|
||||
}
|
||||
if (mRoomInfo != null) {
|
||||
@@ -445,7 +451,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
viewpager.setOffscreenPageLimit(2);
|
||||
viewpager.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
|
||||
viewpager.getChildAt(0).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
viewpager.setUserInputEnabled(false);
|
||||
disableViewPagerInput();
|
||||
viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
@@ -472,11 +478,11 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (state == 0 && viewpager.getCurrentItem() == 2) {
|
||||
showLoadingDialog();
|
||||
((FakeSingleRoomFragment) mAdapter.getItem(2)).tryJumpRoom();
|
||||
viewpager.setUserInputEnabled(false);
|
||||
disableViewPagerInput();
|
||||
} else if (state == 0 && viewpager.getCurrentItem() == 0) {
|
||||
showLoadingDialog();
|
||||
((FakeSingleRoomBackFragment) mAdapter.getItem(0)).tryJumpRoom();
|
||||
viewpager.setUserInputEnabled(false);
|
||||
disableViewPagerInput();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -615,6 +621,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
case RoomEvent.MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN:
|
||||
toBack(true);
|
||||
break;
|
||||
case RoomEvent.FAIRY_DRAW_GIFT_L5:
|
||||
ChatRoomMessage message = roomEvent.getChatRoomMessage();
|
||||
if (message != null) {
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -663,7 +675,14 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
*/
|
||||
private void showRoomFragment(boolean isRoomMin) {
|
||||
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);
|
||||
if (isRoomMin) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
@@ -1196,17 +1215,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
return;
|
||||
giftList.add(data);
|
||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
giftDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showGiftDialog();
|
||||
if (mCurrentFragment != null && mCurrentFragment.isShowingPlayNotify()) {
|
||||
return;
|
||||
}
|
||||
showGiftDialog();
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
@@ -1303,10 +1315,23 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowingGiftNotify() {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void showGiftDialog() {
|
||||
if (!isValid()) return;
|
||||
if (giftList == null) return;
|
||||
if (giftList.size() == 0) return;
|
||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||
if (data == null) return;
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
giftDialog = generateAllServiceGiftDialog(this, data);
|
||||
giftDialog.setOnDismissListener(dialog -> {
|
||||
giftList.pollFirst();
|
||||
@@ -1395,6 +1420,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RoomWidget findWidget(@NonNull String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class GiftBroadcastObserver implements Observer<BroadcastMessage> {
|
||||
private WeakReference<AVRoomActivity> mReference;
|
||||
|
||||
@@ -1427,4 +1458,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.noble.NobleResourceType;
|
||||
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_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
@@ -107,10 +108,11 @@ public class RoomInviteActivity extends BaseMvpActivity<IRoomInviteView, RoomInv
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChatMemberByPageSuccess(List<OnlineChatMember> memberList, int page) {
|
||||
public void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
||||
mPage = page;
|
||||
|
@@ -527,7 +527,7 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
/**
|
||||
* 主席位特有
|
||||
*/
|
||||
FrameLayout frTitle;
|
||||
View frTitle;
|
||||
TextView tvRoomDesc;
|
||||
ImageView ivTag;
|
||||
TextView tvLabelLeaveMode;
|
||||
|
@@ -12,27 +12,20 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
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.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
||||
import com.yizhuan.erban.utils.NamePlateHelper;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
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.IMNetEaseManager;
|
||||
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.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomOnlineUserBean;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
@@ -41,19 +34,17 @@ import io.reactivex.disposables.Disposable;
|
||||
* @author Administrator
|
||||
* @date 2017/12/4
|
||||
*/
|
||||
public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMember, BaseViewHolder> {
|
||||
public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<RoomOnlineUserBean, BaseViewHolder> {
|
||||
|
||||
private boolean mIsHomeParty;
|
||||
private Disposable mDisposable;
|
||||
private Context context;
|
||||
private OnRoomOnlineNumberChangeListener mListener;
|
||||
|
||||
public OnlineUserAdapter(Context context, boolean isHomeParty) {
|
||||
super(null);
|
||||
addItemType(OnlineChatMember.NORMAL, R.layout.list_item_online_user);
|
||||
addItemType(OnlineChatMember.NOBLE, R.layout.list_item_online_user_mystery);
|
||||
addItemType(RoomOnlineUserBean.NORMAL, R.layout.list_item_online_user);
|
||||
addItemType(RoomOnlineUserBean.NOBLE, R.layout.list_item_online_user_mystery);
|
||||
mIsHomeParty = isHomeParty;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,147 +54,76 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder baseViewHolder, OnlineChatMember onlineChatMember) {
|
||||
if (onlineChatMember != null && onlineChatMember.chatRoomMember != null) {
|
||||
if (onlineChatMember.getItemType() == OnlineChatMember.NORMAL) {
|
||||
setNormalData(baseViewHolder, onlineChatMember);
|
||||
} else {
|
||||
setMysteryData();
|
||||
}
|
||||
protected void convert(@NonNull BaseViewHolder helper, RoomOnlineUserBean item) {
|
||||
if (item.getItemType() == OnlineChatMember.NOBLE) {
|
||||
return;
|
||||
}
|
||||
// 性别
|
||||
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);
|
||||
|
||||
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 nobleAvatarView = helper.getView(R.id.noble_avatar_view);
|
||||
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);
|
||||
String experLevelUrl = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, onlineChatMember.chatRoomMember);
|
||||
AppCompatImageView ivUserExper = helper.getView(R.id.iv_user_exper);
|
||||
boolean isExperLevelUrlEmpty = TextUtils.isEmpty(experLevelUrl);
|
||||
ivUserExper.setVisibility(!isExperLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
||||
if (!isExperLevelUrlEmpty) {
|
||||
ImageLoadUtils.loadImage(mContext, experLevelUrl, ivUserExper);
|
||||
}
|
||||
//魅力等级
|
||||
AppCompatImageView ivUserCharm = baseViewHolder.getView(R.id.iv_user_charm);
|
||||
String charmLevelUrl = NobleUtil.getLevel(UserLevelResourceType.CHARM_URL, onlineChatMember.chatRoomMember);
|
||||
AppCompatImageView ivUserCharm = helper.getView(R.id.iv_user_charm);
|
||||
boolean isCharmLevelUrlEmpty = TextUtils.isEmpty(charmLevelUrl);
|
||||
ivUserCharm.setVisibility(!isCharmLevelUrlEmpty ? View.VISIBLE : View.GONE);
|
||||
if (!isCharmLevelUrlEmpty) {
|
||||
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);
|
||||
String namePlatePic = NobleUtil.getLevel(UserInfo.NAMEPLATE_PIC, onlineChatMember.chatRoomMember);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
View inNamePlate = helper.getView(R.id.in_nameplate);
|
||||
NamePlateHelper.INSTANCE.load(inNamePlate, inNamePlate.findViewById(R.id.tv_official_mask), inNamePlate.findViewById(R.id.iv_official_mask), item);
|
||||
}
|
||||
|
||||
private void registerRoomEvent() {
|
||||
@@ -240,7 +160,7 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
||||
updateMemberIn(roomEvent);
|
||||
} else if (event == RoomEvent.ROOM_MEMBER_EXIT) {
|
||||
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) {
|
||||
if (mListener != null) {
|
||||
mListener.onMemberIn(roomEvent.getAccount(), mData);
|
||||
mListener.onMemberIn(roomEvent.getAccount());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateManager(RoomEvent roomEvent) {
|
||||
if (mListener != null)
|
||||
mListener.onUpdateMemberManager(roomEvent.getAccount(),
|
||||
roomEvent.getEvent() == RoomEvent.ROOM_MANAGER_REMOVE, mData);
|
||||
roomEvent.getEvent() == RoomEvent.ROOM_MANAGER_REMOVE);
|
||||
}
|
||||
|
||||
private void updateDownUpMic(String account, boolean isUpMic) {
|
||||
if (mListener != null) {
|
||||
mListener.onMemberDownUpMic(account, isUpMic, mData);
|
||||
mListener.onMemberDownUpMic(account, isUpMic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,34 +201,29 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
||||
*
|
||||
* @param account
|
||||
*/
|
||||
void onMemberIn(String account, List<OnlineChatMember> dataList);
|
||||
void onMemberIn(String account);
|
||||
|
||||
/**
|
||||
* 成员出去回调
|
||||
*
|
||||
* @param account
|
||||
* @param dataList
|
||||
*/
|
||||
void onMemberExit(String account, List<OnlineChatMember> dataList);
|
||||
void onMemberExit(String account);
|
||||
|
||||
/**
|
||||
* 成员上下麦更新
|
||||
*
|
||||
* @param account
|
||||
* @param isUpMic
|
||||
* @param dataList
|
||||
*/
|
||||
void onMemberDownUpMic(String account, boolean isUpMic,
|
||||
List<OnlineChatMember> dataList);
|
||||
void onMemberDownUpMic(String account, boolean isUpMic);
|
||||
|
||||
/**
|
||||
* 设置管理员回调
|
||||
*
|
||||
* @param account
|
||||
* @param dataList
|
||||
*/
|
||||
void onUpdateMemberManager(String account, boolean isRemoveManager,
|
||||
List<OnlineChatMember> dataList);
|
||||
void onUpdateMemberManager(String account, boolean isRemoveManager);
|
||||
|
||||
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.Intent
|
||||
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.text.TextUtils
|
||||
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.RoomFreeGiftDialog
|
||||
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.redpackage.send.RedPackageSendDialog
|
||||
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.event.OpenRoomIntroEvent
|
||||
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.GiftDialog
|
||||
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
||||
import com.yizhuan.erban.ui.widget.GiftDialog.SenGiftCallback
|
||||
import com.yizhuan.erban.ui.widget.UserInfoDialog
|
||||
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.tutu.music.widget.MusicPlayerView
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants
|
||||
import com.yizhuan.xchat_android_core.Constants
|
||||
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.bean.RoomMicInfo
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo
|
||||
import com.yizhuan.xchat_android_core.gift.event.RoomFreeGiftEvent
|
||||
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.im.custom.bean.RoomFollowOwnerAttachment
|
||||
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.room.anotherroompk.ShowGiftDialogEvent
|
||||
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.event.RoomAtEvent
|
||||
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 microView: MicroView
|
||||
private var musicPlayerView: MusicPlayerView? = null
|
||||
private var ivRadishEntrance: View? = null
|
||||
private var mVsMusicPlayer: ViewStub? = null
|
||||
private var mDisposable: Disposable? = null
|
||||
private var isCloseScreen = false
|
||||
@@ -207,7 +191,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
inputSend = mView.findViewById(R.id.input_send)
|
||||
microView = mView.findViewById(R.id.micro_view)
|
||||
mVsMusicPlayer = mView.findViewById(R.id.vs_music_player)
|
||||
ivRadishEntrance = mView.findViewById(R.id.iv_radish_entrance)
|
||||
messageView.setClickConsumer {
|
||||
if (!TextUtils.isEmpty(it) && it != "0") {
|
||||
showUserCardDialog(it)
|
||||
@@ -287,13 +270,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
// 刷新禮物列表,獲取房間專屬禮物列表
|
||||
GiftModel.get().refreshGiftList(AvRoomDataManager.get().roomUid.toString()).subscribe()
|
||||
checkFollowOwner()
|
||||
mvpPresenter?.loadRoomRank()
|
||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||
|
||||
//先隐藏航海冒险
|
||||
// ivRadishEntrance?.isVisible =
|
||||
// !GoldBoxHelper.needIntegrateBoxEntrance() && GoldBoxHelper.isShowRadish()
|
||||
|
||||
//获取免费礼物详情
|
||||
mvpPresenter?.queryFreeFlower()
|
||||
initRoomAlbum()
|
||||
@@ -355,6 +333,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
updateRemoteMuteBtn()
|
||||
openOrCloseGiftValue(true)
|
||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||
onEnterRoom()
|
||||
}
|
||||
|
||||
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() {
|
||||
roomFreeGiftDialog?.dismiss()
|
||||
messageView.release()
|
||||
@@ -557,6 +474,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
if (isOnMic) {
|
||||
if (musicPlayerView == null) {
|
||||
musicPlayerView = mVsMusicPlayer?.inflate() as? MusicPlayerView
|
||||
musicPlayerView?.let {
|
||||
onInitMusicPlayerView(it)
|
||||
}
|
||||
}
|
||||
musicPlayerView?.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -678,17 +598,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
R.id.input_send -> {
|
||||
sendMsg()
|
||||
}
|
||||
|
||||
R.id.contribute_list -> {
|
||||
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
||||
mvpPresenter?.loadRoomRank()
|
||||
}
|
||||
|
||||
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
||||
R.id.iv_treasure_box,
|
||||
R.id.iv_treasure_box_cp -> GoldBoxHelper.handleBoxClick(mContext)
|
||||
|
||||
R.id.iv_radish_entrance -> PullRadishActivity.start(mContext)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,18 +1070,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
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) {
|
||||
if (giftDialog == null) {
|
||||
GiftDialog.GIFT_DIALOG_FROM = getString(R.string.room)
|
||||
@@ -1337,6 +1234,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
return this
|
||||
}
|
||||
|
||||
override fun findWidget(name: String): RoomWidget? {
|
||||
return widgets[name]
|
||||
}
|
||||
|
||||
open fun initWidget() {
|
||||
|
||||
}
|
||||
@@ -1365,4 +1266,12 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
inputEdit.requestFocus()
|
||||
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.GameMiniMicroViewAdapter
|
||||
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.game.GameDelegate
|
||||
import com.yizhuan.erban.avroom.game.OnGameStatusChangeListener
|
||||
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.view.IGameRoomView
|
||||
import com.yizhuan.erban.databinding.FragmentGameRoomBinding
|
||||
import com.yizhuan.erban.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.music.model.PlayerModel
|
||||
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
||||
@@ -68,9 +69,9 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.mgId
|
||||
)
|
||||
gameDelegate.setOnGameStatusChangeListener(this)
|
||||
gameBinding.rankWidget.setContentBackgroundResource(R.drawable.room_rank_widget_bg_game)
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun initiate() {
|
||||
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
||||
@@ -78,7 +79,6 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
//游戏模式暂时不需要这个
|
||||
PlayerModel.get().stop()
|
||||
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
|
||||
mvpPresenter?.getBannerList()
|
||||
gameBinding.tvShowMiniMic.setOnClickListener { showMiniMic() }
|
||||
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)
|
||||
fun onFinishAvRoomEvent(event: FinishAvRoomEvent) {
|
||||
gameDelegate.exitGame()
|
||||
@@ -161,6 +157,8 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
||||
// banner里可能有首充入口:刷新下
|
||||
gameBinding.bannerWidget.refreshData()
|
||||
FirstChargePrizeDialog(
|
||||
requireContext(),
|
||||
event.chargeProdTitle,
|
||||
@@ -196,6 +194,9 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
|
||||
override fun initWidget() {
|
||||
super.initWidget()
|
||||
gameBinding.bannerWidget.disabledIndicator()
|
||||
registerWidget(RedPackageWidget::class.java.simpleName, gameBinding.redPackageWidget)
|
||||
registerWidget(RoomRankWidget::class.java.simpleName, gameBinding.rankWidget)
|
||||
registerWidget(RoomBannerWidget::class.java.simpleName, gameBinding.bannerWidget)
|
||||
}
|
||||
}
|
@@ -18,6 +18,8 @@ import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
@@ -114,6 +116,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
private String FOLLOW_ROOM_TYPE = "";
|
||||
private SelectGameAdapter gameAdapter;
|
||||
|
||||
public final MutableLiveData<Boolean> playNotifyStateLiveData = new MutableLiveData<Boolean>(false);
|
||||
|
||||
public static HomePartyFragment newInstance() {
|
||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||
@@ -214,10 +217,11 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
gameMainBinding.llRoomInfo.setOnClickListener(this);
|
||||
gameMainBinding.ivBack.setOnClickListener(this);
|
||||
|
||||
mRoomEffectView.setPlayNotifyStateListener(playNotifyStateLiveData);
|
||||
mRoomEffectView.setOnPlayAnimCallback(new Function0<Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke() {
|
||||
return getIsAnim();
|
||||
return isShowingGiftNotify();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -360,18 +364,22 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean getIsAnim() {
|
||||
if (giftView != null) {
|
||||
return giftView.getIsPlayAnim();
|
||||
private boolean isShowingGiftNotify() {
|
||||
if ((getActivity() instanceof AVRoomActivity)) {
|
||||
return ((AVRoomActivity) getActivity()).isShowingGiftNotify();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取玩法飘屏是否展示
|
||||
*/
|
||||
private boolean getIsPlayAnim() {
|
||||
return mRoomEffectView.getIsPlayAnim();
|
||||
public LiveData<Boolean> getPlayNotifyState(){
|
||||
return playNotifyStateLiveData;
|
||||
}
|
||||
|
||||
public boolean isShowingPlayNotify(){
|
||||
if(playNotifyStateLiveData.getValue()==null) {
|
||||
return false;
|
||||
}
|
||||
return playNotifyStateLiveData.getValue();
|
||||
}
|
||||
|
||||
private void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
|
||||
|
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
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.RoomPkForceFinishDialog;
|
||||
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.PKMicQueueDialog;
|
||||
import com.yizhuan.erban.avroom.dialog.PKResultDialog;
|
||||
import com.yizhuan.erban.avroom.dialog.PKScoreBoardDialog;
|
||||
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.presenter.HomePartyPresenter;
|
||||
import com.yizhuan.erban.avroom.rank.RoomRankWidget;
|
||||
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget;
|
||||
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
||||
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.DialogWebViewActivity;
|
||||
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.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
@@ -138,6 +144,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
public void initWidget() {
|
||||
super.initWidget();
|
||||
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")
|
||||
@@ -151,7 +161,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
updateQueuingMicBtn();
|
||||
updatePkScoreBoard();
|
||||
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
||||
getMvpPresenter().getBannerList();
|
||||
// if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
||||
// UserModel.get().getCurrentUserInfo()
|
||||
// .compose(bindToLifecycle())
|
||||
@@ -603,7 +612,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
getMvpPresenter().cancelDragon();
|
||||
});
|
||||
break;
|
||||
case R.id.tv_hour_rank:
|
||||
case R.id.layout_hour_rank:
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
||||
@@ -787,7 +796,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
|
||||
private void hideKtvRelaView() {
|
||||
gameBinding.setKtvModel(false);
|
||||
gameBinding.contributeList.setVisibility(View.VISIBLE);
|
||||
changeModelShowView();
|
||||
gameBinding.bottomView.showKtvBottom(false);
|
||||
}
|
||||
@@ -799,40 +807,10 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
}
|
||||
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo.getIsPermitRoom() == 1) {
|
||||
gameBinding.tvHourRank.setVisibility(View.VISIBLE);
|
||||
gameBinding.layoutHourRank.setVisibility(View.VISIBLE);
|
||||
} 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();
|
||||
}
|
||||
|
||||
@@ -966,15 +944,11 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
return pkMicQueueDialog != null && pkMicQueueDialog.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowBanner(List<BannerInfo> bannerInfos) {
|
||||
initRoomAct(gameBinding.activityImg, bannerInfos, 11f);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onFirstRechargeEvent(FirstChargeEvent event) {
|
||||
gameBinding.ivFirstChargeEnter.setVisibility(View.GONE);
|
||||
// banner里可能有首充入口:刷新下
|
||||
gameBinding.bannerWidget.refreshData();
|
||||
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.netease.nim.uikit.common.util.sys.NetworkUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
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.avroom.adapter.OnlineUserAdapter;
|
||||
import com.yizhuan.erban.avroom.presenter.HomePartyUserListPresenter;
|
||||
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
||||
import com.yizhuan.erban.base.BaseMvpFragment;
|
||||
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.room.bean.OnlineChatMember;
|
||||
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.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -44,7 +39,6 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
private SmartRefreshLayout mRefreshLayout;
|
||||
|
||||
private OnlineUserAdapter mOnlineUserAdapter;
|
||||
private int mPage = Constants.PAGE_START;
|
||||
private boolean isShowToUser = false;
|
||||
|
||||
@Override
|
||||
@@ -58,24 +52,12 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
public void onFindViews() {
|
||||
mRecyclerView = mView.findViewById(R.id.recycler_view);
|
||||
mRefreshLayout = mView.findViewById(R.id.refresh_layout);
|
||||
mRefreshLayout.setEnableLoadmore(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
mRefreshLayout.setOnRefreshLoadmoreListener(new OnRefreshLoadmoreListener() {
|
||||
@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());
|
||||
}
|
||||
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(RefreshLayout refreshLayout) {
|
||||
@@ -106,53 +88,24 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
|
||||
|
||||
public void firstLoad() {
|
||||
mPage = Constants.PAGE_START;
|
||||
loadData(0);
|
||||
loadData();
|
||||
}
|
||||
|
||||
private void loadData(long time) {
|
||||
getMvpPresenter().requestChatMemberByPage(mPage, time,
|
||||
mOnlineUserAdapter == null ? null : mOnlineUserAdapter.getData());
|
||||
private void loadData() {
|
||||
getMvpPresenter().requestRoomOnlineList(AvRoomDataManager.get().getRoomUid());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRequestChatMemberByPageSuccess(List<OnlineChatMember> chatRoomMemberList, int page) {
|
||||
mPage = page;
|
||||
if (!ListUtils.isListEmpty(chatRoomMemberList)) {
|
||||
//超管不显示
|
||||
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);
|
||||
}
|
||||
}
|
||||
public void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list) {
|
||||
mOnlineUserAdapter.setNewData(list);
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChatMemberByPageFail(String errorStr, int page) {
|
||||
Logger.i(ResUtil.getString(R.string.avroom_fragment_onlineuserfragment_01) + page);
|
||||
mPage = page;
|
||||
if (mPage == Constants.PAGE_START) {
|
||||
mRefreshLayout.finishRefresh();
|
||||
} else {
|
||||
mRefreshLayout.finishLoadmore(0);
|
||||
}
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,16 +119,12 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom != null) {
|
||||
List<OnlineChatMember> chatRoomMembers = mOnlineUserAdapter.getData();
|
||||
List<RoomOnlineUserBean> chatRoomMembers = mOnlineUserAdapter.getData();
|
||||
if (ListUtils.isListEmpty(chatRoomMembers)) return;
|
||||
OnlineChatMember onlineChatMember = chatRoomMembers.get(position);
|
||||
ChatRoomMember chatRoomMember = onlineChatMember.chatRoomMember;
|
||||
if (chatRoomMember != null) {
|
||||
if (onlineChatMember.getItemType() == OnlineChatMember.NOBLE) {
|
||||
return;
|
||||
}
|
||||
RoomOnlineUserBean onlineChatMember = chatRoomMembers.get(position);
|
||||
if (onlineChatMember != null) {
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext,
|
||||
JavaUtil.str2long(chatRoomMember.getAccount()),
|
||||
onlineChatMember.getUid(),
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
@@ -185,28 +134,25 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberIn(String account, List<OnlineChatMember> dataList) {
|
||||
// if (!isResumed()) return;
|
||||
// getMvpPresenter().onMemberInRefreshData(account, dataList, mPage);
|
||||
public void onMemberIn(String account) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberExit(String account, List<OnlineChatMember> dataList) {
|
||||
public void onMemberExit(String account) {
|
||||
// if (!isResumed()) return;
|
||||
// if (!isShowToUser()) return;
|
||||
// firstLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberDownUpMic(String account, boolean isUpMic, List<OnlineChatMember> dataList) {
|
||||
if (!isResumed()) return;
|
||||
getMvpPresenter().onMemberDownUpMic(account, isUpMic, dataList, mPage);
|
||||
public void onMemberDownUpMic(String account, boolean isUpMic) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateMemberManager(String account, boolean isRemoveManager, List<OnlineChatMember> dataList) {
|
||||
if (!isResumed()) return;
|
||||
getMvpPresenter().onUpdateMemberManager(account, dataList, isRemoveManager, mPage);
|
||||
public void onUpdateMemberManager(String account, boolean isRemoveManager) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -13,9 +13,13 @@ import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener
|
||||
import com.yizhuan.erban.avroom.adapter.SingleAnchorMicroViewAdapter
|
||||
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.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.rank.RoomRankWidget
|
||||
import com.yizhuan.erban.avroom.redpackage.RedPackageWidget
|
||||
import com.yizhuan.erban.avroom.singleroompk.SingleRoomPkFinishDialog
|
||||
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.FansTeamJoinedActivity
|
||||
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.DialogWebViewActivity
|
||||
import com.yizhuan.tutu.music.widget.MusicPlayerView
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
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.RequestUpmicAttachment
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment
|
||||
@@ -83,24 +85,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
@SuppressLint("CheckResult")
|
||||
override fun initiate() {
|
||||
super.initiate()
|
||||
mvpPresenter?.getBannerList()
|
||||
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.fansTeamInitInfoLiveData.observe(viewLifecycleOwner) {
|
||||
@@ -109,7 +94,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
}
|
||||
}
|
||||
|
||||
gameBinding.tvHourRank.setOnClickListener {
|
||||
gameBinding.layoutHourRank.setOnClickListener {
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||
@@ -120,16 +105,10 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateFansTeamInfo(initInfo: FansTeamInitInfo) {
|
||||
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 (AvRoomDataManager.get().isRoomOwner) {
|
||||
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||
gameBinding.tvFansTeamOpt.isVisible = true
|
||||
gameBinding.tvFansTeamOpt.text = "粉絲團(${initInfo.anchorFansNum})"
|
||||
clickListener = View.OnClickListener {
|
||||
DialogWebViewActivity.start(
|
||||
@@ -139,12 +118,16 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
}
|
||||
} else {
|
||||
if (initInfo.isAnchorFans) {
|
||||
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||
gameBinding.tvFansTeamOpt.isVisible = true
|
||||
gameBinding.tvFansTeamOpt.text =
|
||||
"粉絲LV.${if (initInfo.fansLevelSeq == 0) 1 else initInfo.fansLevelSeq}"
|
||||
clickListener = View.OnClickListener {
|
||||
FansTeamJoinedActivity.start(requireContext())
|
||||
}
|
||||
} else {
|
||||
gameBinding.flFansTeamJoinTip.isVisible = true
|
||||
gameBinding.tvFansTeamOpt.isVisible = false
|
||||
clickListener = View.OnClickListener {
|
||||
FansTeamJoinActivity.start(requireContext())
|
||||
}
|
||||
@@ -152,6 +135,8 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
}
|
||||
} else {
|
||||
if (AvRoomDataManager.get().isRoomOwner) {
|
||||
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||
gameBinding.tvFansTeamOpt.isVisible = true
|
||||
gameBinding.tvFansTeamOpt.text = "開通粉絲團"
|
||||
clickListener = View.OnClickListener {
|
||||
CommonWebViewActivity.start(
|
||||
@@ -160,7 +145,9 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
)
|
||||
}
|
||||
} else {
|
||||
gameBinding.tvFansTeamOpt.text = "該主播暫未開通粉絲團"
|
||||
gameBinding.flFansTeamJoinTip.isVisible = false
|
||||
gameBinding.tvFansTeamOpt.isVisible = true
|
||||
gameBinding.tvFansTeamOpt.text = "TA暫未開通粉絲團"
|
||||
}
|
||||
}
|
||||
gameBinding.flFansTeam.setOnClickListener(clickListener)
|
||||
@@ -230,6 +217,11 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
bottomView.setBottomViewListener(BaseRoomBottomViewWrapper())
|
||||
}
|
||||
|
||||
override fun onEnterRoom() {
|
||||
super.onEnterRoom()
|
||||
fansTeamViewModel.loadFansTeamInitInfo()
|
||||
}
|
||||
|
||||
override fun updateView() {
|
||||
super.updateView()
|
||||
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)
|
||||
fun onFirstRechargeEvent(event: FirstChargeEvent) {
|
||||
gameBinding.ivFirstChargeEnter.visibility = View.GONE
|
||||
// banner里可能有首充入口:刷新下
|
||||
gameBinding.bannerWidget.refreshData()
|
||||
FirstChargePrizeDialog(
|
||||
requireContext(),
|
||||
event.chargeProdTitle,
|
||||
@@ -266,5 +255,14 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
override fun initWidget() {
|
||||
super.initWidget()
|
||||
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 var APP_CODE = ""
|
||||
|
||||
private val mRoomID = AvRoomDataManager.get().roomUid.toString()
|
||||
private val mRoomID :String get() = AvRoomDataManager.get().roomUid.toString()
|
||||
private val mLanguage = "zh-TW" //語言
|
||||
|
||||
//調用遊戲SDK的接口,成功加載遊戲後可用:
|
||||
@@ -84,7 +84,10 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
}
|
||||
|
||||
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
|
||||
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
|
||||
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.avroom.activity.AVRoomActivity;
|
||||
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.erban.avroom.view.IAvRoomView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
@@ -120,7 +121,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
exitRoom();
|
||||
}
|
||||
AvRoomDataManager.get().updateServiceRoomInfo(roomInfo);
|
||||
initAnotherPKData();
|
||||
mAvRoomModel.enterRoom(roomInfo.getRoomId(), 3, fromType, fromNick, fromUid)
|
||||
.flatMap(this::dealServerMicInfo)
|
||||
.map(this::dealMicMemberFromIMNet)
|
||||
@@ -143,6 +143,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
.subscribe((stringServiceResult) -> EventBus.getDefault().post(new AudioPartyOpenEvent()));
|
||||
mAvRoomModel.loadMessageHistory(AvRoomDataManager.get().clearScreenTime);
|
||||
IMNetEaseManager.get().joinAvRoom();
|
||||
initAnotherPKData();
|
||||
}, this::dealEnterRoomError);
|
||||
}
|
||||
|
||||
@@ -151,7 +152,15 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
if (AvRoomDataManager.get().isOpenAnotherPKMode()) {
|
||||
RoomPKModel.INSTANCE.getRoomPKData(AvRoomDataManager.get().getRoomUid())
|
||||
.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
|
||||
|
@@ -1,15 +1,7 @@
|
||||
package com.yizhuan.erban.avroom.presenter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
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> {
|
||||
|
||||
@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.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
||||
import com.yizhuan.erban.utils.UserUtils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
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.FaceAttachment;
|
||||
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))
|
||||
, 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 com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.view.IHomePartyUserListView;
|
||||
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_library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> </p>
|
||||
@@ -26,49 +20,17 @@ public class HomePartyUserListPresenter extends BaseMvpPresenter<IHomePartyUserL
|
||||
mHomePartyUserListMode = new HomePartyUserListModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取房间成员:第一页包含队列成员,固定成员,游客50人,之后每一页获取游客50人
|
||||
*
|
||||
* @param page 页数
|
||||
* @param time 固定成员列表用updateTime,
|
||||
* 游客列表用进入enterTime,
|
||||
* 填0会使用当前服务器最新时间开始查询,即第一页,单位毫秒
|
||||
*/
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestChatMemberByPage(final int page, long time, List<OnlineChatMember> oldList) {
|
||||
mHomePartyUserListMode.getOnLinePageMembers(page, time, oldList)
|
||||
.subscribe(onlineChatMembers -> {
|
||||
Logger.i(ResUtil.getString(R.string.avroom_presenter_homepartyuserlistpresenter_01), page, onlineChatMembers.size());
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().onRequestChatMemberByPageSuccess(onlineChatMembers, page);
|
||||
}
|
||||
}, 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 requestRoomOnlineList(long roomUid){
|
||||
mHomePartyUserListMode.getRoomOnlineList(roomUid).compose(bindToLifecycle()).subscribe((data, throwable) -> {
|
||||
if (getMvpView() != null) {
|
||||
if (data != null) {
|
||||
getMvpView().onRequestRoomOnlineListSuccess(data);
|
||||
} else {
|
||||
getMvpView().onRequestChatMemberByPageFail(throwable.getMessage(), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
while (iterator.hasNext()) {
|
||||
ChatRoomMember member = iterator.next();
|
||||
if (member != null
|
||||
&& !TextUtils.isEmpty(member.getAccount())
|
||||
&& map.containsKey(member.getAccount())) {
|
||||
iterator.remove();
|
||||
if (member != null && !TextUtils.isEmpty(member.getAccount())) {
|
||||
if (map.containsKey(member.getAccount())) {
|
||||
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;
|
||||
|
@@ -1,11 +1,7 @@
|
||||
package com.yizhuan.erban.avroom.presenter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
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>
|
||||
@@ -14,50 +10,4 @@ import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
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
|
||||
)
|
||||
|
||||
private var compositeDisposable: CompositeDisposable? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
@@ -218,26 +216,14 @@ class RedPackageWidget : FrameLayoutRoomWidget, RoomWidget {
|
||||
getCompositeDisposable().add(disposable)
|
||||
}
|
||||
|
||||
private fun getCompositeDisposable(): CompositeDisposable {
|
||||
var disposable = compositeDisposable
|
||||
if (disposable == null) {
|
||||
disposable = CompositeDisposable()
|
||||
compositeDisposable = disposable
|
||||
}
|
||||
return disposable
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
this.dialogManager?.dismissDialog()
|
||||
this.dialogManager = null
|
||||
this.roomView = null
|
||||
}
|
||||
|
||||
override fun onUnbindContext() {
|
||||
super.onUnbindContext()
|
||||
compositeDisposable?.dispose()
|
||||
compositeDisposable = 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.xchat_android_core.im.custom.bean.RoomPkBean
|
||||
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.subAndReplaceDot
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -30,7 +32,7 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
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 roomPkBean: RoomPkBean? = null
|
||||
|
||||
@@ -55,6 +57,20 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
||||
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() {
|
||||
@@ -118,7 +134,13 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
||||
binding.ivPkResult.isVisible = true
|
||||
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.toIntOrDef
|
||||
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
|
||||
|
||||
class SingleRoomPKCreateActivity : BaseViewBindingActivity<ActivitySingleRoomPkCreateBinding>() {
|
||||
@@ -94,7 +95,8 @@ class SingleRoomPKCreateActivity : BaseViewBindingActivity<ActivitySingleRoomPkC
|
||||
|
||||
binding.tvOk.setOnClickListener {
|
||||
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
|
||||
}
|
||||
currSimpleRoomInfo?.let {
|
||||
|
@@ -71,6 +71,4 @@ interface IBaseRoomView : IMvpBaseView {
|
||||
|
||||
fun updateMicView()
|
||||
|
||||
fun updateRoomRanks(data: List<RoomContributeUserInfo>)
|
||||
|
||||
}
|
@@ -1,8 +1,5 @@
|
||||
package com.yizhuan.erban.avroom.view;
|
||||
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 轰趴房View层 </p>
|
||||
@@ -12,6 +9,4 @@ import java.util.List;
|
||||
*/
|
||||
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.RoomOnlineUserBean;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,7 +15,8 @@ import java.util.List;
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public interface IHomePartyUserListView extends IMvpBaseView {
|
||||
void onRequestChatMemberByPageSuccess(List<OnlineChatMember> memberList, int page);
|
||||
|
||||
void onRequestRoomOnlineListSuccess(List<RoomOnlineUserBean> list);
|
||||
|
||||
void onRequestChatMemberByPageFail(String errorStr, int page);
|
||||
|
||||
|
@@ -1,9 +1,7 @@
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 轰趴房View层 </p>
|
||||
@@ -20,6 +18,4 @@ public interface IHomePartyView extends IBaseRoomView {
|
||||
* 礼物值模式下换麦
|
||||
*/
|
||||
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;
|
||||
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 轰趴房View层 </p>
|
||||
@@ -12,6 +9,4 @@ import java.util.List;
|
||||
*/
|
||||
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_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_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_CONVERT_L1;
|
||||
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.GiftCompoundAttachment;
|
||||
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.JoinMiniWorldNoticeAttachment;
|
||||
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.TarotAttachment;
|
||||
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.VipMessageAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
|
||||
@@ -253,6 +257,7 @@ public class MessageView extends FrameLayout {
|
||||
private OnClick onClick;
|
||||
|
||||
private OnMsgLongClickListener onLongClickListener;
|
||||
private TemplateMessageAdapter templateMessageAdapter;
|
||||
|
||||
public MessageView(Context context) {
|
||||
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) {
|
||||
@@ -617,6 +632,19 @@ public class MessageView extends FrameLayout {
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
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
|
||||
@@ -633,6 +661,16 @@ public class MessageView extends FrameLayout {
|
||||
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;
|
||||
}
|
||||
|
||||
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 width 寬
|
||||
@@ -1032,6 +1080,15 @@ public class MessageView extends FrameLayout {
|
||||
setFairyMsg(chatRoomMessage, tvContent);
|
||||
} else if (first == CUSTOM_MSG_ROOM_ALBUM) {
|
||||
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 {
|
||||
tvContent.setTextColor(Color.WHITE);
|
||||
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
||||
@@ -1948,6 +2005,37 @@ public class MessageView extends FrameLayout {
|
||||
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) {
|
||||
RoomLuckySeaAttachment attachment = (RoomLuckySeaAttachment) chatRoomMessage.getAttachment();
|
||||
RoomLuckySeaMsgBean bean = attachment.getRoomLuckySeaMsgInfo();
|
||||
@@ -2248,8 +2336,12 @@ public class MessageView extends FrameLayout {
|
||||
//等級
|
||||
builder.append(userLevel, expLevelHeight);
|
||||
//銘牌
|
||||
boolean isCustom = NobleUtil.getExtBoolean( chatRoomMessage,UserInfo.NAMEPLATE_IS_CUSTOM,false);
|
||||
String tvNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_WORD, chatRoomMessage).trim();
|
||||
String ivNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_PIC, chatRoomMessage);
|
||||
if (isCustom) {
|
||||
tvNamePlate = null;
|
||||
}
|
||||
if (!TextUtils.isEmpty(tvNamePlate) && !TextUtils.isEmpty(ivNamePlate)) { // extension != null 表示自己
|
||||
builder.appendBgAndContent(ivNamePlate, tvNamePlate);
|
||||
} else if (!TextUtils.isEmpty(ivNamePlate)) {
|
||||
|
@@ -151,8 +151,8 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
.subscribe { roomEvent: RoomEvent? ->
|
||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
// RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
// RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.RADISH_NOTIFY,
|
||||
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
||||
|
@@ -19,8 +19,12 @@ import android.view.animation.AnimationUtils
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.chuhai.utils.UiUtils
|
||||
import com.chuhai.utils.ktx.setPadding2
|
||||
import com.coorchice.library.SuperTextView
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
@@ -28,19 +32,23 @@ import com.netease.nimlib.sdk.chatroom.model.ChatRoomNotificationAttachment
|
||||
import com.opensource.svgaplayer.*
|
||||
import com.opensource.svgaplayer.SVGAParser.Companion.shareParser
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.XChatApplication
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.avroom.bean.RoomPlayBean
|
||||
import com.yizhuan.erban.avroom.helper.AnimHelper
|
||||
import com.yizhuan.erban.base.TitleBar
|
||||
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
|
||||
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.isDestroyed
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.erban.ui.utils.loadAnim
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
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.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.erban.utils.MsgBuilder
|
||||
import com.yizhuan.erban.utils.RegexUtil
|
||||
import com.yizhuan.erban.utils.SpannableBuilder
|
||||
@@ -134,14 +142,22 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
private val drawGiftPlayHelper: DrawGiftPlayHelper by lazy { DrawGiftPlayHelper(context as Activity) }
|
||||
|
||||
private var isPlayAnim = false
|
||||
private var playNotifyStateLiveData: MutableLiveData<Boolean>? = null
|
||||
|
||||
private var onPlayAnimCallback: (() -> Boolean)? = null
|
||||
fun setPlayNotifyStateListener(stateLiveData: MutableLiveData<Boolean>) {
|
||||
this.playNotifyStateLiveData = stateLiveData
|
||||
}
|
||||
|
||||
fun setOnPlayAnimCallback(onPlayAnimCallback: (() -> Boolean)) {
|
||||
this.onPlayAnimCallback = onPlayAnimCallback
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private fun isShowingGiftNotify(): Boolean {
|
||||
return onPlayAnimCallback?.invoke() ?: false
|
||||
}
|
||||
|
||||
private fun loopCarAnim() {
|
||||
if (context.isDestroyed()) return
|
||||
isSvgaPlaying = false
|
||||
@@ -230,7 +246,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(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_CAR_EFFECT_HIDE -> {
|
||||
isHideCarEffect = true
|
||||
@@ -265,6 +281,11 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
loopCarAnim()
|
||||
}
|
||||
})
|
||||
var statusBarHeight = TitleBar.getStatusBarHeight()
|
||||
if (statusBarHeight == 0) {
|
||||
statusBarHeight = UiUtils.dip2px(25f)
|
||||
}
|
||||
binding.clNotify.setPadding2(top = binding.clNotify.paddingTop + statusBarHeight)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,29 +306,15 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
if (binding.flPlayNotify.childCount != 0) {
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
if (binding.flLuckyBagNotify.childCount != 0) {
|
||||
return@subscribe
|
||||
}
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
when (messagesPlay[0].event) {
|
||||
RoomEvent.BOX_NOTIFY -> {//寻爱
|
||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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
|
||||
)
|
||||
}
|
||||
if ((mContext as AVRoomActivity).isTopActivity || XChatApplication.gStack.topActivity is TreasureBoxActivity) {
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showBoxNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -315,51 +322,17 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱
|
||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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
|
||||
)
|
||||
}
|
||||
if ((mContext as AVRoomActivity).isTopActivity || XChatApplication.gStack.topActivity is TreasureBoxActivity) {
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.TAROT_NOTIFY -> {
|
||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showTarotNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -368,25 +341,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
RoomEvent.TAROT_NOTIFY_SVGA -> {
|
||||
if ((mContext as AVRoomActivity).isTopActivity) {
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
}
|
||||
@@ -395,17 +351,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
if (!(mContext as AVRoomActivity).isTopActivity) {
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, if (isPlay) 180.0 else 60.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
val msg = messagesPlay.removeAt(0)
|
||||
val attachment = msg.chatRoomMessage.attachment as NotifyH5Attachment
|
||||
val bean = attachment.bean ?: return@subscribe
|
||||
@@ -418,39 +365,24 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> {//福袋
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckyBagNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckySeaNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckySeaNotifyBySVGA(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -461,13 +393,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
RoomEvent.FAIRY_CONVERT_L2,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {//夺宝
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showFairyNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -494,8 +421,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
@@ -521,8 +448,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,6 +568,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) {
|
||||
if (v.layoutParams is MarginLayoutParams) {
|
||||
val params = v.layoutParams as MarginLayoutParams
|
||||
@@ -653,89 +593,69 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
val message = roomPlayBean.chatRoomMessage
|
||||
val attachment = message.attachment as? RoomReceivedLuckyGiftAttachment ?: 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()
|
||||
.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)
|
||||
)
|
||||
.append(
|
||||
noticeInfo.nick.subAndReplaceDot(6) + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
noticeInfo.luckyBagName,
|
||||
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FFF45E))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_028),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
noticeInfo.luckyBagName + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
noticeInfo.goldPrice + ResUtil.getString(R.string.diamond_name),
|
||||
ForegroundColorSpan(ContextCompat.getColor(context, R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_06),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
noticeInfo.goldPrice + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_07),
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_029),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
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) {
|
||||
@@ -780,8 +700,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
@@ -828,8 +748,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -873,7 +793,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
private fun showNotifyH5(data: NotifyH5Info) {
|
||||
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
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flPlayNotify.addView(textView)
|
||||
@@ -886,8 +806,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -901,8 +821,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -962,8 +882,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -1005,8 +925,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -1028,8 +948,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1100,8 +1020,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
animationPlay!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
})
|
||||
binding.flPlayNotify.startAnimation(animationPlay)
|
||||
@@ -1907,6 +1827,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) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
@@ -1935,10 +1876,6 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}, SHOW_TIME.toLong())
|
||||
}
|
||||
|
||||
fun getIsPlayAnim(): Boolean {
|
||||
return isPlayAnim
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
playDisposable?.dispose()
|
||||
@@ -1952,7 +1889,20 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
disposableRoomPK?.dispose()
|
||||
disposableSingleRoomPK?.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,133 @@
|
||||
package com.yizhuan.erban.avroom.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
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.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) {
|
||||
|
||||
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)
|
||||
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)
|
||||
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
|
||||
): 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
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseColor(color: String?): Int? {
|
||||
try {
|
||||
return Color.parseColor(color)
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
fun onShowUserCard(uid: String)
|
||||
}
|
||||
}
|
@@ -992,17 +992,10 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
if (data == null || data.getGiftUrl() == null) return;
|
||||
giftList.add(data);
|
||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
giftDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showGiftDialog();
|
||||
if (isShowingPlayNotify()) {
|
||||
return;
|
||||
}
|
||||
showGiftDialog();
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
@@ -1187,8 +1180,11 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
|
||||
private void showPlayEffectDialog() {
|
||||
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 -> {
|
||||
tryShowGiftDialog();
|
||||
playEffectList.pollFirst();
|
||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
@@ -1206,12 +1202,20 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void tryShowGiftDialog() {
|
||||
showGiftDialog();
|
||||
}
|
||||
|
||||
private void showGiftDialog() {
|
||||
if (giftList == null) return;
|
||||
if (giftList.size() == 0) return;
|
||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
if (!data.isHomeShow()) {
|
||||
return;
|
||||
}
|
||||
@@ -1234,6 +1238,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) {
|
||||
return new AllServiceGiftLevelDialog(context, dataBean);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import java.lang.reflect.ParameterizedType
|
||||
abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
|
||||
|
||||
val isViewLoaded: Boolean get() = _binding != null
|
||||
private var _binding: T? = null
|
||||
protected var _binding: T? = null
|
||||
private var onDismissListener: (() -> Unit)? = null
|
||||
val binding get() = _binding!!
|
||||
open var width = ScreenUtil.getDialogWidth()
|
||||
|
@@ -2,33 +2,24 @@ package com.yizhuan.erban.common.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
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.graphics.Outline;
|
||||
import android.util.AttributeSet;
|
||||
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 java.io.InputStream;
|
||||
|
||||
|
||||
/**
|
||||
* 自定义View,实现圆角,圆形等效果
|
||||
*
|
||||
* @author zhy
|
||||
*/
|
||||
public class RectRoundImageView extends ImageView {
|
||||
public class RectRoundImageView extends ShapeableImageView {
|
||||
|
||||
/**
|
||||
* 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_ROUND = 1;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private Bitmap mSrc;
|
||||
|
||||
/**
|
||||
* 圆角的大小
|
||||
*/
|
||||
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) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@@ -98,17 +58,6 @@ public class RectRoundImageView extends ImageView {
|
||||
for (int i = 0; i < n; i++) {
|
||||
int attr = a.getIndex(i);
|
||||
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:
|
||||
type = a.getInt(attr, 0);// 默认为Circle
|
||||
break;
|
||||
@@ -121,197 +70,25 @@ public class RectRoundImageView extends ImageView {
|
||||
}
|
||||
setScaleType(ScaleType.CENTER_CROP);
|
||||
a.recycle();
|
||||
setup(type, mRadius);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算控件的高度和宽度
|
||||
*/
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
Drawable drawable = getDrawable();
|
||||
if (null != drawable) {
|
||||
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);
|
||||
private void setup(int type, int cornerSize) {
|
||||
if (type == TYPE_CIRCLE) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
int min = Math.min(view.getWidth(), view.getHeight());
|
||||
int left = (view.getWidth() - min) / 2;
|
||||
int top = (view.getHeight() - min) / 2;
|
||||
outline.setOval(left, top, min, min);
|
||||
}
|
||||
break;
|
||||
case TYPE_ROUND:
|
||||
canvas.drawBitmap(createFramedPhoto(mWidth, mHeight, mSrc, mRadius), 0, 0, null);
|
||||
break;
|
||||
});
|
||||
setClipToOutline(true);
|
||||
} else if (type == TYPE_ROUND) {
|
||||
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 ->
|
||||
binding.ivJoinLogo.load(privilegeConfig.icon)
|
||||
binding.tvJoin.text = privilegeConfig.name
|
||||
binding.tvJoin.setOnClickListener {
|
||||
binding.bgJoin.setOnClickListener {
|
||||
privilegeConfig.giftVo?.let { giftInfo ->
|
||||
GiftModel.get().sendFansTeamGift(
|
||||
giftInfo.giftId,
|
||||
|
@@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.fansteam.*
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
|
||||
class FansTeamViewModel : BaseViewModel() {
|
||||
@@ -37,6 +38,9 @@ class FansTeamViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
fun loadFansTeamInitInfo() {
|
||||
if (AvRoomDataManager.get().roomUid == 0L) {
|
||||
return
|
||||
}
|
||||
safeLaunch {
|
||||
_fansTeamInitInfoLiveData.value = FansTeamModel.getFansTeamInitInfo()
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ import kotlinx.coroutines.async
|
||||
|
||||
class HomeViewModel : BaseViewModel() {
|
||||
|
||||
private val _tabHomeLiveData = MutableLiveData<List<HomeTabMapInfo>?>()
|
||||
val tabHomeLiveData: MutableLiveData<List<HomeTabMapInfo>?> = _tabHomeLiveData
|
||||
private val _tabHomeLiveData = MutableLiveData<ListResult<HomeRoomInfo>?>()
|
||||
val tabHomeLiveData: MutableLiveData<ListResult<HomeRoomInfo>?> = _tabHomeLiveData
|
||||
|
||||
private val _bannerLiveData = MutableLiveData<List<BannerInfo>?>()
|
||||
val bannerLiveData: MutableLiveData<List<BannerInfo>?> = _bannerLiveData
|
||||
@@ -47,6 +47,8 @@ class HomeViewModel : BaseViewModel() {
|
||||
private val _tagLiveData = MutableLiveData<List<HomeTagInfo>>()
|
||||
val tagLiveData: LiveData<List<HomeTagInfo>> = _tagLiveData
|
||||
|
||||
val homeTagLiveData: MutableLiveData<List<HomeTagInfo>> = MutableLiveData<List<HomeTagInfo>>()
|
||||
|
||||
private val _emptyLiveData = MutableLiveData<Boolean>()
|
||||
val emptyLiveData: LiveData<Boolean> = _emptyLiveData
|
||||
|
||||
@@ -62,13 +64,14 @@ class HomeViewModel : BaseViewModel() {
|
||||
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
|
||||
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
|
||||
|
||||
fun getHomeTabName() {
|
||||
fun getHomeTabName(tabId: Int, pageNum: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_tabHomeLiveData.value = null
|
||||
_tabHomeLiveData.value = ListResult.failed(pageNum)
|
||||
},
|
||||
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() {
|
||||
safeLaunch {
|
||||
_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)
|
||||
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.RoomNewFriendsAdapter
|
||||
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.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
||||
@@ -116,6 +117,11 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
|
||||
private fun initHotRoomTab() {
|
||||
roomNewFriendsAdapter = RoomNewFriendsAdapter()
|
||||
roomNewFriendsAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
(adapter.getItem(position) as? UserInfo)?.let {
|
||||
UserInfoActivity.Companion.start(context, it.uid)
|
||||
}
|
||||
}
|
||||
rvDelegate = RVDelegate.Builder<UserInfo>()
|
||||
.setAdapter(roomNewFriendsAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
|
@@ -40,20 +40,22 @@ import com.zhpan.bannerview.BannerViewPager
|
||||
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener,
|
||||
MainIndicatorAdapter.OnItemSelectListener {
|
||||
|
||||
private val mFragments = mutableListOf<Class<out Fragment>>()
|
||||
private val mTabInfoList = mutableListOf<HomeTagInfo>()
|
||||
private val TAB_ID_RECOMMEND = Int.MAX_VALUE - 1
|
||||
|
||||
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 var mBanner: BannerViewPager<BannerInfo>? = null
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HomeFragment"
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
mBanner = view?.findViewById(R.id.banner)
|
||||
initTitleTab()
|
||||
initTab()
|
||||
initListener()
|
||||
homeViewModel.homeTagLiveData.observe(this) {
|
||||
loadTabList(transformTabList(it))
|
||||
}
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
if (ListUtils.isListEmpty(it)) {
|
||||
@@ -71,7 +73,10 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
Pair(
|
||||
IReportConstants.MODULE,
|
||||
IReportConstants.PEKO_HOMEPAGE
|
||||
)
|
||||
)
|
||||
)
|
||||
CommonJumpHelper.bannerJump(context, it[position])
|
||||
@@ -83,7 +88,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
}
|
||||
homeViewModel.currentResourceLiveData.observe(this) {
|
||||
it?.let {
|
||||
if(it.size != 2){
|
||||
if (it.size != 2) {
|
||||
binding.csResource.visibility = View.GONE
|
||||
return@observe
|
||||
}
|
||||
@@ -99,10 +104,12 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
it[i].resourceType == 5 -> {
|
||||
CommonWebViewActivity.start(context, it[i].resourceContent)
|
||||
}
|
||||
|
||||
i == 3 -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getHomeChatPick()
|
||||
}
|
||||
|
||||
else -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getResourceJumpInfo(it[i].id)
|
||||
@@ -131,6 +138,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.getHomeTagInfo()
|
||||
homeViewModel.getBannerInfo()
|
||||
homeViewModel.getCurrentResourceInfo()
|
||||
}
|
||||
@@ -157,6 +165,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
DemoCache.saveAnchorCardView(1)
|
||||
}
|
||||
}
|
||||
|
||||
R.id.iv_ranking -> {
|
||||
//首页_排行榜
|
||||
ReportManager.get().reportEvent(
|
||||
@@ -167,6 +176,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
)
|
||||
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
|
||||
}
|
||||
|
||||
R.id.iv_my_room -> {
|
||||
//首页_创建房间
|
||||
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?) {
|
||||
binding.viewPager.currentItem = position
|
||||
//点击顶部tab上报
|
||||
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
|
||||
ReportManager.get().reportEvent(IReportConstants.TAB_HOMEPAGE_CLICK, map)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mTabInfoList.clear()
|
||||
mFragments.clear()
|
||||
tabList.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
|
||||
}
|
||||
|
||||
}
|
@@ -53,6 +53,7 @@ import com.netease.nimlib.sdk.robot.model.RobotMsgType;
|
||||
import com.tbruyelle.rxpermissions2.RxPermissions;
|
||||
import com.yizhuan.erban.R;
|
||||
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.MessageListPanelEx;
|
||||
import com.yizhuan.erban.ui.im.chat.MVHChatterBoxStart;
|
||||
@@ -104,6 +105,8 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
protected AitManager aitManager;
|
||||
protected String recordId = "";
|
||||
|
||||
private DialogManager dialogManager;
|
||||
|
||||
/**
|
||||
* 消息接收观察者
|
||||
*/
|
||||
@@ -189,6 +192,10 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (aitManager != null) {
|
||||
aitManager.reset();
|
||||
}
|
||||
if (dialogManager != null) {
|
||||
dialogManager.dismissDialog();
|
||||
}
|
||||
dialogManager = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,7 +340,37 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (!isAllowSendMessage(message)) {
|
||||
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);
|
||||
message = changeToRobotMsg(message);
|
||||
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>() {
|
||||
@Override
|
||||
public void onSuccess(Void param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -376,7 +412,6 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (aitManager != null) {
|
||||
aitManager.reset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -599,7 +634,10 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
tvChatLimit.setVisibility(View.GONE);
|
||||
inputPanel.setLimitLevel(true, "");
|
||||
} else {
|
||||
IMCustomModel.get().getPrivateChatLimit(sessionId).subscribe(((privateChatLimitInfo, throwable) -> {
|
||||
Disposable disposable = IMCustomModel.get().getPrivateChatLimit(sessionId).subscribe(((privateChatLimitInfo, throwable) -> {
|
||||
if (isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
@@ -642,6 +680,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
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) {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.yizhuan.xchat_android_core.bean.PrivateChatLimitInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.manager.BaseMvpModel;
|
||||
@@ -31,6 +32,12 @@ public class IMCustomModel extends BaseMvpModel {
|
||||
.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 {
|
||||
/**
|
||||
* 获取是否可以发送私聊
|
||||
@@ -38,5 +45,11 @@ public class IMCustomModel extends BaseMvpModel {
|
||||
*/
|
||||
@GET("/privateChat/limit")
|
||||
Single<ServiceResult<PrivateChatLimitInfo>> getPrivateChatLimit(@Query("receiverUid") String receiverUid);
|
||||
|
||||
/**
|
||||
* 私聊发送消息时检测
|
||||
*/
|
||||
@GET("/privateChat/check")
|
||||
Single<ServiceResult<JsonElement>> privateChatCheck(@Query("content") String content, @Query("toUid") String toUid);
|
||||
}
|
||||
}
|
||||
|
@@ -3,17 +3,19 @@ package com.yizhuan.erban.ui.login
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
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.trello.rxlifecycle3.android.ActivityEvent
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityAreaCodeBinding
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.auth.bean.AreaInfoBean
|
||||
import com.yizhuan.xchat_android_core.utils.Logger
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||
import com.yizhuan.erban.ui.widget.SideBarView
|
||||
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
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>() {
|
||||
|
||||
private val mCountries = ArrayList<AreaInfoBean>()
|
||||
private val regionRepository = RegionHelper()
|
||||
|
||||
private val adapter = RegionListAdapter()
|
||||
|
||||
companion object {
|
||||
const val COUNTRY_NUMBER = "country_number"
|
||||
@@ -39,55 +43,51 @@ class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
||||
|
||||
override fun init() {
|
||||
initTitleBar(getString(R.string.select_area_code))
|
||||
initCountryData()
|
||||
initListView()
|
||||
initSideBar()
|
||||
loadData()
|
||||
}
|
||||
|
||||
private fun initCountryData() {
|
||||
val countryList = resources.getStringArray(R.array.country_code_list_ch)
|
||||
for (s in countryList) {
|
||||
val country = s.split("*").toTypedArray()
|
||||
val countryName = country[0]
|
||||
val countryNumber = country[1]
|
||||
val c = AreaInfoBean(
|
||||
name = countryName,
|
||||
phoneAreaCode = countryNumber
|
||||
)
|
||||
mCountries.add(c)
|
||||
private fun initSideBar() {
|
||||
binding.sideBarView.setTextColor(context.getColorById(R.color.color_5caaff))
|
||||
binding.sideBarView.setTextSize(UiUtils.dip2px(12f).toFloat())
|
||||
binding.sideBarView.setListener(object : SideBarView.Listener {
|
||||
override fun onSideBarScroll(word: String) {
|
||||
val index = adapter.data.indexOfFirst {
|
||||
it.itemType == RegionListAdapter.ITEM_TYPE_GROUP && it.groupName?.toString() == word
|
||||
}
|
||||
if (index >= 0) {
|
||||
binding.mRecyclerView.scrollToPosition(index)
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
val mAdapter = object :
|
||||
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)
|
||||
binding.mRecyclerView.adapter = adapter
|
||||
//返回国家
|
||||
mAdapter.setOnItemClickListener { adapter: BaseQuickAdapter<*, *>?, view: View?, position: Int ->
|
||||
val country = mAdapter.data[position]
|
||||
adapter.setOnItemClickListener { adapter: BaseQuickAdapter<*, *>?, view: View?, position: Int ->
|
||||
val region = this.adapter.getItem(position)
|
||||
if (region?.code.isNullOrEmpty()) {
|
||||
return@setOnItemClickListener
|
||||
}
|
||||
val intent = Intent()
|
||||
intent.putExtra(COUNTRY_NUMBER, "+${country.phoneAreaCode}")
|
||||
intent.putExtra(COUNTRY_NUMBER, region?.fullCode)
|
||||
setResult(RESULT_OK, intent)
|
||||
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
|
||||
@@ -97,5 +97,4 @@ class AreaCodeActivity : BaseViewBindingActivity<ActivityAreaCodeBinding>() {
|
||||
StatusBarUtil.transparencyBar(this)
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
}
|
@@ -16,9 +16,9 @@ import com.trello.rxlifecycle3.android.ActivityEvent
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
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.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.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_library.utils.NetworkUtils
|
||||
@@ -50,6 +50,7 @@ class BindPhoneActivity : BaseViewBindingActivity<ActivityBindPhoneBinding>(),
|
||||
override fun init() {
|
||||
initTitleBar(getString(R.string.text_bind_phone))
|
||||
initListener()
|
||||
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||
}
|
||||
|
||||
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.util.SPUtils;
|
||||
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.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
@@ -90,6 +90,7 @@ public class LoginPasswordActivity extends BaseActivity {
|
||||
setContentView(R.layout.activity_login_password);
|
||||
EventBus.getDefault().register(this);
|
||||
initView();
|
||||
new RegionHelper().loadRecommendRegion(getLifecycle(), tvAreaCode);
|
||||
}
|
||||
|
||||
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.event.LoginEvent
|
||||
import com.yizhuan.xchat_android_core.code.CodeType
|
||||
import com.yizhuan.xchat_android_core.region.RegionHelper
|
||||
import io.reactivex.SingleObserver
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
@@ -43,6 +44,7 @@ class LoginPhoneActivity : BaseViewBindingActivity<ActivityLoginPhoneBinding>(),
|
||||
override fun init() {
|
||||
EventBus.getDefault().register(this)
|
||||
initListener()
|
||||
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -15,6 +16,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
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.utils.RegexUtil;
|
||||
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.erbanNo.setText(context.getString(R.string.me_user_id, item.getErbanNo()));
|
||||
|
||||
if (item.getGender() == 1) {
|
||||
holder.mIvSex.setVisibility(View.VISIBLE);
|
||||
holder.mIvSex.setImageResource(R.drawable.ic_gender_male);
|
||||
} else if (item.getGender() == 2) {
|
||||
holder.mIvSex.setVisibility(View.VISIBLE);
|
||||
holder.mIvSex.setImageResource(R.drawable.ic_gender_female);
|
||||
} else {
|
||||
holder.mIvSex.setVisibility(View.GONE);
|
||||
holder.wealthLevelView.setVisibility(View.GONE);
|
||||
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getExperUrl())) {
|
||||
holder.wealthLevelView.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getExperUrl(), holder.wealthLevelView);
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -132,7 +135,8 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
||||
private ImageView ivLive;
|
||||
RelativeLayout container;
|
||||
private NobleAvatarView mNobleAvatarView;
|
||||
private ImageView mIvSex;
|
||||
private ImageView wealthLevelView;
|
||||
private ImageView charmLevelView;
|
||||
private SuperTextView stvOp;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
@@ -142,7 +146,8 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
||||
erbanNo = itemView.findViewById(R.id.erban_no);
|
||||
container = itemView.findViewById(R.id.container);
|
||||
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);
|
||||
tvOnlineNum = itemView.findViewById(R.id.tv_online_num);
|
||||
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.xchat_android_core.auth.AuthModel
|
||||
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_library.utils.ResUtil
|
||||
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper
|
||||
@@ -59,6 +60,7 @@ class ResetPasswordActivity : BaseViewBindingActivity<ActivityResetLoginPwdBindi
|
||||
// binding.etAccount.isEnabled = false
|
||||
// }
|
||||
initListener()
|
||||
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
|
@@ -218,7 +218,11 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
|
||||
|
||||
private fun debug() {
|
||||
// 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)}}}"
|
||||
onReceivedNimBroadcastMessage(json)
|
||||
// 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)}}}"
|
||||
// onReceivedNimBroadcastMessage(json)
|
||||
// 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)
|
||||
// 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.code.CodeType
|
||||
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_library.utils.ResUtil
|
||||
|
||||
@@ -53,6 +54,7 @@ class VerifyPhoneActivity : BaseViewBindingActivity<ActivityVerifyPhoneBinding>(
|
||||
resetPwd = intent.getBooleanExtra("resetPwd", false)
|
||||
|
||||
initListener()
|
||||
RegionHelper().loadRecommendRegion(lifecycle, binding.tvAreaCode)
|
||||
}
|
||||
|
||||
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.RollPagerView;
|
||||
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.vip.util.VipHelper;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
@@ -317,7 +318,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
//等级魅力值
|
||||
setUserLevel(userInfo.getUserLevelVo());
|
||||
//铭牌
|
||||
setOfficialMask(userInfo.getNameplateWord(), userInfo.getNameplatePic());
|
||||
NamePlateHelper.INSTANCE.load(mBinding.inOfficialMask, tvOfficialMask, ivOfficialMask, userInfo);
|
||||
if (AuthModel.get().getCurrentUid() != userInfo.getUid()) {
|
||||
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), userInfo.getUid()).subscribe();
|
||||
}
|
||||
@@ -626,19 +627,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
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) {
|
||||
if (audioCard != null && !TextUtils.isEmpty(audioCard.getAudioUrl())) {
|
||||
if (AuthModel.get().getCurrentUid() == userId) {//主态
|
||||
|
@@ -427,6 +427,11 @@ public class ImageLoadUtils {
|
||||
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) {
|
||||
GlideApp.with(context).load(url).optionalFitCenter().into(new SimpleTarget<Drawable>() {
|
||||
@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.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
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_library.rxbus.RxBus;
|
||||
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.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -99,32 +99,6 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
private static final String POSITION = "position";
|
||||
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) {
|
||||
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
@@ -222,7 +196,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private void initData() {
|
||||
mHandler.post(mProgressRunnable);
|
||||
webView.getSettings().setAllowFileAccess(true);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.getSettings().setUseWideViewPort(true);
|
||||
webView.getSettings().setLoadWithOverviewMode(true);
|
||||
@@ -238,14 +212,13 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
webView.addJavascriptInterface(jsInterface, "androidJsObj");
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
String packageName;
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Logger.e("shouldOverrideUrlLoading--------" + url);
|
||||
LogUtil.e("shouldOverrideUrlLoading" + url);
|
||||
targetUrl = url;
|
||||
|
||||
if (url.contains("tel:")) {
|
||||
//删除直接拨打电话的功能
|
||||
return true;
|
||||
@@ -253,6 +226,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
// ------- 处理结束 -------
|
||||
|
||||
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
||||
handleIntent(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -290,9 +264,56 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
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
|
||||
wvcc = new WebChromeClient() {
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
super.onProgressChanged(view, newProgress);
|
||||
mProgressBar.setProgress(newProgress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
@@ -520,11 +541,6 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacks(mProgressRunnable);
|
||||
mProgressRunnable = null;
|
||||
mHandler = null;
|
||||
}
|
||||
EventBus.getDefault().unregister(this);
|
||||
|
||||
if (webViewCallBack != null) {
|
||||
|
@@ -3,8 +3,8 @@ package com.yizhuan.erban.ui.webview;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
@@ -28,8 +28,17 @@ public class DialogWebViewActivity extends CommonWebViewActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight / 3 * 2);
|
||||
getWindow().setGravity(Gravity.BOTTOM);
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
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);
|
||||
if (!showTitleBar) {
|
||||
layoutTitleBar.setVisibility(View.GONE);
|
||||
@@ -40,4 +49,8 @@ public class DialogWebViewActivity extends CommonWebViewActivity {
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_dialog_web_view;
|
||||
}
|
||||
|
||||
protected int getTopMargin() {
|
||||
return ScreenUtil.screenHeight / 3;
|
||||
}
|
||||
}
|
||||
|
@@ -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?.icon)
|
||||
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_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_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)));
|
||||
giftIndicator = root.findViewById(R.id.gift_indicator);
|
||||
giftIndicator.initTab(
|
||||
@@ -492,6 +493,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
giftIndicator.setPosition(indicatorType);
|
||||
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);
|
||||
|
||||
@@ -620,6 +626,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
currentGiftInfoList = getWeekStarGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||
currentGiftInfoList = getDrawGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_SING_ROOM) {
|
||||
currentGiftInfoList = getSingleRoomGiftInfos();
|
||||
}
|
||||
// 有贵族礼物才显示贵族礼物的tab
|
||||
if (ListUtils.isListEmpty(nobleGiftInfos)) {
|
||||
@@ -643,6 +651,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
showEmptyView();
|
||||
} else if (position == GiftIndicator.TYPE_LUCKY ||
|
||||
position == GiftIndicator.TYPE_WEEK ||
|
||||
position == GiftIndicator.TYPE_SING_ROOM ||
|
||||
position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||
showEmptyView();
|
||||
updateWeekStarDesc();
|
||||
@@ -657,7 +666,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (currentGiftInfo.isSendMsg()) {
|
||||
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);
|
||||
if (isKnap) {
|
||||
tvGiftValue.setVisibility(View.VISIBLE);
|
||||
@@ -1093,6 +1102,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
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() {
|
||||
return GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_VIP);
|
||||
}
|
||||
@@ -1409,7 +1424,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (throwable == null) {
|
||||
// 返回结果时,当前选中选项与请求时的选项一样时才显示
|
||||
if (currentType == giftIndicator.getCurrrentType()) {
|
||||
updateGiftView(giftIndicator.getCurrrentType());
|
||||
updateGiftView(giftIndicator.getCurrrentType(), currentGiftInfo);
|
||||
}
|
||||
} else {
|
||||
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.decorationsend.UserInfoSkillDecoration;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.utils.NamePlateHelper;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
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())) {
|
||||
setNamePlate(userInfo.getNameplatePic(), userInfo.getNameplateWord());
|
||||
} else {
|
||||
setNamePlate(null, null);
|
||||
}
|
||||
NamePlateHelper.INSTANCE.load(inNamePlate, inNamePlate.findViewById(R.id.tv_official_mask), inNamePlate.findViewById(R.id.iv_official_mask), userInfo);
|
||||
// 改变贵族
|
||||
updateNobleView();
|
||||
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) {
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
|
@@ -20,9 +20,14 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
@@ -35,6 +40,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.common.svga.SimpleSvgaCallback;
|
||||
import com.yizhuan.erban.databinding.DialogAllPlayEffectBinding;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.erban.utils.SpannableBuilder;
|
||||
@@ -49,18 +55,28 @@ import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
|
||||
public class AllPlayEffectDialog extends BaseDialog {
|
||||
|
||||
private final PlayEffectInfo playEffectInfo;
|
||||
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);
|
||||
this.playEffectInfo = playEffectInfo;
|
||||
this.belowGiftNotify = belowGiftNotify;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
disposable = new CompositeDisposable();
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
binding = DialogAllPlayEffectBinding.inflate(LayoutInflater.from(getContext()));
|
||||
setContentView(binding.getRoot());
|
||||
@@ -80,6 +96,9 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
window.setAttributes(windowParams);
|
||||
window.setWindowAnimations(R.style.anim_left);
|
||||
}
|
||||
if (belowGiftNotify) {
|
||||
binding.vGiftNotifyPlaceholder.setVisibility(View.VISIBLE);
|
||||
}
|
||||
switch (playEffectInfo.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
|
||||
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
||||
@@ -260,93 +279,64 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private void showLuckyBagNotify(LuckyBagNoticeInfo luckyBagNoticeInfo) {
|
||||
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(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_04),
|
||||
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(
|
||||
subAndReplaceDot(luckyBagNoticeInfo.getNick(), 6) + " ",
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(),R.color.notice_nick))
|
||||
noticeInfo.getLuckyBagName(),
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_FFF45E))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_028),
|
||||
new ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
luckyBagNoticeInfo.getLuckyBagName() + " ",
|
||||
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_06),
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_029),
|
||||
new ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
luckyBagNoticeInfo.getGoldPrice() + " ",
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_07),
|
||||
new ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
luckyBagNoticeInfo.getGiftName(),
|
||||
noticeInfo.getGiftName(),
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||
);
|
||||
SVGAImageView svgaImageView = new SVGAImageView(getContext());
|
||||
svgaImageView.setLoops(1);
|
||||
svgaImageView.setClearsAfterDetached(true);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
svgaImageView.setLayoutParams(params);
|
||||
svgaImageView.setCallback(new SimpleSvgaCallback() {
|
||||
@Override
|
||||
public void onFinished() {
|
||||
closeSelf();
|
||||
}
|
||||
});
|
||||
binding.flSvgaNotify.addView(svgaImageView);
|
||||
try {
|
||||
SVGAParser.Companion.shareParser().decodeFromAssets("svga/lucky_gift_notify.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||
TextPaint textPaint = new TextPaint();
|
||||
textPaint.setColor(Color.WHITE);//字体颜色
|
||||
textPaint.setTextSize(24);//字体大小
|
||||
dynamicEntity.setDynamicText(new StaticLayout(
|
||||
text.build(),
|
||||
0,
|
||||
text.build().length(),
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "fdpp_copywriting");
|
||||
svgaImageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//跳轉房間要移除監聽,不然可能NPE
|
||||
svgaImageView.setCallback(null);
|
||||
AVRoomActivity.start(getContext(), luckyBagNoticeInfo.getRoomUid());
|
||||
}
|
||||
});
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||
svgaImageView.setImageDrawable(drawable);
|
||||
svgaImageView.stepToFrame(0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
closeSelf();
|
||||
}
|
||||
}, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
closeSelf();
|
||||
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).subscribe(aLong -> {
|
||||
Animation animation1 = AnimationUtils.loadAnimation(getContext(), R.anim.anim_box_notify_close);
|
||||
roomView.startAnimation(animation1);
|
||||
}));
|
||||
disposable.add(Observable.timer(7000, TimeUnit.MILLISECONDS).subscribe(aLong -> closeSelf()));
|
||||
}
|
||||
|
||||
private void showNotifyH5BySvga(NotifyH5Info info) {
|
||||
@@ -510,18 +500,32 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
}
|
||||
|
||||
private String subAndReplaceDot(String nick, int maxLength) {
|
||||
if(nick.length() > maxLength){
|
||||
return nick.substring(0,maxLength)+"...";
|
||||
}else {
|
||||
if (nick.length() > maxLength) {
|
||||
return nick.substring(0, maxLength) + "...";
|
||||
} else {
|
||||
return nick;
|
||||
}
|
||||
}
|
||||
|
||||
private void closeSelf() {
|
||||
try {
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
dismiss();
|
||||
} catch (Exception e) {
|
||||
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 com.chuhai.utils.ServiceTime;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGADynamicEntity;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
@@ -41,6 +42,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
||||
|
||||
private final VipMessageInfo vipMessageInfo;
|
||||
private DialogVipAllServiceLevelUpBinding binding;
|
||||
private long startTime = 0;
|
||||
private int frameCount = 0;
|
||||
|
||||
public AllServiceVipLevelUPDialog(Context context, @NonNull VipMessageInfo vipMessageInfo) {
|
||||
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("-", 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(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.setLoops(1);
|
||||
@@ -87,7 +90,19 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
||||
svgaImageView.setCallback(new SimpleSvgaCallback() {
|
||||
@Override
|
||||
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);
|
||||
@@ -95,6 +110,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog {
|
||||
SVGAParser.Companion.shareParser().decodeFromURL(new URL(vipMessageInfo.getFloatPic()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
|
||||
frameCount = svgaVideoEntity.getFrames();
|
||||
startTime = ServiceTime.INSTANCE.getTime();
|
||||
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||
TextPaint textPaint = new TextPaint();
|
||||
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_SING_ROOM = 6;
|
||||
|
||||
|
||||
private Map<String, String> map = new HashMap<>();
|
||||
|
||||
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.webview.CommonWebViewActivity;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ public class CommonJumpHelper {
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void bannerJump(Context context, BannerInfo bannerInfo) {
|
||||
public static void bannerJump(Context context, IRouterData bannerInfo) {
|
||||
|
||||
|
||||
if (null == context || null == bannerInfo) {
|
||||
|
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
|
||||
}
|
||||
}
|
||||
}
|
@@ -57,8 +57,10 @@ class VipUpgradeDialog : BaseDialog<DialogVipUpgradeBinding>() {
|
||||
.decodeFromURL(URL(vipInfo.vipLogo), object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val drawable = SVGADrawable(videoItem)
|
||||
binding?.ivVipIcon?.setImageDrawable(drawable)
|
||||
binding?.ivVipIcon?.startAnimation()
|
||||
if (isViewLoaded) {
|
||||
_binding?.ivVipIcon?.setImageDrawable(drawable)
|
||||
_binding?.ivVipIcon?.startAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
|
Before Width: | Height: | Size: 7.6 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 |
BIN
app/src/main/res/drawable-xxhdpi/room_ic_hour_rank.webp
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/room_ic_music.webp
Normal file
After Width: | Height: | Size: 2.0 KiB |
@@ -2,9 +2,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FF87152D" />
|
||||
<solid android:color="#FF49157D" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#FFFFED77" />
|
||||
android:color="#FFFE9FFF" />
|
||||
<corners android:radius="8.5dp" />
|
||||
</shape>
|
@@ -2,9 +2,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FF49157D" />
|
||||
<solid android:color="#87152D" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#FFFE9FFF" />
|
||||
android:color="#FFED77" />
|
||||
<corners android:radius="8.5dp" />
|
||||
</shape>
|
9
app/src/main/res/drawable/base_arrow_right_f1f1fa.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="9dp"
|
||||
android:height="9dp"
|
||||
android:viewportWidth="9"
|
||||
android:viewportHeight="9">
|
||||
<path
|
||||
android:pathData="M2.5158,7.0939L6.5158,3.7124L7,4.2851L6.524,4.8647L2.524,1.5796L3.476,0.4204L7.476,3.7055Q7.5287,3.7488 7.5728,3.8009Q7.6205,3.8573 7.6562,3.922Q7.692,3.9866 7.7144,4.057Q7.7369,4.1273 7.7452,4.2007Q7.7536,4.2741 7.7474,4.3477Q7.7412,4.4213 7.7208,4.4923Q7.7004,4.5633 7.6665,4.629Q7.6327,4.6946 7.5866,4.7524Q7.5406,4.8102 7.4842,4.8579L3.4842,8.2394L2.5158,7.0939ZM3.75,7.6667Q3.75,7.7405 3.7356,7.813Q3.7212,7.8854 3.6929,7.9537Q3.6646,8.0219 3.6236,8.0833Q3.5826,8.1448 3.5303,8.197Q3.4781,8.2492 3.4167,8.2903Q3.3553,8.3313 3.287,8.3596Q3.2188,8.3878 3.1463,8.4023Q3.0739,8.4167 3,8.4167Q2.9261,8.4167 2.8537,8.4023Q2.7812,8.3878 2.713,8.3596Q2.6447,8.3313 2.5833,8.2903Q2.5219,8.2492 2.4697,8.197Q2.4174,8.1448 2.3764,8.0833Q2.3354,8.0219 2.3071,7.9537Q2.2788,7.8854 2.2644,7.813Q2.25,7.7405 2.25,7.6667Q2.25,7.5928 2.2644,7.5203Q2.2788,7.4479 2.3071,7.3797Q2.3354,7.3114 2.3764,7.25Q2.4174,7.1886 2.4697,7.1363Q2.5219,7.0841 2.5833,7.0431Q2.6447,7.002 2.713,6.9738Q2.7812,6.9455 2.8537,6.9311Q2.9261,6.9167 3,6.9167Q3.0739,6.9167 3.1463,6.9311Q3.2188,6.9455 3.287,6.9738Q3.3553,7.002 3.4167,7.0431Q3.4781,7.0841 3.5303,7.1363Q3.5826,7.1886 3.6236,7.25Q3.6646,7.3114 3.6929,7.3797Q3.7212,7.4479 3.7356,7.5203Q3.75,7.5928 3.75,7.6667ZM3.75,1Q3.75,1.0739 3.7356,1.1463Q3.7212,1.2188 3.6929,1.287Q3.6646,1.3553 3.6236,1.4167Q3.5826,1.4781 3.5303,1.5303Q3.4781,1.5826 3.4167,1.6236Q3.3553,1.6646 3.287,1.6929Q3.2188,1.7212 3.1463,1.7356Q3.0739,1.75 3,1.75Q2.9261,1.75 2.8537,1.7356Q2.7812,1.7212 2.713,1.6929Q2.6447,1.6646 2.5833,1.6236Q2.5219,1.5826 2.4697,1.5303Q2.4174,1.4781 2.3764,1.4167Q2.3354,1.3553 2.3071,1.287Q2.2788,1.2188 2.2644,1.1463Q2.25,1.0739 2.25,1Q2.25,0.9261 2.2644,0.8537Q2.2788,0.7812 2.3071,0.713Q2.3354,0.6447 2.3764,0.5833Q2.4174,0.5219 2.4697,0.4697Q2.5219,0.4174 2.5833,0.3764Q2.6447,0.3354 2.713,0.3071Q2.7812,0.2788 2.8537,0.2644Q2.9261,0.25 3,0.25Q3.0739,0.25 3.1463,0.2644Q3.2188,0.2788 3.287,0.3071Q3.3553,0.3354 3.4167,0.3764Q3.4781,0.4174 3.5303,0.4697Q3.5826,0.5219 3.6236,0.5833Q3.6646,0.6447 3.6929,0.713Q3.7212,0.7812 3.7356,0.8537Q3.75,0.9261 3.75,1Z"
|
||||
android:fillColor="#F1F1FA"/>
|
||||
</vector>
|
17
app/src/main/res/drawable/progress_drawable_room_banner.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@android:id/background"
|
||||
android:drawable="@color/transparent" />
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="2dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
10
app/src/main/res/drawable/room_bg_hour_rank.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#33170ACD"
|
||||
android:startColor="#8C2B00CA" />
|
||||
<corners android:radius="11dp" />
|
||||
</shape>
|
9
app/src/main/res/drawable/room_gameplay_bg.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:width="2px"
|
||||
android:color="#CCFFFFFF" />
|
||||
<corners android:radius="@dimen/dp_12" />
|
||||
</shape>
|
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#4D4D4D" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|