- Fixed QR scanner in send fragment not triggering when the camera is focusing on a QR code

- Gradle version upgraded to work with the last android studio
feat_androidx_migration
Javier Varona 2018-10-07 20:02:56 -04:00
parent be679e655f
commit 303011e419
2 changed files with 10 additions and 2 deletions

View File

@ -405,6 +405,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@Override
public void onResume() {
super.onResume();
mScannerView.setResultHandler(this);
mScannerView.startCamera();
/*builder.setNeutralButton("Scan QR Code", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
@ -419,6 +421,12 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
loadUserImage();
}
@Override
public void onPause() {
super.onPause();
mScannerView.stopCamera();
}
@Override
public void onDestroy() {
super.onDestroy();
@ -652,6 +660,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
public void beginScanQrCode(){
//mScannerView = new ZXingScannerView(getContext());
mScannerView.setFormats(listOf(BarcodeFormat.QR_CODE));
mScannerView.setAspectTolerance(0.5f);
mScannerView.setAutoFocus(true);
mScannerView.setLaserColor(R.color.colorAccent);
mScannerView.setMaskColor(R.color.colorAccent);
@ -719,7 +728,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@Override
public void handleResult(Result result) {
try {
System.out.println("CAMERA result " + result.getText() );
Invoice invoice = Invoice.fromQrCode(result.getText());
etTo.setText(invoice.getTo());

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip