Commit 91ba879e by amateur

1

1 parent 9f336e39
......@@ -60,20 +60,29 @@ public class ModulesFragmentMgr implements FragmentManager.OnBackStackChangedLis
}
public void showModule(ModulesEnum module) {
if (module == this.currentModule) {
return ;
}
WebViewFragment fragment = this.findFragment(module);
if (!module.fmtKey.equals(this.currentModule.fmtKey)) {
WebViewFragment fragment = this.findFragment(module);
FragmentTransaction transaction = this.manager.beginTransaction();
transaction.hide(this.getCurrentFragment());
transaction.addToBackStack("").show(fragment).commit();
} else {
IWebview webview = fragment.getWebview();
if (null != webview) {
webview.loadUrl(module.webUrl);
}
}
this.setCurrentModule(module);
}
public void showModule(MenuBean bean) {
ModulesEnum module = ModulesEnum.findModule(bean.getModuleName());
Fragment fragment = this.findFragment(module);
WebViewFragment fragment = this.findFragment(module);
if (!TextUtils.isEmpty(bean.getUrl())) {
((IWebview) fragment).loadUrl(bean.getUrl());
IWebview webview = fragment.getWebview();
webview.loadUrl(bean.getUrl());
}
if (!module.fmtKey.equals(this.currentModule.fmtKey)) {
FragmentTransaction transaction = this.manager.beginTransaction();
......
package com.polysoft.nafmii.webview;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.polysoft.nafmii.activity.HomeActivity;
......@@ -22,6 +24,7 @@ public class WebviewHandler implements IWebview{
this.java2js = new JavaToJsinterface(webView);
this.js2java = new JsToJavaInterface(this, fragment, this.java2js);
webView.addJavascriptInterface(this.js2java, "$NativeApi");
// webView.getSettings().setTextZoom(120);
}
public void setButtomMenu(MenuBean bean) {
......@@ -43,6 +46,9 @@ public class WebviewHandler implements IWebview{
@Override
public void loadUrl(String url) {
if (TextUtils.isEmpty(url) || url.equals(this.getUrl())) {
return;
}
this.webView.loadUrl(url);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!