Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser 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
Browser White
Commits
91de3794
Commit
91de3794
authored
Aug 27, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
b61f0e8f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
4 deletions
+27
-4
MyApplication.kt
app/src/main/java/com/base/browserwhite/MyApplication.kt
+1
-2
DownloadAdapter.kt
...base/browserwhite/ui/activity/download/DownloadAdapter.kt
+1
-0
WebDownloadManagerActivity.kt
...rwhite/ui/activity/download/WebDownloadManagerActivity.kt
+17
-1
bg_delete_download.xml
app/src/main/res/drawable/bg_delete_download.xml
+6
-0
activity_web_download_manager.xml
app/src/main/res/layout/activity_web_download_manager.xml
+2
-1
d_del_s.png
app/src/main/res/mipmap-xxhdpi/d_del_s.png
+0
-0
No files found.
app/src/main/java/com/base/browserwhite/MyApplication.kt
View file @
91de3794
...
@@ -31,8 +31,7 @@ class MyApplication : Application() {
...
@@ -31,8 +31,7 @@ class MyApplication : Application() {
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
context
=
this
context
=
this
initApp
()
}
}
fun
initApp
()
{
fun
initApp
()
{
...
...
app/src/main/java/com/base/browserwhite/ui/activity/download/DownloadAdapter.kt
View file @
91de3794
...
@@ -290,6 +290,7 @@ class DownloadAdapter : BaseQuickAdapter<DownloadBean, DownloadAdapter.DownloadV
...
@@ -290,6 +290,7 @@ class DownloadAdapter : BaseQuickAdapter<DownloadBean, DownloadAdapter.DownloadV
private
fun
createNewLister
(
item
:
DownloadBean
,
tag
:
String
=
""
,
position
:
Int
):
FileDownloadListener
{
private
fun
createNewLister
(
item
:
DownloadBean
,
tag
:
String
=
""
,
position
:
Int
):
FileDownloadListener
{
return
object
:
FileDownloadListener
()
{
return
object
:
FileDownloadListener
()
{
override
fun
pending
(
task
:
BaseDownloadTask
?,
soFarBytes
:
Int
,
totalBytes
:
Int
)
{
override
fun
pending
(
task
:
BaseDownloadTask
?,
soFarBytes
:
Int
,
totalBytes
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"pending tag=$tag item=${item.downloadId} ${task?.id}"
)
}
}
override
fun
progress
(
task
:
BaseDownloadTask
?,
soFarBytes
:
Int
,
totalBytes
:
Int
)
{
override
fun
progress
(
task
:
BaseDownloadTask
?,
soFarBytes
:
Int
,
totalBytes
:
Int
)
{
...
...
app/src/main/java/com/base/browserwhite/ui/activity/download/WebDownloadManagerActivity.kt
View file @
91de3794
...
@@ -100,6 +100,11 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
...
@@ -100,6 +100,11 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
recordFile
.
writeText
(
json
)
recordFile
.
writeText
(
json
)
}
}
private
fun
clearDownloadJson
()
{
val
recordFile
=
getDownloadJson
()
recordFile
.
writeText
(
""
)
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
...
@@ -114,7 +119,15 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
...
@@ -114,7 +119,15 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
}
}
binding
.
ivDelete
.
setOnClickListener
{
binding
.
ivDelete
.
setOnClickListener
{
showDeleteTipDialog
{
showDeleteTipDialog
{
runCatching
{
adapter
.
items
.
forEach
{
File
(
it
.
path
).
delete
()
clearDownloadJson
()
}
}
binding
.
llEmpty
.
isVisible
=
true
binding
.
ivDelete
.
isEnabled
=
false
adapter
.
submitList
(
listOf
())
}
}
}
}
}
}
...
@@ -123,7 +136,9 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
...
@@ -123,7 +136,9 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
val
list
=
getDownloadJsonBean
(
getDownloadJson
())
val
list
=
getDownloadJsonBean
(
getDownloadJson
())
if
(
list
.
isEmpty
())
{
if
(
list
.
isEmpty
())
{
binding
.
ivDelete
.
isEnabled
=
false
binding
.
llEmpty
.
isVisible
=
true
binding
.
llEmpty
.
isVisible
=
true
}
else
{
}
else
{
val
beanList
=
arrayListOf
<
DownloadBean
>()
val
beanList
=
arrayListOf
<
DownloadBean
>()
...
@@ -141,6 +156,7 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
...
@@ -141,6 +156,7 @@ class WebDownloadManagerActivity : BaseActivity<ActivityWebDownloadManagerBindin
beanList
.
add
(
old
.
apply
{
uiType
=
1
})
beanList
.
add
(
old
.
apply
{
uiType
=
1
})
}
}
adapter
.
submitList
(
beanList
)
adapter
.
submitList
(
beanList
)
binding
.
ivDelete
.
isEnabled
=
true
}
}
}
}
...
...
app/src/main/res/drawable/bg_delete_download.xml
0 → 100644
View file @
91de3794
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_enabled=
"true"
android:drawable=
"@mipmap/d_del_s"
/>
<item
android:state_enabled=
"false"
android:drawable=
"@mipmap/d_del"
/>
</selector>
\ No newline at end of file
app/src/main/res/layout/activity_web_download_manager.xml
View file @
91de3794
...
@@ -50,7 +50,8 @@
...
@@ -50,7 +50,8 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"16dp"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/d_del_s"
android:enabled=
"false"
android:src=
"@drawable/bg_delete_download"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</FrameLayout>
...
...
app/src/main/res/mipmap-xxhdpi/d_del_s.png
View replaced file @
b61f0e8f
View file @
91de3794
1.79 KB
|
W:
|
H:
1.38 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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