Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
SuperEasyClean
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
songjianyu
SuperEasyClean
Commits
ad432fec
Commit
ad432fec
authored
Jun 12, 2025
by
songjianyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修复】电池通知问题,设置页面广告太大
parent
2b7848fc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
99 deletions
+97
-99
MyApplication.kt
app/src/main/java/com/easy/clean/MyApplication.kt
+4
-2
BatteryNotification.kt
...y/clean/business/push/notification/BatteryNotification.kt
+9
-9
NotificationUiUtil.kt
...sy/clean/business/push/notification/NotificationUiUtil.kt
+16
-10
StayJobService.kt
...in/java/com/easy/clean/business/service/StayJobService.kt
+0
-12
SplashActivity.kt
app/src/main/java/com/easy/clean/ui/splash/SplashActivity.kt
+4
-1
fragment_settings.xml
app/src/main/res/layout/fragment_settings.xml
+1
-1
layout_admob_native_medium.xml
app/src/main/res/layout/layout_admob_native_medium.xml
+62
-63
layout_battery_stay_small.xml
app/src/main/res/layout/layout_battery_stay_small.xml
+1
-1
No files found.
app/src/main/java/com/easy/clean/MyApplication.kt
View file @
ad432fec
...
@@ -92,7 +92,8 @@ class MyApplication : Application() {
...
@@ -92,7 +92,8 @@ class MyApplication : Application() {
override
fun
onSystemLocaleChange
(
oldLocale
:
Locale
,
newLocale
:
Locale
)
{
override
fun
onSystemLocaleChange
(
oldLocale
:
Locale
,
newLocale
:
Locale
)
{
Log
.
i
(
Log
.
i
(
"MultiLanguages"
,
"监听到系统切换了语种,旧语种:"
+
oldLocale
+
",新语种:"
+
newLocale
+
"MultiLanguages"
,
"监听到系统切换了语种,旧语种:"
+
oldLocale
+
",新语种:"
+
newLocale
+
",是否跟随系统:"
+
MultiLanguages
.
isSystemLanguage
(
this
@MyApplication
)
",是否跟随系统:"
+
MultiLanguages
.
isSystemLanguage
(
this
@MyApplication
)
)
)
}
}
...
@@ -101,7 +102,8 @@ class MyApplication : Application() {
...
@@ -101,7 +102,8 @@ class MyApplication : Application() {
private
fun
initGid
()
{
private
fun
initGid
()
{
Thread
{
Thread
{
val
info
:
AdvertisingIdClient
.
Info
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
applicationContext
)
val
info
:
AdvertisingIdClient
.
Info
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
applicationContext
)
val
advertisingId
=
info
.
id
val
advertisingId
=
info
.
id
AppPreferences
.
getInstance
().
put
(
"gid"
,
advertisingId
)
AppPreferences
.
getInstance
().
put
(
"gid"
,
advertisingId
)
}.
start
()
}.
start
()
...
...
app/src/main/java/com/easy/clean/business/
service
/BatteryNotification.kt
→
app/src/main/java/com/easy/clean/business/
push/notification
/BatteryNotification.kt
View file @
ad432fec
package
com.easy.clean.business.
service
package
com.easy.clean.business.
push.notification
import
android.app.Notification
import
android.app.Notification
import
android.app.NotificationChannel
import
android.app.NotificationChannel
...
@@ -14,7 +14,7 @@ import android.widget.RemoteViews
...
@@ -14,7 +14,7 @@ import android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.core.graphics.drawable.IconCompat
import
com.easy.clean.R
import
com.easy.clean.R
import
com.easy.clean.bean.FeatureBean
.Companion.BATTERY_INFO
import
com.easy.clean.bean.FeatureBean
import
com.easy.clean.ui.batteryinfo.BatteryReceiver
import
com.easy.clean.ui.batteryinfo.BatteryReceiver
import
com.easy.clean.ui.main.MainActivity
import
com.easy.clean.ui.main.MainActivity
import
com.easy.clean.ui.splash.SplashActivity
import
com.easy.clean.ui.splash.SplashActivity
...
@@ -24,14 +24,14 @@ import kotlin.random.Random
...
@@ -24,14 +24,14 @@ import kotlin.random.Random
object
BatteryNotification
{
object
BatteryNotification
{
private
fun
customRemoteViews
(
fun
customRemoteViews
(
context
:
Context
,
context
:
Context
,
contentView
:
RemoteViews
,
contentView
:
RemoteViews
,
expendView
:
RemoteViews
,
expendView
:
RemoteViews
,
)
{
)
{
val
requestCode
=
Random
.
nextInt
(
1800
)
val
requestCode
=
Random
.
Default
.
nextInt
(
1800
)
val
intent
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
val
intent
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
BATTERY_INFO
)
putExtra
(
"actionId"
,
FeatureBean
.
Companion
.
BATTERY_INFO
)
}
}
val
pendingIntent
=
val
pendingIntent
=
PendingIntent
.
getActivity
(
PendingIntent
.
getActivity
(
...
@@ -43,13 +43,13 @@ object BatteryNotification {
...
@@ -43,13 +43,13 @@ object BatteryNotification {
contentView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
contentView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
expendView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
expendView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
//set view
//set view
val
percent
=
BatteryReceiver
.
level
/
BatteryReceiver
.
scale
.
toFloat
()
val
percent
=
BatteryReceiver
.
Companion
.
level
/
BatteryReceiver
.
Companion
.
scale
.
toFloat
()
val
power
=
"${(percent * 100).roundToInt()}%"
val
power
=
"${(percent * 100).roundToInt()}%"
val
remainingCapacity
=
BatteryReceiver
.
mAh
*
percent
val
remainingCapacity
=
BatteryReceiver
.
Companion
.
mAh
*
percent
val
wTime
=
(
remainingCapacity
/
3.0f
).
toInt
()
val
wTime
=
(
remainingCapacity
/
3.0f
).
toInt
()
if
(
BatteryReceiver
.
isCharging
)
{
if
(
BatteryReceiver
.
Companion
.
isCharging
)
{
//充电
//充电
contentView
.
setTextColor
(
R
.
id
.
tv_status
,
Color
.
parseColor
(
"#00E961"
))
contentView
.
setTextColor
(
R
.
id
.
tv_status
,
Color
.
parseColor
(
"#00E961"
))
contentView
.
setTextViewText
(
R
.
id
.
tv_status
,
"Charging"
)
contentView
.
setTextViewText
(
R
.
id
.
tv_status
,
"Charging"
)
contentView
.
setTextColor
(
R
.
id
.
tv_power
,
Color
.
parseColor
(
"#00E961"
))
contentView
.
setTextColor
(
R
.
id
.
tv_power
,
Color
.
parseColor
(
"#00E961"
))
contentView
.
setTextViewText
(
R
.
id
.
tv_power
,
power
)
contentView
.
setTextViewText
(
R
.
id
.
tv_power
,
power
)
...
...
app/src/main/java/com/easy/clean/business/push/notification/NotificationUiUtil.kt
View file @
ad432fec
...
@@ -20,6 +20,7 @@ import com.easy.clean.bean.FeatureBean.Companion.SCREENSHOT_CLEAN
...
@@ -20,6 +20,7 @@ import com.easy.clean.bean.FeatureBean.Companion.SCREENSHOT_CLEAN
import
com.easy.clean.bean.FeatureBean.Companion.SIMILAR_PHOTOS
import
com.easy.clean.bean.FeatureBean.Companion.SIMILAR_PHOTOS
import
com.easy.clean.bean.push.NotificationSendBean
import
com.easy.clean.bean.push.NotificationSendBean
import
com.easy.clean.bean.config.PopupConfigBean
import
com.easy.clean.bean.config.PopupConfigBean
import
com.easy.clean.business.push.notification.BatteryNotification
import
com.easy.clean.ui.splash.SplashActivity
import
com.easy.clean.ui.splash.SplashActivity
import
kotlin.random.Random
import
kotlin.random.Random
...
@@ -69,16 +70,21 @@ object NotificationUiUtil {
...
@@ -69,16 +70,21 @@ object NotificationUiUtil {
}
}
BATTERY_INFO
->
{
BATTERY_INFO
->
{
val
text
=
testNotificationId
+
"Check your phone battery consumption recently!"
// val text = testNotificationId + "Check your phone battery consumption recently!"
sendBean
.
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
).
apply
{
// sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
setTextViewText
(
R
.
id
.
tv1
,
text
)
// setTextViewText(R.id.tv1, text)
debugAction
.
invoke
(
this
)
// debugAction.invoke(this)
}
// }
sendBean
.
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_large
).
apply
{
// sendBean.bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_large).apply {
setTextViewText
(
R
.
id
.
tv1
,
text
)
// setTextViewText(R.id.tv1, text)
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
drawable
.
icon_battery
)
// setImageViewResource(R.id.ivIcon, R.drawable.icon_battery)
debugAction
.
invoke
(
this
)
// debugAction.invoke(this)
}
// }
val
contentView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
layout_battery_stay_small
)
val
expendView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
layout_battery_stay_large
)
BatteryNotification
.
customRemoteViews
(
context
,
contentView
,
expendView
)
sendBean
.
smallRemoteViews
=
contentView
sendBean
.
bigRemoteViews
=
expendView
}
}
LARGE_FILE_CLEAN
->
{
LARGE_FILE_CLEAN
->
{
...
...
app/src/main/java/com/easy/clean/business/service/StayJobService.kt
View file @
ad432fec
...
@@ -63,22 +63,14 @@ class StayJobService : JobService() {
...
@@ -63,22 +63,14 @@ class StayJobService : JobService() {
private
fun
startForeground
()
{
private
fun
startForeground
()
{
try
{
try
{
val
notification
=
createPermanentNotification
(
applicationContext
)
val
notification
=
createPermanentNotification
(
applicationContext
)
val
batteryNotification
=
BatteryNotification
.
createBatteryNotification
(
applicationContext
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
startForeground
(
startForeground
(
NOTIFICATION_STAY_ID
,
NOTIFICATION_STAY_ID
,
notification
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
)
startForeground
(
NOTIFICATION_STAY_ID
+
1
,
batteryNotification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
}
else
{
}
else
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
)
startForeground
(
NOTIFICATION_STAY_ID
,
notification
)
startForeground
(
NOTIFICATION_STAY_ID
+
1
,
batteryNotification
)
}
}
isRunning
=
true
isRunning
=
true
EventUtils
.
event
(
"startForeground"
)
EventUtils
.
event
(
"startForeground"
)
...
@@ -97,10 +89,6 @@ class StayJobService : JobService() {
...
@@ -97,10 +89,6 @@ class StayJobService : JobService() {
NOTIFICATION_STAY_ID
,
NOTIFICATION_STAY_ID
,
createPermanentNotification
(
applicationContext
)
createPermanentNotification
(
applicationContext
)
)
)
notificationManager
.
notify
(
NOTIFICATION_STAY_ID
+
1
,
BatteryNotification
.
createBatteryNotification
(
applicationContext
)
)
}
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
...
...
app/src/main/java/com/easy/clean/ui/splash/SplashActivity.kt
View file @
ad432fec
...
@@ -112,7 +112,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
...
@@ -112,7 +112,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
}
}
private
fun
requestNotificationPermission
()
{
private
fun
requestNotificationPermission
()
{
if
(
isGuided
){
if
(
isGuided
)
{
return
return
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
...
@@ -137,6 +137,9 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
...
@@ -137,6 +137,9 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
viewModel
.
onTick
=
{
p
,
_
->
viewModel
.
onTick
=
{
p
,
_
->
binding
.
progress
.
progress
=
p
.
toInt
()
binding
.
progress
.
progress
=
p
.
toInt
()
}
}
viewModel
.
jumpNext
=
{
jumpNext
()
}
}
}
override
fun
handleBackCallBack
()
{
override
fun
handleBackCallBack
()
{
...
...
app/src/main/res/layout/fragment_settings.xml
View file @
ad432fec
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<com.easy.clean.business.ads.NativeParentView
<com.easy.clean.business.ads.NativeParentView
android:id=
"@+id/flAd"
android:id=
"@+id/flAd"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
180dp
"
android:layout_marginTop=
"12dp"
android:layout_marginTop=
"12dp"
app:layout_constraintTop_toBottomOf=
"@id/cl_top"
>
app:layout_constraintTop_toBottomOf=
"@id/cl_top"
>
...
...
app/src/main/res/layout/layout_admob_native_medium.xml
View file @
ad432fec
...
@@ -5,84 +5,83 @@
...
@@ -5,84 +5,83 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center_vertical"
android:background=
"@color/white"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:paddingHorizontal=
"1
4
dp"
android:paddingHorizontal=
"1
5
dp"
android:paddingTop=
"10dp"
android:paddingTop=
"10dp"
android:paddingBottom=
"15dp"
>
android:paddingBottom=
"15dp"
>
<com.google.android.gms.ads.nativead.MediaView
<com.google.android.gms.ads.nativead.MediaView
android:id=
"@+id/ad_media"
android:id=
"@+id/ad_media"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"152dp"
android:layout_height=
"100dp"
android:layout_marginHorizontal=
"8dp"
/>
android:layout_marginHorizontal=
"8dp"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
<ImageView
android:layout_width=
"match_parent"
android:id=
"@+id/ad_app_icon"
android:layout_height=
"wrap_content"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"15dp"
android:layout_marginTop=
"20dp"
android:orientation=
"vertical"
>
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/ad_media"
<ImageView
tools:ignore=
"ContentDescription"
/>
android:id=
"@+id/ad_app_icon"
android:layout_width=
"51dp"
android:layout_height=
"51dp"
android:layout_gravity=
"center_vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<TextView
<TextView
android:id=
"@+id/ad_headline"
android:id=
"@+id/ad_headline"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"10dp"
android:layout_marginEnd=
"10dp"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"14sp"
android:textSize=
"14sp"
android:textStyle=
"bold"
android:textStyle=
"bold"
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
app:layout_constraintBottom_toTopOf=
"@id/ad_body"
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintTop_toTopOf=
"@id/ad_app_icon"
tools:background=
"@color/colorPrimary"
/>
<TextView
<TextView
android:id=
"@+id/ad_body"
android:id=
"@+id/ad_body"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"10dp"
android:layout_marginTop=
"2dp"
android:ellipsize=
"end"
android:layout_marginEnd=
"10dp"
android:maxLines=
"2"
android:ellipsize=
"end"
android:singleLine=
"true"
android:maxLines=
"2"
android:textColor=
"@color/black"
android:singleLine=
"true"
android:textSize=
"12sp"
android:textColor=
"@color/black"
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
android:textSize=
"12sp"
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintBottom_toBottomOf=
"@id/ad_app_icon"
app:layout_constraintTop_toBottomOf=
"@id/ad_headline"
/>
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintTop_toBottomOf=
"@id/ad_headline"
tools:background=
"@color/colorPrimary"
/>
<androidx.appcompat.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id=
"@+id/ad_call_to_action"
android:id=
"@+id/ad_call_to_action"
android:layout_width=
"104dp"
android:layout_width=
"104dp"
android:layout_height=
"43
dp"
android:layout_height=
"30
dp"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/bg_btn_ad"
android:background=
"@drawable/bg_btn_ad"
android:gravity=
"center"
android:gravity=
"center"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"15sp"
android:textSize=
"15sp"
app:layout_constraintBottom_toBottomOf=
"@id/ad_app_icon"
app:layout_constraintBottom_toBottomOf=
"@id/ad_app_icon"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/ad_app_icon"
app:layout_constraintTop_toTopOf=
"@id/ad_app_icon"
tools:ignore=
"SpeakableTextPresentCheck,TouchTargetSizeCheck,VisualLintButtonSize"
/>
tools:ignore=
"SpeakableTextPresentCheck,TouchTargetSizeCheck,VisualLintButtonSize"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</com.google.android.gms.ads.nativead.NativeAdView>
</com.google.android.gms.ads.nativead.NativeAdView>
\ No newline at end of file
app/src/main/res/layout/layout_battery_stay_small.xml
View file @
ad432fec
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_12"
android:textSize=
"@dimen/sp_12"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:layout_marginEnd=
"
2
0dp"
android:layout_marginEnd=
"
4
0dp"
app:layout_constraintBottom_toBottomOf=
"@id/tv_2"
app:layout_constraintBottom_toBottomOf=
"@id/tv_2"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_power"
/>
app:layout_constraintTop_toTopOf=
"@id/tv_power"
/>
...
...
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