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
3ac7b60b
Commit
3ac7b60b
authored
Jul 22, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7b3a2d98
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
37 deletions
+26
-37
RecycleBinDetailActivity.kt
...ecyclebin/activity/recyclebin/RecycleBinDetailActivity.kt
+17
-16
RecycleBinAdapter.kt
.../base/filerecoveryrecyclebin/adapter/RecycleBinAdapter.kt
+6
-4
RecycleBinBean.kt
...va/com/base/filerecoveryrecyclebin/bean/RecycleBinBean.kt
+1
-1
RecycleBinFragment.kt
...ase/filerecoveryrecyclebin/fragment/RecycleBinFragment.kt
+0
-14
BackUpUtils.kt
...va/com/base/filerecoveryrecyclebin/service/BackUpUtils.kt
+2
-2
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/recyclebin/RecycleBinDetailActivity.kt
View file @
3ac7b60b
...
...
@@ -3,13 +3,11 @@ package com.base.filerecoveryrecyclebin.activity.recyclebin
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.net.Uri
import
android.os.Build
import
android.util.Log
import
android.view.View
import
android.widget.Toast
import
androidx.activity.addCallback
import
androidx.annotation.RequiresApi
import
androidx.core.content.FileProvider
import
androidx.core.view.updatePadding
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.activity.recyclebin.RecycleBinFileEx.findRecycleBinFile
...
...
@@ -35,6 +33,16 @@ class RecycleBinDetailActivity : BaseActivity<ActivityRecycleBinDetailBinding>()
ActivityRecycleBinDetailBinding
.
inflate
(
layoutInflater
)
}
private
var
recycleBinBean
:
RecycleBinBean
?
=
null
val
mImageStr
:
Set
<
String
>
=
HashSet
(
mutableListOf
(
".jpg"
,
".jpeg"
,
".png"
,
".gif"
,
".bmp"
)
)
val
mVideoStr
:
Set
<
String
>
=
HashSet
(
mutableListOf
(
".mp4"
,
".avi"
,
".mov"
,
".mkv"
)
)
@SuppressLint
(
"SetTextI18n"
)
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
...
...
@@ -48,24 +56,17 @@ class RecycleBinDetailActivity : BaseActivity<ActivityRecycleBinDetailBinding>()
LogEx
.
logDebug
(
TAG
,
"json=$json"
)
recycleBinBean
=
Gson
().
fromJson
(
json
,
RecycleBinBean
::
class
.
java
)
recycleBinBean
?.
let
{
bean
->
if
(
bean
.
mimeType
.
contains
(
"image/"
))
{
if
(
mImageStr
.
contains
(
"."
+
bean
.
mimeType
))
{
binding
.
ivBofang
.
visibility
=
View
.
GONE
}
if
(
bean
.
mimeType
.
contains
(
"video/"
))
{
if
(
mVideoStr
.
contains
(
"."
+
bean
.
mimeType
))
{
binding
.
ivBofang
.
visibility
=
View
.
VISIBLE
}
val
file
=
File
(
bean
.
path
)
val
binFile
=
findRecycleBinFile
(
file
.
name
)
val
binJsonFile
=
findRecycleBinJsonFile
(
file
.
name
)
if
(
binFile
!=
null
&&
binJsonFile
!=
null
)
{
Glide
.
with
(
this
).
load
(
binFile
.
absoluteFile
).
centerCrop
().
into
(
binding
.
iv
)
binding
.
tvName
.
text
=
bean
.
path
binding
.
tvSize
.
text
=
bean
.
size
.
toFormatSize
()
binding
.
tvTime
.
text
=
"Delete time:${bean.deleteTime.toFormatTime()}"
}
Glide
.
with
(
this
).
load
(
bean
.
backupPath
).
centerCrop
().
into
(
binding
.
iv
)
binding
.
tvName
.
text
=
bean
.
path
binding
.
tvSize
.
text
=
bean
.
size
.
toFormatSize
()
binding
.
tvTime
.
text
=
"Delete time:${bean.deleteTime.toFormatTime()}"
}
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/adapter/RecycleBinAdapter.kt
View file @
3ac7b60b
...
...
@@ -46,10 +46,12 @@ class RecycleBinAdapter(val click: (bean: RecycleBinBean) -> Unit) : RecyclerVie
override
fun
onBindViewHolder
(
holder
:
RBAV
,
position
:
Int
)
{
val
binding
=
ItemRecyclebinFileBinding
.
bind
(
holder
.
itemView
)
val
bean
=
beanList
[
position
]
val
file
=
File
(
bean
.
path
)
val
binFile
=
findRecycleBinFile
(
file
.
name
)
val
file
=
File
(
bean
.
backupPath
)
val
context
=
holder
.
itemView
.
context
Glide
.
with
(
context
).
load
(
binFile
?.
absoluteFile
).
listener
(
object
:
RequestListener
<
Drawable
>
{
LogEx
.
logDebug
(
"glc"
,
"bean.backupPath "
+
bean
.
backupPath
)
LogEx
.
logDebug
(
"glc"
,
"bean.absoluteFile "
+
bean
.
backupPath
)
Glide
.
with
(
context
).
load
(
file
?.
absoluteFile
).
listener
(
object
:
RequestListener
<
Drawable
>
{
override
fun
onLoadFailed
(
e
:
GlideException
?,
model
:
Any
?,
target
:
Target
<
Drawable
>,
isFirstResource
:
Boolean
):
Boolean
{
LogEx
.
logDebug
(
TAG
,
"Failed to load image: $model"
)
return
false
...
...
@@ -66,7 +68,7 @@ class RecycleBinAdapter(val click: (bean: RecycleBinBean) -> Unit) : RecyclerVie
return
false
}
}).
centerCrop
().
into
(
binding
.
iv
)
binding
.
tvName
.
text
=
file
.
name
binding
.
tvName
.
text
=
bean
.
name
binding
.
tvTime
.
text
=
"delete time:"
+
bean
.
deleteTime
.
toFormatTime
()
binding
.
tvSize
.
text
=
bean
.
size
.
toFormatSize
()
binding
.
root
.
setOnClickListener
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/bean/RecycleBinBean.kt
View file @
3ac7b60b
package
com.base.filerecoveryrecyclebin.bean
import
android.net.Uri
data class
RecycleBinBean
(
val
name
:
String
=
""
,
val
path
:
String
=
""
,
val
backupPath
:
String
=
""
,
var
deleteTime
:
Long
=
0
,
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/RecycleBinFragment.kt
View file @
3ac7b60b
...
...
@@ -37,20 +37,6 @@ class RecycleBinFragment : BaseFragment<FragmentRecycleBinBinding>() {
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
override
fun
setView
()
{
// handler = Handler(requireActivity().mainLooper) { message ->
// if (message.what == 99) {
//// LogEx.logDebug(TAG, "媒体库更新了")
// initData()
// }
// if (message.what == 100) {
//// LogEx.logDebug(TAG, "回收站数据更新了")
// initData()
// }
// true
// }
// StayNotificationService.mainHandler = handler
recycleBinAdapter
=
RecycleBinAdapter
{
bean
->
startActivity
(
Intent
(
requireContext
(),
RecycleBinDetailActivity
::
class
.
java
).
apply
{
putExtra
(
"Json"
,
Gson
().
toJson
(
bean
))
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/service/BackUpUtils.kt
View file @
3ac7b60b
...
...
@@ -28,9 +28,9 @@ object BackUpUtils {
return
}
try
{
val
recycleBinFile
=
File
(
getRecycleBinDir
(),
".
\$name
"
)
val
recycleBinFile
=
File
(
getRecycleBinDir
(),
".
$path
"
)
src
.
copyTo
(
recycleBinFile
,
true
)
val
binBean
=
RecycleBinBean
(
src
.
path
,
recycleBinFile
.
p
ath
,
0
,
src
.
length
(),
getFileExtension
(
src
),
false
)
val
binBean
=
RecycleBinBean
(
path
,
src
.
path
,
recycleBinFile
.
absoluteP
ath
,
0
,
src
.
length
(),
getFileExtension
(
src
),
false
)
saveData
(
binBean
,
path
)
}
catch
(
e
:
Exception
)
{
...
...
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