Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
98ed7b64
Commit
98ed7b64
authored
Jul 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
71da967f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
29 deletions
+56
-29
RepeatActivity.kt
...a/com/base/datarecovery/activity/repeat/RepeatActivity.kt
+19
-9
ScreenShotActivity.kt
...se/datarecovery/activity/screenshot/ScreenShotActivity.kt
+29
-20
AdmobInterstitialUtils.kt
.../java/com/base/datarecovery/ads/AdmobInterstitialUtils.kt
+8
-0
No files found.
app/src/main/java/com/base/datarecovery/activity/repeat/RepeatActivity.kt
View file @
98ed7b64
...
...
@@ -7,6 +7,7 @@ import androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
com.base.datarecovery.adapter.MediaAdapter
import
com.base.datarecovery.ads.AdmobInterstitialUtils
import
com.base.datarecovery.ads.AdmobInterstitialUtils.showInterAdSp
import
com.base.datarecovery.ads.AdmobNativeUtils
import
com.base.datarecovery.bean.MediaBean
import
com.base.datarecovery.bean.MediaTimeBean
...
...
@@ -90,18 +91,27 @@ class RepeatActivity : BaseActivity<ActivityRepeatBinding>() {
}
binding
.
tvClean
.
setOnClickListener
{
showDeletePermanentlyDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
mediaAdapter
.
getSelectData
().
second
.
forEach
{
runCatching
{
val
file
=
File
(
it
.
path
)
file
.
delete
()
}
}
initData
()
if
(
showInterAdSp
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
cleanFile
()
}
}
else
{
cleanFile
()
}
}
}
}
private
fun
cleanFile
()
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
mediaAdapter
.
getSelectData
().
second
.
forEach
{
runCatching
{
val
file
=
File
(
it
.
path
)
file
.
delete
()
}
}
initData
()
}
}
...
...
app/src/main/java/com/base/datarecovery/activity/screenshot/ScreenShotActivity.kt
View file @
98ed7b64
...
...
@@ -8,6 +8,7 @@ import androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
com.base.datarecovery.adapter.ScreenShotAdapter
import
com.base.datarecovery.ads.AdmobInterstitialUtils
import
com.base.datarecovery.ads.AdmobInterstitialUtils.showInterAdSp
import
com.base.datarecovery.ads.AdmobNativeUtils
import
com.base.datarecovery.bean.ScreenPhotoBean
import
com.base.datarecovery.bean.ScreenshotBean
...
...
@@ -118,32 +119,40 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
setCleanUpUi
(
size
)
}
binding
.
tvClean
.
setOnClickListener
{
val
files
=
screenShotAdapter
.
getSelectData
()
showDeletePermanentlyDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
async
{
files
.
forEach
{
screenFile
->
runCatching
{
val
file
=
screenFile
.
file
if
(
file
.
exists
())
file
.
delete
()
}
}
}.
await
()
launch
(
Dispatchers
.
Main
)
{
binding
.
tvClean
.
text
=
"CLEAN"
screenShotAdapter
.
removeData
(
files
)
val
split
=
screenShotAdapter
.
getAllData
().
sumOf
{
it
.
file
.
length
()
}.
toFormatSize
().
split
(
" "
)
binding
.
tvSize
.
text
=
split
[
0
]
binding
.
tvUnit
.
text
=
split
[
1
]
setCleanUpUi
(
0
)
}
if
(
showInterAdSp
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
cleanFile
()
}
}
else
{
cleanFile
()
}
}
}
}
}
private
fun
cleanFile
()
{
val
files
=
screenShotAdapter
.
getSelectData
()
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
async
{
files
.
forEach
{
screenFile
->
runCatching
{
val
file
=
screenFile
.
file
if
(
file
.
exists
())
file
.
delete
()
}
}
}.
await
()
launch
(
Dispatchers
.
Main
)
{
binding
.
tvClean
.
text
=
"CLEAN"
screenShotAdapter
.
removeData
(
files
)
val
split
=
screenShotAdapter
.
getAllData
().
sumOf
{
it
.
file
.
length
()
}.
toFormatSize
().
split
(
" "
)
binding
.
tvSize
.
text
=
split
[
0
]
binding
.
tvUnit
.
text
=
split
[
1
]
setCleanUpUi
(
0
)
}
}
}
private
fun
getScreenshotBean
():
ArrayList
<
ScreenshotBean
>
{
...
...
app/src/main/java/com/base/datarecovery/ads/AdmobInterstitialUtils.kt
View file @
98ed7b64
...
...
@@ -13,6 +13,7 @@ import com.base.datarecovery.ads.AdmobEvent.pullAd
import
com.base.datarecovery.ads.AdmobEvent.showAd
import
com.base.datarecovery.help.BaseApplication
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.utils.AppPreferences
import
com.base.datarecovery.utils.EventUtils
import
com.base.datarecovery.view.CustomDialog
import
com.google.android.gms.ads.AdError
...
...
@@ -38,12 +39,19 @@ object AdmobInterstitialUtils {
return
System
.
currentTimeMillis
()
-
interLoadTime
>
1000
*
60
*
60
}
fun
showInterAdSp
():
Boolean
{
val
isDeleteInterAd
=
AppPreferences
.
getInstance
().
getString
(
"isDeleteInterAd"
,
"0"
).
toInt
()
//1要看插屏 0不看
return
isDeleteInterAd
==
1
}
fun
showInterstitialAd
(
activity
:
Activity
,
isReLoadAd
:
Boolean
=
false
,
isShowDialog
:
Boolean
=
true
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
}
...
...
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