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
Show 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() {
override
fun
onSystemLocaleChange
(
oldLocale
:
Locale
,
newLocale
:
Locale
)
{
Log
.
i
(
"MultiLanguages"
,
"监听到系统切换了语种,旧语种:"
+
oldLocale
+
",新语种:"
+
newLocale
+
"MultiLanguages"
,
"监听到系统切换了语种,旧语种:"
+
oldLocale
+
",新语种:"
+
newLocale
+
",是否跟随系统:"
+
MultiLanguages
.
isSystemLanguage
(
this
@MyApplication
)
)
}
...
...
@@ -101,7 +102,8 @@ class MyApplication : Application() {
private
fun
initGid
()
{
Thread
{
val
info
:
AdvertisingIdClient
.
Info
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
applicationContext
)
val
info
:
AdvertisingIdClient
.
Info
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
applicationContext
)
val
advertisingId
=
info
.
id
AppPreferences
.
getInstance
().
put
(
"gid"
,
advertisingId
)
}.
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.NotificationChannel
...
...
@@ -14,7 +14,7 @@ import android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
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.main.MainActivity
import
com.easy.clean.ui.splash.SplashActivity
...
...
@@ -24,14 +24,14 @@ import kotlin.random.Random
object
BatteryNotification
{
private
fun
customRemoteViews
(
fun
customRemoteViews
(
context
:
Context
,
contentView
:
RemoteViews
,
expendView
:
RemoteViews
,
)
{
val
requestCode
=
Random
.
nextInt
(
1800
)
val
requestCode
=
Random
.
Default
.
nextInt
(
1800
)
val
intent
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
BATTERY_INFO
)
putExtra
(
"actionId"
,
FeatureBean
.
Companion
.
BATTERY_INFO
)
}
val
pendingIntent
=
PendingIntent
.
getActivity
(
...
...
@@ -43,13 +43,13 @@ object BatteryNotification {
contentView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
expendView
.
setOnClickPendingIntent
(
R
.
id
.
tv_open
,
pendingIntent
)
//set view
val
percent
=
BatteryReceiver
.
level
/
BatteryReceiver
.
scale
.
toFloat
()
val
percent
=
BatteryReceiver
.
Companion
.
level
/
BatteryReceiver
.
Companion
.
scale
.
toFloat
()
val
power
=
"${(percent * 100).roundToInt()}%"
val
remainingCapacity
=
BatteryReceiver
.
mAh
*
percent
val
remainingCapacity
=
BatteryReceiver
.
Companion
.
mAh
*
percent
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
.
setTextColor
(
R
.
id
.
tv_power
,
Color
.
parseColor
(
"#00E961"
))
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
import
com.easy.clean.bean.FeatureBean.Companion.SIMILAR_PHOTOS
import
com.easy.clean.bean.push.NotificationSendBean
import
com.easy.clean.bean.config.PopupConfigBean
import
com.easy.clean.business.push.notification.BatteryNotification
import
com.easy.clean.ui.splash.SplashActivity
import
kotlin.random.Random
...
...
@@ -69,16 +70,21 @@ object NotificationUiUtil {
}
BATTERY_INFO
->
{
val
text
=
testNotificationId
+
"Check your phone battery consumption recently!"
sendBean
.
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
).
apply
{
setTextViewText
(
R
.
id
.
tv1
,
text
)
debugAction
.
invoke
(
this
)
}
sendBean
.
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_large
).
apply
{
setTextViewText
(
R
.
id
.
tv1
,
text
)
setImageViewResource
(
R
.
id
.
ivIcon
,
R
.
drawable
.
icon_battery
)
debugAction
.
invoke
(
this
)
}
// val text = testNotificationId + "Check your phone battery consumption recently!"
// sendBean.smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small).apply {
// setTextViewText(R.id.tv1, text)
// debugAction.invoke(this)
// }
// sendBean.bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_large).apply {
// setTextViewText(R.id.tv1, text)
// setImageViewResource(R.id.ivIcon, R.drawable.icon_battery)
// 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
->
{
...
...
app/src/main/java/com/easy/clean/business/service/StayJobService.kt
View file @
ad432fec
...
...
@@ -63,22 +63,14 @@ class StayJobService : JobService() {
private
fun
startForeground
()
{
try
{
val
notification
=
createPermanentNotification
(
applicationContext
)
val
batteryNotification
=
BatteryNotification
.
createBatteryNotification
(
applicationContext
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
startForeground
(
NOTIFICATION_STAY_ID
+
1
,
batteryNotification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
}
else
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
)
startForeground
(
NOTIFICATION_STAY_ID
+
1
,
batteryNotification
)
}
isRunning
=
true
EventUtils
.
event
(
"startForeground"
)
...
...
@@ -97,10 +89,6 @@ class StayJobService : JobService() {
NOTIFICATION_STAY_ID
,
createPermanentNotification
(
applicationContext
)
)
notificationManager
.
notify
(
NOTIFICATION_STAY_ID
+
1
,
BatteryNotification
.
createBatteryNotification
(
applicationContext
)
)
}
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
}
private
fun
requestNotificationPermission
()
{
if
(
isGuided
){
if
(
isGuided
)
{
return
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
...
...
@@ -137,6 +137,9 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
viewModel
.
onTick
=
{
p
,
_
->
binding
.
progress
.
progress
=
p
.
toInt
()
}
viewModel
.
jumpNext
=
{
jumpNext
()
}
}
override
fun
handleBackCallBack
()
{
...
...
app/src/main/res/layout/fragment_settings.xml
View file @
ad432fec
...
...
@@ -65,7 +65,7 @@
<com.easy.clean.business.ads.NativeParentView
android:id=
"@+id/flAd"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
180dp
"
android:layout_marginTop=
"12dp"
app:layout_constraintTop_toBottomOf=
"@id/cl_top"
>
...
...
app/src/main/res/layout/layout_admob_native_medium.xml
View file @
ad432fec
...
...
@@ -5,36 +5,31 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@color/white"
android:layout_gravity=
"center_vertical"
android:orientation=
"vertical"
android:paddingHorizontal=
"1
4
dp"
android:paddingHorizontal=
"1
5
dp"
android:paddingTop=
"10dp"
android:paddingBottom=
"15dp"
>
<com.google.android.gms.ads.nativead.MediaView
android:id=
"@+id/ad_media"
android:layout_width=
"match_parent"
android:layout_height=
"152dp"
android:layout_marginHorizontal=
"8dp"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
>
android:layout_height=
"100dp"
android:layout_marginHorizontal=
"8dp"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/ad_app_icon"
android:layout_width=
"51
dp"
android:layout_height=
"51
dp"
android:layout_width=
"30
dp"
android:layout_height=
"30
dp"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"20dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent
"
app:layout_constraintTop_toBottomOf=
"@id/ad_media
"
tools:ignore=
"ContentDescription"
/>
<TextView
...
...
@@ -48,29 +43,34 @@
android:textColor=
"@color/black"
android:textSize=
"14sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/ad_body"
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"@id/ad_app_icon"
tools:background=
"@color/colorPrimary"
/>
<TextView
android:id=
"@+id/ad_body"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"2dp"
android:layout_marginEnd=
"10dp"
android:ellipsize=
"end"
android:maxLines=
"2"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"@id/ad_app_icon"
app:layout_constraintEnd_toStartOf=
"@id/ad_call_to_action"
app:layout_constraintStart_toEndOf=
"@id/ad_app_icon"
app:layout_constraintTop_toBottomOf=
"@id/ad_headline"
/>
app:layout_constraintTop_toBottomOf=
"@id/ad_headline"
tools:background=
"@color/colorPrimary"
/>
<androidx.appcompat.widget.AppCompatButton
android:id=
"@+id/ad_call_to_action"
android:layout_width=
"104dp"
android:layout_height=
"43
dp"
android:layout_height=
"30
dp"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/bg_btn_ad"
android:gravity=
"center"
...
...
@@ -83,6 +83,5 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</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 @@
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_12"
android:textStyle=
"bold"
android:layout_marginEnd=
"
2
0dp"
android:layout_marginEnd=
"
4
0dp"
app:layout_constraintBottom_toBottomOf=
"@id/tv_2"
app:layout_constraintEnd_toEndOf=
"parent"
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