Skip to content
Permalink
Browse files

setPackage on encode intent internally

  • Loading branch information
srowen committed Feb 16, 2020
1 parent c1fc401 commit 24a5f9c65457e21ec5bf4331dd7eb07e49eb51d8
Showing with 11 additions and 12 deletions.
  1. +11 −12 android/src/com/google/zxing/client/android/share/ShareActivity.java
@@ -104,11 +104,8 @@ public boolean onKey(View view, int keyCode, KeyEvent event) {
};

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 @@ private void showTextAsBarcode(String text) {
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,13 +243,18 @@ private void showContactAsBarcode(Uri contactUri) {
}
}

Intent intent = buildEncodeIntent(Contents.Type.CONTACT);
intent.putExtra(Intents.Encode.DATA, bundle);
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, Contents.Type.CONTACT);
intent.putExtra(Intents.Encode.DATA, bundle);
intent.putExtra(Intents.Encode.TYPE, type);
intent.putExtra(Intents.Encode.FORMAT, BarcodeFormat.QR_CODE.toString());

startActivity(intent);
return intent;
}

private static String massageContactData(String data) {

0 comments on commit 24a5f9c

Please sign in to comment.
You can’t perform that action at this time.