Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
81f35acf
Commit
81f35acf
authored
Feb 05, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let Zxing try harder
parent
a755b669
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
...e/src/main/java/com/github/shadowsocks/ScannerActivity.kt
+4
-5
No files found.
mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
View file @
81f35acf
...
...
@@ -41,10 +41,7 @@ import com.github.shadowsocks.App.Companion.app
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.ProfileManager
import
com.github.shadowsocks.utils.resolveResourceId
import
com.google.zxing.BinaryBitmap
import
com.google.zxing.MultiFormatReader
import
com.google.zxing.RGBLuminanceSource
import
com.google.zxing.Result
import
com.google.zxing.*
import
com.google.zxing.common.HybridBinarizer
import
me.dm7.barcodescanner.zxing.ZXingScannerView
...
...
@@ -53,6 +50,8 @@ class ScannerActivity : AppCompatActivity(), ZXingScannerView.ResultHandler, Too
private
const
val
MY_PERMISSIONS_REQUEST_CAMERA
=
1
private
const
val
REQUEST_IMPORT
=
2
private
const
val
REQUEST_IMPORT_OR_FINISH
=
3
private
val
hints
by
lazy
{
mapOf
(
Pair
(
DecodeHintType
.
TRY_HARDER
,
true
))
}
}
private
lateinit
var
scannerView
:
ZXingScannerView
...
...
@@ -151,7 +150,7 @@ class ScannerActivity : AppCompatActivity(), ZXingScannerView.ResultHandler, Too
val
pixels
=
IntArray
(
bitmap
.
width
*
bitmap
.
height
)
bitmap
.
getPixels
(
pixels
,
0
,
bitmap
.
width
,
0
,
0
,
bitmap
.
width
,
bitmap
.
height
)
Profile
.
findAll
(
reader
.
decode
(
BinaryBitmap
(
HybridBinarizer
(
RGBLuminanceSource
(
bitmap
.
width
,
bitmap
.
height
,
pixels
)))).
text
).
forEach
{
RGBLuminanceSource
(
bitmap
.
width
,
bitmap
.
height
,
pixels
)))
,
hints
).
text
).
forEach
{
ProfileManager
.
createProfile
(
it
)
success
=
true
}
...
...
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