Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Easy Cleaner Junk
Commits
9e72fc89
Commit
9e72fc89
authored
Jun 25, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'free-master' of gitlab.huolea.com:koko/easy-junk-cleaner-6-18 into free-master
# Conflicts: # app/src/main/AndroidManifest.xml
parents
b33aa88a
d91e3fae
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
50 additions
and
334 deletions
+50
-334
build.gradle
app/build.gradle
+14
-14
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+3
-6
SettingActivity.kt
...com/test/easy/easycleanerjunk/activity/SettingActivity.kt
+10
-18
NewSplashActivity.kt
...easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
+6
-8
CloseNotificationReceiver.kt
...easy/easycleanerjunk/display/CloseNotificationReceiver.kt
+0
-30
NotificationService.kt
.../test/easy/easycleanerjunk/display/NotificationService.kt
+0
-38
NotificationUtils.kt
...om/test/easy/easycleanerjunk/display/NotificationUtils.kt
+0
-99
InstallHelps.kt
.../java/com/test/easy/easycleanerjunk/helps/InstallHelps.kt
+0
-37
FlashlightService.kt
...om/test/easy/easycleanerjunk/service/FlashlightService.kt
+0
-46
BarUtils.kt
...main/java/com/test/easy/easycleanerjunk/utils/BarUtils.kt
+17
-25
DeviceUtils.java
...java/com/test/easy/easycleanerjunk/utils/DeviceUtils.java
+0
-13
No files found.
app/build.gradle
View file @
9e72fc89
...
@@ -81,9 +81,9 @@ dependencies {
...
@@ -81,9 +81,9 @@ dependencies {
androidTestImplementation
'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.5.1'
implementation
(
"com.google.android.gms:play-services-ads:23.1.0"
)
implementation
(
"com.google.android.gms:play-services-ads:23.1.0"
)
implementation
'com.google.ads.mediation:applovin:12.4.3.0'
implementation
'com.google.ads.mediation:applovin:12.4.3.0'
implementation
'com.google.ads.mediation:fyber:8.2.7.0'
//
implementation 'com.google.ads.mediation:fyber:8.2.7.0'
implementation
'com.google.ads.mediation:ironsource:8.0.0.1'
//
implementation 'com.google.ads.mediation:ironsource:8.0.0.1'
implementation
'com.google.ads.mediation:vungle:7.3.1.0'
//
implementation 'com.google.ads.mediation:vungle:7.3.1.0'
implementation
'com.google.ads.mediation:facebook:6.17.0.0'
implementation
'com.google.ads.mediation:facebook:6.17.0.0'
implementation
'com.google.ads.mediation:mintegral:16.7.21.0'
implementation
'com.google.ads.mediation:mintegral:16.7.21.0'
implementation
'com.google.ads.mediation:pangle:5.9.0.4.0'
implementation
'com.google.ads.mediation:pangle:5.9.0.4.0'
...
@@ -91,22 +91,22 @@ dependencies {
...
@@ -91,22 +91,22 @@ dependencies {
implementation
'com.airbnb.android:lottie:6.4.0'
implementation
'com.airbnb.android:lottie:6.4.0'
implementation
platform
(
'com.google.firebase:firebase-bom:32.3.1'
)
implementation
platform
(
'com.google.firebase:firebase-bom:32.3.1'
)
implementation
'com.google.firebase:firebase-analytics:21.6.2'
implementation
'com.google.firebase:firebase-analytics:21.6.2'
implementation
'com.google.firebase:firebase-crashlytics'
//
implementation 'com.google.firebase:firebase-crashlytics'
implementation
(
"com.squareup.okhttp3:okhttp:4.9.0"
)
//
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation
(
"com.squareup.okhttp3:logging-interceptor:4.9.0"
)
//
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")
implementation
(
"com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.6"
)
implementation
(
"com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.6"
)
implementation
(
"com.github.pokercc:ExpandableRecyclerView:0.9.3"
)
implementation
(
"com.github.pokercc:ExpandableRecyclerView:0.9.3"
)
def
roomVersion
=
"2.5.0"
//
def roomVersion = "2.5.0"
implementation
(
"androidx.room:room-runtime:$roomVersion"
)
//
implementation("androidx.room:room-runtime:$roomVersion")
annotationProcessor
(
"androidx.room:room-compiler:$roomVersion"
)
//
annotationProcessor("androidx.room:room-compiler:$roomVersion")
kapt
(
"androidx.room:room-compiler:$roomVersion"
)
//
kapt("androidx.room:room-compiler:$roomVersion")
implementation
(
"androidx.room:room-ktx:$roomVersion"
)
//
implementation("androidx.room:room-ktx:$roomVersion")
implementation
group:
'com.google.code.gson'
,
name:
'gson'
,
version:
'2.10.1'
implementation
group:
'com.google.code.gson'
,
name:
'gson'
,
version:
'2.10.1'
implementation
'com.belerweb:pinyin4j:2.5.1'
//
implementation 'com.belerweb:pinyin4j:2.5.1'
implementation
(
"com.google.firebase:firebase-messaging"
)
//
implementation("com.google.firebase:firebase-messaging")
implementation
(
"com.facebook.android:facebook-android-sdk:[8,9)"
)
//
implementation("com.facebook.android:facebook-android-sdk:[8,9)")
implementation
'com.makeramen:roundedimageview:2.3.0'
implementation
'com.makeramen:roundedimageview:2.3.0'
implementation
'com.mikhaellopez:circularprogressbar:3.1.0'
implementation
'com.mikhaellopez:circularprogressbar:3.1.0'
...
...
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
9e72fc89
...
@@ -4,15 +4,12 @@ import android.annotation.SuppressLint
...
@@ -4,15 +4,12 @@ import android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Process
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
com.google.android.gms.ads.MobileAds
import
com.google.android.gms.ads.MobileAds
import
com.google.firebase.FirebaseApp
import
com.google.firebase.FirebaseApp
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.InstallHelps
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
...
@@ -44,9 +41,9 @@ class MyApplication : BaseApplication() {
...
@@ -44,9 +41,9 @@ class MyApplication : BaseApplication() {
fun
initApp
()
{
fun
initApp
()
{
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
initNotificationWork
()
initNotificationWork
()
MainScope
().
launch
{
//
MainScope().launch {
InstallHelps
.
init
()
//
InstallHelps.init()
}
//
}
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
}
}
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/SettingActivity.kt
View file @
9e72fc89
...
@@ -4,7 +4,6 @@ import android.content.Intent
...
@@ -4,7 +4,6 @@ import android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Build
import
com.test.easy.easycleanerjunk.databinding.ActivitySettingBinding
import
com.test.easy.easycleanerjunk.databinding.ActivitySettingBinding
import
com.test.easy.easycleanerjunk.display.NotificationService
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.allNotification
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.allNotification
...
@@ -27,15 +26,15 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
...
@@ -27,15 +26,15 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
finishToMain
()
finishToMain
()
// }
// }
}
}
binding
.
switchRemainNotification
.
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
//
binding.switchRemainNotification.setOnCheckedChangeListener { buttonView, isChecked ->
remainNotification
=
isChecked
//
remainNotification = isChecked
if
(
isChecked
)
{
//
if (isChecked) {
startNotification
()
//
startNotification()
}
else
{
//
} else {
val
serviceIntent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
//
val serviceIntent = Intent(this, NotificationService::class.java)
stopService
(
serviceIntent
)
//
stopService(serviceIntent)
}
//
}
}
//
}
binding
.
cardPrivacy
.
setOnClickListener
{
binding
.
cardPrivacy
.
setOnClickListener
{
val
intent
=
Intent
(
val
intent
=
Intent
(
...
@@ -45,12 +44,5 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
...
@@ -45,12 +44,5 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
startActivity
(
intent
)
startActivity
(
intent
)
}
}
}
}
private
fun
startNotification
()
{
val
intent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
intent
)
}
else
{
startService
(
intent
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
View file @
9e72fc89
...
@@ -10,8 +10,6 @@ import android.util.Log
...
@@ -10,8 +10,6 @@ import android.util.Log
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
import
com.test.easy.easycleanerjunk.databinding.ActivityLayoutSplashBinding
import
com.test.easy.easycleanerjunk.databinding.ActivityLayoutSplashBinding
import
com.test.easy.easycleanerjunk.display.CloseNotificationReceiver
import
com.test.easy.easycleanerjunk.display.NotificationService
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.LogEx
...
@@ -72,12 +70,12 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
...
@@ -72,12 +70,12 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
}
}
private
fun
startNotification
()
{
private
fun
startNotification
()
{
val
intent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
//
val intent = Intent(this, NotificationService::class.java)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
//
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService
(
intent
)
//
startForegroundService(intent)
}
else
{
//
} else {
startService
(
intent
)
//
startService(intent)
}
//
}
}
}
override
fun
onProgressMax
()
{
override
fun
onProgressMax
()
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/display/CloseNotificationReceiver.kt
deleted
100644 → 0
View file @
b33aa88a
package
com.test.easy.easycleanerjunk.display
import
android.app.NotificationManager
import
android.content.BroadcastReceiver
import
android.content.Context
import
android.content.Intent
import
com.test.easy.easycleanerjunk.helps.LogEx
class
CloseNotificationReceiver
:
BroadcastReceiver
()
{
private
val
TAG
=
"CloseNotificationReceiver"
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
LogEx
.
logDebug
(
TAG
,
"onReceive intent.action=${intent?.action}"
)
//cancel事件,经过测试Intent.action这里无法传递参数
if
(
intent
?.
action
==
null
)
{
}
intent
?.
let
{
val
notificationId
=
it
.
getIntExtra
(
"notificationId"
,
-
1
)
LogEx
.
logDebug
(
TAG
,
"notificationId=$notificationId action=$action"
)
if
(
notificationId
!=
-
1
&&
it
.
action
!=
"DELETE_NOTIFICATION"
)
{
val
notificationManager
=
context
?.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
?
NotificationManager
notificationManager
?.
cancel
(
NotificationUtils
.
NOTIFICATION_TAG
,
notificationId
)
}
}
}
companion
object
{
const
val
action
=
"com.file.notification.CloseNotificationReceiver"
}
}
app/src/main/java/com/test/easy/easycleanerjunk/display/NotificationService.kt
deleted
100644 → 0
View file @
b33aa88a
package
com.test.easy.easycleanerjunk.display
import
android.app.Service
import
android.content.Intent
import
android.os.IBinder
class
NotificationService
:
Service
()
{
companion
object
{
var
isRunning
=
false
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
if
(
isRunning
)
{
stopSelf
()
return
START_NOT_STICKY
}
val
notification
=
NotificationUtils
.
createPermanentNotification
(
applicationContext
)
startForeground
(
1
,
notification
)
return
START_STICKY
}
override
fun
onBind
(
intent
:
Intent
?):
IBinder
?
{
return
null
}
override
fun
onDestroy
()
{
isRunning
=
false
super
.
onDestroy
()
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/display/NotificationUtils.kt
deleted
100644 → 0
View file @
b33aa88a
package
com.test.easy.easycleanerjunk.display
import
android.app.Notification
import
android.app.NotificationChannel
import
android.app.NotificationManager
import
android.app.PendingIntent
import
android.content.ComponentName
import
android.content.Context
import
android.content.Intent
import
android.os.Build
import
android.util.Log
import
android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
com.test.easy.easycleanerjunk.R
import
com.test.easy.easycleanerjunk.activity.ScanJunkActivity
import
com.test.easy.easycleanerjunk.activity.home.NewMainActivity
import
com.test.easy.easycleanerjunk.service.FlashlightService
object
NotificationUtils
{
const
val
NOTIFICATION_TAG
=
"SmartCleanNotification"
fun
createPermanentNotification
(
context
:
Context
):
Notification
{
Log
.
d
(
"startForegroundService"
,
"Start foreground service."
)
val
isOngoing
=
true
//是否持续(为不消失的常驻通知)
val
channelName
=
context
.
resources
.
getString
(
R
.
string
.
foreground_service_channel
)
val
channelId
=
"Service_Id"
val
category
=
Notification
.
CATEGORY_SERVICE
val
contentView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
reminder_layout_notification_notify
)
val
expendView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
reminder_layout_notification_big_notify
)
val
intent0
=
Intent
(
context
,
ScanJunkActivity
::
class
.
java
)
val
pendingIntent0
=
PendingIntent
.
getActivity
(
context
,
0
,
intent0
,
PendingIntent
.
FLAG_IMMUTABLE
)
contentView
.
setOnClickPendingIntent
(
R
.
id
.
id_ll_clean
,
pendingIntent0
)
expendView
.
setOnClickPendingIntent
(
R
.
id
.
id_ll_clean
,
pendingIntent0
)
// val intent2 = Intent(context, ::class.java)
// val pendingIntent2 =
// PendingIntent.getActivity(context, 0, intent2, PendingIntent.FLAG_IMMUTABLE)
// contentView.setOnClickPendingIntent(R.id.id_battery, pendingIntent2)
// expendView.setOnClickPendingIntent(R.id.id_battery, pendingIntent2)
val
intent3
=
Intent
()
val
serviceComponent
=
ComponentName
(
context
,
FlashlightService
::
class
.
java
)
intent3
.
component
=
serviceComponent
val
pendingIntent3
=
PendingIntent
.
getService
(
context
,
0
,
intent3
,
PendingIntent
.
FLAG_IMMUTABLE
)
contentView
.
setOnClickPendingIntent
(
R
.
id
.
id_lighit
,
pendingIntent3
)
expendView
.
setOnClickPendingIntent
(
R
.
id
.
id_lighit
,
pendingIntent3
)
// val intent4 = Intent(context, ::class.java)
// val pendingIntent4 =
// PendingIntent.getActivity(context, 0, intent4, PendingIntent.FLAG_IMMUTABLE)
// contentView.setOnClickPendingIntent(R.id.id_app_manager, pendingIntent4)
// expendView.setOnClickPendingIntent(R.id.id_app_manager, pendingIntent4)
val
nfIntent
=
Intent
(
context
,
NewMainActivity
::
class
.
java
)
val
pendingIntent
=
PendingIntent
.
getActivity
(
context
,
0
,
nfIntent
,
PendingIntent
.
FLAG_IMMUTABLE
)
val
builder
=
NotificationCompat
.
Builder
(
context
,
channelId
)
builder
.
setCustomContentView
(
contentView
)
builder
.
setCustomBigContentView
(
expendView
)
builder
.
setContentIntent
(
pendingIntent
)
//设置PendingIntent
builder
.
setSmallIcon
(
R
.
mipmap
.
logo
)
//设置状态栏内的小图标
builder
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PRIVATE
)
//设置通知公开可见
builder
.
setOngoing
(
isOngoing
)
//设置持续(不消失的常驻通知)
// builder.setCategory(category) //设置类别
builder
.
setAutoCancel
(
false
)
builder
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
//优先级为:重要通知
builder
.
setWhen
(
System
.
currentTimeMillis
())
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
channel
=
NotificationChannel
(
channelId
,
channelName
,
NotificationManager
.
IMPORTANCE_LOW
)
channel
.
lockscreenVisibility
=
1
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
notificationManager
.
createNotificationChannel
(
channel
)
builder
.
setChannelId
(
channelId
)
}
val
notification
=
builder
.
build
()
return
notification
}
}
app/src/main/java/com/test/easy/easycleanerjunk/helps/InstallHelps.kt
deleted
100644 → 0
View file @
b33aa88a
package
com.test.easy.easycleanerjunk.helps
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerStateListener
import
org.json.JSONObject
object
InstallHelps
{
fun
init
()
{
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
try
{
when
(
responseCode
)
{
InstallReferrerClient
.
InstallReferrerResponse
.
OK
->
{
val
response
=
referrerClient
.
installReferrer
val
installInfo
=
response
.
installReferrer
val
obj
=
JSONObject
()
obj
.
put
(
"referrerUrl"
,
response
.
installReferrer
)
obj
.
put
(
"referrerClickTime"
,
response
.
referrerClickTimestampSeconds
)
obj
.
put
(
"appInstallTime"
,
response
.
installBeginTimestampSeconds
)
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
}
else
->
{
}
}
}
catch
(
_
:
Exception
)
{
}
}
override
fun
onInstallReferrerServiceDisconnected
()
{
}
})
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/service/FlashlightService.kt
deleted
100644 → 0
View file @
b33aa88a
package
com.test.easy.easycleanerjunk.service
import
android.app.Service
import
android.content.Context
import
android.content.Intent
import
android.hardware.camera2.CameraAccessException
import
android.hardware.camera2.CameraManager
import
android.os.Build
import
android.os.IBinder
import
android.util.Log
class
FlashlightService
:
Service
()
{
private
var
cameraManager
:
CameraManager
?
=
null
private
var
flashlightOn
=
false
override
fun
onCreate
()
{
super
.
onCreate
()
cameraManager
=
getSystemService
(
Context
.
CAMERA_SERVICE
)
as
CameraManager
?
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
try
{
val
cameraId
=
cameraManager
!!
.
cameraIdList
[
0
]
flashlightOn
=
if
(
flashlightOn
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
cameraManager
!!
.
setTorchMode
(
cameraId
,
false
)
}
false
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
cameraManager
!!
.
setTorchMode
(
cameraId
,
true
)
}
true
}
}
catch
(
e
:
CameraAccessException
)
{
e
.
printStackTrace
()
}
return
START_NOT_STICKY
}
override
fun
onBind
(
p0
:
Intent
?):
IBinder
?
{
return
null
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/utils/BarUtils.kt
View file @
9e72fc89
...
@@ -23,25 +23,22 @@ object BarUtils {
...
@@ -23,25 +23,22 @@ object BarUtils {
}
}
private
fun
setStatusBarLightMode
(
window
:
Window
,
isLightMode
:
Boolean
)
{
private
fun
setStatusBarLightMode
(
window
:
Window
,
isLightMode
:
Boolean
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
val
decorView
=
window
.
decorView
val
decorView
=
window
.
decorView
var
vis
=
decorView
.
systemUiVisibility
var
vis
=
decorView
.
systemUiVisibility
vis
=
if
(
isLightMode
)
{
vis
=
if
(
isLightMode
)
{
vis
or
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
vis
or
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
else
{
}
else
{
vis
and
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
.
inv
()
vis
and
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
.
inv
()
}
}
decorView
.
systemUiVisibility
=
vis
decorView
.
systemUiVisibility
=
vis
}
}
}
fun
setStatusBarColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
):
View
?
{
fun
setStatusBarColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
):
View
?
{
return
setStatusBarColor
(
activity
,
color
,
false
)
return
setStatusBarColor
(
activity
,
color
,
false
)
}
}
private
fun
setStatusBarColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
,
isDecor
:
Boolean
):
View
?
{
private
fun
setStatusBarColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
,
isDecor
:
Boolean
):
View
?
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
return
null
transparentStatusBar
(
activity
)
transparentStatusBar
(
activity
)
return
applyStatusBarColor
(
activity
,
color
,
isDecor
)
return
applyStatusBarColor
(
activity
,
color
,
isDecor
)
}
}
...
@@ -53,18 +50,13 @@ object BarUtils {
...
@@ -53,18 +50,13 @@ object BarUtils {
}
}
private
fun
transparentStatusBar
(
window
:
Window
)
{
private
fun
transparentStatusBar
(
window
:
Window
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
return
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
val
option
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
or
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
val
vis
=
window
.
decorView
.
systemUiVisibility
val
option
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
or
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
decorView
.
systemUiVisibility
=
option
or
vis
val
vis
=
window
.
decorView
.
systemUiVisibility
window
.
statusBarColor
=
Color
.
TRANSPARENT
window
.
decorView
.
systemUiVisibility
=
option
or
vis
}
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
else
{
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
}
private
fun
applyStatusBarColor
(
window
:
Window
,
color
:
Int
,
isDecor
:
Boolean
):
View
{
private
fun
applyStatusBarColor
(
window
:
Window
,
color
:
Int
,
isDecor
:
Boolean
):
View
{
val
parent
=
val
parent
=
...
...
app/src/main/java/com/test/easy/easycleanerjunk/utils/DeviceUtils.java
View file @
9e72fc89
...
@@ -8,8 +8,6 @@ import android.view.WindowManager;
...
@@ -8,8 +8,6 @@ import android.view.WindowManager;
public
class
DeviceUtils
{
public
class
DeviceUtils
{
private
static
final
String
TAG
=
"DeviceUtils"
;
/**
/**
* 获取屏幕宽度
* 获取屏幕宽度
*/
*/
...
@@ -30,15 +28,4 @@ public class DeviceUtils {
...
@@ -30,15 +28,4 @@ public class DeviceUtils {
return
dm
.
heightPixels
;
return
dm
.
heightPixels
;
}
}
public
static
String
[]
getABIs
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
Build
.
SUPPORTED_ABIS
;
}
else
{
if
(!
TextUtils
.
isEmpty
(
Build
.
CPU_ABI2
))
{
return
new
String
[]{
Build
.
CPU_ABI
,
Build
.
CPU_ABI2
};
}
return
new
String
[]{
Build
.
CPU_ABI
};
}
}
}
}
\ No newline at end of file
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