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
6b41d825
Commit
6b41d825
authored
Jan 06, 2025
by
周文华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修复】1.修复空文件路径导致的崩溃。2.修复0不能作为除数的错误。3.修复没有权限导致的查询问题。
parent
ef3aea2e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
4 deletions
+18
-4
NotificationUiUtil.kt
.../com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
+1
-1
PdfActivity.kt
...base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
+4
-1
PdfPagerAdapter.kt
.../pdfviewerscannerwhite/ui/document/pdf/PdfPagerAdapter.kt
+2
-1
PdfSplitActivity.kt
...pdfviewerscannerwhite/ui/document/pdf/PdfSplitActivity.kt
+6
-0
MediaStoreUtils.kt
...a/com/base/pdfviewerscannerwhite/utils/MediaStoreUtils.kt
+5
-1
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
View file @
6b41d825
...
...
@@ -213,7 +213,7 @@ object NotificationUiUtil {
NOTIFICATION_ACTION_APP_PROCESS
->
{
val
pair
=
MyApplication
.
context
.
ramPair
()
val
percent
=
(
pair
.
first
*
100
/
pair
.
second
).
toInt
()
val
percent
=
if
(
pair
.
second
>
0
)
(
pair
.
first
*
100
/
pair
.
second
).
toInt
()
else
0
val
desc
=
"Memory is $percent% used"
val
smallRemoteViewsVar
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_memory_small_1
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfActivity.kt
View file @
6b41d825
...
...
@@ -109,7 +109,10 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
binding
.
tvPdfName
.
text
=
file
.
name
pdfPresenter
=
PdfPresenter
(
this
)
if
(!
file
.
exists
()
&&
uri
==
null
)
{
finish
()
return
}
initAdapter
()
changeNormalUI
()
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfPagerAdapter.kt
View file @
6b41d825
...
...
@@ -13,6 +13,7 @@ import com.base.pdfviewerscannerwhite.utils.XmlEx.inflate
import
com.chad.library.adapter4.BaseQuickAdapter
import
com.tom_roush.pdfbox.pdmodel.PDDocument
import
com.tom_roush.pdfbox.rendering.PDFRenderer
import
kotlinx.coroutines.CoroutineExceptionHandler
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.SupervisorJob
...
...
@@ -55,7 +56,7 @@ class PdfPagerAdapter(
private
val
refreshPayLoad
=
1
init
{
scope
.
launch
(
SupervisorJob
()
+
Dispatchers
.
IO
)
{
scope
.
launch
(
CoroutineExceptionHandler
{
_
,
_
->
}
+
Dispatchers
.
IO
)
{
pdfDocument
=
PdfBoxUtils
.
getPdfDocument
(
pdfPath
,
mPassword
,
uri
)
pdfRender
=
PDFRenderer
(
pdfDocument
)
val
dataList
=
mutableListOf
<
PdfPageBean
>()
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/document/pdf/PdfSplitActivity.kt
View file @
6b41d825
...
...
@@ -8,6 +8,7 @@ import com.base.pdfviewerscannerwhite.databinding.ActivityPdfSplitBinding
import
com.base.pdfviewerscannerwhite.helper.BaseActivity
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentRenameDialog
import
java.io.File
class
PdfSplitActivity
:
BaseActivity
<
ActivityPdfSplitBinding
>(),
PdfView
{
...
...
@@ -70,6 +71,11 @@ class PdfSplitActivity : BaseActivity<ActivityPdfSplitBinding>(), PdfView {
}
private
fun
initAdapter
()
{
val
file
=
File
(
path
)
if
(!
file
.
exists
())
{
finish
()
return
}
pdfPagerAdapter
=
PdfPagerAdapter
(
path
,
null
,
R
.
layout
.
item_pdf_pager_split
,
1.5f
,
mPassword
=
pwd
)
pdfPagerAdapter
.
selectAction
=
{
enable
,
allSelect
->
binding
.
tvBtnSplit
.
isEnabled
=
enable
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/utils/MediaStoreUtils.kt
View file @
6b41d825
...
...
@@ -415,7 +415,11 @@ fun CoroutineScope.queryFiles(context: Context, fileSuffix: String, flow: Mutabl
}
else
{
MediaStore
.
Files
.
getContentUri
(
"external"
)
}
val
cursor
=
context
.
contentResolver
.
query
(
queryUri
,
projection
,
selection
,
null
,
sortOrder
)
val
cursor
=
try
{
context
.
contentResolver
.
query
(
queryUri
,
projection
,
selection
,
null
,
sortOrder
)
}
catch
(
e
:
SecurityException
){
null
}
if
(
cursor
!=
null
)
{
while
(
cursor
.
moveToNext
())
{
delay
(
150
)
...
...
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