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
c058ff36
Commit
c058ff36
authored
Jun 06, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[新增]添加功能动画期间拦截返回键,添加退出功能弹窗和动画
parent
a8574d5b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
237 additions
and
13 deletions
+237
-13
BaseActivity.kt
app/src/main/java/com/base/appzxhy/base/BaseActivity.kt
+25
-13
FunctionBackDialog.kt
...ain/java/com/base/appzxhy/ui/dialog/FunctionBackDialog.kt
+86
-0
ScreenshotCleanActivity.kt
...com/base/appzxhy/ui/screenshot/ScreenshotCleanActivity.kt
+4
-0
dialog_function_back.xml
app/src/main/res/layout/dialog_function_back.xml
+109
-0
strings.xml
app/src/main/res/values/strings.xml
+13
-0
No files found.
app/src/main/java/com/base/appzxhy/base/BaseActivity.kt
View file @
c058ff36
...
...
@@ -19,6 +19,7 @@ import androidx.activity.addCallback
import
androidx.activity.enableEdgeToEdge
import
androidx.activity.result.ActivityResult
import
androidx.activity.result.ActivityResultCallback
import
androidx.annotation.CallSuper
import
androidx.annotation.ColorInt
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.widget.AppCompatTextView
...
...
@@ -46,6 +47,7 @@ import com.base.appzxhy.business.ads.NativeParentView
import
com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.ui.batteryinfo.BatteryInfoActivity
import
com.base.appzxhy.ui.clean.JunkCleanActivity
import
com.base.appzxhy.ui.dialog.FunctionBackDialog
import
com.base.appzxhy.ui.largefile.LargeFileCleanActivity
import
com.base.appzxhy.ui.main.MainActivity
import
com.base.appzxhy.ui.photocompression.PhotoCompressionActivity
...
...
@@ -119,7 +121,7 @@ abstract class BaseActivity<VB : ViewBinding>(
// } else {
// }
}
@CallSuper
protected
open
fun
initView
()
{
setBackPressed
()
}
...
...
@@ -287,8 +289,6 @@ abstract class BaseActivity<VB : ViewBinding>(
}
protected
var
isBackDisable
=
false
@SuppressLint
(
"SetTextI18n"
)
open
fun
showAdAnimation
(
lottieConfig
:
LottieEnum
,
...
...
@@ -299,6 +299,12 @@ abstract class BaseActivity<VB : ViewBinding>(
isBackDisable
=
true
var
actionFinsh
=
{
isBackDisable
=
false
finish
?.
invoke
()
}
val
adNext
=
{
val
include
:
View
?
=
findViewById
(
R
.
id
.
layout_animation
)
...
...
@@ -328,7 +334,7 @@ abstract class BaseActivity<VB : ViewBinding>(
tvProgress
?.
text
=
"${value.toInt()}%"
if
(
value
.
toInt
()
==
100
)
{
include
?.
visibility
=
View
.
GONE
finish
?
.
invoke
()
actionFinsh
.
invoke
()
}
}
...
...
@@ -348,7 +354,7 @@ abstract class BaseActivity<VB : ViewBinding>(
override
fun
onAnimationEnd
(
animation
:
Animator
)
{
include
?.
visibility
=
View
.
GONE
lottie
?.
cancelAnimation
()
finish
?
.
invoke
()
actionFinsh
.
invoke
()
}
})
}.
start
()
...
...
@@ -356,7 +362,6 @@ abstract class BaseActivity<VB : ViewBinding>(
}
}
isBackDisable
=
false
}
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
...
...
@@ -368,8 +373,14 @@ abstract class BaseActivity<VB : ViewBinding>(
}
protected
var
isBackDisable
=
false
private
fun
setBackPressed
()
{
onBackPressedDispatcher
.
addCallback
{
handleBackCallBack
()
}
}
protected
open
fun
handleBackCallBack
()
{
if
(
isBackDisable
)
{
Toast
.
makeText
(
applicationContext
,
...
...
@@ -377,7 +388,8 @@ abstract class BaseActivity<VB : ViewBinding>(
Toast
.
LENGTH_SHORT
).
show
()
}
else
{
FunctionBackDialog
(
this
@BaseActivity
).
showDialog
{
backAdJump
()
}
}
}
...
...
app/src/main/java/com/base/appzxhy/ui/dialog/FunctionBackDialog.kt
0 → 100644
View file @
c058ff36
package
com.base.appzxhy.ui.dialog
import
android.app.Activity
import
android.view.LayoutInflater
import
androidx.appcompat.app.AlertDialog
import
com.base.appzxhy.R
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.databinding.DialogFunctionBackBinding
import
com.base.appzxhy.ui.batteryinfo.BatteryInfoActivity
import
com.base.appzxhy.ui.clean.JunkCleanActivity
import
com.base.appzxhy.ui.largefile.LargeFileCleanActivity
import
com.base.appzxhy.ui.photocompression.PhotoCompressionActivity
import
com.base.appzxhy.ui.screenshot.ScreenshotCleanActivity
import
com.base.appzxhy.ui.similar.SimilarPhotosActivity
class
FunctionBackDialog
(
val
activity
:
Activity
)
{
val
dialog
=
AlertDialog
.
Builder
(
activity
).
create
()
val
binding
=
DialogFunctionBackBinding
.
inflate
(
LayoutInflater
.
from
(
activity
))
fun
showDialog
(
back
:
()
->
Unit
)
{
dialog
.
setView
(
binding
.
root
)
dialog
.
setCanceledOnTouchOutside
(
true
)
val
params
=
dialog
.
window
?.
attributes
// params?.width = LinearLayout.LayoutParams.MATCH_PARENT
// params?.height = LinearLayout.LayoutParams.WRAP_CONTENT
// params?.gravity = Gravity.BOTTOM
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
when
(
activity
)
{
is
JunkCleanActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_junk_clean
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_junk_clean_content
)
}
is
BatteryInfoActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_battery_info
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_battery_info_content
)
}
is
LargeFileCleanActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_large_file_clean
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_large_file_clean_content
)
}
is
PhotoCompressionActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_photo_compression
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_photo_compression_content
)
}
is
ScreenshotCleanActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_screenshot_cleaner
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_screenshot_cleaner_content
)
}
is
SimilarPhotosActivity
->
{
binding
.
tvTitle
.
text
=
activity
.
getString
(
R
.
string
.
exit_screenshot_cleaner
)
binding
.
tvContent
.
text
=
activity
.
getString
(
R
.
string
.
exit_screenshot_cleaner_content
)
}
else
->
{
back
.
invoke
()
return
}
}
dialog
.
show
()
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_native_custom
)
binding
.
ivCancel
.
setOnClickListener
{
dialog
.
dismiss
()
}
binding
.
tvCancel
.
setOnClickListener
{
dialog
.
dismiss
()
}
binding
.
tvSure
.
setOnClickListener
{
dialog
.
dismiss
()
back
.
invoke
()
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/ui/screenshot/ScreenshotCleanActivity.kt
View file @
c058ff36
...
...
@@ -161,6 +161,10 @@ class ScreenshotCleanActivity : BaseActivity<ActivityScreenshotCleanBinding>(Act
}
}
override
fun
handleBackCallBack
()
{
super
.
handleBackCallBack
()
}
@SuppressLint
(
"NotifyDataSetChanged"
)
private
fun
initData
()
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
...
...
app/src/main/res/layout/dialog_function_back.xml
0 → 100644
View file @
c058ff36
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_exit"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/white_background_24"
android:paddingBottom=
"30dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/ivCancel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"20dp"
android:src=
"@drawable/icon_close"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"30dp"
android:includeFontPadding=
"false"
android:lineSpacingExtra=
"4dp"
android:textAlignment=
"center"
android:textColor=
"@color/color_1a1a1a"
android:textSize=
"20sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"6dp"
android:includeFontPadding=
"false"
android:lineSpacingExtra=
"4dp"
android:textAlignment=
"center"
android:textColor=
"@color/color_666666"
android:textSize=
"16sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_title"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_cancel"
android:layout_width=
"0dp"
android:layout_height=
"44dp"
android:layout_marginStart=
"28dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"4dp"
android:background=
"@drawable/bg_enable_no_50"
android:paddingVertical=
"10dp"
android:text=
"@string/cancel"
android:textAlignment=
"center"
android:textColor=
"@color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toStartOf=
"@id/tv_sure"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_content"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_sure"
android:layout_width=
"0dp"
android:layout_height=
"44dp"
android:layout_marginStart=
"4dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
android:background=
"@drawable/bg_btn_50"
android:paddingVertical=
"10dp"
android:text=
"@string/sure"
android:textAlignment=
"center"
android:textColor=
"@color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/tv_cancel"
app:layout_constraintTop_toBottomOf=
"@id/tv_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.base.appzxhy.business.ads.NativeParentView
android:id=
"@+id/flAd"
app:layout_constraintTop_toBottomOf=
"@id/cl_exit"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginTop=
"10dp"
>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:src=
"@drawable/zhanwei1"
/>
</com.base.appzxhy.business.ads.NativeParentView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
c058ff36
...
...
@@ -128,6 +128,19 @@ Please rest assured that we will handle your information in strict accordance wi
<string
name=
"guide_tip_2"
>
Don’t let regret set in! Our app can accurately recover the files you’ve accidentally deleted.
</string>
<string
name=
"guide_tip_3"
>
Release phone memory clean up junk files
</string>
<string
name=
"next"
>
Next
</string>
<string
name=
"sure"
>
Sure
</string>
<string
name=
"exit_junk_clean"
>
Exit Junk Clean
</string>
<string
name=
"exit_junk_clean_content"
>
Exit Junk Clean? Uncleared junk files might be taking up space.
</string>
<string
name=
"exit_battery_info"
>
Exit Battery Info
</string>
<string
name=
"exit_battery_info_content"
>
Exit Battery Info? Continuing to use it can help you better manage your battery status.
</string>
<string
name=
"exit_large_file_clean"
>
Exit Large File Clean
</string>
<string
name=
"exit_large_file_clean_content"
>
Exit Large File Clean? Undeleted large files may be taking up valuable space.
</string>
<string
name=
"exit_photo_compression"
>
Exit Photo Compression
</string>
<string
name=
"exit_photo_compression_content"
>
Exit Photo Compression? Uncompressed photos may be taking up space.
</string>
<string
name=
"exit_screenshot_cleaner"
>
Exit Screenshot Clean
</string>
<string
name=
"exit_screenshot_cleaner_content"
>
Exit Screenshot Clean? Undeleted screenshots might be using space.
</string>
<string
name=
"exit_similar_photos"
>
Exit Similar Photos
</string>
<string
name=
"exit_similar_photos_content"
>
Exit Similar Photos? Unmoved similar photos might be occupying space.
</string>
</resources>
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