Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
scanqrwhite2copy1
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
scanqrwhite2copy1
Commits
8b19238e
Commit
8b19238e
authored
Feb 21, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
7cba32e7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
48 deletions
+79
-48
.gitignore
.gitignore
+1
-0
build.gradle
android-pdf-viewer/build.gradle
+0
-30
build.gradle.kts
android-pdf-viewer/build.gradle.kts
+23
-0
build.gradle.kts
app/build.gradle.kts
+2
-2
PdfResultActivity.kt
...in/java/com/base/scanqrclear/ui/scan/PdfResultActivity.kt
+41
-0
ScanOtherActivity.kt
...in/java/com/base/scanqrclear/ui/scan/ScanOtherActivity.kt
+6
-7
activity_pdf_result.xml
app/src/main/res/layout/activity_pdf_result.xml
+6
-0
activity_scan_other.xml
app/src/main/res/layout/activity_scan_other.xml
+0
-9
No files found.
.gitignore
View file @
8b19238e
...
...
@@ -9,6 +9,7 @@
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/android-pdf-viewer/build
/build
/captures
.externalNativeBuild
...
...
android-pdf-viewer/build.gradle
deleted
100644 → 0
View file @
7cba32e7
plugins
{
id
'com.android.library'
id
'org.jetbrains.kotlin.android'
}
android
{
namespace
'com.github.barteksc.pdfviewer'
// 添加 namespace
compileSdkVersion
34
// 更新为最新 SDK 版本
defaultConfig
{
minSdkVersion
21
// 提升最低 SDK 版本以符合现代应用标准
targetSdkVersion
34
// 更新为目标 SDK 版本
versionCode
1
versionName
"2.8.1"
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
}
dependencies
{
implementation
'com.github.barteksc:pdfium-android:1.7.1'
implementation
(
"androidx.core:core-ktx:1.10.1"
)
implementation
(
"com.android.support:support-v4:28.0.0"
)
}
android-pdf-viewer/build.gradle.kts
0 → 100644
View file @
8b19238e
plugins
{
id
(
"com.android.library"
)
id
(
"org.jetbrains.kotlin.android"
)
}
android
{
namespace
=
"com.github.barteksc.pdfviewer"
compileSdk
=
34
// 更新为最新 SDK 版本
defaultConfig
{
minSdk
=
24
// 提升最低 SDK 版本以符合现代应用标准
//noinspection OldTargetApi
targetSdk
=
34
// 更新为目标 SDK 版本
}
}
dependencies
{
//noinspection UseTomlInstead
implementation
(
"com.github.barteksc:pdfium-android:1.7.1"
)
implementation
(
libs
.
androidx
.
core
.
ktx
)
implementation
(
libs
.
androidx
.
activity
)
implementation
(
libs
.
androidx
.
appcompat
)
}
\ No newline at end of file
app/build.gradle.kts
View file @
8b19238e
...
...
@@ -16,6 +16,7 @@ android {
defaultConfig
{
applicationId
=
"com.tool.advanced.cleaner"
minSdk
=
24
//noinspection OldTargetApi
targetSdk
=
34
versionCode
=
5
versionName
=
"1.5"
...
...
@@ -76,7 +77,6 @@ dependencies {
implementation
(
libs
.
androidx
.
constraintlayout
)
implementation
(
libs
.
androidx
.
navigation
.
fragment
.
ktx
)
implementation
(
libs
.
androidx
.
navigation
.
ui
.
ktx
)
implementation
(
project
(
":android-pdf-viewer"
))
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
...
...
@@ -111,7 +111,7 @@ dependencies {
// https://developers.google.com/ml-kit/vision/doc-scanner/android
implementation
(
"com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1"
)
// https://github.com/DImuthuUpe/AndroidPdfViewer
implementation
(
"com.github.barteksc:android-pdf-viewer:2.8.1"
)
implementation
(
project
(
":android-pdf-viewer"
)
)
//相机
...
...
app/src/main/java/com/base/scanqrclear/ui/scan/PdfResultActivity.kt
View file @
8b19238e
package
com.base.scanqrclear.ui.scan
import
android.net.Uri
import
androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
com.base.scanqrclear.base.BaseActivity
import
com.base.scanqrclear.databinding.ActivityPdfResultBinding
import
com.base.scanqrclear.utils.BarUtils
import
com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle
import
com.gyf.immersionbar.ktx.immersionBar
class
PdfResultActivity
:
BaseActivity
<
ActivityPdfResultBinding
>(
ActivityPdfResultBinding
::
inflate
)
{
private
var
uri
:
String
=
""
override
fun
initView
()
{
super
.
initView
()
binding
.
clTop
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
uri
=
intent
.
extras
?.
getString
(
"uri"
)
?:
""
val
name
=
uri
.
split
(
"/"
).
last
()
binding
.
tvPdfName
.
text
=
name
displayFromUri
(
uri
)
}
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
finish
()
}
binding
.
flBack
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
}
private
fun
displayFromUri
(
uri
:
String
)
{
binding
.
pdfView
.
fromUri
(
Uri
.
parse
(
uri
))
.
defaultPage
(
0
)
// .onPageChange(this)
.
enableAnnotationRendering
(
true
)
// .onLoad(this)
.
scrollHandle
(
DefaultScrollHandle
(
this
))
.
spacing
(
10
)
// in dp
// .onPageError(this)
.
load
()
}
override
fun
configSystemBar
()
{
immersionBar
{
statusBarColor
(
"#FFFFFFFF"
)
statusBarDarkFont
(
true
)
}
}
}
\ No newline at end of file
app/src/main/java/com/base/scanqrclear/ui/scan/ScanOtherActivity.kt
View file @
8b19238e
package
com.base.scanqrclear.ui.scan
import
android.content.Intent
import
androidx.activity.addCallback
import
androidx.activity.result.ActivityResultLauncher
import
androidx.activity.result.IntentSenderRequest
...
...
@@ -56,8 +57,8 @@ class ScanOtherActivity : BaseActivity<ActivityScanOtherBinding>(ActivityScanOth
when
(
item
.
key
)
{
KEY_DOCUMENT
->
{
val
options
=
GmsDocumentScannerOptions
.
Builder
()
.
setGalleryImportAllowed
(
fals
e
)
.
setPageLimit
(
2
)
.
setGalleryImportAllowed
(
tru
e
)
//
.setPageLimit(2)
.
setResultFormats
(
RESULT_FORMAT_JPEG
,
RESULT_FORMAT_PDF
)
.
setScannerMode
(
SCANNER_MODE_FULL
)
.
build
()
...
...
@@ -83,18 +84,16 @@ class ScanOtherActivity : BaseActivity<ActivityScanOtherBinding>(ActivityScanOth
val
imageUri
=
page
.
imageUri
// imageUri=file:///data/user/0/com.tool.advanced.cleaner/cache/mlkit_docscan_ui_client/268059886691727.jpg
LogEx
.
logDebug
(
TAG
,
"imageUri=$imageUri"
)
if
(
BuildConfig
.
DEBUG
)
{
binding
.
tvTest
.
append
(
"imageUri=$imageUri\n"
)
}
}
val
pdfUri
=
data
?.
pdf
?.
uri
val
pdfPageCount
=
data
?.
pdf
?.
pageCount
LogEx
.
logDebug
(
TAG
,
"pdfUri=$pdfUri"
)
// pdfUri=file:///data/user/0/com.tool.advanced.cleaner/cache/mlkit_docscan_ui_client/268059987162265.pdf
binding
.
tvTest
.
append
(
"pdfUri=$pdfUri\n"
)
LogEx
.
logDebug
(
TAG
,
"pdfPageCount=$pdfPageCount"
)
binding
.
tvTest
.
append
(
"pdfPageCount=$pdfPageCount"
)
startActivity
(
Intent
(
this
,
PdfResultActivity
::
class
.
java
).
apply
{
putExtra
(
"uri"
,
pdfUri
.
toString
())
})
}
}
...
...
app/src/main/res/layout/activity_pdf_result.xml
View file @
8b19238e
...
...
@@ -45,6 +45,12 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<com.github.barteksc.pdfviewer.PDFView
android:id=
"@+id/pdfView"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@id/clBottom"
app:layout_constraintTop_toBottomOf=
"@id/clTop"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/clBottom"
...
...
app/src/main/res/layout/activity_scan_other.xml
View file @
8b19238e
...
...
@@ -87,13 +87,4 @@
</com.base.scanqrclear.ads.NativeParentView>
<TextView
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:id=
"@+id/tvTest"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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