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
b46ca915
Commit
b46ca915
authored
Jan 08, 2025
by
guest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改空文件夹
parent
8fa04feb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5399 additions
and
16 deletions
+5399
-16
CleanJunkActivity.kt
...base/datarecovery/activity/junkclean/CleanJunkActivity.kt
+37
-16
test9.py
app/test9.py
+1555
-0
word_file.json
app/word_file.json
+3807
-0
No files found.
app/src/main/java/com/base/datarecovery/activity/junkclean/CleanJunkActivity.kt
View file @
b46ca915
...
...
@@ -17,7 +17,6 @@ import com.base.datarecovery.bean.ChildBean
import
com.base.datarecovery.bean.ConstObject.JUNK_CLEANER
import
com.base.datarecovery.databinding.ActivityLayoutCleanJunkBinding
import
com.base.datarecovery.help.BaseActivity
import
com.base.datarecovery.help.FileHelp
import
com.base.datarecovery.help.KotlinExt.toFormatSize
import
com.base.datarecovery.help.PermissionHelp.checkStorePermission
import
com.base.datarecovery.help.PermissionHelp.requestStorePermission
...
...
@@ -193,24 +192,32 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
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
.
filter
{
it
.
listFiles
().
isNullOrEmpty
()
}.
forEach
{
l
->
list
.
add
(
ChildBean
(
R
.
mipmap
.
kongwenjian
,
l
.
name
,
l
.
path
,
1
))
val
empty
=
findEmptyFolders
()
empty
.
filter
{
it
.
listFiles
().
isNullOrEmpty
()
}.
forEach
{
l
->
totalSize
+=
l
.
length
()
list
.
add
(
ChildBean
(
R
.
mipmap
.
kongwenjian
,
l
.
name
,
l
.
path
,
l
.
length
()))
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
// 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.filter { it.listFiles().isNullOrEmpty() }.forEach { l ->
// list.add(ChildBean(R.mipmap.kongwenjian, l.name, l.path, 1))
// }
// delay(Random.nextLong(1500, 2000))
// }.await()
junkExpandAdapter
.
addChildData
(
0
,
list
)
...
...
@@ -281,4 +288,18 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
it
.
cancel
()
}
}
fun
findEmptyFolders
():
List
<
File
>
{
val
externalStorageDir
=
Environment
.
getExternalStorageDirectory
()
val
filters
=
arrayOf
(
"/storage/emulated/0/Android/data"
,
"/storage/emulated/0/Android/obb"
)
val
emptyFolders
=
getAllEmptyFolders
(
externalStorageDir
,
filters
)
return
emptyFolders
}
private
fun
getAllEmptyFolders
(
root
:
File
,
filters
:
Array
<
String
>):
List
<
File
>
{
return
root
.
walk
()
.
filter
{
it
.
isDirectory
&&
!
filters
.
contains
(
it
.
path
)
&&
!
it
.
isHidden
&&
it
.
list
()
?.
isEmpty
()
==
true
}
.
toList
()
}
}
\ No newline at end of file
app/test9.py
0 → 100644
View file @
b46ca915
This diff is collapsed.
Click to expand it.
app/word_file.json
0 → 100644
View file @
b46ca915
This diff is collapsed.
Click to expand it.
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