From fd15428ed94e93a1e6dadbd46db700a25acb2747 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 6 Apr 2023 10:34:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=BB=E6=92=AD?= =?UTF-8?q?=E8=81=94=E7=B3=BB=E6=96=B9=E5=BC=8F=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...LiveUserAnchorMailBoxWebInfoPopDialog.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java index 143eaed8d..807d50fa5 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java @@ -10,13 +10,19 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.lxj.xpopup.XPopup; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.event.JavascriptInterfaceEvent; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.L; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow { WebView mWebView; TextView textView; @@ -47,10 +53,13 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow @Override protected void onCreate() { super.onCreate(); - mWebView=findViewById(R.id.webView); - textView=findViewById(R.id.title); - textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title),anchorName)); - mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(CommonAppContext.getTopActivity(),mWebView),"androidObject"); + Bus.getOn(this); + mWebView = findViewById(R.id.webView); + textView = findViewById(R.id.title); + textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title), anchorName)); + mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance() + .setDialogClose(true) + .setmContext(CommonAppContext.getTopActivity(), mWebView), "androidObject"); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); String appCachePath = getContext().getCacheDir().getAbsolutePath(); @@ -78,4 +87,17 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow }); mWebView.loadUrl(url); } + + @Override + public void dismiss() { + super.dismiss(); + Bus.getOff(this); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) { + if (event.getMethod().equals("androidGoBack")) { + dismiss(); + } + } } From 1fba3bd53ed33bcd810b6c880f97c462c42f8206 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 6 Apr 2023 11:02:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E3=80=90=E5=A4=8D=E5=88=B6=E3=80=91=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BD=8D=E7=BD=AE=E5=92=8C=E6=B7=BB=E5=8A=A0=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{background_fff.xml => bg_preview.xml} | 3 +++ .../src/main/res/layout/view_share_preview.xml | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) rename Share/src/main/res/drawable/{background_fff.xml => bg_preview.xml} (72%) diff --git a/Share/src/main/res/drawable/background_fff.xml b/Share/src/main/res/drawable/bg_preview.xml similarity index 72% rename from Share/src/main/res/drawable/background_fff.xml rename to Share/src/main/res/drawable/bg_preview.xml index 2b3a47e26..8ea7f09be 100644 --- a/Share/src/main/res/drawable/background_fff.xml +++ b/Share/src/main/res/drawable/bg_preview.xml @@ -4,6 +4,9 @@ + \ No newline at end of file diff --git a/Share/src/main/res/layout/view_share_preview.xml b/Share/src/main/res/layout/view_share_preview.xml index 36705df33..486074c77 100644 --- a/Share/src/main/res/layout/view_share_preview.xml +++ b/Share/src/main/res/layout/view_share_preview.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/background_fff" + android:background="@drawable/bg_preview" android:orientation="vertical"> + android:textSize="12sp" /> -