-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you pay to remove Powered by pay.cards parts ? #64
Comments
Have you done it yet? |
You can do it if you implement your own screen with <cards.pay.paycardsrecognizer.sdk.camera.widget.CameraPreviewLayout
android:id="@+id/cardScannerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:clipToPadding="true"
android:focusable="false"
android:focusableInTouchMode="false"
tools:showIn="@layout/wocr_fragment_scan_card"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<SurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<cards.pay.paycardsrecognizer.sdk.camera.widget.CardDetectionStateView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</cards.pay.paycardsrecognizer.sdk.camera.widget.CameraPreviewLayout> In your code, in your private var mScanManager: ScanManager? = null
private fun checkPermissions() {
val activity = this.requireActivity()
val isCameraGranted = activity.isPermissionGranted(Manifest.permission.CAMERA)
if (isCameraGranted) this.onScanPermissionGranted()
else this.onScanPermissionDenied()
}
private fun onScanPermissionGranted() = with(binding) {
permissionHint.visibility = View.GONE
cardScannerView.visibility = View.VISIBLE
setUpScanner()
startScanner()
}
private fun onScanPermissionDenied() = with(binding) {
permissionHint.visibility = View.VISIBLE
cardScannerView.visibility = View.GONE
stopScanner()
}
@SuppressLint("RestrictedApi")
private fun startScanner() {
mScanManager?.onResume()
}
@SuppressLint("RestrictedApi")
private fun stopScanner() {
mScanManager?.onPause()
}
@SuppressLint("RestrictedApi")
private fun setUpScanner() {
val recognitionMode = this.getRecognitionMode()
val callback = this.createScanManagerCallback()
mScanManager = ScanManager(recognitionMode, activity, binding.cardScannerView, callback)
}
@SuppressLint("RestrictedApi")
private fun getRecognitionMode(): Int = RECOGNIZER_MODE_NUMBER or
RECOGNIZER_MODE_NAME or
RECOGNIZER_MODE_DATE or
RECOGNIZER_MODE_GRAB_CARD_IMAGE
private fun createScanManagerCallback() = object : SimpleScanManagerCallback() {
@SuppressLint("RestrictedApi")
override fun freezeCameraPreview() {
mScanManager?.freezeCameraPreview()
}
override fun onCardScanned(card: Card) {
// Send scanned card result to other screens or process it here
}
} Don't forget the lifecycle, in our case, we used a override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
checkPermissions()
}
override fun onResume() {
super.onResume()
this.startScanner()
}
override fun onPause() {
super.onPause()
this.stopScanner()
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your software design is very beautiful, I want to apply it to my own application, but I don't want to display this logo, can you help me remove it, I can pay for it if needed.
The text was updated successfully, but these errors were encountered: