Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
File Recovery RecycleBin
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
File Recovery RecycleBin
Commits
30e61018
Commit
30e61018
authored
Jul 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...whatsapp
parent
de9bf7bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
51 deletions
+86
-51
WhatsAppCleanerActivity.kt
...ryrecyclebin/activity/whatsapp/WhatsAppCleanerActivity.kt
+64
-37
WhatsAppCleanerAnimationActivity.kt
...bin/activity/whatsapp/WhatsAppCleanerAnimationActivity.kt
+21
-11
HomeFragment.kt
.../com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
+0
-2
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/whatsapp/WhatsAppCleanerActivity.kt
View file @
30e61018
...
@@ -29,76 +29,99 @@ class WhatsAppCleanerActivity : BaseActivity<ActivityWhatsAppCleanerBinding>() {
...
@@ -29,76 +29,99 @@ class WhatsAppCleanerActivity : BaseActivity<ActivityWhatsAppCleanerBinding>() {
private
val
TAG
=
"WhatsAppCleanerActivity"
private
val
TAG
=
"WhatsAppCleanerActivity"
private
lateinit
var
adapter
:
WhatsAppCleanerAdapter
private
lateinit
var
adapter
:
WhatsAppCleanerAdapter
private
val
whatsAppMediaDir
=
"${Environment.getExternalStorageDirectory()}/Android/media/com.whatsapp/WhatsApp/Media/"
override
val
binding
:
ActivityWhatsAppCleanerBinding
by
lazy
{
override
val
binding
:
ActivityWhatsAppCleanerBinding
by
lazy
{
ActivityWhatsAppCleanerBinding
.
inflate
(
layoutInflater
)
ActivityWhatsAppCleanerBinding
.
inflate
(
layoutInflater
)
}
}
override
fun
initView
()
{
override
fun
initView
()
{
setupStatusBar
()
setupAdapter
()
checkAndRequestPermissions
()
showNativeAd
()
}
private
fun
setupStatusBar
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
}
adapter
=
WhatsAppCleanerAdapter
{
private
fun
setupAdapter
()
{
startActivity
(
adapter
=
WhatsAppCleanerAdapter
{
item
->
Intent
(
navigateToWhatsAppMessageCleanActivity
(
item
)
this
,
WhatsAppMessageCleanActivity
::
class
.
java
).
apply
{
putExtra
(
"PathList"
,
Gson
().
toJson
(
it
.
subFile
.
toTypedArray
()))
putExtra
(
"Tittle"
,
it
.
tittle
)
})
finish
()
}
}
binding
.
rv
.
adapter
=
adapter
binding
.
rv
.
adapter
=
adapter
}
private
fun
checkAndRequestPermissions
()
{
if
(
checkStorePermission
())
{
if
(
checkStorePermission
())
{
initData
()
initData
()
}
else
{
}
else
{
showGerPermission
(
null
,
deny
=
{
requestStoragePermissionWithDialog
()
finishToMain
()
}
},
allow
=
{
}
requestStorePermission
(
launcher
,
private
fun
requestStoragePermissionWithDialog
()
{
result
=
{
flag
->
showGerPermission
(
null
,
deny
=
{
if
(
flag
)
{
finishToMain
()
initData
()
},
allow
=
{
}
else
{
requestStorePermission
(
finishToMain
()
launcher
,
}
result
=
{
flag
->
},
if
(
flag
)
{
)
initData
()
})
}
else
{
finishToMain
()
}
}
)
})
}
private
fun
navigateToWhatsAppMessageCleanActivity
(
item
:
WhatsAppCleanerBean
)
{
val
intent
=
Intent
(
this
,
WhatsAppMessageCleanActivity
::
class
.
java
).
apply
{
putExtra
(
"PathList"
,
Gson
().
toJson
(
item
.
subFile
.
toTypedArray
()))
putExtra
(
"Tittle"
,
item
.
tittle
)
}
}
startActivity
(
intent
)
finish
()
}
private
fun
showNativeAd
()
{
AdmobMaxHelper
.
admobMaxShowNativeAd
(
this
,
binding
.
flAd
,
0
)
AdmobMaxHelper
.
admobMaxShowNativeAd
(
this
,
binding
.
flAd
,
0
)
}
}
override
fun
initListener
()
{
override
fun
initListener
()
{
setupBackButton
()
}
private
fun
setupBackButton
()
{
binding
.
flBack
.
setOnClickListener
{
binding
.
flBack
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
onBackPressedDispatcher
.
onBackPressed
()
}
}
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
@WhatsAppCleanerActivity
)
{
showInterstitialAdAndFinish
()
finishToMain
()
}
}
binding
.
tvTvGotIt
.
setOnClickListener
{
}
}
}
}
private
fun
showInterstitialAdAndFinish
()
{
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
)
{
finishToMain
()
}
}
private
fun
initData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
private
fun
initData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
whatsAppRoot
=
File
(
Environment
.
getExternalStorageDirectory
(),
"Android/media/com.whatsapp/WhatsApp/Media/"
)
LogEx
.
logDebug
(
TAG
,
whatsAppRoot
.
absolutePath
)
val
list
=
arrayListOf
<
WhatsAppCleanerBean
>()
val
list
=
arrayListOf
<
WhatsAppCleanerBean
>()
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
videomessages
,
"Video Messages"
))
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
videomessages
,
"Video Messages"
))
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
imagemessages
,
"Image Messages"
))
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
imagemessages
,
"Image Messages"
))
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
audiomessages
,
"Audio Messages"
))
list
.
add
(
WhatsAppCleanerBean
(
R
.
mipmap
.
audiomessages
,
"Audio Messages"
))
var
totalSize
=
0L
var
totalSize
=
0L
whatsAppRoot
.
listFiles
()
?.
forEach
{
file
->
File
(
whatsAppMediaDir
)
.
listFiles
()
?.
forEach
{
file
->
if
(
file
.
name
==
"WhatsApp Video"
)
{
if
(
file
.
name
==
"WhatsApp Video"
)
{
LogEx
.
logDebug
(
TAG
,
"whatsapp file=${file.absolutePath}"
)
LogEx
.
logDebug
(
TAG
,
"whatsapp file=${file.absolutePath}"
)
...
@@ -131,10 +154,14 @@ class WhatsAppCleanerActivity : BaseActivity<ActivityWhatsAppCleanerBinding>() {
...
@@ -131,10 +154,14 @@ class WhatsAppCleanerActivity : BaseActivity<ActivityWhatsAppCleanerBinding>() {
}
}
launch
(
Dispatchers
.
Main
)
{
launch
(
Dispatchers
.
Main
)
{
adapter
.
setData
(
list
)
adapter
.
setData
(
list
)
val
split
=
totalSize
.
toFormatSize
().
split
(
" "
)
updateTotalSizeUI
(
list
)
binding
.
tvSize
.
text
=
split
[
0
]
binding
.
tvUnit
.
text
=
split
[
1
]
}
}
}
}
private
fun
updateTotalSizeUI
(
list
:
List
<
WhatsAppCleanerBean
>)
{
val
totalSize
=
list
.
sumOf
{
it
.
size
}
val
formattedSize
=
totalSize
.
toFormatSize
()
binding
.
tvSize
.
text
=
formattedSize
.
split
(
" "
)[
0
]
binding
.
tvUnit
.
text
=
formattedSize
.
split
(
" "
)[
1
]
}
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/activity/whatsapp/WhatsAppCleanerAnimationActivity.kt
View file @
30e61018
...
@@ -15,6 +15,10 @@ import kotlin.random.Random
...
@@ -15,6 +15,10 @@ import kotlin.random.Random
class
WhatsAppCleanerAnimationActivity
:
BaseActivity
<
ActivityWhatsAppCleanerAnimationBinding
>()
{
class
WhatsAppCleanerAnimationActivity
:
BaseActivity
<
ActivityWhatsAppCleanerAnimationBinding
>()
{
private
val
animationPath
=
"junk_scan/data.json"
private
val
imagesPath
=
"junk_scan/images/"
private
val
nextActivityClass
=
WhatsAppCleanerActivity
::
class
.
java
override
val
binding
:
ActivityWhatsAppCleanerAnimationBinding
by
lazy
{
override
val
binding
:
ActivityWhatsAppCleanerAnimationBinding
by
lazy
{
ActivityWhatsAppCleanerAnimationBinding
.
inflate
(
layoutInflater
)
ActivityWhatsAppCleanerAnimationBinding
.
inflate
(
layoutInflater
)
}
}
...
@@ -31,24 +35,30 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni
...
@@ -31,24 +35,30 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
private
fun
playLottie
()
{
private
fun
playLottie
()
{
binding
.
lottie
.
imageAssetsFolder
=
"junk_scan/images/"
binding
.
lottie
.
imageAssetsFolder
=
imagesPath
binding
.
lottie
.
setAnimation
(
"junk_scan/data.json"
)
binding
.
lottie
.
setAnimation
(
animationPath
)
binding
.
lottie
.
playAnimation
()
binding
.
lottie
.
playAnimation
()
lifecycleScope
.
launch
{
lifecycleScope
.
launch
{
delay
(
Random
.
nextLong
(
3500
,
4500
))
delay
(
Random
.
nextLong
(
3500
,
4500
))
binding
.
lottie
.
cancelAnimation
()
binding
.
lottie
.
cancelAnimation
()
binding
.
lottie
.
visibility
=
View
.
GONE
binding
.
lottie
.
visibility
=
View
.
GONE
binding
.
lottieCompleted
.
visibility
=
View
.
VISIBLE
showCompletionAnimation
()
binding
.
lottieCompleted
.
playAnimation
()
binding
.
tv
.
text
=
"Completed!"
delay
(
1000
)
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
@WhatsAppCleanerAnimationActivity
)
{
startActivity
(
Intent
(
this
@WhatsAppCleanerAnimationActivity
,
WhatsAppCleanerActivity
::
class
.
java
))
finish
()
}
}
}
}
}
@SuppressLint
(
"SetTextI18n"
)
private
suspend
fun
showCompletionAnimation
()
{
binding
.
lottieCompleted
.
visibility
=
View
.
VISIBLE
binding
.
lottieCompleted
.
playAnimation
()
binding
.
tv
.
text
=
"Completed!"
delay
(
1000
)
showAdAndNavigateToNextActivity
()
}
private
fun
showAdAndNavigateToNextActivity
()
{
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
)
{
startActivity
(
Intent
(
this
,
nextActivityClass
))
finish
()
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
View file @
30e61018
...
@@ -7,9 +7,7 @@ import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
...
@@ -7,9 +7,7 @@ import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import
com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import
com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import
com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerActivity
import
com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_AUDIOS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_AUDIOS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_DOCUMENTS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_DOCUMENTS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_PHOTOS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_PHOTOS
...
...
app/src/main/res/values/strings.xml
View file @
30e61018
<resources>
<resources>
<string
name=
"app_name"
>
Photo/Video
Recovery
</string>
<string
name=
"app_name"
>
Dumpster:Photo
&
File
Recovery
</string>
<!-- TODO: Remove or change this placeholder text -->
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"facebook_app_id"
>
1141667540450666
</string>
<string
name=
"facebook_app_id"
>
1141667540450666
</string>
...
...
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