Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
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
swiftcleanerphonehelper
Commits
a22d829e
Commit
a22d829e
authored
Feb 10, 2025
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
迭代
parent
0dd4ebcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
56 deletions
+35
-56
MainActivity.java
.../main/java/com/swiftcleaner/chovey/view/MainActivity.java
+15
-29
CleanJunkActivity.java
.../swiftcleaner/chovey/view/activity/CleanJunkActivity.java
+9
-6
FullscreenDialog.java
...com/swiftcleaner/chovey/view/dialog/FullscreenDialog.java
+11
-21
No files found.
app/src/main/java/com/swiftcleaner/chovey/view/MainActivity.java
View file @
a22d829e
...
...
@@ -50,9 +50,8 @@ public class MainActivity extends AppCompatActivity {
ActivityMainBinding
binding
;
private
ActivityResultLauncher
<
String
[]>
multiplePermissionsLauncher
;
private
ActivityResultLauncher
<
Intent
>
notificationSettingsLauncher
;
private
static
final
String
PREFS_NAME
=
"AppPrefs"
;
private
static
final
String
KEY_CLEANED
=
"cleaned"
;
private
FullscreenDialog
fullscreenDialog
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -62,14 +61,14 @@ public class MainActivity extends AppCompatActivity {
initBar
();
if
(!
isCleaned
())
{
//
fullscreenDialog = new FullscreenDialog(this);
//
fullscreenDialog.setOnDialogDismissListener(new FullscreenDialog.OnDialogDismissListener() {
//
@Override
//
public void onSuccButton() {
// startActivity(new Intent(MainActivity.this,
CleanJunkActivity.class));
//
}
//
});
//
fullscreenDialog.show();
fullscreenDialog
=
new
FullscreenDialog
(
this
);
fullscreenDialog
.
setOnDialogDismissListener
(
new
FullscreenDialog
.
OnDialogDismissListener
()
{
@Override
public
void
onSuccButton
()
{
startActivity
(
new
Intent
(
MainActivity
.
this
,
CleanJunkActivity
.
class
));
}
});
fullscreenDialog
.
show
();
}
initPermission
();
...
...
@@ -90,22 +89,10 @@ public class MainActivity extends AppCompatActivity {
}
private
boolean
isCleaned
()
{
SharedPreferences
prefs
=
getSharedPreferences
(
PREFS_NAME
,
MODE_PRIVATE
);
return
prefs
.
getBoolean
(
KEY_CLEANED
,
false
);
}
private
void
setCleaned
(
boolean
cleaned
)
{
SharedPreferences
prefs
=
getSharedPreferences
(
PREFS_NAME
,
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
editor
.
putBoolean
(
KEY_CLEANED
,
cleaned
);
editor
.
apply
();
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
1
&&
resultCode
==
RESULT_OK
)
{
setCleaned
(
true
);
}
SharedPreferences
prefs
=
getSharedPreferences
(
"AppPrefs"
,
MODE_PRIVATE
);
return
prefs
.
getBoolean
(
"cleaned"
,
false
);
}
private
void
initShow
()
{
binding
.
lottieAnimattionView
.
setAnimation
(
R
.
raw
.
cleaner_junk_found_animation
);
binding
.
lottieAnimattionView
.
playAnimation
();
...
...
@@ -243,17 +230,17 @@ public class MainActivity extends AppCompatActivity {
});
appExitDialog
.
show
();
}
private
AtomicBoolean
bannerShowed
=
new
AtomicBoolean
(
false
);
@Override
protected
void
onResume
()
{
super
.
onResume
();
Log
.
d
(
"isCleaned"
,
isCleaned
()
+
"111"
);
if
(
isCleaned
())
{
if
(
isCleaned
()
&&
fullscreenDialog
!=
null
)
{
Log
.
d
(
"isCleaned"
,
isCleaned
()
+
"222"
);
fullscreenDialog
.
dismiss
();
fullscreenDialog
=
null
;
// 释放引用
}
if
(
bannerShowed
.
get
())
return
;
bannerShowed
.
set
(
true
);
AdmobManager
.
INSTANCE
.
showBannerAd
(
this
,
binding
.
flBanner
,
"bottom"
,
null
,
null
);
...
...
@@ -289,7 +276,6 @@ public class MainActivity extends AppCompatActivity {
binding
.
lottieAnimattionView
.
setImageDrawable
(
null
);
// 清除图像
binding
.
lottieAnimattionView
.
destroyDrawingCache
();
// 销毁缓存
}
if
(
binding
.
radarview
!=
null
)
{
binding
.
radarview
.
setSearching
(
false
);
}
...
...
app/src/main/java/com/swiftcleaner/chovey/view/activity/CleanJunkActivity.java
View file @
a22d829e
...
...
@@ -18,6 +18,7 @@ import android.os.Build;
import
android.os.CountDownTimer
;
import
android.os.Environment
;
import
android.provider.Settings
;
import
android.util.Log
;
import
android.view.View
;
import
android.content.Intent
;
import
android.widget.Toast
;
...
...
@@ -212,11 +213,17 @@ public class CleanJunkActivity extends BaseActivity<ActivityCleanJunkBinding> {
binding
.
emptyFilesRecy
.
setVisibility
(
View
.
VISIBLE
);
}
});
SharedPreferences
prefs
=
getSharedPreferences
(
"AppPrefs"
,
MODE_PRIVATE
);
binding
.
buttonCleanUp
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
view
!=
null
)
{
setResult
(
RESULT_OK
);
boolean
cleaned
=
prefs
.
getBoolean
(
"cleaned"
,
false
);
if
(!
cleaned
){
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
editor
.
putBoolean
(
"cleaned"
,
true
);
editor
.
commit
();
}
onClickCleanUpButton
(
view
);
}
}
...
...
@@ -235,11 +242,6 @@ public class CleanJunkActivity extends BaseActivity<ActivityCleanJunkBinding> {
}
sharedPreferences
=
getSharedPreferences
(
"AppPrefs"
,
MODE_PRIVATE
);
}
private
void
markAsCleaned
()
{
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putBoolean
(
"isCleaned"
,
true
);
editor
.
apply
();
// 使用 apply() 方法异步保存数据
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
...
...
@@ -701,6 +703,7 @@ public class CleanJunkActivity extends BaseActivity<ActivityCleanJunkBinding> {
if
(
binding
!=
null
)
{
binding
=
null
;
}
}
}
\ No newline at end of file
app/src/main/java/com/swiftcleaner/chovey/view/dialog/FullscreenDialog.java
View file @
a22d829e
...
...
@@ -68,33 +68,23 @@ public class FullscreenDialog {
lottieView
=
dialog
.
findViewById
(
R
.
id
.
lottie_animattion_view1
);
lottieView
.
setAnimation
(
R
.
raw
.
cleaner_junk_found_animation
);
// 替换为你的动画文件名
lottieView
.
playAnimation
();
// 开始播放动画
// 监听动画结束事件
lottieView
.
addAnimatorListener
(
new
AnimatorListenerAdapter
()
{
@Override
public
void
onAnimationEnd
(
Animator
animation
)
{
lottieView
.
cancelAnimation
();
lottieView
.
clearAnimation
();
lottieView
.
setAnimation
((
String
)
null
);
}
});
dialog
.
setOnDismissListener
(
dialog
->
{
if
(
lottieView
!=
null
)
{
lottieView
.
cancelAnimation
();
lottieView
.
clearAnimation
();
lottieView
.
setAnimation
((
String
)
null
);
lottieView
=
null
;
}
});
// 显示Dialog
dialog
.
show
();
}
public
void
dismiss
()
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
()
){
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
dialog
.
setOnDismissListener
(
null
);
// 移除监听器,避免重复调用
dialog
.
setOnCancelListener
(
null
);
// 移除取消监听器
dialog
.
dismiss
();
if
(
lottieView
!=
null
)
{
lottieView
.
cancelAnimation
();
// 停止动画
lottieView
.
clearAnimation
();
// 清除动画
lottieView
.
setImageDrawable
(
null
);
// 清除图像
lottieView
.
destroyDrawingCache
();
// 销毁缓存
}
}
}
...
...
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