mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Remove unnecessary code now that minSdk is 21.
This commit is contained in:
committed by
Cody Henthorne
parent
8cfd02aff2
commit
3e7dc79fe8
@@ -1,7 +1,6 @@
|
||||
package org.signal.qr
|
||||
|
||||
import android.graphics.ImageFormat
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.ImageProxy
|
||||
import com.google.zxing.LuminanceSource
|
||||
import java.nio.ByteBuffer
|
||||
@@ -14,7 +13,6 @@ import java.nio.ByteBuffer
|
||||
* An image width can be reported as 1080 but the row stride may be 1088. Thus when representing a row-major
|
||||
* 2D array as a 1D array, the math can go sideways if width is used instead of row stride.
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
class ImageProxyLuminanceSource(image: ImageProxy) : LuminanceSource(image.width, image.height) {
|
||||
|
||||
val yData: ByteArray
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.signal.qr
|
||||
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.ImageProxy
|
||||
import com.google.zxing.BinaryBitmap
|
||||
import com.google.zxing.ChecksumException
|
||||
@@ -24,7 +23,6 @@ class QrProcessor {
|
||||
private var previousHeight = 0
|
||||
private var previousWidth = 0
|
||||
|
||||
@RequiresApi(21)
|
||||
fun getScannedData(proxy: ImageProxy): String? {
|
||||
return getScannedData(ImageProxyLuminanceSource(proxy))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.signal.qr
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.widget.FrameLayout
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
@@ -28,7 +27,7 @@ class QrScannerView @JvmOverloads constructor(
|
||||
val qrData: Observable<String> = qrDataPublish
|
||||
|
||||
private fun initScannerView(forceLegacy: Boolean) {
|
||||
val scannerView: FrameLayout = if (Build.VERSION.SDK_INT >= 21 && !forceLegacy) {
|
||||
val scannerView: FrameLayout = if (!forceLegacy) {
|
||||
ScannerView21(context) { qrDataPublish.onNext(it) }
|
||||
} else {
|
||||
ScannerView19(context) { qrDataPublish.onNext(it) }
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.Size
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.Camera
|
||||
import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
@@ -22,7 +21,6 @@ import java.util.concurrent.Executors
|
||||
* API21+ version of QR scanning view. Uses camerax APIs.
|
||||
*/
|
||||
@SuppressLint("ViewConstructor")
|
||||
@RequiresApi(21)
|
||||
internal class ScannerView21 constructor(
|
||||
context: Context,
|
||||
private val listener: ScanListener
|
||||
|
||||
Reference in New Issue
Block a user