1:修改家族展示续签按钮位置

2:修改购买爵位前,先请求一次接口
3:修改所有CP更改为心动
4:修改挚友,初始获取数据变更成40条
5:未实名认证不能进行歌手认证
This commit is contained in:
2025-12-04 15:20:05 +08:00
parent 0f0c2d97cc
commit 46b0a856fe
11 changed files with 155 additions and 159 deletions

View File

@@ -41,8 +41,8 @@ class MyFamilyBean {
var nobility_image: String = "" //贵族
var nickname_color: String = "" //贵族颜色
var free_renewal: Int = 0 //免费续签次数
var today_earnings: String = "" //今日收礼收益
var yesterday_earnings: String = "" //昨日收礼收益
var today_earnings: Double = 0.0 //今日收礼收益
var yesterday_earnings: Double = 0.0 //昨日收礼收益
var is_online: Int = 0 //是否在线 1在线 0离线
var is_show_sign: Int = 0 //是否显示续约按钮 1显示 0不显示

View File

@@ -228,6 +228,9 @@ public class RoomCPView extends FrameLayout {
isLoadEffect = false;
// 标记动画已停止运行
isAnimationRunning = false;
// 清除播放器缓存
clearPlayerCache();
} finally {
lock.unlock();
}
@@ -237,7 +240,7 @@ public class RoomCPView extends FrameLayout {
}
// 继续播放下一个动画
loadStartAnimation();
processNextAnimation();
}, 100); // 添加100毫秒的延迟
}
});
@@ -295,7 +298,7 @@ public class RoomCPView extends FrameLayout {
}
// 继续播放下一个
loadStartAnimation();
processNextAnimation();
});
}
});
@@ -352,10 +355,9 @@ public class RoomCPView extends FrameLayout {
}
/**
* 加载并开始播放动画
* 从动画队列中取出下一个动画进行播放
* 处理并播放队列中的下一个动画
*/
private void loadStartAnimation() {
private void processNextAnimation() {
// 检查是否开启特效
if (!isShow) {
return;
@@ -368,75 +370,68 @@ public class RoomCPView extends FrameLayout {
return;
}
String animationPath = null;
// 对动画列表加锁
lock.lock();
try {
// 检查动画队列是否为空
if (!animationArray.isEmpty()) {
// 获取队列中的第一个动画路径
animationPath = animationArray.get(0);
// 从队列中移除已获取的动画
animationArray.remove(0);
// 设置状态标记
isLoadEffect = true;
isAnimationRunning = true;
} else {
// 队列为空,重置状态并释放资源
isLoadEffect = false;
post(() -> {
destroyEffectView();
});
}
} finally {
// 解锁
lock.unlock();
// 检查动画队列是否为空
if (animationQueue.isEmpty()) {
// 队列为空,重置状态并释放资源
isLoadEffect = false;
post(() -> {
destroyEffectView();
});
return;
}
// 如果有动画需要播放
if (isLoadEffect && animationPath != null && !TextUtils.isEmpty(animationPath)) {
String finalAnimationPath = animationPath;
post(new Runnable() {
@Override
public void run() {
// 处理MP4动画文件可能是网络URL
handleMP4File(finalAnimationPath, new DownloadCallback() {
@Override
public void onSuccess(String localPath) {
post(() -> {
// 设置当前播放路径
currPlayPath = localPath;
// 启动从底部弹起动画
startBottomUpAnimation();
// 设置播放次数为1次
anim_cp.setLoop(1);
});
}
// 获取并移除队列中的第一个动画任务
AnimationTask task = animationQueue.poll();
if (task == null) {
return;
}
@Override
public void onError(String error) {
LogUtils.e("MP4下载或播放失败: " + error);
// 处理失败情况,继续播放下一个
post(() -> {
// 使用动画队列锁确保线程安全
synchronized (animationLock) {
lock.lock();
try {
// 重置状态标记
isLoadEffect = false;
isAnimationRunning = false;
} finally {
lock.unlock();
}
}
// 尝试播放下一个动画
loadStartAnimation();
});
// 设置状态标记
isLoadEffect = true;
isAnimationRunning = true;
// 设置CP数据
setCPTextData(task.room_head1, task.room_head2, task.room_cp_name1, task.room_cp_name2);
// 确保视图可见
setVisibility(View.VISIBLE);
// 处理动画文件
String animationPath = task.mp4Path;
if (animationPath != null && !TextUtils.isEmpty(animationPath)) {
post(() -> {
// 处理MP4动画文件可能是网络URL
handleMP4File(animationPath, new DownloadCallback() {
@Override
public void onSuccess(String localPath) {
post(() -> {
// 设置当前播放路径
currPlayPath = localPath;
// 启动从底部弹起动画
startBottomUpAnimation();
// 设置播放次数为1次
anim_cp.setLoop(1);
});
}
@Override
public void onError(String error) {
LogUtils.e("MP4下载或播放失败: " + error);
// 处理失败情况,继续播放下一个
synchronized (animationLock) {
lock.lock();
try {
// 重置状态标记
isLoadEffect = false;
isAnimationRunning = false;
} finally {
lock.unlock();
}
}
});
}
// 尝试播放下一个动画
processNextAnimation();
}
});
});
}
}
@@ -457,58 +452,18 @@ public class RoomCPView extends FrameLayout {
// 确保视图已初始化
reinitView();
// 设置CP数据
setCPTextData(room_head1, room_head2, room_name1, room_name2);
// 创建动画任务并添加到队列
AnimationTask task = new AnimationTask(room_head1, room_head2, room_name1, room_name2, mp4Path, null);
// 注释:确保头像初始为隐藏状态(如需要可取消注释)
// room_cp_head1.setVisibility(View.GONE);
// room_cp_head2.setVisibility(View.GONE);
// room_cp_name1.setVisibility(View.GONE);
// room_cp_name2.setVisibility(View.GONE);
// 使用动画队列锁确保线程安全
synchronized (animationLock) {
animationQueue.offer(task);
// 确保视图可见
setVisibility(View.VISIBLE);
// 检查队列是否已初始化
if (queue == null) {
queue = Executors.newSingleThreadExecutor();
}
// 在后台线程中处理动画
queue.execute(new Runnable() {
@Override
public void run() {
// 检查动画路径是否有效
if (mp4Path == null || mp4Path.isEmpty()) {
return;
}
// 获取文件扩展名并转为小写
String playImage = mp4Path;
String pathExtension = getFileExtension(playImage).toLowerCase();
// 检查文件格式是否支持仅支持svga和mp4
if (!("svga".equals(pathExtension) || "mp4".equals(pathExtension))) {
return;
}
// 对动画列表加锁
lock.lock();
try {
// 将动画路径添加到队列
animationArray.add(playImage);
// 如果当前没有动画在加载,则开始加载新动画
if (!isLoadEffect) {
isLoadEffect = true;
loadStartAnimation();
}
} finally {
// 解锁
lock.unlock();
}
// 如果当前没有动画在播放,则开始播放队列中的第一个动画
if (!isAnimationRunning) {
processNextAnimation();
}
});
}
}
@@ -805,7 +760,7 @@ public class RoomCPView extends FrameLayout {
synchronized (animationLock) {
lock.lock();
try {
animationArray.clear();
animationQueue.clear();
isLoadEffect = false;
// 重置动画运行状态
isAnimationRunning = false;
@@ -1011,6 +966,19 @@ public class RoomCPView extends FrameLayout {
}
}
/**
* 清除播放器缓存
* 清除当前播放的视频缓存,但不删除已下载的文件
*/
private void clearPlayerCache() {
if (anim_cp != null) {
// 停止当前播放
anim_cp.stopPlay();
// 重置当前播放路径
currPlayPath = "";
}
}
/**
* 重新初始化视图,以便再次播放
*/
@@ -1030,6 +998,7 @@ public class RoomCPView extends FrameLayout {
// 重置状态
isLoadEffect = false;
isAnimationRunning = false;
isShow = true;
}
@@ -1057,6 +1026,11 @@ public class RoomCPView extends FrameLayout {
queue = null;
}
// 清空动画队列
synchronized (animationLock) {
animationQueue.clear();
}
// 隐藏并移除整个视图
setVisibility(View.GONE);
if (getParent() != null) {