This commit is contained in:
2025-11-12 16:40:26 +08:00
parent d4721faa42
commit 8013268816
332 changed files with 12369 additions and 522 deletions

View File

@@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.blankj.utilcode.util.LogUtils;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
@@ -41,6 +42,10 @@ import com.xscm.moduleutil.utils.logger.Logger;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import java.net.MalformedURLException;
import java.net.URL;
public abstract class BaseWheatView extends ConstraintLayout implements IBaseWheat {
public ImageView mRiv;
@@ -78,9 +83,14 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
private boolean showGiftAnim = true;//显示麦位动画
private ImageView iv_tag_type;
// 当前音量监听器,用于防止重复添加
private SoundLevelUpdateListener currentSoundLevelListener;
private TextView tv_zhul;
private SVGAParser parser = new SVGAParser(getContext());
private SVGAParser mParser;
private final SVGAParser parser = new SVGAParser(CommonAppContext.getInstance());
public BaseWheatView(Context context) {
@@ -237,7 +247,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
} else {
iv_tag_type.setVisibility(GONE);
}
AgoraManager.getInstance(getContext()).addSoundLevelListener(new SoundLevelUpdateListener() {
AgoraManager.getInstance().addSoundLevelListener(new SoundLevelUpdateListener() {
@Override
public void onRemoteSoundLevelUpdate(String userId, int soundLevel) {
if (mIvRipple == null)
@@ -250,9 +260,40 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
mIvRipple.setVisibility(INVISIBLE);
} else {
mIvRipple.setVisibility(VISIBLE);
mIvRipple.startAnimation();
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
iv_on_line.setVisibility(GONE);
mIvRipple.post(() -> {
if (!mIvRipple.isAnimating()) {
if (pitBean.getMic_cycle() != null && !pitBean.getMic_cycle().isEmpty()) {
if (mParser != null) {
mIvRipple.startAnimation();
} else {
mParser = new SVGAParser(getContext());
try {
mParser.decodeFromURL(new URL(pitBean.getMic_cycle()), new SVGAParser.ParseCompletion() {
@Override
public void onError() {
}
@Override
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
mIvRipple.setImageDrawable(drawable);
mIvRipple.startAnimation();
}
});
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
} else {
mIvRipple.startAnimation();
}
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
iv_on_line.setVisibility(GONE);
}
});
}
}
}
@@ -266,7 +307,34 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
} else {
mIvRipple.setVisibility(VISIBLE);
if (!mIvRipple.isAnimating()) {
mIvRipple.startAnimation();
if (pitBean.getMic_cycle()!=null && !pitBean.getMic_cycle().isEmpty()) {
if (mParser != null) {
mIvRipple.startAnimation();
} else {
mParser = new SVGAParser(getContext());
try {
mParser.decodeFromURL(new URL(pitBean.getMic_cycle()), new SVGAParser.ParseCompletion() {
@Override
public void onError() {
}
@Override
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
mIvRipple.setImageDrawable(drawable);
mIvRipple.startAnimation();
}
});
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}else {
mIvRipple.startAnimation();
}
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
iv_on_line.setVisibility(GONE);
}
@@ -456,7 +524,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
@Override
public void unRegister(Object obj) {
AgoraManager.getInstance(getContext()).removeSoundLevelListener(this);
AgoraManager.getInstance().removeSoundLevelListener(this);
}