1:添加cp进场动画效果
2:修改cp礼物弹框 3:添加组成cp后进入心动空间跳转
This commit is contained in:
@@ -41,6 +41,7 @@ import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.modulemain.activity.main.activity.MainActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.HeartCpActivity;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.BaseEvent;
|
||||
import com.xscm.moduleutil.R;
|
||||
@@ -217,7 +218,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
if (event instanceof RoomMessageEvent) {
|
||||
com.xscm.moduleutil.bean.RoomGiftData.CpType text = GsonUtils.fromJson(((RoomMessageEvent) event).getText().getText().toString(),com.xscm.moduleutil.bean.RoomGiftData.CpType.class);
|
||||
if (text.getCp_type() == 1) {
|
||||
queren1(1,text.getText(),text.getGift_id()+"",((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id()+"",((RoomMessageEvent) event).getRoomId());
|
||||
queren1(1,text.getText1(),text.getGift_id()+"",((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id()+"",((RoomMessageEvent) event).getRoomId());
|
||||
}else if (text.getCp_type() == 2) {
|
||||
queren1(2,text.getText1(),text.getGift_id()+"",((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id()+"",((RoomMessageEvent) event).getRoomId());
|
||||
}
|
||||
@@ -334,6 +335,11 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
int userids= Integer.parseInt(userId);
|
||||
Intent intent = new Intent(ActivityUtils.getTopActivity(), HeartCpActivity.class);
|
||||
intent.putExtra("userId",userids);
|
||||
startActivity(intent);
|
||||
}
|
||||
},
|
||||
v -> {
|
||||
|
||||
@@ -345,7 +345,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
qxRedPacketManager!!.delegate = this;
|
||||
|
||||
// 初始化礼物管理器
|
||||
GiftDisplayManager.getInstance().setupDisplayView(mBinding!!.giftContainer)
|
||||
GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
|
||||
|
||||
initPublicScreenFragment()
|
||||
}
|
||||
|
||||
@@ -1489,153 +1490,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomFragment!!.handleRoomMessage(messageEvent)
|
||||
}
|
||||
}else if(msgType == EMMessageInfo.QXRoomMessageTypeCPText){
|
||||
LogUtils.e("CPText", messageEvent.text.rights_icon)
|
||||
if(messageEvent.text.rights_icon.isNotEmpty()){
|
||||
mBinding?.roomCpView?.fl!!.visibility = View.VISIBLE
|
||||
ImageUtils.loadHead(messageEvent.text.fromUserInfo.avatar, mBinding?.roomCpView?.roomCpHead1)
|
||||
mBinding?.roomCpView?.roomCpName1?.text = messageEvent.text.fromUserInfo.nickname
|
||||
mBinding?.roomCpView?.roomCpName2?.text = messageEvent.text.toUserInfo.nickname
|
||||
ImageUtils.loadHead(messageEvent.text.toUserInfo.avatar, mBinding?.roomCpView?.roomCpHead2)
|
||||
playVap(messageEvent.text.rights_icon, mBinding?.roomCpView?.animCp!!, true)
|
||||
QXGiftPlayerManager.getInstance(this).displayCPView(messageEvent.text.fromUserInfo.avatar,messageEvent.text.toUserInfo.avatar,messageEvent.text.fromUserInfo.nickname, messageEvent.text.toUserInfo.nickname,messageEvent.text.rights_icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun playVap(url: String, animView: AnimView, isTxk: Boolean) {
|
||||
|
||||
if (!FileUtils.isFileExists(this.cacheDir.absolutePath + url.substring(url.lastIndexOf("/")))) {
|
||||
LogUtils.e("无缓存")
|
||||
|
||||
downloadAndPlay(this, url, object : GiftAnimView.DownloadCallback {
|
||||
override fun onSuccess(file: File) {
|
||||
post(Runnable {
|
||||
animView.startPlay(file)
|
||||
})
|
||||
}
|
||||
|
||||
override fun onFailure(e: java.lang.Exception) {
|
||||
LogUtils.e("MP4下载或播放失败: " + e.message)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
LogUtils.e("有缓存")
|
||||
if (isTxk) {
|
||||
animView.setLoop(20)
|
||||
}
|
||||
animView.startPlay(
|
||||
File(this.cacheDir.absolutePath + url.substring(url.lastIndexOf("/")))
|
||||
)
|
||||
}
|
||||
//情侣特效播放回调
|
||||
mBinding?.roomCpView?.animCp?.setAnimListener(object : IAnimListener {
|
||||
override fun onFailed(errorType: Int, errorMsg: String?) {
|
||||
}
|
||||
|
||||
override fun onVideoComplete() {
|
||||
runOnUiThread {
|
||||
//播放结束后隐藏
|
||||
mBinding?.roomCpView?.fl.let { view ->
|
||||
if (view?.visibility == View.VISIBLE) {
|
||||
// 你的代码
|
||||
view?.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVideoDestroy() {
|
||||
}
|
||||
|
||||
override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
|
||||
}
|
||||
|
||||
override fun onVideoStart() {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
fun downloadAndPlay(
|
||||
context: Context,
|
||||
playImage: String,
|
||||
callback: GiftAnimView.DownloadCallback?
|
||||
) {
|
||||
|
||||
val filePath = context.cacheDir.absolutePath + playImage.substring(playImage.lastIndexOf("/"))
|
||||
val file = File(filePath)
|
||||
|
||||
if (!FileUtils.isFileExists(this.cacheDir.absolutePath + playImage.substring(playImage.lastIndexOf("/")))) {
|
||||
LogUtils.e("无缓存")
|
||||
// 使用OkHttp进行下载
|
||||
val client = OkHttpClient()
|
||||
val request = Request.Builder()
|
||||
.url(playImage)
|
||||
.build()
|
||||
|
||||
client.newCall(request).enqueue(object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
LogUtils.e("MP4下载失败: " + e.toString())
|
||||
// 在主线程中回调失败
|
||||
post(Runnable {
|
||||
if (callback != null) {
|
||||
callback.onFailure(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun onResponse(call: Call, response: Response) {
|
||||
if (response.isSuccessful()) {
|
||||
try {
|
||||
response.body().use { responseBody ->
|
||||
if (responseBody != null) {
|
||||
val downloadedFile = File(filePath)
|
||||
val fos = FileOutputStream(downloadedFile)
|
||||
fos.write(responseBody.bytes())
|
||||
fos.close()
|
||||
|
||||
// 在主线程中回调成功
|
||||
post(Runnable {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(downloadedFile)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 在主线程中回调失败
|
||||
post(Runnable {
|
||||
if (callback != null) {
|
||||
callback.onFailure(IOException("Response body is null"))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
LogUtils.e("MP4文件保存失败: " + e.message)
|
||||
// 在主线程中回调失败
|
||||
post(Runnable {
|
||||
if (callback != null) {
|
||||
callback.onFailure(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("MP4下载响应失败")
|
||||
// 在主线程中回调失败
|
||||
post(Runnable {
|
||||
if (callback != null) {
|
||||
callback.onFailure(IOException("Response not successful: " + response.code()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 文件已存在,直接回调成功
|
||||
if (callback != null) {
|
||||
callback.onSuccess(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
private var endTime: Long = 0
|
||||
|
||||
private fun xlhDjs(endTimeStr: String?) {
|
||||
|
||||
@@ -45,6 +45,9 @@ class HeartCpActivity : BaseMvpActivity<HeartCpPresenter, ActivityHeartCpBinding
|
||||
|
||||
|
||||
override fun initData() {
|
||||
if (userId == 0){
|
||||
userId=intent.getStringExtra("userId")?.toInt()!!
|
||||
}
|
||||
MvpPre.getHeartCpData(userId)
|
||||
|
||||
mBinding.ivBack.setOnClickListener {
|
||||
|
||||
@@ -4,13 +4,14 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.SnackbarUtils.dismiss
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.user.activity.HeartCpActivity
|
||||
import com.xscm.modulemain.activity.user.activity.RelationshipActivity
|
||||
import com.xscm.modulemain.activity.user.activity.UserHomepageActivity
|
||||
import com.xscm.modulemain.activity.user.conacts.UserHomepageConacts
|
||||
@@ -24,7 +25,6 @@ import com.xscm.moduleutil.bean.RelationshipBean
|
||||
import com.xscm.moduleutil.bean.UserInfo
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
import com.xscm.moduleutil.utils.SpUtil
|
||||
|
||||
/**
|
||||
* @Author qx
|
||||
@@ -181,7 +181,9 @@ class BosomFriendFragment : BaseMvpFragment<UserHomepagePresenter?, FragmentBoso
|
||||
startActivity(intent)
|
||||
}
|
||||
mBinding.llMiddle.setOnClickListener { //跳转到心动空间
|
||||
|
||||
val intent = Intent(ActivityUtils.getTopActivity(), HeartCpActivity::class.java)
|
||||
intent.putExtra("userId", userId)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user