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 adb6ccb9
authored
May 18, 2021
by
amateur
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
91ba879e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
app/src/main/java/com/polysoft/nafmii/webview/JsToJavaInterface.java
app/src/main/java/com/polysoft/nafmii/webview/WebviewHandler.java
app/src/main/java/com/polysoft/nafmii/webview/JsToJavaInterface.java
View file @
adb6ccb
...
@@ -66,6 +66,17 @@ public class JsToJavaInterface {
...
@@ -66,6 +66,17 @@ public class JsToJavaInterface {
});
});
}
}
@JavascriptInterface
public
void
nativeTextZoom
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
mActivity
.
runOnUiThread
(()
->
{
int
value
=
data
.
getIntValue
(
"value"
);
handler
.
setTextZoom
(
value
);
js
.
callJs
(
Result
.
success
(
null
));
});
});
}
@JavascriptInterface
@JavascriptInterface
public
void
nativeShare
(
String
params
)
{
public
void
nativeShare
(
String
params
)
{
...
...
app/src/main/java/com/polysoft/nafmii/webview/WebviewHandler.java
View file @
adb6ccb
...
@@ -8,7 +8,7 @@ import com.polysoft.nafmii.activity.HomeActivity;
...
@@ -8,7 +8,7 @@ import com.polysoft.nafmii.activity.HomeActivity;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.tencent.smtt.sdk.WebView
;
import
com.tencent.smtt.sdk.WebView
;
public
class
WebviewHandler
implements
IWebview
{
public
class
WebviewHandler
implements
IWebview
{
private
static
final
String
TAG
=
WebviewHandler
.
class
.
getName
();
private
static
final
String
TAG
=
WebviewHandler
.
class
.
getName
();
private
final
Fragment
fragment
;
private
final
Fragment
fragment
;
...
@@ -57,4 +57,8 @@ public class WebviewHandler implements IWebview{
...
@@ -57,4 +57,8 @@ public class WebviewHandler implements IWebview{
return
this
.
webView
.
getUrl
();
return
this
.
webView
.
getUrl
();
}
}
public
void
setTextZoom
(
int
zoom
)
{
this
.
webView
.
getSettings
().
setTextZoom
(
zoom
);
}
}
}
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