Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_jdsdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_jdsdk
Commits
c97512be
Commit
c97512be
authored
Feb 12, 2021
by
李增强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m
parent
fd4f72d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
50 deletions
+32
-50
android/build.gradle
android/build.gradle
+2
-1
android/src/main/java/com/jd/jdsdk/JDHelper.java
android/src/main/java/com/jd/jdsdk/JDHelper.java
+30
-49
No files found.
android/build.gradle
View file @
c97512be
...
@@ -49,5 +49,6 @@ android {
...
@@ -49,5 +49,6 @@ android {
dependencies
{
dependencies
{
//implementation files('src/libs/jdmasdk.jar')
//implementation files('src/libs/jdmasdk.jar')
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
files
(
'src/libs/JDSDK_h.jar'
)
implementation
files
(
'src/libs/cps_1.0.0.jar'
)
}
}
android/src/main/java/com/jd/jdsdk/JDHelper.java
View file @
c97512be
...
@@ -7,7 +7,7 @@ import android.text.TextUtils;
...
@@ -7,7 +7,7 @@ import android.text.TextUtils;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.jd.kepler.res.ApkResources
;
//
import com.jd.kepler.res.ApkResources;
import
com.kepler.jd.Listener.AsyncInitListener
;
import
com.kepler.jd.Listener.AsyncInitListener
;
import
com.kepler.jd.Listener.OpenAppAction
;
import
com.kepler.jd.Listener.OpenAppAction
;
import
com.kepler.jd.login.KeplerApiManager
;
import
com.kepler.jd.login.KeplerApiManager
;
...
@@ -27,19 +27,17 @@ public class JDHelper {
...
@@ -27,19 +27,17 @@ public class JDHelper {
private
static
JDHelper
jdHelper
;
private
static
JDHelper
jdHelper
;
private
PluginRegistry
.
Registrar
register
;
private
PluginRegistry
.
Registrar
register
;
private
ActivityPluginBinding
binding
;
private
ActivityPluginBinding
binding
;
Activity
activity
;
KelperTask
mKelperTask
;
Handler
mHandler
=
new
Handler
();
Handler
mHandler
=
new
Handler
();
KeplerAttachParameter
mKeplerAttachParameter
=
new
KeplerAttachParameter
();
//这个是即时性参数 可以设置
KeplerAttachParameter
mKeplerAttachParameter
=
new
KeplerAttachParameter
();
//这个是即时性参数 可以设置
LoadingDialog
dialog
;
LoadingDialog
dialog
;
private
Activity
getActivity
()
{
private
Activity
getActivity
()
{
if
(
null
!=
register
)
{
if
(
null
!=
register
)
{
return
register
.
activity
();
return
register
.
activity
();
}
else
if
(
null
!=
binding
)
{
}
else
if
(
null
!=
binding
)
{
return
binding
.
getActivity
();
return
binding
.
getActivity
();
}
}
return
null
;
return
null
;
}
}
...
@@ -47,27 +45,15 @@ public class JDHelper {
...
@@ -47,27 +45,15 @@ public class JDHelper {
OpenAppAction
mOpenAppAction
=
new
OpenAppAction
()
{
OpenAppAction
mOpenAppAction
=
new
OpenAppAction
()
{
@Override
@Override
public
void
onStatus
(
final
int
status
,
final
String
url
)
{
public
void
onStatus
(
final
int
status
)
{
mHandler
.
post
(
new
Runnable
()
{
mHandler
.
post
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
status
==
OpenAppAction
.
OpenAppAction_start
)
{
//开始状态未必一定执行,
if
(
status
==
OpenAppAction
.
OpenAppAction_start
)
{
//开始状态未必一定执行,
dialogShow
();
dialogShow
();
}
else
{
}
else
{
mKelperTask
=
null
;
dialogDiss
();
dialogDiss
();
}
}
if
(
status
==
OpenAppAction
.
OpenAppAction_result_NoJDAPP
)
{
// Toast.makeText(getActivity(), "您未安装京东app,你可以手动打开以下链接地址:"+url+" ,code="+status, Toast.LENGTH_SHORT).show();
}
else
if
(
status
==
OpenAppAction
.
OpenAppAction_result_BlackUrl
){
// Toast.makeText(getActivity(), "url不在白名单,你可以手动打开以下链接地址:"+url+" ,code="+status, Toast.LENGTH_SHORT).show();
}
else
if
(
status
==
OpenAppAction
.
OpenAppAction_result_ErrorScheme
){
// Toast.makeText(getActivity(), "呼起协议异常"+" ,code="+status, Toast.LENGTH_SHORT).show();
}
else
if
(
status
==
OpenAppAction
.
OpenAppAction_result_APP
){
}
else
if
(
status
==
OpenAppAction
.
OpenAppAction_result_NetError
){
// Toast.makeText(getActivity(), ApkResources.getSingleton().getString("kepler_check_net")+" ,code="+status+" ,url="+url,Toast.LENGTH_SHORT).show();
}
}
}
});
});
}
}
...
@@ -76,31 +62,24 @@ public class JDHelper {
...
@@ -76,31 +62,24 @@ public class JDHelper {
private
void
dialogShow
()
{
private
void
dialogShow
()
{
if
(
dialog
==
null
)
{
if
(
dialog
==
null
)
{
dialog
=
new
LoadingDialog
(
getActivity
());
dialog
=
new
LoadingDialog
(
getActivity
());
dialog
.
setOnCancelListener
(
new
DialogInterface
.
OnCancelListener
()
{
@Override
public
void
onCancel
(
DialogInterface
dialog
)
{
if
(
mKelperTask
!=
null
)
{
//取消
mKelperTask
.
setCancel
(
true
);
}
}
});
}
}
dialog
.
show
();
dialog
.
show
();
}
}
private
void
dialogDiss
()
{
private
void
dialogDiss
()
{
if
(
dialog
!=
null
)
if
(
dialog
!=
null
)
dialog
.
dismiss
();
dialog
.
dismiss
();
}
}
//第一次调用getInstance register不能为空
//第一次调用getInstance register不能为空
public
static
JDHelper
getInstance
(
PluginRegistry
.
Registrar
register
){
public
static
JDHelper
getInstance
(
PluginRegistry
.
Registrar
register
)
{
if
(
jdHelper
==
null
){
if
(
jdHelper
==
null
)
{
synchronized
(
JDHelper
.
class
){
synchronized
(
JDHelper
.
class
)
{
jdHelper
=
new
JDHelper
();
jdHelper
=
new
JDHelper
();
if
(
null
!=
register
)
{
if
(
null
!=
register
)
{
jdHelper
.
register
=
register
;
jdHelper
.
register
=
register
;
}
}
}
}
...
@@ -109,11 +88,11 @@ public class JDHelper {
...
@@ -109,11 +88,11 @@ public class JDHelper {
}
}
//第一次调用getInstance register不能为空
//第一次调用getInstance register不能为空
public
static
JDHelper
getInstance
(
ActivityPluginBinding
binding
){
public
static
JDHelper
getInstance
(
ActivityPluginBinding
binding
)
{
if
(
jdHelper
==
null
){
if
(
jdHelper
==
null
)
{
synchronized
(
JDHelper
.
class
){
synchronized
(
JDHelper
.
class
)
{
jdHelper
=
new
JDHelper
();
jdHelper
=
new
JDHelper
();
if
(
null
!=
binding
)
{
if
(
null
!=
binding
)
{
jdHelper
.
binding
=
binding
;
jdHelper
.
binding
=
binding
;
}
}
}
}
...
@@ -122,17 +101,16 @@ public class JDHelper {
...
@@ -122,17 +101,16 @@ public class JDHelper {
}
}
/**
/**
* 初始化开普勒
* 初始化开普勒
*
* @param call
* @param call
* @param result
* @param result
*/
*/
public
void
initKepler
(
MethodCall
call
,
MethodChannel
.
Result
result
){
public
void
initKepler
(
MethodCall
call
,
MethodChannel
.
Result
result
)
{
String
appKey
=
call
.
argument
(
"appKey"
);
String
appKey
=
call
.
argument
(
"appKey"
);
String
appSecret
=
call
.
argument
(
"appSecret"
);
String
appSecret
=
call
.
argument
(
"appSecret"
);
Log
.
d
(
"flutter-taoke"
,
"initKepler"
+
getActivity
());
Log
.
d
(
"flutter-taoke"
,
"initKepler"
+
getActivity
());
KeplerApiManager
.
asyncInitSdk
(
getActivity
().
getApplication
(),
appKey
,
appSecret
,
new
AsyncInitListener
()
{
KeplerApiManager
.
asyncInitSdk
(
getActivity
().
getApplication
(),
appKey
,
appSecret
,
new
AsyncInitListener
()
{
@Override
@Override
public
void
onSuccess
()
{
public
void
onSuccess
()
{
...
@@ -151,18 +129,21 @@ public class JDHelper {
...
@@ -151,18 +129,21 @@ public class JDHelper {
/**
/**
* 通过URL方式打开
* 通过URL方式打开
*
* @param call
* @param call
* @param result
* @param result
*/
*/
public
void
openUrl
(
MethodCall
call
,
MethodChannel
.
Result
result
){
public
void
openUrl
(
MethodCall
call
,
MethodChannel
.
Result
result
)
{
String
url
=
call
.
argument
(
"url"
);
String
url
=
call
.
argument
(
"url"
);
if
(
TextUtils
.
isEmpty
(
url
))
{
if
(
TextUtils
.
isEmpty
(
url
))
{
return
;
return
;
}
}
mKelperTask
=
KeplerApiManager
.
getWebViewService
().
openAppWebViewPage
(
getActivity
(),
// mKelperTask = KeplerApiManager.getWebViewService().openAppWebViewPage(getActivity(),
url
,
// url,
mKeplerAttachParameter
,
// mKeplerAttachParameter,
mOpenAppAction
);
// mOpenAppAction);
KeplerApiManager
.
getWebViewService
().
openJDUrlWebViewPage
(
url
,
mKeplerAttachParameter
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment