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
fec216d4
Commit
fec216d4
authored
Jul 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
d4677a01
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
27 deletions
+90
-27
CleanJunkActivity.kt
...ecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
+57
-19
ScanJunkActivity.kt
...recoveryrecyclebin/activity/junkclean/ScanJunkActivity.kt
+1
-0
JunkExpandAdapter.kt
.../base/filerecoveryrecyclebin/adapter/JunkExpandAdapter.kt
+24
-6
activity_layout_clean_junk.xml
app/src/main/res/layout/activity_layout_clean_junk.xml
+6
-1
item_child.xml
app/src/main/res/layout/item_child.xml
+2
-1
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
View file @
fec216d4
...
@@ -3,19 +3,21 @@ package com.base.filerecoveryrecyclebin.activity.junkclean
...
@@ -3,19 +3,21 @@ package com.base.filerecoveryrecyclebin.activity.junkclean
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Environment
import
androidx.activity.OnBackPressedCallback
import
androidx.activity.OnBackPressedCallback
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
import
androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.lifecycleScope
import
com.base.filerecoveryrecyclebin.BuildConfig
import
com.base.filerecoveryrecyclebin.BuildConfig
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
import
com.base.filerecoveryrecyclebin.adapter.JunkExpandAdapter
import
com.base.filerecoveryrecyclebin.adapter.JunkExpandAdapter
import
com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import
com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import
com.base.filerecoveryrecyclebin.bean.ChildBean
import
com.base.filerecoveryrecyclebin.bean.ChildBean
import
com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER
import
com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER
import
com.base.filerecoveryrecyclebin.databinding.ActivityLayoutCleanJunkBinding
import
com.base.filerecoveryrecyclebin.databinding.ActivityLayoutCleanJunkBinding
import
com.base.filerecoveryrecyclebin.help.BaseActivity
import
com.base.filerecoveryrecyclebin.help.BaseActivity
import
com.base.filerecoveryrecyclebin.help.FileHelp
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatSize
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatSize
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.requestStorePermission
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.requestStorePermission
...
@@ -27,6 +29,7 @@ import kotlinx.coroutines.Dispatchers
...
@@ -27,6 +29,7 @@ import kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.async
import
kotlinx.coroutines.async
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
java.io.File
import
kotlin.random.Random
import
kotlin.random.Random
/**
/**
...
@@ -45,7 +48,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -45,7 +48,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
override
fun
initView
()
{
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
//
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
junkExpandAdapter
=
JunkExpandAdapter
{
size
->
junkExpandAdapter
=
JunkExpandAdapter
{
size
->
if
(
size
==
0L
)
{
if
(
size
==
0L
)
{
...
@@ -58,6 +61,9 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -58,6 +61,9 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
binding
.
tvSize
.
text
=
split
[
0
]
binding
.
tvSize
.
text
=
split
[
0
]
binding
.
tvUnit
.
text
=
split
[
1
]
binding
.
tvUnit
.
text
=
split
[
1
]
}
}
if
(
junkExpandAdapter
.
getAllChildItemCount
()
==
0
)
{
binding
.
tvBtn
.
text
=
"Deep Clean"
}
}
}
binding
.
exRv
.
adapter
=
junkExpandAdapter
binding
.
exRv
.
adapter
=
junkExpandAdapter
...
@@ -93,22 +99,32 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -93,22 +99,32 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
})
})
binding
.
tvBtn
.
setOnClickListener
{
binding
.
tvBtn
.
setOnClickListener
{
if
(
binding
.
tvBtn
.
text
==
"Got it"
)
{
when
(
binding
.
tvBtn
.
text
)
{
startActivity
(
Intent
(
this
@CleanJunkActivity
,
ResultActivity
::
class
.
java
).
apply
{
"Got it"
->
{
putExtra
(
"clean_size"
,
JUNK_CLEANER
)
startActivity
(
Intent
(
this
@CleanJunkActivity
,
ResultActivity
::
class
.
java
).
apply
{
putExtra
(
"from"
,
0
)
putExtra
(
"clean_size"
,
JUNK_CLEANER
)
})
putExtra
(
"from"
,
0
)
}
else
{
})
startActivity
(
}
Intent
(
this
,
CleaningActivity
::
class
.
java
).
apply
{
val
list
=
junkExpandAdapter
.
getChoosePath
()
"Deep Clean"
->
{
putExtra
(
"list"
,
list
.
toTypedArray
())
startActivity
(
Intent
(
this
@CleanJunkActivity
,
PhotoManagerAnimationActivity
::
class
.
java
))
putExtra
(
"size"
,
list
.
sumOf
{
it
.
childSize
})
}
}
)
else
->
{
scanJunk
()
startActivity
(
Intent
(
this
,
CleaningActivity
::
class
.
java
).
apply
{
val
list
=
junkExpandAdapter
.
getChoosePath
()
putExtra
(
"list"
,
list
.
toTypedArray
())
putExtra
(
"size"
,
list
.
sumOf
{
it
.
childSize
})
}
)
}
}
}
finish
()
}
}
}
}
private
fun
scanJunk
()
=
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
private
fun
scanJunk
()
=
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
...
@@ -116,7 +132,29 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -116,7 +132,29 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
var
totalSize
=
0L
var
totalSize
=
0L
val
list
=
arrayListOf
<
ChildBean
>()
val
list
=
arrayListOf
<
ChildBean
>()
async
{
val
emptyFolder1
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DCIM
))
val
emptyFolder2
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOWNLOADS
))
val
emptyFolder3
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
))
val
emptyFolder4
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
))
val
emptyFolder5
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MOVIES
))
val
emptyFolder6
=
FileHelp
.
getFileFolder
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MUSIC
))
val
emptyFolder
=
arrayListOf
<
File
>()
emptyFolder
.
addAll
(
emptyFolder1
)
emptyFolder
.
addAll
(
emptyFolder2
)
emptyFolder
.
addAll
(
emptyFolder3
)
emptyFolder
.
addAll
(
emptyFolder4
)
emptyFolder
.
addAll
(
emptyFolder5
)
emptyFolder
.
addAll
(
emptyFolder6
)
emptyFolder
.
forEach
{
l
->
list
.
add
(
ChildBean
(
R
.
mipmap
.
apk
,
l
.
name
,
l
.
path
,
0
))
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
junkExpandAdapter
.
addChildData
(
0
,
list
)
list
.
clear
()
async
{
async
{
val
apk
=
MediaStoreUtils
.
queryFiles
(
this
@CleanJunkActivity
,
MediaStoreUtils
.
FileType
.
APK
)
?:
listOf
()
val
apk
=
MediaStoreUtils
.
queryFiles
(
this
@CleanJunkActivity
,
MediaStoreUtils
.
FileType
.
APK
)
?:
listOf
()
apk
.
forEach
{
l
->
apk
.
forEach
{
l
->
...
@@ -132,7 +170,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -132,7 +170,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
}.
await
()
junkExpandAdapter
.
addChildData
(
0
,
list
)
junkExpandAdapter
.
addChildData
(
1
,
list
)
list
.
clear
()
list
.
clear
()
...
@@ -151,7 +189,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -151,7 +189,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
}.
await
()
junkExpandAdapter
.
addChildData
(
1
,
list
)
junkExpandAdapter
.
addChildData
(
2
,
list
)
list
.
clear
()
list
.
clear
()
async
{
async
{
...
@@ -169,7 +207,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -169,7 +207,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
}.
await
()
junkExpandAdapter
.
addChildData
(
2
,
list
)
junkExpandAdapter
.
addChildData
(
3
,
list
)
binding
.
tvBtn
.
isVisible
=
true
binding
.
tvBtn
.
isVisible
=
true
binding
.
tvBtn
.
isEnabled
=
true
binding
.
tvBtn
.
isEnabled
=
true
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/activity/junkclean/ScanJunkActivity.kt
View file @
fec216d4
...
@@ -132,6 +132,7 @@ class ScanJunkActivity : BaseActivity<ActivityLayoutScanJunkBinding>() {
...
@@ -132,6 +132,7 @@ class ScanJunkActivity : BaseActivity<ActivityLayoutScanJunkBinding>() {
binding
.
lottie
.
playAnimation
()
binding
.
lottie
.
playAnimation
()
}
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
waitJob
()
=
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
private
fun
waitJob
()
=
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
delay
(
5000
)
delay
(
5000
)
binding
.
lottie
.
visibility
=
View
.
GONE
binding
.
lottie
.
visibility
=
View
.
GONE
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/adapter/JunkExpandAdapter.kt
View file @
fec216d4
...
@@ -23,6 +23,11 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -23,6 +23,11 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
private
val
parentBeanList
by
lazy
{
private
val
parentBeanList
by
lazy
{
mutableListOf
(
mutableListOf
(
ParentBean
(
title
=
"empty folder"
,
isParentSelected
=
true
,
expanded
=
false
),
ParentBean
(
ParentBean
(
title
=
"Useless installation package"
,
title
=
"Useless installation package"
,
isParentSelected
=
true
,
isParentSelected
=
true
,
...
@@ -66,7 +71,7 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -66,7 +71,7 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
return
ParentViewHolder
(
binding
)
return
ParentViewHolder
(
binding
)
}
}
@SuppressLint
(
"NotifyDataSetChanged"
)
@SuppressLint
(
"NotifyDataSetChanged"
,
"SetTextI18n"
)
override
fun
onBindGroupViewHolder
(
holder
:
ViewHolder
,
groupPosition
:
Int
,
expand
:
Boolean
,
payloads
:
List
<
Any
>)
{
override
fun
onBindGroupViewHolder
(
holder
:
ViewHolder
,
groupPosition
:
Int
,
expand
:
Boolean
,
payloads
:
List
<
Any
>)
{
val
viewHolder
=
holder
as
?
ParentViewHolder
?:
return
val
viewHolder
=
holder
as
?
ParentViewHolder
?:
return
val
parentBean
=
parentBeanList
[
groupPosition
]
val
parentBean
=
parentBeanList
[
groupPosition
]
...
@@ -79,7 +84,12 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -79,7 +84,12 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
}
else
{
}
else
{
viewHolder
.
binding
.
idXiala
.
setImageResource
(
R
.
mipmap
.
shouqi
)
viewHolder
.
binding
.
idXiala
.
setImageResource
(
R
.
mipmap
.
shouqi
)
}
}
viewHolder
.
binding
.
idTypeSize
.
text
=
parentBean
.
parentSize
.
toFormatSize
(
1
)
if
(
parentBean
.
title
==
"empty folder"
)
{
viewHolder
.
binding
.
idTypeSize
.
text
=
parentBean
.
childItem
.
size
.
toString
()
+
" items"
}
else
{
viewHolder
.
binding
.
idTypeSize
.
text
=
parentBean
.
parentSize
.
toFormatSize
(
1
)
}
viewHolder
.
binding
.
idXiala
.
isVisible
=
parentBean
.
childItem
.
isNotEmpty
()
viewHolder
.
binding
.
idXiala
.
isVisible
=
parentBean
.
childItem
.
isNotEmpty
()
viewHolder
.
binding
.
idImgChoose
.
isSelected
=
parentBean
.
isParentSelected
viewHolder
.
binding
.
idImgChoose
.
isSelected
=
parentBean
.
isParentSelected
...
@@ -105,10 +115,14 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -105,10 +115,14 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
chooseAction
.
invoke
(
selectSize
)
chooseAction
.
invoke
(
selectSize
)
}
}
fun
getChoosePath
():
List
<
ChildBean
>
{
fun
getChoosePath
():
List
<
ChildBean
>
{
return
parentBeanList
.
flatMap
{
it
.
childItem
}.
filter
{
it
.
isChildSelected
}
return
parentBeanList
.
flatMap
{
it
.
childItem
}.
filter
{
it
.
isChildSelected
}
}
}
fun
getAllChildItemCount
():
Int
{
return
parentBeanList
.
flatMap
{
it
.
childItem
}.
size
}
private
fun
bindParentAnimation
(
parentBean
:
ParentBean
,
groupPosition
:
Int
,
viewHolder
:
ParentViewHolder
)
{
private
fun
bindParentAnimation
(
parentBean
:
ParentBean
,
groupPosition
:
Int
,
viewHolder
:
ParentViewHolder
)
{
if
(
parentBean
.
isfinish
)
{
if
(
parentBean
.
isfinish
)
{
viewHolder
.
binding
.
idImgLoad
.
isVisible
=
false
viewHolder
.
binding
.
idImgLoad
.
isVisible
=
false
...
@@ -146,6 +160,11 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -146,6 +160,11 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
when
(
groupPosition
)
{
when
(
groupPosition
)
{
0
->
{
0
->
{
viewHolder
.
binding
.
idTvAppName
.
text
=
childBean
.
chilepath
}
1
->
{
try
{
try
{
val
apkFilePath
=
childBean
.
chilepath
// 替换成您的APK文件路径
val
apkFilePath
=
childBean
.
chilepath
// 替换成您的APK文件路径
val
packageInfo
=
val
packageInfo
=
...
@@ -160,14 +179,13 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
...
@@ -160,14 +179,13 @@ class JunkExpandAdapter(private val chooseAction: (size: Long) -> Unit) : Expand
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
apk
)
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
apk
)
}
}
}
}
1
->
{
2
->
{
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
temp_clean
)
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
temp_clean
)
}
}
2
->
{
3
->
{
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
log_clean
)
holder
.
binding
.
idImgIcon
.
setImageResource
(
R
.
mipmap
.
log_clean
)
}
}
}
}
...
...
app/src/main/res/layout/activity_layout_clean_junk.xml
View file @
fec216d4
...
@@ -15,6 +15,10 @@
...
@@ -15,6 +15,10 @@
android:orientation=
"vertical"
android:orientation=
"vertical"
app:layout_constraintTop_toTopOf=
"parent"
>
app:layout_constraintTop_toTopOf=
"parent"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
/>
<FrameLayout
<FrameLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
@@ -130,7 +134,8 @@
...
@@ -130,7 +134,8 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:visibility=
"visible"
/>
android:visibility=
"visible"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
<TextView
<TextView
android:id=
"@+id/tv_btn"
android:id=
"@+id/tv_btn"
...
...
app/src/main/res/layout/item_child.xml
View file @
fec216d4
...
@@ -26,9 +26,10 @@
...
@@ -26,9 +26,10 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"6dp"
android:layout_marginBottom=
"6dp"
android:ellipsize=
"
end
"
android:ellipsize=
"
middle
"
android:includeFontPadding=
"false"
android:includeFontPadding=
"false"
android:maxLines=
"1"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"Ali Webpage ads"
android:text=
"Ali Webpage ads"
android:textColor=
"#000000"
android:textColor=
"#000000"
android:textSize=
"14sp"
android:textSize=
"14sp"
...
...
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