From 1935ac14f00ebe608cb93d3cfa74344c613fab97 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 19 Sep 2022 17:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E5=BC=80=E9=80=9A?= =?UTF-8?q?=E8=B4=B5=E6=97=8F=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/weight/NobleNoticeView.java | 21 ++++++++++- .../live/activity/LiveAudienceActivity.java | 2 +- .../live/activity/ZhuangBanActivity.java | 36 +++++++++++++++---- .../yunbao/live/views/LiveRoomViewHolder.java | 21 +++++++---- .../yunbao/main/activity/RewardActivity.java | 29 +++++++++++++-- .../main/activity/ZhuangBanActivity.java | 30 ++++++++++++++-- 6 files changed, 120 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java index ec62f429c..c0a97cae2 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java @@ -52,7 +52,7 @@ public class NobleNoticeView extends FrameLayout { private RelativeLayout rootLayout; private long animationTime = 8000; private TextView gotoRoomView, nobleNickname, userName, anchorNickname; - private String mSvgaName, uhead,anchorUid; + private String mSvgaName, uhead, anchorUid; private RoleType roleType; private HorizontalScrollView contextLayout; private RelativeLayout scrollLayout; @@ -87,6 +87,14 @@ public class NobleNoticeView extends FrameLayout { anchorNickname = rootView.findViewById(R.id.anchor_nickname); contextLayout.setVisibility(GONE); gotoRoomView.setVisibility(GONE); + gotoRoomView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + if (callBack != null) { + callBack.gotoLive(); + } + } + }); } public NobleNoticeView setRootView(String uHead, String userNameStr, String anchorNicknameStr, String anchorUid) { @@ -409,4 +417,15 @@ public class NobleNoticeView extends FrameLayout { return this; } } + + private NobleNoticeCallBack callBack; + + public NobleNoticeView setCallBack(NobleNoticeCallBack callBack) { + this.callBack = callBack; + return this; + } + + public interface NobleNoticeCallBack { + void gotoLive(); + } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 4b9e6b384..8ee23788d 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -686,7 +686,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case NOBLE: Constants.isTitle = true; - String nobleUrl = CommonAppConfig.HOST + "/h5/Nobility.html?nickname=" + userInfo.getUserNicename() + String nobleUrl = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + userInfo.getUserNicename() + "&usernobId=" + userInfo.getNobleId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveBean.getUid() diff --git a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java index 8cfc7ae1d..a7b846602 100644 --- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java @@ -1,9 +1,5 @@ package com.yunbao.live.activity; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; -import static com.yunbao.common.utils.RouteUtil.PATH_COIN; - import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; @@ -30,6 +26,7 @@ import androidx.annotation.RequiresApi; import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.android.arouter.launcher.ARouter; +import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -46,6 +43,10 @@ import com.yunbao.live.R; import java.net.MalformedURLException; import java.net.URL; +import static com.yunbao.common.CommonAppContext.logger; +import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + public class ZhuangBanActivity extends AbsActivity { private ProgressBar mProgressBar; @@ -69,8 +70,8 @@ public class ZhuangBanActivity extends AbsActivity { LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); mProgressBar = (ProgressBar) findViewById(R.id.progressbar); svga = (SVGAImageView) findViewById(R.id.svga); - title=findViewById(R.id.ft_title); - if (isFullWindow){ + title = findViewById(R.id.ft_title); + if (isFullWindow) { title.setVisibility(View.GONE); } mWebView = new WebView(mContext); @@ -157,6 +158,7 @@ public class ZhuangBanActivity extends AbsActivity { new SVGAParser(mContext).parse(new URL(svg), new SVGAParser.ParseCompletion() { @Override public void onComplete(SVGAVideoEntity videoItem) { + svga.setVisibility(View.VISIBLE); SVGADrawable drawable = new SVGADrawable(videoItem); svga.setImageDrawable(drawable); svga.setLoops(1); @@ -167,6 +169,28 @@ public class ZhuangBanActivity extends AbsActivity { public void onError() { } }); + svga.setCallback(new SVGACallback() { + @Override + public void onPause() { + + } + + @Override + public void onFinished() { + svga.clear(); + svga.setVisibility(View.GONE); + } + + @Override + public void onRepeat() { + + } + + @Override + public void onStep(int i, double v) { + + } + }); } catch (MalformedURLException e) { e.printStackTrace(); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index c688546ea..fb3b46c72 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -2274,49 +2274,56 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.BARON); + .setRoleType(NobleNoticeView.RoleType.BARON) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "2": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.VISCOUNT); + .setRoleType(NobleNoticeView.RoleType.VISCOUNT) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "3": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.MARQUIS); + .setRoleType(NobleNoticeView.RoleType.MARQUIS) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "4": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.DUKE); + .setRoleType(NobleNoticeView.RoleType.DUKE) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "5": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.KING); + .setRoleType(NobleNoticeView.RoleType.KING) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "6": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.EMPEROR); + .setRoleType(NobleNoticeView.RoleType.EMPEROR) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "7": noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getAnchorUid()) - .setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR); + .setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR) + .setCallBack(() -> gotoLive(bean.getRoomnum())); break; } } diff --git a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java index 471eedd95..309d7564b 100644 --- a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java @@ -7,7 +7,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; -import androidx.annotation.RequiresApi; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -21,9 +20,12 @@ import android.webkit.WebViewClient; import android.widget.LinearLayout; import android.widget.ProgressBar; +import androidx.annotation.RequiresApi; + import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -184,6 +186,7 @@ public class RewardActivity extends AbsActivity { new SVGAParser(mContext).parse(new URL(svg), new SVGAParser.ParseCompletion() { @Override public void onComplete(SVGAVideoEntity videoItem) { + svga.setVisibility(View.VISIBLE); SVGADrawable drawable = new SVGADrawable(videoItem); svga.setImageDrawable(drawable); svga.setLoops(1); @@ -194,6 +197,28 @@ public class RewardActivity extends AbsActivity { public void onError() { } }); + svga.setCallback(new SVGACallback() { + @Override + public void onPause() { + + } + + @Override + public void onFinished() { + svga.clear(); + svga.setVisibility(View.GONE); + } + + @Override + public void onRepeat() { + + } + + @Override + public void onStep(int i, double v) { + + } + }); } catch (MalformedURLException e) { e.printStackTrace(); } @@ -215,7 +240,7 @@ public class RewardActivity extends AbsActivity { @JavascriptInterface public void gotoHomePage(String indexStr) { - Log.e("tgasss","indexStr3"+indexStr); + Log.e("tgasss", "indexStr3" + indexStr); if (!"".equals(indexStr) && indexStr != null) { int index = -1; diff --git a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java index 30f1b3e1a..dbd7d9521 100644 --- a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java @@ -7,7 +7,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; -import androidx.annotation.RequiresApi; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -21,8 +20,11 @@ import android.webkit.WebViewClient; import android.widget.LinearLayout; import android.widget.ProgressBar; +import androidx.annotation.RequiresApi; + import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.launcher.ARouter; +import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -189,16 +191,40 @@ public class ZhuangBanActivity extends AbsActivity { new SVGAParser(mContext).parse(new URL(svg), new SVGAParser.ParseCompletion() { @Override public void onComplete(SVGAVideoEntity videoItem) { + svga.setVisibility(View.VISIBLE); SVGADrawable drawable = new SVGADrawable(videoItem); svga.setImageDrawable(drawable); svga.setLoops(1); svga.startAnimation(); + } @Override public void onError() { } }); + svga.setCallback(new SVGACallback() { + @Override + public void onPause() { + + } + + @Override + public void onFinished() { + svga.clear(); + svga.setVisibility(View.GONE); + } + + @Override + public void onRepeat() { + + } + + @Override + public void onStep(int i, double v) { + + } + }); } catch (MalformedURLException e) { e.printStackTrace(); } @@ -217,7 +243,7 @@ public class ZhuangBanActivity extends AbsActivity { @JavascriptInterface public void gotoHomePage(String indexStr) { - Log.e("tgasss","indexStr2"+indexStr); + Log.e("tgasss", "indexStr2" + indexStr); if (!"".equals(indexStr) && indexStr != null) { int index = -1; if ("0".equals(indexStr)) {