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
c5ed0484
Commit
c5ed0484
authored
Nov 15, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
2fa2ebf2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
31 deletions
+42
-31
DocumentEx.kt
...c/main/java/com/base/pdfoneread/ui/document/DocumentEx.kt
+31
-23
SettingFragment.kt
.../main/java/com/base/pdfoneread/ui/main/SettingFragment.kt
+0
-1
PdfSelectActivity.kt
...main/java/com/base/pdfoneread/ui/pdf/PdfSelectActivity.kt
+4
-4
MediaStoreUtils.kt
...rc/main/java/com/base/pdfoneread/utils/MediaStoreUtils.kt
+3
-3
strings.xml
app/src/main/res/values/strings.xml
+4
-0
No files found.
app/src/main/java/com/base/pdfoneread/ui/document/DocumentEx.kt
View file @
c5ed0484
...
@@ -4,6 +4,7 @@ import android.content.Context
...
@@ -4,6 +4,7 @@ import android.content.Context
import
android.media.MediaScannerConnection
import
android.media.MediaScannerConnection
import
android.net.Uri
import
android.net.Uri
import
android.os.Environment
import
android.os.Environment
import
com.base.pdfoneread.R
import
com.base.pdfoneread.ads.AdmobHelper
import
com.base.pdfoneread.ads.AdmobHelper
import
com.base.pdfoneread.ui.MyApplication.Companion.appContext
import
com.base.pdfoneread.ui.MyApplication.Companion.appContext
import
com.base.pdfoneread.bean.ConstObject
import
com.base.pdfoneread.bean.ConstObject
...
@@ -27,10 +28,7 @@ import com.base.pdfoneread.utils.PdfBoxUtils.checkPdfEncryption
...
@@ -27,10 +28,7 @@ import com.base.pdfoneread.utils.PdfBoxUtils.checkPdfEncryption
import
com.base.pdfoneread.utils.SpStringUtils
import
com.base.pdfoneread.utils.SpStringUtils
import
com.base.pdfoneread.utils.SpStringUtils.BOOKMARK_KEY
import
com.base.pdfoneread.utils.SpStringUtils.BOOKMARK_KEY
import
com.base.pdfoneread.utils.getMediaFile
import
com.base.pdfoneread.utils.getMediaFile
import
kotlinx.coroutines.DelicateCoroutinesApi
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.flow.MutableSharedFlow
import
kotlinx.coroutines.flow.MutableSharedFlow
import
kotlinx.coroutines.flow.MutableStateFlow
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
java.io.File
import
java.io.File
import
java.io.FileOutputStream
import
java.io.FileOutputStream
...
@@ -68,7 +66,6 @@ fun cleanGlobalData() {
...
@@ -68,7 +66,6 @@ fun cleanGlobalData() {
GlobalPptList
.
clear
()
GlobalPptList
.
clear
()
}
}
fun
Context
.
upDateDemoStore
()
{
fun
Context
.
upDateDemoStore
()
{
val
demoFile
=
File
(
filesDir
,
"demo"
)
val
demoFile
=
File
(
filesDir
,
"demo"
)
MediaScannerConnection
.
scanFile
(
MediaScannerConnection
.
scanFile
(
...
@@ -77,15 +74,26 @@ fun Context.upDateDemoStore() {
...
@@ -77,15 +74,26 @@ fun Context.upDateDemoStore() {
}
}
fun
getDocumentAppDir
():
File
{
fun
getDocumentAppDir
():
File
{
val
appDir
=
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
),
appContext
.
packageName
)
val
appDir
=
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
),
appContext
.
resources
.
getString
(
R
.
string
.
app_name
)
)
if
(!
appDir
.
exists
())
if
(!
appDir
.
exists
())
appDir
.
exists
()
appDir
.
exists
()
return
appDir
return
appDir
}
}
fun
getDemoDir
():
File
{
val
demoFile
=
File
(
getDocumentAppDir
(),
"demo"
)
if
(!
demoFile
.
exists
())
{
demoFile
.
mkdirs
()
}
return
demoFile
}
fun
Context
.
saveAssetsFile
()
{
fun
Context
.
saveAssetsFile
()
{
val
demoFile
=
File
(
filesDir
,
"demo"
)
val
demoFile
=
getDemoDir
()
demoFile
.
mkdirs
()
arrayOf
(
arrayOf
(
"DEMO.pdf"
,
"DEMO.pdf"
,
"DEMO.docx"
,
"DEMO.docx"
,
...
@@ -111,32 +119,32 @@ fun Context.saveAssetsFile() {
...
@@ -111,32 +119,32 @@ fun Context.saveAssetsFile() {
fun
getPdfDemo
(
context
:
Context
):
DocumentBean
{
fun
getPdfDemo
(
context
:
Context
):
DocumentBean
{
val
demoDocumentBean
=
DocumentBean
()
val
demoDocumentBean
=
DocumentBean
()
demoDocumentBean
.
type
=
TYPE_PDF
demoDocumentBean
.
type
=
TYPE_PDF
val
demoFile
=
File
(
context
.
filesDir
,
"demo"
)
val
demoFile
=
getDemoDir
(
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pdf"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pdf"
)
}
?.
absolutePath
?:
""
context
.
pdfCheck
(
demoDocumentBean
)
context
.
pdfCheck
(
demoDocumentBean
)
return
demoDocumentBean
return
demoDocumentBean
}
}
fun
getWordDemo
(
context
:
Context
):
DocumentBean
{
fun
getWordDemo
():
DocumentBean
{
val
demoDocumentBean
=
DocumentBean
()
val
demoDocumentBean
=
DocumentBean
()
demoDocumentBean
.
type
=
TYPE_WORD
demoDocumentBean
.
type
=
TYPE_WORD
val
demoFile
=
File
(
context
.
filesDir
,
"demo"
)
val
demoFile
=
getDemoDir
(
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".docx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".docx"
)
}
?.
absolutePath
?:
""
return
demoDocumentBean
return
demoDocumentBean
}
}
fun
getExcelDemo
(
context
:
Context
):
DocumentBean
{
fun
getExcelDemo
():
DocumentBean
{
val
demoDocumentBean
=
DocumentBean
()
val
demoDocumentBean
=
DocumentBean
()
demoDocumentBean
.
type
=
TYPE_EXCEL
demoDocumentBean
.
type
=
TYPE_EXCEL
val
demoFile
=
File
(
context
.
filesDir
,
"demo"
)
val
demoFile
=
getDemoDir
(
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".xlsx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".xlsx"
)
}
?.
absolutePath
?:
""
return
demoDocumentBean
return
demoDocumentBean
}
}
fun
getPPtDemo
(
context
:
Context
):
DocumentBean
{
fun
getPPtDemo
():
DocumentBean
{
val
demoDocumentBean
=
DocumentBean
()
val
demoDocumentBean
=
DocumentBean
()
demoDocumentBean
.
type
=
TYPE_PPT
demoDocumentBean
.
type
=
TYPE_PPT
val
demoFile
=
File
(
context
.
filesDir
,
"demo"
)
val
demoFile
=
getDemoDir
(
)
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pptx"
)
}
?.
absolutePath
?:
""
demoDocumentBean
.
path
=
demoFile
.
listFiles
()
?.
find
{
it
.
name
.
contains
(
".pptx"
)
}
?.
absolutePath
?:
""
return
demoDocumentBean
return
demoDocumentBean
}
}
...
@@ -193,20 +201,20 @@ fun getAllDocument(context: Context): MutableList<DocumentBean> {
...
@@ -193,20 +201,20 @@ fun getAllDocument(context: Context): MutableList<DocumentBean> {
documentBean
documentBean
}
}
val
new
=
documentList
.
toMutableList
()
val
new
=
documentList
.
toMutableList
()
val
pptDemo
=
getPPtDemo
(
context
)
val
pptDemo
=
getPPtDemo
()
if
(
File
(
pptDemo
.
path
).
exists
())
{
if
(
File
(
pptDemo
.
path
).
exists
())
{
new
.
add
(
0
,
pptDemo
)
new
.
add
(
0
,
pptDemo
)
GlobalPptList
.
add
(
0
,
pptDemo
)
GlobalPptList
.
add
(
0
,
pptDemo
)
}
}
val
excelDemo
=
getExcelDemo
(
context
)
val
excelDemo
=
getExcelDemo
()
if
(
File
(
excelDemo
.
path
).
exists
())
{
if
(
File
(
excelDemo
.
path
).
exists
())
{
new
.
add
(
0
,
excelDemo
)
new
.
add
(
0
,
excelDemo
)
GlobalExcelList
.
add
(
0
,
excelDemo
)
GlobalExcelList
.
add
(
0
,
excelDemo
)
}
}
val
wordDem
p
=
getWordDemo
(
context
)
val
wordDem
o
=
getWordDemo
(
)
if
(
File
(
wordDem
p
.
path
).
exists
())
{
if
(
File
(
wordDem
o
.
path
).
exists
())
{
new
.
add
(
0
,
wordDem
p
)
new
.
add
(
0
,
wordDem
o
)
GlobalWordList
.
add
(
0
,
wordDem
p
)
GlobalWordList
.
add
(
0
,
wordDem
o
)
}
}
val
pdfDemo
=
getPdfDemo
(
context
)
val
pdfDemo
=
getPdfDemo
(
context
)
if
(
File
(
pdfDemo
.
path
).
exists
())
{
if
(
File
(
pdfDemo
.
path
).
exists
())
{
...
@@ -272,7 +280,7 @@ fun getWordDocument(context: Context): MutableList<DocumentBean> {
...
@@ -272,7 +280,7 @@ fun getWordDocument(context: Context): MutableList<DocumentBean> {
documentBean
documentBean
}
}
val
new
=
documentList
.
toMutableList
()
val
new
=
documentList
.
toMutableList
()
val
wordDemo
=
getWordDemo
(
context
)
val
wordDemo
=
getWordDemo
()
if
(
File
(
wordDemo
.
path
).
exists
())
{
if
(
File
(
wordDemo
.
path
).
exists
())
{
new
.
add
(
0
,
wordDemo
)
new
.
add
(
0
,
wordDemo
)
GlobalWordList
.
add
(
0
,
deepCopy
(
wordDemo
))
GlobalWordList
.
add
(
0
,
deepCopy
(
wordDemo
))
...
@@ -304,7 +312,7 @@ fun getExcelDocument(context: Context): MutableList<DocumentBean> {
...
@@ -304,7 +312,7 @@ fun getExcelDocument(context: Context): MutableList<DocumentBean> {
documentBean
documentBean
}
}
val
new
=
documentList
.
toMutableList
()
val
new
=
documentList
.
toMutableList
()
val
excelDemo
=
getExcelDemo
(
context
)
val
excelDemo
=
getExcelDemo
()
if
(
File
(
excelDemo
.
path
).
exists
())
{
if
(
File
(
excelDemo
.
path
).
exists
())
{
new
.
add
(
0
,
excelDemo
)
new
.
add
(
0
,
excelDemo
)
GlobalExcelList
.
add
(
0
,
deepCopy
(
excelDemo
))
GlobalExcelList
.
add
(
0
,
deepCopy
(
excelDemo
))
...
@@ -335,7 +343,7 @@ fun getPptDocument(context: Context): MutableList<DocumentBean> {
...
@@ -335,7 +343,7 @@ fun getPptDocument(context: Context): MutableList<DocumentBean> {
documentBean
documentBean
}
}
val
new
=
documentList
.
toMutableList
()
val
new
=
documentList
.
toMutableList
()
val
pptDemo
=
getPPtDemo
(
context
)
val
pptDemo
=
getPPtDemo
()
if
(
File
(
pptDemo
.
path
).
exists
())
{
if
(
File
(
pptDemo
.
path
).
exists
())
{
new
.
add
(
0
,
pptDemo
)
new
.
add
(
0
,
pptDemo
)
GlobalPptList
.
add
(
0
,
deepCopy
(
pptDemo
))
GlobalPptList
.
add
(
0
,
deepCopy
(
pptDemo
))
...
...
app/src/main/java/com/base/pdfoneread/ui/main/SettingFragment.kt
View file @
c5ed0484
...
@@ -17,7 +17,6 @@ import com.base.pdfoneread.utils.LogEx
...
@@ -17,7 +17,6 @@ import com.base.pdfoneread.utils.LogEx
import
com.base.pdfoneread.utils.PdfBoxUtils.checkPdfEncryption
import
com.base.pdfoneread.utils.PdfBoxUtils.checkPdfEncryption
import
com.base.pdfoneread.utils.SafUtils.jumpOpenDocumentThenPersistable
import
com.base.pdfoneread.utils.SafUtils.jumpOpenDocumentThenPersistable
import
com.base.pdfoneread.utils.UriUtils.getMimeTypeBySafUri
import
com.base.pdfoneread.utils.UriUtils.getMimeTypeBySafUri
import
com.mbridge.msdk.widget.FeedBackButton
class
SettingFragment
:
Fragment
()
{
class
SettingFragment
:
Fragment
()
{
...
...
app/src/main/java/com/base/pdfoneread/ui/pdf/PdfSelectActivity.kt
View file @
c5ed0484
...
@@ -68,25 +68,25 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
...
@@ -68,25 +68,25 @@ class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>() {
when
(
doWhat
)
{
when
(
doWhat
)
{
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
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project
_split
)
getPdfData
(
2
)
getPdfData
(
2
)
}
}
DO_MERGE_PDF
->
{
DO_MERGE_PDF
->
{
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project
_merge
)
getPdfData
(
1
)
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
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project
_lock
)
getPdfData
(
3
)
getPdfData
(
3
)
}
}
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
)
binding
.
tvSelectTip
.
text
=
getString
(
R
.
string
.
select_a_project
_unlock
)
getPdfData
(
3
)
getPdfData
(
3
)
}
}
...
...
app/src/main/java/com/base/pdfoneread/utils/MediaStoreUtils.kt
View file @
c5ed0484
...
@@ -109,9 +109,9 @@ fun Context.getMediaFile(selectionArgs: Array<String>? = null): ArrayList<MediaB
...
@@ -109,9 +109,9 @@ fun Context.getMediaFile(selectionArgs: Array<String>? = null): ArrayList<MediaB
// val size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE))
// val size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE))
LogEx
.
logDebug
(
TAG
,
"path=$path uri=$uri mimeType=$mimeType"
)
LogEx
.
logDebug
(
TAG
,
"path=$path uri=$uri mimeType=$mimeType"
)
list
.
add
(
if
(!
Uri
.
EMPTY
.
equals
(
uri
)
||
File
(
path
).
exists
())
{
MediaBean
(
path
=
path
,
uri
=
uri
,
mimeType
=
mimeType
)
list
.
add
(
MediaBean
(
path
=
path
,
uri
=
uri
,
mimeType
=
mimeType
)
)
)
}
}
}
}
}
}
}
...
...
app/src/main/res/values/strings.xml
View file @
c5ed0484
...
@@ -76,5 +76,9 @@
...
@@ -76,5 +76,9 @@
<string
name=
"rate_tip"
>
We are working hard for a better\nuser experience.\nWe\'d greatly appreciate if you\ncan rate us.
</string>
<string
name=
"rate_tip"
>
We are working hard for a better\nuser experience.\nWe\'d greatly appreciate if you\ncan rate us.
</string>
<string
name=
"send"
>
Send
</string>
<string
name=
"send"
>
Send
</string>
<string
name=
"favorite"
>
Favorite
</string>
<string
name=
"favorite"
>
Favorite
</string>
<string
name=
"select_a_project_split"
>
Select a project for split
</string>
<string
name=
"select_a_project_merge"
>
Select projects for merge
</string>
<string
name=
"select_a_project_lock"
>
Select a project to lock
</string>
<string
name=
"select_a_project_unlock"
>
Select a project to unlock
</string>
</resources>
</resources>
\ No newline at end of file
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