新增主播联系方式详情页

This commit is contained in:
zlzw 2023-04-06 10:34:45 +08:00
parent a5fd14cc0e
commit fd15428ed9

View File

@ -10,13 +10,19 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.dialog.AbsDialogPopupWindow; 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.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow { public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow {
WebView mWebView; WebView mWebView;
TextView textView; TextView textView;
@ -47,10 +53,13 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow
@Override @Override
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
Bus.getOn(this);
mWebView = findViewById(R.id.webView); mWebView = findViewById(R.id.webView);
textView = findViewById(R.id.title); textView = findViewById(R.id.title);
textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title), anchorName)); textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title), anchorName));
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(CommonAppContext.getTopActivity(),mWebView),"androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance()
.setDialogClose(true)
.setmContext(CommonAppContext.getTopActivity(), mWebView), "androidObject");
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);
String appCachePath = getContext().getCacheDir().getAbsolutePath(); String appCachePath = getContext().getCacheDir().getAbsolutePath();
@ -78,4 +87,17 @@ public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow
}); });
mWebView.loadUrl(url); 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();
}
}
} }