Compare commits
85 Commits
molistar_r
...
v2.0.4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f4fb164999 | ||
![]() |
6134bd508b | ||
![]() |
59adea0674 | ||
![]() |
6e9032bcb4 | ||
![]() |
9ce499c027 | ||
![]() |
dca7f68130 | ||
![]() |
3c21fe8cb6 | ||
![]() |
c0ea66522a | ||
![]() |
d4e4759994 | ||
![]() |
077cef5c26 | ||
![]() |
aebb11557a | ||
![]() |
52a73e3d08 | ||
![]() |
ac7089dc0b | ||
![]() |
2e167f2e21 | ||
![]() |
9aaa2043a4 | ||
![]() |
465f1de55c | ||
![]() |
a71b265687 | ||
![]() |
90e92e6f98 | ||
![]() |
eb4d32e6cc | ||
![]() |
92edbf42b4 | ||
![]() |
4194c492ab | ||
![]() |
d7ce32b101 | ||
![]() |
3237a772d7 | ||
![]() |
ddc65609d4 | ||
![]() |
888ee9dc4b | ||
![]() |
27f5931d30 | ||
![]() |
b4b1add221 | ||
![]() |
83f2a8f5a8 | ||
![]() |
746c0ccac4 | ||
![]() |
115d47db63 | ||
![]() |
517ad7bb38 | ||
![]() |
f87c54f0e1 | ||
![]() |
653116d3df | ||
![]() |
0ec9324f38 | ||
![]() |
475ec454ab | ||
![]() |
c3e001e70b | ||
![]() |
6965343562 | ||
![]() |
9b0b878593 | ||
![]() |
227f41e1bb | ||
![]() |
aaa5529e3c | ||
![]() |
33acf7fab5 | ||
![]() |
558328f639 | ||
![]() |
3d2d614bba | ||
![]() |
06c83e3305 | ||
![]() |
2934ad0e49 | ||
![]() |
10c7e3409e | ||
![]() |
ebf1b891db | ||
![]() |
f43afae374 | ||
![]() |
05d391bd1b | ||
![]() |
2ea4312a09 | ||
![]() |
46847b2bc7 | ||
![]() |
a95b7940f8 | ||
![]() |
090797b4d8 | ||
![]() |
8fadbea6fa | ||
![]() |
4ce884a903 | ||
![]() |
122d5842fe | ||
![]() |
12f2757861 | ||
![]() |
9d83904f20 | ||
![]() |
6b49e70f28 | ||
![]() |
c4c69169aa | ||
![]() |
3f341362bc | ||
![]() |
47749cd30f | ||
![]() |
4d1c7dc07b | ||
![]() |
167a41fd9c | ||
![]() |
b22b99af90 | ||
![]() |
0ab4fdb105 | ||
![]() |
4c3b9fdcaf | ||
![]() |
009518f019 | ||
![]() |
03ba5abd7d | ||
![]() |
d5b8ee1737 | ||
![]() |
a5094d6ead | ||
![]() |
9a6d31a711 | ||
![]() |
313675c09e | ||
![]() |
8f7d464262 | ||
![]() |
78383c9cfd | ||
![]() |
f7cd89683d | ||
![]() |
737aeaec3e | ||
![]() |
8e565c1e44 | ||
![]() |
3d5bf70208 | ||
![]() |
5211a4e256 | ||
![]() |
2fef91f1cb | ||
![]() |
0a54824057 | ||
![]() |
1c20b65a64 | ||
![]() |
348e63b45e | ||
![]() |
642f8ce309 |
@@ -6,9 +6,6 @@ apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.tencent.vasdolly'
|
||||
apply from: '../mob.gradle'
|
||||
|
||||
configurations.maybeCreate("default")
|
||||
artifacts.add("default", file('SudMGP-v1.1.52.554.aar'))
|
||||
|
||||
def onlyArm64 = Boolean.parseBoolean(only_arm64)
|
||||
|
||||
android {
|
||||
@@ -24,20 +21,20 @@ android {
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
|
||||
ndk {
|
||||
//设置支持的SO库架构
|
||||
if (onlyArm64) {
|
||||
abiFilters "arm64-v8a"
|
||||
} else {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
|
||||
manifestPlaceholders = [CRASHLYTICS_COLLECTION_ENABLED: CRASHLYTICS_COLLECTION_ENABLED.toBoolean()]
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
universalApk true
|
||||
}
|
||||
}
|
||||
|
||||
bundle {
|
||||
language {
|
||||
enableSplit = false
|
||||
@@ -51,12 +48,21 @@ android {
|
||||
}
|
||||
|
||||
//在apk文件后边生成版本号信息
|
||||
android.applicationVariants.all {
|
||||
variant ->
|
||||
variant.outputs.all {
|
||||
def date = new Date().format("MMddHHmm", TimeZone.getTimeZone("GMT+08"))
|
||||
outputFileName = "piko_${buildType.name}_v${defaultConfig.versionName}-${date}.apk"
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
variant.outputs.configureEach { output ->
|
||||
def date = new Date().format("MMddHHmm", TimeZone.getTimeZone("GMT+08"))
|
||||
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile == null || !outputFile.name.endsWith('.apk')) {
|
||||
return
|
||||
}
|
||||
|
||||
def abi = output.getFilter(com.android.build.OutputFile.ABI)
|
||||
if (abi == null) {
|
||||
abi = "universal"
|
||||
}
|
||||
outputFileName = "piko_${buildType.name}_v${defaultConfig.versionName}_${abi}_${date}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
@@ -142,19 +148,20 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
def server_url_debug = '"http://beta.api.pekolive.com/"'
|
||||
def server_url_release = '"https://api.pekolive.com/"'
|
||||
|
||||
debug {
|
||||
ext.enableCrashlytics = false
|
||||
ext.alwaysUpdateBuildId = false // Firebase Crashlytics禁用更新构建ID
|
||||
|
||||
buildConfigField "String", "BASE_URL", "\"https://beta.api.pekolive.com/\""
|
||||
buildConfigField "String", "BASE_URL", server_url_debug
|
||||
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
|
||||
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
|
||||
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
|
||||
buildConfigField "String", "BASE_URL_RELEASE", server_url_release
|
||||
minifyEnabled false // 是否混淆
|
||||
crunchPngs false // 停用 PNG 压缩
|
||||
signingConfig signingConfigs.v2
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
gradle.taskGraph.whenReady {
|
||||
tasks.each { task ->
|
||||
if (task.name.contains("Test") || task.name.contains("Lint")) {
|
||||
@@ -172,7 +179,7 @@ android {
|
||||
mappingFileUploadEnabled CRASHLYTICS_COLLECTION_ENABLED.toBoolean()
|
||||
}
|
||||
|
||||
buildConfigField "String", "BASE_URL", "\"https://api.pekolive.com/\""
|
||||
buildConfigField "String", "BASE_URL", server_url_release
|
||||
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
|
||||
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
|
||||
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
|
||||
@@ -290,6 +297,7 @@ dependencies {
|
||||
//wheelView
|
||||
implementation 'com.contrarywind:wheelview:4.1.0'
|
||||
|
||||
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
|
||||
}
|
||||
|
||||
channel {
|
||||
|
1
app/proguard-rules.pro
vendored
@@ -233,6 +233,7 @@
|
||||
-keep class org.json.** {*;}
|
||||
-dontwarn com.yizhuan.xchat_android_core.**
|
||||
-keep class com.yizhuan.xchat_android_core.** {*;}
|
||||
-keep class com.yizhuan.treasure_box.bean.** {*;}
|
||||
|
||||
|
||||
#百度统计
|
||||
|
@@ -51,8 +51,15 @@
|
||||
tools:node="remove" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" /> <!-- 如果需要实时音视频通话模块,下面的权限也是必须的。否则,可以不加 -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- SDK 权限申明, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 -->
|
||||
@@ -72,6 +79,9 @@
|
||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||
<!-- AppsFlyer需要,参考:https://dev.appsflyer.com/hc/docs/install-android-sdk#setting-required-permissions -->
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<!-- 对于 Android 12.0 及以上设备,还需要添加如下权限: -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<application
|
||||
android:name=".application.XChatApplication"
|
||||
@@ -85,6 +95,7 @@
|
||||
android:theme="@style/MyMaterialTheme"
|
||||
tools:replace="android:name,android:allowBackup"
|
||||
tools:targetApi="n">
|
||||
|
||||
<activity
|
||||
android:name=".other.activity.SplashActivity"
|
||||
android:exported="true"
|
||||
@@ -1004,6 +1015,10 @@
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<meta-data
|
||||
android:name="Mob-Https"
|
||||
android:value="yes" />
|
||||
|
||||
<provider
|
||||
android:name="com.netease.nimlib.ipc.NIMContentProvider"
|
||||
android:authorities="${applicationId}.ipc.provider"
|
||||
|
BIN
app/src/main/assets/svga/home_voice_playing.svga
Normal file
BIN
app/src/main/assets/svga/svga_home_pk.svga
Normal file
BIN
app/src/main/assets/svga/svga_notify_h5.svga
Normal file
BIN
app/src/main/assets/svga/svga_tarot_senior.svga
Normal file
@@ -161,6 +161,11 @@ public class XChatApplication extends BaseApp {
|
||||
public String makeRevokeMsgTip(String s, IMMessage imMessage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeCategory(IMMessage message) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
private static XChatApplication instance;
|
||||
//生命周期监听
|
||||
|
@@ -109,6 +109,9 @@ public class AudioPlayerHelper {
|
||||
}
|
||||
|
||||
public void endPlay() {
|
||||
if (listener != null) {
|
||||
listener.onCompletion();
|
||||
}
|
||||
handler.removeMessages(WHAT_STATUS.COUNT_PLAY);
|
||||
if (player != null) {
|
||||
if (preparing) {
|
||||
|
@@ -97,7 +97,10 @@ import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FairyMsgAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Attachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Info;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment;
|
||||
@@ -105,6 +108,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
@@ -1243,6 +1248,34 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT:
|
||||
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
|
||||
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
|
||||
TarotAttachment tarotAttachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT,
|
||||
CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING);
|
||||
tarotAttachment.setTarotMsgBean(tarotMsgBean);
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomId()), tarotAttachment);
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.TAROT_NOTIFY_SVGA)
|
||||
.setChatRoomMessage(message));
|
||||
AvRoomDataManager.get().addChatRoomMessage(message);
|
||||
}
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5:
|
||||
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE) {
|
||||
NotifyH5Info bean = JSON.parseObject(String.valueOf(baseProtocol.getData()), NotifyH5Info.class);
|
||||
NotifyH5Attachment notifyH5Attachment = new NotifyH5Attachment(baseProtocol.getSecond());
|
||||
notifyH5Attachment.setBean(bean);
|
||||
ChatRoomMessage notifyH5Msg = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomId()), notifyH5Attachment);
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.NOTIFY_H5)
|
||||
.setChatRoomMessage(notifyH5Msg));
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_LUCKY_SEA://星级厨房
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
||||
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
|
||||
|
@@ -113,9 +113,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
rvOPtList.setLayoutManager(new FullyGridLayoutManager(getContext(), 5));
|
||||
optAdapter = new OptAdapter(context, null);
|
||||
addDatingAction(optAdapter);
|
||||
// addPKAction(optAdapter);
|
||||
addPKAction(optAdapter);
|
||||
addRoomPKAction(optAdapter);
|
||||
// addSingleRoomPKAction(optAdapter);
|
||||
addSingleRoomPKAction(optAdapter);
|
||||
addSendBroadcastAction(optAdapter);
|
||||
// addInviteFansOptAdapter();
|
||||
addVipSendBroadcastAction(optAdapter);
|
||||
|
@@ -11,9 +11,12 @@ import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewStub
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
@@ -184,6 +187,14 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
bottomView = mView.findViewById(R.id.bottom_view)
|
||||
inputLayout = mView.findViewById(R.id.input_layout)
|
||||
inputEdit = mView.findViewById(R.id.input_edit)
|
||||
inputEdit.setOnKeyListener { _, keyCode, event ->
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||
sendMsg()
|
||||
return@setOnKeyListener true
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
inputSend = mView.findViewById(R.id.input_send)
|
||||
microView = mView.findViewById(R.id.micro_view)
|
||||
mVsMusicPlayer = mView.findViewById(R.id.vs_music_player)
|
||||
@@ -292,18 +303,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
GiftValueMrg.get().handleReconnect(false)
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_EXIT -> {
|
||||
// 退出房間,把標誌置為 false
|
||||
AvRoomDataManager.get().isFromMentoring = false
|
||||
// 退出房間的時候,要停止倒計時
|
||||
EventBus.getDefault().post(MentoringStopCountingEvent())
|
||||
}
|
||||
|
||||
RoomEvent.DOWN_CROWDED_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||
toast(R.string.crowded_down)
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_MANAGER_ADD, RoomEvent.ROOM_MANAGER_REMOVE -> {
|
||||
updateView()
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_INFO_UPDATE -> {
|
||||
Logger.i(ResUtil.getString(R.string.avroom_fragment_baseroomfragment_01))
|
||||
addOpenDatingTips() //一定要放在updateView之前!!!
|
||||
@@ -313,6 +328,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
updateRemoteMuteBtn()
|
||||
openOrCloseGiftValue(false)
|
||||
}
|
||||
|
||||
RoomEvent.ENTER_ROOM -> {
|
||||
Logger.i(ResUtil.getString(R.string.avroom_fragment_baseroomfragment_02))
|
||||
updateView()
|
||||
@@ -320,6 +336,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
openOrCloseGiftValue(true)
|
||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||
}
|
||||
|
||||
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
||||
RoomEvent.MIC_QUEUE_STATE_CHANGE -> onQueueMicStateChange()
|
||||
RoomEvent.KICK_DOWN_MIC_BY_S_ADMIN, RoomEvent.KICK_DOWN_MIC -> if (event == RoomEvent.KICK_DOWN_MIC) {
|
||||
@@ -335,16 +352,20 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.DOWN_MIC -> {
|
||||
onDownMicro()
|
||||
}
|
||||
|
||||
RoomEvent.UP_MIC -> {
|
||||
onUpMicro()
|
||||
}
|
||||
|
||||
RoomEvent.INVITE_UP_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||
//自己的消息
|
||||
onInviteUpMic(roomEvent.micPosition)
|
||||
}
|
||||
|
||||
RoomEvent.KICK_OUT_ROOM -> {
|
||||
val reason = roomEvent.reason
|
||||
if (reason != null && reason.reason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
||||
@@ -362,6 +383,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
AvRoomDataManager.get().removeChatRoomMember(targetUid)
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.LEAVE_MODE -> microView.adapter.notifyDataSetChanged()
|
||||
RoomEvent.ROOM_CLEAN_SCREEN -> messageView.clear()
|
||||
}
|
||||
@@ -544,7 +566,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
} else {
|
||||
val roomQueueInfo = AvRoomDataManager.get()
|
||||
.getRoomQueueMemberInfoByAccount(myUid.toString())
|
||||
if (roomQueueInfo?.mChatRoomMember != null
|
||||
if (roomQueueInfo?.mChatRoomMember?.isNoProhibitMic == true && roomQueueInfo.mRoomMicInfo?.isMicMute == false) {
|
||||
bottomView.setMicBtnEnable(true)
|
||||
bottomView.setMicBtnOpen(true)
|
||||
} else if (roomQueueInfo?.mChatRoomMember != null
|
||||
&& myUid.toString() == roomQueueInfo.mChatRoomMember.account
|
||||
&& roomQueueInfo.mRoomMicInfo?.isMicMute == true
|
||||
) {
|
||||
@@ -632,13 +657,16 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
R.id.input_send -> {
|
||||
sendMsg()
|
||||
}
|
||||
|
||||
R.id.contribute_list -> {
|
||||
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
||||
mvpPresenter?.loadRoomRank()
|
||||
}
|
||||
|
||||
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
||||
R.id.iv_treasure_box,
|
||||
R.id.iv_treasure_box_cp -> GoldBoxHelper.handleBoxClick(mContext)
|
||||
|
||||
R.id.iv_radish_entrance -> PullRadishActivity.start(mContext)
|
||||
}
|
||||
}
|
||||
@@ -707,6 +735,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
}
|
||||
.subscribe { _, throwable ->
|
||||
if (throwable != null) {
|
||||
toast(throwable.message)
|
||||
callback.onFail()
|
||||
} else {
|
||||
callback.onSuccess()
|
||||
|
@@ -11,7 +11,7 @@ import android.view.View
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
import android.widget.FrameLayout
|
||||
import com.google.gson.Gson
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.room.game.GameCfg
|
||||
@@ -165,7 +165,9 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
) {
|
||||
iSudFSTAPP?.destroyMG()
|
||||
iSudFSTAPP = SudMGP.loadMG(activity, userID, roomID, code, mgID, language, mISudFSMMG)
|
||||
addGameView(iSudFSTAPP!!.gameView)
|
||||
iSudFSTAPP?.apply {
|
||||
addGameView(gameView)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,9 +319,9 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
//遊戲安全操作區域
|
||||
val viewGameRect = JSONObject()
|
||||
viewGameRect.put("left", 0)
|
||||
viewGameRect.put("top", ScreenUtil.dip2px(200f))
|
||||
viewGameRect.put("top", container.context.resources.getDimensionPixelOffset(R.dimen.dp_180))
|
||||
viewGameRect.put("right", 0)
|
||||
viewGameRect.put("bottom", ScreenUtil.dip2px(200f))
|
||||
viewGameRect.put("bottom", container.context.resources.getDimensionPixelOffset(R.dimen.dp_150))
|
||||
jsonObject.put("view_game_rect", viewGameRect)
|
||||
|
||||
//通知遊戲
|
||||
|
@@ -97,11 +97,11 @@ class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
|
||||
it.addListener(object : AnimatorListenerAdapter() {
|
||||
|
||||
var isCanceled = false
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
isCanceled = true
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
if (!isCanceled) {
|
||||
openRedPackage()
|
||||
}
|
||||
|
@@ -1310,15 +1310,26 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void setTarotMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
TarotAttachment attachment = (TarotAttachment) chatRoomMessage.getAttachment();
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS) {
|
||||
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
|
||||
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
|
||||
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
|
||||
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
|
||||
tvContent.setText(text.build());
|
||||
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
|
||||
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
switch (attachment.getSecond()) {
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS:
|
||||
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
|
||||
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
|
||||
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
|
||||
tvContent.setText(text.build());
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_JUNIOR_PRIZE_WINNING:
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING:
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING:
|
||||
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
|
||||
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0160), new ForegroundColorSpan(textColor))
|
||||
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
|
||||
tvContent.setText(text.build());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -424,6 +424,8 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
|
||||
pkScoreBoardDialog.show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -41,9 +41,12 @@ import com.yizhuan.xchat_android_constants.XChatConstants
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.*
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.SimpleAnimationListener
|
||||
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
@@ -51,6 +54,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
@@ -86,9 +90,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
private var boxDisposable: Disposable? = null
|
||||
private val messagesBox: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
|
||||
private var boxSVGADisposable: Disposable? = null
|
||||
private val messagesBoxSVGA: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
|
||||
private var animationLuckyGift: Animation? = null
|
||||
private var disposableLuckyGift: Disposable? = null
|
||||
private val messagesLuckyGift: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
@@ -151,18 +152,21 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotifyBySVGA(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)
|
||||
|
||||
RoomEvent.ROOM_GIFT_COMPOUND -> addGiftCompoundNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.DATING_PUBLISH_RESULT -> showHandAnim((roomEvent.chatRoomMessage.attachment as DatingAttachment).datingNotifyInfo)
|
||||
RoomEvent.RECEIVE_MEMBER_IN_NOTICE -> //進入房間
|
||||
addMemberInNotify(roomEvent.chatRoomMessage)
|
||||
|
||||
RoomEvent.RECEIVE_EXPER_LEVEL_UP_NOTICE -> addLevelUpNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ENTER_ROOM -> if (!SuperAdminUtil.isSuperAdmin()) {
|
||||
playCarSvga(AuthModel.get().currentUid.toString(), null, true)
|
||||
}
|
||||
|
||||
RoomEvent.CAR_MEMBER_IN -> if (roomEvent.mRoomCarMsgAttachment != null) {
|
||||
playCarSvga(
|
||||
null,
|
||||
@@ -174,17 +178,20 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showSingleRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ROOM_CAR_EFFECT_HIDE -> {
|
||||
isHideCarEffect = true
|
||||
loopCarAnim()
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_CAR_EFFECT_SHOW -> {
|
||||
isHideCarEffect = false
|
||||
}
|
||||
|
||||
RoomEvent.DRAW_GIFT_EFFECT -> {
|
||||
val drawGiftAttachment =
|
||||
(roomEvent.chatRoomMessage?.attachment as? DrawGiftAttachment)
|
||||
@@ -195,6 +202,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -308,9 +316,16 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
.takeWhile { messagesBox.size > 0 && !mContext.isDestroyed() }
|
||||
.subscribe {
|
||||
if (binding.flBoxNotify.childCount == 0) {
|
||||
showBoxNotify(
|
||||
messagesBox.removeAt(0)
|
||||
)
|
||||
val msg = messagesBox.removeAt(0)
|
||||
val attachment = msg.attachment
|
||||
if (attachment is CustomAttachment) {
|
||||
if (attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY) {
|
||||
showBoxNotify(msg)
|
||||
} else if(attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
showBoxNotifyBySVGA(msg)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,7 +341,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.nick + " ",
|
||||
attachment.nick.subAndReplaceDot(8),
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
@@ -336,7 +351,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
)
|
||||
.append(
|
||||
attachment.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (attachment.prizeNum > 1) {
|
||||
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
@@ -357,30 +372,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸運池飄屏 五級 SVGA背景的
|
||||
*
|
||||
* @param chatRoomMessage
|
||||
*/
|
||||
private fun addBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
binding.clNotify.visibility = VISIBLE
|
||||
}
|
||||
messagesBoxSVGA.add(chatRoomMessage)
|
||||
if (boxSVGADisposable == null || messagesBoxSVGA.size == 1) {
|
||||
boxSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.takeWhile { messagesBoxSVGA.size > 0 && !mContext.isDestroyed() }
|
||||
.subscribe {
|
||||
if (binding.flSvgaBoxNotify.childCount == 0) {
|
||||
showBoxNotifyBySVGA(
|
||||
messagesBoxSVGA.removeAt(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
|
||||
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
|
||||
val text = SpannableBuilder()
|
||||
@@ -389,7 +380,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.nick + " ",
|
||||
StringUtils.abbreviate(attachment.nick, 8) + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
@@ -399,22 +390,31 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
)
|
||||
.append(
|
||||
attachment.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (attachment.prizeNum > 1) {
|
||||
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
}
|
||||
val svgaImageView = SVGAImageView(mContext)
|
||||
svgaImageView.loops = 1
|
||||
svgaImageView.clearsAfterStop = true
|
||||
svgaImageView.clearsAfterDetached = true
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||
svgaImageView.layoutParams = params
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flSvgaBoxNotify.post { binding.flSvgaBoxNotify.removeView(svgaImageView) }
|
||||
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
animationBox!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
binding.flBoxNotify.removeView(svgaImageView)
|
||||
}
|
||||
})
|
||||
binding.flBoxNotify.startAnimation(animationBox)
|
||||
}
|
||||
}
|
||||
binding.flSvgaBoxNotify.addView(svgaImageView)
|
||||
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flBoxNotify.addView(svgaImageView)
|
||||
binding.flBoxNotify.startAnimation(animationBox)
|
||||
|
||||
shareParser().decodeFromAssets("svga/box_notify.svga", object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val dynamicEntity = SVGADynamicEntity()
|
||||
@@ -432,7 +432,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "noble_text_tx"
|
||||
), "bg"
|
||||
)
|
||||
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||
svgaImageView.setImageDrawable(drawable)
|
||||
@@ -1211,27 +1211,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun showSingleRoomRankNotify(chatRoomMessage: ChatRoomMessage) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
binding.clNotify.visibility = VISIBLE
|
||||
}
|
||||
val roomPkBean = (chatRoomMessage.attachment as SingleRoomRankAttachment).msgBean
|
||||
val rootView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.layout_single_room_rank_notify, null)
|
||||
(rootView.findViewById<View>(R.id.tv_nick) as TextView).text =
|
||||
roomPkBean.nick.subAndReplaceDot(6)
|
||||
(rootView.findViewById<View>(R.id.tv_desc) as TextView).text = roomPkBean.desc
|
||||
rootView.findViewById<ImageView>(R.id.iv_avatar).load(roomPkBean.avatar)
|
||||
rootView.setOnClickListener { AVRoomActivity.start(context, roomPkBean.uid) }
|
||||
binding.flSingleRoomRankNotify.addView(rootView)
|
||||
animationLuckyGift = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
rootView.startAnimation(animationLuckyGift)
|
||||
binding.flSingleRoomRankNotify.postDelayed({
|
||||
binding.flSingleRoomRankNotify.removeView(
|
||||
rootView
|
||||
)
|
||||
}, SHOW_TIME.toLong())
|
||||
}
|
||||
|
||||
private fun showRoomRankNotify(chatRoomMessage: ChatRoomMessage) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
|
@@ -20,6 +20,7 @@ import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.coorchice.library.SuperTextView
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
@@ -41,6 +42,7 @@ import com.yizhuan.erban.ui.widget.SimpleAnimListener
|
||||
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
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
@@ -49,6 +51,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.*
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.SimpleAnimationListener
|
||||
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
@@ -56,6 +59,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
@@ -164,18 +168,32 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
RoomEvent.BOX_NOTIFY -> {//寻爱
|
||||
addPlayNotify(RoomEvent.BOX_NOTIFY, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱svga
|
||||
addPlayNotify(RoomEvent.BOX_NOTIFY_SVGA, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.TAROT_NOTIFY,
|
||||
RoomEvent.TAROT_NOTIFY_SVGA -> {
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.NOTIFY_H5 -> {
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE ->//全服福袋
|
||||
//廳內福袋
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {// 星级厨房房间飘屏通知
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {// 星级厨房全服飘屏通知
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
@@ -183,17 +201,21 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {
|
||||
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.RADISH_NOTIFY,
|
||||
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
||||
|
||||
RoomEvent.ROOM_GIFT_COMPOUND -> addGiftCompoundNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.DATING_PUBLISH_RESULT -> showHandAnim((roomEvent.chatRoomMessage.attachment as DatingAttachment).datingNotifyInfo)
|
||||
RoomEvent.RECEIVE_MEMBER_IN_NOTICE -> //進入房間
|
||||
addMemberInNotify(roomEvent.chatRoomMessage)
|
||||
|
||||
RoomEvent.RECEIVE_EXPER_LEVEL_UP_NOTICE -> addLevelUpNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ENTER_ROOM -> if (!SuperAdminUtil.isSuperAdmin()) {
|
||||
playCarSvga(AuthModel.get().currentUid.toString(), null, true)
|
||||
}
|
||||
|
||||
RoomEvent.CAR_MEMBER_IN -> if (roomEvent.mRoomCarMsgAttachment != null) {
|
||||
playCarSvga(
|
||||
null,
|
||||
@@ -205,17 +227,20 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showSingleRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ROOM_RANK_TOP_NOTIFY -> showRoomRankNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.ROOM_CAR_EFFECT_HIDE -> {
|
||||
isHideCarEffect = true
|
||||
loopCarAnim()
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_CAR_EFFECT_SHOW -> {
|
||||
isHideCarEffect = false
|
||||
}
|
||||
|
||||
RoomEvent.DRAW_GIFT_EFFECT -> {
|
||||
val drawGiftAttachment =
|
||||
(roomEvent.chatRoomMessage?.attachment as? DrawGiftAttachment)
|
||||
@@ -226,6 +251,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -256,111 +282,196 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.takeWhile { messagesPlay.size > 0 && !mContext.isDestroyed() }
|
||||
.subscribe {
|
||||
if (binding.flPlayNotify.childCount == 0) {
|
||||
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
|
||||
)
|
||||
}
|
||||
showBoxNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
if (binding.flPlayNotify.childCount != 0) {
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
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
|
||||
)
|
||||
}
|
||||
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
showLuckyBagNotify(
|
||||
showBoxNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
|
||||
}
|
||||
|
||||
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)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 180.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
} else {
|
||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 60.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
showLuckySeaNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
|
||||
}
|
||||
|
||||
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)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 180.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
} else {
|
||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 60.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
showLuckySeaNotifyBySVGA(
|
||||
showTarotNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
RoomEvent.FAIRY_CONVERT_L2,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {//夺宝
|
||||
}
|
||||
|
||||
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)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 180.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
} else {
|
||||
margin(binding.clNotify, 0, UIUtil.dip2px(context, 60.0), 0, 0)
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, 60.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
showFairyNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.NOTIFY_H5 -> {
|
||||
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
|
||||
)
|
||||
|
||||
val msg = messagesPlay.removeAt(0)
|
||||
val attachment = msg.chatRoomMessage.attachment as NotifyH5Attachment
|
||||
val bean = attachment.bean ?: return@subscribe
|
||||
if (bean.floatingType == 0) {
|
||||
showNotifyH5(bean)
|
||||
} else {
|
||||
showNotifyH5WithAnim(bean)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
showLuckySeaNotifyBySVGA(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
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)
|
||||
}
|
||||
showFairyNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,6 +500,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {
|
||||
showFairyNotifyBySVGA(roomPlayBean)
|
||||
@@ -759,6 +871,102 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun showNotifyH5(data: NotifyH5Info) {
|
||||
val textView = LayoutInflater.from(mContext)
|
||||
.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)
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
textView.startAnimation(animationPlay)
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
private fun showNotifyH5WithAnim(data: NotifyH5Info) {
|
||||
|
||||
val svgaImageView = SVGAImageView(mContext)
|
||||
svgaImageView.loops = 1
|
||||
svgaImageView.clearsAfterStop = true
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||
svgaImageView.layoutParams = params
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.flPlayNotify.addView(svgaImageView)
|
||||
shareParser().decodeFromAssets(
|
||||
"svga/svga_notify_h5.svga",
|
||||
object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val dynamicEntity = SVGADynamicEntity()
|
||||
val textPaint = TextPaint()
|
||||
textPaint.color = Color.WHITE //字體顏色
|
||||
textPaint.textSize = 24f
|
||||
dynamicEntity.setDynamicText(
|
||||
StaticLayout(
|
||||
data.content,
|
||||
0,
|
||||
data.content!!.length,
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "bg"
|
||||
)
|
||||
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||
svgaImageView.setImageDrawable(drawable)
|
||||
svgaImageView.stepToFrame(0, true)
|
||||
}
|
||||
|
||||
override fun onError() {}
|
||||
},
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun showTarotNotify(roomPlayBean: RoomPlayBean) {
|
||||
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||
val attachment = chatRoomMessage.attachment as TarotAttachment
|
||||
val textView =
|
||||
LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_notify_tarot_intermediate, null) as TextView
|
||||
val string = mContext.getString(
|
||||
R.string.avroom_widget_roomeffectview_026,
|
||||
StringUtils.abbreviate(RegexUtil.getPrintableString(attachment.tarotMsgBean.nick), 8),
|
||||
attachment.tarotMsgBean.drawGoldNum
|
||||
)
|
||||
textView.text = HtmlCompat.fromHtml(string, HtmlCompat.FROM_HTML_MODE_COMPACT)
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flPlayNotify.addView(textView)
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
textView.startAnimation(animationPlay)
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
private fun showBoxNotify(roomPlayBean: RoomPlayBean) {
|
||||
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
|
||||
@@ -770,7 +978,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.nick + " ",
|
||||
attachment.nick.subAndReplaceDot(8),
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
@@ -780,7 +988,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
)
|
||||
.append(
|
||||
attachment.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (attachment.prizeNum > 1) {
|
||||
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
@@ -802,30 +1010,16 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
private fun showBoxNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
||||
private fun showTarotNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
||||
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
|
||||
val text = SpannableBuilder()
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_011),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.nick + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
|
||||
R.string.avroom_widget_roomeffectview_013
|
||||
), ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.color_00EAFF))
|
||||
)
|
||||
if (attachment.prizeNum > 1) {
|
||||
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
}
|
||||
val attachment = chatRoomMessage.attachment as TarotAttachment
|
||||
val string = mContext.getString(
|
||||
R.string.avroom_widget_roomeffectview_026,
|
||||
StringUtils.abbreviate(RegexUtil.getPrintableString(attachment.tarotMsgBean.nick), 8),
|
||||
attachment.tarotMsgBean.drawGoldNum
|
||||
)
|
||||
val text = HtmlCompat.fromHtml(string, HtmlCompat.FROM_HTML_MODE_COMPACT)
|
||||
|
||||
val svgaImageView = SVGAImageView(mContext)
|
||||
svgaImageView.loops = 1
|
||||
svgaImageView.clearsAfterStop = true
|
||||
@@ -840,6 +1034,83 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
binding.flPlayNotify.addView(svgaImageView)
|
||||
shareParser().decodeFromAssets(
|
||||
"svga/svga_tarot_senior.svga",
|
||||
object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val dynamicEntity = SVGADynamicEntity()
|
||||
val textPaint = TextPaint()
|
||||
textPaint.color = Color.WHITE //字體顏色
|
||||
textPaint.textSize = 22f
|
||||
dynamicEntity.setDynamicText(
|
||||
StaticLayout(
|
||||
text,
|
||||
0,
|
||||
text.length,
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "taxt"
|
||||
)
|
||||
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||
svgaImageView.setImageDrawable(drawable)
|
||||
svgaImageView.stepToFrame(0, true)
|
||||
}
|
||||
|
||||
override fun onError() {}
|
||||
},
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun showBoxNotifyBySVGA(roomPlayBean: RoomPlayBean) {
|
||||
val chatRoomMessage = roomPlayBean.chatRoomMessage
|
||||
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
|
||||
val text = SpannableBuilder()
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_011),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
StringUtils.abbreviate(attachment.nick, 8) + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
|
||||
R.string.avroom_widget_roomeffectview_013
|
||||
), ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
attachment.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (attachment.prizeNum > 1) {
|
||||
text.append("x" + attachment.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
}
|
||||
val svgaImageView = SVGAImageView(mContext)
|
||||
svgaImageView.loops = 1
|
||||
svgaImageView.clearsAfterDetached = true
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||
svgaImageView.layoutParams = params
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
animationPlay!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
})
|
||||
binding.flPlayNotify.startAnimation(animationPlay)
|
||||
}
|
||||
}
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flPlayNotify.addView(svgaImageView)
|
||||
binding.flPlayNotify.startAnimation(animationPlay)
|
||||
|
||||
shareParser().decodeFromAssets("svga/box_notify.svga", object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val dynamicEntity = SVGADynamicEntity()
|
||||
@@ -857,7 +1128,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "noble_text_tx"
|
||||
), "bg"
|
||||
)
|
||||
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||
svgaImageView.setImageDrawable(drawable)
|
||||
@@ -1636,27 +1907,6 @@ 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) {
|
||||
|
@@ -12,6 +12,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5;
|
||||
@@ -34,6 +35,7 @@ import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -100,9 +102,13 @@ import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Attachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Info;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.PlayEffectInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
@@ -192,7 +198,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
if (roomEvent == null) return;
|
||||
onReceiveChatRoomEvent(roomEvent);
|
||||
}));
|
||||
registerNimBroadcastMessage(true);
|
||||
}
|
||||
|
||||
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
|
||||
@@ -362,16 +367,17 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
registerNimBroadcastMessage(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
registerNimBroadcastMessage(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
registerNimBroadcastMessage(false);
|
||||
if (mCompositeDisposable != null) {
|
||||
mCompositeDisposable.dispose();
|
||||
mCompositeDisposable = null;
|
||||
@@ -1022,6 +1028,65 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT:
|
||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|
||||
|| UserUtils.getUserInfo() == null)
|
||||
return;
|
||||
if (playEffectList == null) {
|
||||
playEffectList = new LinkedList<>();
|
||||
}
|
||||
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
|
||||
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
|
||||
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||
playEffectInfo.setSecond(CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING);
|
||||
playEffectInfo.setTarotMsgBean(tarotMsgBean);
|
||||
if (playEffectList == null) {
|
||||
playEffectList = new LinkedList<>();
|
||||
}
|
||||
playEffectList.add(playEffectInfo);
|
||||
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
playEffectDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showPlayEffectDialog();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5:
|
||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
|| this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|
||||
|| UserUtils.getUserInfo() == null)
|
||||
return;
|
||||
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE) {
|
||||
NotifyH5Info bean = JSON.parseObject(String.valueOf(baseProtocol.getData()), NotifyH5Info.class);
|
||||
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||
playEffectInfo.setSecond(CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE);
|
||||
playEffectInfo.setNotifyH5(bean);
|
||||
if (playEffectList == null) {
|
||||
playEffectList = new LinkedList<>();
|
||||
}
|
||||
playEffectList.add(playEffectInfo);
|
||||
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
playEffectDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showPlayEffectDialog();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_LUCKY_SEA://星级厨房
|
||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
|
@@ -20,6 +20,7 @@ import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
import com.yizhuan.xchat_android_core.utils.StarUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
@@ -83,17 +84,6 @@ public class ViewAdapter {
|
||||
ImageLoadUtils.loadImage(imageView.getContext(), url, imageView);
|
||||
}
|
||||
|
||||
@BindingAdapter(value = {"date"}, requireAll = false)
|
||||
public static void setConstellation(TextView textView, long date) {
|
||||
String star = StarUtils.getConstellation(new Date(date));
|
||||
if (null == star) {
|
||||
textView.setVisibility(View.GONE);
|
||||
} else {
|
||||
textView.setText(star);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter(value = {"isOn"}, requireAll = false)
|
||||
public static void setIsOn(IOSSwitchView iosSwitchView, boolean isOn) {
|
||||
iosSwitchView.setOn(isOn);
|
||||
@@ -177,4 +167,14 @@ public class ViewAdapter {
|
||||
params.height = (int) height;
|
||||
v.setLayoutParams(params);
|
||||
}
|
||||
|
||||
@BindingAdapter(value = {"birthday"}, requireAll = false)
|
||||
public static void setBirthday(GenderAgeTextView v, long birthday) {
|
||||
v.setBirthDay(birthday);
|
||||
}
|
||||
|
||||
@BindingAdapter(value = {"gender"}, requireAll = false)
|
||||
public static void setGender(GenderAgeTextView v, int gender) {
|
||||
v.setGender(gender);
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,14 @@ public class EmptyViewHelper {
|
||||
return view;
|
||||
}
|
||||
|
||||
public static View createEmptyTextViewHeight(Context context, String text) {
|
||||
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.layout_wrap_empty, null);
|
||||
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
|
||||
return view;
|
||||
}
|
||||
|
||||
public static View createEmptyTextViewNoImage(Context context, String text) {
|
||||
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.layout_text_empty, null);
|
||||
|
@@ -3,6 +3,7 @@ package com.yizhuan.erban.common.dialog
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
@@ -73,16 +74,14 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
|
||||
|
||||
private fun checkStoragePermission1() {
|
||||
if (!EasyPermissions.hasPermissions(
|
||||
XChatApplication.gContext, Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
XChatApplication.gContext, if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
EasyPermissions.requestPermissions(
|
||||
this,
|
||||
getString(R.string.permission_storage_rationale),
|
||||
PERMISSION_CODE_STORAGE_1,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
} else {
|
||||
PhotoProviderNew.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
|
||||
@@ -90,7 +89,11 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
|
||||
}
|
||||
|
||||
private fun checkCameraPermission() {
|
||||
if (!EasyPermissions.hasPermissions(XChatApplication.gContext, Manifest.permission.CAMERA)) {
|
||||
if (!EasyPermissions.hasPermissions(
|
||||
XChatApplication.gContext,
|
||||
Manifest.permission.CAMERA
|
||||
)
|
||||
) {
|
||||
EasyPermissions.requestPermissions(
|
||||
this,
|
||||
getString(R.string.permission_camera_rationale),
|
||||
@@ -104,16 +107,15 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
|
||||
|
||||
private fun checkStoragePermission2() {
|
||||
if (!EasyPermissions.hasPermissions(
|
||||
XChatApplication.gContext, Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
XChatApplication.gContext, if (Build.VERSION.SDK_INT >= 33)
|
||||
Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
EasyPermissions.requestPermissions(
|
||||
this,
|
||||
getString(R.string.permission_storage_rationale),
|
||||
PERMISSION_CODE_STORAGE_2,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
} else {
|
||||
PhotoProviderNew.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)
|
||||
|
@@ -4,10 +4,7 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.*
|
||||
import com.yizhuan.xchat_android_core.home.model.HomeModel
|
||||
import com.yizhuan.xchat_android_core.room.bean.AnchorInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
@@ -23,6 +20,15 @@ class HomeViewModel : BaseViewModel() {
|
||||
private val _bannerLiveData = MutableLiveData<List<BannerInfo>?>()
|
||||
val bannerLiveData: MutableLiveData<List<BannerInfo>?> = _bannerLiveData
|
||||
|
||||
private val _currentResourceLiveData = MutableLiveData<List<CurrentResourceInfo>?>()
|
||||
val currentResourceLiveData: MutableLiveData<List<CurrentResourceInfo>?> = _currentResourceLiveData
|
||||
|
||||
private val _resourceJumpLiveData = MutableLiveData<HomeRoomInfo?>()
|
||||
val resourceJumpLiveData: LiveData<HomeRoomInfo?> = _resourceJumpLiveData
|
||||
|
||||
private val _homeChatPickLiveData = MutableLiveData<String?>()
|
||||
val homeChatPickLiveData: LiveData<String?> = _homeChatPickLiveData
|
||||
|
||||
private val _gameRoomLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
|
||||
val gameRoomLiveData: LiveData<ListResult<HomeRoomInfo>> = _gameRoomLiveData
|
||||
|
||||
@@ -50,8 +56,8 @@ class HomeViewModel : BaseViewModel() {
|
||||
private val _homePlayInfoLiveData = MutableLiveData<List<HomeRoomInfo>?>()
|
||||
val homePlayInfoData: MutableLiveData<List<HomeRoomInfo>?> = _homePlayInfoLiveData
|
||||
|
||||
private val _homeHotRoomLiveData = MutableLiveData<List<HomeRoomInfo>?>()
|
||||
val homeHotRoomLiveData: LiveData<List<HomeRoomInfo>?> = _homeHotRoomLiveData
|
||||
private val _homeHotRoomLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
|
||||
val homeHotRoomLiveData: LiveData<ListResult<HomeRoomInfo>> = _homeHotRoomLiveData
|
||||
|
||||
private val _newFriendLiveData = MutableLiveData<ListResult<UserInfo>>()
|
||||
val newFriendLiveData: LiveData<ListResult<UserInfo>> = _newFriendLiveData
|
||||
@@ -67,6 +73,44 @@ class HomeViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页改版资源位
|
||||
*/
|
||||
fun getCurrentResourceInfo() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_currentResourceLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_currentResourceLiveData.value = HomeModel.getCurrentResource()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getResourceJumpInfo(id: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_resourceJumpLiveData.value = null
|
||||
it.message.toast()
|
||||
},
|
||||
block = {
|
||||
_resourceJumpLiveData.value = HomeModel.getResourceJumpInfo(id)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getHomeChatPick() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_homeChatPickLiveData.value = null
|
||||
it.message.toast()
|
||||
},
|
||||
block = {
|
||||
_homeChatPickLiveData.value = HomeModel.getHomeChatPick()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getBannerInfo() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
@@ -181,10 +225,11 @@ class HomeViewModel : BaseViewModel() {
|
||||
fun getHotRoom() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_homeHotRoomLiveData.value = null
|
||||
_homeHotRoomLiveData.value = ListResult.failed(1)
|
||||
},
|
||||
block = {
|
||||
_homeHotRoomLiveData.value = HomeModel.getHotRoom()
|
||||
val result = HomeModel.getHotRoom()
|
||||
_homeHotRoomLiveData.value = ListResult.success(result, 1)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@@ -0,0 +1,22 @@
|
||||
package com.yizhuan.erban.home.adapter
|
||||
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||
import com.zhpan.bannerview.BaseBannerAdapter
|
||||
import com.zhpan.bannerview.BaseViewHolder
|
||||
|
||||
class HomeBannerAdapter : BaseBannerAdapter<BannerInfo?>() {
|
||||
override fun getLayoutId(viewType: Int): Int {
|
||||
return R.layout.activity_home_banner
|
||||
}
|
||||
|
||||
override fun bindData(
|
||||
helper: BaseViewHolder<BannerInfo?>,
|
||||
item: BannerInfo?,
|
||||
position: Int,
|
||||
pageSize: Int
|
||||
) {
|
||||
ImageLoadUtilsV2.loadImage(helper.findViewById(R.id.iv_cover), item?.bannerPic)
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@ import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_library.utils.StringCutUtils
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
|
||||
/**
|
||||
* create by lvzebiao @2019/11/13
|
||||
@@ -20,8 +20,7 @@ class HomeChatAdapter :
|
||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_avatar), item.avatar)
|
||||
val name = StringCutUtils.subStrByLen(item.title.substring(0, item.title.length - 3), 8)
|
||||
helper.setText(R.id.tv_name, name)
|
||||
helper.setText(R.id.tv_name, item.title.subAndReplaceDot(6))
|
||||
if (item.mgId == 0L) {
|
||||
helper.getView<Group>(R.id.group_game).visibility = View.INVISIBLE
|
||||
} else {
|
||||
|
@@ -1,12 +1,16 @@
|
||||
package com.yizhuan.erban.home.adapter
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.view.isGone
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.utils.TextUtils
|
||||
|
||||
@@ -25,5 +29,46 @@ class HomeHotAdapter :
|
||||
helper.setGone(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
|
||||
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
|
||||
|
||||
val icTopList = helper.getView<AppCompatImageView>(R.id.iv_top_list)
|
||||
if(item.isHourTop1 == 1){
|
||||
icTopList.visibility = View.VISIBLE
|
||||
icTopList.setImageResource(R.drawable.bg_recommend_hour_list)
|
||||
} else if(item.isWeekTop1 == 1){
|
||||
icTopList.visibility = View.VISIBLE
|
||||
icTopList.setImageResource(R.drawable.bg_recommend_weekly_list)
|
||||
} else {
|
||||
icTopList.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
val avatars: Array<ImageView> = arrayOf(
|
||||
helper.getView(R.id.iv_avatar_0),
|
||||
helper.getView(R.id.iv_avatar_1),
|
||||
helper.getView(R.id.iv_avatar_2),
|
||||
helper.getView(R.id.iv_avatar_3),
|
||||
helper.getView(R.id.iv_avatar_4)
|
||||
)
|
||||
for (i in avatars.indices) {
|
||||
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
|
||||
avatars[i].isGone = avatarUrl.isNullOrBlank()
|
||||
avatars[i].load(avatarUrl)
|
||||
}
|
||||
|
||||
val svgaPk = helper.getView<SVGAImageView>(R.id.svga_pk)
|
||||
if (item.isCrossPking) {
|
||||
svgaPk.visibility = View.VISIBLE
|
||||
svgaPk.loadFromAssets("svga/svga_home_pk.svga")
|
||||
} else {
|
||||
svgaPk.visibility = View.GONE
|
||||
}
|
||||
|
||||
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
|
||||
svgaLiving.loadFromAssets("svga/home_white_living.svga")
|
||||
}
|
||||
|
||||
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
|
||||
svgaLiving?.loadFromAssets("svga/home_white_living.svga")
|
||||
}
|
||||
|
||||
}
|
@@ -7,66 +7,78 @@ import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.google.android.flexbox.AlignItems
|
||||
import com.google.android.flexbox.FlexDirection
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.audio.helper.AudioPlayerHelper
|
||||
import com.yizhuan.erban.audio.helper.OnPlayListener
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
|
||||
import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
||||
import com.yizhuan.erban.ui.user.adapter.UserInfoLabelAdapter
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.erban.ui.utils.loadAvatar
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.erban.view.GenderAgeTextView
|
||||
import com.yizhuan.xchat_android_core.Constants
|
||||
import com.yizhuan.xchat_android_core.manager.AudioEngineManager
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo.SoundBean
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.StarUtils
|
||||
import com.yizhuan.xchat_android_core.utils.ifNullOrEmpty
|
||||
import com.yizhuan.xchat_android_library.common.widget.LinesFlexBoxLayoutManager
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import java.util.*
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class RoomNewFriendsAdapter :
|
||||
BaseQuickAdapter<UserInfo, BaseViewHolder>(R.layout.item_room_new_friends) {
|
||||
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
private var isMute = false
|
||||
private var isRemoteMute = false
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: UserInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_avatar).loadAvatar(item.avatar)
|
||||
helper.setText(R.id.tv_desc, item.userDesc.ifNullOrEmpty { "我是个默认签名" })
|
||||
.setText(
|
||||
R.id.tv_age,
|
||||
((CurrentTimeUtils.getCurrentTime() - item.birth) / 1000 / 60 / 60 / 24 / 365).toString()
|
||||
)
|
||||
|
||||
val tvGenderAge = helper.getView<GenderAgeTextView>(R.id.tv_gender_age)
|
||||
tvGenderAge.setBirthDay(item.birth)
|
||||
tvGenderAge.setGender(item.gender)
|
||||
|
||||
//设置星座
|
||||
val star = StarUtils.getConstellation(Date(item.birth))
|
||||
helper.setGone(R.id.tv_constellation, star != null)
|
||||
.setText(R.id.tv_constellation, star)
|
||||
helper.setBackgroundRes(
|
||||
R.id.ll_gender_age,
|
||||
if (item.gender == 1) R.drawable.shape_65d3f7_corner else R.drawable.shape_ff9cce_corner
|
||||
)
|
||||
helper.setImageResource(
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_home_man else R.drawable.ic_home_woman
|
||||
)
|
||||
val tvTalk = helper.getView<TextView>(R.id.tv_talk)
|
||||
val viewOnline = helper.getView<View>(R.id.view_online)
|
||||
val groupParty = helper.getView<Group>(R.id.group_party)
|
||||
helper.setImageResource(R.id.iv_constellation, star)
|
||||
|
||||
viewOnline.isVisible = item.inOnline
|
||||
if(item.inMic){
|
||||
groupParty.visibility = View.VISIBLE
|
||||
} else {
|
||||
groupParty.visibility = View.INVISIBLE
|
||||
}
|
||||
val tvTalk = helper.getView<TextView>(R.id.tv_talk)
|
||||
|
||||
helper.setVisible(
|
||||
R.id.view_online, if (item.inMic) {
|
||||
false
|
||||
} else item.inOnline
|
||||
)
|
||||
helper.setVisible(R.id.group_party, item.inMic)
|
||||
|
||||
if (item.inRoomUid != 0L) {
|
||||
tvTalk.text = "去找TA"
|
||||
tvTalk.setOnClickListener {
|
||||
AVRoomActivity.start(mContext, item.inRoomUid)
|
||||
AVRoomActivity.startForFromType(
|
||||
mContext,
|
||||
item.inRoomUid,
|
||||
AVRoomActivity.FROM_TYPE_USER,
|
||||
item.nick,
|
||||
item.uid.toString()
|
||||
)
|
||||
}
|
||||
} else {
|
||||
tvTalk.text = "和TA聊"
|
||||
@@ -100,20 +112,21 @@ class RoomNewFriendsAdapter :
|
||||
)
|
||||
}
|
||||
|
||||
if (item.audioCard != null && !TextUtils.isEmpty(item.audioCard.audioUrl)) {
|
||||
if (item.userVoice.isNullOrBlank()) {
|
||||
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.VISIBLE
|
||||
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.GONE
|
||||
} else {
|
||||
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.GONE
|
||||
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.VISIBLE
|
||||
|
||||
helper.getView<AppCompatTextView>(R.id.tvAudio).text = item.audioCard.second.toString()
|
||||
helper.getView<AppCompatTextView>(R.id.tvAudio).text = item.voiceDura.toString()
|
||||
helper.getView<LinearLayout>(R.id.llAudio)
|
||||
.setOnClickListener { v -> toggleAudio(item.audioCard) }
|
||||
} else {
|
||||
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.VISIBLE
|
||||
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.GONE
|
||||
.setOnClickListener { toggleAudio(helper, item) }
|
||||
helper.setImageResource(R.id.liv_user, R.drawable.ic_sound_wave)
|
||||
}
|
||||
|
||||
val mLabelRecyclerView = helper.getView<RecyclerView>(R.id.mLabelRecyclerView)
|
||||
if(!ListUtils.isListEmpty(item.labels)){
|
||||
if (!ListUtils.isListEmpty(item.labels)) {
|
||||
mLabelRecyclerView.visibility = View.VISIBLE
|
||||
val userInfoLabelAdapter = UserInfoLabelAdapter()
|
||||
|
||||
@@ -131,8 +144,91 @@ class RoomNewFriendsAdapter :
|
||||
|
||||
}
|
||||
|
||||
private fun toggleAudio(audioCard: SoundBean) {
|
||||
|
||||
private fun toggleAudio(holder: BaseViewHolder, item: UserInfo) {
|
||||
if (item.isVoicePlaying) {
|
||||
stopAudio()
|
||||
} else {
|
||||
playAudio(holder, item)
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopAudio() {
|
||||
AudioPlayerHelper.get().endPlay()
|
||||
}
|
||||
|
||||
private fun resetAudioUI(holder: BaseViewHolder, item: UserInfo) {
|
||||
item.isVoicePlaying = false
|
||||
|
||||
disposable?.dispose()
|
||||
holder.setImageResource(R.id.iv_audio_control, R.drawable.ic_sound_pause)
|
||||
holder.setText(R.id.tvAudio, item.voiceDura.toString())
|
||||
|
||||
val svgaImageView = holder.getView<SVGAImageView>(R.id.liv_user)
|
||||
svgaImageView.stopAnimation()
|
||||
svgaImageView.setImageResource(R.drawable.ic_sound_wave)
|
||||
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.run {
|
||||
AudioEngineManager.get().isRemoteMute = isRemoteMute //非靜音
|
||||
AudioEngineManager.get().isMute = isMute //能説話
|
||||
AudioEngineManager.get().setRole(
|
||||
if (isRemoteMute) Constants.CLIENT_ROLE_AUDIENCE else Constants.CLIENT_ROLE_BROADCASTER
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun playAudio(holder: BaseViewHolder, item: UserInfo) {
|
||||
AudioPlayerHelper.get().endPlay()
|
||||
|
||||
item.isVoicePlaying = true
|
||||
|
||||
|
||||
holder.setImageResource(R.id.iv_audio_control, R.drawable.ic_sound_start)
|
||||
val svgaImageView = holder.getView<SVGAImageView>(R.id.liv_user)
|
||||
svgaImageView.loadFromAssets("svga/home_voice_playing.svga")
|
||||
|
||||
disposable = Observable.interval(1L, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map { it + 1 }
|
||||
.takeUntil { it == item.voiceDura.toLong() }
|
||||
.subscribe {
|
||||
holder.setText(R.id.tvAudio, (item.voiceDura - it).toString())
|
||||
}
|
||||
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.run {
|
||||
isRemoteMute = AudioEngineManager.get().isRemoteMute
|
||||
isMute = AudioEngineManager.get().isMute
|
||||
AudioEngineManager.get().isRemoteMute = true //設置靜音
|
||||
AudioEngineManager.get().isMute = true //不能説話
|
||||
AudioEngineManager.get().setRole(Constants.CLIENT_ROLE_AUDIENCE)
|
||||
}
|
||||
|
||||
AudioPlayerHelper.get().playInThread(item.userVoice, object : OnPlayListener {
|
||||
override fun onError(error: String) {
|
||||
SingleToastUtil.showToast(mContext.getString(R.string.me_error_playing))
|
||||
resetAudioUI(holder, item)
|
||||
}
|
||||
|
||||
override fun onPrepared() {}
|
||||
override fun onPlaying(currDuration: Long) {}
|
||||
override fun onCompletion() {
|
||||
resetAudioUI(holder, item)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
|
||||
super.onViewDetachedFromWindow(holder)
|
||||
|
||||
val position = holder.absoluteAdapterPosition
|
||||
|
||||
if (position < 0 || position >= data.size) {
|
||||
return
|
||||
}
|
||||
|
||||
val item = data[position]
|
||||
if (item.isVoicePlaying) {
|
||||
stopAudio()
|
||||
}
|
||||
}
|
||||
}
|
@@ -104,11 +104,11 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
it?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
binding.mLiCreateRoom.visibility = View.GONE
|
||||
binding.mRecyclerChat.visibility = View.VISIBLE
|
||||
binding.nsHost.visibility = View.VISIBLE
|
||||
charAdapter.setNewData(it)
|
||||
} else {
|
||||
binding.mLiCreateRoom.visibility = View.VISIBLE
|
||||
binding.mRecyclerChat.visibility = View.GONE
|
||||
binding.nsHost.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
private fun showGameGuide(){
|
||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||
if (userInfo?.isHasPermitRoom == true) {
|
||||
binding.ivGameGuide.visibility = View.VISIBLE
|
||||
binding.ivGameGuide.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivGameGuide.visibility = View.GONE
|
||||
}
|
||||
|
@@ -10,22 +10,29 @@ import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.IReportConstants
|
||||
import com.yizhuan.erban.application.ReportManager
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.databinding.FragmentHomeBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
import com.yizhuan.erban.home.adapter.PartyMagicIndicatorAdapter
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.home.adapter.HomeBannerAdapter
|
||||
import com.yizhuan.erban.home.dialog.RecommendRoomDialog
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
|
||||
import com.yizhuan.erban.ui.search.SearchActivity
|
||||
import com.yizhuan.erban.ui.user.adapter.MainIndicatorAdapter
|
||||
import com.yizhuan.erban.ui.user.adapter.UserInfoIndicatorAdapter
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.yizhuan.erban.utils.CommonJumpHelper
|
||||
import com.yizhuan.xchat_android_core.DemoCache
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import com.zhpan.bannerview.BannerViewPager
|
||||
|
||||
/**
|
||||
* Peko首页
|
||||
@@ -37,27 +44,95 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
private val mTabInfoList = mutableListOf<HomeTagInfo>()
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
private var mBanner: BannerViewPager<BannerInfo>? = null
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HomeFragment"
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
mBanner = view?.findViewById(R.id.banner)
|
||||
initTitleTab()
|
||||
initListener()
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
|
||||
//首页_banner
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
if (ListUtils.isListEmpty(it)) {
|
||||
mBanner?.visibility = View.GONE
|
||||
return@let
|
||||
}
|
||||
mBanner?.visibility = View.VISIBLE
|
||||
mBanner?.adapter = HomeBannerAdapter()
|
||||
mBanner?.post {
|
||||
mBanner?.apply {
|
||||
this.setPageMargin(UIUtil.dip2px(mContext, 8.0))
|
||||
.setScrollDuration(800)
|
||||
.setOnPageClickListener { _: View?, position: Int ->
|
||||
//首页_banner
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
CommonJumpHelper.bannerJump(context, it[position])
|
||||
}
|
||||
.create(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.currentResourceLiveData.observe(this) {
|
||||
it?.let {
|
||||
if(it.size != 2){
|
||||
binding.csResource.visibility = View.GONE
|
||||
return@observe
|
||||
}
|
||||
binding.csResource.visibility = View.VISIBLE
|
||||
val resourceViews = arrayOf(
|
||||
binding.ivResource0,
|
||||
binding.ivResource1
|
||||
)
|
||||
for (i in resourceViews.indices) {
|
||||
resourceViews[i].load(it[i].icon)
|
||||
resourceViews[i].setOnClickListener { _ ->
|
||||
when {
|
||||
it[i].resourceType == 5 -> {
|
||||
CommonWebViewActivity.start(context, it[i].resourceContent)
|
||||
}
|
||||
i == 3 -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getHomeChatPick()
|
||||
}
|
||||
else -> {
|
||||
dialogManager.showProgressDialog(mContext)
|
||||
homeViewModel.getResourceJumpInfo(it[i].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.resourceJumpLiveData.observe(this) {
|
||||
dialogManager.dismissDialog()
|
||||
it?.let {
|
||||
if (it.isPick) {
|
||||
AVRoomActivity.start(context, it.uid)
|
||||
} else {
|
||||
RecommendRoomDialog.newInstance(it).show(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.homeChatPickLiveData.observe(viewLifecycleOwner) {
|
||||
dialogManager.dismissDialog()
|
||||
it?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
NimP2PMessageActivity.start(context, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.getBannerInfo()
|
||||
homeViewModel.getCurrentResourceInfo()
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
@@ -146,6 +221,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
|
||||
}
|
||||
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
||||
binding.viewPager.offscreenPageLimit = 1
|
||||
}
|
||||
|
||||
override fun onItemSelect(position: Int, view: TextView?) {
|
||||
|
@@ -241,7 +241,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
copyName(it.erbanNo.toString())
|
||||
}
|
||||
val star = StarUtils.getConstellation(Date(it.birth))
|
||||
mBinding.tvConstellation.text = star
|
||||
mBinding.ivConstellation.setImageResource(star)
|
||||
setUserLevel(it.userLevelVo)
|
||||
setWalletInfo()
|
||||
|
||||
@@ -396,6 +396,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
when (v.id) {
|
||||
R.id.iv_user_head, R.id.rl_user_info ->
|
||||
mUserInfo?.let { UIHelper.showUserInfoAct(mContext, it.uid) }
|
||||
|
||||
R.id.iv_edit ->
|
||||
mUserInfo?.let { UIHelper.showUserInfoModifyAct(mContext, it.uid) }
|
||||
|
||||
@@ -405,12 +406,14 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
AttentionListActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
R.id.ll_user_fans -> startActivity(
|
||||
Intent(
|
||||
mContext,
|
||||
FansListActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
R.id.me_item_wallet -> {
|
||||
//进入充值页面埋点
|
||||
val goldWalletInfo = PayModel.get().currentWalletInfo
|
||||
@@ -421,17 +424,10 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
}
|
||||
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
|
||||
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
|
||||
if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
|
||||
ChargeActivity.start(mContext)
|
||||
} else {
|
||||
CommonWebViewActivity.start(
|
||||
context, UriProvider.getOfficialPay(
|
||||
4,
|
||||
DeviceUtil.getDeviceId(context)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
jumpChargePage()
|
||||
}
|
||||
|
||||
R.id.me_item_vip -> {
|
||||
VipMainActivity.start(mContext)
|
||||
//进入贵族中心埋点
|
||||
@@ -444,17 +440,42 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
|
||||
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
|
||||
}
|
||||
|
||||
R.id.ll_room -> {
|
||||
OpenRoomHelper.openRoom(context as BaseActivity?)
|
||||
}
|
||||
|
||||
R.id.ll_gain -> {
|
||||
context?.let { EarnRecordActivity.start(it) }
|
||||
}
|
||||
|
||||
R.id.ll_clean_diamonds -> {
|
||||
GiveGoldActivity.start(mContext)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun jumpChargePage() {
|
||||
PayModel.get().chargeChannel
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
if (it.isNative) {
|
||||
ChargeActivity.start(mContext)
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
CommonWebViewActivity.start(
|
||||
context,
|
||||
UriProvider.getOfficialPay(4, DeviceUtil.getDeviceId(context))
|
||||
)
|
||||
}, {
|
||||
toast(it.message)
|
||||
ChargeActivity.start(mContext)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -3,30 +3,20 @@ package com.yizhuan.erban.home.fragment
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.IReportConstants
|
||||
import com.yizhuan.erban.application.ReportManager
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
|
||||
import com.yizhuan.erban.base.BaseActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentRecommendBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
import com.yizhuan.erban.home.adapter.HomeChatAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeHotAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeTopAdapter
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
|
||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
||||
import com.yizhuan.xchat_android_core.room.event.RoomShieldEvent
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.zhpan.bannerview.BannerViewPager
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -35,8 +25,11 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
* Peko首页
|
||||
*/
|
||||
class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
|
||||
private lateinit var roomHotAdapter: HomeHotAdapter
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<HomeRoomInfo>
|
||||
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
//是否需要刷新接口进行屏蔽房间操作
|
||||
@@ -72,11 +65,14 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
AVRoomActivity.start(mContext, homePlayInfo.uid)
|
||||
}
|
||||
}
|
||||
binding.mRecyclerRoom.adapter = roomHotAdapter
|
||||
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
|
||||
.setAdapter(roomHotAdapter)
|
||||
.setRecyclerView(binding.mRecyclerRoom)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyTextViewHeight(context, "暂无熱門推薦"))
|
||||
.setLayoutManager(GridLayoutManager(mContext, 2))
|
||||
.build()
|
||||
homeViewModel.homeHotRoomLiveData.observe(this) {
|
||||
it?.let {
|
||||
roomHotAdapter.setNewData(it)
|
||||
}
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,12 @@
|
||||
package com.yizhuan.erban.main.helper;
|
||||
|
||||
import static android.Manifest.permission.POST_NOTIFICATIONS;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
@@ -35,23 +41,35 @@ public class NoticationsUiHelper {
|
||||
private static final long CACHE_DISTANCE_TIME = 3 * TimeUtils.MILLIS_OF_A_DAY;
|
||||
|
||||
public static void handle(Activity activity, DialogManager dialogManager) {
|
||||
if (NotificationsUtils.isNotificationEnabled(activity)) {
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
if (ActivityCompat.checkSelfPermission(activity, POST_NOTIFICATIONS) == PackageManager.PERMISSION_DENIED) {
|
||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, POST_NOTIFICATIONS)) {
|
||||
enableNotification(activity, dialogManager);
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(activity, new String[]{POST_NOTIFICATIONS}, 100);
|
||||
}
|
||||
}
|
||||
} else if (NotificationsUtils.isNotificationEnabled(activity)) {
|
||||
return;
|
||||
}
|
||||
enableNotification(activity, dialogManager);
|
||||
}
|
||||
|
||||
private static void enableNotification(Activity activity, DialogManager dialogManager) {
|
||||
Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
long lastDialogTime = (long) SharedPreferenceUtils
|
||||
.get(KEY_NOTICATIONS_DIALOG_TIME, 0L);
|
||||
long currTime = System.currentTimeMillis();
|
||||
if (lastDialogTime == 0L || currTime - lastDialogTime >= CACHE_DISTANCE_TIME) {
|
||||
//超过三天需要重新弹窗
|
||||
emitter.onSuccess("");
|
||||
return;
|
||||
}
|
||||
emitter.onError(new Throwable("no need to show notications dialog"));
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
long lastDialogTime = (long) SharedPreferenceUtils
|
||||
.get(KEY_NOTICATIONS_DIALOG_TIME, 0L);
|
||||
long currTime = System.currentTimeMillis();
|
||||
if (lastDialogTime == 0L || currTime - lastDialogTime >= CACHE_DISTANCE_TIME) {
|
||||
//超过三天需要重新弹窗
|
||||
emitter.onSuccess("");
|
||||
return;
|
||||
}
|
||||
emitter.onError(new Throwable("no need to show notications dialog"));
|
||||
}
|
||||
})
|
||||
.flatMap(new Function<String, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(String s) throws Exception {
|
||||
|
@@ -1,7 +1,12 @@
|
||||
package com.yizhuan.erban.pay.presenter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.yizhuan.erban.pay.view.IChargeView;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_library.base.PresenterEvent;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 05/01/2018.
|
||||
@@ -21,7 +26,16 @@ public class ChargePresenter extends PayPresenter<IChargeView> {
|
||||
refreshWalletInfo(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void loadBanner() {
|
||||
payModel.loadChargeBanner()
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(list -> {
|
||||
if (ListUtils.isListEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
getMvpView().onLoadedBanners(list);
|
||||
},
|
||||
error -> ToastUtils.show(error.getMessage()));
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,16 @@
|
||||
package com.yizhuan.erban.pay.view;
|
||||
|
||||
|
||||
import com.yizhuan.xchat_android_core.pay.bean.Banner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 05/01/2018.
|
||||
*/
|
||||
|
||||
public interface IChargeView extends IPayView {
|
||||
|
||||
void onLoadedBanners(List<Banner> banners);
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderAudioParty;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderChatHint;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderContent;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderP2PContactRecharge;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderFairy;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderGift;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderHello;
|
||||
@@ -43,6 +44,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldThirdLevelAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.ChatHintAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CpInviteAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.P2PContactRechargeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FairySendAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingFamilyAttachment;
|
||||
@@ -169,6 +171,9 @@ public class ImInitHelper {
|
||||
//CP
|
||||
NimUIKit.registerMsgItemViewHolder(CpInviteAttachment.class, MsgViewHolderText.class);
|
||||
NimUIKit.registerMsgItemViewHolder(FairySendAttachment.class, MsgViewHolderFairy.class);
|
||||
// 客服充值
|
||||
NimUIKit.registerMsgItemViewHolder(P2PContactRechargeAttachment.class, MsgViewHolderP2PContactRecharge.class);
|
||||
|
||||
NimUIKit.setSessionListener(listener);
|
||||
NimUIKit.setContactEventListener(listener1);
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import com.yizhuan.erban.home.activity.VisitorListActivity;
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper;
|
||||
import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity;
|
||||
import com.yizhuan.erban.miniworld.activity.MiniWorldMainActivity;
|
||||
import com.yizhuan.erban.miniworld.activity.TopicMainActivity;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity;
|
||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity;
|
||||
@@ -325,6 +326,9 @@ public class RouterHandler {
|
||||
case RouterType.MY_SET:
|
||||
UIHelper.showSettingAct(context);
|
||||
break;
|
||||
case RouterType.TOPIC:
|
||||
TopicMainActivity.start(context, routerValue);
|
||||
break;
|
||||
default:
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.ui_im_routerhandler_07));
|
||||
return false;
|
||||
|
@@ -0,0 +1,81 @@
|
||||
|
||||
package com.yizhuan.erban.ui.im.chat;
|
||||
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.utils.ClipboardUtils;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.P2PContactRechargeAttachment;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/9/21.
|
||||
*/
|
||||
|
||||
public class MsgViewHolderP2PContactRecharge extends MsgViewHolderBase implements View.OnClickListener {
|
||||
|
||||
|
||||
private TextView mTvInstructions;
|
||||
private String mCopyText;
|
||||
|
||||
public MsgViewHolderP2PContactRecharge(BaseMultiItemFetchLoadAdapter adapter) {
|
||||
super(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentResId() {
|
||||
return R.layout.layout_msg_view_holder_customer_service_recharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inflateContentView() {
|
||||
mTvInstructions = findViewById(R.id.tv_instructions);
|
||||
mTvInstructions.setMovementMethod(new LinkMovementMethod());
|
||||
mCopyText = context.getString(R.string.copy);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int leftBackground() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindContentView() {
|
||||
P2PContactRechargeAttachment attachment = (P2PContactRechargeAttachment) message.getAttachment();
|
||||
String string = context.getString(R.string.tips_cs_recharge, attachment.getIdWeChat(), attachment.getIdLine());
|
||||
int first = string.indexOf(mCopyText);
|
||||
SpannableString spannableString = new SpannableString(string);
|
||||
spannableString.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_9168FA)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
ClipboardUtils.copyText(attachment.getIdWeChat());
|
||||
SingleToastUtil.showToast(context.getString(R.string.have_copy));
|
||||
|
||||
}
|
||||
}, first, first + 2, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
int second = string.indexOf(mCopyText, first + 2);
|
||||
spannableString.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_9168FA)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
ClipboardUtils.copyText(attachment.getIdLine());
|
||||
SingleToastUtil.showToast(context.getString(R.string.have_copy));
|
||||
}
|
||||
}, second, second + 2, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mTvInstructions.setText(spannableString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
@@ -16,6 +16,7 @@ import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
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.view.GenderAgeTextView;
|
||||
import com.yizhuan.erban.vip.util.VipHelper;
|
||||
import com.yizhuan.tutu.room_chat.activity.NimRoomP2PMessageActivity;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
@@ -68,12 +69,9 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
}
|
||||
});
|
||||
|
||||
AppCompatImageView ivGender = helper.getView(R.id.iv_gender);
|
||||
if (item.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
GenderAgeTextView tvGenderAge = helper.getView(R.id.tv_gender_age);
|
||||
tvGenderAge.setGender(item.getGender());
|
||||
tvGenderAge.setBirthDay(item.getBirth());
|
||||
|
||||
// 官字 icon
|
||||
helper.getView(R.id.iv_user_official).setVisibility(item.isOfficial() ? View.VISIBLE : View.GONE);
|
||||
|
@@ -119,32 +119,29 @@ public class RecentListFragment extends BaseFragment {
|
||||
mAttentionInRoomAdapter = new AttentionInRoomAdapter();
|
||||
rvAttentionOnline.setAdapter(mAttentionInRoomAdapter);
|
||||
rvAttentionOnline.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||
mAttentionInRoomAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
List<AttentionItem> attentionItems = adapter.getData();
|
||||
if (attentionItems.size() > position) {
|
||||
AttentionItem attentionItem = attentionItems.get(position);
|
||||
switch (attentionItem.getItemType()) {
|
||||
case AttentionItem.TYPE_ATTENTION:
|
||||
try {
|
||||
AttentionInfo attentionInfo = (AttentionInfo) attentionItem.getData();
|
||||
if (attentionInfo != null && attentionInfo.getUserInRoom() != null && mContext != null) {
|
||||
AVRoomActivity.startForFromType(mContext, attentionInfo.getUserInRoom().getUid(),
|
||||
AVRoomActivity.FROM_TYPE_USER, attentionInfo.getNick(), String.valueOf(attentionInfo.getUid()));
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
mAttentionInRoomAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
List<AttentionItem> attentionItems = adapter.getData();
|
||||
if (attentionItems.size() > position) {
|
||||
AttentionItem attentionItem = attentionItems.get(position);
|
||||
switch (attentionItem.getItemType()) {
|
||||
case AttentionItem.TYPE_ATTENTION:
|
||||
try {
|
||||
AttentionInfo attentionInfo = (AttentionInfo) attentionItem.getData();
|
||||
if (attentionInfo != null && attentionInfo.getUserInRoom() != null && mContext != null) {
|
||||
AVRoomActivity.startForFromType(mContext, attentionInfo.getUserInRoom().getUid(),
|
||||
AVRoomActivity.FROM_TYPE_USER, attentionInfo.getNick(), String.valueOf(attentionInfo.getUid()));
|
||||
}
|
||||
break;
|
||||
|
||||
case AttentionItem.TYPE_ATTENTION_MORE:
|
||||
if (mContext != null) {
|
||||
AttentionListActivity.start(mContext);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
break;
|
||||
|
||||
case AttentionItem.TYPE_ATTENTION_MORE:
|
||||
if (mContext != null) {
|
||||
AttentionListActivity.start(mContext);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -172,7 +169,7 @@ public class RecentListFragment extends BaseFragment {
|
||||
ivRedPoint = mView.findViewById(R.id.iv_red_point);
|
||||
ivRedPoint.setVisibility(isClicked ? View.GONE : View.VISIBLE);
|
||||
// 等级限制
|
||||
// setFindNewbieView();
|
||||
setFindNewbieView();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -423,7 +420,7 @@ public class RecentListFragment extends BaseFragment {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoginEvent(LoginEvent event) {
|
||||
//登录成功刷新消息页萌新
|
||||
// setFindNewbieView();
|
||||
setFindNewbieView();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -59,7 +59,7 @@ public class CommonRecentViewHolder extends RecentViewHolder {
|
||||
this.imgMsgStatus = holder.getView(R.id.img_msg_status);
|
||||
this.tvOnlineState = holder.getView(R.id.tv_online_state);
|
||||
this.ivCharmLevel = holder.getView(R.id.iv_charm_level);
|
||||
this.ivUserGender = holder.getView(R.id.iv_user_gender);
|
||||
this.tvGenderAge = holder.getView(R.id.tv_gender_age);
|
||||
mIvNobleHeadWear = holder.getView(R.id.noble_head_wear);
|
||||
mIvNobleLevel = holder.getView(R.id.iv_noble_level);
|
||||
mIvNobleBadge = holder.getView(R.id.iv_user_badge);
|
||||
@@ -156,11 +156,8 @@ public class CommonRecentViewHolder extends RecentViewHolder {
|
||||
ivCharmLevel.setVisibility(VISIBLE);
|
||||
ImageLoadUtils.loadImage(ivCharmLevel.getContext(), userLevelVo.getCharmUrl(), ivCharmLevel);
|
||||
}
|
||||
if (userInfo.getGender() == 1) {
|
||||
ivUserGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivUserGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
tvGenderAge.setBirthDay(userInfo.getBirth());
|
||||
tvGenderAge.setGender(userInfo.getGender());
|
||||
|
||||
VipHelper.loadVipIcon(ivVipIcon,userInfo.getUserVipInfoVO());
|
||||
VipHelper.loadVipNickColor(tvNickname, userInfo.getUserVipInfoVO(),"#FF333333");
|
||||
|
@@ -26,6 +26,7 @@ import com.netease.nimlib.sdk.team.model.Team;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.im.recent.RecentContactsFragment;
|
||||
import com.yizhuan.erban.ui.im.recent.adapter.RecentContactAdapter;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
import com.yizhuan.xchat_android_core.helper.ImHelperUtils;
|
||||
|
||||
public abstract class RecentViewHolder extends RecyclerViewHolder<BaseQuickAdapter, BaseViewHolder, RecentContact> {
|
||||
@@ -41,7 +42,7 @@ public abstract class RecentViewHolder extends RecyclerViewHolder<BaseQuickAdapt
|
||||
protected AppCompatImageView mIvNobleLevel;
|
||||
protected AppCompatImageView mIvNobleBadge;
|
||||
protected AppCompatImageView ivCharmLevel;
|
||||
protected AppCompatImageView ivUserGender;
|
||||
protected GenderAgeTextView tvGenderAge;
|
||||
protected ImageView ivVipIcon;
|
||||
|
||||
protected TextView tvNickname;
|
||||
|
@@ -306,12 +306,6 @@ public class LoginPasswordActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void login() {
|
||||
//发起登录
|
||||
HashMap<String, Object> map = new HashMap<>(3);
|
||||
map.put(IReportConstants.LOGIN_TYPE, IReportConstants.FIVE);
|
||||
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
|
||||
ReportManager.get().reportEvent(IReportConstants.LOGIN_REQUEST, map);
|
||||
|
||||
getDialogManager().showProgressDialog(this, getString(R.string.login_is_logining));
|
||||
AuthModel.get().login(
|
||||
"",
|
||||
@@ -344,6 +338,13 @@ public class LoginPasswordActivity extends BaseActivity {
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
|
||||
//发起登录
|
||||
HashMap<String, Object> map = new HashMap<>(3);
|
||||
map.put(IReportConstants.LOGIN_TYPE, IReportConstants.FIVE);
|
||||
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
|
||||
ReportManager.get().reportEvent(IReportConstants.LOGIN_REQUEST, map);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.yizhuan.erban.ui.pay;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.pay.PayModel.RECHARGE_LIMIT;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -13,6 +15,7 @@ import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -34,18 +37,25 @@ import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.pay.presenter.ChargePresenter;
|
||||
import com.yizhuan.erban.pay.view.IChargeView;
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
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.exception.FailReasonException;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.Banner;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.IgnoreException;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.zhpan.bannerview.BannerViewPager;
|
||||
import com.zhpan.bannerview.BaseBannerAdapter;
|
||||
import com.zhpan.bannerview.BaseViewHolder;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@@ -64,6 +74,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
private static final String TAG = "ChargeActivity";
|
||||
|
||||
private TextView mTv_gold;
|
||||
private BannerViewPager<Banner> mVpBanner;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mIvCharge;
|
||||
private CheckBox mTvProtocol;
|
||||
@@ -90,14 +101,17 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
setContentView(R.layout.activity_charge);
|
||||
findView();
|
||||
EventBus.getDefault().register(this);
|
||||
getDialogManager().showProgressDialog(this);
|
||||
initViews();
|
||||
initBilling();
|
||||
setProtocol();
|
||||
getMvpPresenter().loadUserInfo();
|
||||
getMvpPresenter().loadBanner();
|
||||
}
|
||||
|
||||
private void findView() {
|
||||
mTv_gold = findViewById(R.id.tv_gold);
|
||||
mVpBanner = findViewById(R.id.vp_banner);
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mIvCharge = findViewById(R.id.tv_charge);
|
||||
mTvProtocol = findViewById(R.id.tv_protocol);
|
||||
@@ -176,8 +190,10 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
if (billingResult.getResponseCode() != BillingClient.BillingResponseCode.OK) {
|
||||
Log.w(TAG, "Unsuccessful query for type: " + BillingClient.SkuType.INAPP
|
||||
+ ". Error code: " + billingResult.getResponseCode());
|
||||
getDialogManager().dismissDialog();
|
||||
toast(getString(R.string.Recharge_failure));
|
||||
} else if (skuDetailsList != null && skuDetailsList.size() > 0) {
|
||||
getDialogManager().dismissDialog();
|
||||
List<ChargeBean> showChargeList = new ArrayList<>();
|
||||
for (ChargeBean chargeBean : chargeBeanList) {
|
||||
for (SkuDetails skuDetails : skuDetailsList) {
|
||||
@@ -190,6 +206,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
}
|
||||
runOnUiThread(() -> mChargeAdapter.setNewData(showChargeList));
|
||||
} else {
|
||||
getDialogManager().dismissDialog();
|
||||
toast(getString(R.string.Recharge_failure));
|
||||
}
|
||||
});
|
||||
@@ -258,13 +275,31 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
PayModel.get().placeOrder(skuDetails.getSku())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(recordId -> billingManager.initiatePurchaseFlow(skuDetails, recordId.getRecordId()),
|
||||
throwable -> SingleToastUtil.showToast(throwable.getMessage()));
|
||||
throwable -> {
|
||||
if (throwable instanceof FailReasonException) {
|
||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
||||
if (failReasonException.getCode() == RECHARGE_LIMIT) {
|
||||
getDialogManager().showOkDialog(failReasonException.getMessage(), "聯繫客服", true,
|
||||
() -> jumpContact());
|
||||
return;
|
||||
}
|
||||
}
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
});
|
||||
} else {
|
||||
Log.w(TAG, "skuDetails ==null");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void jumpContact() {
|
||||
PayModel.get().getChargeContact()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(data -> NimP2PMessageActivity.start(this, data),
|
||||
e -> toast(e.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -280,6 +315,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
if (billingManager != null) {
|
||||
billingManager.destroy();
|
||||
}
|
||||
getDialogManager().dismissDialog();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
@@ -353,4 +389,24 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadedBanners(List<Banner> banners) {
|
||||
mVpBanner.setVisibility(View.VISIBLE);
|
||||
mVpBanner.setLifecycleRegistry(getLifecycle())
|
||||
.setAdapter(new BaseBannerAdapter<>() {
|
||||
@Override
|
||||
protected void bindData(BaseViewHolder<Banner> holder, Banner data, int position, int pageSize) {
|
||||
ImageView ivBanner = holder.findViewById(R.id.iv_banner);
|
||||
ImageLoadUtilsV2.loadImage(ivBanner, data.getBannerUrl());
|
||||
ivBanner.setOnClickListener(v ->
|
||||
CommonWebViewActivity.start(ChargeActivity.this, data.getLinkUrl()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId(int viewType) {
|
||||
return R.layout.item_banner_charge;
|
||||
}
|
||||
})
|
||||
.create(banners);
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
import com.yizhuan.erban.vip.util.VipHelper;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
@@ -69,12 +70,9 @@ public class AttentionListAdapter extends BaseQuickAdapter<AttentionInfo, BaseVi
|
||||
}
|
||||
});
|
||||
|
||||
AppCompatImageView ivGender = baseViewHolder.getView(R.id.iv_gender);
|
||||
if (attentionInfo.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
GenderAgeTextView tvGenderAge = baseViewHolder.getView(R.id.tv_gender_age);
|
||||
tvGenderAge.setGender(attentionInfo.getGender());
|
||||
tvGenderAge.setBirthDay(attentionInfo.getBirth());
|
||||
|
||||
VipHelper.loadVipIcon(baseViewHolder.getView(R.id.iv_vip_icon), attentionInfo.getUserVipInfoVO());
|
||||
VipHelper.loadVipNickColor(baseViewHolder.getView(R.id.tv_userName), attentionInfo.getUserVipInfoVO(), "#FF333333");
|
||||
|
@@ -12,6 +12,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.NobleAvatarView;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
import com.yizhuan.erban.vip.util.VipHelper;
|
||||
import com.yizhuan.xchat_android_core.im.friend.IMFriendModel;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
@@ -89,12 +90,9 @@ public class FansViewAdapter extends BaseQuickAdapter<FansInfo, BaseViewHolder>
|
||||
tvAttention.setBackgroundResource(R.drawable.selector_common_confirm);
|
||||
}
|
||||
|
||||
AppCompatImageView ivGender = baseViewHolder.getView(R.id.iv_gender);
|
||||
if (fansInfo.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
GenderAgeTextView tvGenderAge = baseViewHolder.getView(R.id.tv_gender_age);
|
||||
tvGenderAge.setGender(fansInfo.getGender());
|
||||
tvGenderAge.setBirthDay(fansInfo.getBirth());
|
||||
|
||||
VipHelper.loadVipIcon(baseViewHolder.getView(R.id.iv_vip_icon), fansInfo.getUserVipInfoVO());
|
||||
VipHelper.loadVipNickColor(baseViewHolder.getView(R.id.tv_userName), fansInfo.getUserVipInfoVO(), "#FF333333");
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.yizhuan.erban.ui.setting.bean
|
||||
|
||||
import android.Manifest
|
||||
import android.os.Build
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.xchat_android_core.utils.TextUtils
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
@@ -36,8 +37,7 @@ enum class PermissionEntity(
|
||||
STORAGE(
|
||||
ResUtil.getString(R.string.setting_bean_permissionentity_011), ResUtil.getString(R.string.setting_bean_permissionentity_012), R.drawable.icon_permission_storage,
|
||||
arrayOf(
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -1,11 +1,14 @@
|
||||
package com.yizhuan.erban.ui.user.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.yizhuan.erban.BuildConfig;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.ui.setting.LabActivity;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
public class AboutActivity extends BaseActivity {
|
||||
@@ -27,6 +30,11 @@ public class AboutActivity extends BaseActivity {
|
||||
|
||||
private void initView() {
|
||||
mTvVersions = findViewById(R.id.versions);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
findViewById(R.id.img_about_logo).setOnClickListener(v ->
|
||||
startActivity(new Intent(this, LabActivity.class)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -307,10 +307,8 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
UserInfoUiMgr.get().setValue(userInfo);
|
||||
mBinding.tvDesc.setText(userInfo.getUserDesc() != null ? userInfo.getUserDesc() : getResources().getString(R.string.msg_no_user_desc));
|
||||
|
||||
//设置性别
|
||||
Drawable drawable = ContextCompat.getDrawable(this,
|
||||
(userInfo.getGender() == 1) ? R.drawable.ic_gender_male : R.drawable.ic_gender_female);
|
||||
mBinding.tvNick.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
|
||||
mBinding.tvGenderAge.setGender(userInfo.getGender());
|
||||
mBinding.tvGenderAge.setBirthDay(userInfo.getBirth());
|
||||
|
||||
mBinding.tvFansCount.setText(String.valueOf(userInfo.getFansNum()));
|
||||
mBinding.tvErbanId.setText(getString(R.string.me_user_id, userInfo.getErbanNo()));
|
||||
@@ -324,6 +322,8 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), userInfo.getUid()).subscribe();
|
||||
}
|
||||
|
||||
mBinding.ivChargeAgent.setVisibility(userInfo.isRechargeUser() ? View.VISIBLE : View.GONE);
|
||||
|
||||
VipHelper.loadVipIcon(mBinding.ivVipIcon, userInfo.getUserVipInfoVO());
|
||||
|
||||
initVoiceShow(userInfo.getAudioCard());
|
||||
@@ -339,7 +339,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
}
|
||||
}
|
||||
|
||||
private void copyName(){
|
||||
private void copyName() {
|
||||
try {
|
||||
ClipboardManager cm = (ClipboardManager) UserInfoActivity.this.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText("text", String.valueOf(userInfo.getErbanNo())));
|
||||
|
@@ -6,6 +6,7 @@ import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
@@ -125,6 +126,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
||||
binding.civAvatar
|
||||
)
|
||||
binding.tvAvatarAuditing.visibility = if (userInfo.isReview) View.VISIBLE else View.GONE
|
||||
binding.ivAvatarAuditing.visibility = if (userInfo.isReview) View.VISIBLE else View.GONE
|
||||
val birth = TimeUtil.getDateTimeString(userInfo.birth, "yyyy-MM-dd")
|
||||
binding.tvBirth.text = birth
|
||||
binding.tvNick.text = RegexUtil.getPrintableString(userInfo.nick)
|
||||
@@ -435,16 +437,14 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
||||
private fun checkStoragePermission() {
|
||||
if (!EasyPermissions.hasPermissions(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
EasyPermissions.requestPermissions(
|
||||
this,
|
||||
getString(R.string.permission_storage_rationale),
|
||||
PERMISSION_CODE_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
} else {
|
||||
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
|
||||
|
@@ -6,6 +6,7 @@ import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
@@ -20,7 +21,6 @@ import com.yalantis.ucrop.UCrop
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.XChatApplication
|
||||
import com.yizhuan.erban.base.TitleBar
|
||||
import com.yizhuan.xchat_android_library.common.file.FileHelper
|
||||
import com.yizhuan.erban.common.util.BitmapUtil
|
||||
import com.yizhuan.erban.ui.user.adapter.UserModifyPhotosAdapter
|
||||
import com.yizhuan.erban.ui.user.adapter.UserModifyPhotosAdapter.PhotoItemClickListener
|
||||
@@ -30,6 +30,7 @@ import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserPhoto
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||
import com.yizhuan.xchat_android_library.common.file.FileHelper
|
||||
import com.yizhuan.xchat_android_library.common.photo.PhotoProviderNew
|
||||
import com.yizhuan.xchat_android_library.common.util.PhotoCompressCallback
|
||||
import com.yizhuan.xchat_android_library.common.util.PhotoCompressUtil
|
||||
@@ -219,16 +220,14 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
|
||||
private fun checkStoragePermission() {
|
||||
if (!EasyPermissions.hasPermissions(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
EasyPermissions.requestPermissions(
|
||||
this,
|
||||
getString(R.string.permission_storage_rationale),
|
||||
PERMISSION_CODE_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
PERMISSION_CODE_STORAGE,
|
||||
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
} else {
|
||||
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
|
||||
|
@@ -1,21 +1,22 @@
|
||||
package com.yizhuan.erban.ui.user.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.widget.XRecyclerView.ScaleTransitionPagerTitleView;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.FragmentContainerHelper;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.indicators.GradientLinePagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.model.PositionData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,7 +45,7 @@ public class MainIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(context, R.color.color_767585));
|
||||
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_1F1A4E));
|
||||
scaleTransitionPagerTitleView.setMinScale(minScale);
|
||||
scaleTransitionPagerTitleView.setTextSize(textSize);
|
||||
scaleTransitionPagerTitleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimensionPixelSize(R.dimen.sp_16));
|
||||
int padding = UIUtil.dip2px(context, 12);
|
||||
scaleTransitionPagerTitleView.setPadding(padding, 0, padding, 0);
|
||||
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
|
||||
@@ -60,14 +61,61 @@ public class MainIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
if (!showIndicator) return null;
|
||||
GradientLinePagerIndicator indicator = new GradientLinePagerIndicator(context);
|
||||
indicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
|
||||
indicator.setLineHeight(UIUtil.dip2px(mContext, 8));
|
||||
indicator.setRoundRadius(UIUtil.dip2px(mContext, 5));
|
||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
lp.gravity = Gravity.END;
|
||||
lp.bottomMargin = UIUtil.dip2px(mContext, 0);
|
||||
indicator.setLayoutParams(lp);
|
||||
|
||||
int startColor = ContextCompat.getColor(context, R.color.color_5CF1FF);
|
||||
int endColor = ContextCompat.getColor(context, R.color.color_CF70FF);
|
||||
GradientLinePagerIndicator indicator = new GradientLinePagerIndicator(context) {
|
||||
|
||||
private List<PositionData> mDataList;
|
||||
|
||||
@Override
|
||||
public void onPositionDataProvide(List<PositionData> dataList) {
|
||||
mDataList = dataList;
|
||||
super.onPositionDataProvide(mDataList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
if (mDataList == null || mDataList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算锚点位置
|
||||
PositionData current = FragmentContainerHelper.getImitativePositionData(mDataList, position);
|
||||
PositionData next = FragmentContainerHelper.getImitativePositionData(mDataList, position + 1);
|
||||
|
||||
float leftX;
|
||||
float nextLeftX;
|
||||
float rightX;
|
||||
float nextRightX;
|
||||
|
||||
leftX = current.mContentRight - getLineWidth();
|
||||
rightX = current.mContentRight;
|
||||
nextLeftX = next.mContentRight - getLineWidth();
|
||||
nextRightX = next.mContentRight;
|
||||
|
||||
getLineRect().left = leftX + (nextLeftX - leftX) * positionOffset;
|
||||
getLineRect().right = rightX + (nextRightX - rightX) * positionOffset;
|
||||
getLineRect().top = getHeight() - getLineHeight() - getYOffset();
|
||||
getLineRect().bottom = getHeight() - getYOffset();
|
||||
|
||||
LinearGradient lg = new LinearGradient(getLineRect().left, getLineRect().top, getLineRect().right, getLineRect().bottom,
|
||||
new int[]{startColor, endColor}, null, LinearGradient.TileMode.CLAMP);
|
||||
getPaint().setShader(lg);
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawRoundRect(getLineRect(), getRoundRadius(), getRoundRadius(), getPaint());
|
||||
}
|
||||
};
|
||||
|
||||
indicator.setLineHeight(context.getResources().getDimensionPixelOffset(R.dimen.dp_8));
|
||||
indicator.setLineWidth(context.getResources().getDimensionPixelOffset(R.dimen.dp_35));
|
||||
indicator.setRoundRadius(context.getResources().getDimensionPixelOffset(R.dimen.dp_5));
|
||||
indicator.setYOffset(context.getResources().getDimensionPixelOffset(R.dimen.dp_4));
|
||||
return indicator;
|
||||
}
|
||||
|
||||
|
@@ -14,8 +14,6 @@ class UserInfoLabelAdapter :
|
||||
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_user_info_label) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: String) {
|
||||
val tvLabel = helper.getView<AppCompatTextView>(R.id.tv_user_tag)
|
||||
tvLabel.isSelected = helper.layoutPosition <3
|
||||
helper.setText(R.id.tv_user_tag, item)
|
||||
}
|
||||
|
||||
|
@@ -59,12 +59,8 @@ class UserInfoInfoFragment : BaseViewBindingFragment<FragmentUserinfoUserinfoBin
|
||||
private fun initInfoData(bean: UserDetailInfo.DataBean) {
|
||||
//设置星座
|
||||
val star = StarUtils.getConstellation(Date(bean.birth))
|
||||
if (null == star) {
|
||||
binding.tvConstellation.visibility = View.GONE
|
||||
} else {
|
||||
binding.tvConstellation.text = star
|
||||
binding.tvConstellation.visibility = View.VISIBLE
|
||||
}
|
||||
binding.ivConstellation.setImageResource(star)
|
||||
binding.ivConstellation.visibility = View.VISIBLE
|
||||
val birth = TimeUtil.getDateTimeString(bean.birth, "yyyy-MM-dd")
|
||||
binding.tvBirth.text = birth
|
||||
binding.tvArea.text = bean.region
|
||||
|
@@ -42,6 +42,7 @@ import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.manager.PublicChatHallDataManager;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
@@ -543,4 +544,12 @@ public class JSInterface {
|
||||
if (mActivity instanceof TarotPayWebViewActivity) mActivity.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转app并且自动关注用户然后打开私聊页面
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void openAppConcernedChat(String uid) {
|
||||
PraiseModel.get().praise(Long.parseLong(uid), true).subscribe();
|
||||
NimP2PMessageActivity.start(context, uid);
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ 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.RegexUtil;
|
||||
import com.yizhuan.erban.view.GenderAgeTextView;
|
||||
import com.yizhuan.erban.vip.util.VipHelper;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
@@ -127,7 +128,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
private ImageView ivBadge;
|
||||
private ImageView ivVipIcon;
|
||||
private TextView nick;
|
||||
private ImageView ivGender;
|
||||
private GenderAgeTextView mTvGenderAge;
|
||||
private TextView erbanId;
|
||||
private ImageView ivCopy;
|
||||
|
||||
@@ -236,7 +237,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
nick = findViewById(R.id.nick);
|
||||
erbanId = findViewById(R.id.tv_erban_id);
|
||||
ivCopy = findViewById(R.id.iv_copy);
|
||||
ivGender = findViewById(R.id.iv_gender);
|
||||
mTvGenderAge = findViewById(R.id.tv_gender_age);
|
||||
ivVipIcon = findViewById(R.id.iv_vip_icon);
|
||||
fansNumber = findViewById(R.id.fans_number);
|
||||
flexbox = findViewById(R.id.flexbox);
|
||||
@@ -543,8 +544,8 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
return true;
|
||||
});
|
||||
ivCopy.setOnClickListener(view -> copyName());
|
||||
ivGender.setImageResource(
|
||||
userInfo.getGender() == 1 ? R.drawable.ic_gender_male : R.drawable.ic_gender_female);
|
||||
mTvGenderAge.setBirthDay(userInfo.getBirth());
|
||||
mTvGenderAge.setGender(userInfo.getGender());
|
||||
VipHelper.loadVipIcon(ivVipIcon, userInfo.getUserVipInfoVO());
|
||||
// 设置粉丝数量
|
||||
fansNumber.setText(userInfo.getFansNum() + getString(R.string.ui_widget_userinfodialog_07));
|
||||
|
@@ -10,6 +10,7 @@ import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Layout;
|
||||
import android.text.Spanned;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
@@ -23,6 +24,7 @@ import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGADynamicEntity;
|
||||
@@ -34,13 +36,18 @@ 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.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.erban.utils.SpannableBuilder;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NotifyH5Info;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.PlayEffectInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfoBean;
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||
|
||||
public class AllPlayEffectDialog extends BaseDialog {
|
||||
|
||||
@@ -73,14 +80,27 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
window.setAttributes(windowParams);
|
||||
window.setWindowAnimations(R.style.anim_left);
|
||||
}
|
||||
if (playEffectInfo.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
||||
} else if (playEffectInfo.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
||||
showLuckySeaNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
|
||||
} else if (playEffectInfo.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
|
||||
showLuckyBagNotify(playEffectInfo.getLuckyBagNoticeInfo());
|
||||
} else if(playEffectInfo.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5){
|
||||
showFairyNotifyBySVGA(playEffectInfo.getFairyMsgInfo());
|
||||
switch (playEffectInfo.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
|
||||
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
||||
break;
|
||||
case CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL:
|
||||
showLuckySeaNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
|
||||
break;
|
||||
case CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL:
|
||||
showLuckyBagNotify(playEffectInfo.getLuckyBagNoticeInfo());
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L5:
|
||||
showFairyNotifyBySVGA(playEffectInfo.getFairyMsgInfo());
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING:
|
||||
showTarotNotifyBySvga(playEffectInfo.getTarotMsgBean());
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_NOTIFY_H5_SUB_WHOLE_SERVICE:
|
||||
showNotifyH5BySvga(playEffectInfo.getNotifyH5());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +112,7 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
new ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
roomBoxPrizeInfo.getNick() + " ",
|
||||
StringUtils.abbreviate(roomBoxPrizeInfo.getNick(), 8) + " ",
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
@@ -102,7 +122,7 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
)
|
||||
.append(
|
||||
roomBoxPrizeInfo.getPrizeName(),
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
|
||||
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
|
||||
);
|
||||
if (roomBoxPrizeInfo.getPrizeNum() > 1) {
|
||||
text.append("x" + roomBoxPrizeInfo.getPrizeNum(), new ForegroundColorSpan(Color.WHITE));
|
||||
@@ -138,7 +158,7 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "noble_text_tx");
|
||||
), "bg");
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||
svgaImageView.setImageDrawable(drawable);
|
||||
svgaImageView.stepToFrame(0, true);
|
||||
@@ -329,6 +349,107 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private void showNotifyH5BySvga(NotifyH5Info info) {
|
||||
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/svga_notify_h5.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(
|
||||
info.getContent(),
|
||||
0,
|
||||
info.getContent().length(),
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "bg");
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void showTarotNotifyBySvga(TarotMsgBean tarotMsgBean) {
|
||||
String string = getContext().getString(
|
||||
R.string.avroom_widget_roomeffectview_026,
|
||||
StringUtils.abbreviate(RegexUtil.getPrintableString(tarotMsgBean.getNick()), 8),
|
||||
tarotMsgBean.getDrawGoldNum());
|
||||
Spanned spanned = HtmlCompat.fromHtml(string, HtmlCompat.FROM_HTML_MODE_COMPACT);
|
||||
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/svga_tarot_senior.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(
|
||||
spanned,
|
||||
0,
|
||||
spanned.length(),
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "taxt");
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void showFairyNotifyBySVGA(FairyMsgInfoBean fairyMsgInfo) {
|
||||
SpannableBuilder text = new SpannableBuilder()
|
||||
.append("好運爆棚!", new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_8C4700)))
|
||||
|
@@ -0,0 +1,90 @@
|
||||
package com.yizhuan.erban.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.yizhuan.erban.R
|
||||
import java.util.Calendar
|
||||
import java.util.Date
|
||||
|
||||
class GenderAgeTextView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyle: Int = 0
|
||||
) : AppCompatTextView(context, attrs, defStyle) {
|
||||
|
||||
init {
|
||||
val array =
|
||||
context.obtainStyledAttributes(attrs, R.styleable.GenderAgeTextView)
|
||||
val gender = array.getInt(R.styleable.GenderAgeTextView_gender, 0)
|
||||
array.recycle()
|
||||
|
||||
setTextColor(Color.WHITE)
|
||||
|
||||
minWidth = resources.getDimensionPixelOffset(R.dimen.dp_26)
|
||||
gravity = Gravity.CENTER_VERTICAL
|
||||
setPadding(
|
||||
resources.getDimensionPixelOffset(R.dimen.dp_4),
|
||||
0,
|
||||
resources.getDimensionPixelOffset(R.dimen.dp_4),
|
||||
0
|
||||
)
|
||||
compoundDrawablePadding = resources.getDimensionPixelOffset(R.dimen.dp_2)
|
||||
|
||||
setGender(gender)
|
||||
setBirthDay(System.currentTimeMillis())
|
||||
}
|
||||
|
||||
fun setBirthDay(ts: Long) {
|
||||
text = getAgeByBirthday(Date(ts)).toString()
|
||||
}
|
||||
|
||||
fun setGender(gender: Int) {
|
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
if (gender == GENDER_MALE) R.drawable.ic_gender_male_t else R.drawable.ic_gender_female_t,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
val drawable = ContextCompat.getDrawable(
|
||||
context,
|
||||
if (gender == GENDER_MALE) R.drawable.bg_gender_male else R.drawable.bg_gender_female
|
||||
)
|
||||
background = drawable
|
||||
}
|
||||
|
||||
private fun getAgeByBirthday(birthday: Date): Int {
|
||||
val cal: Calendar = Calendar.getInstance()
|
||||
require(!cal.before(birthday)) { "The birthDay is before Now. It's unbelievable!" }
|
||||
val yearNow: Int = cal.get(Calendar.YEAR)
|
||||
val monthNow: Int = cal.get(Calendar.MONTH) + 1
|
||||
val dayOfMonthNow: Int = cal.get(Calendar.DAY_OF_MONTH)
|
||||
cal.time = birthday
|
||||
val yearBirth: Int = cal.get(Calendar.YEAR)
|
||||
val monthBirth: Int = cal.get(Calendar.MONTH) + 1
|
||||
val dayOfMonthBirth: Int = cal.get(Calendar.DAY_OF_MONTH)
|
||||
var age = yearNow - yearBirth
|
||||
if (monthNow <= monthBirth) {
|
||||
if (monthNow == monthBirth) {
|
||||
// monthNow==monthBirth
|
||||
if (dayOfMonthNow < dayOfMonthBirth) {
|
||||
age--
|
||||
}
|
||||
} else {
|
||||
// monthNow>monthBirth
|
||||
age--
|
||||
}
|
||||
}
|
||||
return age
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val GENDER_UNKNOWN = 0
|
||||
const val GENDER_MALE = 1
|
||||
const val GENDER_FEMALE = 2
|
||||
}
|
||||
}
|
111
app/src/main/java/com/yizhuan/erban/view/NestedScrollableHost.kt
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.yizhuan.erban.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewConfiguration
|
||||
import android.widget.FrameLayout
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import androidx.viewpager2.widget.ViewPager2.ORIENTATION_HORIZONTAL
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.sign
|
||||
|
||||
/**
|
||||
* Layout to wrap a scrollable component inside a ViewPager2. Provided as a solution to the problem
|
||||
* where pages of ViewPager2 have nested scrollable elements that scroll in the same direction as
|
||||
* ViewPager2. The scrollable element needs to be the immediate and only child of this host layout.
|
||||
*
|
||||
* This solution has limitations when using multiple levels of nested scrollable elements
|
||||
* (e.g. a horizontal RecyclerView in a vertical RecyclerView in a horizontal ViewPager2).
|
||||
*/
|
||||
class NestedScrollableHost : FrameLayout {
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
||||
private var touchSlop = 0
|
||||
private var initialX = 0f
|
||||
private var initialY = 0f
|
||||
private val parentViewPager: ViewPager2?
|
||||
get() {
|
||||
var v: View? = parent as? View
|
||||
while (v != null && v !is ViewPager2) {
|
||||
v = v.parent as? View
|
||||
}
|
||||
return v as? ViewPager2
|
||||
}
|
||||
|
||||
private val child: View? get() = if (childCount > 0) getChildAt(0) else null
|
||||
|
||||
init {
|
||||
touchSlop = ViewConfiguration.get(context).scaledTouchSlop
|
||||
}
|
||||
|
||||
private fun canChildScroll(orientation: Int, delta: Float): Boolean {
|
||||
val direction = -delta.sign.toInt()
|
||||
return when (orientation) {
|
||||
0 -> child?.canScrollHorizontally(direction) ?: false
|
||||
1 -> child?.canScrollVertically(direction) ?: false
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(e: MotionEvent): Boolean {
|
||||
handleInterceptTouchEvent(e)
|
||||
return super.onInterceptTouchEvent(e)
|
||||
}
|
||||
|
||||
private fun handleInterceptTouchEvent(e: MotionEvent) {
|
||||
val orientation = parentViewPager?.orientation ?: return
|
||||
|
||||
// Early return if child can't scroll in same direction as parent
|
||||
if (!canChildScroll(orientation, -1f) && !canChildScroll(orientation, 1f)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (e.action == MotionEvent.ACTION_DOWN) {
|
||||
initialX = e.x
|
||||
initialY = e.y
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
} else if (e.action == MotionEvent.ACTION_MOVE) {
|
||||
val dx = e.x - initialX
|
||||
val dy = e.y - initialY
|
||||
val isVpHorizontal = orientation == ORIENTATION_HORIZONTAL
|
||||
|
||||
// assuming ViewPager2 touch-slop is 2x touch-slop of child
|
||||
val scaledDx = dx.absoluteValue * if (isVpHorizontal) .5f else 1f
|
||||
val scaledDy = dy.absoluteValue * if (isVpHorizontal) 1f else .5f
|
||||
|
||||
if (scaledDx > touchSlop || scaledDy > touchSlop) {
|
||||
if (isVpHorizontal == (scaledDy > scaledDx)) {
|
||||
// Gesture is perpendicular, allow all parents to intercept
|
||||
parent.requestDisallowInterceptTouchEvent(false)
|
||||
} else {
|
||||
// Gesture is parallel, query child if movement in that direction is possible
|
||||
if (canChildScroll(orientation, if (isVpHorizontal) dx else dy)) {
|
||||
// Child can scroll, disallow all parents to intercept
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
} else {
|
||||
// Child cannot scroll, allow all parents to intercept
|
||||
parent.requestDisallowInterceptTouchEvent(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/bg_add_num_bg.webp
Normal file
After Width: | Height: | Size: 1016 B |
BIN
app/src/main/res/drawable-xhdpi/bg_box_buy.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 8.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_notify_h5.webp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_recommend_hour_list.webp
Normal file
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 23 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_recommend_weekly_list.webp
Normal file
After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xhdpi/btn_box_buy.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_box_selected.png
Normal file
After Width: | Height: | Size: 564 B |
BIN
app/src/main/res/drawable-xhdpi/ic_box_unselected.png
Normal file
After Width: | Height: | Size: 468 B |
BIN
app/src/main/res/drawable-xhdpi/ic_gender_female_t.png
Normal file
After Width: | Height: | Size: 468 B |
BIN
app/src/main/res/drawable-xhdpi/ic_gender_male_t.png
Normal file
After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_token.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 970 B |
Before Width: | Height: | Size: 1014 B After Width: | Height: | Size: 914 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 940 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 932 B |
BIN
app/src/main/res/drawable-xhdpi/img_charge_agent.webp
Normal file
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/room_bg_rank_go_room.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 74 KiB |
BIN
app/src/main/res/drawable-xhdpi/room_bg_rank_notice.webp
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/treasure_box_ic_diamond.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/treasure_exchange_bg.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
6
app/src/main/res/drawable/bg_683fad_10.xml
Normal file
@@ -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="#683FAD" />
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
</shape>
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke android:width="2dp" android:color="#ff759fff" />
|
||||
<stroke android:width="2dp" android:color="@color/color_a974ff" />
|
||||
<corners android:radius="360dp" />
|
||||
</shape>
|
6
app/src/main/res/drawable/bg_7748c7_r10.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/color_7748C7" />
|
||||
</shape>
|
5
app/src/main/res/drawable/bg_8651e0.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#8651e0" />
|
||||
</shape>
|
9
app/src/main/res/drawable/bg_8651e0_stroke_ffffff.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="0.5dp"
|
||||
android:color="@color/color_white" />
|
||||
<corners android:radius="@dimen/dp_15" />
|
||||
<solid android:color="@color/color_8651E0"/>
|
||||
</shape>
|
8
app/src/main/res/drawable/bg_constellation.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<solid android:color="@color/color_339168FA" />
|
||||
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
|
||||
</shape>
|
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#339168FA" />
|
||||
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
|
||||
<solid android:color="@color/color_ff80cc" />
|
||||
</shape>
|
7
app/src/main/res/drawable/bg_gender_male.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
|
||||
<solid android:color="@color/color_6bb3ff" />
|
||||
</shape>
|