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
6d575f28
Commit
6d575f28
authored
Sep 23, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
a48cf652
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
4 deletions
+67
-4
DocumentBean.kt
.../java/com/base/pdfviewerscannerwhite/bean/DocumentBean.kt
+2
-2
DocumentAdapter.kt
.../base/pdfviewerscannerwhite/ui/adapter/DocumentAdapter.kt
+15
-2
PdfSelectActivity.kt
...dfviewerscannerwhite/ui/document/pdf/PdfSelectActivity.kt
+24
-0
DocumentPresenter.kt
...m/base/pdfviewerscannerwhite/ui/main/DocumentPresenter.kt
+12
-0
ToolFragment.kt
...va/com/base/pdfviewerscannerwhite/ui/main/ToolFragment.kt
+6
-0
SplashActivity.kt
...om/base/pdfviewerscannerwhite/ui/splash/SplashActivity.kt
+1
-0
DialogView.kt
...java/com/base/pdfviewerscannerwhite/ui/view/DialogView.kt
+1
-0
activity_pdf_select.xml
app/src/main/res/layout/activity_pdf_select.xml
+6
-0
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/bean/DocumentBean.kt
View file @
6d575f28
...
@@ -8,9 +8,9 @@ data class DocumentBean(
...
@@ -8,9 +8,9 @@ data class DocumentBean(
val
type
:
String
=
""
,
val
type
:
String
=
""
,
var
isBookmarked
:
Boolean
=
false
var
isBookmarked
:
Boolean
=
false
)
{
)
{
var
uiType
:
Int
=
0
//0首页模式 1合并选择模式 2拆分模式
var
uiType
:
Int
=
0
//0首页模式 1合并选择模式 2拆分模式
3解锁加锁模式
var
isSelect
:
Boolean
=
false
var
isSelect
:
Boolean
=
false
var
state
:
Int
=
0
//0正常状态 1 锁定
var
state
:
Int
=
-
1
//0正常状态 1 锁定
companion
object
{
companion
object
{
const
val
TYPE_PDF
=
"type_pdf"
const
val
TYPE_PDF
=
"type_pdf"
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/adapter/DocumentAdapter.kt
View file @
6d575f28
...
@@ -49,7 +49,16 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
...
@@ -49,7 +49,16 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
if
(
item
==
null
)
return
if
(
item
==
null
)
return
val
binding
=
ItemDocumentBinding
.
bind
(
holder
.
itemView
)
val
binding
=
ItemDocumentBinding
.
bind
(
holder
.
itemView
)
if
(
item
.
type
==
TYPE_PDF
)
{
if
(
item
.
type
==
TYPE_PDF
)
{
checkPwd
(
item
,
binding
.
iv
)
if
(
item
.
state
==
-
1
)
{
checkPwd
(
item
,
binding
.
iv
)
}
else
{
var
res
=
R
.
mipmap
.
h_pdfiocn
when
(
item
.
state
)
{
0
->
res
=
R
.
mipmap
.
h_pdfiocn
1
->
res
=
R
.
mipmap
.
suoding
}
binding
.
iv
.
setImageResource
(
res
)
}
}
}
val
file
=
File
(
item
.
path
)
val
file
=
File
(
item
.
path
)
...
@@ -99,6 +108,11 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
...
@@ -99,6 +108,11 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
}
}
3
->
{
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
}
}
}
binding
.
root
.
setOnClickListener
{
binding
.
root
.
setOnClickListener
{
...
@@ -119,7 +133,6 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
...
@@ -119,7 +133,6 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
iv
.
setImageResource
(
res
)
iv
.
setImageResource
(
res
)
}
}
}
}
}
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
DocumentViewHolder
{
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
DocumentViewHolder
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfSelectActivity.kt
View file @
6d575f28
...
@@ -3,10 +3,12 @@ package com.base.pdfviewerscannerwhite.ui.document.pdf
...
@@ -3,10 +3,12 @@ package com.base.pdfviewerscannerwhite.ui.document.pdf
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.content.Intent
import
android.view.View
import
android.view.View
import
androidx.activity.addCallback
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.lifecycleScope
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_LOCK_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_LOCK_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_MERGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_MERGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_SPLIT_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_SPLIT_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_UNLOCK_PDF
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.bean.DocumentBean
import
com.base.pdfviewerscannerwhite.databinding.ActivityPdfSelectBinding
import
com.base.pdfviewerscannerwhite.databinding.ActivityPdfSelectBinding
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
...
@@ -46,12 +48,25 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
...
@@ -46,12 +48,25 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
binding
.
tvSelectTip
.
text
=
"Select a project"
binding
.
tvSelectTip
.
text
=
"Select a project"
documentPresenter
.
initUnLoadData
()
documentPresenter
.
initUnLoadData
()
}
}
DO_UNLOCK_PDF
->
{
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvSelectTip
.
text
=
"Select a project"
documentPresenter
.
initLoadData
()
}
}
}
}
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
finishToMain
()
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
tvBtnNext
.
setOnClickListener
{
binding
.
tvBtnNext
.
setOnClickListener
{
val
selectList
=
adapter
.
items
.
filter
{
it
.
isSelect
}
val
selectList
=
adapter
.
items
.
filter
{
it
.
isSelect
}
...
@@ -78,6 +93,11 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
...
@@ -78,6 +93,11 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
adapter
.
remove
(
it
)
adapter
.
remove
(
it
)
})
})
}
}
if
(
doWhat
==
DO_UNLOCK_PDF
)
{
showPdfPwdDialog
(
it
,
null
,
false
,
encryptionAction
=
{
adapter
.
remove
(
it
)
})
}
}
}
adapter
.
selectAction
=
{
adapter
.
selectAction
=
{
if
(
it
==
0
)
{
if
(
it
==
0
)
{
...
@@ -93,12 +113,16 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
...
@@ -93,12 +113,16 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView
}
}
override
fun
refreshDocumentRv
(
documentList
:
List
<
DocumentBean
>,
isRefresh
:
Boolean
)
{
override
fun
refreshDocumentRv
(
documentList
:
List
<
DocumentBean
>,
isRefresh
:
Boolean
)
{
binding
.
progressBar
.
visibility
=
View
.
GONE
if
(
doWhat
==
DO_MERGE_PDF
)
{
if
(
doWhat
==
DO_MERGE_PDF
)
{
documentList
.
map
{
it
.
uiType
=
1
}
documentList
.
map
{
it
.
uiType
=
1
}
}
}
if
(
doWhat
==
DO_SPLIT_PDF
)
{
if
(
doWhat
==
DO_SPLIT_PDF
)
{
documentList
.
map
{
it
.
uiType
=
2
}
documentList
.
map
{
it
.
uiType
=
2
}
}
}
if
(
doWhat
==
DO_LOCK_PDF
||
doWhat
==
DO_UNLOCK_PDF
)
{
documentList
.
map
{
it
.
uiType
=
3
}
}
adapter
.
submitList
(
documentList
)
adapter
.
submitList
(
documentList
)
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/DocumentPresenter.kt
View file @
6d575f28
...
@@ -52,6 +52,18 @@ class DocumentPresenter(
...
@@ -52,6 +52,18 @@ class DocumentPresenter(
}
}
}
}
fun
initLoadData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
documentList
=
getDocumentBeanList
()
documentList
.
forEach
{
it
.
state
=
PdfBoxUtils
.
checkPdfEncryption
(
it
.
path
)
}
val
list
=
documentList
.
filter
{
it
.
state
==
1
}
launch
(
Dispatchers
.
Main
)
{
documentView
.
refreshDocumentRv
(
list
,
true
)
}
}
fun
saveBookmarkChange
(
addRemove
:
Boolean
,
path
:
String
)
{
fun
saveBookmarkChange
(
addRemove
:
Boolean
,
path
:
String
)
{
if
(
addRemove
)
{
if
(
addRemove
)
{
SpStringUtils
.
addSpString
(
SpStringUtils
.
BOOKMARK_KEY
,
path
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
BOOKMARK_KEY
,
path
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/ToolFragment.kt
View file @
6d575f28
...
@@ -4,6 +4,7 @@ import android.content.Intent
...
@@ -4,6 +4,7 @@ import android.content.Intent
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_LOCK_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_LOCK_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_MERGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_MERGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_SPLIT_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_SPLIT_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.DO_UNLOCK_PDF
import
com.base.pdfviewerscannerwhite.databinding.FragmentToolBinding
import
com.base.pdfviewerscannerwhite.databinding.FragmentToolBinding
import
com.base.pdfviewerscannerwhite.helper.BaseFragment
import
com.base.pdfviewerscannerwhite.helper.BaseFragment
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfSelectActivity
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfSelectActivity
...
@@ -35,6 +36,11 @@ class ToolFragment : BaseFragment<FragmentToolBinding>() {
...
@@ -35,6 +36,11 @@ class ToolFragment : BaseFragment<FragmentToolBinding>() {
putExtra
(
"doWhat"
,
DO_LOCK_PDF
)
putExtra
(
"doWhat"
,
DO_LOCK_PDF
)
})
})
}
}
binding
.
llUnlock
.
setOnClickListener
{
startActivity
(
Intent
(
requireContext
(),
PdfSelectActivity
::
class
.
java
).
apply
{
putExtra
(
"doWhat"
,
DO_UNLOCK_PDF
)
})
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfviewerscannerwhite/ui/splash/SplashActivity.kt
View file @
6d575f28
...
@@ -113,6 +113,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
...
@@ -113,6 +113,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
binding
.
progressBar
.
progress
=
100
binding
.
progressBar
.
progress
=
100
binding
.
root
.
postDelayed
({
binding
.
root
.
postDelayed
({
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
))
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
))
finish
()
},
200
)
},
200
)
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/view/DialogView.kt
View file @
6d575f28
...
@@ -249,6 +249,7 @@ object DialogView {
...
@@ -249,6 +249,7 @@ object DialogView {
if
(
item
.
state
==
1
)
{
if
(
item
.
state
==
1
)
{
PdfBoxUtils
.
clearPassword
(
item
.
path
,
pwd
)
PdfBoxUtils
.
clearPassword
(
item
.
path
,
pwd
)
toast
(
"clear Encryption"
)
toast
(
"clear Encryption"
)
encryptionAction
?.
invoke
()
}
}
}
else
{
}
else
{
val
result
=
PdfBoxUtils
.
checkPwd
(
item
.
path
,
pwd
)
val
result
=
PdfBoxUtils
.
checkPwd
(
item
.
path
,
pwd
)
...
...
app/src/main/res/layout/activity_pdf_select.xml
View file @
6d575f28
...
@@ -63,6 +63,12 @@
...
@@ -63,6 +63,12 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem=
"@layout/item_document"
/>
tools:listitem=
"@layout/item_document"
/>
<ProgressBar
android:id=
"@+id/progressBar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
</FrameLayout>
</FrameLayout>
<TextView
<TextView
...
...
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