Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
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
android
android_flowbox
Commits
6824b0f8
Commit
6824b0f8
authored
Jul 17, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
80bdeaf4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
27 deletions
+43
-27
MintsApplication.java
app/src/main/java/com/mints/flowbox/MintsApplication.java
+6
-5
AlarmManager.java
...c/main/java/com/mints/flowbox/keepalive/AlarmManager.java
+5
-1
OutAppRouter.kt
...src/main/java/com/mints/flowbox/keepalive/OutAppRouter.kt
+5
-5
CleanActivity.kt
...main/java/com/mints/flowbox/ui/activitys/CleanActivity.kt
+9
-6
ForegroundOrBackground.java
.../java/com/mints/flowbox/utils/ForegroundOrBackground.java
+8
-3
IntentUtils.java
...n/java/com/mints/flowbox/utils/keepalive/IntentUtils.java
+10
-7
No files found.
app/src/main/java/com/mints/flowbox/MintsApplication.java
View file @
6824b0f8
...
...
@@ -36,6 +36,7 @@ import com.mints.flowbox.manager.wifi.WifiDataManager;
import
com.mints.flowbox.net.LoanService
;
import
com.mints.flowbox.ui.activitys.keepalive.TriggerActivity
;
import
com.mints.flowbox.utils.ForegroundOrBackground
;
import
com.mints.flowbox.utils.LogUtil
;
import
com.mints.flowbox.utils.SystemUtils
;
import
com.mints.flowbox.utils.keepalive.ScreenLockerUtils
;
import
com.module.legacy.oreo.RegisterJobUtils
;
...
...
@@ -215,9 +216,10 @@ public class MintsApplication extends BaseApp {
@Override
public
void
onScreenOff
()
{
// if (!ScreenLockerUtils.INSTANCE.canShowScreenLocker(mContext)) {
// return;
// }
if
(!
ScreenLockerUtils
.
INSTANCE
.
canShowScreenLocker
(
mContext
))
{
return
;
}
if
(
WifiDataManager
.
INSTANCE
.
getLockOn
())
{
OutAppRouter
.
INSTANCE
.
showScreenActivity
();
}
...
...
@@ -257,7 +259,6 @@ public class MintsApplication extends BaseApp {
// });
// 监听电话状态
PhoneWatch
.
getInstance
(
this
).
begin
(
new
PhoneWatch
.
PhoneStateListener
()
{
@Override
public
void
onIdle
(
String
phoneNum
,
int
time
)
{
...
...
@@ -467,4 +468,4 @@ public class MintsApplication extends BaseApp {
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/flowbox/keepalive/AlarmManager.java
View file @
6824b0f8
...
...
@@ -131,6 +131,10 @@ public class AlarmManager implements WeakHandler.IHandler {
* 展示定时页面
*/
private
void
showTimingActivity
()
{
if
(
ForegroundOrBackground
.
isForeground2
()
||
ScreenLockerUtils
.
INSTANCE
.
canShowScreenLocker
(
MintsApplication
.
getContext
()))
{
return
;
}
if
(
currentType
>
5
)
{
currentType
=
0
;
}
...
...
@@ -139,7 +143,7 @@ public class AlarmManager implements WeakHandler.IHandler {
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
);
intent
.
putExtra
(
TransparentActivity
.
TIMING_TYPE
,
currentType
++);
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
IntentUtils
.
startActivity
(
intent
);
}
else
{
IntentUtils
.
startActivity2
(
intent
);
}
...
...
app/src/main/java/com/mints/flowbox/keepalive/OutAppRouter.kt
View file @
6824b0f8
...
...
@@ -44,7 +44,7 @@ object OutAppRouter {
intent
.
putExtra
(
ApkActivity
.
APK_PKG_NAME
,
pkgName
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
intent
)
}
else
{
IntentUtils
.
startActivity2
(
intent
)
}
...
...
@@ -64,12 +64,12 @@ object OutAppRouter {
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
if
(
PhoneBrandUtils
.
isHuaweiHonor
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
intent
)
return
}
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
intent
)
}
else
{
IntentUtils
.
startActivity2
(
intent
)
}
...
...
@@ -122,7 +122,7 @@ object OutAppRouter {
intent
.
putExtra
(
TriggerActivity
.
CALL_PHONE_NUM
,
phone
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
intent
)
}
else
{
IntentUtils
.
startActivity2
(
intent
)
}
...
...
@@ -156,7 +156,7 @@ object OutAppRouter {
intent
.
putExtra
(
TriggerActivity
.
TRIGGER_TYPE
,
realType
)
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
or
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
if
(
PhoneBrandUtils
.
isLockScreenProtected
())
{
IntentUtils
.
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
)
IntentUtils
.
startActivity
(
intent
)
}
else
{
IntentUtils
.
startActivity2
(
intent
)
}
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/CleanActivity.kt
View file @
6824b0f8
...
...
@@ -6,7 +6,6 @@ import android.content.Context
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.WindowManager
import
android.view.animation.Animation
...
...
@@ -24,12 +23,12 @@ import com.mints.flowbox.ui.adapter.clean.CleanExpandAdapter
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo
import
com.mints.flowbox.ui.adapter.clean.ExpandInfo.ChildInfo
import
com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import
com.mints.flowbox.utils.CleanRDataUtil
import
com.mints.flowbox.utils.FileUtils
import
com.mints.flowbox.utils.SpanUtils
import
kotlinx.android.synthetic.main.activity_clean.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.view_title.*
import
java.lang.Exception
import
java.util.*
/**
...
...
@@ -491,11 +490,15 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
/** 清理内存 */
private
fun
cleaningOperation
(
ctx
:
Context
,
list
:
List
<
ChildInfo
>)
{
val
am
=
ctx
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
for
(
childInfo
in
list
)
{
if
(
childInfo
.
getName
()
!=
Constant
.
MINTS_PKG_NAME
)
{
am
.
killBackgroundProcesses
(
childInfo
.
pkgName
)
try
{
val
am
=
ctx
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
for
(
childInfo
in
list
)
{
if
(
childInfo
.
pkgName
!=
Constant
.
MINTS_PKG_NAME
)
{
am
.
killBackgroundProcesses
(
childInfo
.
pkgName
)
}
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
...
...
app/src/main/java/com/mints/flowbox/utils/ForegroundOrBackground.java
View file @
6824b0f8
...
...
@@ -64,10 +64,15 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
}
public
static
Activity
getMain_activity
()
{
if
(
main_activity
.
get
()
==
null
)
{
return
app_activity
.
get
();
try
{
if
(
main_activity
.
get
()
==
null
)
{
return
app_activity
.
get
();
}
return
main_activity
.
get
();
}
catch
(
NullPointerException
e
)
{
e
.
printStackTrace
();
return
null
;
}
return
main_activity
.
get
();
}
@Override
...
...
app/src/main/java/com/mints/flowbox/utils/keepalive/IntentUtils.java
View file @
6824b0f8
...
...
@@ -27,9 +27,11 @@ public class IntentUtils {
public
static
final
String
TAG
=
"IntentUtils"
;
public
static
void
startActivity2
(
Intent
intent
)
{
if
(
PhoneBrandUtils
.
isHuaweiHonor
()){
startActivity
(
ForegroundOrBackground
.
getMain_activity
(),
intent
);
return
;
if
(
PhoneBrandUtils
.
isHuaweiHonor
())
{
if
(
ForegroundOrBackground
.
getMain_activity
()
!=
null
)
{
startActivity
(
intent
);
return
;
}
}
try
{
ActivityManagerProxy
.
INSTANCE
.
bringToFront
(
new
BringToFrontListener
()
{
...
...
@@ -47,14 +49,15 @@ public class IntentUtils {
}
}
public
static
void
startActivity
(
Activity
activity
,
Intent
intent
)
{
try
{
public
static
void
startActivity
(
Intent
intent
)
{
if
(
ForegroundOrBackground
.
getMain_activity
()
!=
null
)
{
Activity
activity
=
ForegroundOrBackground
.
getMain_activity
();
moveToFront
(
activity
);
activity
.
startActivity
(
intent
);
activity
.
moveTaskToBack
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
;
}
startActivity2
(
intent
);
}
public
static
Boolean
isRunningForeground
(
Activity
activity
)
{
...
...
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