mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 10:18:59 +03:00
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:
commit
bb721e2e75
2 changed files with 10 additions and 50 deletions
|
@ -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'
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue