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
abe3e356
Commit
abe3e356
authored
Mar 14, 2024
by
xujialang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
icon隐藏
parent
65bac588
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
28 deletions
+33
-28
OutHelp.java
app/src/main/java/com/zl/sdk/OutHelp.java
+2
-0
IconOpt.java
app/src/main/java/com/zl/sdk/bean/IconOpt.java
+3
-0
OutConfig.java
app/src/main/java/com/zl/sdk/bean/OutConfig.java
+1
-1
IcOptManager.java
app/src/main/java/com/zl/sdk/icon/IcOptManager.java
+27
-27
No files found.
app/src/main/java/com/zl/sdk/OutHelp.java
View file @
abe3e356
...
...
@@ -386,8 +386,10 @@ public final class OutHelp implements KPListener {
Method
clsMethod
=
kpClass
.
getMethod
(
NameInterfaceHelp
.
GetAppRunForegroundMethod
);
Object
isAppInFront
=
clsMethod
.
invoke
(
null
);
if
(
isAppInFront
!=
null
)
{
LogUtil
.
d
(
TAG
+
"获取前后台:"
+
isAppInFront
);
return
(
boolean
)
isAppInFront
;
}
else
{
LogUtil
.
d
(
TAG
+
"获取前后台(null):false"
);
return
false
;
}
}
catch
(
ClassNotFoundException
|
InvocationTargetException
|
NoSuchMethodException
|
...
...
app/src/main/java/com/zl/sdk/bean/IconOpt.java
View file @
abe3e356
package
com
.
zl
.
sdk
.
bean
;
import
androidx.annotation.Keep
;
import
com.google.gson.annotations.SerializedName
;
import
java.io.Serializable
;
@Keep
public
class
IconOpt
implements
Serializable
{
@SerializedName
(
"is_screen_off"
)
public
boolean
is_screen_off
=
false
;
...
...
app/src/main/java/com/zl/sdk/bean/OutConfig.java
View file @
abe3e356
...
...
@@ -15,7 +15,7 @@ public class OutConfig implements Serializable {
@Override
public
String
toString
()
{
return
"
IconAd
Config{"
+
return
"
Out
Config{"
+
"retry_interval_time="
+
retry_interval_time
+
", retry_times="
+
retry_times
+
'}'
;
...
...
app/src/main/java/com/zl/sdk/icon/IcOptManager.java
View file @
abe3e356
...
...
@@ -115,34 +115,34 @@ public class IcOptManager {
return
;
}
//
//隐藏icon的时间间隔
// long intervalTime = 0
;
//
if (iconOpt.hide_interval_time != 0) {
//
intervalTime = iconOpt.hide_interval_time * 60 * 1000L;
//
} else {
//
intervalTime = 60 * 60 * 1000L;
//
}
//
//
//用户上次进入app的时间
//
long lastUserTime = getEnterAppTime();
//
if (lastUserTime == -1) {
//
//如果用户没有进入过app,则用apk的上次安装时间
//
lastUserTime = PkgUtils.getAppLastInstallTime(context);
//
}
//
//
boolean isInterval = Math.abs(System.currentTimeMillis() - lastUserTime) > intervalTime;
//
//
LogUtil.d(TAG + "isInterval:" + isInterval + ",intervalTime:" + intervalTime + ",,lastUserTime:" + lastUserTime);
//
//
if (isInterval) {
//隐藏icon的时间间隔
long
intervalTime
;
if
(
iconOpt
.
hide_interval_time
!=
0
)
{
intervalTime
=
iconOpt
.
hide_interval_time
*
60
*
1000L
;
}
else
{
intervalTime
=
60
*
60
*
1000L
;
}
//用户上次进入app的时间
long
lastUserTime
=
getEnterAppTime
();
if
(
lastUserTime
==
-
1
)
{
//如果用户没有进入过app,则用apk的上次安装时间
lastUserTime
=
PkgUtils
.
getAppLastInstallTime
(
context
);
}
boolean
isInterval
=
Math
.
abs
(
System
.
currentTimeMillis
()
-
lastUserTime
)
>
intervalTime
;
LogUtil
.
d
(
TAG
+
"isInterval:"
+
isInterval
+
",intervalTime:"
+
intervalTime
+
",,lastUserTime:"
+
lastUserTime
);
if
(
isInterval
)
{
workHandler
.
removeMessages
(
MSG_ICON_OPERATOR
);
Message
message
=
Message
.
obtain
();
message
.
what
=
MSG_ICON_OPERATOR
;
message
.
obj
=
iconOpt
;
workHandler
.
sendMessage
(
message
);
//
} else {
//
stat("check", "isInterval is false");
//
}
}
else
{
stat
(
"check"
,
"isInterval is false"
);
}
}
public
void
saveEnterAppTime
(
long
time
)
{
...
...
@@ -160,6 +160,7 @@ public class IcOptManager {
}
int
operator
=
iconOpt
.
hide_sw
;
LogUtil
.
d
(
TAG
+
"operator :"
+
operator
);
if
(
operator
==
OPERATOR_DO_NOTHING
)
{
return
;
}
...
...
@@ -186,15 +187,15 @@ public class IcOptManager {
private
void
hideOperator
(
IconOpt
iconOpt
)
{
stat
(
"start"
,
""
);
LogUtil
.
d
(
TAG
+
"isInit:"
+
OutHelp
.
get
().
isInit
());
if
(!
OutHelp
.
get
().
isInit
())
{
LogUtil
.
d
(
TAG
+
"not alive !"
);
stat
(
"fail"
,
"no init"
);
return
;
}
boolean
isAppFront
=
OutHelp
.
get
().
isAppForeground
();
LogUtil
.
d
(
TAG
+
"isAppFront:"
+
isAppFront
);
if
(
isAppFront
)
{
LogUtil
.
d
(
TAG
+
"isAppFront :"
+
isAppFront
);
stat
(
"fail"
,
"fg"
);
return
;
}
...
...
@@ -207,8 +208,8 @@ public class IcOptManager {
// return;
// }
LogUtil
.
d
(
TAG
+
"isScreenOn:"
+
isScreenOn
());
if
(
iconOpt
!=
null
&&
iconOpt
.
is_screen_off
&&
isScreenOn
())
{
LogUtil
.
d
(
TAG
+
"sceen on !"
);
stat
(
"fail"
,
"screen on"
);
return
;
}
...
...
@@ -302,7 +303,6 @@ public class IcOptManager {
private
class
ScreenBroadcastReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
LogUtil
.
d
(
TAG
+
"===>>> 灭屏"
);
if
(
Intent
.
ACTION_SCREEN_OFF
.
equals
(
action
))
{
...
...
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