From 84596b0191479da700a1af2af1ed35e58b98b730 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 24 Aug 2022 15:45:32 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=B4=BB=E5=8A=A8=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E7=AA=97=E6=94=B9=E4=B8=BAActivity=20fix:?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DZhuangBanActivity.java=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=9A=84xml=E8=B5=84=E6=BA=90=E5=86=B2=E7=AA=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/activity/AbsActivity.java | 6 ++ .../live/activity/LiveAudienceActivity.java | 9 ++- .../live/activity/ZhuangBanActivity.java | 22 +++--- .../live/dialog/LiveHDDialogFragment.java | 36 +++++++--- .../live/views/LiveAudienceViewHolder.java | 2 +- .../res/layout/activity_zhuang_ban_new.xml | 69 +++++++++++++++++++ 6 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 live/src/main/res/layout/activity_zhuang_ban_new.xml diff --git a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java index a3ac74556..aa49fd96f 100644 --- a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java @@ -38,6 +38,7 @@ public abstract class AbsActivity extends AppCompatActivity { protected String mTag; protected Activity mContext; protected List mLifeCycleListeners; + protected boolean isFullWindow; @Override public Resources getResources() { @@ -51,6 +52,11 @@ public abstract class AbsActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { + isFullWindow=getIntent().getBooleanExtra("isFull",false); + if(isFullWindow){ + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); + } super.onCreate(savedInstanceState); mTag = this.getClass().getSimpleName(); setStatusBar(); 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 1cfce84e9..903b70d5e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -827,11 +827,10 @@ public class LiveAudienceActivity extends LiveActivity { url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; Log.i("tag", url); - Bundle bundle1 = new Bundle(); - bundle1.putString("url", url); - liveHDDialogFragment = new LiveHDDialogFragment(true); - liveHDDialogFragment.setArguments(bundle1); - liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + Intent intent=new Intent(mContext,ZhuangBanActivity.class); + intent.putExtra("url", url); + intent.putExtra("isFull",true); + mContext.startActivity(intent); break; } 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 8e6ecadb9..8cfc7ae1d 100644 --- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java @@ -1,5 +1,9 @@ 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; @@ -7,7 +11,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; @@ -18,9 +21,12 @@ import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ProgressBar; +import androidx.annotation.RequiresApi; + import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.android.arouter.launcher.ARouter; @@ -40,10 +46,6 @@ 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; @@ -53,10 +55,11 @@ public class ZhuangBanActivity extends AbsActivity { private ValueCallback mValueCallback; private ValueCallback mValueCallback2; private SVGAImageView svga; + private FrameLayout title; @Override protected int getLayoutId() { - return R.layout.activity_zhuang_ban; + return R.layout.activity_zhuang_ban_new; } @Override @@ -66,9 +69,12 @@ 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.setVisibility(View.GONE); + } mWebView = new WebView(mContext); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.topMargin = DpUtil.dp2px(1); mWebView.setLayoutParams(params); mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 59dd56382..80fb75167 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -1,16 +1,20 @@ package com.yunbao.live.dialog; -import android.app.Dialog; +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.graphics.Color; -import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; -import android.util.DisplayMetrics; import android.util.Log; +import android.view.Display; import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; import android.view.Window; +import android.view.WindowInsets; import android.view.WindowManager; import android.webkit.JavascriptInterface; import android.webkit.WebSettings; @@ -20,7 +24,6 @@ import android.webkit.WebViewClient; import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.android.arouter.launcher.ARouter; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.JsWishBean; import com.yunbao.common.dialog.AbsDialogFragment; @@ -29,10 +32,6 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; -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 LiveHDDialogFragment extends AbsDialogFragment { private WebView mWebView; @@ -73,7 +72,24 @@ public class LiveHDDialogFragment extends AbsDialogFragment { WindowManager.LayoutParams params = window.getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; if(isFullWindow){ + Display display=null; + window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT); + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.R) { + display= requireContext().getDisplay(); + window.getInsetsController().hide(WindowInsets.Type.statusBars()); + window.getInsetsController().hide(WindowInsets.Type.navigationBars()); + }else { + display=window.getWindowManager().getDefaultDisplay(); + window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); + window.getDecorView().setBackgroundColor(Color.parseColor("#10000000")); params.height = WindowManager.LayoutParams.MATCH_PARENT; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + window.getDecorView().setMinimumHeight(display.getMode().getPhysicalHeight()); + window.getDecorView().setMinimumWidth(display.getMode().getPhysicalWidth()); + } + window.getDecorView().setPadding(10,-10,0,0); }else { params.height = WindowManager.LayoutParams.WRAP_CONTENT; } @@ -192,6 +208,10 @@ public class LiveHDDialogFragment extends AbsDialogFragment { dismiss(); ((LiveAudienceActivity) mContext).openGiftWindow(); } + @JavascriptInterface + public void androidGoBack(){ + dismiss(); + } } /** diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 91059625f..24c2f8dac 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -379,7 +379,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { liveNewPeople.setVisibility(View.VISIBLE); newPeopleUrl = peopleInfo.getLink(); } - }, throwable -> throwable.printStackTrace()).isDisposed(); + }, Throwable::printStackTrace).isDisposed(); } @Override diff --git a/live/src/main/res/layout/activity_zhuang_ban_new.xml b/live/src/main/res/layout/activity_zhuang_ban_new.xml new file mode 100644 index 000000000..1fcf37766 --- /dev/null +++ b/live/src/main/res/layout/activity_zhuang_ban_new.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file