Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-android
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 91ba879e
authored
May 17, 2021
by
amateur
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
9f336e39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
app/src/main/java/com/polysoft/nafmii/fragment/ModulesFragmentMgr.java
app/src/main/java/com/polysoft/nafmii/webview/WebviewHandler.java
app/src/main/java/com/polysoft/nafmii/fragment/ModulesFragmentMgr.java
View file @
91ba879
...
...
@@ -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
);
WebView
Fragment
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
();
...
...
app/src/main/java/com/polysoft/nafmii/webview/WebviewHandler.java
View file @
91ba879
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
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment