mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Fixed handling of new Android Intent result
git-svn-id: https://zxing.googlecode.com/svn/trunk@261 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
600e93c174
commit
5f867e7b0d
|
@ -42,6 +42,8 @@ public final class AndroidIntentParsedResult extends ParsedReaderResult {
|
||||||
return new AndroidIntentParsedResult(Intent.getIntent(rawText));
|
return new AndroidIntentParsedResult(Intent.getIntent(rawText));
|
||||||
} catch (URISyntaxException urise) {
|
} catch (URISyntaxException urise) {
|
||||||
return null;
|
return null;
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package com.google.zxing.client.android;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -179,9 +180,14 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
||||||
String rawText = rawResult.getText();
|
String rawText = rawResult.getText();
|
||||||
ParsedReaderResult readerResult = ParsedReaderResult.parseReaderResult(rawText);
|
ParsedReaderResult readerResult = ParsedReaderResult.parseReaderResult(rawText);
|
||||||
if (readerResult.getType().equals(ParsedReaderResultType.TEXT)) {
|
if (readerResult.getType().equals(ParsedReaderResultType.TEXT)) {
|
||||||
ParsedReaderResult androidResult = AndroidIntentParsedResult.parse(rawText);
|
AndroidIntentParsedResult androidResult = AndroidIntentParsedResult.parse(rawText);
|
||||||
if (androidResult != null) {
|
if (androidResult != null) {
|
||||||
readerResult = androidResult;
|
Intent intent = androidResult.getIntent();
|
||||||
|
if (!Intent.VIEW_ACTION.equals(intent.getAction())) {
|
||||||
|
// For now, don't take anything that just parses as a View action. A lot
|
||||||
|
// of things are accepted as a View action by default.
|
||||||
|
readerResult = androidResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return readerResult;
|
return readerResult;
|
||||||
|
|
|
@ -119,6 +119,8 @@ final class ResultHandler extends Handler {
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (type.equals(ParsedReaderResultType.ANDROID_INTENT)) {
|
||||||
|
intent = ((AndroidIntentParsedResult) result).getIntent();
|
||||||
}
|
}
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
captureActivity.startActivity(intent);
|
captureActivity.startActivity(intent);
|
||||||
|
|
Loading…
Reference in a new issue