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
cd845150
Commit
cd845150
authored
Oct 15, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
a3547387
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
MainActivity.kt
...va/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
+5
-2
MainPresenter.kt
...a/com/base/pdfviewerscannerwhite/ui/main/MainPresenter.kt
+6
-2
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainActivity.kt
View file @
cd845150
...
...
@@ -74,11 +74,13 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
override
fun
initView
()
{
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
?:
""
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId"
,
true
)
mainPresenter
=
MainPresenter
(
this
,
this
,
lifecycleScope
)
mainPresenter
.
initScannerLauncher
(
this
)
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
?:
""
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId"
,
true
)
addDeskShortCut
()
...
...
@@ -257,6 +259,7 @@ class MainActivity : BaseActivity<ActivityMain2Binding>(), MainView {
override
fun
onDestroy
()
{
super
.
onDestroy
()
LogEx
.
logDebug
(
TAG
,
"onDestroy"
)
mainPresenter
.
scannerLauncher
=
null
}
override
fun
onSaveInstanceState
(
outState
:
Bundle
)
{
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/ui/main/MainPresenter.kt
View file @
cd845150
...
...
@@ -62,7 +62,7 @@ class MainPresenter(
val
excelDocuments
=
arrayListOf
<
DocumentBean
>()
val
pptDocuments
=
arrayListOf
<
DocumentBean
>()
private
lateinit
var
scannerLauncher
:
ActivityResultLauncher
<
IntentSenderRequest
>
var
scannerLauncher
:
ActivityResultLauncher
<
IntentSenderRequest
>?
=
null
companion
object
{
var
mainRefreshData
:
Boolean
=
false
...
...
@@ -300,6 +300,7 @@ class MainPresenter(
return
new
}
var
scannerLauncherRegister
:
Boolean
=
false
fun
initScannerLauncher
(
appCompatActivity
:
AppCompatActivity
)
{
scannerLauncher
=
appCompatActivity
.
registerForActivityResult
(
ActivityResultContracts
.
StartIntentSenderForResult
())
{
activityResult
->
...
...
@@ -321,6 +322,8 @@ class MainPresenter(
mainView
.
handleActivityGmsScanResult
(
null
,
null
)
}
}
scannerLauncherRegister
=
true
}
...
...
@@ -341,6 +344,7 @@ class MainPresenter(
fun
starGmsScan
(
activity
:
Activity
)
{
runCatching
{
if
(
scannerLauncher
==
null
&&
!
scannerLauncherRegister
)
return
val
options
=
GmsDocumentScannerOptions
.
Builder
()
.
setScannerMode
(
GmsDocumentScannerOptions
.
SCANNER_MODE_BASE
)
...
...
@@ -356,7 +360,7 @@ class MainPresenter(
GmsDocumentScanning
.
getClient
(
options
.
build
())
.
getStartScanIntent
(
activity
)
.
addOnSuccessListener
{
intentSender
:
IntentSender
->
scannerLauncher
.
launch
(
IntentSenderRequest
.
Builder
(
intentSender
).
build
())
scannerLauncher
?
.
launch
(
IntentSenderRequest
.
Builder
(
intentSender
).
build
())
}
.
addOnFailureListener
{
e
:
Exception
->
}
...
...
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