From d629ee3f9f6817cb2b309ae39e8be280df64056e Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 9 Jan 2024 17:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=87=E5=88=B0=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E9=A1=B5=E9=9D=A2=E5=90=8E=E7=9F=AD=E5=89=A7=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E6=9A=82=E5=81=9C=E6=92=AD=E6=94=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E7=9F=AD=E5=89=A7=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E5=8D=B7=E9=87=8D=E5=A4=8D=E5=BC=B9=E5=87=BA=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/main/activity/MainActivity.java | 12 +++++ .../fragment/MainHomeCommunityFragment.java | 53 ------------------- .../MainHomeCommunityVideoFragment.java | 6 +++ .../views/MainHomeCommunityViewHolder.java | 26 +++++++++ 4 files changed, 44 insertions(+), 53 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 5380d1a38..032e75500 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -329,15 +329,27 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene case 0: //点击埋点 MobclickAgent.onEvent(mContext, "home_page", "首页"); + if(mMainHomeCommunityViewHolder!=null) { + mMainHomeCommunityViewHolder.onPauseVideo(); + } break; case 1: MobclickAgent.onEvent(mContext, "community", "社区"); + if(mMainHomeCommunityViewHolder!=null) { + mMainHomeCommunityViewHolder.onResumePlay(); + } break; case 2: MobclickAgent.onEvent(mContext, "information", "消息"); + if(mMainHomeCommunityViewHolder!=null) { + mMainHomeCommunityViewHolder.onPauseVideo(); + } break; case 3: MobclickAgent.onEvent(mContext, "my", "我的"); + if(mMainHomeCommunityViewHolder!=null) { + mMainHomeCommunityViewHolder.onPauseVideo(); + } break; } if (mTabButtonGroup.getCurPosition() != position) { diff --git a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java index 96ed6cfd6..ae5f07953 100644 --- a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java @@ -378,59 +378,6 @@ public class MainHomeCommunityFragment extends BaseFragment { .setShareLink(CommonAppConfig.HOST + json.getString("link")) .setAnchorAvatar(json.getString("avatar")) .showDialog(); - } else if (TextUtils.equals(event.getMethod(), "postWeakBalance")) { - LiveNetManager.get(mContext). - getCoolConfig(new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(CoolConfig data) { - new XPopup.Builder(mContext) - .enableDrag(false) - .autoOpenSoftInput(false) - .maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34)) - .asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() { - @Override - public void onCallBack(String data) { - if (TextUtils.equals(data, "2")) { - DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false, - new DialogUitl.SimpleCallback2() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1)); - } - - @Override - public void onCancelClick() { - - } - }); - } else if (TextUtils.equals(data, "1")) { - ToastUtil.show(WordUtil.isNewZh() ? "兑换成功" : "Successful exchange"); - mWebView.post(new Runnable() { - @Override - public void run() { - - NativeCallbackModel model = new NativeCallbackModel(); - model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId())); - String nativeJson = new JsonUtil().toJson(model); - mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback() { - @Override - public void onReceiveValue(String value) { - } - }); - - } - }); - } - - } - })).show(); - } - - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); } } } diff --git a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityVideoFragment.java b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityVideoFragment.java index 2730f6146..0727bf0ca 100644 --- a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityVideoFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityVideoFragment.java @@ -197,4 +197,10 @@ public class MainHomeCommunityVideoFragment extends BaseFragment { }); } } + public void onPausePlay(){ + mWebView.onPause(); + } + public void onResumePlay(){ + mWebView.onResume(); + } } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index 369a2edd9..6145f2eab 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -224,6 +224,32 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl public void loadNewUrl() { } + public void onPauseVideo() { + if(fragments==null || fragments.isEmpty()){ + return; + } + BaseFragment fragment = fragments.get(viewPager.getCurrentItem()); + if(fragment==null){ + return; + } + if (fragment instanceof MainHomeCommunityVideoFragment) { + // viewPager.setCurrentItem(0, false); + ((MainHomeCommunityVideoFragment)fragment).onPausePlay(); + } + } + public void onResumePlay() { + if(fragments==null || fragments.isEmpty()){ + return; + } + BaseFragment fragment = fragments.get(viewPager.getCurrentItem()); + if(fragment==null){ + return; + } + if (fragment instanceof MainHomeCommunityVideoFragment) { + // viewPager.setCurrentItem(0, false); + ((MainHomeCommunityVideoFragment)fragment).onResumePlay(); + } + } @Override public void onItemClick(LiveBean bean, int position) {