Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
Out
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xjl
Out
Commits
d0eaad5f
Commit
d0eaad5f
authored
Dec 01, 2023
by
xujialang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新-3 反射和动态代理
parent
c66c9801
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
18 deletions
+110
-18
OutHelp.java
app/src/main/java/com/zl/sdk/OutHelp.java
+81
-3
OutAdManager.java
app/src/main/java/com/zl/sdk/out/OutAdManager.java
+4
-4
SLKManager.java
app/src/main/java/com/zl/sdk/out/SLKManager.java
+25
-11
No files found.
app/src/main/java/com/zl/sdk/OutHelp.java
View file @
d0eaad5f
...
...
@@ -9,14 +9,21 @@ import android.content.IntentFilter;
import
androidx.annotation.Keep
;
import
com.blankj.utilcode.util.AppUtils
;
import
com.pgl.ssdk.C
;
import
com.zl.sdk.ad.topOn.TopOnAdManager
;
import
com.zl.sdk.bean.AdAppInfo
;
import
com.zl.sdk.event.EventUtils
;
import
com.zl.sdk.icon.IconHelp
;
import
com.zl.sdk.out.ActionFrom
;
import
com.zl.sdk.out.DialogShowStatusCallback
;
import
com.zl.sdk.out.OutAdManager
;
import
com.zl.sdk.util.LogUtil
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Proxy
;
import
java.util.Timer
;
import
java.util.TimerTask
;
...
...
@@ -54,7 +61,7 @@ public final class OutHelp implements KPListener {
* @param isDebug appId
* @param isDebug appKey
*/
public
void
init
(
Context
context
,
boolean
isDebug
,
String
appId
,
String
appKey
)
{
public
void
init
(
Context
context
,
boolean
isDebug
,
String
appId
,
String
appKey
)
{
this
.
mContext
=
context
;
this
.
isDebug
=
isDebug
;
...
...
@@ -121,6 +128,15 @@ public final class OutHelp implements KPListener {
}
public
void
startDialogSuccess
()
{
LogUtil
.
d
(
TAG
+
"广告SLK 拉起成功"
);
try
{
EventUtils
.
statRemindOutFgSurpriseStart
(
EventUtils
.
SLK_START_OK
,
""
,
,
actionState
);
}
catch
(
Throwable
throwable
)
{
}
}
// /**
// * 设置广告数据
// *
...
...
@@ -159,7 +175,21 @@ public final class OutHelp implements KPListener {
*/
@Override
public
boolean
isInit
()
{
return
false
;
try
{
Class
<?>
kpClass
=
Class
.
forName
(
"KplvManager"
);
Method
instanceMethod
=
kpClass
.
getMethod
(
"getInstance"
);
Object
obj
=
instanceMethod
.
invoke
(
null
);
Method
isInitMethod
=
kpClass
.
getMethod
(
"isInit"
);
Object
isInit
=
isInitMethod
.
invoke
(
kpClass
.
cast
(
obj
));
if
(
isInit
!=
null
)
{
return
(
boolean
)
isInit
;
}
else
{
return
false
;
}
}
catch
(
ClassNotFoundException
|
InvocationTargetException
|
NoSuchMethodException
|
IllegalAccessException
e
)
{
return
false
;
}
}
/**
...
...
@@ -178,15 +208,63 @@ public final class OutHelp implements KPListener {
/**
* 反射调用保活拉起弹窗
*
* @param intent
* @param callback
*/
@Override
public
void
startOutDialog
(
Intent
intent
,
DialogShowStatusCallback
callback
)
{
try
{
Class
<?>
fgClass
=
Class
.
forName
(
"FG"
);
Method
surpriseMethod
=
fgClass
.
getMethod
(
"surprise"
);
Class
<?>
startCallbackClass
=
Class
.
forName
(
"StartCallback"
);
Constructor
constructor
=
startCallbackClass
.
getConstructor
();
Object
callObj
=
constructor
.
newInstance
();
Object
newCallBack
=
Proxy
.
newProxyInstance
(
startCallbackClass
.
getClassLoader
(),
new
Class
[]{
startCallbackClass
},
new
StartCallbackProxy
(
callObj
,
callback
)
);
surpriseMethod
.
invoke
(
null
,
mContext
,
intent
,
""
,
true
,
newCallBack
);
}
catch
(
ClassNotFoundException
|
InvocationTargetException
|
NoSuchMethodException
|
IllegalAccessException
|
InstantiationException
e
)
{
if
(
callback
!=
null
)
{
callback
.
fail
(
"执行失败"
);
}
}
}
public
class
StartCallbackProxy
implements
InvocationHandler
{
private
Object
proxyObj
;
private
DialogShowStatusCallback
callback
;
public
StartCallbackProxy
(
Object
obj
,
DialogShowStatusCallback
callback
)
{
this
.
proxyObj
=
obj
;
this
.
callback
=
callback
;
}
@Override
public
Object
invoke
(
Object
o
,
Method
method
,
Object
[]
objects
)
throws
Throwable
{
if
(
callback
!=
null
)
{
if
(
"onSuccess"
.
equals
(
method
.
getName
()))
{
callback
.
success
();
}
else
if
(
"onFail"
.
equals
(
method
.
getName
()))
{
if
(
objects
.
length
>=
2
)
{
callback
.
fail
((
String
)
objects
[
1
]);
}
else
{
callback
.
fail
(
"unknown"
);
}
}
}
return
method
.
invoke
(
proxyObj
,
objects
);
}
}
public
static
class
TriggerReceiver
extends
BroadcastReceiver
{
public
class
TriggerReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
intent
==
null
)
{
...
...
app/src/main/java/com/zl/sdk/out/OutAdManager.java
View file @
d0eaad5f
...
...
@@ -333,10 +333,11 @@ public class OutAdManager extends BaseOutShowManager {
// if (!(context instanceof Activity)) {
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// }
intent
.
putExtra
(
Config
.
KEY_WEATHER_REMINDERS_INFO
,
(
Parcelable
)
remindersInfo
);
intent
.
putExtra
(
Config
.
KEY_WEATHER_AD_DATA
,
data
);
//
intent.putExtra(Config.KEY_WEATHER_REMINDERS_INFO, (Parcelable) remindersInfo);
//
intent.putExtra(Config.KEY_WEATHER_AD_DATA, data);
SLKManager
.
get
().
resetIntent
(
intent
);
SLKManager
.
get
().
setOutRemindersInfo
(
remindersInfo
);
SLKManager
.
get
().
setOutAdData
(
data
);
EventUtils
.
statRemindOutFgSurpriseStart
(
EventUtils
.
SLK_START
,
""
,
isShow
,
actionFrom
.
getAction
());
...
...
@@ -346,7 +347,6 @@ public class OutAdManager extends BaseOutShowManager {
LogUtil
.
d
(
TAG
+
"拉起广告SLK"
);
OutHelp
.
get
().
startOutDialog
(
intent
,
new
DialogShowStatusCallback
()
{
@Override
public
void
success
()
{
...
...
app/src/main/java/com/zl/sdk/out/SLKManager.java
View file @
d0eaad5f
...
...
@@ -2,6 +2,9 @@ package com.zl.sdk.out;
import
android.content.Intent
;
import
com.zl.sdk.bean.RemindersInfo
;
import
com.zl.sdk.bean.WeatherAdData
;
public
class
SLKManager
{
private
SLKManager
()
{
}
...
...
@@ -16,7 +19,28 @@ public class SLKManager {
private
static
final
String
TAG
=
"OutShow SLKManager --> "
;
// private final Stack<Activity> appOutActivities = new Stack<Activity>();
private
RemindersInfo
outRemindersInfo
=
null
;
private
WeatherAdData
.
NormalAdData
outAdData
=
null
;
public
RemindersInfo
getOutRemindersInfo
()
{
return
outRemindersInfo
;
}
public
void
setOutRemindersInfo
(
RemindersInfo
outRemindersInfo
)
{
this
.
outRemindersInfo
=
outRemindersInfo
;
}
public
WeatherAdData
.
NormalAdData
getOutAdData
()
{
return
outAdData
;
}
public
void
setOutAdData
(
WeatherAdData
.
NormalAdData
outAdData
)
{
this
.
outAdData
=
outAdData
;
}
// private final Stack<Activity> appOutActivities = new Stack<Activity>();
//
//
// public boolean existAppOutActivities() {
...
...
@@ -51,14 +75,4 @@ public class SLKManager {
//
// appOutActivities.clear();
// }
private
Intent
intent
=
null
;
public
void
resetIntent
(
Intent
intent
)
{
this
.
intent
=
intent
;
}
public
Intent
getIntent
()
{
return
intent
;
}
}
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