mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Logging vCard content received to help debug
git-svn-id: https://zxing.googlecode.com/svn/trunk@1117 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
2893fb3804
commit
c0c1290611
|
@ -42,6 +42,7 @@ import android.util.Log;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class does the work of decoding the user's request and extracting all the data
|
* This class does the work of decoding the user's request and extracting all the data
|
||||||
|
@ -50,13 +51,16 @@ import java.io.InputStream;
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
final class QRCodeEncoder {
|
final class QRCodeEncoder {
|
||||||
|
|
||||||
|
private static final String TAG = "QRCodeEncoder";
|
||||||
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
private String contents;
|
private String contents;
|
||||||
private String displayContents;
|
private String displayContents;
|
||||||
private String title;
|
private String title;
|
||||||
private BarcodeFormat format;
|
private BarcodeFormat format;
|
||||||
|
|
||||||
public QRCodeEncoder(Activity activity, Intent intent) {
|
QRCodeEncoder(Activity activity, Intent intent) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
throw new IllegalArgumentException("No valid data to encode.");
|
throw new IllegalArgumentException("No valid data to encode.");
|
||||||
|
@ -69,7 +73,7 @@ final class QRCodeEncoder {
|
||||||
}
|
}
|
||||||
} else if (action.equals(Intent.ACTION_SEND)) {
|
} else if (action.equals(Intent.ACTION_SEND)) {
|
||||||
if (!encodeContentsFromShareIntent(intent)) {
|
if (!encodeContentsFromShareIntent(intent)) {
|
||||||
throw new IllegalArgumentException("No valid data to encode.");
|
throw new IllegalArgumentException("No valid data to encode.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +146,8 @@ final class QRCodeEncoder {
|
||||||
int length = stream.available();
|
int length = stream.available();
|
||||||
byte[] vcard = new byte[length];
|
byte[] vcard = new byte[length];
|
||||||
stream.read(vcard, 0, length);
|
stream.read(vcard, 0, length);
|
||||||
String vcardString = new String(vcard, "utf-8");
|
String vcardString = new String(vcard, Charset.forName("UTF-8"));
|
||||||
|
Log.d(TAG, "Encoding share intent content: " + vcardString);
|
||||||
Result result = new Result(vcardString, vcard, null, BarcodeFormat.QR_CODE);
|
Result result = new Result(vcardString, vcard, null, BarcodeFormat.QR_CODE);
|
||||||
ParsedResult parsedResult = ResultParser.parseResult(result);
|
ParsedResult parsedResult = ResultParser.parseResult(result);
|
||||||
if (!(parsedResult instanceof AddressBookParsedResult)) {
|
if (!(parsedResult instanceof AddressBookParsedResult)) {
|
||||||
|
|
Loading…
Reference in a new issue