Commit 8496354f authored by Martin LOISEAU's avatar Martin LOISEAU 🎄
Browse files

Display QR code content in snackbar when back to main activity

parent 9767c156
......@@ -200,6 +200,9 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d("Debug2", "QR data retrieved in main activity: " + data.getStringExtra("QR_CONTENT"));
Snackbar.make(findViewById(R.id.main_layout), "QR code says:" + data.getStringExtra("QR_CONTENT") , Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
public void SetListeningResults(String result) // to display listening results
......
......@@ -51,6 +51,11 @@ public class QRCaptureActivity extends MainActivity {
startDetection();
Log.d("Debug2", "End of QRCapture activity creation");
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* Starts the detection of new QRCodes
......@@ -173,7 +178,7 @@ public class QRCaptureActivity extends MainActivity {
String rawValue = barcodes.valueAt(0).rawValue;
Log.d("Debug", "QR code raw value : " + rawValue);
stopDetection();
stopDetection(rawValue);
//ignoring if the QRCode has already been recorded or ignored
try {
QRCode detectedQR = QRCodeBuilder.build(rawValue);
......@@ -198,7 +203,7 @@ public class QRCaptureActivity extends MainActivity {
* Stops the detection : the application is no longer trying to detect QRCodes
* The cameraView becomes white
*/
public void stopDetection() {
public void stopDetection(String QRContent) {
final AppCompatActivity activity = this;
activity.runOnUiThread(new Runnable() {
......@@ -212,7 +217,7 @@ public class QRCaptureActivity extends MainActivity {
});
Intent returnIntent= new Intent();
returnIntent.putExtra("QR_CONTENT","yada");
returnIntent.putExtra("QR_CONTENT",QRContent);
setResult(RESULT_OK, returnIntent);//Terminel'activité
finish();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment