1:修改K歌房

This commit is contained in:
2025-10-27 09:43:19 +08:00
parent 8ebe1530ee
commit 8631fdbdbf
20 changed files with 208 additions and 131 deletions

View File

@@ -78,6 +78,9 @@ public class GiftDisplayManager {
}
public void receiveGift(GiftBean gift) {
if (isInBackground){
return;
}
if (gift == null) return;
Log.d("GiftDisplayManager", "Received gift: " + gift.getSenderName() +
@@ -201,6 +204,20 @@ public class GiftDisplayManager {
// 立即处理队列,而不是延迟
mainHandler.post(this::processGiftQueue);
}
private boolean isInBackground=false;
public void isBackGround(){
for (GiftDisplayView view : displayViews) {
view.finishAnimationImmediately();
}
giftQueue.clear();
accumulatedGifts.clear();
isProcessingQueue = false;
isInBackground=true;
}
public void becomeFront(){
isInBackground=false;
}
public void clearAll() {
Log.d("GiftDisplayManager", "Clear all gifts and queue");

View File

@@ -124,7 +124,9 @@ public class GiftDisplayView extends FrameLayout {
// 临时用颜色代替
// avatarImageView.setBackgroundColor(getRandomColor());
ImageUtils.loadHeadCC(avatarUrl, avatarImageView);
if (avatarImageView!=null&&avatarImageView.getContext()!=null) {
ImageUtils.loadHeadCC(avatarUrl, avatarImageView);
}
} else {
avatarImageView.setBackgroundColor(Color.LTGRAY);
}