Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner 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
PDF Viewer Scanner White
Commits
6698b57f
Commit
6698b57f
authored
Dec 19, 2024
by
周文华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修复】修复pdf加锁问题
parent
0005e831
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
PdfActivity.kt
...base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
+3
-3
PdfBoxUtils.kt
...base/pdfviewerscannerwhite/ui/document/pdf/PdfBoxUtils.kt
+4
-0
PdfPagerAdapter.kt
.../pdfviewerscannerwhite/ui/document/pdf/PdfPagerAdapter.kt
+1
-7
PdfSplitActivity.kt
...pdfviewerscannerwhite/ui/document/pdf/PdfSplitActivity.kt
+1
-2
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
View file @
6698b57f
...
@@ -121,11 +121,11 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
...
@@ -121,11 +121,11 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
SearchTaskResult
.
set
(
null
)
SearchTaskResult
.
set
(
null
)
if
(
muPDFCore
?.
needsPassword
()
==
true
)
{
if
(
muPDFCore
?.
needsPassword
()
==
true
)
{
val
pwd
=
intent
.
extras
?.
getString
(
"pwd"
)
?:
""
//
val pwd = intent.extras?.getString("pwd") ?: ""
val
flag
=
muPDFCore
?.
authenticatePassword
(
pwd
)
?:
false
val
flag
=
muPDFCore
?.
authenticatePassword
(
pwd
)
?:
false
if
(
flag
)
{
if
(
flag
)
{
pdfPresenter
.
password
=
pwd
pdfPresenter
.
password
=
pwd
pdfPageAdapter
.
setPassword
(
pwd
)
//
pdfPageAdapter.setPassword(pwd)
createPdfUI
()
createPdfUI
()
muPDFCore
?.
countPages
()
?.
let
{
muPDFCore
?.
countPages
()
?.
let
{
//pdfPresenter.iniPdfPage(it)
//pdfPresenter.iniPdfPage(it)
...
@@ -351,7 +351,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
...
@@ -351,7 +351,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
}
}
private
fun
initAdapter
()
{
private
fun
initAdapter
()
{
pdfPageAdapter
=
PdfPagerAdapter
(
path
,
uri
){
pdfPageAdapter
=
PdfPagerAdapter
(
path
,
uri
,
mPassword
=
pwd
){
iniSetVerticalSeekbar
(
it
)
iniSetVerticalSeekbar
(
it
)
}
}
pdfPageAdapter
.
clickAction
=
{
pageIndex
->
pdfPageAdapter
.
clickAction
=
{
pageIndex
->
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfBoxUtils.kt
View file @
6698b57f
...
@@ -15,6 +15,7 @@ import com.tom_roush.pdfbox.pdmodel.PDPage
...
@@ -15,6 +15,7 @@ import com.tom_roush.pdfbox.pdmodel.PDPage
import
com.tom_roush.pdfbox.pdmodel.PDPageContentStream
import
com.tom_roush.pdfbox.pdmodel.PDPageContentStream
import
com.tom_roush.pdfbox.pdmodel.common.PDRectangle
import
com.tom_roush.pdfbox.pdmodel.common.PDRectangle
import
com.tom_roush.pdfbox.pdmodel.encryption.AccessPermission
import
com.tom_roush.pdfbox.pdmodel.encryption.AccessPermission
import
com.tom_roush.pdfbox.pdmodel.encryption.InvalidPasswordException
import
com.tom_roush.pdfbox.pdmodel.encryption.StandardProtectionPolicy
import
com.tom_roush.pdfbox.pdmodel.encryption.StandardProtectionPolicy
import
com.tom_roush.pdfbox.pdmodel.graphics.image.PDImageXObject
import
com.tom_roush.pdfbox.pdmodel.graphics.image.PDImageXObject
import
com.tom_roush.pdfbox.rendering.ImageType
import
com.tom_roush.pdfbox.rendering.ImageType
...
@@ -90,6 +91,9 @@ object PdfBoxUtils {
...
@@ -90,6 +91,9 @@ object PdfBoxUtils {
state
=
0
state
=
0
}
}
}
}
}
catch
(
e
:
InvalidPasswordException
){
e
.
printStackTrace
()
state
=
1
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
state
=
-
1
state
=
-
1
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfPagerAdapter.kt
View file @
6698b57f
...
@@ -27,10 +27,10 @@ class PdfPagerAdapter(
...
@@ -27,10 +27,10 @@ class PdfPagerAdapter(
val
uri
:
String
?
=
null
,
val
uri
:
String
?
=
null
,
val
itemLayout
:
Int
=
R
.
layout
.
item_pdf_pager
,
val
itemLayout
:
Int
=
R
.
layout
.
item_pdf_pager
,
private
val
previewScale
:
Float
=
1f
,
private
val
previewScale
:
Float
=
1f
,
private
val
mPassword
:
String
?
=
null
,
initCallBack
:
((
itemCount
:
Int
)
->
Unit
)?
=
null
initCallBack
:
((
itemCount
:
Int
)
->
Unit
)?
=
null
)
:
BaseQuickAdapter
<
PdfPageBean
,
PdfPagerAdapter
.
PdfPagerViewHolder
>()
{
)
:
BaseQuickAdapter
<
PdfPageBean
,
PdfPagerAdapter
.
PdfPagerViewHolder
>()
{
var
mPassword
:
String
?
=
null
var
selectAction
:
((
enable
:
Boolean
,
allSelect
:
Boolean
)
->
Unit
)?
=
null
var
selectAction
:
((
enable
:
Boolean
,
allSelect
:
Boolean
)
->
Unit
)?
=
null
var
clickAction
:
((
pageIndex
:
Int
)
->
Unit
)?
=
null
var
clickAction
:
((
pageIndex
:
Int
)
->
Unit
)?
=
null
...
@@ -183,12 +183,6 @@ class PdfPagerAdapter(
...
@@ -183,12 +183,6 @@ class PdfPagerAdapter(
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
@SuppressLint
(
"NotifyDataSetChanged"
)
fun
setPassword
(
password
:
String
)
{
mPassword
=
password
notifyDataSetChanged
()
}
fun
release
()
{
fun
release
()
{
scope
.
cancel
()
scope
.
cancel
()
pdfRender
=
null
pdfRender
=
null
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfSplitActivity.kt
View file @
6698b57f
...
@@ -70,8 +70,7 @@ class PdfSplitActivity : BaseActivity<ActivityPdfSplitBinding>(), PdfView {
...
@@ -70,8 +70,7 @@ class PdfSplitActivity : BaseActivity<ActivityPdfSplitBinding>(), PdfView {
}
}
private
fun
initAdapter
()
{
private
fun
initAdapter
()
{
pdfPagerAdapter
=
PdfPagerAdapter
(
path
,
null
,
R
.
layout
.
item_pdf_pager_split
,
1.5f
)
pdfPagerAdapter
=
PdfPagerAdapter
(
path
,
null
,
R
.
layout
.
item_pdf_pager_split
,
1.5f
,
mPassword
=
pwd
)
pdfPagerAdapter
.
mPassword
=
pwd
pdfPagerAdapter
.
selectAction
=
{
enable
,
allSelect
->
pdfPagerAdapter
.
selectAction
=
{
enable
,
allSelect
->
binding
.
tvBtnSplit
.
isEnabled
=
enable
binding
.
tvBtnSplit
.
isEnabled
=
enable
binding
.
ivSelector
.
isSelected
=
allSelect
binding
.
ivSelector
.
isSelected
=
allSelect
...
...
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