Merge pull request #11148 from nextcloud/devVersionWithoutScanner

For our daily build on F-Droid we cannot add our document scanning
This commit is contained in:
Tobias Kaminsky 2022-12-07 15:30:41 +01:00 committed by GitHub
commit bb721e2e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 50 deletions

View file

@ -274,7 +274,6 @@ dependencies {
gplayImplementation "com.github.zynkware:Document-Scanning-Android-SDK:$documentScannerVersion"
huaweiImplementation "com.github.zynkware:Document-Scanning-Android-SDK:$documentScannerVersion"
qaImplementation "com.github.zynkware:Document-Scanning-Android-SDK:$documentScannerVersion"
versionDevImplementation "com.github.zynkware:Document-Scanning-Android-SDK:$documentScannerVersion"
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'

View file

@ -21,60 +21,21 @@
package com.owncloud.android.ui.activity
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.graphics.Bitmap
import android.os.Bundle
import com.owncloud.android.R
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.PermissionUtil
import com.zynksoftware.documentscanner.ScanActivity
import com.zynksoftware.documentscanner.model.DocumentScannerErrorModel
import com.zynksoftware.documentscanner.model.ScannerResults
import com.zynksoftware.documentscanner.ui.DocumentScanner
class AppScanActivity : ScanActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addFragmentContentLayout()
}
override fun onError(error: DocumentScannerErrorModel) {
DisplayUtils.showSnackMessage(this, R.string.error_starting_scan_doc)
}
override fun onSuccess(scannerResults: ScannerResults) {
val intent = Intent()
intent.putExtra(
"file",
scannerResults.transformedImageFile?.absolutePath ?: scannerResults.croppedImageFile?.absolutePath
)
setResult(Activity.RESULT_OK, intent)
finish()
}
override fun onClose() {
finish()
}
import com.owncloud.android.lib.common.utils.Log_OC
class AppScanActivity {
// stub
companion object {
@JvmStatic
val enabled: Boolean = true
private val TAG = AppScanActivity::class.simpleName
@JvmStatic
fun scanFromCamera(activity: Activity, requestCode: Int) {
val configuration = DocumentScanner.Configuration()
configuration.imageType = Bitmap.CompressFormat.PNG
DocumentScanner.init(activity, configuration)
val scanIntent = Intent(activity, AppScanActivity::class.java)
if (PermissionUtil.checkSelfPermission(activity, Manifest.permission.CAMERA)) {
activity.startActivityForResult(scanIntent, requestCode)
} else {
PermissionUtil.requestCameraPermission(activity, PermissionUtil.PERMISSIONS_SCAN_DOCUMENT)
}
val enabled: Boolean = false
@JvmStatic
fun scanFromCamera(activity: Activity, requestcode: Int) {
// stub
Log_OC.w(TAG, "scanFromCamera called in stub implementation")
}
}
}