Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
Pdf one Reader
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 one Reader
Commits
e41ed9e8
Commit
e41ed9e8
authored
Nov 15, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
c5ed0484
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
18 deletions
+47
-18
DocumentBean.kt
app/src/main/java/com/base/pdfoneread/bean/DocumentBean.kt
+1
-1
DocumentAdapter.kt
...n/java/com/base/pdfoneread/ui/document/DocumentAdapter.kt
+24
-5
HomeFragment.kt
...src/main/java/com/base/pdfoneread/ui/main/HomeFragment.kt
+3
-3
PdfSelectActivity.kt
...main/java/com/base/pdfoneread/ui/pdf/PdfSelectActivity.kt
+19
-9
No files found.
app/src/main/java/com/base/pdfoneread/bean/DocumentBean.kt
View file @
e41ed9e8
...
@@ -8,7 +8,7 @@ data class DocumentBean(
...
@@ -8,7 +8,7 @@ data class DocumentBean(
var
type
:
String
=
""
,
var
type
:
String
=
""
,
var
isBookmarked
:
Boolean
=
false
,
var
isBookmarked
:
Boolean
=
false
,
)
{
)
{
var
uiType
:
Int
=
0
//0
浏览模式 1合并选择模式 2拆分模式 3解锁加锁模式 4搜索
模式
var
uiType
:
Int
=
0
//0
主页浏览模式 1合并选择模式 2拆分模式 3搜索模式 4加锁模式 5解锁
模式
var
isSelect
:
Boolean
=
false
var
isSelect
:
Boolean
=
false
var
state
:
Int
=
-
1
//0正常状态 1 锁定
var
state
:
Int
=
-
1
//0正常状态 1 锁定
var
password
:
String
=
""
var
password
:
String
=
""
...
...
app/src/main/java/com/base/pdfoneread/ui/document/DocumentAdapter.kt
View file @
e41ed9e8
...
@@ -70,7 +70,7 @@ class DocumentAdapter(
...
@@ -70,7 +70,7 @@ class DocumentAdapter(
binding
.
tvInfo
.
text
=
file
.
lastModified
().
toFormatTime5
()
+
" "
+
file
.
length
().
toFormatSize
()
binding
.
tvInfo
.
text
=
file
.
lastModified
().
toFormatTime5
()
+
" "
+
file
.
length
().
toFormatSize
()
//DocumentPdfAdapter
//DocumentPdfAdapter
when
(
item
.
uiType
)
{
when
(
item
.
uiType
)
{
0
->
{
DOCUMENT_UI_HOME
->
{
binding
.
flSelect
.
visibility
=
View
.
GONE
binding
.
flSelect
.
visibility
=
View
.
GONE
binding
.
flBookmark
.
visibility
=
View
.
VISIBLE
binding
.
flBookmark
.
visibility
=
View
.
VISIBLE
binding
.
flMore
.
visibility
=
View
.
VISIBLE
binding
.
flMore
.
visibility
=
View
.
VISIBLE
...
@@ -93,7 +93,7 @@ class DocumentAdapter(
...
@@ -93,7 +93,7 @@ class DocumentAdapter(
}
}
}
}
1
->
{
DOCUMENT_UI_MERGE_SELECT
->
{
binding
.
flSelect
.
visibility
=
View
.
VISIBLE
binding
.
flSelect
.
visibility
=
View
.
VISIBLE
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
GONE
...
@@ -106,7 +106,7 @@ class DocumentAdapter(
...
@@ -106,7 +106,7 @@ class DocumentAdapter(
}
}
2
->
{
//拆分选择
DOCUMENT_UI_SPLIT_SELECT
->
{
//拆分选择
binding
.
flBookmark
.
visibility
=
View
.
INVISIBLE
binding
.
flBookmark
.
visibility
=
View
.
INVISIBLE
binding
.
flSelect
.
visibility
=
View
.
INVISIBLE
binding
.
flSelect
.
visibility
=
View
.
INVISIBLE
binding
.
flMore
.
visibility
=
View
.
VISIBLE
binding
.
flMore
.
visibility
=
View
.
VISIBLE
...
@@ -118,15 +118,25 @@ class DocumentAdapter(
...
@@ -118,15 +118,25 @@ class DocumentAdapter(
}
}
}
}
3
->
{
//解锁模式选择
DOCUMENT_UI_LOCK
->
{
//加解模式
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
binding
.
flSelect
.
visibility
=
View
.
INVISIBLE
binding
.
root
.
setOnClickListener
{
binding
.
root
.
setOnClickListener
{
itemClick
?.
invoke
(
item
)
itemClick
?.
invoke
(
item
)
}
}
}
}
4
->
{
//搜索选择
DOCUMENT_UI_UNLOCK
->
{
//解锁模式
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
visibility
=
View
.
INVISIBLE
binding
.
flSelect
.
visibility
=
View
.
INVISIBLE
binding
.
root
.
setOnClickListener
{
itemClick
?.
invoke
(
item
)
}
}
DOCUMENT_UI_SEARCH
->
{
//搜索选择
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flBookmark
.
visibility
=
View
.
GONE
binding
.
flMore
.
setOnClickListener
{
binding
.
flMore
.
setOnClickListener
{
moreAction
?.
invoke
(
item
)
moreAction
?.
invoke
(
item
)
...
@@ -156,4 +166,13 @@ class DocumentAdapter(
...
@@ -156,4 +166,13 @@ class DocumentAdapter(
DocumentViewHolder
(
R
.
layout
.
item_ad
.
inflate
(
parent
))
DocumentViewHolder
(
R
.
layout
.
item_ad
.
inflate
(
parent
))
}
}
}
}
companion
object
{
const
val
DOCUMENT_UI_HOME
=
0
const
val
DOCUMENT_UI_MERGE_SELECT
=
1
const
val
DOCUMENT_UI_SPLIT_SELECT
=
2
const
val
DOCUMENT_UI_SEARCH
=
3
const
val
DOCUMENT_UI_LOCK
=
4
const
val
DOCUMENT_UI_UNLOCK
=
5
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfoneread/ui/main/HomeFragment.kt
View file @
e41ed9e8
...
@@ -283,13 +283,13 @@ class HomeFragment() : Fragment() {
...
@@ -283,13 +283,13 @@ class HomeFragment() : Fragment() {
tittle
=
"Tools"
tittle
=
"Tools"
},
},
HomeUIBean
(
KEY_IMAGE_TO_PDF
,
R
.
mipmap
.
h_pdf_edit
,
"Image to PDF"
),
//
HomeUIBean(KEY_IMAGE_TO_PDF, R.mipmap.h_pdf_edit, "Image to PDF"),
HomeUIBean
(
KEY_MERGE_PDF
,
R
.
mipmap
.
h_pdf_merge
,
"Merge PDF"
),
HomeUIBean
(
KEY_MERGE_PDF
,
R
.
mipmap
.
h_pdf_merge
,
"Merge PDF"
),
HomeUIBean
(
KEY_SPLIT_PDF
,
R
.
mipmap
.
h_pdf_split
,
"Split PDF"
),
HomeUIBean
(
KEY_SPLIT_PDF
,
R
.
mipmap
.
h_pdf_split
,
"Split PDF"
),
HomeUIBean
(
KEY_LOCK_PDF
,
R
.
mipmap
.
h_pdf_lock
,
"Lock PDF"
),
HomeUIBean
(
KEY_LOCK_PDF
,
R
.
mipmap
.
h_pdf_lock
,
"Lock PDF"
),
HomeUIBean
(
KEY_UNLOCK_PDF
,
R
.
mipmap
.
h_pdf_unlock
,
"UnLock PDF"
),
HomeUIBean
(
KEY_UNLOCK_PDF
,
R
.
mipmap
.
h_pdf_unlock
,
"UnLock PDF"
),
HomeUIBean
(
KEY_SCAN_PDF
,
R
.
mipmap
.
h_pdf_scan
,
"Scan PDF"
),
//
HomeUIBean(KEY_SCAN_PDF, R.mipmap.h_pdf_scan, "Scan PDF"),
HomeUIBean
(
KEY_IMAGE_PDF
,
R
.
mipmap
.
h_pdf_image
,
"Image PDF"
),
//
HomeUIBean(KEY_IMAGE_PDF, R.mipmap.h_pdf_image, "Image PDF"),
)
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfoneread/ui/pdf/PdfSelectActivity.kt
View file @
e41ed9e8
...
@@ -21,6 +21,10 @@ import com.base.pdfoneread.bean.DocumentBean
...
@@ -21,6 +21,10 @@ import com.base.pdfoneread.bean.DocumentBean
import
com.base.pdfoneread.databinding.ActivityPdfSelectBinding
import
com.base.pdfoneread.databinding.ActivityPdfSelectBinding
import
com.base.pdfoneread.ui.BaseActivity
import
com.base.pdfoneread.ui.BaseActivity
import
com.base.pdfoneread.ui.document.DocumentAdapter
import
com.base.pdfoneread.ui.document.DocumentAdapter
import
com.base.pdfoneread.ui.document.DocumentAdapter.Companion.DOCUMENT_UI_LOCK
import
com.base.pdfoneread.ui.document.DocumentAdapter.Companion.DOCUMENT_UI_MERGE_SELECT
import
com.base.pdfoneread.ui.document.DocumentAdapter.Companion.DOCUMENT_UI_SPLIT_SELECT
import
com.base.pdfoneread.ui.document.DocumentAdapter.Companion.DOCUMENT_UI_UNLOCK
import
com.base.pdfoneread.ui.document.getPdfDocument
import
com.base.pdfoneread.ui.document.getPdfDocument
import
com.base.pdfoneread.ui.views.PwdDialog.showPdfPwdDialog
import
com.base.pdfoneread.ui.views.PwdDialog.showPdfPwdDialog
import
com.base.pdfoneread.utils.BarUtils
import
com.base.pdfoneread.utils.BarUtils
...
@@ -66,28 +70,28 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
...
@@ -66,28 +70,28 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
initAdapter
()
initAdapter
()
when
(
doWhat
)
{
when
(
doWhat
)
{
DO_MERGE_PDF
->
{
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_merge
)
getPdfData
(
DOCUMENT_UI_MERGE_SELECT
)
}
DO_SPLIT_PDF
->
{
DO_SPLIT_PDF
->
{
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_split
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_split
)
getPdfData
(
2
)
getPdfData
(
DOCUMENT_UI_SPLIT_SELECT
)
}
DO_MERGE_PDF
->
{
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_merge
)
getPdfData
(
1
)
}
}
DO_LOCK_PDF
->
{
DO_LOCK_PDF
->
{
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_lock
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_lock
)
getPdfData
(
3
)
getPdfData
(
DOCUMENT_UI_LOCK
)
}
}
DO_UNLOCK_PDF
->
{
DO_UNLOCK_PDF
->
{
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvBtnNext
.
visibility
=
View
.
GONE
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_unlock
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project_unlock
)
getPdfData
(
3
)
getPdfData
(
DOCUMENT_UI_UNLOCK
)
}
}
}
}
...
@@ -97,7 +101,13 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
...
@@ -97,7 +101,13 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
private
fun
getPdfData
(
uiType
:
Int
)
{
private
fun
getPdfData
(
uiType
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"uiType=$uiType"
)
LogEx
.
logDebug
(
TAG
,
"uiType=$uiType"
)
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
list
=
getPdfDocument
(
this
@PdfSelectActivity
)
var
list
=
getPdfDocument
(
this
@PdfSelectActivity
)
if
(
uiType
==
DOCUMENT_UI_LOCK
)
{
list
=
list
.
filter
{
it
.
state
==
0
}.
toMutableList
()
}
if
(
uiType
==
DOCUMENT_UI_UNLOCK
)
{
list
=
list
.
filter
{
it
.
state
==
1
}.
toMutableList
()
}
list
.
forEach
{
it
.
uiType
=
uiType
}
list
.
forEach
{
it
.
uiType
=
uiType
}
launch
(
Dispatchers
.
Main
)
{
launch
(
Dispatchers
.
Main
)
{
refreshUI
(
list
)
refreshUI
(
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