diff --git a/app/src/main/java/com/yizhuan/habu/ui/setting/SettingActivity.kt b/app/src/main/java/com/yizhuan/habu/ui/setting/SettingActivity.kt index 53ce3df1c..e59cf48b6 100644 --- a/app/src/main/java/com/yizhuan/habu/ui/setting/SettingActivity.kt +++ b/app/src/main/java/com/yizhuan/habu/ui/setting/SettingActivity.kt @@ -220,5 +220,8 @@ class SettingActivity : BaseViewBindingActivity(), View. // RedPackageOpenDialog2().show(this) // val json = "{\"first\":3,\"second\":32,\"data\":{\"recvUserUid\":2735,\"recvUserAvatar\":\"https://img.pekolive.com/default_avatar.png\",\"recvUserNick\":\"66丢丢丢丢丢多多多的hhhh\",\"sendUserNick\":\"11的ass\",\"sendUserAvatar\":\"http://beta.img.pekolive.com/Fk7aur-1RBqKXC-qqBwMTjivZ3lV?imageslim\",\"sendUserUid\":2737,\"giftUrl\":\"http://beta.img.pekolive.com/Fn6h_gPFD5MwA-Ql_kcWqNpKp0JM?imageslim\",\"giftName\":\"幽靈糖果\",\"giftId\":2075,\"giftNum\":${Random.nextInt(1,1000)},\"giftGolds\":33440,\"notifyStaySecond\":5,\"isHomeShow\":true,\"isSkipRoom\":true,\"isFullScreen\":false,\"isSendMsg\":false,\"roomUid\":2737,\"roomErbanNo\":11,\"roomTitle\":\"11的工会\",\"levelNum\":${Random.nextInt(1,4)}}}" // onReceivedNimBroadcastMessage(json) + val json = "{\"first\":85,\"second\":855,\"data\":{\"nick\":\"66丢丢丢丢丢多多多的hhhh\",\"preVipName\":\"子爵\",\"floatPic\":\"https://image.hfighting.com/Fq3JtbK2acO3FN-3vWZo8ldtHfse\",\"uid\":2735,\"currVipName\":\"侯爵\",\"erbanNo\":66,\"roomUid\":2734,\"avatar\":\"https://img.pekolive.com/default_avatar.png\",\"currVipLevel\":5}}" + onReceivedNimBroadcastMessage(json) +// CommonWebViewActivity.start(this,"https://api.anan.chat/anan_vestBag/modules/myincome/index.html#/DiamondLog") } } \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/habu/ui/widget/dialog/AllServiceVipLevelUPDialog.java b/app/src/main/java/com/yizhuan/habu/ui/widget/dialog/AllServiceVipLevelUPDialog.java index 3153e819c..0d4934eab 100644 --- a/app/src/main/java/com/yizhuan/habu/ui/widget/dialog/AllServiceVipLevelUPDialog.java +++ b/app/src/main/java/com/yizhuan/habu/ui/widget/dialog/AllServiceVipLevelUPDialog.java @@ -16,6 +16,7 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; +import com.chuhai.utils.ServiceTime; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGADynamicEntity; import com.opensource.svgaplayer.SVGAImageView; @@ -41,6 +42,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog { private final VipMessageInfo vipMessageInfo; private DialogVipAllServiceLevelUpBinding binding; + private long startTime = 0; + private int frameCount = 0; public AllServiceVipLevelUPDialog(Context context, @NonNull VipMessageInfo vipMessageInfo) { super(context, R.style.FullScreenDialog); @@ -77,7 +80,7 @@ public class AllServiceVipLevelUPDialog extends BaseDialog { .append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_01), new ForegroundColorSpan(Color.WHITE)) .append("-", new CircleImageSpan(new ColorDrawable(Color.TRANSPARENT), vipMessageInfo.getAvatar(), 50, 50)) .append(" " + StringExtensionKt.sub(vipMessageInfo.getNick(), 6) + " ", new ForegroundColorSpan(getContext().getResources().getColor(R.color.notice_nick))) - .append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_02) + vipMessageInfo.getCurrVipName(), new ForegroundColorSpan(Color.WHITE)+"!"); + .append(ResUtil.getString(R.string.widget_dialog_allserviceviplevelupdialog_02) + vipMessageInfo.getCurrVipName(), new ForegroundColorSpan(Color.WHITE) + "!"); SVGAImageView svgaImageView = new SVGAImageView(getContext()); svgaImageView.setLoops(1); @@ -87,7 +90,19 @@ public class AllServiceVipLevelUPDialog extends BaseDialog { svgaImageView.setCallback(new SimpleSvgaCallback() { @Override public void onFinished() { - closeSelf(); + long offset = ServiceTime.INSTANCE.getTime() - startTime; + if (offset < 6000) { + int centerFrame = frameCount / 2; + if (centerFrame > 0) { + // 目前的SVGA资源最后一帧是半透明的,这里强制跳到中间帧,最大程度避免这种情况 + svgaImageView.stepToFrame(centerFrame, false); + } + svgaImageView.postDelayed(() -> { + closeSelf(); + }, 6000 - offset); + } else { + closeSelf(); + } } }); binding.flSvgaVipNotify.addView(svgaImageView); @@ -95,6 +110,8 @@ public class AllServiceVipLevelUPDialog extends BaseDialog { SVGAParser.Companion.shareParser().decodeFromURL(new URL(vipMessageInfo.getFloatPic()), new SVGAParser.ParseCompletion() { @Override public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) { + frameCount = svgaVideoEntity.getFrames(); + startTime = ServiceTime.INSTANCE.getTime(); SVGADynamicEntity dynamicEntity = new SVGADynamicEntity(); TextPaint textPaint = new TextPaint(); textPaint.setColor(Color.WHITE);//字体颜色