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
60d400a9
Commit
60d400a9
authored
Jul 22, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
....回收站Glide加载失败
parent
0fb9fa34
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
5 deletions
+29
-5
MyFileObserver.kt
...erecoveryrecyclebin/activity/recyclebin/MyFileObserver.kt
+1
-0
RecycleBinAdapter.kt
.../base/filerecoveryrecyclebin/adapter/RecycleBinAdapter.kt
+25
-2
RecycleBinFragment.kt
...ase/filerecoveryrecyclebin/fragment/RecycleBinFragment.kt
+0
-1
item_recyclebin_file.xml
app/src/main/res/layout/item_recyclebin_file.xml
+3
-2
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/recyclebin/MyFileObserver.kt
View file @
60d400a9
...
...
@@ -12,6 +12,7 @@ import com.base.filerecoveryrecyclebin.utils.LogEx
import
com.google.gson.Gson
import
java.io.File
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
class
MyFileObserver
(
files
:
List
<
File
>)
:
FileObserver
(
files
,
ALL_EVENTS
)
{
private
val
TAG
=
"MyFileObserver"
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/adapter/RecycleBinAdapter.kt
View file @
60d400a9
package
com.base.filerecoveryrecyclebin.adapter
import
android.annotation.SuppressLint
import
android.graphics.drawable.Drawable
import
android.os.Build
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -13,12 +14,19 @@ import com.base.filerecoveryrecyclebin.bean.RecycleBinBean
import
com.base.filerecoveryrecyclebin.databinding.ItemRecyclebinFileBinding
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatSize
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatTime
import
com.base.filerecoveryrecyclebin.utils.LogEx
import
com.base.filerecoveryrecyclebin.view.XmlEx.inflate
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.DataSource
import
com.bumptech.glide.load.engine.GlideException
import
com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.target.Target
import
java.io.File
class
RecycleBinAdapter
(
val
click
:
(
bean
:
RecycleBinBean
)
->
Unit
)
:
RecyclerView
.
Adapter
<
RecycleBinAdapter
.
RBAV
>()
{
private
val
TAG
=
"RecycleBinAdapter"
private
val
beanList
=
arrayListOf
<
RecycleBinBean
>()
...
...
@@ -34,7 +42,6 @@ class RecycleBinAdapter(val click: (bean: RecycleBinBean) -> Unit) : RecyclerVie
return
beanList
.
size
}
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
@SuppressLint
(
"SetTextI18n"
)
override
fun
onBindViewHolder
(
holder
:
RBAV
,
position
:
Int
)
{
val
binding
=
ItemRecyclebinFileBinding
.
bind
(
holder
.
itemView
)
...
...
@@ -42,7 +49,23 @@ class RecycleBinAdapter(val click: (bean: RecycleBinBean) -> Unit) : RecyclerVie
val
file
=
File
(
bean
.
path
)
val
binFile
=
findRecycleBinFile
(
file
.
name
)
val
context
=
holder
.
itemView
.
context
Glide
.
with
(
context
).
load
(
binFile
?.
absoluteFile
).
centerCrop
().
into
(
binding
.
iv
)
Glide
.
with
(
context
).
load
(
binFile
?.
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
}
override
fun
onResourceReady
(
resource
:
Drawable
,
model
:
Any
,
target
:
Target
<
Drawable
>?,
dataSource
:
DataSource
,
isFirstResource
:
Boolean
):
Boolean
{
return
false
}
}).
centerCrop
().
into
(
binding
.
iv
)
binding
.
tvName
.
text
=
file
.
name
binding
.
tvTime
.
text
=
"delete time:"
+
bean
.
deleteTime
.
toFormatTime
()
binding
.
tvSize
.
text
=
bean
.
size
.
toFormatSize
()
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/RecycleBinFragment.kt
View file @
60d400a9
...
...
@@ -76,7 +76,6 @@ class RecycleBinFragment : BaseFragment<FragmentRecycleBinBinding>() {
}
}
@RequiresApi
(
Build
.
VERSION_CODES
.
Q
)
private
fun
initData
()
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
...
...
app/src/main/res/layout/item_recyclebin_file.xml
View file @
60d400a9
...
...
@@ -9,8 +9,8 @@
<androidx.cardview.widget.CardView
android:id=
"@+id/card"
android:layout_width=
"5
0
dp"
android:layout_height=
"5
0
dp"
android:layout_width=
"5
5
dp"
android:layout_height=
"5
5
dp"
app:cardCornerRadius=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -20,6 +20,7 @@
android:id=
"@+id/iv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"5dp"
tools:ignore=
"ContentDescription"
/>
</androidx.cardview.widget.CardView>
...
...
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