Skip to content

Commit

Permalink
Tweak new QR processing some more.
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-signal committed Jun 1, 2022
1 parent f4c728f commit 4c44f1e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion qr/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:theme="@style/Theme.App">

<activity
android:name=".MainActivity"
android:name=".QrMainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.kotlin.subscribeBy
import org.signal.qr.QrScannerView

class MainActivity : AppCompatActivity() {
class QrMainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Expand Down
2 changes: 1 addition & 1 deletion qr/lib/src/main/java/org/signal/qr/QrProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class QrProcessor {
val source = PlanarYUVLuminanceSource(data, width, height, 0, 0, width, height, false)

val bitmap = BinaryBitmap(HybridBinarizer(source))
val result: Result? = reader.decode(bitmap, emptyMap<DecodeHintType, String>())
val result: Result? = reader.decode(bitmap, mapOf(DecodeHintType.TRY_HARDER to true, DecodeHintType.CHARACTER_SET to "ISO-8859-1"))

if (result != null) {
return result.text
Expand Down
4 changes: 2 additions & 2 deletions qr/lib/src/main/java/org/signal/qr/ScannerView21.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ internal class ScannerView21 constructor(
val preview = Preview.Builder().build()

val imageAnalysis = ImageAnalysis.Builder()
.setTargetAspectRatio(AspectRatio.RATIO_16_9)
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()

imageAnalysis.setAnalyzer(analyzerExecutor) { proxy ->
val buffer = proxy.planes[0].buffer
val buffer = proxy.planes[0].buffer.apply { rewind() }
val bytes = ByteArray(buffer.capacity())
buffer.get(bytes)

Expand Down

0 comments on commit 4c44f1e

Please sign in to comment.