mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
Merge miscellaneous additional changes from my near-identical version of hiding text while encoding QR codes: redact menu bar title, and some javadoc improvements in Intents
git-svn-id: https://zxing.googlecode.com/svn/trunk@1989 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
deea2105b7
commit
352dc25139
|
@ -34,9 +34,9 @@ public final class Intents {
|
||||||
public static final String ACTION = "com.google.zxing.client.android.SCAN";
|
public static final String ACTION = "com.google.zxing.client.android.SCAN";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default, sending Scan.ACTION will decode all barcodes that we understand. However it
|
* By default, sending this will decode all barcodes that we understand. However it
|
||||||
* may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
|
* may be useful to limit scanning to certain formats. Use
|
||||||
* one of the values below.
|
* {@link android.content.Intent#putExtra(String, String)} with one of the values below.
|
||||||
*
|
*
|
||||||
* Setting this is effectively shorthand for setting explicit formats with {@link #FORMATS}.
|
* Setting this is effectively shorthand for setting explicit formats with {@link #FORMATS}.
|
||||||
* It is overridden by that setting.
|
* It is overridden by that setting.
|
||||||
|
@ -87,9 +87,13 @@ public final class Intents {
|
||||||
public static final String HEIGHT = "SCAN_HEIGHT";
|
public static final String HEIGHT = "SCAN_HEIGHT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which
|
* If a barcode is found, Barcodes returns RESULT_OK to
|
||||||
* requested the scan via startSubActivity(). The barcodes contents can be retrieved with
|
* {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)}
|
||||||
* intent.getStringExtra(RESULT). If the user presses Back, the result code will be
|
* of the app which requested the scan via
|
||||||
|
* {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
|
||||||
|
* The barcodes contents can be retrieved with
|
||||||
|
* {@link android.content.Intent#getStringExtra(String)}.
|
||||||
|
* If the user presses Back, the result code will be
|
||||||
* RESULT_CANCELED.
|
* RESULT_CANCELED.
|
||||||
*/
|
*/
|
||||||
public static final String RESULT = "SCAN_RESULT";
|
public static final String RESULT = "SCAN_RESULT";
|
||||||
|
@ -123,22 +127,23 @@ public final class Intents {
|
||||||
public static final String ACTION = "com.google.zxing.client.android.ENCODE";
|
public static final String ACTION = "com.google.zxing.client.android.ENCODE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data to encode. Use Intent.putExtra(DATA, data) where data is either a String or a
|
* The data to encode. Use {@link android.content.Intent#putExtra(String, String)} or
|
||||||
* Bundle, depending on the type and format specified. Non-QR Code formats should
|
* {@link android.content.Intent#putExtra(String, android.os.Bundle)},
|
||||||
|
* depending on the type and format specified. Non-QR Code formats should
|
||||||
* just use a String here. For QR Code, see Contents for details.
|
* just use a String here. For QR Code, see Contents for details.
|
||||||
*/
|
*/
|
||||||
public static final String DATA = "ENCODE_DATA";
|
public static final String DATA = "ENCODE_DATA";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of data being supplied if the format is QR Code. Use
|
* The type of data being supplied if the format is QR Code. Use
|
||||||
* Intent.putExtra(TYPE, type) with one of Contents.Type.
|
* {@link android.content.Intent#putExtra(String, String)} with one of {@link Contents.Type}.
|
||||||
*/
|
*/
|
||||||
public static final String TYPE = "ENCODE_TYPE";
|
public static final String TYPE = "ENCODE_TYPE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The barcode format to be displayed. If this isn't specified or is blank,
|
* The barcode format to be displayed. If this isn't specified or is blank,
|
||||||
* it defaults to QR Code. Use Intent.putExtra(FORMAT, format), where
|
* it defaults to QR Code. Use {@link android.content.Intent#putExtra(String, String)}, where
|
||||||
* format is one of Contents.Format.
|
* format is one of {@link com.google.zxing.BarcodeFormat}.
|
||||||
*/
|
*/
|
||||||
public static final String FORMAT = "ENCODE_FORMAT";
|
public static final String FORMAT = "ENCODE_FORMAT";
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,6 @@ public final class EncodeActivity extends Activity {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
qrCodeEncoder = new QRCodeEncoder(this, intent, smallerDimension);
|
qrCodeEncoder = new QRCodeEncoder(this, intent, smallerDimension);
|
||||||
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
|
|
||||||
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
|
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
|
||||||
ImageView view = (ImageView) findViewById(R.id.image_view);
|
ImageView view = (ImageView) findViewById(R.id.image_view);
|
||||||
view.setImageBitmap(bitmap);
|
view.setImageBitmap(bitmap);
|
||||||
|
@ -175,8 +174,10 @@ public final class EncodeActivity extends Activity {
|
||||||
TextView contents = (TextView) findViewById(R.id.contents_text_view);
|
TextView contents = (TextView) findViewById(R.id.contents_text_view);
|
||||||
if (intent.getBooleanExtra(Intents.Encode.SHOW_CONTENTS, true)) {
|
if (intent.getBooleanExtra(Intents.Encode.SHOW_CONTENTS, true)) {
|
||||||
contents.setText(qrCodeEncoder.getDisplayContents());
|
contents.setText(qrCodeEncoder.getDisplayContents());
|
||||||
|
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
|
||||||
} else {
|
} else {
|
||||||
contents.setText("");
|
contents.setText("");
|
||||||
|
setTitle(getString(R.string.app_name));
|
||||||
}
|
}
|
||||||
} catch (WriterException e) {
|
} catch (WriterException e) {
|
||||||
Log.e(TAG, "Could not encode barcode", e);
|
Log.e(TAG, "Could not encode barcode", e);
|
||||||
|
|
Loading…
Reference in a new issue