Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White ago
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
kuxulei
PDF Viewer Scanner White ago
Commits
66f0c395
Commit
66f0c395
authored
Dec 19, 2024
by
周文华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修复】修复分解、合并页面,加锁状态与空文件问题
parent
6698b57f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
14 deletions
+38
-14
DocumentPresenter.kt
...m/base/pdfviewerscannerwhite/ui/main/DocumentPresenter.kt
+38
-14
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/DocumentPresenter.kt
View file @
66f0c395
...
...
@@ -13,6 +13,7 @@ import com.base.pdfviewerscannerwhite.utils.getMediaFile
import
com.base.pdfviewerscannerwhite.utils.upDateDemoStore
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
java.io.File
class
DocumentPresenter
(
...
...
@@ -37,19 +38,23 @@ class DocumentPresenter(
if
(
type
==
DocumentBean
.
TYPE_PDF
)
{
selectionArgs
=
arrayOf
(
ConstObject
.
MIME_TYPE_PDF
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pdf"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pdf"
)
}
?.
absolutePath
?:
""
}
if
(
type
==
DocumentBean
.
TYPE_WORD
)
{
selectionArgs
=
arrayOf
(
ConstObject
.
MIME_TYPE_DOC
,
ConstObject
.
MIME_TYPE_DOCX
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".docx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".docx"
)
}
?.
absolutePath
?:
""
}
if
(
type
==
DocumentBean
.
TYPE_EXCEL
)
{
selectionArgs
=
arrayOf
(
ConstObject
.
MIME_TYPE_XLS
,
ConstObject
.
MIME_TYPE_XLSX
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".xlsx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".xlsx"
)
}
?.
absolutePath
?:
""
}
if
(
type
==
DocumentBean
.
TYPE_PPT
)
{
selectionArgs
=
arrayOf
(
ConstObject
.
MIME_TYPE_PPT
,
ConstObject
.
MIME_TYPE_PPTX
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pptx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pptx"
)
}
?.
absolutePath
?:
""
}
demoDocumentBean
.
type
=
type
...
...
@@ -57,7 +62,12 @@ class DocumentPresenter(
val
list
=
context
.
getMediaFile
(
selectionArgs
=
selectionArgs
)
val
documentList
=
list
.
map
{
DocumentBean
(
it
.
path
,
uri
=
it
.
uri
,
type
=
type
,
isBookmarked
=
bookmarkList
.
contains
(
it
.
path
))
DocumentBean
(
it
.
path
,
uri
=
it
.
uri
,
type
=
type
,
isBookmarked
=
bookmarkList
.
contains
(
it
.
path
)
)
}
val
new
=
documentList
.
toMutableList
()
if
(
File
(
demoDocumentBean
.
path
).
exists
())
{
...
...
@@ -68,31 +78,45 @@ class DocumentPresenter(
fun
initData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
documentList
=
getDocumentBeanList
()
launch
(
Dispatchers
.
Main
)
{
documentView
.
refreshDocumentRv
(
documentList
)
val
realList
=
documentList
.
filter
{
val
file
=
File
(
it
.
path
)
file
.
exists
()
&&
file
.
length
()
>
0
}
realList
.
forEach
{
it
.
state
=
PdfBoxUtils
.
checkPdfEncryption
(
it
.
path
)
}
withContext
(
Dispatchers
.
Main
)
{
documentView
.
refreshDocumentRv
(
realList
)
}
}
fun
initUnLockData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
documentList
=
getDocumentBeanList
()
documentList
.
forEach
{
val
realList
=
documentList
.
filter
{
val
file
=
File
(
it
.
path
)
file
.
exists
()
&&
file
.
length
()
>
0
}
realList
.
forEach
{
it
.
state
=
PdfBoxUtils
.
checkPdfEncryption
(
it
.
path
)
}
val
list
=
document
List
.
filter
{
it
.
state
==
0
}
launch
(
Dispatchers
.
Main
)
{
val
list
=
real
List
.
filter
{
it
.
state
==
0
}
withContext
(
Dispatchers
.
Main
)
{
documentView
.
refreshDocumentRv
(
list
)
}
}
fun
initLoadData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
documentList
=
getDocumentBeanList
()
documentList
.
forEach
{
val
realList
=
documentList
.
filter
{
val
file
=
File
(
it
.
path
)
file
.
exists
()
&&
file
.
length
()
>
0
}
realList
.
forEach
{
it
.
state
=
PdfBoxUtils
.
checkPdfEncryption
(
it
.
path
)
}
val
list
=
document
List
.
filter
{
it
.
state
==
1
}
launch
(
Dispatchers
.
Main
)
{
val
list
=
real
List
.
filter
{
it
.
state
==
1
}
withContext
(
Dispatchers
.
Main
)
{
documentView
.
refreshDocumentRv
(
list
)
}
}
...
...
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