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 2010a055
authored
Jul 08, 2021
by
amateur
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
64a05ce5
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
281 additions
and
72 deletions
app/build.gradle
app/src/main/java/com/polysoft/nafmii/database/ObjectBox.java
app/src/main/java/com/polysoft/nafmii/database/entity/DataEntity.java
app/src/main/java/com/polysoft/nafmii/enums/JSMethodsEnum.java
app/src/main/java/com/polysoft/nafmii/fragment/WebViewFragment.java
app/src/main/java/com/polysoft/nafmii/webview/HomeWebviewHandler.java
app/src/main/java/com/polysoft/nafmii/webview/IWebview.java
app/src/main/java/com/polysoft/nafmii/webview/JavaToJsinterface.java
app/src/main/java/com/polysoft/nafmii/webview/JsInterfaceHandler.java
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/whaty/nafmii/MyApplication.java
app/src/main/java/com/whaty/nafmii/activity/home/ModuleUrlHandle.java
build.gradle
app/build.gradle
View file @
2010a05
plugins
{
id
'com.android.application'
id
'io.objectbox'
}
android
{
...
...
@@ -20,6 +21,14 @@ android {
ndk
{
abiFilters
"armeabi"
,
"armeabi-v7a"
,
"x86"
,
"mips"
}
javaCompileOptions
{
annotationProcessorOptions
{
arguments
=
[
"objectbox.modelPath"
:
"$projectDir\\schemas\\objectbox.json"
.
toString
(),
"objectbox.myObjectBoxPackage"
:
"com.polysoft.nafmii.database"
]
}
}
}
buildTypes
{
...
...
@@ -62,17 +71,19 @@ android {
dependencies
{
implementation
'androidx.wear:wear:1.0.0'
implementation
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
implementation
'androidx.appcompat:appcompat:1.
1
.0'
implementation
'com.google.android.material:material:1.
1.0
'
implementation
'androidx.constraintlayout:constraintlayout:
1.1.3
'
implementation
'androidx.appcompat:appcompat:1.
2
.0'
implementation
'com.google.android.material:material:1.
2.1
'
implementation
'androidx.constraintlayout:constraintlayout:
2.0.1
'
implementation
'ren.yale.android:cachewebviewlib:2.1.8'
implementation
'com.alibaba:fastjson:1.
1.72.android
'
implementation
'com.alibaba:fastjson:1.
2.75
'
implementation
'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.0'
implementation
'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
implementation
'com.github.bumptech.glide:glide:4.12.0'
implementation
"io.objectbox:objectbox-android:$objectboxVersion"
annotationProcessor
"io.objectbox:objectbox-processor:$objectboxVersion"
implementation
'me.jessyan:autosize:1.2.1'
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.
1
'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.
2
.0'
compileOnly
'com.google.android.wearable:wearable:2.
6
.0'
androidTestImplementation
'androidx.test.ext:junit:1.1.
2
'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.
3
.0'
compileOnly
'com.google.android.wearable:wearable:2.
7
.0'
}
\ No newline at end of file
app/src/main/java/com/polysoft/nafmii/database/ObjectBox.java
0 → 100644
View file @
2010a05
package
com
.
polysoft
.
nafmii
.
database
;
import
com.polysoft.nafmii.database.entity.DataEntity
;
import
com.polysoft.nafmii.database.entity.DataEntity_
;
import
com.polysoft.nafmii.utils.CtxUtils
;
import
java.util.Date
;
import
java.util.List
;
import
io.objectbox.Box
;
import
io.objectbox.BoxStore
;
import
io.objectbox.EntityInfo
;
import
io.objectbox.Property
;
import
io.objectbox.query.QueryBuilder
;
public
abstract
class
ObjectBox
<
T
>
{
private
static
BoxStore
mBoxStore
;
public
static
synchronized
BoxStore
getStore
()
{
if
(
null
==
mBoxStore
)
{
mBoxStore
=
MyObjectBox
.
builder
()
.
androidContext
(
CtxUtils
.
getApplication
())
.
build
();
}
return
mBoxStore
;
}
public
static
Box
<
DataEntity
>
getDataBox
()
{
return
getStore
().
boxFor
(
DataEntity
.
class
);
}
public
static
QueryBuilder
<
DataEntity
>
newQuery
()
{
return
getDataBox
().
query
();
}
public
static
DataEntity
findById
(
long
id
)
{
return
newQuery
().
equal
(
DataEntity_
.
id
,
id
).
build
().
findFirst
();
}
public
static
DataEntity
findByName
(
String
name
)
{
return
newQuery
().
equal
(
DataEntity_
.
name
,
name
).
build
().
findFirst
();
}
public
static
List
<
DataEntity
>
findList
(
DataEntity
...
data
)
{
QueryBuilder
<
DataEntity
>
query
=
newQuery
();
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
query
.
equal
(
DataEntity_
.
name
,
data
[
i
].
getName
());
if
((
i
+
1
)
<
data
.
length
)
{
query
.
or
();
}
}
return
query
.
build
().
find
();
}
public
static
void
put
(
DataEntity
...
data
)
{
for
(
DataEntity
item
:
data
)
{
DataEntity
entity
=
findByName
(
item
.
getName
());
if
(
null
!=
entity
)
{
entity
.
setUpdateDate
(
new
Date
());
entity
.
setValue
(
item
.
getValue
());
}
getDataBox
().
put
(
item
);
}
}
public
static
void
delete
(
long
...
ids
)
{
getDataBox
().
remove
(
ids
);
}
public
static
void
delete
(
DataEntity
...
data
)
{
getDataBox
().
remove
(
data
);
}
}
app/src/main/java/com/polysoft/nafmii/database/entity/DataEntity.java
0 → 100644
View file @
2010a05
package
com
.
polysoft
.
nafmii
.
database
.
entity
;
import
java.util.Date
;
import
io.objectbox.annotation.Entity
;
import
io.objectbox.annotation.Id
;
import
io.objectbox.annotation.Index
;
@Entity
()
public
class
DataEntity
{
@Id
private
long
id
;
@Index
private
String
name
;
private
String
value
;
private
Date
updateDate
;
public
DataEntity
()
{}
public
DataEntity
(
String
name
,
String
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
Date
getUpdateDate
()
{
return
updateDate
;
}
public
void
setUpdateDate
(
Date
updateDate
)
{
this
.
updateDate
=
updateDate
;
}
}
app/src/main/java/com/polysoft/nafmii/enums/JSMethodsEnum.java
0 → 100644
View file @
2010a05
package
com
.
polysoft
.
nafmii
.
enums
;
public
enum
JSMethodsEnum
{
CALL_BACK
(
"onBack"
),
CALL_CHANGE_ROUTE
(
"onChangeRoute"
);
public
final
String
name
;
JSMethodsEnum
(
String
name
)
{
this
.
name
=
name
;
}
}
app/src/main/java/com/polysoft/nafmii/fragment/WebViewFragment.java
View file @
2010a05
...
...
@@ -20,6 +20,7 @@ import com.polysoft.nafmii.utils.FileProviderUtils;
import
com.polysoft.nafmii.utils.IntentUtils
;
import
com.polysoft.nafmii.utils.PermissionUtils
;
import
com.polysoft.nafmii.utils.ToastUtils
;
import
com.polysoft.nafmii.webview.HomeWebviewHandler
;
import
com.polysoft.nafmii.webview.IWebview
;
import
com.polysoft.nafmii.webview.MyWebChromeClient
;
import
com.polysoft.nafmii.webview.MyWebViewClient
;
...
...
@@ -71,7 +72,7 @@ public class WebViewFragment extends Fragment implements WebviewLoadListener {
WebView
webView
=
X5WebviewUtils
.
create
(
getActivity
());
webView
.
setWebChromeClient
(
new
MyWebChromeClient
(
this
));
webView
.
setWebViewClient
(
new
MyWebViewClient
(
this
));
this
.
webviewHandler
=
new
WebviewHandler
(
this
,
webView
);
this
.
webviewHandler
=
new
Home
WebviewHandler
(
this
,
webView
);
this
.
layout
.
removeAllViews
();
int
match
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
...
...
app/src/main/java/com/polysoft/nafmii/webview/HomeWebviewHandler.java
0 → 100644
View file @
2010a05
package
com
.
polysoft
.
nafmii
.
webview
;
import
androidx.fragment.app.Fragment
;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.tencent.smtt.sdk.WebView
;
import
com.whaty.nafmii.activity.HomeActivity
;
public
class
HomeWebviewHandler
extends
WebviewHandler
{
private
final
JsToJavaInterface
js2java
;
public
HomeWebviewHandler
(
Fragment
fragment
,
WebView
webView
)
{
super
(
fragment
,
webView
);
this
.
js2java
=
new
JsToJavaInterface
(
this
);
webView
.
addJavascriptInterface
(
this
.
js2java
,
"$NativeApi"
);
}
public
void
setButtomMenu
(
MenuBean
bean
)
{
HomeActivity
activity
=
(
HomeActivity
)
this
.
fragment
.
getActivity
();
activity
.
setModuleStatus
(
bean
);
}
public
void
setTextZoom
(
int
zoom
)
{
super
.
webView
.
getSettings
().
setTextZoom
(
zoom
);
}
}
app/src/main/java/com/polysoft/nafmii/webview/IWebview.java
View file @
2010a05
...
...
@@ -2,12 +2,12 @@ package com.polysoft.nafmii.webview;
public
interface
IWebview
{
void
callJs
(
String
methodName
,
String
json
);
void
loadUrl
(
String
url
);
String
getUrl
();
boolean
canGoBack
();
JavaToJsinterface
getJsInterface
();
}
app/src/main/java/com/polysoft/nafmii/webview/JavaToJsinterface.java
View file @
2010a05
...
...
@@ -4,6 +4,7 @@ package com.polysoft.nafmii.webview;
import
android.util.Log
;
import
com.alibaba.fastjson.JSON
;
import
com.polysoft.nafmii.enums.JSMethodsEnum
;
import
com.tencent.smtt.sdk.WebView
;
public
class
JavaToJsinterface
{
...
...
@@ -14,6 +15,10 @@ public class JavaToJsinterface {
this
.
mWebView
=
webView
;
}
public
void
callJs
(
JSMethodsEnum
method
,
String
json
)
{
this
.
callJs
(
method
.
name
,
json
);
}
public
void
callJs
(
String
methodName
,
String
json
)
{
String
param
=
JSON
.
toJSONString
(
json
);
String
script
=
String
.
format
(
"javascript:$api.%s(%s)"
,
methodName
,
param
);
...
...
app/src/main/java/com/polysoft/nafmii/webview/JsInterfaceHandler.java
View file @
2010a05
...
...
@@ -12,9 +12,9 @@ public class JsInterfaceHandler {
private
final
JavaToJsinterface
javaTojs
;
private
String
jsMethodName
;
public
JsInterfaceHandler
(
Activity
mActivity
,
JavaToJsinterface
javaTojs
)
{
this
.
mActivity
=
mActivity
;
this
.
javaTojs
=
javaTojs
;
public
JsInterfaceHandler
(
WebviewHandler
handler
)
{
this
.
mActivity
=
handler
.
getFragment
().
getActivity
()
;
this
.
javaTojs
=
handler
.
getJsInterface
()
;
}
public
void
parse
(
String
params
,
JsHandle
jsHandle
)
{
...
...
app/src/main/java/com/polysoft/nafmii/webview/JsToJavaInterface.java
View file @
2010a05
...
...
@@ -8,40 +8,38 @@ import android.webkit.JavascriptInterface;
import
androidx.fragment.app.Fragment
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.util.TypeUtils
;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.polysoft.nafmii.bean.Result
;
import
com.polysoft.nafmii.broadcast.Receiver
;
import
com.polysoft.nafmii.broadcast.ShareReceiver
;
import
com.polysoft.nafmii.database.ObjectBox
;
import
com.polysoft.nafmii.database.entity.DataEntity
;
import
com.polysoft.nafmii.utils.CtxUtils
;
import
com.polysoft.nafmii.utils.StatusBarUtils
;
import
com.polysoft.nafmii.wechat.ShareBean
;
import
com.polysoft.nafmii.wechat.WechatApi
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
JsToJavaInterface
{
private
final
HomeWebviewHandler
handler
;
private
final
Activity
mActivity
;
private
final
JavaToJsinterface
javaTojs
;
private
Fragment
mFragment
;
WebviewHandler
handler
;
public
JsToJavaInterface
(
Activity
activity
,
JavaToJsinterface
javaTojs
)
{
this
.
mActivity
=
activity
;
this
.
javaTojs
=
javaTojs
;
}
public
JsToJavaInterface
(
WebviewHandler
handler
,
Fragment
fragment
,
JavaToJsinterface
javaTojs
)
{
this
(
fragment
.
getActivity
(),
javaTojs
);
this
.
mFragment
=
fragment
;
public
JsToJavaInterface
(
HomeWebviewHandler
handler
)
{
this
.
handler
=
handler
;
this
.
mActivity
=
handler
.
getFragment
().
getActivity
();
}
@JavascriptInterface
public
void
nativeAppInfo
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
(
data
,
js
)
->
{
final
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
PackageInfo
packageInfo
=
CtxUtils
.
getPackageInfo
();
dataMap
.
put
(
"versionCode"
,
packageInfo
.
versionCode
);
...
...
@@ -53,7 +51,7 @@ public class JsToJavaInterface {
@JavascriptInterface
public
void
nativeMenu
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
(
data
,
js
)
->
{
MenuBean
bean
=
TypeUtils
.
castToJavaBean
(
data
,
MenuBean
.
class
);
mActivity
.
runOnUiThread
(()
->
handler
.
setButtomMenu
(
bean
));
});
...
...
@@ -61,14 +59,14 @@ public class JsToJavaInterface {
@JavascriptInterface
public
void
nativeLogin
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
(
data
,
js
)
->
{
});
}
@JavascriptInterface
public
void
nativeTextZoom
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
(
data
,
js
)
->
{
mActivity
.
runOnUiThread
(()
->
{
int
value
=
data
.
getIntValue
(
"value"
);
handler
.
setTextZoom
(
value
);
...
...
@@ -80,7 +78,7 @@ public class JsToJavaInterface {
@JavascriptInterface
public
void
nativeShare
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
(
data
,
js
)
->
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
(
data
,
js
)
->
{
WechatApi
instance
=
WechatApi
.
getInstance
(
mActivity
);
if
(!
instance
.
isWXAppInstalled
())
{
js
.
callJs
(
Result
.
fail
(
"未安装应用"
));
...
...
@@ -96,8 +94,42 @@ public class JsToJavaInterface {
}
@JavascriptInterface
public
void
nativeBackIntercept
(
String
param
)
{
new
JsInterfaceHandler
(
handler
).
parse
(
param
,
(
data
,
js
)
->
{
Boolean
type
=
data
.
getBoolean
(
"type"
);
handler
.
setBackIntercept
(
null
==
type
?
false
:
type
);
js
.
success
(
null
);
});
}
@JavascriptInterface
public
void
nativeDatabase
(
String
param
)
{
new
JsInterfaceHandler
(
handler
).
parse
(
param
,
(
data
,
js
)
->
{
String
type
=
data
.
getString
(
"type"
);
JSONArray
datas
=
data
.
getJSONArray
(
"datas"
);
List
<
DataEntity
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
datas
.
size
();
i
++)
{
JSONObject
item
=
datas
.
getJSONObject
(
i
);
String
key
=
item
.
getString
(
"key"
);
Object
valueObj
=
item
.
get
(
"value"
);
list
.
add
(
new
DataEntity
(
key
,
null
==
valueObj
?
null
:
valueObj
.
toString
()));
}
DataEntity
[]
arrays
=
list
.
toArray
(
new
DataEntity
[]{});
if
(
"1"
.
equals
(
type
))
{
js
.
success
(
ObjectBox
.
findList
(
arrays
));
return
;
}
else
if
(
"2"
.
equals
(
type
))
{
ObjectBox
.
put
(
arrays
);
}
else
if
(
"3"
.
equals
(
type
))
{
ObjectBox
.
delete
(
arrays
);
}
js
.
success
(
null
);
});
}
@JavascriptInterface
public
void
nativeCamera
(
String
params
)
{
new
JsInterfaceHandler
(
mActivity
,
javaTojs
).
parse
(
params
,
new
JsInterfaceHandler
.
JsHandle
()
{
new
JsInterfaceHandler
(
handler
).
parse
(
params
,
new
JsInterfaceHandler
.
JsHandle
()
{
@Override
public
void
handle
(
JSONObject
data
,
JsInterfaceHandler
.
JsInterface
js
)
{
...
...
@@ -194,21 +226,4 @@ public class JsToJavaInterface {
// });
// }
private
void
sendMessage2Js
(
String
jsMethodName
,
String
json
)
{
if
(
TextUtils
.
isEmpty
(
jsMethodName
))
{
return
;
}
if
(
"'main'"
.
equals
(
Thread
.
currentThread
().
getName
()))
{
javaTojs
.
callJs
(
jsMethodName
,
json
);
return
;
}
this
.
mActivity
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
javaTojs
.
callJs
(
jsMethodName
,
json
);
}
});
}
}
app/src/main/java/com/polysoft/nafmii/webview/WebviewHandler.java
View file @
2010a05
...
...
@@ -5,36 +5,29 @@ import android.text.TextUtils;
import
androidx.fragment.app.Fragment
;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.polysoft.nafmii.enums.JSMethodsEnum
;
import
com.tencent.smtt.sdk.WebView
;
import
com.whaty.nafmii.activity.HomeActivity
;
public
class
WebviewHandler
implements
IWebview
{
private
static
final
String
TAG
=
WebviewHandler
.
class
.
getName
();
private
final
Fragment
fragment
;
private
final
WebView
webView
;
private
final
JavaToJsinterface
java2js
;
private
final
JsToJavaInterface
js2java
;
protected
final
Fragment
fragment
;
protected
final
WebView
webView
;
protected
final
JavaToJsinterface
java2js
;
pr
ivate
boolean
backIntercept
=
false
;
pr
otected
boolean
backIntercept
=
false
;
public
WebviewHandler
(
Fragment
fragment
,
WebView
webView
)
{
this
.
fragment
=
fragment
;
this
.
webView
=
webView
;
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
)
{
HomeActivity
activity
=
(
HomeActivity
)
this
.
fragment
.
getActivity
();
activity
.
setModuleStatus
(
bean
);
}
@Override
public
boolean
canGoBack
()
{
if
(
this
.
backIntercept
)
{
this
.
java2js
.
callJs
(
JSMethodsEnum
.
CALL_BACK
,
""
);
return
true
;
}
if
(
this
.
webView
.
canGoBack
())
{
...
...
@@ -45,11 +38,6 @@ public class WebviewHandler implements IWebview {
}
@Override
public
void
callJs
(
String
methodName
,
String
json
)
{
this
.
java2js
.
callJs
(
methodName
,
json
);
}
@Override
public
void
loadUrl
(
String
url
)
{
if
(
TextUtils
.
isEmpty
(
url
)
||
url
.
equals
(
this
.
getUrl
()))
{
return
;
...
...
@@ -62,8 +50,20 @@ public class WebviewHandler implements IWebview {
return
this
.
webView
.
getUrl
();
}
public
void
setTextZoom
(
int
zoom
)
{
this
.
webView
.
getSettings
().
setTextZoom
(
zoom
);
@Override
public
JavaToJsinterface
getJsInterface
()
{
return
this
.
java2js
;
}
public
void
setBackIntercept
(
boolean
intercept
)
{
this
.
backIntercept
=
intercept
;
}
public
WebView
getWebView
()
{
return
this
.
webView
;
}
public
Fragment
getFragment
()
{
return
this
.
fragment
;
}
}
app/src/main/java/com/whaty/nafmii/MyApplication.java
View file @
2010a05
...
...
@@ -19,7 +19,9 @@ public class MyApplication extends Application {
.
setDesignHeightInDp
(
896
);
WebViewCacheInterceptor
.
Builder
builder
=
new
WebViewCacheInterceptor
.
Builder
(
this
);
//
builder.setDebug(BuildConfig.DEBUG);
builder
.
setDebug
(
BuildConfig
.
DEBUG
);
WebViewCacheInterceptorInst
.
getInstance
().
init
(
builder
);
}
}
app/src/main/java/com/whaty/nafmii/activity/home/ModuleUrlHandle.java
View file @
2010a05
...
...
@@ -7,8 +7,10 @@ import android.text.TextUtils;
import
com.polysoft.nafmii.bean.MenuBean
;
import
com.polysoft.nafmii.constants.Constants
;
import
com.polysoft.nafmii.constants.JsApi
;
import
com.polysoft.nafmii.enums.JSMethodsEnum
;
import
com.polysoft.nafmii.enums.ModulesEnum
;
import
com.polysoft.nafmii.webview.IWebview
;
import
com.polysoft.nafmii.webview.JavaToJsinterface
;
public
class
ModuleUrlHandle
{
...
...
@@ -65,9 +67,9 @@ public class ModuleUrlHandle {
if
(!
TextUtils
.
isEmpty
(
bean
.
getUrl
()))
{
webview
.
loadUrl
(
bean
.
getUrl
());
}
else
if
(!
TextUtils
.
isEmpty
(
bean
.
getRouteName
()))
{
webview
.
callJs
(
JsApi
.
API
_ROUTE
,
""
);
webview
.
getJsInterface
().
callJs
(
JSMethodsEnum
.
CALL_CHANGE
_ROUTE
,
""
);
}
else
if
(!
TextUtils
.
isEmpty
(
bean
.
getRoutePath
()))
{
webview
.
callJs
(
JsApi
.
API
_ROUTE
,
""
);
webview
.
getJsInterface
().
callJs
(
JSMethodsEnum
.
CALL_CHANGE
_ROUTE
,
""
);
}
}
}
...
...
@@ -89,10 +91,11 @@ public class ModuleUrlHandle {
Intent
intent
=
activity
.
getIntent
();
String
url
=
intent
.
getStringExtra
(
module
.
name
);
if
(!
TextUtils
.
isEmpty
(
url
))
{
JavaToJsinterface
jsInterface
=
webview
.
getJsInterface
();
if
(
module
==
ModulesEnum
.
MEMBER
)
{
webview
.
callJs
(
JsApi
.
API
_ROUTE
,
""
);
webview
.
getJsInterface
().
callJs
(
JSMethodsEnum
.
CALL_CHANGE
_ROUTE
,
""
);
}
else
if
(
module
==
ModulesEnum
.
MY
)
{
webview
.
callJs
(
JsApi
.
API
_ROUTE
,
""
);
webview
.
getJsInterface
().
callJs
(
JSMethodsEnum
.
CALL_CHANGE
_ROUTE
,
""
);
}
else
{
webview
.
loadUrl
(
url
);
}
...
...
build.gradle
View file @
2010a05
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
{
ext
.
objectboxVersion
=
'2.9.1'
repositories
{
google
()
jcenter
()
}
dependencies
{
classpath
"com.android.tools.build:gradle:4.1.1"
classpath
"io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
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