From 1ad773d1d17f54d0f67fd7f14702e2cd186227d0 Mon Sep 17 00:00:00 2001 From: elserj Date: Fri, 20 Sep 2013 21:06:15 +0000 Subject: [PATCH] compiled zxing jar added svn path=/; revision=505 --- .../libs/android-integration-2.2.jar | Bin 0 -> 12535 bytes .../integration/android/IntentIntegrator.java | 423 ------------------ .../integration/android/IntentResult.java | 48 -- .../lab/inventory/MainActivity.java | 6 +- 4 files changed, 3 insertions(+), 474 deletions(-) create mode 100644 Personnel/justin/lab inventory/libs/android-integration-2.2.jar delete mode 100644 Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentIntegrator.java delete mode 100644 Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentResult.java diff --git a/Personnel/justin/lab inventory/libs/android-integration-2.2.jar b/Personnel/justin/lab inventory/libs/android-integration-2.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..99c2e03fb90ba01901ec37397d47608b633b269a GIT binary patch literal 12535 zcmbt*1yo&2vNobVzxcT)2`+AiTQGQP+AuGxt|En4dh}5gv42R2C zlh>cUUk|i@R+D)zDEleht7>bN^V+2eNUd^pTvVfW@?mD zj6pOG7?!A{q*L{ixNx|100sFiuD^y4@fw$*t@ZDb|5XG2R}E8JTT?6Jf1`-}KNUUP z%xz5njXM6{shit48JjxjJDJ&$SepOdj&I%MnM)1fCL4|zaiS! z57PpdkjT5~Ou?upBvnfgnteAvm2U3O&XVnO7Hi?D#!jVYaE{Ez?vI}oz;a0UB9AX{f)!u6S$iccF-yn(|~|=R(xfek%C#CF_yriqo8r$ zzJ^lY3d8E^3OivJeHVZ}n#%0ec@|8gv(i{!O{<^?Ln-~qdj`EP+p>^}Q9>>zzqr2= zTnFvsiIIAe-*-eNR4FGjU+y@;!f=IR|ISrb8##l)tGr24^bFf(LAXLW$jQbk1Wi9W zwLno!c_p0k8@hdDT7RCchw&x~jpC{B(!OF0wQ!R0Vj~^{p|B&-V~4KUCf7}T^BM0Az$hrF*O~^%$RuFp~)fx-;%f^ zx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+M z{lmjwC*nUDx4+0w;O^JkU--BGI@F&G++XCU#rEs%PmACAxc}PlCnNV4`DqCEN(?pVRk$?dm6E_YYT2|H;)K{N3MN{yl^DH>XAZ&Hr1M|BBE1 zN0t2o^=Go)A5a`nfAb#y`9=H|{a>JdrSAP1>d!Q~SsDI@%+-tt=t`dbD6)%aEWSNUnY@cQ_BSNp~IFDc-^ z3*~20`iuPZhD!9Gz5QK6`3J(^C#k<-6!{zfmk7V6tp5!3^DhT~9*+M2+N1vOit-ca akHJ}93i7pC{~QdFKxiOAK$>WNKK(!OnaF7X literal 0 HcmV?d00001 diff --git a/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentIntegrator.java b/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentIntegrator.java deleted file mode 100644 index 7ba0f0f..0000000 --- a/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentIntegrator.java +++ /dev/null @@ -1,423 +0,0 @@ -/** - * Copyright 2009 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.integration.android; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; - -/** - *

A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple - * way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the - * project's source code.

- * - *

Initiating a barcode scan

- * - *

To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait - * for the result in your app.

- * - *

It does require that the Barcode Scanner (or work-alike) application is installed. The - * {@link #initiateScan()} method will prompt the user to download the application, if needed.

- * - *

There are a few steps to using this integration. First, your {@link Activity} must implement - * the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:

- * - *
{@code
- * public void onActivityResult(int requestCode, int resultCode, Intent intent) {
- *   IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
- *   if (scanResult != null) {
- *     // handle scan result
- *   }
- *   // else continue with any other code you need in the method
- *   ...
- * }
- * }
- * - *

This is where you will handle a scan result.

- * - *

Second, just call this in response to a user action somewhere to begin the scan process:

- * - *
{@code
- * IntentIntegrator integrator = new IntentIntegrator(yourActivity);
- * integrator.initiateScan();
- * }
- * - *

Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the - * user was prompted to download the application. This lets the calling app potentially manage the dialog. - * In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()} - * method.

- * - *

You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use - * {@link #setTitleByID(int)} to set the title by string resource ID.) Likewise, the prompt message, and - * yes/no button labels can be changed.

- * - *

Finally, you can use {@link #addExtra(String, Object)} to add more parameters to the Intent used - * to invoke the scanner. This can be used to set additional options not directly exposed by this - * simplified API.

- * - *

By default, this will only allow applications that are known to respond to this intent correctly - * do so. The apps that are allowed to response can be set with {@link #setTargetApplications(List)}. - * For example, set to {@link #TARGET_BARCODE_SCANNER_ONLY} to only target the Barcode Scanner app itself.

- * - *

Sharing text via barcode

- * - *

To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(CharSequence)}.

- * - *

Some code, particularly download integration, was contributed from the Anobiit application.

- * - *

Enabling experimental barcode formats

- * - *

Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as - * PDF417. Use {@link #initiateScan(java.util.Collection)} with - * a collection containing the names of formats to scan for explicitly, like "PDF_417", to use such - * formats.

- * - * @author Sean Owen - * @author Fred Lin - * @author Isaac Potoczny-Jones - * @author Brad Drehmer - * @author gcstang - */ -public class IntentIntegrator { - - public static final int REQUEST_CODE = 0x0000c0de; // Only use bottom 16 bits - private static final String TAG = IntentIntegrator.class.getSimpleName(); - - public static final String DEFAULT_TITLE = "Install Barcode Scanner?"; - public static final String DEFAULT_MESSAGE = - "This application requires Barcode Scanner. Would you like to install it?"; - public static final String DEFAULT_YES = "Yes"; - public static final String DEFAULT_NO = "No"; - - private static final String BS_PACKAGE = "com.google.zxing.client.android"; - private static final String BSPLUS_PACKAGE = "com.srowen.bs.android"; - - // supported barcode formats - public static final Collection PRODUCT_CODE_TYPES = list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "RSS_14"); - public static final Collection ONE_D_CODE_TYPES = - list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "CODE_39", "CODE_93", "CODE_128", - "ITF", "RSS_14", "RSS_EXPANDED"); - public static final Collection QR_CODE_TYPES = Collections.singleton("QR_CODE"); - public static final Collection DATA_MATRIX_TYPES = Collections.singleton("DATA_MATRIX"); - - public static final Collection ALL_CODE_TYPES = null; - - public static final List TARGET_BARCODE_SCANNER_ONLY = Collections.singletonList(BS_PACKAGE); - public static final List TARGET_ALL_KNOWN = list( - BSPLUS_PACKAGE, // Barcode Scanner+ - BSPLUS_PACKAGE + ".simple", // Barcode Scanner+ Simple - BS_PACKAGE // Barcode Scanner - // What else supports this intent? - ); - - private final Activity activity; - private String title; - private String message; - private String buttonYes; - private String buttonNo; - private List targetApplications; - private final Map moreExtras; - - public IntentIntegrator(Activity activity) { - this.activity = activity; - title = DEFAULT_TITLE; - message = DEFAULT_MESSAGE; - buttonYes = DEFAULT_YES; - buttonNo = DEFAULT_NO; - targetApplications = TARGET_ALL_KNOWN; - moreExtras = new HashMap(3); - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public void setTitleByID(int titleID) { - title = activity.getString(titleID); - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setMessageByID(int messageID) { - message = activity.getString(messageID); - } - - public String getButtonYes() { - return buttonYes; - } - - public void setButtonYes(String buttonYes) { - this.buttonYes = buttonYes; - } - - public void setButtonYesByID(int buttonYesID) { - buttonYes = activity.getString(buttonYesID); - } - - public String getButtonNo() { - return buttonNo; - } - - public void setButtonNo(String buttonNo) { - this.buttonNo = buttonNo; - } - - public void setButtonNoByID(int buttonNoID) { - buttonNo = activity.getString(buttonNoID); - } - - public Collection getTargetApplications() { - return targetApplications; - } - - public final void setTargetApplications(List targetApplications) { - if (targetApplications.isEmpty()) { - throw new IllegalArgumentException("No target applications"); - } - this.targetApplications = targetApplications; - } - - public void setSingleTargetApplication(String targetApplication) { - this.targetApplications = Collections.singletonList(targetApplication); - } - - public Map getMoreExtras() { - return moreExtras; - } - - public final void addExtra(String key, Object value) { - moreExtras.put(key, value); - } - - /** - * Initiates a scan for all known barcode types. - */ - public final AlertDialog initiateScan() { - return initiateScan(ALL_CODE_TYPES); - } - - /** - * Initiates a scan only for a certain set of barcode types, given as strings corresponding - * to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants - * like {@link #PRODUCT_CODE_TYPES} for example. - * - * @return the {@link AlertDialog} that was shown to the user prompting them to download the app - * if a prompt was needed, or null otherwise - */ - public final AlertDialog initiateScan(Collection desiredBarcodeFormats) { - Intent intentScan = new Intent(BS_PACKAGE + ".SCAN"); - intentScan.addCategory(Intent.CATEGORY_DEFAULT); - - // check which types of codes to scan for - if (desiredBarcodeFormats != null) { - // set the desired barcode types - StringBuilder joinedByComma = new StringBuilder(); - for (String format : desiredBarcodeFormats) { - if (joinedByComma.length() > 0) { - joinedByComma.append(','); - } - joinedByComma.append(format); - } - intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); - } - - String targetAppPackage = findTargetAppPackage(intentScan); - if (targetAppPackage == null) { - return showDownloadDialog(); - } - intentScan.setPackage(targetAppPackage); - intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - attachMoreExtras(intentScan); - startActivityForResult(intentScan, REQUEST_CODE); - return null; - } - - /** - * Start an activity. This method is defined to allow different methods of activity starting for - * newer versions of Android and for compatibility library. - * - * @param intent Intent to start. - * @param code Request code for the activity - * @see android.app.Activity#startActivityForResult(Intent, int) - * @see android.app.Fragment#startActivityForResult(Intent, int) - */ - protected void startActivityForResult(Intent intent, int code) { - activity.startActivityForResult(intent, code); - } - - private String findTargetAppPackage(Intent intent) { - PackageManager pm = activity.getPackageManager(); - List availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - if (availableApps != null) { - for (String targetApp : targetApplications) { - if (contains(availableApps, targetApp)) { - return targetApp; - } - } - } - return null; - } - - private static boolean contains(Iterable availableApps, String targetApp) { - for (ResolveInfo availableApp : availableApps) { - String packageName = availableApp.activityInfo.packageName; - if (targetApp.equals(packageName)) { - return true; - } - } - return false; - } - - private AlertDialog showDownloadDialog() { - AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); - downloadDialog.setTitle(title); - downloadDialog.setMessage(message); - downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - String packageName = targetApplications.get(0); - Uri uri = Uri.parse("market://details?id=" + packageName); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - try { - activity.startActivity(intent); - } catch (ActivityNotFoundException anfe) { - // Hmm, market is not installed - Log.w(TAG, "Google Play is not installed; cannot install " + packageName); - } - } - }); - downloadDialog.setNegativeButton(buttonNo, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) {} - }); - return downloadDialog.show(); - } - - - /** - *

Call this from your {@link Activity}'s - * {@link Activity#onActivityResult(int, int, Intent)} method.

- * - * @return null if the event handled here was not related to this class, or - * else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning, - * the fields will be null. - */ - public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { - if (requestCode == REQUEST_CODE) { - if (resultCode == Activity.RESULT_OK) { - String contents = intent.getStringExtra("SCAN_RESULT"); - String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT"); - byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES"); - int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE); - Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation; - String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL"); - return new IntentResult(contents,formatName); - } - return new IntentResult("",""); - } - return null; - } - - - /** - * Defaults to type "TEXT_TYPE". - * @see #shareText(CharSequence, CharSequence) - */ - public final AlertDialog shareText(CharSequence text) { - return shareText(text, "TEXT_TYPE"); - } - - /** - * Shares the given text by encoding it as a barcode, such that another user can - * scan the text off the screen of the device. - * - * @param text the text string to encode as a barcode - * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants. - * @return the {@link AlertDialog} that was shown to the user prompting them to download the app - * if a prompt was needed, or null otherwise - */ - public final AlertDialog shareText(CharSequence text, CharSequence type) { - Intent intent = new Intent(); - intent.addCategory(Intent.CATEGORY_DEFAULT); - intent.setAction(BS_PACKAGE + ".ENCODE"); - intent.putExtra("ENCODE_TYPE", type); - intent.putExtra("ENCODE_DATA", text); - String targetAppPackage = findTargetAppPackage(intent); - if (targetAppPackage == null) { - return showDownloadDialog(); - } - intent.setPackage(targetAppPackage); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - attachMoreExtras(intent); - activity.startActivity(intent); - return null; - } - - private static List list(String... values) { - return Collections.unmodifiableList(Arrays.asList(values)); - } - - private void attachMoreExtras(Intent intent) { - for (Map.Entry entry : moreExtras.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - // Kind of hacky - if (value instanceof Integer) { - intent.putExtra(key, (Integer) value); - } else if (value instanceof Long) { - intent.putExtra(key, (Long) value); - } else if (value instanceof Boolean) { - intent.putExtra(key, (Boolean) value); - } else if (value instanceof Double) { - intent.putExtra(key, (Double) value); - } else if (value instanceof Float) { - intent.putExtra(key, (Float) value); - } else if (value instanceof Bundle) { - intent.putExtra(key, (Bundle) value); - } else { - intent.putExtra(key, value.toString()); - } - } - } - -} \ No newline at end of file diff --git a/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentResult.java b/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentResult.java deleted file mode 100644 index d4c69c0..0000000 --- a/Personnel/justin/lab inventory/src/com/google/zxing/integration/android/IntentResult.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2009 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.integration.android; - -/** - *

Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.

- * - * @author Sean Owen - */ -public final class IntentResult { - - private final String contents; - private final String formatName; - - IntentResult(String contents, String formatName) { - this.contents = contents; - this.formatName = formatName; - } - - /** - * @return raw content of barcode - */ - public String getContents() { - return contents; - } - - /** - * @return name of format, like "QR_CODE", "UPC_A". See BarcodeFormat for more format names. - */ - public String getFormatName() { - return formatName; - } - -} diff --git a/Personnel/justin/lab inventory/src/com/jaiswallab/lab/inventory/MainActivity.java b/Personnel/justin/lab inventory/src/com/jaiswallab/lab/inventory/MainActivity.java index 65fa0b1..7664104 100644 --- a/Personnel/justin/lab inventory/src/com/jaiswallab/lab/inventory/MainActivity.java +++ b/Personnel/justin/lab inventory/src/com/jaiswallab/lab/inventory/MainActivity.java @@ -62,7 +62,7 @@ public class MainActivity extends Activity { if (scanResult != null) { String contents = scanResult.getContents(); if(printingNewQR) { - addNewQR(contents); + // addNewQR(contents); } else if(recognizingQR){ displayQRInfo(contents); } @@ -77,7 +77,7 @@ public class MainActivity extends Activity { //this will use the information passed to it to create a new ID in the database //it will also use any input from a variety of text edits in order to populate the database entry //can we store pictures in the database if desired? - public void addNewQR(String id) { +/* public void addNewQR(String id) { return; int rand1 = (int) (100*Math.random()); int rand2 = (int) (100*Math.random()); @@ -104,7 +104,7 @@ public class MainActivity extends Activity { } } - + */ //this will use the information passed to it to reference an existing ID in the database -- 2.34.1