1:修改播放礼物特效
2:修改特效按照ios方式更改
This commit is contained in:
@@ -55,7 +55,7 @@ android {
|
|||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ android {
|
|||||||
|
|
||||||
debug {
|
debug {
|
||||||
debuggable true
|
debuggable true
|
||||||
minifyEnabled false
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ isBuildModule=false
|
|||||||
android.injected.testOnly=false
|
android.injected.testOnly=false
|
||||||
|
|
||||||
APP_VERSION_NAME=1.0.0
|
APP_VERSION_NAME=1.0.0
|
||||||
APP_VERSION_CODE=121
|
APP_VERSION_CODE=125
|
||||||
|
|
||||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
@@ -121,7 +123,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
private ChannelSplitRenderer1 renderer;
|
private ChannelSplitRenderer1 renderer;
|
||||||
private int mType;//1:循环播放 2:播放一次停止播放
|
private int mType;//1:循环播放 2:播放一次停止播放
|
||||||
private File mFile;
|
private File mFile;
|
||||||
private final Queue<PlayItem> playQueue = new LinkedList<>();
|
private final BlockingQueue<PlayItem> playQueue = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
private boolean isPlaying = false;
|
private boolean isPlaying = false;
|
||||||
// 添加销毁标记
|
// 添加销毁标记
|
||||||
@@ -224,7 +226,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playNextFromQueue() {
|
public void playNextFromQueue() {
|
||||||
// if (isDestroyed) return;
|
// if (isDestroyed) return;
|
||||||
// 确保在主线程中执行
|
// 确保在主线程中执行
|
||||||
// if (Looper.myLooper() != Looper.getMainLooper()) {
|
// if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||||
@@ -238,33 +240,39 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 检查是否可以开始新的播放
|
// 检查是否可以开始新的播放
|
||||||
if (!playbackManager.canStartNewPlayback()) {
|
// if (!playbackManager.canStartNewPlayback()) {
|
||||||
Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");
|
// Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
PlayItem item = playQueue.poll();
|
if (!isPlaying || !isActuallyPlaying()) {
|
||||||
if (item != null) {
|
|
||||||
// 通知开始播放
|
|
||||||
playbackManager.onStartPlayback();
|
|
||||||
isPlaying = true;
|
|
||||||
|
|
||||||
// 处理播放项目
|
|
||||||
processPlayItem(item);
|
|
||||||
|
|
||||||
} else {
|
PlayItem item = playQueue.poll();
|
||||||
isPlaying = false;
|
if (item != null) {
|
||||||
Logger.d("AvatarFrameView", "Queue is empty, stop playing");
|
// 通知开始播放
|
||||||
|
playbackManager.onStartPlayback();
|
||||||
|
isPlaying = true;
|
||||||
|
|
||||||
|
// 处理播放项目
|
||||||
|
processPlayItem(item);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
isPlaying = false;
|
||||||
|
Logger.d("AvatarFrameView", "Queue is empty, stop playing");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加统一的播放完成处理方法
|
// 添加统一的播放完成处理方法
|
||||||
public void onPlaybackComplete() {
|
public void onPlaybackComplete() {
|
||||||
|
if (isDestroyed) return;
|
||||||
mainHandler.post(() -> {
|
mainHandler.post(() -> {
|
||||||
|
// 再次检查是否已销毁
|
||||||
if (isDestroyed) return;
|
if (isDestroyed) return;
|
||||||
|
|
||||||
// 通知播放管理器播放完成
|
// // 通知播放管理器播放完成
|
||||||
playbackManager.onFinishPlayback();
|
// playbackManager.onFinishPlayback();
|
||||||
|
|
||||||
// 重置播放状态
|
// 重置播放状态
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
@@ -280,19 +288,25 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
|
|
||||||
private void processPlayItem(PlayItem item) {
|
private void processPlayItem(PlayItem item) {
|
||||||
try {
|
try {
|
||||||
clearPrevious();
|
// clearPrevious();
|
||||||
|
|
||||||
String ext = getFileExtension(item.url);
|
String ext = getFileExtension(item.url);
|
||||||
if ("svga".equalsIgnoreCase(ext)) {
|
if ("svga".equalsIgnoreCase(ext)) {
|
||||||
renderType = RenderType.SVGA;
|
mainHandler.post(() -> {
|
||||||
mType = item.type;
|
renderType = RenderType.SVGA;
|
||||||
mBinding.playView.setVisibility(View.GONE);
|
mType = item.type;
|
||||||
loadSVGA(item.url);
|
if (mBinding != null) {
|
||||||
|
mBinding.playView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
loadSVGA(item.url);
|
||||||
|
} );
|
||||||
} else if ("mp4".equalsIgnoreCase(ext)) {
|
} else if ("mp4".equalsIgnoreCase(ext)) {
|
||||||
renderType = RenderType.MP4;
|
mainHandler.post(() -> {
|
||||||
mType = item.type;
|
renderType = RenderType.MP4;
|
||||||
mBinding.playView.setVisibility(View.VISIBLE);
|
mType = item.type;
|
||||||
downloadAndPlayMp4(item.url);
|
mBinding.playView.setVisibility(View.VISIBLE);
|
||||||
|
downloadAndPlayMp4(item.url);
|
||||||
|
} );
|
||||||
} else {
|
} else {
|
||||||
// 不支持的格式,直接完成
|
// 不支持的格式,直接完成
|
||||||
handlePlaybackComplete();
|
handlePlaybackComplete();
|
||||||
@@ -314,8 +328,11 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlaying(){
|
public boolean isPlaying() {
|
||||||
return mBinding.playView.isRunning();
|
if (mBinding!=null && mBinding.playView!=null) {
|
||||||
|
return mBinding.playView.isRunning();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
// 在 AvatarFrameView 类中添加以下代码
|
// 在 AvatarFrameView 类中添加以下代码
|
||||||
|
|
||||||
@@ -330,24 +347,12 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
mainHandler.post(() -> setSource(url, type2));
|
mainHandler.post(() -> setSource(url, type2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// // 检查内存状态
|
|
||||||
// if (isMemoryLow()) {
|
|
||||||
// LogUtils.w(TAG, "Low memory, skipping animation");
|
|
||||||
// clearQueue();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// 检查特效是否开启
|
|
||||||
// if (SpUtil.getOpenEffect() != 1) {
|
|
||||||
// // 特效关闭时清空队列并停止播放
|
|
||||||
// clearQueue();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 添加到播放队列
|
// 添加到播放队列
|
||||||
playQueue.add(new PlayItem(url, type2));
|
playQueue.add(new PlayItem(url, type2));
|
||||||
Logger.d("AvatarFrameView", "Added to queue, queue size: " + playQueue.size() + ", url: " + url);
|
Logger.d("AvatarFrameView", "Added to queue, queue size: " + playQueue.size() + ", url: " + url);
|
||||||
|
|
||||||
if (type2 == 3) {
|
if (type2 == 3 || type2 == 1) {
|
||||||
// playNextFromQueue();
|
// playNextFromQueue();
|
||||||
loadSVGA(url);
|
loadSVGA(url);
|
||||||
} else {
|
} else {
|
||||||
@@ -461,12 +466,22 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, IOException e) {
|
public void onFailure(Call call, IOException e) {
|
||||||
LogUtils.e("MP4下载失败: " + e.toString());
|
LogUtils.e("MP4下载失败: " + e.toString());
|
||||||
onPlaybackComplete();
|
mainHandler.post(() -> {
|
||||||
|
// 检查是否已销毁
|
||||||
|
if (!isDestroyed) {
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更简单的优化版本
|
// 更简单的优化版本
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(Call call, Response response) throws IOException {
|
||||||
|
// 在异步回调中首先检查是否已销毁
|
||||||
|
if (isDestroyed) {
|
||||||
|
LogUtils.w(TAG, "View destroyed before download completed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
LogUtils.d("@@@@", "onResponse" + Thread.currentThread().getName());
|
LogUtils.d("@@@@", "onResponse" + Thread.currentThread().getName());
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
try (ResponseBody responseBody = response.body()) {
|
try (ResponseBody responseBody = response.body()) {
|
||||||
@@ -493,31 +508,62 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
fos.flush();
|
fos.flush();
|
||||||
isTxk = true;
|
isTxk = true;
|
||||||
mainHandler.post(() -> {
|
mainHandler.post(() -> {
|
||||||
LogUtils.d("@@@@Thread", Thread.currentThread().getName());
|
// 关键:在执行UI操作前再次检查是否已销毁
|
||||||
playMp4File(file);
|
if (downloadedFile.exists()) {
|
||||||
|
LogUtils.d("@@@@Thread", Thread.currentThread().getName());
|
||||||
|
playMp4File(downloadedFile); // 使用正确的文件引用
|
||||||
|
} else {
|
||||||
|
LogUtils.w(TAG, "View destroyed or file not exist after download");
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogUtils.e("MP4文件保存失败: " + e.getMessage());
|
LogUtils.e("MP4文件保存失败: " + e.getMessage());
|
||||||
|
mainHandler.post(() -> {
|
||||||
|
if (!isDestroyed) {
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mainHandler.post(() -> onPlaybackComplete());
|
mainHandler.post(() -> {
|
||||||
|
if (!isDestroyed) {
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.e("MP4文件保存失败: " + e.getMessage());
|
LogUtils.e("MP4文件保存失败: " + e.getMessage());
|
||||||
mainHandler.post(() -> onPlaybackComplete());
|
mainHandler.post(() -> {
|
||||||
|
if (!isDestroyed) {
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LogUtils.e("MP4下载响应失败");
|
LogUtils.e("MP4下载响应失败");
|
||||||
mainHandler.post(() -> onPlaybackComplete());
|
mainHandler.post(() -> {
|
||||||
|
if (!isDestroyed) {
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
isTxk = true;
|
isTxk = true;
|
||||||
LogUtils.e("有缓存");
|
LogUtils.e("有缓存");
|
||||||
playMp4File(file);
|
mainHandler.post(() -> {
|
||||||
|
// 检查是否已销毁
|
||||||
|
if ( file.exists()) {
|
||||||
|
playMp4File(file);
|
||||||
|
} else {
|
||||||
|
LogUtils.w(TAG, "有缓存2222222222222");
|
||||||
|
// onPlaybackComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
// 直接播放缓存文件
|
// 直接播放缓存文件
|
||||||
// if (isTxk) {
|
// if (isTxk) {
|
||||||
// mBinding.playView.setLoop(1);
|
// mBinding.playView.setLoop(1);
|
||||||
@@ -528,8 +574,20 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
|
|
||||||
private void playMp4File(File file) {
|
private void playMp4File(File file) {
|
||||||
try {
|
try {
|
||||||
if (mBinding != null && file != null && file.exists()) {
|
// 双重检查确保组件未被销毁
|
||||||
// mBinding.playView.setAnimListener(new MP4PlaybackCallback());
|
if (isDestroyed) {
|
||||||
|
LogUtils.w(TAG, "Attempt to play MP4 file after view destroyed");
|
||||||
|
onPlaybackComplete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mBinding == null || mBinding.playView == null) {
|
||||||
|
LogUtils.w(TAG, "PlayView is null");
|
||||||
|
onPlaybackComplete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file != null && file.exists()) {
|
||||||
// 设置循环次数(根据mType决定)
|
// 设置循环次数(根据mType决定)
|
||||||
if (mType == 1) {
|
if (mType == 1) {
|
||||||
mBinding.playView.setLoop(0); // 无限循环
|
mBinding.playView.setLoop(0); // 无限循环
|
||||||
@@ -537,9 +595,15 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
mBinding.playView.setLoop(1); // 播放一次
|
mBinding.playView.setLoop(1); // 播放一次
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始播放
|
// 开始播放前检查视图状态
|
||||||
mBinding.playView.startPlay(file);
|
if (!isDestroyed && mBinding != null && mBinding.playView != null) {
|
||||||
|
mBinding.playView.startPlay(file);
|
||||||
|
} else {
|
||||||
|
LogUtils.w(TAG, "View was destroyed before MP4 playback started");
|
||||||
|
onPlaybackComplete();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
LogUtils.e("播放MP4文件出错: 文件不存在或已损坏");
|
||||||
onPlaybackComplete();
|
onPlaybackComplete();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1265,7 +1329,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
clearPrevious(); // 清除之前的动画
|
// clearPrevious(); // 清除之前的动画
|
||||||
svgaSurface.setVisibility(View.VISIBLE);
|
svgaSurface.setVisibility(View.VISIBLE);
|
||||||
new SVGAParser(getContext()).decodeFromAssets(assetName, new SVGAParser.ParseCompletion() {
|
new SVGAParser(getContext()).decodeFromAssets(assetName, new SVGAParser.ParseCompletion() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1363,7 +1427,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
|
|
||||||
// 内存检查
|
// 内存检查
|
||||||
if (playQueue.size() % 5 == 0) {
|
if (playQueue.size() % 5 == 0) {
|
||||||
performLightMemoryCleanup();
|
// performLightMemoryCleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 播放下一个
|
// 播放下一个
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
|||||||
|
|
||||||
setCardiac(pitBean.getCharm(), getTzbl());
|
setCardiac(pitBean.getCharm(), getTzbl());
|
||||||
setPitData(bean);
|
setPitData(bean);
|
||||||
if (bean.getIs_online() == 2){
|
if (bean.getIs_online() == 2 && bean.getUser_id()!=null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()){
|
||||||
iv_on_line.setVisibility(VISIBLE);
|
iv_on_line.setVisibility(VISIBLE);
|
||||||
}else {
|
}else {
|
||||||
iv_on_line.setVisibility(GONE);
|
iv_on_line.setVisibility(GONE);
|
||||||
|
|||||||
@@ -238,6 +238,16 @@ public class WheatLayoutManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateSingleCharm(RoomPitBean pitBean, int pitNumber) {
|
||||||
|
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||||
|
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||||
|
|
||||||
|
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||||
|
if (wheatView != null) {
|
||||||
|
wheatView.setCharm(pitBean.getCharm());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private RoomDefaultWheatView findWheatViewByPitNumber(int pitNumber) {
|
private RoomDefaultWheatView findWheatViewByPitNumber(int pitNumber) {
|
||||||
for (int i = 0; i < container.getChildCount(); i++) {
|
for (int i = 0; i < container.getChildCount(); i++) {
|
||||||
|
|||||||
@@ -402,6 +402,24 @@ public class WheatLayoutSingManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void upDataCharm(RoomPitBean pitBean, int pitNumber){
|
||||||
|
// 检查容器状态
|
||||||
|
if (container == null || !isContainerValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||||
|
|
||||||
|
// 如果是单个展示模式且不是当前麦位,不处理
|
||||||
|
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||||
|
|
||||||
|
RoomSingSongWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||||
|
if (wheatView != null) {
|
||||||
|
RoomPitBean bean = pitBean;
|
||||||
|
wheatView.setCharm(bean.getCharm()); // 刷新数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private RoomSingSongWheatView findWheatViewByPitNumber(int pitNumber) {
|
private RoomSingSongWheatView findWheatViewByPitNumber(int pitNumber) {
|
||||||
// 检查容器状态
|
// 检查容器状态
|
||||||
|
|||||||
@@ -35,8 +35,7 @@
|
|||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
app:layout_constraintHeight_percent="1"
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
app:layout_constraintWidth_percent="1.05"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/riv"
|
app:layout_constraintBottom_toBottomOf="@id/riv"
|
||||||
app:layout_constraintEnd_toEndOf="@id/riv"
|
app:layout_constraintEnd_toEndOf="@id/riv"
|
||||||
app:layout_constraintStart_toStartOf="@id/riv"
|
app:layout_constraintStart_toStartOf="@id/riv"
|
||||||
|
|||||||
@@ -370,6 +370,9 @@ public class HomePresenter extends BasePresenter<HomeContacts.View> implements H
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(ThemeBean themeBean) {
|
public void onNext(ThemeBean themeBean) {
|
||||||
|
if (MvpRef==null){
|
||||||
|
MvpRef = new WeakReference<>(mView);
|
||||||
|
}
|
||||||
MvpRef.get().getThemeData(themeBean);
|
MvpRef.get().getThemeData(themeBean);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ import com.xscm.moduleutil.utils.SystemUtils;
|
|||||||
import com.xscm.moduleutil.widget.AvatarFrameView;
|
import com.xscm.moduleutil.widget.AvatarFrameView;
|
||||||
import com.xscm.moduleutil.widget.CircularProgressView;
|
import com.xscm.moduleutil.widget.CircularProgressView;
|
||||||
import com.xscm.moduleutil.widget.CustomMusicFloatingView;
|
import com.xscm.moduleutil.widget.CustomMusicFloatingView;
|
||||||
|
import com.xscm.moduleutil.widget.GiftAnimView;
|
||||||
|
import com.xscm.moduleutil.widget.QXGiftPlayerManager;
|
||||||
import com.xscm.moduleutil.widget.SilentCountDownTimer;
|
import com.xscm.moduleutil.widget.SilentCountDownTimer;
|
||||||
import com.xscm.moduleutil.widget.ViewUtils;
|
import com.xscm.moduleutil.widget.ViewUtils;
|
||||||
import com.xscm.moduleutil.widget.floatingView.Floa;
|
import com.xscm.moduleutil.widget.floatingView.Floa;
|
||||||
@@ -158,6 +160,8 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -301,6 +305,61 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private View bgEffectView;
|
||||||
|
|
||||||
|
private void setupEffectView() {
|
||||||
|
if (bgEffectView == null) {
|
||||||
|
// 获取单例管理器
|
||||||
|
QXGiftPlayerManager manager = QXGiftPlayerManager.getInstance(getApplicationContext());
|
||||||
|
|
||||||
|
// 获取背景特效视图并添加到布局中
|
||||||
|
bgEffectView = manager.getDefaultBgEffectView();
|
||||||
|
// 找到 mBinding.svgaGift 的父容器
|
||||||
|
ViewParent parent = mBinding.svgaGift.getParent();
|
||||||
|
if (parent instanceof ViewGroup) {
|
||||||
|
ViewGroup parentViewGroup = (ViewGroup) parent;
|
||||||
|
|
||||||
|
// 将 bgEffectView 添加到父容器中,位置在 mBinding.svgaGift 之后
|
||||||
|
int index = parentViewGroup.indexOfChild(mBinding.svgaGift);
|
||||||
|
parentViewGroup.addView(bgEffectView);
|
||||||
|
|
||||||
|
// 设置布局参数 - 填满父视图
|
||||||
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
bgEffectView.setLayoutParams(params);
|
||||||
|
} else {
|
||||||
|
LogUtils.e("mBinding.svgaGift 没有有效的父容器");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取全屏特效视图
|
||||||
|
GiftAnimView fullEffectView = manager.getDefaultFullEffectView();
|
||||||
|
|
||||||
|
// 设置全屏特效视图的布局参数 - 居中并设置尺寸
|
||||||
|
FrameLayout.LayoutParams fullParams = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
fullParams.gravity = Gravity.CENTER;
|
||||||
|
fullEffectView.setLayoutParams(fullParams);
|
||||||
|
|
||||||
|
// 获取聊天特效视图
|
||||||
|
GiftAnimView chatEffectView = manager.getDefaultChatEffectView();
|
||||||
|
|
||||||
|
// 设置聊天特效视图的布局参数 - 底部居中并设置尺寸
|
||||||
|
FrameLayout.LayoutParams chatParams = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
chatParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
||||||
|
chatEffectView.setLayoutParams(chatParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从SharedPreferences获取是否关闭特效的设置
|
||||||
|
boolean isClose = SpUtil.getOpenEffect() != 1;
|
||||||
|
QXGiftPlayerManager.getInstance(getApplicationContext()).openOrCloseEffectViewWith(!isClose);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
@@ -317,7 +376,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
// }
|
// }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
///最小化
|
|
||||||
|
/// 最小化
|
||||||
private void showExitRoomDialog() {
|
private void showExitRoomDialog() {
|
||||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
|
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
|
||||||
bottomSheet.setOnOptionSelectedListener(new ExitRoomBottomSheet.OnOptionSelectedListener() {
|
bottomSheet.setOnOptionSelectedListener(new ExitRoomBottomSheet.OnOptionSelectedListener() {
|
||||||
@@ -446,18 +506,23 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public String doInBackground() throws Throwable {
|
// public String doInBackground() throws Throwable {
|
||||||
// LogUtils.e("@@@@" + "doInBackground"+"playQueue.size()===="+playQueue.size());
|
// if (mBinding.svgaGift.isPlaying()){
|
||||||
// if(!playQueue.isEmpty()){
|
// Thread.sleep(100); // 短暂等待
|
||||||
// return playQueue.poll();
|
// return "";
|
||||||
|
// }
|
||||||
|
// if(!roomMessageEventQueue.isEmpty()){
|
||||||
|
// Thread.sleep(100); // 短暂等待
|
||||||
|
// return roomMessageEventQueue.poll();
|
||||||
// }
|
// }
|
||||||
// return "";
|
// return "";
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public void onSuccess(String result) {
|
// public void onSuccess(String result) {
|
||||||
// LogUtils.e("@@@@" + "onSuccess"+"playQueue.size()===="+playQueue.size());
|
// LogUtils.e("@@@@" + "onSuccess"+"playQueue.size()===="+roomMessageEventQueue.size());
|
||||||
// if(!TextUtils.isEmpty(result)){
|
// if(!TextUtils.isEmpty(result)){
|
||||||
// mBinding.svgaGift.setSource(result, 2);
|
//// mBinding.svgaGift.setSource(result, 2);
|
||||||
|
// mBinding.svgaGift.downloadAndPlayMp4(result);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@@ -487,16 +552,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
// 在子线程中执行网络请求
|
// 在子线程中执行网络请求
|
||||||
performNetworkRequestsAsync();
|
performNetworkRequestsAsync();
|
||||||
|
|
||||||
// if (BuildConfig.DEBUG) {
|
|
||||||
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
|
|
||||||
// .detectDiskReads()
|
|
||||||
// .detectDiskWrites()
|
|
||||||
// .detectNetwork()
|
|
||||||
// .penaltyLog()
|
|
||||||
// .build());
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAndRestoreMinimizeState() {
|
private void checkAndRestoreMinimizeState() {
|
||||||
SharedPreferences prefs = getSharedPreferences("room_minimize_state", Context.MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences("room_minimize_state", Context.MODE_PRIVATE);
|
||||||
boolean isMinimized = prefs.getBoolean("is_minimized", false);
|
boolean isMinimized = prefs.getBoolean("is_minimized", false);
|
||||||
@@ -513,6 +571,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在子线程中执行网络请求,避免阻塞主线程
|
* 在子线程中执行网络请求,避免阻塞主线程
|
||||||
*/
|
*/
|
||||||
@@ -548,18 +607,6 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 网络请求前的准备工作
|
|
||||||
// */
|
|
||||||
// private void prepareNetworkRequest() {
|
|
||||||
// try {
|
|
||||||
// // 可以在这里做一些轻量级的预处理工作
|
|
||||||
// // 例如:检查网络状态、准备请求参数等
|
|
||||||
// LogUtils.d("Preparing network request for room: " + roomId);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// LogUtils.e("Error in prepareNetworkRequest: " + e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 提供安全的访问方法
|
// 提供安全的访问方法
|
||||||
public static RoomActivity getCurrentActivity() {
|
public static RoomActivity getCurrentActivity() {
|
||||||
@@ -632,11 +679,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
||||||
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
|
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
|
||||||
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
|
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
|
||||||
|
// MP4PlaybackCallback mp4PlaybackCallback=MP4PlaybackCallback.getInstance();
|
||||||
// ViewGroup.LayoutParams layoutParams2 = mBinding.vpRoomPager.getLayoutParams();
|
// mp4PlaybackCallback.setAvatarFrameView(mBinding.svgaGift);
|
||||||
// layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
// mBinding.svgaGift.setAnimListener(mp4PlaybackCallback);
|
||||||
// layoutParams.height = SystemUtils.getWidth(74); // 示例高度
|
|
||||||
// mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onGiftGiveProgressClcik() {
|
private void onGiftGiveProgressClcik() {
|
||||||
@@ -919,16 +964,26 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
private Runnable roomSwitchRunnable;
|
private Runnable roomSwitchRunnable;
|
||||||
private String pendingRoomId;
|
private String pendingRoomId;
|
||||||
private String lastSwitchedRoomId = "";
|
private String lastSwitchedRoomId = "";
|
||||||
|
private final Object roomMessageLock = new Object();
|
||||||
|
private BlockingQueue<String> roomMessageEventQueue = new LinkedBlockingQueue<>();
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||||||
if (messageEvent == null) return;
|
if (messageEvent == null) return;
|
||||||
|
|
||||||
|
|
||||||
int msgType = messageEvent.getMsgType();
|
int msgType = messageEvent.getMsgType();
|
||||||
RoomMessageEvent.T text = messageEvent.getText();
|
RoomMessageEvent.T text = messageEvent.getText();
|
||||||
|
|
||||||
if (msgType == 1005) {
|
if (msgType == 1005) {
|
||||||
handleMsgType1005(messageEvent, text);
|
LogUtils.e("@@@@" + "EventBusnujm2"+"playQueue.size()===="+ messageEvent.getText().getGiftInfo());
|
||||||
|
// synchronized (roomMessageLock) {
|
||||||
|
// roomMessageEventQueue.add(messageEvent.getText().getGiftInfo().getPlay_image());
|
||||||
|
// }
|
||||||
|
QXGiftPlayerManager.getInstance(this).displayFullEffectView(messageEvent.getText().getGiftInfo());
|
||||||
|
// handleMsgType1005(messageEvent, text);
|
||||||
|
hand1005(messageEvent, text);
|
||||||
} else if (msgType == 123) {
|
} else if (msgType == 123) {
|
||||||
EventBus.getDefault().post(new RoomSettingEvent());
|
EventBus.getDefault().post(new RoomSettingEvent());
|
||||||
} else if (msgType == 1014) {
|
} else if (msgType == 1014) {
|
||||||
@@ -1106,7 +1161,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
}
|
}
|
||||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
private Queue<String> playQueue = new LinkedList<>();
|
|
||||||
private static volatile MP4PlaybackCallback sInstance;
|
private static volatile MP4PlaybackCallback sInstance;
|
||||||
|
|
||||||
public static class MP4PlaybackCallback implements IAnimListener {
|
public static class MP4PlaybackCallback implements IAnimListener {
|
||||||
@@ -1127,6 +1182,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
}
|
}
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置外部引用的方法
|
// 设置外部引用的方法
|
||||||
public void setAvatarFrameView(AvatarFrameView view) {
|
public void setAvatarFrameView(AvatarFrameView view) {
|
||||||
this.avatarFrameView = view;
|
this.avatarFrameView = view;
|
||||||
@@ -1135,9 +1191,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
@Override
|
@Override
|
||||||
public void onFailed(int i, @Nullable String s) {
|
public void onFailed(int i, @Nullable String s) {
|
||||||
LogUtils.e("@@@", "MP4 playback failed: " + s);
|
LogUtils.e("@@@", "MP4 playback failed: " + s);
|
||||||
if (avatarFrameView != null) {
|
// if (avatarFrameView != null) {
|
||||||
avatarFrameView.onPlaybackComplete();
|
// avatarFrameView.onPlaybackComplete();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1159,10 +1215,11 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
public void onVideoComplete() {
|
public void onVideoComplete() {
|
||||||
LogUtils.e("@@@@" + "EventBus onVideoComplete");
|
LogUtils.e("@@@@" + "EventBus onVideoComplete");
|
||||||
|
|
||||||
if (avatarFrameView != null) {
|
// if (avatarFrameView != null) {
|
||||||
avatarFrameView.onPlaybackComplete();
|
// avatarFrameView.onPlaybackComplete();
|
||||||
}
|
// }
|
||||||
EventBus.getDefault().post(new GiftAvatarBean());
|
// avatarFrameView.playNextFromQueue();
|
||||||
|
// EventBus.getDefault().post(new GiftAvatarBean());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1172,26 +1229,24 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handleMsgType1005(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
private void handleMsgType1005(String url) {
|
||||||
|
|
||||||
|
if (SpUtil.getOpenEffect() == 1) {
|
||||||
|
// LogUtils.e("@@@@" + "handleMsgType1005"+"mBinding.svgaGift.isPlaying()===="+mBinding.svgaGift.isPlaying());
|
||||||
|
// mBinding.svgaGift.setSource(url, 2);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void hand1005(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||||
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
||||||
|
|
||||||
GiftBean giftInfo = text.getGiftInfo();
|
GiftBean giftInfo = text.getGiftInfo();
|
||||||
UserInfo toUserInfo = text.getToUserInfo();
|
UserInfo toUserInfo = text.getToUserInfo();
|
||||||
if (giftInfo == null || toUserInfo == null) return;
|
if (giftInfo == null || toUserInfo == null) return;
|
||||||
MP4PlaybackCallback mp4PlaybackCallback=MP4PlaybackCallback.getInstance();
|
|
||||||
mp4PlaybackCallback.setAvatarFrameView(mBinding.svgaGift);
|
|
||||||
mBinding.svgaGift.setAnimListener(mp4PlaybackCallback);
|
|
||||||
if (SpUtil.getOpenEffect() == 1) {
|
|
||||||
// 特效关闭时清空队列并停止播放
|
|
||||||
playQueue.add(giftInfo.getPlay_image());
|
|
||||||
LogUtils.e("@@@@" + "handleMsgType1005"+"playQueue.size()===="+playQueue.size());
|
|
||||||
|
|
||||||
if(!mBinding.svgaGift.isPlaying()){
|
|
||||||
LogUtils.e("@@@@" + "handleMsgType1005"+"mBinding.svgaGift.isPlaying()===="+mBinding.svgaGift.isPlaying());
|
|
||||||
mBinding.svgaGift.setSource(playQueue.poll(), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||||
if (pitList == null) return;
|
if (pitList == null) return;
|
||||||
|
|
||||||
@@ -1211,35 +1266,22 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
roomFragment.SingSongEvent(messageEvent);
|
roomFragment.SingSongEvent(messageEvent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if ("7".equals(typeId)) {//交友房
|
||||||
else if ("7".equals(typeId)) {//交友房
|
|
||||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||||
return;
|
return;
|
||||||
// for (RoomPitBean roomPitBean : pitList) {
|
|
||||||
// if (roomPitBean.getUser_id().equals(toUserInfo.getUser_id() + "")) {
|
|
||||||
// roomPitBean.setCharm(toUserInfo.getCharm());
|
|
||||||
// try {
|
|
||||||
// pitList.set(Integer.parseInt(roomPitBean.getPit_number()) - 1, roomPitBean);
|
|
||||||
// } catch (NumberFormatException e) {
|
|
||||||
// // Handle exception
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
// public void handleGiftAvatarBean(GiftAvatarBean giftAvatarBean) {
|
||||||
public void handleGiftAvatarBean(GiftAvatarBean giftAvatarBean) {
|
// LogUtils.e("@@@@" + "EventBus2222222"+"playQueue.size()===="+roomMessageEventQueue.size());
|
||||||
LogUtils.e("@@@@" + "EventBus2222222"+"playQueue.size()===="+playQueue.size());
|
// if(!roomMessageEventQueue.isEmpty()){
|
||||||
if(!playQueue.isEmpty()){
|
// String payUrl=roomMessageEventQueue.poll();
|
||||||
String payUrl=playQueue.poll();
|
//// if(!mBinding.svgaGift.isPlaying()){
|
||||||
if(!mBinding.svgaGift.isPlaying()){
|
//// mBinding.svgaGift.setSource(payUrl, 2);
|
||||||
mBinding.svgaGift.setSource(payUrl, 2);
|
//// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
private void handleMsgType1014(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
private void handleMsgType1014(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||||
if (text == null) return;
|
if (text == null) return;
|
||||||
@@ -1931,10 +1973,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void setEffectSwitch(EffectEvent event) {
|
public void setEffectSwitch(EffectEvent event) {
|
||||||
if (event.isEffectOn()) {//特效开启
|
if (event.isEffectOn()) {//特效开启
|
||||||
|
QXGiftPlayerManager.getInstance(this).openOrCloseEffectViewWith(true);
|
||||||
mBinding.svgaGift.setVisibility(View.VISIBLE);
|
mBinding.svgaGift.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
// mBinding.svgaGift.closeEffect();
|
// mBinding.svgaGift.closeEffect();
|
||||||
mBinding.svgaGift.closeEffect();
|
// mBinding.svgaGift.closeEffect();
|
||||||
|
QXGiftPlayerManager.getInstance(this).openOrCloseEffectViewWith(false);
|
||||||
mBinding.svgaGift.setVisibility(View.GONE);
|
mBinding.svgaGift.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1950,7 +1994,11 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (roomJoinMountModel.getShow_type() != 1) {
|
if (roomJoinMountModel.getShow_type() != 1) {
|
||||||
mBinding.svgaZuoji.setSource(roomJoinMountModel.getRide_url(), 2);
|
GiftBean gift = new GiftBean();
|
||||||
|
gift.setGift_id("");
|
||||||
|
gift.setPlay_image(roomJoinMountModel.getRide_url());
|
||||||
|
QXGiftPlayerManager.getInstance(this).displayChatEffectView(gift);
|
||||||
|
// mBinding.svgaZuoji.setSource(roomJoinMountModel.getRide_url(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2148,6 +2196,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加前后台状态检测
|
// 添加前后台状态检测
|
||||||
private boolean isAppInForeground() {
|
private boolean isAppInForeground() {
|
||||||
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
@@ -2620,13 +2669,6 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
AgoraManager.getInstance(this).setBjMusic(true);
|
AgoraManager.getInstance(this).setBjMusic(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ((roomBean.getType_id().equals("1") && roomBean.getLabel_id().equals("2")) || (roomBean.getType_id().equals("3") && roomBean.getLabel_id().equals("2")
|
|
||||||
// || (roomBean.getType_id().equals("4") && roomBean.getLabel_id().equals("2")))) {
|
|
||||||
// AgoraManager.getInstance(this).setBjMusic(false);
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// AgoraManager.getInstance(this).setBjMusic(true);
|
|
||||||
// }
|
|
||||||
AgoraManager.getInstance(this).stopMuisc();
|
AgoraManager.getInstance(this).stopMuisc();
|
||||||
initializeAudio();
|
initializeAudio();
|
||||||
|
|
||||||
@@ -2634,11 +2676,6 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
toutiao();
|
toutiao();
|
||||||
upRoomInfo(resp);
|
upRoomInfo(resp);
|
||||||
|
|
||||||
// if (mRoomInfoResp.getUser_info().getPit_number() == 9 && mRoomInfoResp.getUser_info().getUser_id().equals(SpUtil.getUserId() + "")) {
|
|
||||||
// mBinding.roomTop.rl.setVisibility(View.VISIBLE);
|
|
||||||
// } else {
|
|
||||||
// mBinding.roomTop.rl.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (userIds.length() > 0 && roomId != null) {
|
if (userIds.length() > 0 && roomId != null) {
|
||||||
// MvpPre.userOnlineStatus(userIds.toString(), roomId);
|
// MvpPre.userOnlineStatus(userIds.toString(), roomId);
|
||||||
@@ -2653,6 +2690,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
} else {
|
} else {
|
||||||
mBinding.roomTop.rl.setVisibility(View.GONE);
|
mBinding.roomTop.rl.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupEffectView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void instView() {//隐藏视图
|
private void instView() {//隐藏视图
|
||||||
@@ -2954,6 +2993,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resumeRoomState() {
|
private void resumeRoomState() {
|
||||||
// 恢复房间相关状态
|
// 恢复房间相关状态
|
||||||
if (MvpPre != null && roomId != null) {
|
if (MvpPre != null && roomId != null) {
|
||||||
@@ -3225,7 +3265,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
// finish();
|
// finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void quit(){
|
public void quit() {
|
||||||
CommonAppContext.getInstance().isPlaying = false;
|
CommonAppContext.getInstance().isPlaying = false;
|
||||||
CommonAppContext.getInstance().isShow = false;
|
CommonAppContext.getInstance().isShow = false;
|
||||||
AgoraManager.getInstance(this).stopScreenCapture();
|
AgoraManager.getInstance(this).stopScreenCapture();
|
||||||
@@ -3380,6 +3420,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
// 移除所有 OnClickListener 防止内存泄漏
|
// 移除所有 OnClickListener 防止内存泄漏
|
||||||
clearClickListeners();
|
clearClickListeners();
|
||||||
}
|
}
|
||||||
|
roomMessageEventQueue.clear();
|
||||||
|
ThreadUtils.cancel();
|
||||||
|
QXGiftPlayerManager.getInstance(getApplicationContext()).destroyEffectSvga();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.e("cleanupResources error: " + e.getMessage());
|
LogUtils.e("cleanupResources error: " + e.getMessage());
|
||||||
@@ -3419,11 +3462,11 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
|||||||
try {
|
try {
|
||||||
if (mBinding != null) {
|
if (mBinding != null) {
|
||||||
if (mBinding.svgaGift != null) {
|
if (mBinding.svgaGift != null) {
|
||||||
mBinding.svgaGift.release();
|
// mBinding.svgaGift.release();
|
||||||
}
|
|
||||||
if (mBinding.svgaZuoji != null) {
|
|
||||||
mBinding.svgaZuoji.release();
|
|
||||||
}
|
}
|
||||||
|
// if (mBinding.svgaZuoji != null) {
|
||||||
|
// mBinding.svgaZuoji.release();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.e("clearSVGAResources error: " + e.getMessage());
|
LogUtils.e("clearSVGAResources error: " + e.getMessage());
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getvjs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -247,7 +247,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
public void initOverlayButtons() {
|
public void initOverlayButtons() {
|
||||||
// if (isButtonsInflated) return;
|
// if (isButtonsInflated) return;
|
||||||
|
|
||||||
stub = requireActivity().findViewById(R.id.stub_buttons);
|
stub = requireActivity().findViewById(R.id.stub_buttons2);
|
||||||
if (stub != null) {
|
if (stub != null) {
|
||||||
View inflated = stub.inflate();
|
View inflated = stub.inflate();
|
||||||
|
|
||||||
|
|||||||
@@ -438,7 +438,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||||
((RoomActivity) getActivity()).setvisibTop(false);
|
((RoomActivity) getActivity()).setvisibTop(false);
|
||||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||||
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
|
if (mRoomInfoResp.getRoom_info().getRoom_background()==null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
|
||||||
|
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
|
||||||
|
}else {
|
||||||
|
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||||
|
}
|
||||||
((RoomActivity) getActivity()).setvisibTop(true);
|
((RoomActivity) getActivity()).setvisibTop(true);
|
||||||
} else {
|
} else {
|
||||||
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import android.view.ViewGroup;
|
|||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
|
import android.widget.PopupWindow;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.ToastUtils;
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
@@ -835,17 +836,17 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
|||||||
RoomPitBean pitBean = mBinding.muYc.pitBean;
|
RoomPitBean pitBean = mBinding.muYc.pitBean;
|
||||||
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(pitBean.getUser_id())) {
|
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(pitBean.getUser_id())) {
|
||||||
pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||||||
mBinding.muYc.setData(pitBean);
|
mBinding.muYc.setCharm(pitBean.getCharm());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(mBinding.muZc.pitBean.getUser_id())) {
|
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(mBinding.muZc.pitBean.getUser_id())) {
|
||||||
mBinding.muZc.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
mBinding.muZc.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||||||
mBinding.muZc.setData(mBinding.muZc.pitBean);
|
mBinding.muZc.setCharm(mBinding.muZc.pitBean.getCharm());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(mBinding.muJb.pitBean.getUser_id())) {
|
if ((messageEvent.getText().getToUserInfo().getUser_id() + "").equals(mBinding.muJb.pitBean.getUser_id())) {
|
||||||
mBinding.muJb.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
mBinding.muJb.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||||||
mBinding.muJb.setData(mBinding.muJb.pitBean);
|
mBinding.muJb.setCharm(mBinding.muJb.pitBean.getCharm());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < roomInfoResp.getSong_pit_list().size(); i++) {
|
for (int i = 0; i < roomInfoResp.getSong_pit_list().size(); i++) {
|
||||||
|
|||||||
@@ -1375,21 +1375,21 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
|||||||
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||||
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||||
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||||
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
wheatLayoutSingManager.upDataCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
|
for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
|
||||||
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||||
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||||
wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||||
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||||
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,23 +342,32 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- </ScrollView>-->
|
<!-- </ScrollView>-->
|
||||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
<View
|
||||||
android:id="@+id/svga_gift"
|
android:id="@+id/svga_gift"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:background="@color/transparent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||||
|
<!-- android:id="@+id/svga_gift"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="0dp"-->
|
||||||
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||||
android:id="@+id/svga_zuoji"
|
<!-- android:id="@+id/svga_zuoji"-->
|
||||||
android:layout_width="0dp"
|
<!-- android:layout_width="0dp"-->
|
||||||
android:layout_height="0dp"
|
<!-- android:layout_height="0dp"-->
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
<!--礼物连送图标-->
|
<!--礼物连送图标-->
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|||||||
@@ -522,14 +522,14 @@
|
|||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
<ViewStub
|
<!-- <ViewStub-->
|
||||||
android:id="@+id/stub_buttons"
|
<!-- android:id="@+id/stub_buttons"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout="@layout/top_overlay_buttons"
|
<!-- android:layout="@layout/top_overlay_buttons"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||||
android:visibility="gone"/>
|
<!-- android:visibility="gone"/>-->
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -317,7 +317,7 @@
|
|||||||
android:layout_marginTop="-55dp"
|
android:layout_marginTop="-55dp"
|
||||||
android:layout_marginEnd="@dimen/dp_5"
|
android:layout_marginEnd="@dimen/dp_5"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:elevation="10dp"
|
android:elevation="9999dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:translationZ="30dp"
|
android:translationZ="30dp"
|
||||||
|
|||||||
@@ -198,7 +198,8 @@
|
|||||||
android:layout_marginStart="@dimen/dp_12"
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
android:background="@drawable/bg_r73_33fffff"
|
android:background="@drawable/bg_r73_33fffff"
|
||||||
android:layout_toEndOf="@id/btn_notice"
|
android:layout_toEndOf="@id/btn_notice"
|
||||||
android:visibility="gone">
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/im_qc"
|
android:id="@+id/im_qc"
|
||||||
@@ -229,11 +230,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_toEndOf="@+id/rl"
|
android:layout_toEndOf="@+id/rl"
|
||||||
android:layout_marginTop="@dimen/dp_40"
|
android:layout_alignTop="@id/btn_notice"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:layout="@layout/top_overlay_buttons"
|
android:layout="@layout/top_overlay_buttons"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -33,7 +33,7 @@ public class ZhuangBanShangChengAdapter extends BaseQuickAdapter<ZhuangBanShangC
|
|||||||
ThemeableDrawableUtils.setThemeableRoundedBackground( tv_integral, ColorManager.getInstance().getPrimaryColorInt(), corners);
|
ThemeableDrawableUtils.setThemeableRoundedBackground( tv_integral, ColorManager.getInstance().getPrimaryColorInt(), corners);
|
||||||
tv_integral.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
tv_integral.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||||
|
|
||||||
helper.setText(R.id.integral, item.getRemaining_day())
|
helper.setText(R.id.integral, item.getRemaining_day()+"天")
|
||||||
.setText(R.id.tv_name_period, item.getTitle());
|
.setText(R.id.tv_name_period, item.getTitle());
|
||||||
// .setText(R.id.tv_time, "(有效期${item.period}天)")
|
// .setText(R.id.tv_time, "(有效期${item.period}天)")
|
||||||
if (item.isIs_select()) {
|
if (item.isIs_select()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user