mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
setPackage on encode intent internally
This commit is contained in:
parent
c1fc401d9a
commit
24a5f9c654
|
@ -104,11 +104,8 @@ public final class ShareActivity extends Activity {
|
|||
};
|
||||
|
||||
private void launchSearch(String text) {
|
||||
Intent intent = new Intent(Intents.Encode.ACTION);
|
||||
intent.addFlags(Intents.FLAG_NEW_DOC);
|
||||
intent.putExtra(Intents.Encode.TYPE, Contents.Type.TEXT);
|
||||
Intent intent = buildEncodeIntent(Contents.Type.TEXT);
|
||||
intent.putExtra(Intents.Encode.DATA, text);
|
||||
intent.putExtra(Intents.Encode.FORMAT, BarcodeFormat.QR_CODE.toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -156,11 +153,8 @@ public final class ShareActivity extends Activity {
|
|||
if (text == null) {
|
||||
return; // Show error?
|
||||
}
|
||||
Intent intent = new Intent(Intents.Encode.ACTION);
|
||||
intent.addFlags(Intents.FLAG_NEW_DOC);
|
||||
intent.putExtra(Intents.Encode.TYPE, Contents.Type.TEXT);
|
||||
Intent intent = buildEncodeIntent(Contents.Type.TEXT);
|
||||
intent.putExtra(Intents.Encode.DATA, text);
|
||||
intent.putExtra(Intents.Encode.FORMAT, BarcodeFormat.QR_CODE.toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -249,15 +243,20 @@ public final class ShareActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intents.Encode.ACTION);
|
||||
intent.addFlags(Intents.FLAG_NEW_DOC);
|
||||
intent.putExtra(Intents.Encode.TYPE, Contents.Type.CONTACT);
|
||||
Intent intent = buildEncodeIntent(Contents.Type.CONTACT);
|
||||
intent.putExtra(Intents.Encode.DATA, bundle);
|
||||
intent.putExtra(Intents.Encode.FORMAT, BarcodeFormat.QR_CODE.toString());
|
||||
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private static Intent buildEncodeIntent(String type) {
|
||||
Intent intent = new Intent(Intents.Encode.ACTION);
|
||||
intent.setPackage("com.google.zxing.client.android");
|
||||
intent.addFlags(Intents.FLAG_NEW_DOC);
|
||||
intent.putExtra(Intents.Encode.TYPE, type);
|
||||
intent.putExtra(Intents.Encode.FORMAT, BarcodeFormat.QR_CODE.toString());
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static String massageContactData(String data) {
|
||||
// For now -- make sure we don't put newlines in shared contact data. It messes up
|
||||
// any known encoding of contact data. Replace with space.
|
||||
|
|
Loading…
Reference in a new issue