Minor revision to last change to Google Glass Intents

This commit is contained in:
Sean Owen 2014-05-20 20:54:58 +01:00
parent aedd6262e6
commit f302d02ea1
2 changed files with 3 additions and 8 deletions

View file

@ -50,6 +50,7 @@ hosigumayuugi
hypest (Barcorama project) hypest (Barcorama project)
Ian W. Davis Ian W. Davis
Isaac Potoczny-Jones Isaac Potoczny-Jones
Ivan Poliakov
Jacob Haynes (Google) Jacob Haynes (Google)
Jeff Breidenbach (Google) Jeff Breidenbach (Google)
Joan Montané (Softcatalà.cat) Joan Montané (Softcatalà.cat)

View file

@ -60,14 +60,8 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
// returnResult should be true if activity was started using // returnResult should be true if activity was started using
// startActivityForResult() with SCAN_ACTION intent // startActivityForResult() with SCAN_ACTION intent
returnResult = false;
Intent intent = getIntent(); Intent intent = getIntent();
if (intent != null) { returnResult = intent != null && SCAN_ACTION.equals(intent.getAction());
String action = intent.getAction();
if (action != null)
returnResult = action.equals(SCAN_ACTION);
}
Window window = getWindow(); Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -171,7 +165,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
void setResult(Result result) { void setResult(Result result) {
if (returnResult) { if (returnResult) {
Intent scanResult = new Intent(); Intent scanResult = new Intent("com.google.zxing.client.android.SCAN");
scanResult.putExtra("SCAN_RESULT", result.getText()); scanResult.putExtra("SCAN_RESULT", result.getText());
setResult(RESULT_OK, scanResult); setResult(RESULT_OK, scanResult);
finish(); finish();