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:
srowen 2011-10-21 23:30:39 +00:00
parent deea2105b7
commit 352dc25139
2 changed files with 18 additions and 12 deletions

View file

@ -34,9 +34,9 @@ public final class Intents {
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
* may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
* one of the values below.
* By default, sending this will decode all barcodes that we understand. However it
* may be useful to limit scanning to certain formats. Use
* {@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}.
* It is overridden by that setting.
@ -87,9 +87,13 @@ public final class Intents {
public static final String HEIGHT = "SCAN_HEIGHT";
/**
* If a barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which
* requested the scan via startSubActivity(). The barcodes contents can be retrieved with
* intent.getStringExtra(RESULT). If the user presses Back, the result code will be
* If a barcode is found, Barcodes returns RESULT_OK to
* {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)}
* 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.
*/
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";
/**
* The data to encode. Use Intent.putExtra(DATA, data) where data is either a String or a
* Bundle, depending on the type and format specified. Non-QR Code formats should
* The data to encode. Use {@link android.content.Intent#putExtra(String, String)} or
* {@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.
*/
public static final String DATA = "ENCODE_DATA";
/**
* 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";
/**
* 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
* format is one of Contents.Format.
* it defaults to QR Code. Use {@link android.content.Intent#putExtra(String, String)}, where
* format is one of {@link com.google.zxing.BarcodeFormat}.
*/
public static final String FORMAT = "ENCODE_FORMAT";

View file

@ -167,7 +167,6 @@ public final class EncodeActivity extends Activity {
}
try {
qrCodeEncoder = new QRCodeEncoder(this, intent, smallerDimension);
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
ImageView view = (ImageView) findViewById(R.id.image_view);
view.setImageBitmap(bitmap);
@ -175,8 +174,10 @@ public final class EncodeActivity extends Activity {
TextView contents = (TextView) findViewById(R.id.contents_text_view);
if (intent.getBooleanExtra(Intents.Encode.SHOW_CONTENTS, true)) {
contents.setText(qrCodeEncoder.getDisplayContents());
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
} else {
contents.setText("");
setTitle(getString(R.string.app_name));
}
} catch (WriterException e) {
Log.e(TAG, "Could not encode barcode", e);