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
b820a700
Commit
b820a700
authored
Sep 30, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
e1d9ed3b
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
23 deletions
+48
-23
DocumentBean.kt
.../java/com/base/pdfviewerscannerwhite/bean/DocumentBean.kt
+1
-0
ExcelActivity.kt
.../pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
+1
-1
PdfActivity.kt
...base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
+0
-1
PptActivity.kt
...base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
+0
-2
WordActivity.kt
...se/pdfviewerscannerwhite/ui/document/word/WordActivity.kt
+1
-1
DocumentPageFragment.kt
...ase/pdfviewerscannerwhite/ui/main/DocumentPageFragment.kt
+10
-9
MainPresenter.kt
...a/com/base/pdfviewerscannerwhite/ui/main/MainPresenter.kt
+22
-6
SpStringUtils.kt
...ava/com/base/pdfviewerscannerwhite/utils/SpStringUtils.kt
+1
-3
activity_set.xml
app/src/main/res/layout/activity_set.xml
+11
-0
fragment_tool.xml
app/src/main/res/layout/fragment_tool.xml
+1
-0
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/bean/DocumentBean.kt
View file @
b820a700
...
@@ -12,6 +12,7 @@ data class DocumentBean(
...
@@ -12,6 +12,7 @@ data class DocumentBean(
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
=
""
var
lastViewTime
:
Long
=
0
companion
object
{
companion
object
{
const
val
TYPE_PDF
=
"type_pdf"
const
val
TYPE_PDF
=
"type_pdf"
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/excel/ExcelActivity.kt
View file @
b820a700
...
@@ -267,7 +267,7 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
...
@@ -267,7 +267,7 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
pathOrUri
?:
""
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
pathOrUri
?:
""
+
System
.
currentTimeMillis
()
)
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
View file @
b820a700
...
@@ -69,7 +69,6 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
...
@@ -69,7 +69,6 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
assets
=
intent
.
extras
?.
getString
(
"assets"
)
?:
""
assets
=
intent
.
extras
?.
getString
(
"assets"
)
?:
""
LogEx
.
logDebug
(
TAG
,
"path=$path"
)
LogEx
.
logDebug
(
TAG
,
"path=$path"
)
LogEx
.
logDebug
(
TAG
,
"uri=$uri"
)
LogEx
.
logDebug
(
TAG
,
"uri=$uri"
)
SpStringUtils
.
addSpString
(
LAST_VIEW_KEY
,
path
)
val
file
=
File
(
path
)
val
file
=
File
(
path
)
binding
.
tvPdfName
.
text
=
file
.
name
binding
.
tvPdfName
.
text
=
file
.
name
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/ppt/PptActivity.kt
View file @
b820a700
...
@@ -112,8 +112,6 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
...
@@ -112,8 +112,6 @@ class PptActivity : BaseActivity<ActivityPptBinding>() {
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
pathOrUri
?:
""
)
}
}
private
fun
showTopLayout
()
{
private
fun
showTopLayout
()
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/word/WordActivity.kt
View file @
b820a700
...
@@ -296,7 +296,7 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
...
@@ -296,7 +296,7 @@ class WordActivity : BaseActivity<ActivityWordBinding>() {
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
pathOrUri
?:
""
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
pathOrUri
?:
""
+
System
.
currentTimeMillis
()
)
}
}
companion
object
{
companion
object
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/DocumentPageFragment.kt
View file @
b820a700
...
@@ -23,7 +23,6 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.SortMode
...
@@ -23,7 +23,6 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.SortMode
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDialog
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDialog
import
com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog
import
com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog
import
com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import
com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import
com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime4
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
java.io.File
import
java.io.File
import
java.util.Locale
import
java.util.Locale
...
@@ -51,7 +50,7 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
...
@@ -51,7 +50,7 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
initAdapter
()
initAdapter
()
isInitialized
=
true
isInitialized
=
true
Log
.
d
(
"glc"
,
"我被调用了setView"
)
Log
.
d
(
"glc"
,
"我被调用了setView"
)
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
...
@@ -63,15 +62,17 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
...
@@ -63,15 +62,17 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
if
(
isInitialized
&&
!
isHidden
)
{
if
(
isInitialized
&&
!
isHidden
)
{
val
list
=
val
list
=
(
requireActivity
()
as
MainActivity
).
mainPresenter
.
getDataByType
(
type
,
dataType
)
(
requireActivity
()
as
MainActivity
).
mainPresenter
.
getDataByType
(
type
,
dataType
)
val
dataType
=
(
parentFragment
as
DocumentFragment
).
dataType
if
(
dataType
==
ConstObject
.
RECENT_DATA_TYPE
)
{
adapter
.
submitList
(
list
)
}
else
{
val
sortList
=
sortByMode
(
list
)
val
sortList
=
sortByMode
(
list
)
sortList
.
forEach
{
LogEx
.
logDebug
(
TAG
,
"sortByMode ${File(it.path).lastModified().toFormatTime3()}"
)
}
adapter
.
submitList
(
sortList
)
adapter
.
submitList
(
sortList
)
}
binding
.
llEmpty
.
isVisible
=
list
.
isEmpty
()
binding
.
llEmpty
.
isVisible
=
list
.
isEmpty
()
Log
.
d
(
"glc"
,
"加载数据成功:"
+
type
+
" list:"
+
list
.
size
)
Log
.
d
(
"glc"
,
"加载数据成功:"
+
type
+
" list:"
+
list
.
size
)
}
else
{
}
else
{
Log
.
d
(
"glc"
,
"加载数据失败:"
+
type
)
Log
.
d
(
"glc"
,
"加载数据失败:"
+
type
)
}
}
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainPresenter.kt
View file @
b820a700
...
@@ -22,6 +22,8 @@ import com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_PPT
...
@@ -22,6 +22,8 @@ import com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_PPT
import
com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_WORD
import
com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_WORD
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfBoxUtils
import
com.base.pdfviewerscannerwhite.ui.document.pdf.PdfBoxUtils
import
com.base.pdfviewerscannerwhite.utils.AssetUtils.saveAssetsFile
import
com.base.pdfviewerscannerwhite.utils.AssetUtils.saveAssetsFile
import
com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils.BOOKMARK_KEY
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils.BOOKMARK_KEY
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils.LAST_VIEW_KEY
import
com.base.pdfviewerscannerwhite.utils.SpStringUtils.LAST_VIEW_KEY
...
@@ -43,6 +45,7 @@ class MainPresenter(
...
@@ -43,6 +45,7 @@ class MainPresenter(
val
lifecycleScope
:
LifecycleCoroutineScope
val
lifecycleScope
:
LifecycleCoroutineScope
)
{
)
{
private
val
TAG
=
"MainPresenter"
fun
getDocumentAppDir
():
File
{
fun
getDocumentAppDir
():
File
{
val
appDir
=
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
),
context
.
packageName
)
val
appDir
=
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
),
context
.
packageName
)
if
(!
appDir
.
exists
())
if
(!
appDir
.
exists
())
...
@@ -86,6 +89,7 @@ class MainPresenter(
...
@@ -86,6 +89,7 @@ class MainPresenter(
fun
getDataByType
(
documentType
:
String
,
dataType
:
String
):
List
<
DocumentBean
>
{
fun
getDataByType
(
documentType
:
String
,
dataType
:
String
):
List
<
DocumentBean
>
{
val
bookmarkList
=
SpStringUtils
.
getSpStringList
(
SpStringUtils
.
BOOKMARK_KEY
)
val
bookmarkList
=
SpStringUtils
.
getSpStringList
(
SpStringUtils
.
BOOKMARK_KEY
)
Log
.
d
(
"glc"
,
"pdfDocuments:"
+
pdfDocuments
.
size
)
Log
.
d
(
"glc"
,
"pdfDocuments:"
+
pdfDocuments
.
size
)
val
recentList
=
SpStringUtils
.
getSpStringList
(
LAST_VIEW_KEY
)
val
recentList
=
SpStringUtils
.
getSpStringList
(
LAST_VIEW_KEY
)
...
@@ -100,7 +104,8 @@ class MainPresenter(
...
@@ -100,7 +104,8 @@ class MainPresenter(
}
}
RECENT_DATA_TYPE
->
{
RECENT_DATA_TYPE
->
{
return
pdfDocuments
.
filter
{
recentFilter
(
recentList
,
it
)
}
pdfDocuments
.
forEach
{
recentFilter
(
recentList
,
it
)
}
return
pdfDocuments
.
filter
{
it
.
lastViewTime
!=
0L
}.
sortedByDescending
{
it
.
lastViewTime
}
}
}
BOOKMARK_DATA_TYPE
->
{
BOOKMARK_DATA_TYPE
->
{
...
@@ -121,7 +126,8 @@ class MainPresenter(
...
@@ -121,7 +126,8 @@ class MainPresenter(
}
}
RECENT_DATA_TYPE
->
{
RECENT_DATA_TYPE
->
{
return
wordDocuments
.
filter
{
recentFilter
(
recentList
,
it
)
}
wordDocuments
.
forEach
{
recentFilter
(
recentList
,
it
)
}
return
wordDocuments
.
sortedByDescending
{
it
.
lastViewTime
}
}
}
BOOKMARK_DATA_TYPE
->
{
BOOKMARK_DATA_TYPE
->
{
...
@@ -142,7 +148,8 @@ class MainPresenter(
...
@@ -142,7 +148,8 @@ class MainPresenter(
}
}
RECENT_DATA_TYPE
->
{
RECENT_DATA_TYPE
->
{
return
excelDocuments
.
filter
{
recentFilter
(
recentList
,
it
)
}
excelDocuments
.
forEach
{
recentFilter
(
recentList
,
it
)
}
return
excelDocuments
.
sortedByDescending
{
it
.
lastViewTime
}
}
}
BOOKMARK_DATA_TYPE
->
{
BOOKMARK_DATA_TYPE
->
{
...
@@ -162,7 +169,8 @@ class MainPresenter(
...
@@ -162,7 +169,8 @@ class MainPresenter(
}
}
RECENT_DATA_TYPE
->
{
RECENT_DATA_TYPE
->
{
return
pptDocuments
.
filter
{
recentFilter
(
recentList
,
it
)
}
pptDocuments
.
forEach
{
recentFilter
(
recentList
,
it
)
}
return
pptDocuments
.
sortedByDescending
{
it
.
lastViewTime
}
}
}
BOOKMARK_DATA_TYPE
->
{
BOOKMARK_DATA_TYPE
->
{
...
@@ -175,8 +183,16 @@ class MainPresenter(
...
@@ -175,8 +183,16 @@ class MainPresenter(
return
listOf
()
return
listOf
()
}
}
private
fun
recentFilter
(
recentList
:
List
<
String
>,
documentBean
:
DocumentBean
):
Boolean
{
private
fun
recentFilter
(
recentList
:
List
<
String
>,
documentBean
:
DocumentBean
)
{
return
recentList
.
contains
(
documentBean
.
path
)
val
findLastTime
=
recentList
.
filter
{
it
.
contains
(
documentBean
.
path
)
}.
map
{
it
.
split
(
"_"
)[
1
].
toLong
()
}
if
(
findLastTime
.
isNotEmpty
())
{
val
max
=
findLastTime
.
max
()
LogEx
.
logDebug
(
TAG
,
"recentFilter ${documentBean.path} ${max.toFormatTime3()}"
)
documentBean
.
lastViewTime
=
max
}
}
}
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/utils/SpStringUtils.kt
View file @
b820a700
...
@@ -15,9 +15,7 @@ object SpStringUtils {
...
@@ -15,9 +15,7 @@ object SpStringUtils {
fun
addSpString
(
key
:
String
,
value
:
String
)
{
fun
addSpString
(
key
:
String
,
value
:
String
)
{
val
list
=
getSpStringList
(
key
).
toMutableList
()
val
list
=
getSpStringList
(
key
).
toMutableList
()
if
(!
list
.
contains
(
value
))
{
list
.
add
(
value
)
list
.
add
(
value
)
}
val
string
=
list
.
joinToString
(
separator
=
"|||"
)
val
string
=
list
.
joinToString
(
separator
=
"|||"
)
AppPreferences
.
getInstance
().
put
(
key
,
string
)
AppPreferences
.
getInstance
().
put
(
key
,
string
)
}
}
...
...
app/src/main/res/layout/activity_set.xml
View file @
b820a700
...
@@ -26,6 +26,17 @@
...
@@ -26,6 +26,17 @@
</FrameLayout>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Set"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"@id/fl_fanhui"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"@id/fl_fanhui"
/>
<LinearLayout
<LinearLayout
android:id=
"@+id/ll_rate"
android:id=
"@+id/ll_rate"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/fragment_tool.xml
View file @
b820a700
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:orientation=
"vertical"
android:orientation=
"vertical"
tools:context=
".ui.main.ToolFragment"
>
tools:context=
".ui.main.ToolFragment"
>
...
...
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