Delay camera activation in SendTransactionFragment after the transition from the homescreen, to avoid flicker during the transition.
This commit is contained in:
parent
fb7c91d6bb
commit
3a0527a5bf
1 changed files with 7 additions and 2 deletions
|
@ -3,6 +3,7 @@ package cy.agorise.bitsybitshareswallet.fragments
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.*
|
import android.view.*
|
||||||
|
@ -130,8 +131,12 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
|
||||||
|
|
||||||
// Use Navigation SafeArgs to decide if we should activate or not the camera feed
|
// Use Navigation SafeArgs to decide if we should activate or not the camera feed
|
||||||
val safeArgs = SendTransactionFragmentArgs.fromBundle(arguments!!)
|
val safeArgs = SendTransactionFragmentArgs.fromBundle(arguments!!)
|
||||||
if (safeArgs.openCamera)
|
if (safeArgs.openCamera) {
|
||||||
verifyCameraPermission()
|
// Delay the camera action to avoid flicker in the fragment transition
|
||||||
|
Handler().postDelayed({
|
||||||
|
run { verifyCameraPermission() }
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
fabOpenCamera.setOnClickListener { if (isCameraPreviewVisible) stopCameraPreview() else verifyCameraPermission() }
|
fabOpenCamera.setOnClickListener { if (isCameraPreviewVisible) stopCameraPreview() else verifyCameraPermission() }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue