(5);
+ lastPossibleResultPoints = currentPossible;
+ paint.setAlpha(OPAQUE);
+ paint.setColor(resultPointColor);
+ for (ResultPoint point : currentPossible) {
+ canvas.drawCircle(frame.left + point.getX(), frame.top
+ + point.getY(), 6.0f, paint);
+ }
+ }
+ if (currentLast != null) {
+ paint.setAlpha(OPAQUE / 2);
+ paint.setColor(resultPointColor);
+ for (ResultPoint point : currentLast) {
+ canvas.drawCircle(frame.left + point.getX(), frame.top
+ + point.getY(), 3.0f, paint);
+ }
+ }
+
+
+ //只刷新扫描框的内容,其他地方不刷新
+ postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top,
+ frame.right, frame.bottom);
+
+ }
+ }
+
+ public void drawViewfinder() {
+ resultBitmap = null;
+ invalidate();
+ }
+
+ /**
+ * Draw a bitmap with the result points highlighted instead of the live
+ * scanning display.
+ *
+ * @param barcode
+ * An image of the decoded barcode.
+ */
+ public void drawResultBitmap(Bitmap barcode) {
+ resultBitmap = barcode;
+ invalidate();
+ }
+
+ public void addPossibleResultPoint(ResultPoint point) {
+ possibleResultPoints.add(point);
+ }
+
+}
diff --git a/app/src/main/java/com/motorolasolutions/adc/decoder/BarCodeReader.java b/app/src/main/java/com/motorolasolutions/adc/decoder/BarCodeReader.java
new file mode 100644
index 0000000..9deb2d5
--- /dev/null
+++ b/app/src/main/java/com/motorolasolutions/adc/decoder/BarCodeReader.java
@@ -0,0 +1,3227 @@
+/*
+ * BarCodeReader.java
+ *
+ * Class used to access a Motorola Solutions imaging bar code reader.
+ *
+ * Copyright (C) 2011 Motorola Solutions, Inc.
+ */
+
+package com.motorolasolutions.adc.decoder;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.io.IOException;
+
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.graphics.ImageFormat;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+
+/**
+ * The BarCodeReader class is used to set bar code reader settings, start/stop
+ * preview, snap pictures, and capture frames for encoding for video. This class
+ * is a client for the Camera service, which manages the actual Camera hardware.
+ *
+ *
+ * To decode bar codes with this class, use the following steps:
+ *
+ *
+ *
+ * - Obtain an instance of BarCodeReader with {@link #open(int)}.
+ *
+ *
- Get the current settings with {@link #getParameters()}.
+ *
+ *
- If necessary, modify the returned {@link Parameters} object
+ * and call {@link #setParameters(Parameters)}.
+ *
+ *
- Call {@link #setDecodeCallback(DecodeCallback)} to register
+ * a bar code decode event handler.
+ *
+ *
- If a view finder is desired, pass a fully initialized
+ * {@link SurfaceHolder} to {@link #setPreviewDisplay(SurfaceHolder)}.
+ *
+ *
- To begin a decode session, call {@link #startDecode()} or
+ * {@link #startHandsFreeDecode(int)}. Your registered DecodeCallback will be
+ * called when a successful decode occurs or if the configured timeout expires.
+ *
+ *
- Call {@link #stopDecode()} to end the decode session.
+ *
+ *
- Important: Call {@link #release()} to release the BarCodeReader
+ * for use by other applications. Applications should release the BarCodeReader
+ * immediately in {@link android.app.Activity#onPause()} (and re-{@link #open()}
+ * it in {@link android.app.Activity#onResume()}).
+ *
+ *
+ *
+ * This class is not thread-safe, and is meant for use from one event thread.
+ * Callbacks will be invoked on the event thread {@link #open(int)} was called
+ * from. This class's methods must never be called from multiple threads at
+ * once.
+ *
+ */
+
+public class BarCodeReader {
+ private static final String TAG = "BarCodeReader";
+
+ // These match the enums in frameworks/base/include/bcreader/BCReader.h
+ private static final int BCRDR_MSG_ERROR = 0x000001;
+ private static final int BCRDR_MSG_SHUTTER = 0x000002;
+ private static final int BCRDR_MSG_FOCUS = 0x000004;
+ private static final int BCRDR_MSG_ZOOM = 0x000008;
+ private static final int BCRDR_MSG_PREVIEW_FRAME = 0x000010;
+ private static final int BCRDR_MSG_VIDEO_FRAME = 0x000020;
+ private static final int BCRDR_MSG_POSTVIEW_FRAME = 0x000040;
+ private static final int BCRDR_MSG_RAW_IMAGE = 0x000080;
+ private static final int BCRDR_MSG_COMPRESSED_IMAGE = 0x000100;
+ // Add bar code reader specific values here
+ private static final int BCRDR_MSG_DECODE_COMPLETE = 0x010000;
+ private static final int BCRDR_MSG_DECODE_TIMEOUT = 0x020000;
+ private static final int BCRDR_MSG_DECODE_CANCELED = 0x040000;
+ private static final int BCRDR_MSG_DECODE_ERROR = 0x080000;
+ private static final int BCRDR_MSG_DECODE_EVENT = 0x100000;
+ private static final int BCRDR_MSG_FRAME_ERROR = 0x200000;
+ private static final int BCRDR_MSG_ALL_MSGS = 0x3F01FF;
+
+ private static final int DECODE_MODE_PREVIEW = 1;
+ private static final int DECODE_MODE_VIEWFINDER = 2;
+ private static final int DECODE_MODE_VIDEO = 3;
+
+ private int mNativeContext; // accessed by native methods
+ private EventHandler mEventHandler;
+ private AutoFocusCallback mAutoFocusCallback;
+ private DecodeCallback mDecodeCallback;
+ private ErrorCallback mErrorCallback;
+ private VideoCallback mVideoCallback;
+ private PictureCallback mSnapshotCallback;
+ private PreviewCallback mPreviewCallback;
+ private OnZoomChangeListener mZoomListener;
+ private boolean mOneShot;
+ private boolean mWithBuffer;
+
+ // ///////////////////////////////////////////////////////////////
+ // Private native functions
+ // ///////////////////////////////////////////////////////////////
+
+ private native final void native_autoFocus();
+
+ private native final void native_cancelAutoFocus();
+
+ private native final String native_getParameters();
+
+ private native final void native_release();
+
+ private native final int setNumParameter(int paramNum, int paramVal);
+
+ private native final int setStrParameter(int paramNum, String paramVal);
+
+ private native final void native_setParameters(String params);
+
+ private native final void native_setup(Object reader_this, int readerId);
+
+ private native final void native_startPreview(int mode);
+
+ private native final void native_takePicture();
+
+ private native final void setHasPreviewCallback(boolean installed,
+ boolean manualBuffer);
+
+ private native final void setPreviewDisplay(Surface surface);
+
+ // ///////////////////////////////////////////////////////////////
+ // Public native functions
+ // ///////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the number of physical readers available on this device.
+ */
+ public native static int getNumberOfReaders();
+
+ /**
+ * Returns the information about a particular reader. If
+ * {@link #getNumberOfReaders()} returns N, the valid id is 0 to N-1.
+ */
+ public native static void getReaderInfo(int readerId,
+ ReaderInfo readerInfo);
+
+ /**
+ * Re-locks the reader to prevent other processes from accessing it.
+ * BarCodeReader objects are locked by default unless {@link #unlock()} is
+ * called. Normally {@link #reconnect()} is used instead.
+ *
+ *
+ * If you are not recording video, you probably do not need this method.
+ *
+ * @throws RuntimeException
+ * if the reader cannot be re-locked (for example, if the reader
+ * is still in use by another process).
+ */
+ public native final void lock();
+
+ /**
+ * Unlocks the reader to allow another process to access it. Normally, the
+ * reader is locked to the process with an active BarCodeReader object until
+ * {@link #release()} is called. To allow rapid handoff between processes,
+ * you can call this method to release the reader temporarily for another
+ * process to use; once the other process is done you can call
+ * {@link #reconnect()} to reclaim the reader.
+ *
+ *
+ * This must be done before calling
+ * {@link android.media.MediaRecorder#setCamera(BarCodeReader)}.
+ *
+ *
+ * If you are not recording video, you probably do not need this method.
+ *
+ * @throws RuntimeException
+ * if the reader cannot be unlocked.
+ */
+ public native final void unlock();
+
+ /**
+ * Reconnects to the reader service after another process used it. After
+ * {@link #unlock()} is called, another process may use the reader; when the
+ * process is done, you must reconnect to the reader, which will re-acquire
+ * the lock and allow you to continue using the reader.
+ *
+ *
+ * This must be done after {@link android.media.MediaRecorder} is done
+ * recording if {@link android.media.MediaRecorder#setReader(BarCodeReader)}
+ * was used.
+ *
+ *
+ * If you are not recording video, you probably do not need this method.
+ *
+ * @throws IOException
+ * if a connection cannot be re-established (for example, if the
+ * reader is still in use by another process).
+ */
+ public native final void reconnect() throws IOException;
+
+ /**
+ * Returns the value of a specified bar code reader numeric property or
+ * BCR_ERROR if the specified property number is invalid.
+ */
+ public native final int getNumProperty(int propNum);
+
+ /**
+ * Returns the value of a specified bar code reader string property or null
+ * if the specified property number is invalid.
+ */
+ public native final String getStrProperty(int propNum);
+
+ /**
+ * Returns the value of a specified bar code reader numeric parameter or
+ * BCR_ERROR if the specified parameter number is invalid.
+ */
+ public native final int getNumParameter(int paramNum);
+
+ /**
+ * Returns the value of a specified bar code reader string parameter or
+ * BCR_ERROR if the specified parameter number is invalid.
+ */
+ public native final String getStrParameter(int paramNum);
+
+ /**
+ * Sets the value of a specified bar code reader numeric parameter. Returns
+ * BCR_SUCCESS if successful or BCR_ERROR if the specified parameter number
+ * or value is invalid.
+ */
+ public final int setParameter(int paramNum, int paramVal) {
+ return (setNumParameter(paramNum, paramVal));
+ }
+
+ /**
+ * Sets the value of a specified bar code reader string parameter.
+ *
+ * @param paramNum
+ * The parameter number to set
+ * @param paramVal
+ * The new value for the parameter
+ *
+ * @return BCR_SUCCESS if successful or BCR_ERROR if the specified parameter
+ * number or value is invalid.
+ */
+ public final int setParameter(int paramNum, String paramVal) {
+ return (setStrParameter(paramNum, paramVal));
+ }
+
+ /**
+ * Sets all bar code reader parameters to their default values.
+ */
+ public native final void setDefaultParameters();
+
+ /**
+ * Adds a pre-allocated buffer to the preview callback buffer queue.
+ * Applications can add one or more buffers to the queue. When a preview
+ * frame arrives and there is still at least one available buffer, the
+ * buffer will be used and removed from the queue. Then preview callback is
+ * invoked with the buffer. If a frame arrives and there is no buffer left,
+ * the frame is discarded. Applications should add buffers back when they
+ * finish processing the data in them.
+ *
+ *
+ * The size of the buffer is determined by multiplying the preview image
+ * width, height, and bytes per pixel. The width and height can be read from
+ * {@link Parameters#getPreviewSize()}. Bytes per pixel can be
+ * computed from {@link ImageFormat#getBitsPerPixel(int)} /
+ * 8, using the image format from
+ * {@link Parameters#getPreviewFormat()}.
+ *
+ *
+ * This method is only necessary when
+ * {@link #setPreviewCallbackWithBuffer(PreviewCallback)} is used. When
+ * {@link #setOneShotPreviewCallback(PreviewCallback)} is used, buffers are
+ * automatically allocated.
+ *
+ * @param callbackBuffer
+ * the buffer to add to the queue. The size should be width *
+ * height * bits_per_pixel / 8.
+ * @see #setPreviewCallbackWithBuffer(PreviewCallback)
+ */
+ public native final void addCallbackBuffer(byte[] callbackBuffer);
+
+ /**
+ * Starts capturing frames in video mode. If a surface has been supplied
+ * with {@link #setPreviewDisplay(SurfaceHolder)}, the frames will be drawn
+ * to the surface.
+ *
+ *
+ * {@link VideoCallback#onVideoFrame(format, width, height, byte[], BarCodeReader)}
+ * will be called when preview data becomes available. The data passed will
+ * be in the format and resolution specified by ParamNum.IMG_FILE_FORMAT and
+ * ParamNum.IMG_VIDEOSUB.
+ */
+ public final void startVideoCapture(VideoCallback cb) {
+ mVideoCallback = cb;
+ native_startPreview(DECODE_MODE_VIDEO);
+ }
+
+ /**
+ * Starts capturing frames in view finder mode in preparation of taking a
+ * snapshot. If a surface has been supplied with
+ * {@link #setPreviewDisplay(SurfaceHolder)}, the frames will be drawn to
+ * the surface.
+ */
+ public final void startViewFinder() {
+ native_startPreview(DECODE_MODE_VIEWFINDER);
+ }
+
+ /**
+ * Starts capturing frames in preview mode. If a surface has been supplied
+ * with {@link #setPreviewDisplay(SurfaceHolder)}, the frames will be drawn
+ * to the surface.
+ *
+ *
+ * If {@link #setOneShotPreviewCallback(PreviewCallback)} or
+ * {@link #setPreviewCallbackWithBuffer(PreviewCallback)} was
+ * called,
+ * {@link PreviewCallback#onPreviewFrame(byte[], BarCodeReader)}
+ * will be called when preview data becomes available.
+ *
+ *
+ * If {@link #setImageCallback(BarCodeReader.ImageCallback)} was called,
+ * {@link PreviewCallback#onVideoFrame(format, width, height, byte[], BarCodeReader)}
+ * will be called when preview data becomes available. The data passed will
+ * be in the format and resolution specified by ParamNum.IMG_FILE_FORMAT and
+ * ParamNum.IMG_VIDEOSUB.
+ */
+ public final void startPreview() {
+ native_startPreview(DECODE_MODE_PREVIEW);
+ }
+
+ /**
+ * Stops capturing and drawing preview frames to the surface, and resets the
+ * reader for a future call to {@link #startPreview()}.
+ */
+ public native final void stopPreview();
+
+ /**
+ * Starts capturing frames and passes the captured frames to the decoder. If
+ * a surface has been supplied with
+ * {@link #setPreviewDisplay(SurfaceHolder)}, the frames will be drawn to
+ * the surface. When a decode occurs or timeout expires and
+ * {@link #setDecodeCallback(DecodeCallback)} was called,
+ * {@link #BarCodeReader.DecodeCallback.onDecodeComplete(int, int, byte[], BarCodeReader)}
+ * will be called with the decode results.
+ */
+ public native final void startDecode();
+
+ /**
+ * Starts capturing frames and passes the captured frames to the decoder. If
+ * a surface has been supplied with
+ * {@link #setPreviewDisplay(SurfaceHolder)}, the frames will be drawn to
+ * the surface. If motion is detected, a motion event is generated. If a
+ * decode occurs a decode event is generated. Decoding continues until
+ * {@link #stopDecode()} is called.
+ *
+ * @param mode
+ * Indicates the trigger mode to use. It must be either
+ * {@link #ParamVal.HANDSFREE} or {@link #ParamVal.AUTO_AIM}.
+ *
+ * @return BCR_SUCCESS if hands-free mode is successfully started or
+ * BCR_ERROR if an invalid mode is specified or if a decode session
+ * is already in progress.
+ */
+ public native final int startHandsFreeDecode(int mode);
+
+ /**
+ * Stops capturing and decoding frames.
+ */
+ public native final void stopDecode();
+
+ /**
+ * Return current preview state.
+ *
+ * FIXME: Unhide before release
+ *
+ * @hide
+ */
+ public native final boolean previewEnabled();
+
+ /**
+ * Zooms to the requested value smoothly. The driver will notify
+ * {@link OnZoomChangeListener} of the zoom value and whether zoom is
+ * stopped at the time. For example, suppose the current zoom is 0 and
+ * startSmoothZoom is called with value 3. The
+ * {@link OnZoomChangeListener#onZoomChange(int, boolean, BarCodeReader)}
+ * method will be called three times with zoom values 1, 2, and 3.
+ * Applications can call {@link #stopSmoothZoom} to stop the zoom earlier.
+ * Applications should not call startSmoothZoom again or change the zoom
+ * value before zoom stops. If the supplied zoom value equals to the current
+ * zoom value, no zoom callback will be generated. This method is supported
+ * if
+ * {@link Parameters#isSmoothZoomSupported}
+ * returns true.
+ *
+ * @param value
+ * zoom value. The valid range is 0 to
+ * {@link Parameters#getMaxZoom}
+ * .
+ * @throws IllegalArgumentException
+ * if the zoom value is invalid.
+ * @throws RuntimeException
+ * if the method fails.
+ * @see #setZoomChangeListener(OnZoomChangeListener)
+ */
+ public native final void startSmoothZoom(int value);
+
+ /**
+ * Stops the smooth zoom. Applications should wait for the
+ * {@link OnZoomChangeListener} to know when the zoom is actually stopped.
+ * This method is supported if
+ * {@link Parameters#isSmoothZoomSupported}
+ * is true.
+ *
+ * @throws RuntimeException
+ * if the method fails.
+ */
+ public native final void stopSmoothZoom();
+
+ /**
+ * Set the clockwise rotation of preview display in degrees. This affects
+ * the preview frames and the picture displayed after snapshot. This method
+ * is useful for portrait mode applications. Note that preview display of
+ * front-facing readers is flipped horizontally before the rotation, that
+ * is, the image is reflected along the central vertical axis of the reader
+ * sensor. So the users can see themselves as looking into a mirror.
+ *
+ *
+ * This does not affect the order of byte array passed in
+ * {@link PreviewCallback#onPreviewFrame}, JPEG pictures, or recorded
+ * videos. This method is not allowed to be called during preview.
+ *
+ *
+ * If you want to make the reader image show in the same orientation as the
+ * display, you can use the following code.
+ *
+ *
+ * #import com.motorolasolutions.adc.decoder;
+ *
+ * public static void setReaderDisplayOrientation(Activity activity, int readerId, BarCodeReader reader)
+ * {
+ * int result;
+ * int degrees = 0;
+ * int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
+ * BarCodeReader.ReaderInfo info = new BarCodeReader.ReaderInfo();
+ * BarCodeReader.getReaderInfo(readerId, info);
+ * switch (rotation)
+ * {
+ * case Surface.ROTATION_0:
+ * degrees = 0;
+ * break;
+ * case Surface.ROTATION_90:
+ * degrees = 90;
+ * break;
+ * case Surface.ROTATION_180:
+ * degrees = 180;
+ * break;
+ * case Surface.ROTATION_270:
+ * degrees = 270;
+ * break;
+ * default:
+ * break;
+ * }
+ *
+ * if ( info.facing == BarCodeReader.ReaderInfo.BCRDR_FACING_FRONT )
+ * {
+ * result = (info.orientation + degrees) % 360;
+ * result = (360 - result) % 360; // compensate the mirror
+ * }
+ * else
+ * {
+ * // back-facing
+ * result = (info.orientation - degrees + 360) % 360;
+ * }
+ * reader.setDisplayOrientation(result);
+ * }
+ *
+ *
+ * @param degrees
+ * the angle that the picture will be rotated clockwise. Valid
+ * values are 0, 90, 180, and 270. The starting position is 0
+ * (landscape).
+ * @see #setPreviewDisplay(SurfaceHolder)
+ */
+ public native final void setDisplayOrientation(int degrees);
+
+ // Result codes for functions that return and integer status
+
+ /**
+ * Function completed successfully
+ */
+ public static final int BCR_SUCCESS = 0;
+
+ /**
+ * Function failed
+ */
+ public static final int BCR_ERROR = -1;
+
+ // onDecodeComplete status codes passed as the length value
+
+ /**
+ * onDecodeComplete length value indicating that the decode timed out
+ */
+ public static final int DECODE_STATUS_TIMEOUT = 0;
+
+ /**
+ * onDecodeComplete length value indicating that the decode was canceled
+ */
+ public static final int DECODE_STATUS_CANCELED = -1;
+
+ /**
+ * onDecodeComplete length value indicating that an error occurred
+ */
+ public static final int DECODE_STATUS_ERROR = -2;
+
+ // Miscellaneous event ID's
+
+ /**
+ * Scan mode changed event ID
+ */
+ public static final int BCRDR_EVENT_SCAN_MODE_CHANGED = 5;
+
+ /**
+ * Motion detected event ID
+ */
+ public static final int BCRDR_EVENT_MOTION_DETECTED = 6;
+
+ /**
+ * Scanner reset event ID
+ */
+ public static final int BCRDR_EVENT_SCANNER_RESET = 7;
+
+ /**
+ * Unspecified reader error.
+ *
+ * @see ErrorCallback
+ */
+ public static final int BCRDR_ERROR_UNKNOWN = 1;
+
+ /**
+ * Media server died. In this case, the application must release the
+ * BarCodeReader object and instantiate a new one.
+ *
+ * @see ErrorCallback
+ */
+ public static final int BCRDR_ERROR_SERVER_DIED = 100;
+
+ /**
+ * Information about a bar code reader
+ */
+ public static class ReaderInfo {
+ /*
+ * The facing of the reader is opposite to that of the screen.
+ */
+ public static final int BCRDR_FACING_BACK = 0;
+
+ /**
+ * The facing of the reader is the same as that of the screen.
+ */
+ public static final int BCRDR_FACING_FRONT = 1;
+
+ /**
+ * The direction to which the reader faces. It must be BCRDR_FACING_BACK
+ * or BCRDR_FACING_FRONT.
+ */
+ public int facing;
+
+ /**
+ * The orientation of the reader image. The value is the angle that the
+ * reader image needs to be rotated clockwise so it shows correctly on
+ * the display in its natural orientation. It should be 0, 90, 180, or
+ * 270.
+ *
+ * For example, suppose a device has a naturally tall screen. The
+ * back-facing reader sensor is mounted in landscape. You are looking at
+ * the screen. If the top side of the reader sensor is aligned with the
+ * right edge of the screen in natural orientation, the value should be
+ * 90. If the top side of a front-facing reader sensor is aligned with
+ * the right of the screen, the value should be 270.
+ *
+ * @see #setDisplayOrientation(int)
+ * @see Parameters#setRotation(int)
+ * @see Parameters#setPreviewSize(int, int)
+ * @see Parameters#setPictureSize(int, int)
+ * @see Parameters#setJpegThumbnailSize(int, int)
+ */
+ public int orientation;
+ };
+
+ /**
+ * Parameter numbers
+ */
+ public static class ParamNum {
+ /* Name Number Min Max Default */
+ public static final short CODE39 = 0; // 0 1 1
+ public static final short UPCA = 1; // 0 1 1
+ public static final short UPCE = 2; // 0 1 1
+ public static final short EAN13 = 3; // 0 1 1
+ public static final short EAN8 = 4; // 0 1 1
+ public static final short D25 = 5; // 0 1 0
+ public static final short I25 = 6; // 0 1 1
+ public static final short CODABAR = 7; // 0 1 0
+ public static final short CODE128 = 8; // 0 1 1
+ public static final short CODE93 = 9; // 0 1 0
+ public static final short CODE11 = 10; // 0 1 0
+ public static final short MSI = 11; // 0 1 0
+ public static final short UPCE1 = 12; // 0 1 0
+ public static final short TRIOPTIC = 13; // 0 1 0
+ public static final short EAN128 = 14; // 0 1 1
+ public static final short PDF = 15; // 0 1 1
+ public static final short SUPPS = 16; // 0 12 SUPP_NONE
+ public static final short C39_FULL_ASCII = 17; // 0 1 0
+ public static final short C39_LEN1 = 18; // 0 55 2
+ public static final short C39_LEN2 = 19; // 0 55 55
+ public static final short D25_LEN1 = 20; // 0 55 12
+ public static final short D25_LEN2 = 21; // 0 55 0
+ public static final short I25_LEN1 = 22; // 0 55 14
+ public static final short I25_LEN2 = 23; // 0 55 0
+ public static final short CBR_LEN1 = 24; // 0 55 5
+ public static final short CBR_LEN2 = 25; // 0 55 55
+ public static final short C93_LEN1 = 26; // 0 55 4
+ public static final short C93_LEN2 = 27; // 0 55 55
+ public static final short C11_LEN1 = 28; // 0 55 4
+ public static final short C11_LEN2 = 29; // 0 55 55
+ public static final short MSI_LEN1 = 30; // 0 55 4
+ public static final short MSI_LEN2 = 31; // 0 55 55
+ public static final short UPCA_PREAM = 34; // 0 2 1
+ public static final short UPCE_PREAM = 35; // 0 2 1
+ public static final short UPCE1_PREAM = 36; // 0 2 1
+ public static final short UPCE_TO_A = 37; // 0 1 0
+ public static final short UPCE1_TO_A = 38; // 0 1 0
+ public static final short EAN8_TO_13 = 39; // 0 1 0
+ public static final short UPCA_CHK = 40; // 0 1 1
+ public static final short UPCE_CHK = 41; // 0 1 1
+ public static final short UPCE1_CHK = 42; // 0 1 1
+ public static final short XMIT_C39_CHK = 43; // 0 1 0
+ public static final short XMIT_I25_CHK = 44; // 0 1 0
+ public static final short XMIT_CODE_ID = 45; // 0 2 0
+ public static final short XMIT_MSI_CHK = 46; // 0 1 0
+ public static final short XMIT_C11_CHK = 47; // 0 1 0
+ public static final short C39_CHK_EN = 48; // 0 1 0
+ public static final short I25_CHK_TYPE = 49; // 0 2 0
+ public static final short MSI_CHK_1_2 = 50; // 0 1 0
+ public static final short MSI_CHK_SCHEME = 51; // 0 1 1
+ public static final short C11_CHK_TYPE = 52; // 0 2 0
+ public static final short CLSI = 54; // 0 1 0
+ public static final short NOTIS = 55; // 0 1 0
+ public static final short UPC_SEC_LEV = 77; // 0 3 1
+ public static final short LIN_SEC_LEV = 78; // 1 4 1
+ public static final short SUPP_REDUN = 80; // 2 30 10
+ public static final short I25_TO_EAN13 = 82; // 0 1 0
+ public static final short BOOKLAND = 83; // 0 1 0
+ public static final short ISBT_128 = 84; // 0 1 1
+ public static final short COUPON = 85; // 0 1 0
+ public static final short CODE32 = 86; // 0 1 0
+ public static final short POST_US1 = 89; // 0 1 1
+ public static final short POST_US2 = 90; // 0 1 1
+ public static final short POST_UK = 91; // 0 1 1
+ public static final short SIGNATURE = 93; // 0 1 0
+ public static final short XMIT_NO_READ = 94; // 0 1 0
+ public static final short POST_US_PARITY = 95; // 0 1 1
+ public static final short POST_UK_PARITY = 96; // 0 1 1
+ public static final short EMUL_EAN128 = 123; // 0 1 0
+ public static final short LASER_ON_PRIM = 136; // 5 99 99
+ public static final short LASER_OFF_PRIM = 137; // 0 99 6
+ public static final short PRIM_TRIG_MODE = 138; // N/A N/A LEVEL
+ public static final short C128_LEN1 = 209; // 0 55 0
+ public static final short C128_LEN2 = 210; // 0 55 0
+ public static final short ISBT_MAX_TRY = 223; // 0 0 10
+ public static final short UPDF = 227; // 0 1 0
+ public static final short C32_PREFIX = 231; // 0 1 0
+ public static final short POSTAL_JAP = 290; // 0 1 1
+ public static final short POSTAL_AUS = 291; // 0 1 1
+ public static final short DATAMATRIX = 292; // 0 1 1
+ public static final short QRCODE = 293; // 0 1 1
+ public static final short MAXICODE = 294; // 0 1 1
+ public static final short IMG_ILLUM = 298; // 0 1 1
+ public static final short IMG_AIM_SNAPSHOT = 300; // 0 1 1
+ public static final short IMG_CROP = 301; // 0 1 0
+ public static final short IMG_SUBSAMPLE = 302; // 0 3 0
+ public static final short IMG_BPP = 303; // 0 2 IMG_BPP_8
+ public static final short IMG_FILE_FORMAT = 304; // 1 4 IMG_FORMAT_JPEG
+ public static final short IMG_JPEG_QUAL = 305; // 5 100 65
+ public static final short IMG_AIM_MODE = 306; // 0 2 AIM_ON
+ public static final short IMG_SIG_FMT = 313; // 1 4 1
+ public static final short IMG_SIG_BPP = 314; // 0 2 IMG_BPP_8
+ public static final short IMG_CROP_TOP = 315; // 0 479 0
+ public static final short IMG_CROP_LEFT = 316; // 0 751 0
+ public static final short IMG_CROP_BOT = 317; // 0 479 479
+ public static final short IMG_CROP_RIGHT = 318; // 0 751 751
+ public static final short IMG_SNAPTIMEOUT = 323; // 0 9 0
+ public static final short IMG_VIDEOVF = 324; // 0 1 0
+ public static final short POSTAL_DUTCH = 326; // 0 1 1
+ public static final short RSS_14 = 338; // 0 1 1
+ public static final short RSS_LIM = 339; // 0 1 0
+ public static final short RSS_EXP = 340; // 0 1 0
+ public static final short CCC_ENABLE = 341; // 0 1 0
+ public static final short CCAB_ENABLE = 342; // 0 1 0
+ public static final short UPC_COMPOSITE = 344; // 0 2 UPC_ALWAYS
+ public static final short IMG_IMAGE_ILLUM = 361; // 0 1 1
+ public static final short SIGCAP_WIDTH = 366; // 16 752 400
+ public static final short SIGCAP_HEIGHT = 367; // 16 480 100
+ public static final short TCIF = 371; // 0 1 0
+ public static final short MARGIN_RATIO = 381; // N/A N/A 6
+ public static final short DEMOTE_RSS = 397; // 0 1 0
+ public static final short PICKLIST_MODE = 402; // 0 2 PICKLIST_NEVER
+ public static final short C25 = 408; // 0 1 0
+ public static final short IMAGE_SIG_JPEG_QUALITY = 421; // 5 100 65
+ public static final short EMUL_UCCEAN128 = 427; // 0 1 0
+ public static final short MIRROR_IMAGE = 537; // 0 2 MIRROR_NEVER
+ public static final short IMG_ENHANCEMENT = 564; // 0 4 IMG_ENHANCE_OFF
+ public static final short UQR_EN = 573; // 0 1 1
+ public static final short AZTEC = 574; // 0 1 1
+ public static final short BOOKLAND_FORMAT = 576; // 0 1 0
+ public static final short ISBT_CONCAT_MODE = 577; // 0 0
+ // ISBT_CONCAT_NONE
+ public static final short CHECK_ISBT_TABLE = 578; // 0 0 1
+ public static final short SUPP_USER_1 = 579; // N/A N/A 0xFFFF
+ public static final short SUPP_USER_2 = 580; // N/A N/A 0xFFFF
+ public static final short K35 = 581; // 0 1 0
+ public static final short ONE_D_INVERSE = 586; // 0 2 REGULAR_ONLY
+ public static final short QR_INVERSE = 587; // 0 2 REGULAR_ONLY
+ public static final short DATAMATRIX_INVERSE = 588; // 0 2 REGULAR_ONLY
+ public static final short AZTEC_INVERSE = 589; // 0 2 REGULAR_ONLY
+ public static final short AIMMODEHANDSFREE = 590; // 0 1 AIM_ON
+ public static final short POST_US3 = 592; // 0 1 0
+ public static final short POST_US4 = 611; // 0 1 0
+ public static final short ISSN_EAN_EN = 617; // 0 1 0
+ public static final short MATRIX_25_EN = 618; // 0 1 0
+ public static final short MATRIX_25_LEN1 = 619; // 0 55 14
+ public static final short MATRIX_25_LEN2 = 620; // 0 55 0
+ public static final short MATRIX_25_REDUN = 621; // 0 1 0
+ public static final short MATRIX_25_CHK_EN = 622; // 0 1 0
+ public static final short MATRIX_25_XMIT_CHK = 623; // 0 1 0
+ public static final short AIMID_SUPP_FORMAT = 672; // 0 2 1
+ public static final short POST_AUS_FMT = 718; // 0 3 0
+ public static final short DATABAR_LIM_SEC_LEV = 728; // 0 4 3
+ public static final short COUPON_REPORT = 730; // 0 2 1
+ public static final short IMG_MOTIONILLUM = 762; // 0 1 1
+ };
+
+ public static class ParamVal {
+ /**
+ * Valid values for ParamNum.SUPPS
+ */
+ public static final byte SUPP_NONE = 0;
+ public static final byte SUPP_ONLY = 1;
+ public static final byte SUPP_AUTOD = 2;
+ public static final byte SUPP_SMART = 3;
+ public static final byte SUPP_378_379 = 4;
+ public static final byte SUPP_978_979 = 5;
+ public static final byte SUPP_414_419_434_439 = 6;
+ public static final byte SUPP_977 = 7;
+ public static final byte SUPP_491 = 8;
+ public static final byte SUPP_PROG_1 = 9;
+ public static final byte SUPP_PROG_1_AND_2 = 10;
+ public static final byte SUPP_SMART_PLUS_1 = 11;
+ public static final byte SUPP_SMART_PLUS_1_2 = 12;
+
+ /**
+ * Valid values for ParamNum.PRIM_TRIG_MODE
+ */
+ public static final byte LEVEL = 0; // Normal soft-trigger mode
+ public static final byte HANDSFREE = 7; // Presentation/hands-free
+ // trigger mode
+ public static final byte AUTO_AIM = 9; // Motion detection turns AIM
+ // reticle on
+
+ /**
+ * Valid values for ParamNum.IMG_BPP and ParamNum. IMG_SIG_BPP
+ */
+ public static final byte IMG_BPP_1 = 0;
+ public static final byte IMG_BPP_4 = 1;
+ public static final byte IMG_BPP_8 = 2;
+
+ /**
+ * Valid values for ParamNum.IMG_FILE_FORMAT
+ */
+ public static final byte IMG_FORMAT_JPEG = 1;
+ public static final byte IMG_FORMAT_BMP = 3;
+ public static final byte IMG_FORMAT_TIFF = 4;
+
+ /**
+ * Valid values for ParamNum.IMG_SUBSAMPLE and ParamNum.IMG_VIDEOSUB
+ */
+ public static final byte IMG_SUBSAMPLE_FACTOR_1 = 0; // Full size image
+ public static final byte IMG_SUBSAMPLE_FACTOR_2 = 1; // Width and height
+ // divided by 2
+ // (1/4 size)
+ public static final byte IMG_SUBSAMPLE_FACTOR_3 = 2; // Width and height
+ // divided by 3
+ // (1/9 size)
+ public static final byte IMG_SUBSAMPLE_FACTOR_4 = 3; // Width and height
+ // divided by 4
+ // (1/16 size)
+
+ /**
+ * Valid values for ParamNum.IMG_AIM_MODE and ParamNum.AIMMODEHANDSFREE
+ */
+ public static final byte AIM_OFF = 0;
+ public static final byte AIM_ON = 1;
+ public static final byte AIM_ON_ALWAYS = 2;
+
+ /**
+ * Valid values for ParamNum.UPC_COMPOSITE
+ */
+ public static final byte UPC_NEVER = 0;
+ public static final byte UPC_ALWAYS = 1;
+ public static final byte UPC_AUTOD = 2;
+
+ /**
+ * Valid values for ParamNum.PICKLIST_MODE
+ */
+ public static final byte PICKLIST_NEVER = 0;
+ public static final byte PICKLIST_OUT_OF_SCANSTAND = 1;
+ public static final byte PICKLIST_ALWAYS = 1;
+
+ /**
+ * Valid values for ParamNum.PICKLIST_MODE
+ */
+ public static final byte MIRROR_NEVER = 0;
+ public static final byte MIRROR_ALWAYS = 1;
+ public static final byte MIRROR_AUTO = 2;
+
+ /**
+ * Valid values for ParamNum.IMG_ENHANCEMENT
+ */
+ public static final byte IMG_ENHANCE_OFF = 0;
+ public static final byte IMG_ENHANCE_LOW = 1;
+ public static final byte IMG_ENHANCE_MED = 2;
+ public static final byte IMG_ENHANCE_HIGH = 3;
+ public static final byte IMG_ENHANCE_CUSTOM = 4;
+
+ /**
+ * Valid values for ParamNum.ISBT_CONCAT_MODE
+ */
+ public static final byte ISBT_CONCAT_NONE = 0;
+ public static final byte ISBT_CONCAT_ONLY = 1;
+ public static final byte ISBT_CONCAT_AUTOD = 2;
+
+ /**
+ * Valid values for ParamNum.*_INVERSE
+ */
+ public static final byte REGULAR_ONLY = 0;
+ public static final byte INVERSE_ONLY = 1;
+ public static final byte INVERSE_AUTOD = 2;
+
+ /**
+ * Valid values for ParamNum.PDF_SECURITY_LEVEL
+ */
+ public static final byte PDF_SECURITY_STRICT = 0;
+ public static final byte PDF_CWLEN_ZERO_OK = 1;
+ };
+
+ /**
+ * Property numbers used to get information from the scanner hardware.
+ */
+ public static class PropertyNum {
+ /**
+ * Property number used to get the scanner model number string
+ */
+ public static final int MODEL_NUMBER = 1;
+ /**
+ * Property number used to get the scanner serial number string
+ */
+ public static final int SERIAL_NUM = 2;
+ /**
+ * Property number used to get the maximum buffer size required for a
+ * frame
+ */
+ public static final int MAX_FRAME_BUFFER_SIZE = 3;
+ /**
+ * Property number used to get the scanner's horizontal resolution
+ */
+ public static final int HORIZONTAL_RES = 4;
+ /**
+ * Property number used to get the scanner's vertical resolution
+ */
+ public static final int VERTICAL_RES = 5;
+ /**
+ * Property number used to get the Image Kit version string
+ */
+ public static final int IMGKIT_VER = 6;
+ /**
+ * Property number used to get the Scan Engine version string
+ */
+ public static final int ENGINE_VER = 7;
+ }
+
+ /**
+ * Creates a new BarCodeReader object to access a particular hardware
+ * reader.
+ *
+ *
+ * You must call {@link #release()} when you are done using the reader,
+ * otherwise it will remain locked and be unavailable to other applications.
+ *
+ *
+ * Your application should only have one BarCodeReader object active at a
+ * time for a particular hardware reader.
+ *
+ *
+ * Callbacks from other methods are delivered to the event loop of the
+ * thread which called open(). If this thread has no event loop, then
+ * callbacks are delivered to the main application event loop. If there is
+ * no main application event loop, callbacks are not delivered.
+ *
+ *
+ * Caution: On some devices, this method may take a long time to
+ * complete. It is best to call this method from a worker thread (possibly
+ * using {@link android.os.AsyncTask}) to avoid blocking the main
+ * application UI thread.
+ *
+ * @param readerId
+ * the hardware reader to access, between 0 and
+ * {@link #getNumberOfReaders()}-1.
+ *
+ * @return a new BarCodeReader object, connected, locked and ready for use.
+ *
+ * @throws RuntimeException
+ * if connection to the reader service fails (for example, if
+ * the reader is in use by another process).
+ */
+ public static BarCodeReader open(int readerId) {
+ Log.i("info", "enter open");
+ return (new BarCodeReader(readerId));
+ }
+
+ /**
+ * Creates a new BarCodeReader object to access the first back-facing reader
+ * on the device. If the device does not have a back-facing reader, this
+ * returns null
+ *
+ * @see #open(int)
+ */
+ public static BarCodeReader open() {
+ ReaderInfo readerInfo;
+
+ int iIdx;
+ int iNumReaders;
+
+ iNumReaders = getNumberOfReaders();
+ readerInfo = new ReaderInfo();
+ for (iIdx = 0; iIdx < iNumReaders; ++iIdx) {
+ BarCodeReader.getReaderInfo(iIdx, readerInfo);
+ if (readerInfo.facing == ReaderInfo.BCRDR_FACING_BACK) {
+ return (new BarCodeReader(iIdx));
+ }
+ }
+ return (null);
+ }
+
+ BarCodeReader(int readerId) {
+ Looper aLooper;
+
+ mEventHandler = null;
+ mAutoFocusCallback = null;
+ mDecodeCallback = null;
+ mErrorCallback = null;
+ mPreviewCallback = null;
+ mSnapshotCallback = null;
+ mVideoCallback = null;
+ mZoomListener = null;
+
+ aLooper = Looper.myLooper();
+ if (null == aLooper)
+ aLooper = Looper.getMainLooper();
+ if (aLooper != null) {
+ mEventHandler = new EventHandler(this, aLooper);
+ }
+ Log.i("info","-----before native_setup---");
+ native_setup(new WeakReference(this), readerId);
+ Log.i("info","-----after native_setup---");
+ }
+
+ protected void finalize() {
+ native_release();
+ }
+
+ /**
+ * Disconnects and releases the BarCodeReader object resources.
+ *
+ *
+ * You must call this as soon as you're done with the BarCodeReader object.
+ *
+ */
+ public final void release() {
+ native_release();
+ }
+
+ /**
+ * Sets the {@link Surface} to be used for live preview. A surface is
+ * necessary for preview, and preview is necessary to take pictures. The
+ * same surface can be re-set without harm.
+ *
+ *
+ * The {@link SurfaceHolder} must already contain a surface when this method
+ * is called. If you are using {@link android.view.SurfaceView}, you will
+ * need to register a {@link SurfaceHolder.Callback} with
+ * {@link SurfaceHolder#addCallback(SurfaceHolder.Callback)} and wait for
+ * {@link SurfaceHolder.Callback#surfaceCreated(SurfaceHolder)} before
+ * calling setPreviewDisplay() or starting preview.
+ *
+ *
+ * This method must be called before {@link #startPreview()}. The one
+ * exception is that if the preview surface is not set (or set to null)
+ * before startPreview() is called, then this method may be called once with
+ * a non-null parameter to set the preview surface. (This allows reader
+ * setup and surface creation to happen in parallel, saving time.) The
+ * preview surface may not otherwise change while preview is running.
+ *
+ * @param holder
+ * containing the Surface on which to place the preview, or null
+ * to remove the preview surface
+ * @throws IOException
+ * if the method fails (for example, if the surface is
+ * unavailable or unsuitable).
+ */
+ public final void setPreviewDisplay(SurfaceHolder holder)
+ throws IOException {
+ if (holder != null) {
+ setPreviewDisplay(holder.getSurface());
+ } else {
+ setPreviewDisplay((Surface) null);
+ }
+ }
+
+ /**
+ * Callback interface used to notify on completion of reader auto focus.
+ *
+ *
+ * Devices that do not support auto-focus will receive a "fake" callback to
+ * this interface. If your application needs auto-focus and should not be
+ * installed on devices without auto-focus, you must declare that
+ * your app uses the
+ * {@code android.hardware.camera.autofocus} feature, in the
+ * <uses-feature>
+ * manifest element.
+ *
+ *
+ * @see #autoFocus(AutoFocusCallback)
+ */
+ public interface AutoFocusCallback {
+ /**
+ * Called when the reader auto focus completes. If the reader does not
+ * support auto-focus and autoFocus is called, onAutoFocus will be
+ * called immediately with a fake value of success set to
+ * true.
+ *
+ * @param success
+ * true if focus was successful, false if otherwise
+ * @param reader
+ * the BarCodeReader service object
+ */
+ void onAutoFocus(boolean success, BarCodeReader reader);
+ };
+
+ /**
+ * Starts reader auto-focus and registers a callback function to run when
+ * the reader is focused. This method is only valid when frame acquisition
+ * is active.
+ *
+ *
+ * Callers should check
+ * {@link Parameters#getFocusMode()}
+ * to determine if this method should be called. If the reader does not
+ * support auto-focus, it is a no-op and
+ * {@link AutoFocusCallback#onAutoFocus(boolean, BarCodeReader)} callback
+ * will be called immediately.
+ *
+ *
+ * If your application should not be installed on devices without
+ * auto-focus, you must declare that your application uses auto-focus with
+ * the <uses-feature>
+ * manifest element.
+ *
+ *
+ *
+ * If the current flash mode is not
+ * {@link Parameters#FLASH_MODE_OFF}
+ * , flash may be fired during auto-focus, depending on the driver and
+ * reader hardware.
+ *
+ *
+ * @param cb
+ * the callback to run
+ * @see #cancelAutoFocus()
+ */
+ public final void autoFocus(AutoFocusCallback cb) {
+ mAutoFocusCallback = cb;
+ native_autoFocus();
+ }
+
+ /**
+ * Cancels any auto-focus function in progress. Whether or not auto-focus is
+ * currently in progress, this function will return the focus position to
+ * the default. If the reader does not support auto-focus, this is a no-op.
+ *
+ * @see #autoFocus(AutoFocusCallback)
+ */
+ public final void cancelAutoFocus() {
+ mAutoFocusCallback = null;
+ native_cancelAutoFocus();
+ }
+
+ /**
+ * Callback interface used to deliver decode results.
+ *
+ * @see #setDecodeCallback(DecodeCallback)
+ * @see #startDecode()
+ */
+ public interface DecodeCallback {
+ /**
+ * Called when a decode operation has completed, either due to a
+ * timeout, a successful decode or canceled by the user. This callback
+ * is invoked on the event thread {@link #open(int)} was called from.
+ *
+ * @param symbology
+ * the symbology of decoded bar code if any
+ * @param status
+ * if positive, indicates the length of the bar code data,
+ * otherwise, DECODE_STATUS_TIMEOUT if the request timed out
+ * or DECODE_STATUS_CANCELED if stopDecode() is called before
+ * a successful decode or timeout.
+ * @param data
+ * the contents of the decoded bar code
+ * @param reader
+ * the BarCodeReader service object.
+ */
+ void onDecodeComplete(int symbology, int length, byte[] data,
+ BarCodeReader reader);
+
+ /**
+ * Called to indicate that the decoder detected an event such as MOTION
+ * DECTECTED. This callback is invoked on the event thread
+ * {@link #open(int)} was called from.
+ *
+ * @param event
+ * the type of event that has occurred
+ * @param info
+ * additional event information, if any, else zero
+ * @param data
+ * data associated with the event, if any, else null
+ * @param reader
+ * the BarCodeReader service object.
+ */
+ void onEvent(int event, int info, byte[] data, BarCodeReader reader);
+ };
+
+ /**
+ * Specifies whether or not automatic auto-focus should be performed during
+ * decode operations and if so, how many frames to initially wait before
+ * issuing the the first auto-focus request and how many frames to wait
+ * after receiving an auto-focus complete notification before issuing
+ * another request. An application should call
+ * {@link #Parameters.setFocusMode(String)} and
+ * {@link #setParameters(Parameters)} to set the focus mode to
+ * {@link #BarCodeReader.Parameters.FOCUS_MODE_AUTO}.
+ *
+ * When this function is used to enable automatic auto-focus requests,
+ * auto-focus callbacks are disabled. If an application needs to receive
+ * auto-focus callbacks, it should issue its own
+ * {@link #autoFocus(AutoFocusCallback)} requests and should not call this
+ * function.
+ *
+ * @param initialDelay
+ * the number of frames to process when a decode session is
+ * started before issuing the first auto-focus request. If this
+ * parameter is less than one and secondaryDelay is greater than
+ * zero, an auto-focus request will be issued as soon as the
+ * decode session is started. If both initialDelay and
+ * secondaryDelay are both less than one, no auto-focus requests
+ * will be issued.
+ * @param secondaryDelay
+ * the number of frames to process after receiving an auto-focus
+ * complete notification before issuing another auto-focus
+ * request. If this parameter is less than one, only the initial
+ * auto-focus request, if any, will be performed.
+ */
+ public native final void setAutoFocusDelay(int initialDelay,
+ int secondaryDelay);
+
+ /**
+ * Installs callbacks to be invoked when a decode request completes or a
+ * decoder event occurs. This method can be called at any time, even while a
+ * decode request is active. Any other decode callbacks are overridden.
+ *
+ * @param cb
+ * a callback object that receives a notification of a completed,
+ * decode request or null to stop receiving decode callbacks.
+ */
+ public final void setDecodeCallback(DecodeCallback cb) {
+ mDecodeCallback = cb;
+ }
+
+ /**
+ * Callback interface used to supply image data from a photo capture.
+ *
+ * @see #takePicture(PictureCallback)
+ */
+ public interface PictureCallback {
+ /**
+ * Called when image data is available after a picture is taken. The
+ * format of the data depends on the current value of the
+ * IMG_FILE_FORMAT and IMG_VIDEOSUB parameters.
+ *
+ * @param format
+ * format of the image (IMG_FORMAT_JPEG, IMG_FORMAT_BMP, or
+ * IMG_FORMAT_TIFF)
+ * @param with
+ * horizontal resolution of the image
+ * @param height
+ * vertical resolution of the image
+ * @param data
+ * a byte array of the picture data
+ * @param reader
+ * the BarCodeReader service object
+ */
+ void onPictureTaken(int format, int width, int height, byte[] data,
+ BarCodeReader reader);
+ };
+
+ /**
+ * Triggers an asynchronous image capture. The picture taken callback occurs
+ * when a scaled, fully processed image is available
+ *
+ *
+ * This method is only valid when the decoder is idle or view finder mode is
+ * active (after calling {@link #startViewFinder()}). Image capture will be
+ * stopped after the picture taken callback is called. Callers must call
+ * {@link #startViewFiner()} and/or takePicture() again if they want to
+ * re-start the view finder or take more pictures.
+ *
+ *
+ * After calling this method, you must not call {@link #startPreview()},
+ * {@link #startViewFinder()} or take another picture until the picture
+ * taken callback has returned.
+ *
+ * @param cb
+ * the callback for processed image data
+ */
+ public final void takePicture(PictureCallback cb) {
+ mSnapshotCallback = cb;
+ try {
+ native_takePicture();
+ } catch (Throwable thrw) {
+ // TODO: Call error callback?
+ }
+ }
+
+ /**
+ * Callback interface used to supply image data in video capture mode.
+ *
+ * @see #startVideoCapture(VideoCallback)
+ */
+ public interface VideoCallback {
+ /**
+ * Called when image data is available during video capture mode. The
+ * format of the data depends on the current value of the
+ * IMG_FILE_FORMAT and IMG_VIDEOSUB parameters.
+ *
+ * @param format
+ * format of the image (IMG_FORMAT_JPEG, IMG_FORMAT_BMP, or
+ * IMG_FORMAT_TIFF)
+ * @param with
+ * horizontal resolution of the image
+ * @param height
+ * vertical resolution of the image
+ * @param data
+ * a byte array of the video frame
+ * @param reader
+ * the BarCodeReader service object
+ */
+ void onVideoFrame(int format, int width, int height, byte[] data,
+ BarCodeReader reader);
+ };
+
+ /**
+ * Callback interface used to deliver copies of preview frames as they are
+ * displayed.
+ *
+ * @see #setOneShotPreviewCallback(PreviewCallback)
+ * @see #setPreviewCallbackWithBuffer(PreviewCallback)
+ * @see #startPreview()
+ */
+ public interface PreviewCallback {
+ /**
+ * Called as preview frames are displayed. This callback is invoked on
+ * the event thread {@link #open(int)} was called from.
+ *
+ * @param data
+ * the contents of the preview frame in the format defined by
+ * {@link ImageFormat}, which can be queried
+ * with
+ * {@link Parameters#getPreviewFormat()}
+ * . If
+ * {@link Parameters#setPreviewFormat(int)}
+ * is never called, the default will be the YCbCr_420_SP
+ * (NV21) format.
+ * @param reader
+ * the BarCodeReader service object.
+ */
+ void onPreviewFrame(byte[] data, BarCodeReader reader);
+ };
+
+ /**
+ * Installs a callback to be invoked for the next preview frame in addition
+ * to displaying it on the screen. After one invocation, the callback is
+ * cleared. This method can be called any time, even when preview is live.
+ * Any other preview callbacks are overridden.
+ *
+ * @param cb
+ * a callback object that receives a copy of the next preview
+ * frame, or null to stop receiving callbacks.
+ */
+ public final void setOneShotPreviewCallback(PreviewCallback cb) {
+ mPreviewCallback = cb;
+ mOneShot = true;
+ mWithBuffer = false;
+ setHasPreviewCallback(cb != null, false);
+ }
+
+ /**
+ * Installs a callback to be invoked for every preview frame, using buffers
+ * supplied with {@link #addCallbackBuffer(byte[])}, in addition to
+ * displaying them on the screen. The callback will be repeatedly called for
+ * as long as preview is active and buffers are available. Any other preview
+ * callbacks are overridden.
+ *
+ *
+ * The purpose of this method is to improve preview efficiency and frame
+ * rate by allowing preview frame memory reuse. You must call
+ * {@link #addCallbackBuffer(byte[])} at some point -- before or after
+ * calling this method -- or no callbacks will received.
+ *
+ * The buffer queue will be cleared if this method is called with a null
+ * callback or if
+ * {@link #setOneShotPreviewCallback(PreviewCallback)} is
+ * called.
+ *
+ * @param cb
+ * a callback object that receives a copy of the preview frame,
+ * or null to stop receiving callbacks and clear the buffer
+ * queue.
+ * @see #addCallbackBuffer(byte[])
+ */
+ public final void setPreviewCallbackWithBuffer(PreviewCallback cb) {
+ mPreviewCallback = cb;
+ mOneShot = false;
+ mWithBuffer = true;
+ setHasPreviewCallback(cb != null, true);
+ }
+
+ private class EventHandler extends Handler {
+ private BarCodeReader mReader;
+
+ public EventHandler(BarCodeReader rdr, Looper looper) {
+ super(looper);
+ mReader = rdr;
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ Log.v(TAG, String.format("Event message: %X, arg1=%d, arg2=%d",
+ msg.what, msg.arg1, msg.arg2));
+ switch (msg.what) {
+ case BCRDR_MSG_DECODE_COMPLETE:
+ if (mDecodeCallback != null) {
+ mDecodeCallback.onDecodeComplete(msg.arg1, msg.arg2,
+ (byte[]) msg.obj, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_DECODE_TIMEOUT:
+ if (mDecodeCallback != null) {
+ mDecodeCallback.onDecodeComplete(0, 0, (byte[]) msg.obj,
+ mReader);
+ }
+ return;
+
+ case BCRDR_MSG_DECODE_CANCELED:
+ if (mDecodeCallback != null) {
+ mDecodeCallback.onDecodeComplete(0, DECODE_STATUS_CANCELED,
+ (byte[]) msg.obj, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_FRAME_ERROR:
+ // TODO:
+ case BCRDR_MSG_DECODE_ERROR:
+ if (mDecodeCallback != null) {
+ mDecodeCallback.onDecodeComplete(0, DECODE_STATUS_ERROR,
+ (byte[]) msg.obj, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_DECODE_EVENT:
+ if (mDecodeCallback != null) {
+ mDecodeCallback.onEvent(msg.arg1, msg.arg2,
+ (byte[]) msg.obj, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_SHUTTER:
+ // We do not support the shutter callback
+ return;
+
+ case BCRDR_MSG_COMPRESSED_IMAGE:
+ if (mSnapshotCallback != null) {
+ int iCX;
+ int iCY;
+
+ iCX = (msg.arg1 >> 0) & 0xFFFF;
+ iCY = (msg.arg1 >> 16) & 0xFFFF;
+ mSnapshotCallback.onPictureTaken(msg.arg2, iCX, iCY,
+ (byte[]) msg.obj, mReader);
+ } else {
+ Log.e(TAG,
+ "BCRDR_MSG_COMPRESSED_IMAGE event with no snapshot callback");
+ }
+ return;
+
+ case BCRDR_MSG_VIDEO_FRAME:
+ if (mVideoCallback != null) {
+ int iCX;
+ int iCY;
+
+ iCX = (msg.arg1 >> 0) & 0xFFFF;
+ iCY = (msg.arg1 >> 16) & 0xFFFF;
+ mVideoCallback.onVideoFrame(msg.arg2, iCX, iCY,
+ (byte[]) msg.obj, mReader);
+ } else {
+ Log.e(TAG,
+ "BCRDR_MSG_VIDEO_FRAME event with no video callback");
+ }
+ return;
+
+ case BCRDR_MSG_PREVIEW_FRAME:
+ if (mPreviewCallback != null) {
+ PreviewCallback cb = mPreviewCallback;
+ if (mOneShot) {
+ // Clear the callback variable before the callback
+ // in case the app calls setOneShotPreviewCallback from
+ // the callback function
+ mPreviewCallback = null;
+ } else if (!mWithBuffer) {
+ // We're faking the reader preview mode to prevent
+ // the app from being flooded with preview frames.
+ // Set to one-shot mode again.
+ setHasPreviewCallback(true, false);
+ }
+ cb.onPreviewFrame((byte[]) msg.obj, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_FOCUS:
+ if (mAutoFocusCallback != null) {
+ mAutoFocusCallback.onAutoFocus(
+ msg.arg1 == 0 ? false : true, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_ZOOM:
+ if (mZoomListener != null) {
+ mZoomListener
+ .onZoomChange(msg.arg1, msg.arg2 != 0, mReader);
+ }
+ return;
+
+ case BCRDR_MSG_ERROR:
+ Log.e(TAG, "Error " + msg.arg1);
+ if (mErrorCallback != null) {
+ mErrorCallback.onError(msg.arg1, mReader);
+ }
+ return;
+
+ default:
+ Log.e(TAG, "Unknown message type " + msg.what);
+ return;
+ }
+ }
+ };
+
+ private static void postEventFromNative(Object reader_ref, int what,
+ int arg1, int arg2, Object obj) {
+ @SuppressWarnings("unchecked")
+ BarCodeReader c = (BarCodeReader) ((WeakReference) reader_ref)
+ .get();
+ if ((c != null) && (c.mEventHandler != null)) {
+ Message m = c.mEventHandler.obtainMessage(what, arg1, arg2, obj);
+ c.mEventHandler.sendMessage(m);
+ }
+ }
+
+ /**
+ * Callback interface for zoom changes during a smooth zoom operation.
+ *
+ * @see #setZoomChangeListener(OnZoomChangeListener)
+ * @see #startSmoothZoom(int)
+ */
+ public interface OnZoomChangeListener {
+ /**
+ * Called when the zoom value has changed during a smooth zoom.
+ *
+ * @param zoomValue
+ * the current zoom value. In smooth zoom mode, reader calls
+ * this for every new zoom value.
+ * @param stopped
+ * whether smooth zoom is stopped. If the value is true, this
+ * is the last zoom update for the application.
+ * @param reader
+ * the BarCodeReader service object
+ */
+ void onZoomChange(int zoomValue, boolean stopped, BarCodeReader reader);
+ };
+
+ /**
+ * Registers a listener to be notified when the zoom value is updated by the
+ * reader driver during smooth zoom.
+ *
+ * @param listener
+ * the listener to notify
+ * @see #startSmoothZoom(int)
+ */
+ public final void setZoomChangeListener(OnZoomChangeListener listener) {
+ mZoomListener = listener;
+ }
+
+ /**
+ * Callback interface for reader error notification.
+ *
+ * @see #setErrorCallback(ErrorCallback)
+ */
+ public interface ErrorCallback {
+ /**
+ * Callback for reader errors.
+ *
+ * @param error
+ * error code:
+ *
+ * - {@link #BCRDR_ERROR_UNKNOWN}
+ *
- {@link #BCRDR_ERROR_SERVER_DIED}
+ *
+ * @param reader
+ * the BarCodeReader service object
+ */
+ void onError(int error, BarCodeReader reader);
+ };
+
+ /**
+ * Registers a callback to be invoked when an error occurs.
+ *
+ * @param cb
+ * The callback to run
+ */
+ public final void setErrorCallback(ErrorCallback cb) {
+ mErrorCallback = cb;
+ }
+
+ /**
+ * Changes the settings for this BarCodeReader service.
+ *
+ * @param params
+ * the Parameters to use for this BarCodeReader service
+ * @throws RuntimeException
+ * if any parameter is invalid or not supported.
+ * @see #getParameters()
+ */
+ public void setParameters(Parameters params) {
+ native_setParameters(params.flatten());
+ }
+
+ /**
+ * Returns the current settings for this BarCodeReader service. If
+ * modifications are made to the returned Parameters, they must be passed to
+ * {@link #setParameters(Parameters)} to take effect.
+ *
+ * @see #setParameters(Parameters)
+ */
+ public Parameters getParameters() {
+ Parameters p = new Parameters();
+ String s = native_getParameters();
+ p.unflatten(s);
+ return (p);
+ }
+
+ /**
+ * Image size (width and height dimensions).
+ */
+ public class Size {
+ /**
+ * Sets the dimensions for snapshots.
+ *
+ * @param w
+ * the image width (pixels)
+ * @param h
+ * the image height (pixels)
+ */
+ public Size(int w, int h) {
+ width = w;
+ height = h;
+ }
+
+ /**
+ * Compares {@code obj} to this size.
+ *
+ * @param obj
+ * the object to compare this size with.
+ * @return {@code true} if the width and height of {@code obj} is the
+ * same as those of this size. {@code false} otherwise.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Size)) {
+ return (false);
+ }
+ Size s = (Size) obj;
+ return ((width == s.width) && (height == s.height));
+ }
+
+ @Override
+ public int hashCode() {
+ return ((width * 32713) + height);
+ }
+
+ // width of the image
+ public int width;
+ // height of the image
+ public int height;
+ };
+
+ /**
+ * BarCodeReader service settings.
+ *
+ *
+ * To make reader parameters take effect, applications have to call
+ * {@link BarCodeReader#setParameters(Parameters)}. For
+ * example, after {@link Parameters#setWhiteBalance} is
+ * called, white balance is not actually changed until
+ * {@link BarCodeReader#setParameters(Parameters)} is called
+ * with the changed parameters object.
+ *
+ *
+ * Different devices may have different reader capabilities, such as picture
+ * size or flash modes. The application should query the reader capabilities
+ * before setting parameters. For example, the application should call
+ * {@link Parameters#getSupportedColorEffects()} before
+ * calling {@link Parameters#setColorEffect(String)}. If the
+ * reader does not support color effects,
+ * {@link Parameters#getSupportedColorEffects()} will return
+ * null.
+ */
+ public class Parameters {
+ // Parameter keys to communicate with the reader driver.
+ private static final String KEY_PREVIEW_SIZE = "preview-size";
+ private static final String KEY_PREVIEW_FORMAT = "preview-format";
+ private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate";
+ private static final String KEY_PREVIEW_FPS_RANGE = "preview-fps-range";
+ private static final String KEY_PICTURE_SIZE = "picture-size";
+ private static final String KEY_PICTURE_FORMAT = "picture-format";
+ private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size";
+ private static final String KEY_JPEG_THUMBNAIL_WIDTH = "jpeg-thumbnail-width";
+ private static final String KEY_JPEG_THUMBNAIL_HEIGHT = "jpeg-thumbnail-height";
+ private static final String KEY_JPEG_THUMBNAIL_QUALITY = "jpeg-thumbnail-quality";
+ private static final String KEY_JPEG_QUALITY = "jpeg-quality";
+ private static final String KEY_ROTATION = "rotation";
+ private static final String KEY_GPS_LATITUDE = "gps-latitude";
+ private static final String KEY_GPS_LONGITUDE = "gps-longitude";
+ private static final String KEY_GPS_ALTITUDE = "gps-altitude";
+ private static final String KEY_GPS_TIMESTAMP = "gps-timestamp";
+ private static final String KEY_GPS_PROCESSING_METHOD = "gps-processing-method";
+ private static final String KEY_WHITE_BALANCE = "whitebalance";
+ private static final String KEY_EFFECT = "effect";
+ private static final String KEY_ANTIBANDING = "antibanding";
+ private static final String KEY_SCENE_MODE = "scene-mode";
+ private static final String KEY_FLASH_MODE = "flash-mode";
+ private static final String KEY_FOCUS_MODE = "focus-mode";
+ private static final String KEY_FOCAL_LENGTH = "focal-length";
+ private static final String KEY_HORIZONTAL_VIEW_ANGLE = "horizontal-view-angle";
+ private static final String KEY_VERTICAL_VIEW_ANGLE = "vertical-view-angle";
+ private static final String KEY_EXPOSURE_COMPENSATION = "exposure-compensation";
+ private static final String KEY_MAX_EXPOSURE_COMPENSATION = "max-exposure-compensation";
+ private static final String KEY_MIN_EXPOSURE_COMPENSATION = "min-exposure-compensation";
+ private static final String KEY_EXPOSURE_COMPENSATION_STEP = "exposure-compensation-step";
+ private static final String KEY_ZOOM = "zoom";
+ private static final String KEY_MAX_ZOOM = "max-zoom";
+ private static final String KEY_ZOOM_RATIOS = "zoom-ratios";
+ private static final String KEY_ZOOM_SUPPORTED = "zoom-supported";
+ private static final String KEY_SMOOTH_ZOOM_SUPPORTED = "smooth-zoom-supported";
+ private static final String KEY_FOCUS_DISTANCES = "focus-distances";
+
+ // Parameter key suffix for supported values.
+ private static final String SUPPORTED_VALUES_SUFFIX = "-values";
+
+ private static final String TRUE = "true";
+
+ // Values for white balance settings.
+ public static final String WHITE_BALANCE_AUTO = "auto";
+ public static final String WHITE_BALANCE_INCANDESCENT = "incandescent";
+ public static final String WHITE_BALANCE_FLUORESCENT = "fluorescent";
+ public static final String WHITE_BALANCE_WARM_FLUORESCENT = "warm-fluorescent";
+ public static final String WHITE_BALANCE_DAYLIGHT = "daylight";
+ public static final String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight";
+ public static final String WHITE_BALANCE_TWILIGHT = "twilight";
+ public static final String WHITE_BALANCE_SHADE = "shade";
+
+ // Values for color effect settings.
+ public static final String EFFECT_NONE = "none";
+ public static final String EFFECT_MONO = "mono";
+ public static final String EFFECT_NEGATIVE = "negative";
+ public static final String EFFECT_SOLARIZE = "solarize";
+ public static final String EFFECT_SEPIA = "sepia";
+ public static final String EFFECT_POSTERIZE = "posterize";
+ public static final String EFFECT_WHITEBOARD = "whiteboard";
+ public static final String EFFECT_BLACKBOARD = "blackboard";
+ public static final String EFFECT_AQUA = "aqua";
+
+ // Values for antibanding settings.
+ public static final String ANTIBANDING_AUTO = "auto";
+ public static final String ANTIBANDING_50HZ = "50hz";
+ public static final String ANTIBANDING_60HZ = "60hz";
+ public static final String ANTIBANDING_OFF = "off";
+
+ // Values for flash mode settings.
+ /**
+ * Flash will not be fired.
+ */
+ public static final String FLASH_MODE_OFF = "off";
+
+ /**
+ * Flash will be fired automatically when required. The flash may be
+ * fired during preview, auto-focus, or snapshot depending on the
+ * driver.
+ */
+ public static final String FLASH_MODE_AUTO = "auto";
+
+ /**
+ * Flash will always be fired during snapshot. The flash may also be
+ * fired during preview or auto-focus depending on the driver.
+ */
+ public static final String FLASH_MODE_ON = "on";
+
+ /**
+ * Flash will be fired in red-eye reduction mode.
+ */
+ public static final String FLASH_MODE_RED_EYE = "red-eye";
+
+ /**
+ * Constant emission of light during preview, auto-focus and snapshot.
+ * This can also be used for video recording.
+ */
+ public static final String FLASH_MODE_TORCH = "torch";
+
+ /**
+ * Scene mode is off.
+ */
+ public static final String SCENE_MODE_AUTO = "auto";
+
+ /**
+ * Take photos of fast moving objects. Same as
+ * {@link #SCENE_MODE_SPORTS}.
+ */
+ public static final String SCENE_MODE_ACTION = "action";
+
+ /**
+ * Take people pictures.
+ */
+ public static final String SCENE_MODE_PORTRAIT = "portrait";
+
+ /**
+ * Take pictures on distant objects.
+ */
+ public static final String SCENE_MODE_LANDSCAPE = "landscape";
+
+ /**
+ * Take photos at night.
+ */
+ public static final String SCENE_MODE_NIGHT = "night";
+
+ /**
+ * Take people pictures at night.
+ */
+ public static final String SCENE_MODE_NIGHT_PORTRAIT = "night-portrait";
+
+ /**
+ * Take photos in a theater. Flash light is off.
+ */
+ public static final String SCENE_MODE_THEATRE = "theatre";
+
+ /**
+ * Take pictures on the beach.
+ */
+ public static final String SCENE_MODE_BEACH = "beach";
+
+ /**
+ * Take pictures on the snow.
+ */
+ public static final String SCENE_MODE_SNOW = "snow";
+
+ /**
+ * Take sunset photos.
+ */
+ public static final String SCENE_MODE_SUNSET = "sunset";
+
+ /**
+ * Avoid blurry pictures (for example, due to hand shake).
+ */
+ public static final String SCENE_MODE_STEADYPHOTO = "steadyphoto";
+
+ /**
+ * For shooting firework displays.
+ */
+ public static final String SCENE_MODE_FIREWORKS = "fireworks";
+
+ /**
+ * Take photos of fast moving objects. Same as
+ * {@link #SCENE_MODE_ACTION}.
+ */
+ public static final String SCENE_MODE_SPORTS = "sports";
+
+ /**
+ * Take indoor low-light shot.
+ */
+ public static final String SCENE_MODE_PARTY = "party";
+
+ /**
+ * Capture the naturally warm color of scenes lit by candles.
+ */
+ public static final String SCENE_MODE_CANDLELIGHT = "candlelight";
+
+ /**
+ * Applications are looking for a barcode. BarCodeReader driver will be
+ * optimized for barcode reading.
+ */
+ public static final String SCENE_MODE_BARCODE = "barcode";
+
+ /**
+ * Auto-focus mode. Applications should call
+ * {@link #autoFocus(AutoFocusCallback)} to start the focus in this
+ * mode.
+ */
+ public static final String FOCUS_MODE_AUTO = "auto";
+
+ /**
+ * Focus is set at infinity. Applications should not call
+ * {@link #autoFocus(AutoFocusCallback)} in this mode.
+ */
+ public static final String FOCUS_MODE_INFINITY = "infinity";
+
+ /**
+ * Macro (close-up) focus mode. Applications should call
+ * {@link #autoFocus(AutoFocusCallback)} to start the focus in this
+ * mode.
+ */
+ public static final String FOCUS_MODE_MACRO = "macro";
+
+ /**
+ * Focus is fixed. The reader is always in this mode if the focus is not
+ * adjustable. If the reader has auto-focus, this mode can fix the
+ * focus, which is usually at hyperfocal distance. Applications should
+ * not call {@link #autoFocus(AutoFocusCallback)} in this mode.
+ */
+ public static final String FOCUS_MODE_FIXED = "fixed";
+
+ /**
+ * Extended depth of field (EDOF). Focusing is done digitally and
+ * continuously. Applications should not call
+ * {@link #autoFocus(AutoFocusCallback)} in this mode.
+ */
+ public static final String FOCUS_MODE_EDOF = "edof";
+
+ /**
+ * Continuous auto focus mode intended for video recording. The reader
+ * continuously tries to focus. This is ideal for shooting video. Auto
+ * focus starts when the parameter is set. Applications should not call
+ * {@link #autoFocus(AutoFocusCallback)} in this mode. To stop
+ * continuous focus, applications should change the focus mode to other
+ * modes.
+ */
+ public static final String FOCUS_MODE_CONTINUOUS_VIDEO = "continuous-video";
+
+ // Indices for focus distance array.
+ /**
+ * The array index of near focus distance for use with
+ * {@link #getFocusDistances(float[])}.
+ */
+ public static final int FOCUS_DISTANCE_NEAR_INDEX = 0;
+
+ /**
+ * The array index of optimal focus distance for use with
+ * {@link #getFocusDistances(float[])}.
+ */
+ public static final int FOCUS_DISTANCE_OPTIMAL_INDEX = 1;
+
+ /**
+ * The array index of far focus distance for use with
+ * {@link #getFocusDistances(float[])}.
+ */
+ public static final int FOCUS_DISTANCE_FAR_INDEX = 2;
+
+ /**
+ * The array index of minimum preview fps for use with
+ * {@link #getPreviewFpsRange(int[])} or
+ * {@link #getSupportedPreviewFpsRange()}.
+ */
+ public static final int PREVIEW_FPS_MIN_INDEX = 0;
+
+ /**
+ * The array index of maximum preview fps for use with
+ * {@link #getPreviewFpsRange(int[])} or
+ * {@link #getSupportedPreviewFpsRange()}.
+ */
+ public static final int PREVIEW_FPS_MAX_INDEX = 1;
+
+ // Formats for setPreviewFormat and setPictureFormat.
+ private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp";
+ private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp";
+ private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv";
+ private static final String PIXEL_FORMAT_RGB565 = "rgb565";
+ private static final String PIXEL_FORMAT_JPEG = "jpeg";
+
+ private HashMap mMap;
+
+ private Parameters() {
+ mMap = new HashMap();
+ }
+
+ /**
+ * Writes the current Parameters to the log.
+ *
+ * @hide
+ * @deprecated
+ */
+ public void dump() {
+ Log.e(TAG, "dump: size=" + mMap.size());
+ for (String k : mMap.keySet()) {
+ Log.e(TAG, "dump: " + k + "=" + mMap.get(k));
+ }
+ }
+
+ /**
+ * Creates a single string with all the parameters set in this
+ * Parameters object.
+ *
+ * The {@link #unflatten(String)} method does the reverse.
+ *
+ *
+ * @return a String with all values from this Parameters object, in
+ * semi-colon delimited key-value pairs
+ */
+ public String flatten() {
+ StringBuilder flattened = new StringBuilder();
+ for (String k : mMap.keySet()) {
+ flattened.append(k);
+ flattened.append("=");
+ flattened.append(mMap.get(k));
+ flattened.append(";");
+ }
+ // chop off the extra semicolon at the end
+ flattened.deleteCharAt(flattened.length() - 1);
+ return (flattened.toString());
+ }
+
+ /**
+ * Takes a flattened string of parameters and adds each one to this
+ * Parameters object.
+ *
+ * The {@link #flatten()} method does the reverse.
+ *
+ *
+ * @param flattened
+ * a String of parameters (key-value paired) that are
+ * semi-colon delimited
+ */
+ public void unflatten(String flattened) {
+ StringTokenizer tokenizer;
+
+ int iPos;
+ String strKV;
+
+ mMap.clear();
+
+ tokenizer = new StringTokenizer(flattened, ";");
+ while (tokenizer.hasMoreElements()) {
+ strKV = tokenizer.nextToken();
+ iPos = strKV.indexOf('=');
+ if (iPos == -1) {
+ continue;
+ }
+ mMap.put(strKV.substring(0, iPos), strKV.substring(iPos + 1));
+ }
+ }
+
+ public void remove(String key) {
+ mMap.remove(key);
+ }
+
+ /**
+ * Sets a String parameter.
+ *
+ * @param key
+ * the key name for the parameter
+ * @param value
+ * the String value of the parameter
+ */
+ public void set(String key, String value) {
+ if ((key.indexOf('=') != -1) || (key.indexOf(';') != -1)) {
+ Log.e(TAG, "Key \"" + key
+ + "\" contains invalid character (= or ;)");
+ return;
+ }
+ if ((value.indexOf('=') != -1) || (value.indexOf(';') != -1)) {
+ Log.e(TAG, "Value \"" + value
+ + "\" contains invalid character (= or ;)");
+ return;
+ }
+
+ mMap.put(key, value);
+ }
+
+ /**
+ * Sets an integer parameter.
+ *
+ * @param key
+ * the key name for the parameter
+ * @param value
+ * the int value of the parameter
+ */
+ public void set(String key, int value) {
+ if ((key.indexOf('=') != -1) || (key.indexOf(';') != -1)) {
+ Log.e(TAG, "Key \"" + key
+ + "\" contains invalid character (= or ;)");
+ return;
+ }
+ mMap.put(key, Integer.toString(value));
+ }
+
+ /**
+ * Returns the value of a String parameter.
+ *
+ * @param key
+ * the key name for the parameter
+ * @return the String value of the parameter
+ */
+ public String get(String key) {
+ return (mMap.get(key));
+ }
+
+ /**
+ * Returns the value of an integer parameter.
+ *
+ * @param key
+ * the key name for the parameter
+ * @return the int value of the parameter
+ */
+ public int getInt(String key) {
+ return (getInt(key, -1));
+ }
+
+ /**
+ * Sets the dimensions for preview pictures.
+ *
+ * The sides of width and height are based on reader orientation. That
+ * is, the preview size is the size before it is rotated by display
+ * orientation. So applications need to consider the display orientation
+ * while setting preview size. For example, suppose the reader supports
+ * both 480x320 and 320x480 preview sizes. The application wants a 3:2
+ * preview ratio. If the display orientation is set to 0 or 180, preview
+ * size should be set to 480x320. If the display orientation is set to
+ * 90 or 270, preview size should be set to 320x480. The display
+ * orientation should also be considered while setting picture size and
+ * thumbnail size.
+ *
+ * @param width
+ * the width of the pictures, in pixels
+ * @param height
+ * the height of the pictures, in pixels
+ * @see #setDisplayOrientation(int)
+ * @see #getReaderInfo(int, ReaderInfo)
+ * @see #setPictureSize(int, int)
+ * @see #setJpegThumbnailSize(int, int)
+ */
+ public void setPreviewSize(int width, int height) {
+ String v = Integer.toString(width) + "x" + Integer.toString(height);
+ set(KEY_PREVIEW_SIZE, v);
+ }
+
+ /**
+ * Returns the dimensions setting for preview pictures.
+ *
+ * @return a Size object with the height and width setting for the
+ * preview picture
+ */
+ public Size getPreviewSize() {
+ String pair = get(KEY_PREVIEW_SIZE);
+ return (strToSize(pair));
+ }
+
+ /**
+ * Gets the supported preview sizes.
+ *
+ * @return a list of Size object. This method will always return a list
+ * with at least one element.
+ */
+ public List getSupportedPreviewSizes() {
+ String str = get(KEY_PREVIEW_SIZE + SUPPORTED_VALUES_SUFFIX);
+ return (splitSize(str));
+ }
+
+ /**
+ * Sets the dimensions for EXIF thumbnail in Jpeg picture. If
+ * applications set both width and height to 0, EXIF will not contain
+ * thumbnail.
+ *
+ * Applications need to consider the display orientation. See
+ * {@link #setPreviewSize(int,int)} for reference.
+ *
+ * @param width
+ * the width of the thumbnail, in pixels
+ * @param height
+ * the height of the thumbnail, in pixels
+ * @see #setPreviewSize(int,int)
+ */
+ public void setJpegThumbnailSize(int width, int height) {
+ set(KEY_JPEG_THUMBNAIL_WIDTH, width);
+ set(KEY_JPEG_THUMBNAIL_HEIGHT, height);
+ }
+
+ /**
+ * Returns the dimensions for EXIF thumbnail in Jpeg picture.
+ *
+ * @return a Size object with the height and width setting for the EXIF
+ * thumbnails
+ */
+ public Size getJpegThumbnailSize() {
+ return (new Size(getInt(KEY_JPEG_THUMBNAIL_WIDTH),
+ getInt(KEY_JPEG_THUMBNAIL_HEIGHT)));
+ }
+
+ /**
+ * Gets the supported jpeg thumbnail sizes.
+ *
+ * @return a list of Size object. This method will always return a list
+ * with at least two elements. Size 0,0 (no thumbnail) is always
+ * supported.
+ */
+ public List getSupportedJpegThumbnailSizes() {
+ String str = get(KEY_JPEG_THUMBNAIL_SIZE + SUPPORTED_VALUES_SUFFIX);
+ return (splitSize(str));
+ }
+
+ /**
+ * Sets the quality of the EXIF thumbnail in Jpeg picture.
+ *
+ * @param quality
+ * the JPEG quality of the EXIF thumbnail. The range is 1 to
+ * 100, with 100 being the best.
+ */
+ public void setJpegThumbnailQuality(int quality) {
+ set(KEY_JPEG_THUMBNAIL_QUALITY, quality);
+ }
+
+ /**
+ * Returns the quality setting for the EXIF thumbnail in Jpeg picture.
+ *
+ * @return the JPEG quality setting of the EXIF thumbnail.
+ */
+ public int getJpegThumbnailQuality() {
+ return (getInt(KEY_JPEG_THUMBNAIL_QUALITY));
+ }
+
+ /**
+ * Sets Jpeg quality of captured picture.
+ *
+ * @param quality
+ * the JPEG quality of captured picture. The range is 1 to
+ * 100, with 100 being the best.
+ */
+ public void setJpegQuality(int quality) {
+ set(KEY_JPEG_QUALITY, quality);
+ }
+
+ /**
+ * Returns the quality setting for the JPEG picture.
+ *
+ * @return the JPEG picture quality setting.
+ */
+ public int getJpegQuality() {
+ return (getInt(KEY_JPEG_QUALITY));
+ }
+
+ /**
+ * Sets the rate at which preview frames are received. This is the
+ * target frame rate. The actual frame rate depends on the driver.
+ *
+ * @param fps
+ * the frame rate (frames per second)
+ * @deprecated replaced by {@link #setPreviewFpsRange(int,int)}
+ */
+ @Deprecated
+ public void setPreviewFrameRate(int fps) {
+ set(KEY_PREVIEW_FRAME_RATE, fps);
+ }
+
+ /**
+ * Returns the setting for the rate at which preview frames are
+ * received. This is the target frame rate. The actual frame rate
+ * depends on the driver.
+ *
+ * @return the frame rate setting (frames per second)
+ * @deprecated replaced by {@link #getPreviewFpsRange(int[])}
+ */
+ @Deprecated
+ public int getPreviewFrameRate() {
+ return (getInt(KEY_PREVIEW_FRAME_RATE));
+ }
+
+ /**
+ * Gets the supported preview frame rates.
+ *
+ * @return a list of supported preview frame rates. null if preview
+ * frame rate setting is not supported.
+ * @deprecated replaced by {@link #getSupportedPreviewFpsRange()}
+ */
+ @Deprecated
+ public List getSupportedPreviewFrameRates() {
+ String str = get(KEY_PREVIEW_FRAME_RATE + SUPPORTED_VALUES_SUFFIX);
+ return (splitInt(str));
+ }
+
+ /**
+ * Sets the maximum and maximum preview fps. This controls the rate of
+ * preview frames received in {@link PreviewCallback}. The minimum and
+ * maximum preview fps must be one of the elements from
+ * {@link #getSupportedPreviewFpsRange}.
+ *
+ * @param min
+ * the minimum preview fps (scaled by 1000).
+ * @param max
+ * the maximum preview fps (scaled by 1000).
+ * @throws RuntimeException
+ * if fps range is invalid.
+ * @see #setPreviewCallbackWithBuffer(PreviewCallback)
+ * @see #getSupportedPreviewFpsRange()
+ */
+ public void setPreviewFpsRange(int min, int max) {
+ set(KEY_PREVIEW_FPS_RANGE, "" + min + "," + max);
+ }
+
+ /**
+ * Returns the current minimum and maximum preview fps. The values are
+ * one of the elements returned by {@link #getSupportedPreviewFpsRange}.
+ *
+ * @return range the minimum and maximum preview fps (scaled by 1000).
+ * @see #PREVIEW_FPS_MIN_INDEX
+ * @see #PREVIEW_FPS_MAX_INDEX
+ * @see #getSupportedPreviewFpsRange()
+ */
+ public void getPreviewFpsRange(int[] range) {
+ if ((range == null) || (range.length != 2)) {
+ throw new IllegalArgumentException(
+ "range must be an array with two elements.");
+ }
+ splitInt(get(KEY_PREVIEW_FPS_RANGE), range);
+ }
+
+ /**
+ * Gets the supported preview fps (frame-per-second) ranges. Each range
+ * contains a minimum fps and maximum fps. If minimum fps equals to
+ * maximum fps, the reader outputs frames in fixed frame rate. If not,
+ * the reader outputs frames in auto frame rate. The actual frame rate
+ * fluctuates between the minimum and the maximum. The values are
+ * multiplied by 1000 and represented in integers. For example, if frame
+ * rate is 26.623 frames per second, the value is 26623.
+ *
+ * @return a list of supported preview fps ranges. This method returns a
+ * list with at least one element. Every element is an int array
+ * of two values - minimum fps and maximum fps. The list is
+ * sorted from small to large (first by maximum fps and then
+ * minimum fps).
+ * @see #PREVIEW_FPS_MIN_INDEX
+ * @see #PREVIEW_FPS_MAX_INDEX
+ */
+ public List getSupportedPreviewFpsRange() {
+ String str = get(KEY_PREVIEW_FPS_RANGE + SUPPORTED_VALUES_SUFFIX);
+ return (splitRange(str));
+ }
+
+ /**
+ * Sets the image format for preview pictures.
+ *
+ * If this is never called, the default format will be
+ * {@link ImageFormat#NV21}, which uses the NV21
+ * encoding format.
+ *
+ *
+ * @param pixel_format
+ * the desired preview picture format, defined by one of the
+ * {@link ImageFormat} constants. (E.g.,
+ * ImageFormat.NV21 (default),
+ * ImageFormat.RGB_565, or
+ * ImageFormat.JPEG)
+ * @see ImageFormat
+ */
+ public void setPreviewFormat(int pixel_format) {
+ String s = readerFormatForPixelFormat(pixel_format);
+ if (s == null) {
+ throw new IllegalArgumentException("Invalid pixel_format="
+ + pixel_format);
+ }
+
+ set(KEY_PREVIEW_FORMAT, s);
+ }
+
+ /**
+ * Returns the image format for preview frames got from
+ * {@link PreviewCallback}.
+ *
+ * @return the preview format.
+ * @see ImageFormat
+ */
+ public int getPreviewFormat() {
+ return (pixelFormatForReaderFormat(get(KEY_PREVIEW_FORMAT)));
+ }
+
+ /**
+ * Gets the supported preview formats.
+ *
+ * @return a list of supported preview formats. This method will always
+ * return a list with at least one element.
+ * @see ImageFormat
+ */
+ public List getSupportedPreviewFormats() {
+ String str = get(KEY_PREVIEW_FORMAT + SUPPORTED_VALUES_SUFFIX);
+ ArrayList formats = new ArrayList();
+ for (String s : split(str)) {
+ int f = pixelFormatForReaderFormat(s);
+ if (f == ImageFormat.UNKNOWN)
+ continue;
+ formats.add(f);
+ }
+ return (formats);
+ }
+
+ /**
+ * Sets the dimensions for pictures.
+ *
+ * Applications need to consider the display orientation. See
+ * {@link #setPreviewSize(int,int)} for reference.
+ *
+ * @param width
+ * the width for pictures, in pixels
+ * @param height
+ * the height for pictures, in pixels
+ * @see #setPreviewSize(int,int)
+ *
+ */
+ public void setPictureSize(int width, int height) {
+ String v = Integer.toString(width) + "x" + Integer.toString(height);
+ set(KEY_PICTURE_SIZE, v);
+ }
+
+ /**
+ * Returns the dimension setting for pictures.
+ *
+ * @return a Size object with the height and width setting for pictures
+ */
+ public Size getPictureSize() {
+ String pair = get(KEY_PICTURE_SIZE);
+ return (strToSize(pair));
+ }
+
+ /**
+ * Gets the supported picture sizes.
+ *
+ * @return a list of supported picture sizes. This method will always
+ * return a list with at least one element.
+ */
+ public List getSupportedPictureSizes() {
+ String str = get(KEY_PICTURE_SIZE + SUPPORTED_VALUES_SUFFIX);
+ return (splitSize(str));
+ }
+
+ /**
+ * Sets the image format for pictures.
+ *
+ * @param pixel_format
+ * the desired picture format (ImageFormat.NV21,
+ * ImageFormat.RGB_565, or
+ * ImageFormat.JPEG)
+ * @see ImageFormat
+ */
+ public void setPictureFormat(int pixel_format) {
+ String s = readerFormatForPixelFormat(pixel_format);
+ if (s == null) {
+ throw new IllegalArgumentException("Invalid pixel_format="
+ + pixel_format);
+ }
+
+ set(KEY_PICTURE_FORMAT, s);
+ }
+
+ /**
+ * Returns the image format for pictures.
+ *
+ * @return the picture format
+ * @see ImageFormat
+ */
+ public int getPictureFormat() {
+ return (pixelFormatForReaderFormat(get(KEY_PICTURE_FORMAT)));
+ }
+
+ /**
+ * Gets the supported picture formats.
+ *
+ * @return supported picture formats. This method will always return a
+ * list with at least one element.
+ * @see ImageFormat
+ */
+ public List getSupportedPictureFormats() {
+ String str = get(KEY_PICTURE_FORMAT + SUPPORTED_VALUES_SUFFIX);
+ ArrayList formats = new ArrayList();
+ for (String s : split(str)) {
+ int f = pixelFormatForReaderFormat(s);
+ if (f == ImageFormat.UNKNOWN)
+ continue;
+ formats.add(f);
+ }
+ return (formats);
+ }
+
+ private String readerFormatForPixelFormat(int pixel_format) {
+ switch (pixel_format) {
+ case ImageFormat.NV16:
+ return (PIXEL_FORMAT_YUV422SP);
+ case ImageFormat.NV21:
+ return (PIXEL_FORMAT_YUV420SP);
+ case ImageFormat.YUY2:
+ return (PIXEL_FORMAT_YUV422I);
+ case ImageFormat.RGB_565:
+ return (PIXEL_FORMAT_RGB565);
+ case ImageFormat.JPEG:
+ return (PIXEL_FORMAT_JPEG);
+ default:
+ break;
+ }
+ return (null);
+ }
+
+ private int pixelFormatForReaderFormat(String format) {
+ if (format == null)
+ return (ImageFormat.UNKNOWN);
+
+ if (format.equals(PIXEL_FORMAT_YUV422SP))
+ return (ImageFormat.NV16);
+
+ if (format.equals(PIXEL_FORMAT_YUV420SP))
+ return (ImageFormat.NV21);
+
+ if (format.equals(PIXEL_FORMAT_YUV422I))
+ return (ImageFormat.YUY2);
+
+ if (format.equals(PIXEL_FORMAT_RGB565))
+ return (ImageFormat.RGB_565);
+
+ if (format.equals(PIXEL_FORMAT_JPEG))
+ return (ImageFormat.JPEG);
+
+ return (ImageFormat.UNKNOWN);
+ }
+
+ /**
+ * Sets the rotation angle in degrees relative to the orientation of the
+ * reader. This affects the pictures returned from JPEG
+ * {@link PictureCallback}. The reader driver may set orientation in the
+ * EXIF header without rotating the picture. Or the driver may rotate
+ * the picture and the EXIF thumbnail. If the Jpeg picture is rotated,
+ * the orientation in the EXIF header will be missing or 1 (row #0 is
+ * top and column #0 is left side).
+ *
+ *
+ * If applications want to rotate the picture to match the orientation
+ * of what users see, apps should use
+ * {@link android.view.OrientationEventListener} and {@link ReaderInfo}.
+ * The value from OrientationEventListener is relative to the natural
+ * orientation of the device. ReaderInfo.orientation is the angle
+ * between reader orientation and natural device orientation. The sum of
+ * the two is the rotation angle for back-facing reader. The difference
+ * of the two is the rotation angle for front-facing reader. Note that
+ * the JPEG pictures of front-facing readers are not mirrored as in
+ * preview display.
+ *
+ *
+ * For example, suppose the natural orientation of the device is
+ * portrait. The device is rotated 270 degrees clockwise, so the device
+ * orientation is 270. Suppose a back-facing reader sensor is mounted in
+ * landscape and the top side of the reader sensor is aligned with the
+ * right edge of the display in natural orientation. So the reader
+ * orientation is 90. The rotation should be set to 0 (270 + 90).
+ *
+ *
+ * The reference code is as follows.
+ *
+ *
+ * #import com.motorolasolutions.adc.decoder;
+ *
+ * public void public void onOrientationChanged(int orientation)
+ * {
+ * int rotation = 0;
+ *
+ * if ( orientation == ORIENTATION_UNKNOWN )
+ * return;
+ *
+ * BarCodeReader.ReaderInfo info = new BarCodeReader.ReaderInfo();
+ * BarCodeReader.getReaderInfo(readerId, info);
+ * orientation = (orientation + 45) / 90 * 90;
+ * if ( info.facing == BarCodeReader.ReaderInfo.BCRDR_FACING_FRONT )
+ * {
+ * rotation = (info.orientation - orientation + 360) % 360;
+ * }
+ * else
+ * {
+ * // back-facing reader
+ * rotation = (info.orientation + orientation) % 360;
+ * }
+ * mParameters.setRotation(rotation);
+ * }
+ *
+ *
+ * @param rotation
+ * The rotation angle in degrees relative to the orientation
+ * of the reader. Rotation can only be 0, 90, 180 or 270.
+ * @throws IllegalArgumentException
+ * if rotation value is invalid.
+ * @see android.view.OrientationEventListener
+ * @see #getReaderInfo(int, ReaderInfo)
+ */
+ public void setRotation(int rotation) {
+ if ((rotation == 0) || (rotation == 90) || (rotation == 180)
+ || (rotation == 270)) {
+ set(KEY_ROTATION, Integer.toString(rotation));
+ } else {
+ throw new IllegalArgumentException("Invalid rotation="
+ + rotation);
+ }
+ }
+
+ /**
+ * Sets GPS latitude coordinate. This will be stored in JPEG EXIF
+ * header.
+ *
+ * @param latitude
+ * GPS latitude coordinate.
+ */
+ public void setGpsLatitude(double latitude) {
+ set(KEY_GPS_LATITUDE, Double.toString(latitude));
+ }
+
+ /**
+ * Sets GPS longitude coordinate. This will be stored in JPEG EXIF
+ * header.
+ *
+ * @param longitude
+ * GPS longitude coordinate.
+ */
+ public void setGpsLongitude(double longitude) {
+ set(KEY_GPS_LONGITUDE, Double.toString(longitude));
+ }
+
+ /**
+ * Sets GPS altitude. This will be stored in JPEG EXIF header.
+ *
+ * @param altitude
+ * GPS altitude in meters.
+ */
+ public void setGpsAltitude(double altitude) {
+ set(KEY_GPS_ALTITUDE, Double.toString(altitude));
+ }
+
+ /**
+ * Sets GPS timestamp. This will be stored in JPEG EXIF header.
+ *
+ * @param timestamp
+ * GPS timestamp (UTC in seconds since January 1, 1970).
+ */
+ public void setGpsTimestamp(long timestamp) {
+ set(KEY_GPS_TIMESTAMP, Long.toString(timestamp));
+ }
+
+ /**
+ * Sets GPS processing method. It will store up to 32 characters in JPEG
+ * EXIF header.
+ *
+ * @param processing_method
+ * The processing method to get this location.
+ */
+ public void setGpsProcessingMethod(String processing_method) {
+ set(KEY_GPS_PROCESSING_METHOD, processing_method);
+ }
+
+ /**
+ * Removes GPS latitude, longitude, altitude, and timestamp from the
+ * parameters.
+ */
+ public void removeGpsData() {
+ remove(KEY_GPS_LATITUDE);
+ remove(KEY_GPS_LONGITUDE);
+ remove(KEY_GPS_ALTITUDE);
+ remove(KEY_GPS_TIMESTAMP);
+ remove(KEY_GPS_PROCESSING_METHOD);
+ }
+
+ /**
+ * Gets the current white balance setting.
+ *
+ * @return current white balance. null if white balance setting is not
+ * supported.
+ * @see #WHITE_BALANCE_AUTO
+ * @see #WHITE_BALANCE_INCANDESCENT
+ * @see #WHITE_BALANCE_FLUORESCENT
+ * @see #WHITE_BALANCE_WARM_FLUORESCENT
+ * @see #WHITE_BALANCE_DAYLIGHT
+ * @see #WHITE_BALANCE_CLOUDY_DAYLIGHT
+ * @see #WHITE_BALANCE_TWILIGHT
+ * @see #WHITE_BALANCE_SHADE
+ *
+ */
+ public String getWhiteBalance() {
+ return (get(KEY_WHITE_BALANCE));
+ }
+
+ /**
+ * Sets the white balance.
+ *
+ * @param value
+ * new white balance.
+ * @see #getWhiteBalance()
+ */
+ public void setWhiteBalance(String value) {
+ set(KEY_WHITE_BALANCE, value);
+ }
+
+ /**
+ * Gets the supported white balance.
+ *
+ * @return a list of supported white balance. null if white balance
+ * setting is not supported.
+ * @see #getWhiteBalance()
+ */
+ public List getSupportedWhiteBalance() {
+ String str = get(KEY_WHITE_BALANCE + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the current color effect setting.
+ *
+ * @return current color effect. null if color effect setting is not
+ * supported.
+ * @see #EFFECT_NONE
+ * @see #EFFECT_MONO
+ * @see #EFFECT_NEGATIVE
+ * @see #EFFECT_SOLARIZE
+ * @see #EFFECT_SEPIA
+ * @see #EFFECT_POSTERIZE
+ * @see #EFFECT_WHITEBOARD
+ * @see #EFFECT_BLACKBOARD
+ * @see #EFFECT_AQUA
+ */
+ public String getColorEffect() {
+ return (get(KEY_EFFECT));
+ }
+
+ /**
+ * Sets the current color effect setting.
+ *
+ * @param value
+ * new color effect.
+ * @see #getColorEffect()
+ */
+ public void setColorEffect(String value) {
+ set(KEY_EFFECT, value);
+ }
+
+ /**
+ * Gets the supported color effects.
+ *
+ * @return a list of supported color effects. null if color effect
+ * setting is not supported.
+ * @see #getColorEffect()
+ */
+ public List getSupportedColorEffects() {
+ String str = get(KEY_EFFECT + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the current antibanding setting.
+ *
+ * @return current antibanding. null if antibanding setting is not
+ * supported.
+ * @see #ANTIBANDING_AUTO
+ * @see #ANTIBANDING_50HZ
+ * @see #ANTIBANDING_60HZ
+ * @see #ANTIBANDING_OFF
+ */
+ public String getAntibanding() {
+ return (get(KEY_ANTIBANDING));
+ }
+
+ /**
+ * Sets the antibanding.
+ *
+ * @param antibanding
+ * new antibanding value.
+ * @see #getAntibanding()
+ */
+ public void setAntibanding(String antibanding) {
+ set(KEY_ANTIBANDING, antibanding);
+ }
+
+ /**
+ * Gets the supported antibanding values.
+ *
+ * @return a list of supported antibanding values. null if antibanding
+ * setting is not supported.
+ * @see #getAntibanding()
+ */
+ public List getSupportedAntibanding() {
+ String str = get(KEY_ANTIBANDING + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the current scene mode setting.
+ *
+ * @return one of SCENE_MODE_XXX string constant. null if scene mode
+ * setting is not supported.
+ * @see #SCENE_MODE_AUTO
+ * @see #SCENE_MODE_ACTION
+ * @see #SCENE_MODE_PORTRAIT
+ * @see #SCENE_MODE_LANDSCAPE
+ * @see #SCENE_MODE_NIGHT
+ * @see #SCENE_MODE_NIGHT_PORTRAIT
+ * @see #SCENE_MODE_THEATRE
+ * @see #SCENE_MODE_BEACH
+ * @see #SCENE_MODE_SNOW
+ * @see #SCENE_MODE_SUNSET
+ * @see #SCENE_MODE_STEADYPHOTO
+ * @see #SCENE_MODE_FIREWORKS
+ * @see #SCENE_MODE_SPORTS
+ * @see #SCENE_MODE_PARTY
+ * @see #SCENE_MODE_CANDLELIGHT
+ */
+ public String getSceneMode() {
+ return (get(KEY_SCENE_MODE));
+ }
+
+ /**
+ * Sets the scene mode. Changing scene mode may override other
+ * parameters (such as flash mode, focus mode, white balance). For
+ * example, suppose originally flash mode is on and supported flash
+ * modes are on/off. In night scene mode, both flash mode and supported
+ * flash mode may be changed to off. After setting scene mode,
+ * applications should call getParameters to know if some parameters are
+ * changed.
+ *
+ * @param value
+ * scene mode.
+ * @see #getSceneMode()
+ */
+ public void setSceneMode(String value) {
+ set(KEY_SCENE_MODE, value);
+ }
+
+ /**
+ * Gets the supported scene modes.
+ *
+ * @return a list of supported scene modes. null if scene mode setting
+ * is not supported.
+ * @see #getSceneMode()
+ */
+ public List getSupportedSceneModes() {
+ String str = get(KEY_SCENE_MODE + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the current flash mode setting.
+ *
+ * @return current flash mode. null if flash mode setting is not
+ * supported.
+ * @see #FLASH_MODE_OFF
+ * @see #FLASH_MODE_AUTO
+ * @see #FLASH_MODE_ON
+ * @see #FLASH_MODE_RED_EYE
+ * @see #FLASH_MODE_TORCH
+ */
+ public String getFlashMode() {
+ return (get(KEY_FLASH_MODE));
+ }
+
+ /**
+ * Sets the flash mode.
+ *
+ * @param value
+ * flash mode.
+ * @see #getFlashMode()
+ */
+ public void setFlashMode(String value) {
+ set(KEY_FLASH_MODE, value);
+ }
+
+ /**
+ * Gets the supported flash modes.
+ *
+ * @return a list of supported flash modes. null if flash mode setting
+ * is not supported.
+ * @see #getFlashMode()
+ */
+ public List getSupportedFlashModes() {
+ String str = get(KEY_FLASH_MODE + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the current focus mode setting.
+ *
+ * @return current focus mode. This method will always return a non-null
+ * value. Applications should call
+ * {@link #autoFocus(AutoFocusCallback)} to start the focus if
+ * focus mode is FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
+ * @see #FOCUS_MODE_AUTO
+ * @see #FOCUS_MODE_INFINITY
+ * @see #FOCUS_MODE_MACRO
+ * @see #FOCUS_MODE_FIXED
+ * @see #FOCUS_MODE_EDOF
+ * @see #FOCUS_MODE_CONTINUOUS_VIDEO
+ */
+ public String getFocusMode() {
+ return (get(KEY_FOCUS_MODE));
+ }
+
+ /**
+ * Sets the focus mode.
+ *
+ * @param value
+ * focus mode.
+ * @see #getFocusMode()
+ */
+ public void setFocusMode(String value) {
+ set(KEY_FOCUS_MODE, value);
+ }
+
+ /**
+ * Gets the supported focus modes.
+ *
+ * @return a list of supported focus modes. This method will always
+ * return a list with at least one element.
+ * @see #getFocusMode()
+ */
+ public List getSupportedFocusModes() {
+ String str = get(KEY_FOCUS_MODE + SUPPORTED_VALUES_SUFFIX);
+ return (split(str));
+ }
+
+ /**
+ * Gets the focal length (in millimeter) of the reader.
+ *
+ * @return the focal length. This method will always return a valid
+ * value.
+ */
+ public float getFocalLength() {
+ return (Float.parseFloat(get(KEY_FOCAL_LENGTH)));
+ }
+
+ /**
+ * Gets the horizontal angle of view in degrees.
+ *
+ * @return horizontal angle of view. This method will always return a
+ * valid value.
+ */
+ public float getHorizontalViewAngle() {
+ return (Float.parseFloat(get(KEY_HORIZONTAL_VIEW_ANGLE)));
+ }
+
+ /**
+ * Gets the vertical angle of view in degrees.
+ *
+ * @return vertical angle of view. This method will always return a
+ * valid value.
+ */
+ public float getVerticalViewAngle() {
+ return (Float.parseFloat(get(KEY_VERTICAL_VIEW_ANGLE)));
+ }
+
+ /**
+ * Gets the current exposure compensation index.
+ *
+ * @return current exposure compensation index. The range is
+ * {@link #getMinExposureCompensation} to
+ * {@link #getMaxExposureCompensation}. 0 means exposure is not
+ * adjusted.
+ */
+ public int getExposureCompensation() {
+ return (getInt(KEY_EXPOSURE_COMPENSATION, 0));
+ }
+
+ /**
+ * Sets the exposure compensation index.
+ *
+ * @param value
+ * exposure compensation index. The valid value range is from
+ * {@link #getMinExposureCompensation} (inclusive) to
+ * {@link #getMaxExposureCompensation} (inclusive). 0 means
+ * exposure is not adjusted. Application should call
+ * getMinExposureCompensation and getMaxExposureCompensation
+ * to know if exposure compensation is supported.
+ */
+ public void setExposureCompensation(int value) {
+ set(KEY_EXPOSURE_COMPENSATION, value);
+ }
+
+ /**
+ * Gets the maximum exposure compensation index.
+ *
+ * @return maximum exposure compensation index (>=0). If both this
+ * method and {@link #getMinExposureCompensation} return 0,
+ * exposure compensation is not supported.
+ */
+ public int getMaxExposureCompensation() {
+ return (getInt(KEY_MAX_EXPOSURE_COMPENSATION, 0));
+ }
+
+ /**
+ * Gets the minimum exposure compensation index.
+ *
+ * @return minimum exposure compensation index (<=0). If both this
+ * method and {@link #getMaxExposureCompensation} return 0,
+ * exposure compensation is not supported.
+ */
+ public int getMinExposureCompensation() {
+ return (getInt(KEY_MIN_EXPOSURE_COMPENSATION, 0));
+ }
+
+ /**
+ * Gets the exposure compensation step.
+ *
+ * @return exposure compensation step. Applications can get EV by
+ * multiplying the exposure compensation index and step. Ex: if
+ * exposure compensation index is -6 and step is 0.333333333, EV
+ * is -2.
+ */
+ public float getExposureCompensationStep() {
+ return (getFloat(KEY_EXPOSURE_COMPENSATION_STEP, 0));
+ }
+
+ /**
+ * Gets current zoom value. This also works when smooth zoom is in
+ * progress. Applications should check {@link #isZoomSupported} before
+ * using this method.
+ *
+ * @return the current zoom value. The range is 0 to {@link #getMaxZoom}
+ * . 0 means the reader is not zoomed.
+ */
+ public int getZoom() {
+ return (getInt(KEY_ZOOM, 0));
+ }
+
+ /**
+ * Sets current zoom value. If the reader is zoomed (value > 0), the
+ * actual picture size may be smaller than picture size setting.
+ * Applications can check the actual picture size after picture is
+ * returned from {@link PictureCallback}. The preview size remains the
+ * same in zoom. Applications should check {@link #isZoomSupported}
+ * before using this method.
+ *
+ * @param value
+ * zoom value. The valid range is 0 to {@link #getMaxZoom}.
+ */
+ public void setZoom(int value) {
+ set(KEY_ZOOM, value);
+ }
+
+ /**
+ * Returns true if zoom is supported. Applications should call this
+ * before using other zoom methods.
+ *
+ * @return true if zoom is supported.
+ */
+ public boolean isZoomSupported() {
+ String str = get(KEY_ZOOM_SUPPORTED);
+ return (TRUE.equals(str));
+ }
+
+ /**
+ * Gets the maximum zoom value allowed for snapshot. This is the maximum
+ * value that applications can set to {@link #setZoom(int)}.
+ * Applications should call {@link #isZoomSupported} before using this
+ * method. This value may change in different preview size. Applications
+ * should call this again after setting preview size.
+ *
+ * @return the maximum zoom value supported by the reader.
+ */
+ public int getMaxZoom() {
+ return (getInt(KEY_MAX_ZOOM, 0));
+ }
+
+ /**
+ * Gets the zoom ratios of all zoom values. Applications should check
+ * {@link #isZoomSupported} before using this method.
+ *
+ * @return the zoom ratios in 1/100 increments. Ex: a zoom of 3.2x is
+ * returned as 320. The number of elements is
+ * {@link #getMaxZoom} + 1. The list is sorted from small to
+ * large. The first element is always 100. The last element is
+ * the zoom ratio of the maximum zoom value.
+ */
+ public List getZoomRatios() {
+ return (splitInt(get(KEY_ZOOM_RATIOS)));
+ }
+
+ /**
+ * Returns true if smooth zoom is supported. Applications should call
+ * this before using other smooth zoom methods.
+ *
+ * @return true if smooth zoom is supported.
+ */
+ public boolean isSmoothZoomSupported() {
+ String str = get(KEY_SMOOTH_ZOOM_SUPPORTED);
+ return (TRUE.equals(str));
+ }
+
+ /**
+ * Gets the distances from the reader to where an object appears to be
+ * in focus. The object is sharpest at the optimal focus distance. The
+ * depth of field is the far focus distance minus near focus distance.
+ *
+ * Focus distances may change after calling
+ * {@link #autoFocus(AutoFocusCallback)}, {@link #cancelAutoFocus}, or
+ * {@link #startPreview()}. Applications can call
+ * {@link #getParameters()} and this method anytime to get the latest
+ * focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO,
+ * focus distances may change from time to time.
+ *
+ * This method is intended to estimate the distance between the reader
+ * and the subject. After autofocus, the subject distance may be within
+ * near and far focus distance. However, the precision depends on the
+ * reader hardware, autofocus algorithm, the focus area, and the scene.
+ * The error can be large and it should be only used as a reference.
+ *
+ * Far focus distance >= optimal focus distance >= near focus distance.
+ * If the focus distance is infinity, the value will be
+ * Float.POSITIVE_INFINITY.
+ *
+ * @param output
+ * focus distances in meters. output must be a float array
+ * with three elements. Near focus distance, optimal focus
+ * distance, and far focus distance will be filled in the
+ * array.
+ * @see #FOCUS_DISTANCE_NEAR_INDEX
+ * @see #FOCUS_DISTANCE_OPTIMAL_INDEX
+ * @see #FOCUS_DISTANCE_FAR_INDEX
+ */
+ public void getFocusDistances(float[] output) {
+ if ((output == null) || (output.length != 3)) {
+ throw new IllegalArgumentException(
+ "output must be an float array with three elements.");
+ }
+ splitFloat(get(KEY_FOCUS_DISTANCES), output);
+ }
+
+ // Splits a comma delimited string to an ArrayList of String.
+ // Return null if the passing string is null or the size is 0.
+ private ArrayList split(String str) {
+ if (str == null)
+ return (null);
+
+ // Use StringTokenizer because it is faster than split.
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ ArrayList substrings = new ArrayList();
+ while (tokenizer.hasMoreElements()) {
+ substrings.add(tokenizer.nextToken());
+ }
+ return (substrings);
+ }
+
+ // Splits a comma delimited string to an ArrayList of Integer.
+ // Return null if the passing string is null or the size is 0.
+ private ArrayList splitInt(String str) {
+ if (str == null)
+ return (null);
+
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ ArrayList substrings = new ArrayList();
+ while (tokenizer.hasMoreElements()) {
+ String token = tokenizer.nextToken();
+ substrings.add(Integer.parseInt(token));
+ }
+ if (substrings.size() == 0)
+ return (null);
+
+ return (substrings);
+ }
+
+ private void splitInt(String str, int[] output) {
+ if (str == null)
+ return;
+
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ int index = 0;
+ while (tokenizer.hasMoreElements()) {
+ String token = tokenizer.nextToken();
+ output[index++] = Integer.parseInt(token);
+ }
+ }
+
+ // Splits a comma delimited string to an ArrayList of Float.
+ private void splitFloat(String str, float[] output) {
+ if (str == null)
+ return;
+
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ int index = 0;
+ while (tokenizer.hasMoreElements()) {
+ String token = tokenizer.nextToken();
+ output[index++] = Float.parseFloat(token);
+ }
+ }
+
+ // Returns the value of a float parameter.
+ private float getFloat(String key, float defaultValue) {
+ float flRetVal;
+
+ try {
+ flRetVal = Float.parseFloat(mMap.get(key));
+ return (flRetVal);
+ } catch (Throwable thrw) {
+ }
+ return (defaultValue);
+ }
+
+ // Returns the value of a integer parameter.
+ private int getInt(String key, int defaultValue) {
+ int iRetVal;
+
+ try {
+ iRetVal = Integer.parseInt(mMap.get(key));
+ return (iRetVal);
+ } catch (Throwable thrw) {
+ }
+ return (defaultValue);
+ }
+
+ // Splits a comma delimited string to an ArrayList of Size.
+ // Return null if the passing string is null or the size is 0.
+ private ArrayList splitSize(String str) {
+ if (str == null)
+ return (null);
+
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ ArrayList sizeList = new ArrayList();
+ while (tokenizer.hasMoreElements()) {
+ Size size = strToSize(tokenizer.nextToken());
+ if (size != null)
+ sizeList.add(size);
+ }
+ if (sizeList.size() == 0)
+ return (null);
+
+ return (sizeList);
+ }
+
+ // Parses a string (ex: "480x320") to Size object.
+ // Return null if the passing string is null.
+ private Size strToSize(String str) {
+ if (str == null)
+ return (null);
+
+ int pos = str.indexOf('x');
+ if (pos != -1) {
+ String width = str.substring(0, pos);
+ String height = str.substring(pos + 1);
+ return (new Size(Integer.parseInt(width),
+ Integer.parseInt(height)));
+ }
+ Log.e(TAG, "Invalid size parameter string=" + str);
+ return (null);
+ }
+
+ // Splits a comma delimited string to an ArrayList of int array.
+ // Example string: "(10000,26623),(10000,30000)". Return null if the
+ // passing string is null or the size is 0.
+ private ArrayList splitRange(String str) {
+ if ((str == null) || (str.charAt(0) != '(')
+ || (str.charAt(str.length() - 1) != ')')) {
+ Log.e(TAG, "Invalid range list string=" + str);
+ return (null);
+ }
+
+ ArrayList rangeList = new ArrayList();
+ int endIndex, fromIndex = 1;
+ do {
+ int[] range = new int[2];
+ endIndex = str.indexOf("),(", fromIndex);
+ if (endIndex == -1)
+ endIndex = str.length() - 1;
+ splitInt(str.substring(fromIndex, endIndex), range);
+ rangeList.add(range);
+ fromIndex = endIndex + 3;
+ } while (endIndex != (str.length() - 1));
+
+ if (rangeList.size() == 0)
+ return (null);
+
+ return (rangeList);
+ }
+ };
+}
diff --git a/app/src/main/java/com/seuic/scan/SeuicScanKeyEventRunnable.java b/app/src/main/java/com/seuic/scan/SeuicScanKeyEventRunnable.java
new file mode 100644
index 0000000..109195e
--- /dev/null
+++ b/app/src/main/java/com/seuic/scan/SeuicScanKeyEventRunnable.java
@@ -0,0 +1,44 @@
+package com.seuic.scan;
+
+import com.seuic.scanner.Scanner;
+import com.seuic.scanner.ScannerKey;
+
+public class SeuicScanKeyEventRunnable implements Runnable {
+ private Scanner mScanner;
+ public boolean isrun = true;
+
+ // 需要调用ScannerKey去实现扫描按键控制扫描灯的亮和灭(需要在子线程中执行)
+ public SeuicScanKeyEventRunnable(Scanner mScanner) {
+ this.mScanner = mScanner;
+ }
+
+ public void run() {
+ int ret1 = ScannerKey.open();
+ if (ret1 > -1) {
+ while (isrun) {
+ int ret = ScannerKey.getKeyEvent();
+ if (ret > -1) {
+ // while (isrun) {
+ // try {
+ // mScanner.startScan();
+ // Thread.sleep(300);
+ // mScanner.stopScan();
+ // Thread.sleep(300);
+ // } catch (InterruptedException e) {
+ //
+ // }
+ // }
+ switch (ret) {
+ case ScannerKey.KEY_DOWN:
+ mScanner.startScan();
+ break;
+ case ScannerKey.KEY_UP:
+ mScanner.stopScan();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/seuic/scanner/DecodeCallback.java b/app/src/main/java/com/seuic/scanner/DecodeCallback.java
new file mode 100644
index 0000000..f06771a
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/DecodeCallback.java
@@ -0,0 +1,11 @@
+package com.seuic.scanner;
+
+public interface DecodeCallback {
+ void onDecodeComplete(String paramString);
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\DecodeCallback.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/DecodeInfo.java b/app/src/main/java/com/seuic/scanner/DecodeInfo.java
new file mode 100644
index 0000000..4de8d5b
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/DecodeInfo.java
@@ -0,0 +1,15 @@
+package com.seuic.scanner;
+
+public class DecodeInfo {
+ public String barcode;
+
+ public String codetype;
+
+ public int length;
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\DecodeInfo.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/DecodeInfoCallBack.java b/app/src/main/java/com/seuic/scanner/DecodeInfoCallBack.java
new file mode 100644
index 0000000..90b589e
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/DecodeInfoCallBack.java
@@ -0,0 +1,11 @@
+package com.seuic.scanner;
+
+public interface DecodeInfoCallBack {
+ void onDecodeComplete(DecodeInfo paramDecodeInfo);
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\DecodeInfoCallBack.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/Devices.java b/app/src/main/java/com/seuic/scanner/Devices.java
new file mode 100644
index 0000000..aa49270
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/Devices.java
@@ -0,0 +1,15 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ class Devices
+/* */ {
+/* */ enum DeviceModels {
+/* 6 */ AUTOID6,
+/* 7 */ AUTOID9;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\Devices.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/FileUtil.java b/app/src/main/java/com/seuic/scanner/FileUtil.java
new file mode 100644
index 0000000..3ff2e6e
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/FileUtil.java
@@ -0,0 +1,71 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.os.Environment;
+/* */ import android.util.Log;
+/* */ import java.io.File;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */ public class FileUtil
+/* */ {
+/* */ private static final String LOG_TAG = "FileUtil";
+/* 14 */ public static final String APP_TEMP_DIRECTORY = Environment.getExternalStorageDirectory() + "/PDATest";
+/* */
+/* */ public static boolean fileExists(String file) {
+/* 17 */ File _file = new File(file);
+/* 18 */ return _file.exists();
+/* */ }
+/* */
+/* */ public static boolean createDirectory(String directory) {
+/* */ try {
+/* 23 */ File file = new File(directory);
+/* 24 */ if (!file.exists() && !file.isDirectory()) {
+/* 25 */ file.mkdir();
+/* */ }
+/* 27 */ return true;
+/* 28 */ } catch (Exception ex) {
+/* 29 */ return false;
+/* */ }
+/* */ }
+/* */
+/* */ public static void createFile(String filename) {
+/* 34 */ File file = new File(filename);
+/* */ try {
+/* 36 */ file.createNewFile();
+/* 37 */ } catch (IOException e) {
+/* 38 */ Log.e("FileUtil", "createFile : " + e.getMessage());
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static void clear(String folder) {
+/* 48 */ File filefolder = new File(folder);
+/* 49 */ if (filefolder != null) {
+/* 50 */ if (filefolder.isDirectory()) {
+/* 51 */ File[] filelist = filefolder.listFiles(); byte b; int i; File[] arrayOfFile1;
+/* 52 */ for (i = (arrayOfFile1 = filelist).length, b = 0; b < i; ) { File file = arrayOfFile1[b];
+/* 53 */ clear(file.getPath()); b++; }
+/* */
+/* */ }
+/* 56 */ filefolder.delete();
+/* */ }
+/* */ }
+/* */
+/* */ public static void delete(String filename) {
+/* 61 */ File file = new File(filename);
+/* 62 */ if (file.exists())
+/* 63 */ file.delete();
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\FileUtil.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/HHPObject.java b/app/src/main/java/com/seuic/scanner/HHPObject.java
new file mode 100644
index 0000000..c94129d
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/HHPObject.java
@@ -0,0 +1,19 @@
+package com.seuic.scanner;
+
+public class HHPObject {
+ String msg;
+
+ byte codeID;
+
+ byte symLetter;
+
+ byte symModifier;
+
+ int length;
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\HHPObject.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/HHPScanner.java b/app/src/main/java/com/seuic/scanner/HHPScanner.java
new file mode 100644
index 0000000..bae0ac2
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/HHPScanner.java
@@ -0,0 +1,319 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.os.Handler;
+/* */ import android.os.Message;
+/* */ import android.text.TextUtils;
+/* */ import android.util.Log;
+/* */ import android.util.SparseIntArray;
+/* */
+/* */ public class HHPScanner
+/* */ extends Scanner
+/* */ {
+/* 13 */ final String LOG_TAG = "HHPScanner";
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 25 */ private final int DEFAULT_PARAMETER = 849;
+/* */
+/* */ private Thread mThread;
+/* */ private boolean isEnabled = true;
+/* */ private static DecodeCallback callback;
+/* 30 */ private Handler mHandler = new DecodeHandler();
+/* 31 */ private Runnable runnable = new DecodeRunnable();
+/* */ boolean scanFinished; static { System.loadLibrary("HHPScanner_jni"); paramArray.put(257, 1); paramArray.put(258, 17); paramArray.put(259, 33); paramArray.put(260, 49); paramArray.put(261, 65); paramArray.put(263, 2); paramArray.put(264, 18); paramArray.put(265, 34); paramArray.put(266, 3); paramArray.put(267, 19); paramArray.put(265, 35); paramArray.put(273, 20); paramArray.put(289, 113); paramArray.put(290, 114); paramArray.put(291, 115); paramArray.put(292, 145); paramArray.put(305, 209); paramArray.put(307, 212); paramArray.put(310, 210); paramArray.put(311, 211); paramArray.put(321, 241); paramArray.put(322, 242); paramArray.put(323, 243); paramArray.put(337, 257); paramArray.put(338, 258); paramArray.put(339, 259); paramArray.put(341, 260); paramArray.put(353, 273); paramArray.put(354, 274); paramArray.put(355, 275); paramArray.put(401, 289); paramArray.put(402, 290); paramArray.put(403, 291); paramArray.put(513, 305); paramArray.put(514, 306); paramArray.put(515, 307); paramArray.put(577, 321); paramArray.put(578, 322); paramArray.put(579, 323); paramArray.put(593, 337); paramArray.put(594, 338); paramArray.put(595, 339); paramArray.put(609, 369); paramArray.put(617, 370); paramArray.put(610, 385); paramArray.put(618, 386); paramArray.put(611, 401); paramArray.put(612, 417); paramArray.put(613, 433); paramArray.put(689, 561); paramArray.put(690, 562); paramArray.put(691, 563); paramArray.put(836, 564); paramArray.put(529, 497); paramArray.put(705, 577); paramArray.put(706, 578); paramArray.put(707, 579); paramArray.put(721, 593); paramArray.put(722, 594); paramArray.put(723, 595); paramArray.put(561, 609); paramArray.put(562, 610); paramArray.put(563, 611); paramArray.put(737, 625); paramArray.put(739, 626); paramArray.put(739, 627); paramArray.put(545, 641); paramArray.put(546, 642); paramArray.put(547, 643); paramArray.put(753, 657); paramArray.put(754, 658); paramArray.put(755, 659); paramArray.put(769, 705); paramArray.put(770, 706); paramArray.put(771, 707); paramArray.put(785, 753); paramArray.put(786, 754); paramArray.put(787, 755); paramArray.put(788, 756);
+/* */ paramArray.put(817, 785);
+/* */ paramArray.put(818, 786);
+/* 35 */ paramArray.put(7, 850); } HHPScanner(Context context) { super(context);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 187 */ this.scanFinished = true; }
+/* */ void decode() { HHPObject object = new HHPObject(); if (JNIGetDecode(object, 5000) > 0) { ScanLed.setLed(1); Message msg = this.mHandler.obtainMessage(); msg.obj = object; this.mHandler.sendMessage(msg); }
+/* 189 */ this.scanFinished = true; } void scan() { synchronized (this.runnable) {
+/* 190 */ if (this.isEnabled)
+/* 191 */ if (this.scanFinished) {
+/* 192 */ this.runnable.notify();
+/* */ } else {
+/* 194 */ this.scanFinished = true;
+/* */ }
+/* */ } } public boolean open() { if (JNIOpen() > -1) {
+/* */ this.mThread = new Thread(this.runnable); this.mThread.start(); return true;
+/* */ }
+/* */ return false; }
+/* */ public void close() { JNIClose(); }
+/* */ public void startScan() { scan(); }
+/* 202 */ public void stopScan() { JNIStopDecode(); }
+/* */
+/* */
+/* */
+/* */ public int getParams(int num) {
+/* 207 */ if (paramArray.get(num, -1) == -1 && num != 801) {
+/* 208 */ return -1;
+/* */ }
+/* */
+/* 211 */ ScanParam param = new ScanParam();
+/* 212 */ param.id = paramArray.get(num);
+/* 213 */ JNIGetParameter(param);
+/* */
+/* */
+/* 216 */ if (num == 7) {
+/* 217 */ Log.i("HHPScanner", "12345");
+/* */ }
+/* */
+/* 220 */ return param.value;
+/* */ }
+/* */
+/* */
+/* */ public void enable() {
+/* 225 */ JNIEnable();
+/* */ }
+/* */
+/* */
+/* */ public void disable() {
+/* 230 */ JNIDisable();
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean setParams(int num, int value) {
+/* 236 */ if (paramArray.get(num, -1) == -1 && num != 801) {
+/* 237 */ return false;
+/* */ }
+/* */
+/* 240 */ ScanParam param = new ScanParam();
+/* 241 */ if (num != 801) {
+/* 242 */ param.id = paramArray.get(num);
+/* */ } else {
+/* */
+/* 245 */ param.id = 849;
+/* */ }
+/* 247 */ param.value = value;
+/* */
+/* 249 */ if (JNISetParameter(param) == 1) {
+/* 250 */ return true;
+/* */ }
+/* 252 */ return false;
+/* */ }
+/* */
+/* */ public void setOCRTemplate(String template) {
+/* 256 */ JNISetOCRTemplate(template);
+/* */ }
+/* */
+/* */
+/* */ public SparseIntArray getAllParams() {
+/* 261 */ return paramArray;
+/* */ }
+/* */
+/* */ static class DecodeHandler extends Handler {
+/* */ public void handleMessage(Message msg) {
+/* 266 */ HHPObject object = (HHPObject)msg.obj;
+/* 267 */ if (HHPScanner.callback != null && !TextUtils.isEmpty(object.msg))
+/* 268 */ HHPScanner.callback.onDecodeComplete(object.msg);
+/* */ }
+/* */ }
+/* */
+/* */ class DecodeRunnable
+/* */ implements Runnable
+/* */ {
+/* */ public void run() {
+/* */ while (true) {
+/* 277 */ synchronized (HHPScanner.this.runnable) {
+/* */ try {
+/* 279 */ HHPScanner.this.runnable.wait();
+/* 280 */ } catch (InterruptedException e) {
+/* 281 */ Log.e("HHPScanner", "DecodeRunnable:" + e.getMessage());
+/* */ }
+/* 283 */ HHPScanner.this.decode();
+/* */ }
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void setDecodeCallBack(DecodeCallback decodeCallback) {
+/* 291 */ callback = decodeCallback;
+/* */ }
+/* */
+/* */ public void setDecodeInfoCallBack(DecodeInfoCallBack callback) {}
+/* */
+/* */ final native int JNIOpen();
+/* */
+/* */ final native int JNIClose();
+/* */
+/* */ final native int JNIEnable();
+/* */
+/* */ final native int JNIDisable();
+/* */
+/* */ final native int JNISetOCRTemplate(String paramString);
+/* */
+/* */ final native int JNIStopDecode();
+/* */
+/* */ final native int JNIGetDecode(HHPObject paramHHPObject, int paramInt);
+/* */
+/* */ final native int JNISetParameter(ScanParam paramScanParam);
+/* */
+/* */ final native int JNIGetParameter(ScanParam paramScanParam);
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\HHPScanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/IScanner.java b/app/src/main/java/com/seuic/scanner/IScanner.java
new file mode 100644
index 0000000..7c11d10
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/IScanner.java
@@ -0,0 +1,279 @@
+package com.seuic.scanner;
+
+public interface IScanner {
+ boolean open();
+
+ void close();
+
+ void startScan();
+
+ void stopScan();
+
+ void enable();
+
+ void disable();
+
+ boolean setParams(int paramInt1, int paramInt2);
+
+ int getParams(int paramInt);
+
+ void setDecodeCallBack(DecodeCallback paramDecodeCallback);
+
+ void setDecodeInfoCallBack(DecodeInfoCallBack paramDecodeInfoCallBack);
+
+ public static class ParamCode {
+ public static final int LASTER_ONTIME = 1;
+
+ public static final int SCAN_ANGLE = 2;
+
+ public static final int TIMEOUT_SAMESYMBOL = 3;
+
+ public static final int SECURITY_LEVEL = 4;
+
+ public static final int BIDIRECTIONAL = 6;
+
+ public static final int LIGHTS = 7;
+
+ public static final int LCD_DISPLAY = 8;
+
+ public static final int ILLUMINATION_LEVEL = 9;
+
+ public static final int UPCA = 257;
+
+ public static final int UPCE = 258;
+
+ public static final int UPCE1 = 259;
+
+ public static final int EAN8 = 260;
+
+ public static final int EAN13 = 261;
+
+ public static final int BOOKLAND = 262;
+
+ public static final int UPCA_CHK = 263;
+
+ public static final int UPCE_CHK = 264;
+
+ public static final int UPCE1_CHK = 265;
+
+ public static final int UPCA_PREAM = 266;
+
+ public static final int UPCE_PREAM = 267;
+
+ public static final int UPCE1_PREAM = 268;
+
+ public static final int UPCE_TO_A = 269;
+
+ public static final int UPCE1_TO_A = 270;
+
+ public static final int EAN8_TO_13 = 271;
+
+ public static final int COUPON = 272;
+
+ public static final int UPCE_EXPANDED = 273;
+
+ public static final int CODE128 = 289;
+
+ public static final int CODE128_LEN_MIN = 290;
+
+ public static final int CODE128_LEN_MAX = 291;
+
+ public static final int ISBT128 = 292;
+
+ public static final int GS1128 = 293;
+
+ public static final int CODE39 = 305;
+
+ public static final int TRIC39 = 306;
+
+ public static final int CODE39_FULL_ASCII = 307;
+
+ public static final int CODE39_TO_CODE32 = 308;
+
+ public static final int CODE32_PREFIX = 309;
+
+ public static final int CODE39_LEN_MIN = 310;
+
+ public static final int CODE39_LEN_MAX = 311;
+
+ public static final int CODE39_CHK = 312;
+
+ public static final int CODE39_VER = 313;
+
+ public static final int CODE93 = 321;
+
+ public static final int CODE93_LEN_MIN = 322;
+
+ public static final int CODE93_LEN_MAX = 323;
+
+ public static final int CODE11 = 337;
+
+ public static final int CODE11_LEN_MIN = 338;
+
+ public static final int CODE11_LEN_MAX = 339;
+
+ public static final int CODE11_CHK_VER = 340;
+
+ public static final int CODE11_CHK = 341;
+
+ public static final int I25 = 353;
+
+ public static final int I25_LEN_MIN = 354;
+
+ public static final int I25_LEN_MAX = 355;
+
+ public static final int D25 = 369;
+
+ public static final int D25_LEN_MIN = 370;
+
+ public static final int D25_LEN_MAX = 371;
+
+ public static final int C25 = 385;
+
+ public static final int C25_LEN_MIN = 386;
+
+ public static final int C25_LEN_MAX = 387;
+
+ public static final int CODEBAR = 401;
+
+ public static final int CODEBAR_LEN_MIN = 402;
+
+ public static final int CODEBAR_LEN_MAX = 403;
+
+ public static final int MSI = 513;
+
+ public static final int MSI_LEN_MIN = 514;
+
+ public static final int MSI_LEN_MAX = 515;
+
+ public static final int RSS14 = 529;
+
+ public static final int RSS_LIMIT = 530;
+
+ public static final int RSS_EXPANDED = 531;
+
+ public static final int RSS_TO_UPCEAN = 532;
+
+ public static final int QRCODE = 545;
+
+ public static final int QRCODE_LEN_MIN = 546;
+
+ public static final int QRCODE_LEN_MAX = 547;
+
+ public static final int QRINVERSE = 548;
+
+ public static final int MICROQR = 549;
+
+ public static final int DM = 561;
+
+ public static final int DM_LEN_MIN = 562;
+
+ public static final int DM_LEN_MAX = 563;
+
+ public static final int DMINVERSE = 564;
+
+ public static final int DMI = 565;
+
+ public static final int CHINAPOST = 577;
+
+ public static final int CHINAPOST_LEN_MIN = 578;
+
+ public static final int CHINAPOST_LEN_MAX = 579;
+
+ public static final int M25 = 593;
+
+ public static final int M25_LEN_MIN = 594;
+
+ public static final int M25_LEN_MAX = 595;
+
+ public static final int POSTNET = 609;
+
+ public static final int PLANET = 610;
+
+ public static final int BRITISHPOST = 611;
+
+ public static final int JAPPOST = 612;
+
+ public static final int AUSPOST = 613;
+
+ public static final int UPU_FICS_POSTAL = 614;
+
+ public static final int USPS_4CB = 615;
+
+ public static final int NETHERLANDS_KIX_CODE = 616;
+
+ public static final int POSTNET_CHK = 617;
+
+ public static final int PLANET_CHK = 618;
+
+ public static final int K35 = 625;
+
+ public static final int COMPOSITE = 689;
+
+ public static final int COMPOSITE_LEN_MIN = 690;
+
+ public static final int COMPOSITE_LEN_MAX = 691;
+
+ public static final int PDF417 = 705;
+
+ public static final int PDF417_LEN_MIN = 706;
+
+ public static final int PDF417_LEN_MAX = 707;
+
+ public static final int MICROPDF417 = 721;
+
+ public static final int MICROPDF417_LEN_MIN = 722;
+
+ public static final int MICROPDF417_LEN_MAX = 723;
+
+ public static final int MAXICODE = 737;
+
+ public static final int MAXICODE_LEN_MIN = 738;
+
+ public static final int MAXICODE_LEN_MAX = 739;
+
+ public static final int AZTECCODE = 753;
+
+ public static final int AZTECCODE_LEN_MIN = 754;
+
+ public static final int AZTECCODE_LEN_MAX = 755;
+
+ public static final int AZTECCODE_INVERSE = 756;
+
+ public static final int CODEBLOCKF = 769;
+
+ public static final int CODEBLOCKF_LEN_MIN = 770;
+
+ public static final int CODEBLOCKF_LEN_MAX = 771;
+
+ public static final int TELEPEN = 785;
+
+ public static final int TELEPEN_LEN_MIN = 786;
+
+ public static final int TELEPEN_LEN_MAX = 787;
+
+ public static final int TELEPEN_OLDSTYLE = 788;
+
+ public static final int FACTORY_DEFAULT = 801;
+
+ public static final int OCR = 817;
+
+ public static final int OCR_TEMPLATE = 818;
+
+ public static final int COMPOSITE_CC_C = 833;
+
+ public static final int COMPOSITE_CC_AB = 834;
+
+ public static final int COMPOSITE_TLC_39 = 835;
+
+ public static final int COMPOSITE_UPCEAN = 836;
+
+ public static final int XMIT_CODE_ID = 849;
+ }
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\IScanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/N4313Scanner.java b/app/src/main/java/com/seuic/scanner/N4313Scanner.java
new file mode 100644
index 0000000..44c5fbe
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/N4313Scanner.java
@@ -0,0 +1,84 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.util.SparseIntArray;
+/* */
+/* */ public class N4313Scanner extends Scanner1D {
+/* */ static {
+/* 8 */ paramArray.clear();
+/* 9 */ paramArray.put(1, 1);
+/* 10 */ paramArray.put(2, 2);
+/* 11 */ paramArray.put(3, 3);
+/* */
+/* */
+/* 14 */ paramArray.put(257, 145);
+/* 15 */ paramArray.put(258, 146);
+/* 16 */ paramArray.put(260, 148);
+/* 17 */ paramArray.put(261, 149);
+/* 18 */ paramArray.put(263, 151);
+/* 19 */ paramArray.put(264, 152);
+/* */
+/* 21 */ paramArray.put(289, 273);
+/* 22 */ paramArray.put(292, 275);
+/* 23 */ paramArray.put(293, 274);
+/* */
+/* 25 */ paramArray.put(305, 289);
+/* 26 */ paramArray.put(307, 291);
+/* 27 */ paramArray.put(309, 293);
+/* 28 */ paramArray.put(310, 294);
+/* 29 */ paramArray.put(311, 295);
+/* 30 */ paramArray.put(312, 296);
+/* */
+/* 32 */ paramArray.put(321, 305);
+/* 33 */ paramArray.put(322, 306);
+/* 34 */ paramArray.put(323, 307);
+/* */
+/* 36 */ paramArray.put(337, 321);
+/* 37 */ paramArray.put(338, 322);
+/* 38 */ paramArray.put(339, 323);
+/* */
+/* */
+/* 41 */ paramArray.put(353, 337);
+/* 42 */ paramArray.put(354, 338);
+/* 43 */ paramArray.put(355, 339);
+/* */
+/* 45 */ paramArray.put(513, 353);
+/* 46 */ paramArray.put(514, 354);
+/* 47 */ paramArray.put(515, 355);
+/* */
+/* 49 */ paramArray.put(401, 369);
+/* 50 */ paramArray.put(402, 370);
+/* 51 */ paramArray.put(403, 371);
+/* */
+/* 53 */ paramArray.put(369, 385);
+/* 54 */ paramArray.put(370, 386);
+/* 55 */ paramArray.put(371, 387);
+/* */
+/* 57 */ paramArray.put(385, 401);
+/* 58 */ paramArray.put(386, 402);
+/* 59 */ paramArray.put(387, 403);
+/* */ }
+/* */
+/* */ N4313Scanner(Context context) {
+/* 63 */ super(context);
+/* */ }
+/* */
+/* */
+/* */ protected int getLaserTime() {
+/* 68 */ int laserTime = getParams(1);
+/* 69 */ if (laserTime > 0) {
+/* 70 */ return laserTime;
+/* */ }
+/* 72 */ return 5000;
+/* */ }
+/* */
+/* */ protected void setLaserTime(int time) {
+/* 76 */ this.laser_time = time;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\N4313Scanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/Param1D.java b/app/src/main/java/com/seuic/scanner/Param1D.java
new file mode 100644
index 0000000..3afde38
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/Param1D.java
@@ -0,0 +1,13 @@
+package com.seuic.scanner;
+
+public class Param1D {
+ public int id;
+
+ public int value;
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\Param1D.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/SE4500Scanner.java b/app/src/main/java/com/seuic/scanner/SE4500Scanner.java
new file mode 100644
index 0000000..4eebb98
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/SE4500Scanner.java
@@ -0,0 +1,438 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.os.Build;
+/* */ import android.text.TextUtils;
+/* */ import android.util.Log;
+/* */ import android.util.SparseIntArray;
+/* */ import com.zebra.adc.decoder.compatible.BarCodeReader;
+/* */ import java.io.UnsupportedEncodingException;
+/* */ import java.util.HashMap;
+/* */ import java.util.Map;
+/* */
+/* */
+/* */
+/* */
+/* */ public class SE4500Scanner
+/* */ extends Scanner
+/* */ implements BarCodeReader.DecodeCallback
+/* */ {
+/* 20 */ private final String TYPE_NOT_FOUND = "Unknown Type";
+/* 21 */ private final int[] TYPE_LENGTH = new int[] { 1, 3 };
+/* */
+/* */
+/* */ static {
+/* 25 */ System.loadLibrary("IAL");
+/* 26 */ System.loadLibrary("SDL");
+/* */
+/* 28 */ if (Build.VERSION.SDK_INT >= 19) {
+/* 29 */ System.loadLibrary("barcodereader44");
+/* */ }
+/* 31 */ else if (Build.VERSION.SDK_INT >= 18) {
+/* 32 */ System.loadLibrary("barcodereader43");
+/* */ } else {
+/* 34 */ System.loadLibrary("barcodereader");
+/* */ }
+/* */
+/* */
+/* 38 */ paramArray.put(257, 1);
+/* 39 */ paramArray.put(258, 2);
+/* 40 */ paramArray.put(259, 12);
+/* 41 */ paramArray.put(260, 4);
+/* 42 */ paramArray.put(261, 3);
+/* 43 */ paramArray.put(262, 83);
+/* 44 */ paramArray.put(263, 40);
+/* 45 */ paramArray.put(264, 41);
+/* 46 */ paramArray.put(265, 42);
+/* 47 */ paramArray.put(266, 34);
+/* 48 */ paramArray.put(267, 35);
+/* 49 */ paramArray.put(268, 36);
+/* 50 */ paramArray.put(269, 37);
+/* 51 */ paramArray.put(270, 38);
+/* 52 */ paramArray.put(271, 39);
+/* 53 */ paramArray.put(272, 85);
+/* */
+/* */
+/* 56 */ paramArray.put(289, 8);
+/* 57 */ paramArray.put(290, 209);
+/* 58 */ paramArray.put(291, 210);
+/* 59 */ paramArray.put(292, 84);
+/* 60 */ paramArray.put(293, 14);
+/* */
+/* */
+/* 63 */ paramArray.put(305, 0);
+/* 64 */ paramArray.put(306, 13);
+/* 65 */ paramArray.put(307, 17);
+/* 66 */ paramArray.put(308, 86);
+/* 67 */ paramArray.put(309, 231);
+/* 68 */ paramArray.put(310, 18);
+/* 69 */ paramArray.put(311, 19);
+/* 70 */ paramArray.put(312, 43);
+/* 71 */ paramArray.put(313, 48);
+/* */
+/* */
+/* 74 */ paramArray.put(321, 9);
+/* 75 */ paramArray.put(322, 26);
+/* 76 */ paramArray.put(323, 27);
+/* */
+/* */
+/* 79 */ paramArray.put(337, 10);
+/* 80 */ paramArray.put(338, 28);
+/* 81 */ paramArray.put(339, 29);
+/* 82 */ paramArray.put(340, 52);
+/* 83 */ paramArray.put(341, 47);
+/* */
+/* */
+/* 86 */ paramArray.put(353, 6);
+/* 87 */ paramArray.put(354, 22);
+/* 88 */ paramArray.put(355, 23);
+/* */
+/* */
+/* 91 */ paramArray.put(369, 5);
+/* 92 */ paramArray.put(370, 20);
+/* 93 */ paramArray.put(371, 21);
+/* */
+/* */
+/* 96 */ paramArray.put(401, 7);
+/* 97 */ paramArray.put(402, 24);
+/* 98 */ paramArray.put(403, 25);
+/* */
+/* */
+/* 101 */ paramArray.put(513, 11);
+/* 102 */ paramArray.put(514, 30);
+/* 103 */ paramArray.put(515, 31);
+/* */
+/* */
+/* 106 */ paramArray.put(385, 408);
+/* */
+/* */
+/* 109 */ paramArray.put(593, 618);
+/* 110 */ paramArray.put(594, 619);
+/* 111 */ paramArray.put(595, 620);
+/* */
+/* */
+/* 114 */ paramArray.put(609, 89);
+/* 115 */ paramArray.put(610, 90);
+/* 116 */ paramArray.put(617, 95);
+/* 117 */ paramArray.put(618, 95);
+/* 118 */ paramArray.put(611, 91);
+/* 119 */ paramArray.put(612, 290);
+/* 120 */ paramArray.put(613, 291);
+/* 121 */ paramArray.put(616, 326);
+/* 122 */ paramArray.put(615, 592);
+/* 123 */ paramArray.put(614, 611);
+/* */
+/* */
+/* 126 */ paramArray.put(625, 581);
+/* */
+/* */
+/* 129 */ paramArray.put(833, 341);
+/* 130 */ paramArray.put(834, 342);
+/* 131 */ paramArray.put(835, 371);
+/* */
+/* */
+/* 134 */ paramArray.put(705, 15);
+/* */
+/* */
+/* 137 */ paramArray.put(721, 227);
+/* */
+/* */
+/* 140 */ paramArray.put(737, 294);
+/* */
+/* */
+/* 143 */ paramArray.put(753, 574);
+/* 144 */ paramArray.put(756, 589);
+/* */
+/* */
+/* 147 */ paramArray.put(545, 293);
+/* 148 */ paramArray.put(548, 587);
+/* 149 */ paramArray.put(549, 573);
+/* */
+/* */
+/* 152 */ paramArray.put(561, 292);
+/* 153 */ paramArray.put(564, 588);
+/* 154 */ paramArray.put(565, 537);
+/* */
+/* 156 */ paramArray.put(8, 716);
+/* 157 */ paramArray.put(849, 45);
+/* */
+/* 159 */ paramArray.put(9, 764);
+/* */ }
+/* 161 */ private static Map mMapType = new HashMap(); static {
+/* 162 */ mMapType.put("A", "UPC-A/UPC-E/UPC-E1/EAN-8/EAN-13");
+/* 163 */ mMapType.put("B", "Code 39/Code 32");
+/* 164 */ mMapType.put("C", "Codabar");
+/* 165 */ mMapType.put("D", "Code 128/ISBT 128/ISBT 128 Concatenated");
+/* 166 */ mMapType.put("E", "Code 93");
+/* 167 */ mMapType.put("F", "Interleaved 2 of 5");
+/* 168 */ mMapType.put("G", "Discrete 2 of 5/Discrete 2 of 5 IATA");
+/* 169 */ mMapType.put("H", "Code 11");
+/* 170 */ mMapType.put("J", "MSI");
+/* 171 */ mMapType.put("K", "GS1-128");
+/* 172 */ mMapType.put("L", "Bookland EAN");
+/* 173 */ mMapType.put("M", "Trioptic Code 39");
+/* 174 */ mMapType.put("N", "Coupon Code");
+/* 175 */ mMapType.put("R", "GS1 DataBar Family");
+/* 176 */ mMapType.put("S", "Matrix 2 of 5");
+/* 177 */ mMapType.put("T", "UCC Composite/TLC 39");
+/* 178 */ mMapType.put("U", "Chinese 2 of 5");
+/* 179 */ mMapType.put("V", "Korean 3 of 5");
+/* 180 */ mMapType.put("X", "ISSN EAN/PDF417/Macro PDF417/Micro PDF417");
+/* 181 */ mMapType.put("z", "Aztec/Aztec Rune");
+/* 182 */ mMapType.put("P00", "Data Matrix");
+/* 183 */ mMapType.put("P01", "QR Code/MicroQR");
+/* 184 */ mMapType.put("P02", "Maxicode");
+/* 185 */ mMapType.put("P03", "US Postnet");
+/* 186 */ mMapType.put("P04", "US Planet");
+/* 187 */ mMapType.put("P05", "Japan Postal");
+/* 188 */ mMapType.put("P06", "UK Postal");
+/* 189 */ mMapType.put("P08", "Netherlands KIX Code");
+/* 190 */ mMapType.put("P09", "Australia Post");
+/* 191 */ mMapType.put("P0A", "USPS 4CB/One Code/Intelligent Mail");
+/* 192 */ mMapType.put("P0B", "UPU FICS Postal");
+/* 193 */ mMapType.put("P0X", "Signature Capture");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 202 */ private Boolean released = new Boolean(true);
+/* 203 */ private static int decCount = 0; private DecodeCallback mDecodeCallBack;
+/* */
+/* */ public SE4500Scanner(Context context) {
+/* 206 */ super(context);
+/* */ }
+/* */ private DecodeInfoCallBack mInfoCallBack; private BarCodeReader mBcr;
+/* */
+/* */ public boolean open() {
+/* 211 */ synchronized (this.released) {
+/* 212 */ if (!this.released.booleanValue()) {
+/* 213 */ return true;
+/* */ }
+/* */
+/* 216 */ if (Build.VERSION.SDK_INT >= 18) {
+/* 217 */ this.mBcr = BarCodeReader.open(this.mContext.getApplicationContext());
+/* */ } else {
+/* 219 */ this.mBcr = BarCodeReader.open();
+/* */ }
+/* */
+/* 222 */ if (this.mBcr == null) {
+/* 223 */ return false;
+/* */ }
+/* */
+/* 226 */ this.mBcr.setDecodeCallback(this);
+/* 227 */ this.mBcr.setParameter(45, 2);
+/* 228 */ this.released = Boolean.valueOf(false);
+/* */ }
+/* 230 */ return true;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void close() {
+/* 236 */ synchronized (this.released) {
+/* */
+/* 238 */ if (this.released.booleanValue()) {
+/* */ return;
+/* */ }
+/* */
+/* 242 */ if (this.mBcr != null) {
+/* 243 */ this.mBcr.stopDecode();
+/* 244 */ if (!this.released.booleanValue())
+/* 245 */ this.mBcr.release();
+/* 246 */ this.released = Boolean.valueOf(true);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void startScan() {
+/* 253 */ synchronized (this) {
+/* 254 */ if (this.mBcr.scanFinished.booleanValue()) {
+/* 255 */ Log.i("SE4500", "Start scan finished " + this.mBcr.scanFinished);
+/* 256 */ this.mBcr.scanFinished = Boolean.valueOf(false);
+/* 257 */ this.mBcr.startDecode();
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void stopScan() {
+/* 264 */ this.mBcr.stopDecode();
+/* 265 */ Log.i("SE4500", "Stop scan finished ");
+/* */ try {
+/* 267 */ Thread.sleep(50L);
+/* 268 */ } catch (InterruptedException e) {
+/* 269 */ e.printStackTrace();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public boolean setParams(int num, int value) {
+/* 275 */ if (paramArray.get(num, -1) == -1 && num != 801) {
+/* 276 */ return false;
+/* */ }
+/* */
+/* */
+/* 280 */ if (num == 801) {
+/* 281 */ setDefault();
+/* 282 */ return true;
+/* */ }
+/* */
+/* 285 */ if (this.mBcr.setParameter(paramArray.get(num), value) == 0) {
+/* 286 */ return true;
+/* */ }
+/* */
+/* 289 */ return false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private void setDefault() {
+/* 297 */ close();
+/* */
+/* 299 */ open();
+/* */ }
+/* */
+/* */
+/* */ public int getParams(int num) {
+/* 304 */ if (paramArray.get(num, -1) == -1) {
+/* 305 */ return -1;
+/* */ }
+/* */
+/* 308 */ return this.mBcr.getNumParameter(paramArray.get(num));
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void onDecodeComplete(int symbology, int length, byte[] data, BarCodeReader reader) {
+/* 314 */ synchronized (this) {
+/* */
+/* 316 */ if (length == -3) {
+/* 317 */ decCount = symbology;
+/* */ } else {
+/* 319 */ this.mBcr.scanFinished = Boolean.valueOf(true);
+/* */ }
+/* 321 */ Log.i("SE4500", "Decode complete finished " + this.mBcr.scanFinished);
+/* 322 */ if (length > 0) {
+/* 323 */ synchronized (this.released) {
+/* 324 */ if (!this.released.booleanValue()) {
+/* 325 */ this.mBcr.stopDecode();
+/* */ }
+/* */ }
+/* */
+/* 329 */ ScanLed.setLed(1);
+/* 330 */ if (symbology == 153) {
+/* */
+/* 332 */ symbology = data[0];
+/* 333 */ int n = data[1];
+/* 334 */ int s = 2;
+/* 335 */ int d = 0;
+/* 336 */ int len = 0;
+/* 337 */ byte[] d99 = new byte[data.length];
+/* 338 */ for (int i = 0; i < n; i++) {
+/* 339 */ s += 2;
+/* 340 */ len = data[s++];
+/* 341 */ System.arraycopy(data, s, d99, d, len);
+/* 342 */ s += len;
+/* 343 */ d += len;
+/* */ }
+/* 345 */ d99[d] = 0;
+/* 346 */ data = d99;
+/* */ }
+/* */
+/* 349 */ String barcode = null;
+/* */ try {
+/* 351 */ barcode = (new String(data, StringUtils.guessEncoding(data))).trim();
+/* 352 */ } catch (UnsupportedEncodingException e1) {
+/* 353 */ e1.printStackTrace();
+/* */ }
+/* */
+/* 356 */ DecodeInfo info = getDecodeInfo(barcode);
+/* 357 */ if (this.mDecodeCallBack != null) {
+/* 358 */ this.mDecodeCallBack.onDecodeComplete(info.barcode);
+/* */ }
+/* */
+/* 361 */ if (this.mInfoCallBack != null) {
+/* 362 */ this.mInfoCallBack.onDecodeComplete(info);
+/* */ }
+/* */ }
+/* */ else {
+/* */
+/* 367 */ switch (length) {
+/* */
+/* */ }
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private DecodeInfo getDecodeInfo(String barcode) {
+/* 379 */ DecodeInfo info = new DecodeInfo();
+/* 380 */ String type = null;
+/* 381 */ int typelength = 0;
+/* 382 */ if (barcode.length() > this.TYPE_LENGTH[0] && !TextUtils.isEmpty(type = mMapType.get(barcode.substring(0, this.TYPE_LENGTH[0])))) {
+/* 383 */ info.codetype = type;
+/* 384 */ typelength = this.TYPE_LENGTH[0];
+/* */ }
+/* 386 */ else if (barcode.length() > this.TYPE_LENGTH[1] && !TextUtils.isEmpty(type = mMapType.get(barcode.substring(0, this.TYPE_LENGTH[1])))) {
+/* 387 */ info.codetype = type;
+/* 388 */ typelength = this.TYPE_LENGTH[1];
+/* */ } else {
+/* 390 */ info.codetype = "Unknown Type";
+/* */ }
+/* */
+/* 393 */ info.barcode = barcode.substring(typelength);
+/* 394 */ info.length = info.barcode.length();
+/* 395 */ return info;
+/* */ }
+/* */
+/* */
+/* */ public void onEvent(int event, int info, byte[] data, BarCodeReader reader) {
+/* 400 */ Log.i("SE4500", "onEvent " + event);
+/* 401 */ switch (event) {
+/* */
+/* */ case 7:
+/* */
+/* */ try {
+/* */
+/* */
+/* 408 */ Thread.sleep(50L);
+/* 409 */ } catch (InterruptedException e) {
+/* 410 */ e.printStackTrace();
+/* */ }
+/* */ break;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setDecodeCallBack(DecodeCallback callBack) {
+/* 420 */ this.mDecodeCallBack = callBack;
+/* */ }
+/* */
+/* */
+/* */ public SparseIntArray getAllParams() {
+/* 425 */ return paramArray;
+/* */ }
+/* */
+/* */
+/* */ public void setDecodeInfoCallBack(DecodeInfoCallBack callback) {
+/* 430 */ this.mInfoCallBack = callback;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\SE4500Scanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/SE955Scanner.java b/app/src/main/java/com/seuic/scanner/SE955Scanner.java
new file mode 100644
index 0000000..1ec9b3b
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/SE955Scanner.java
@@ -0,0 +1,38 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.util.SparseIntArray;
+/* */
+/* */ public class SE955Scanner
+/* */ extends Scanner1D {
+/* */ static {
+/* 9 */ paramArray.put(2, 2);
+/* 10 */ paramArray.put(529, 417);
+/* 11 */ paramArray.put(530, 418);
+/* 12 */ paramArray.put(531, 419);
+/* 13 */ paramArray.put(532, 420);
+/* */ }
+/* */
+/* */ SE955Scanner(Context context) {
+/* 17 */ super(context);
+/* */ }
+/* */
+/* */
+/* */ protected int getLaserTime() {
+/* 22 */ int laserTime = getParams(1);
+/* 23 */ if (laserTime > 0) {
+/* 24 */ return laserTime * 100;
+/* */ }
+/* 26 */ return 3000;
+/* */ }
+/* */
+/* */ protected void setLaserTime(int time) {
+/* 30 */ this.laser_time = time * 100;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\SE955Scanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/ScanLed.java b/app/src/main/java/com/seuic/scanner/ScanLed.java
new file mode 100644
index 0000000..9741f9e
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/ScanLed.java
@@ -0,0 +1,20 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ class ScanLed
+/* */ {
+/* */ static {
+/* 6 */ System.loadLibrary("Scannerled");
+/* */ }
+/* */
+/* */ static final native int JNISetScanled(int paramInt);
+/* */
+/* */ static int setLed(int brightness) {
+/* 12 */ return JNISetScanled(brightness);
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\ScanLed.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/ScanParam.java b/app/src/main/java/com/seuic/scanner/ScanParam.java
new file mode 100644
index 0000000..e3f4a1d
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/ScanParam.java
@@ -0,0 +1,13 @@
+package com.seuic.scanner;
+
+public class ScanParam {
+ public int id;
+
+ public int value;
+}
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\ScanParam.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/Scanner.java b/app/src/main/java/com/seuic/scanner/Scanner.java
new file mode 100644
index 0000000..82328c3
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/Scanner.java
@@ -0,0 +1,72 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.app.ActivityManager;
+/* */ import android.content.Context;
+/* */ import android.content.Intent;
+/* */ import android.util.SparseIntArray;
+/* */ import java.util.List;
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract class Scanner
+/* */ implements IScanner
+/* */ {
+/* */ public static final String ACTION_SEND_BARCODE = "com.android.server.scannerservice.broadcast";
+/* */ public static final String ACTION_SEND_KEY = "scannerdata";
+/* */ public static final String ACTION_SEND_KEY_CODE_TYPE = "codetype";
+/* */ private static final String ACTION_SCANNER_SERVICE_TERMINATE = "com.android.scanner.TERMINATE";
+/* */ private static final String SERVICE_NAME = "com.seuic.scanner.service.ScanService";
+/* */ private static final String ACTION_START_SCAN_SERVICE = "com.seuic.action.START_SCANSERVICE";
+/* */ protected boolean isEnabled = true;
+/* 22 */ protected static SparseIntArray paramArray = new SparseIntArray();
+/* */
+/* */ Context mContext;
+/* */
+/* */ Scanner(Context context) {
+/* 27 */ this.mContext = context;
+/* */ }
+/* */ public abstract SparseIntArray getAllParams();
+/* */
+/* */ public static void stopScanService(Context context) {
+/* 32 */ while (isRunning(context, "com.seuic.scanner.service.ScanService")) {
+/* 33 */ context.sendBroadcast(new Intent("com.android.scanner.TERMINATE"));
+/* */ }
+/* */ try {
+/* 36 */ Thread.sleep(150L);
+/* 37 */ } catch (InterruptedException e) {
+/* 38 */ e.printStackTrace();
+/* */ }
+/* */ }
+/* */
+/* */ public static void startScanService(Context context) {
+/* 43 */ context.sendBroadcast(new Intent("com.seuic.action.START_SCANSERVICE"));
+/* */ }
+/* */
+/* */ private static boolean isRunning(Context context, String serviceName) {
+/* 47 */ ActivityManager am = (ActivityManager)context.getSystemService("activity");
+/* 48 */ List infos = am.getRunningServices(100);
+/* 49 */ for (ActivityManager.RunningServiceInfo serviceInfo : infos) {
+/* 50 */ if (serviceInfo.service.getClassName().equals(serviceName)) {
+/* 51 */ return true;
+/* */ }
+/* */ }
+/* 54 */ return false;
+/* */ }
+/* */
+/* */
+/* */ public void enable() {
+/* 59 */ this.isEnabled = true;
+/* */ }
+/* */
+/* */
+/* */ public void disable() {
+/* 64 */ this.isEnabled = false;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\Scanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/Scanner1D.java b/app/src/main/java/com/seuic/scanner/Scanner1D.java
new file mode 100644
index 0000000..f6c24d3
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/Scanner1D.java
@@ -0,0 +1,327 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.os.Handler;
+/* */ import android.os.Message;
+/* */ import android.util.Log;
+/* */ import android.util.SparseIntArray;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ class Scanner1D
+/* */ extends Scanner
+/* */ {
+/* */ private static final String LOG_TAG = "Scanner1D";
+/* */ private static DecodeCallback callback;
+/* */ private static DecodeInfoCallBack infoCallBack;
+/* */ private Thread mThread;
+/* */ public boolean isOpened = false;
+/* */ protected int laser_time;
+/* */
+/* */ static {
+/* 45 */ System.loadLibrary("Scanner1D");
+/* */
+/* 47 */ paramArray.put(1, 1);
+/* 48 */ paramArray.put(3, 3);
+/* 49 */ paramArray.put(4, 4);
+/* 50 */ paramArray.put(6, 5);
+/* */
+/* 52 */ paramArray.put(257, 145);
+/* 53 */ paramArray.put(258, 146);
+/* 54 */ paramArray.put(259, 147);
+/* 55 */ paramArray.put(260, 148);
+/* 56 */ paramArray.put(261, 149);
+/* 57 */ paramArray.put(262, 150);
+/* 58 */ paramArray.put(263, 151);
+/* 59 */ paramArray.put(264, 152);
+/* 60 */ paramArray.put(265, 153);
+/* 61 */ paramArray.put(266, 154);
+/* 62 */ paramArray.put(267, 155);
+/* 63 */ paramArray.put(268, 156);
+/* 64 */ paramArray.put(269, 157);
+/* 65 */ paramArray.put(270, 158);
+/* 66 */ paramArray.put(272, 159);
+/* */
+/* 68 */ paramArray.put(289, 273);
+/* 69 */ paramArray.put(292, 275);
+/* 70 */ paramArray.put(293, 274);
+/* */
+/* 72 */ paramArray.put(305, 289);
+/* 73 */ paramArray.put(306, 290);
+/* 74 */ paramArray.put(307, 291);
+/* 75 */ paramArray.put(308, 292);
+/* 76 */ paramArray.put(309, 293);
+/* 77 */ paramArray.put(310, 294);
+/* 78 */ paramArray.put(311, 295);
+/* 79 */ paramArray.put(312, 296);
+/* 80 */ paramArray.put(313, 297);
+/* */
+/* 82 */ paramArray.put(321, 305);
+/* 83 */ paramArray.put(322, 306);
+/* 84 */ paramArray.put(323, 307);
+/* */
+/* 86 */ paramArray.put(337, 321);
+/* 87 */ paramArray.put(338, 322);
+/* 88 */ paramArray.put(339, 323);
+/* 89 */ paramArray.put(340, 324);
+/* 90 */ paramArray.put(341, 325);
+/* */
+/* 92 */ paramArray.put(353, 337);
+/* 93 */ paramArray.put(354, 338);
+/* 94 */ paramArray.put(355, 339);
+/* */
+/* 96 */ paramArray.put(513, 353);
+/* 97 */ paramArray.put(514, 354);
+/* 98 */ paramArray.put(515, 355);
+/* */
+/* 100 */ paramArray.put(401, 369);
+/* 101 */ paramArray.put(402, 370);
+/* 102 */ paramArray.put(403, 371);
+/* */
+/* 104 */ paramArray.put(369, 385);
+/* 105 */ paramArray.put(370, 386);
+/* 106 */ paramArray.put(371, 387);
+/* */
+/* 108 */ paramArray.put(385, 401);
+/* 109 */ paramArray.put(386, 402);
+/* 110 */ paramArray.put(387, 403);
+/* */ }
+/* */
+/* */ public SparseIntArray getAllParams() {
+/* 114 */ return paramArray;
+/* */ }
+/* */
+/* 117 */ private Runnable runnable = new Runnable()
+/* */ {
+/* */ public void run()
+/* */ {
+/* */ while (true) {
+/* 122 */ synchronized (Scanner1D.this.runnable) {
+/* */ try {
+/* 124 */ Scanner1D.this.runnable.wait();
+/* 125 */ } catch (InterruptedException e) {
+/* 126 */ Log.i("Scanner1D", "Error:" + e.getMessage());
+/* */ }
+/* 128 */ Scanner1D.this.decode();
+/* */ }
+/* */ }
+/* */ }
+/* */ };
+/* */
+/* 134 */ private Handler mHandler = new DecodeHandler();
+/* */
+/* */ Scanner1D(Context context) {
+/* 137 */ super(context);
+/* */ }
+/* */
+/* */
+/* */ public boolean open() {
+/* 142 */ if (this.isOpened) {
+/* 143 */ return true;
+/* */ }
+/* */
+/* 146 */ if (JNIOpen()) {
+/* 147 */ this.isOpened = true;
+/* 148 */ this.laser_time = getLaserTime();
+/* 149 */ this.mThread = new Thread(this.runnable);
+/* 150 */ this.mThread.start();
+/* 151 */ return true;
+/* */ }
+/* 153 */ return false;
+/* */ }
+/* */
+/* */ public void close() {
+/* 157 */ JNIClose();
+/* 158 */ this.isOpened = false;
+/* */ }
+/* */
+/* */
+/* */ public void startScan() {
+/* 163 */ scan();
+/* */ }
+/* */
+/* */ void scan() {
+/* 167 */ if (!scanFinished.booleanValue()) {
+/* */ return;
+/* */ }
+/* */
+/* 171 */ synchronized (this.runnable) {
+/* 172 */ this.runnable.notify();
+/* */ }
+/* */ }
+/* */
+/* */
+/* 177 */ static Boolean scanFinished = Boolean.valueOf(true);
+/* */ private void decode() {
+/* 179 */ synchronized (this) {
+/* 180 */ scanFinished = Boolean.valueOf(false);
+/* 181 */ BarcodeInfo barcodeInfo = new BarcodeInfo();
+/* */
+/* 183 */ if (this.isEnabled &&
+/* 184 */ JNIGetBarcode(barcodeInfo, this.laser_time)) {
+/* */
+/* 186 */ ScanLed.setLed(1);
+/* 187 */ Message msg = this.mHandler.obtainMessage();
+/* 188 */ msg.obj = barcodeInfo;
+/* 189 */ this.mHandler.sendMessage(msg);
+/* */ }
+/* */
+/* 192 */ scanFinished = Boolean.valueOf(true);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void stopScan() {
+/* 198 */ JNIStopScan();
+/* */ }
+/* */
+/* */
+/* */ public void enable() {
+/* 203 */ JNIEnableScan();
+/* 204 */ this.isEnabled = true;
+/* */ }
+/* */
+/* */
+/* */ public void disable() {
+/* 209 */ JNIDisableScan();
+/* 210 */ this.isEnabled = false;
+/* */ }
+/* */
+/* */
+/* */ public boolean setParams(int id, int value) {
+/* 215 */ if (paramArray.get(id, -1) == -1 && id != 801) {
+/* 216 */ return false;
+/* */ }
+/* */
+/* 219 */ boolean ret = false;
+/* */
+/* 221 */ if (id == 801) {
+/* 222 */ ret = JNIFactoryDefault();
+/* 223 */ if (ret) {
+/* */
+/* */ try {
+/* 226 */ Thread.sleep(500L);
+/* 227 */ this.laser_time = getLaserTime();
+/* 228 */ } catch (Exception exception) {}
+/* */ }
+/* */
+/* */
+/* 232 */ return ret;
+/* */ }
+/* */
+/* 235 */ ScanParam param = new ScanParam();
+/* 236 */ param.id = paramArray.get(id);
+/* 237 */ param.value = value;
+/* 238 */ ret = JNISetParam(param);
+/* 239 */ if (ret && id == 1) {
+/* 240 */ setLaserTime(value);
+/* */ }
+/* 242 */ return ret;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public int getParams(int id) {
+/* 248 */ if (paramArray.get(id, -1) == -1) {
+/* 249 */ return -1;
+/* */ }
+/* */
+/* 252 */ ScanParam param = new ScanParam();
+/* 253 */ param.id = paramArray.get(id);
+/* 254 */ boolean ret = JNIGetParam(param);
+/* */
+/* 256 */ if (ret) {
+/* 257 */ return param.value;
+/* */ }
+/* 259 */ return -1;
+/* */ }
+/* */
+/* */ private class BarcodeInfo {
+/* */ public String data;
+/* */ public int length;
+/* */ public String type;
+/* */
+/* */ private BarcodeInfo() {} }
+/* */
+/* */ public void setDecodeCallBack(DecodeCallback decodeCallback) {
+/* 270 */ callback = decodeCallback;
+/* */ }
+/* */
+/* */ static class DecodeHandler extends Handler {
+/* */ public void handleMessage(Message msg) {
+/* 275 */ BarcodeInfo barcodeInfo = (BarcodeInfo)msg.obj;
+/* 276 */ if (Scanner1D.callback != null && !"".equals(barcodeInfo.data)) {
+/* 277 */ Scanner1D.callback.onDecodeComplete(barcodeInfo.data);
+/* */ }
+/* */
+/* 280 */ if (Scanner1D.infoCallBack != null && !"".equals(barcodeInfo.data)) {
+/* 281 */ DecodeInfo info = new DecodeInfo();
+/* 282 */ info.barcode = barcodeInfo.data;
+/* 283 */ info.codetype = barcodeInfo.type;
+/* 284 */ info.length = barcodeInfo.length;
+/* 285 */ Scanner1D.infoCallBack.onDecodeComplete(info);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void setDecodeInfoCallBack(DecodeInfoCallBack callback) {
+/* 293 */ infoCallBack = callback;
+/* */ }
+/* */
+/* */ protected int getLaserTime() {
+/* 297 */ return -1;
+/* */ }
+/* */
+/* */ protected void setLaserTime(int time) {
+/* 301 */ this.laser_time = time;
+/* */ }
+/* */
+/* */ public final native boolean JNIOpen();
+/* */
+/* */ public final native void JNIClose();
+/* */
+/* */ public final native boolean JNIGetBarcode(BarcodeInfo paramBarcodeInfo, int paramInt);
+/* */
+/* */ public final native boolean JNIStopScan();
+/* */
+/* */ public final native boolean JNISetParam(ScanParam paramScanParam);
+/* */
+/* */ public final native boolean JNIGetParam(ScanParam paramScanParam);
+/* */
+/* */ public final native void JNIEnableScan();
+/* */
+/* */ public final native void JNIDisableScan();
+/* */
+/* */ private final native boolean JNIFactoryDefault();
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\Scanner1D.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/ScannerFactory.java b/app/src/main/java/com/seuic/scanner/ScannerFactory.java
new file mode 100644
index 0000000..217a6b7
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/ScannerFactory.java
@@ -0,0 +1,60 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */
+/* */
+/* */
+/* */ public class ScannerFactory
+/* */ {
+/* */ static final String SCN_SE4500 = "se4500";
+/* */ static final String SCN_N5600 = "N5600";
+/* */ static final String SCN_SE955 = "SE955";
+/* */ static final String SCN_SE965 = "SE965";
+/* */ static final String SCN_N4313 = "N4313";
+/* */ static final String SCN_UE966 = "UE966";
+/* */ static final String SCN_SE655 = "SE655";
+/* */ static final String SCN_SE4710 = "SE4710";
+/* */ private static Scanner scanner;
+/* */ private static scanid mScanid;
+/* */
+/* */ public static Scanner getScanner(Context context) {
+/* 21 */ Scanner.stopScanService(context);
+/* */
+/* 23 */ return getScannerNoStopService(context);
+/* */ }
+/* */
+/* */
+/* */ private static Scanner getScannerNoStopService(Context context) {
+/* 28 */ if (scanner == null) {
+/* */
+/* 30 */ mScanid = new scanid();
+/* 31 */ String deviceName = mScanid.readScanner();
+/* 32 */ if (deviceName != null) {
+/* 33 */ if (deviceName.equals("N4313")) {
+/* 34 */ scanner = new N4313Scanner(context);
+/* 35 */ } else if (deviceName.equals("SE955") ||
+/* 36 */ deviceName.equals("SE965") ||
+/* 37 */ deviceName.equals("SE655")) {
+/* 38 */ scanner = new SE955Scanner(context);
+/* 39 */ } else if (deviceName.endsWith("UE966")) {
+/* 40 */ scanner = new UE966Scanner(context);
+/* 41 */ } else if (deviceName.equals("N5600")) {
+/* 42 */ scanner = new HHPScanner(context);
+/* 43 */ } else if (deviceName.equals("se4500") ||
+/* 44 */ deviceName.equals("SE4710")) {
+/* 45 */ scanner = new SE4500Scanner(context);
+/* */ }
+/* */ } else {
+/* 48 */ scanner = new HHPScanner(context);
+/* */ }
+/* */ }
+/* */
+/* 52 */ return scanner;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\ScannerFactory.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/ScannerKey.java b/app/src/main/java/com/seuic/scanner/ScannerKey.java
new file mode 100644
index 0000000..8d88443
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/ScannerKey.java
@@ -0,0 +1,31 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class ScannerKey
+/* */ {
+/* 11 */ static scankey mScankey = new scankey();
+/* */ public static final int KEY_DOWN = 1;
+/* */
+/* */ public static int open() {
+/* 15 */ return mScankey.openScanKey();
+/* */ }
+/* */ public static final int KEY_UP = 0;
+/* */ public static int getKeyEvent() {
+/* 19 */ return mScankey.waitScanKey();
+/* */ }
+/* */
+/* */ public static void close() {
+/* 23 */ mScankey.closeScanKey();
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\ScannerKey.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/StringUtils.java b/app/src/main/java/com/seuic/scanner/StringUtils.java
new file mode 100644
index 0000000..dea0064
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/StringUtils.java
@@ -0,0 +1,191 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final class StringUtils
+/* */ {
+/* 12 */ private static final String PLATFORM_DEFAULT_ENCODING = System.getProperty("file.encoding");
+/* */
+/* */ public static final String SHIFT_JIS = "SJIS";
+/* */ private static final String EUC_JP = "EUC_JP";
+/* */ private static final String UTF8 = "UTF8";
+/* */ private static final String GB2312 = "GB2312";
+/* */ private static final String ISO88591 = "ISO8859_1";
+/* 19 */ private static final boolean ASSUME_SHIFT_JIS = !(!"SJIS".equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING) &&
+/* 20 */ !"EUC_JP".equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING));
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static String guessEncoding(byte[] bytes) {
+/* 33 */ if (bytes.length > 3 &&
+/* 34 */ bytes[0] == -17 &&
+/* 35 */ bytes[1] == -69 &&
+/* 36 */ bytes[2] == -65) {
+/* 37 */ return "UTF8";
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 46 */ int length = bytes.length;
+/* 47 */ boolean canBeISO88591 = true;
+/* 48 */ boolean canBeShiftJIS = true;
+/* 49 */ boolean canBeUTF8 = true;
+/* */
+/* 51 */ boolean canBeGB2312 = true;
+/* */
+/* 53 */ int utf8BytesLeft = 0;
+/* 54 */ int maybeDoubleByteCount = 0;
+/* 55 */ int maybeSingleByteKatakanaCount = 0;
+/* 56 */ boolean sawLatin1Supplement = false;
+/* 57 */ boolean sawUTF8Start = false;
+/* 58 */ boolean lastWasPossibleDoubleByteStart = false;
+/* */
+/* 60 */ for (int i = 0; i < length && (canBeISO88591 || canBeShiftJIS || canBeUTF8); i++) {
+/* */
+/* 62 */ int value = bytes[i] & 0xFF;
+/* */
+/* */
+/* 65 */ if (value >= 128 && value <= 191) {
+/* 66 */ if (utf8BytesLeft > 0) {
+/* 67 */ utf8BytesLeft--;
+/* */ }
+/* */ } else {
+/* 70 */ if (utf8BytesLeft > 0) {
+/* 71 */ canBeUTF8 = false;
+/* */ }
+/* 73 */ if (value >= 192 && value <= 253) {
+/* 74 */ sawUTF8Start = true;
+/* 75 */ int valueCopy = value;
+/* 76 */ while ((valueCopy & 0x40) != 0) {
+/* 77 */ utf8BytesLeft++;
+/* 78 */ valueCopy <<= 1;
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* 84 */ if (!canBeUTF8 && canBeGB2312 &&
+/* 85 */ value > 127 &&
+/* 86 */ value > 176 && value < 247) {
+/* 87 */ int value2 = bytes[i + 1] & 0xFF;
+/* 88 */ if (value2 > 160 && value2 <= 247) {
+/* 89 */ canBeGB2312 = true;
+/* */
+/* */
+/* */
+/* */ break;
+/* */ }
+/* */ }
+/* */
+/* */
+/* 98 */ if ((value == 194 || value == 195) && i < length - 1) {
+/* */
+/* */
+/* */
+/* 102 */ int nextValue = bytes[i + 1] & 0xFF;
+/* 103 */ if (nextValue <= 191 && ((
+/* 104 */ value == 194 && nextValue >= 160) || (value == 195 && nextValue >= 128))) {
+/* 105 */ sawLatin1Supplement = true;
+/* */ }
+/* */ }
+/* 108 */ if (value >= 127 && value <= 159) {
+/* 109 */ canBeISO88591 = false;
+/* */ }
+/* */
+/* */
+/* */
+/* 114 */ if (value >= 161 && value <= 223)
+/* */ {
+/* 116 */ if (!lastWasPossibleDoubleByteStart) {
+/* 117 */ maybeSingleByteKatakanaCount++;
+/* */ }
+/* */ }
+/* 120 */ if (!lastWasPossibleDoubleByteStart && ((
+/* 121 */ value >= 240 && value <= 255) || value == 128 || value == 160)) {
+/* 122 */ canBeShiftJIS = false;
+/* */ }
+/* 124 */ if ((value >= 129 && value <= 159) || (value >= 224 && value <= 239)) {
+/* */
+/* */
+/* 127 */ if (lastWasPossibleDoubleByteStart) {
+/* */
+/* */
+/* */
+/* */
+/* 132 */ lastWasPossibleDoubleByteStart = false;
+/* */ }
+/* */ else {
+/* */
+/* 136 */ lastWasPossibleDoubleByteStart = true;
+/* 137 */ if (i >= bytes.length - 1) {
+/* 138 */ canBeShiftJIS = false;
+/* */ } else {
+/* 140 */ int nextValue = bytes[i + 1] & 0xFF;
+/* 141 */ if (nextValue < 64 || nextValue > 252) {
+/* 142 */ canBeShiftJIS = false;
+/* */ } else {
+/* 144 */ maybeDoubleByteCount++;
+/* */ }
+/* */
+/* */ }
+/* */ }
+/* */ } else {
+/* */
+/* 151 */ lastWasPossibleDoubleByteStart = false;
+/* */ }
+/* */ }
+/* 154 */ if (utf8BytesLeft > 0) {
+/* 155 */ canBeUTF8 = false;
+/* */ }
+/* */
+/* */
+/* 159 */ if (canBeShiftJIS && ASSUME_SHIFT_JIS) {
+/* 160 */ return "SJIS";
+/* */ }
+/* 162 */ if (canBeUTF8 && sawUTF8Start) {
+/* 163 */ return "UTF8";
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 170 */ if (canBeShiftJIS && (maybeDoubleByteCount >= 3 || 20 * maybeSingleByteKatakanaCount > length)) {
+/* 171 */ return "SJIS";
+/* */ }
+/* */
+/* */
+/* 175 */ if (canBeGB2312) {
+/* 176 */ return "GB2312";
+/* */ }
+/* */
+/* 179 */ if (!sawLatin1Supplement && canBeISO88591) {
+/* 180 */ return "ISO8859_1";
+/* */ }
+/* */
+/* 183 */ return PLATFORM_DEFAULT_ENCODING;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\StringUtils.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/UE966Scanner.java b/app/src/main/java/com/seuic/scanner/UE966Scanner.java
new file mode 100644
index 0000000..57cba7c
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/UE966Scanner.java
@@ -0,0 +1,30 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ import android.content.Context;
+/* */ import android.util.SparseIntArray;
+/* */
+/* */ public class UE966Scanner
+/* */ extends Scanner1D {
+/* */ UE966Scanner(Context context) {
+/* 9 */ super(context);
+/* */ }
+/* */
+/* */
+/* */ protected int getLaserTime() {
+/* 14 */ int laserTime = getParams(1);
+/* 15 */ if (laserTime > 0) {
+/* 16 */ return laserTime * 100;
+/* */ }
+/* 18 */ return 3000;
+/* */ }
+/* */
+/* */ protected void setLaserTime(int time) {
+/* 22 */ this.laser_time = time * 100;
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\UE966Scanner.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/scanid.java b/app/src/main/java/com/seuic/scanner/scanid.java
new file mode 100644
index 0000000..0270770
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/scanid.java
@@ -0,0 +1,18 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ public class scanid {
+/* */ static {
+/* 5 */ System.loadLibrary("ScannerId");
+/* */ }
+/* */ public String readScanner() {
+/* 8 */ return JNIReadScanId();
+/* */ }
+/* */
+/* */ public final native String JNIReadScanId();
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\scanid.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/seuic/scanner/scankey.java b/app/src/main/java/com/seuic/scanner/scankey.java
new file mode 100644
index 0000000..9bef6ea
--- /dev/null
+++ b/app/src/main/java/com/seuic/scanner/scankey.java
@@ -0,0 +1,31 @@
+/* */ package com.seuic.scanner;
+/* */
+/* */ class scankey {
+/* */ static {
+/* 5 */ System.loadLibrary("ScannerKey");
+/* */ }
+/* */
+/* */ public int openScanKey() {
+/* 9 */ return JNIOpenScanKey();
+/* */ }
+/* */
+/* */ public int waitScanKey() {
+/* 13 */ return JNIWaitScanKey();
+/* */ }
+/* */
+/* */ public void closeScanKey() {
+/* 17 */ JNICloseScanKey();
+/* */ }
+/* */
+/* */ private native int JNIOpenScanKey();
+/* */
+/* */ private native int JNIWaitScanKey();
+/* */
+/* */ private native void JNICloseScanKey();
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\scankey.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/com/sys/SysData.java b/app/src/main/java/com/sys/SysData.java
new file mode 100644
index 0000000..2e73ab1
--- /dev/null
+++ b/app/src/main/java/com/sys/SysData.java
@@ -0,0 +1,16 @@
+package com.sys;
+
+public class SysData {
+ public static String url;
+ public static String jigid;
+ public static String userid;
+ public static String lgnname;
+ public static String clientid;
+ public static float scale;//屏幕密度
+ public static float t_scale=1f; //与200dpi的相对放大比例
+ public static int timeout=30000;//超时设置120000
+ public static boolean is_lx=false;
+ public static String isreg="N";
+ public static int exectime=60;
+ public static String no;
+}
diff --git a/app/src/main/java/com/util/BitMapUtil.java b/app/src/main/java/com/util/BitMapUtil.java
new file mode 100644
index 0000000..cbcfaa2
--- /dev/null
+++ b/app/src/main/java/com/util/BitMapUtil.java
@@ -0,0 +1,37 @@
+package com.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+public class BitMapUtil {
+ public static Bitmap generateBitMap(String url) throws IOException {
+ URL myFileUrl = null;
+ Bitmap bitmap = null;
+ myFileUrl = new URL(url);
+ HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();
+ conn.setDoInput(true);
+ conn.connect();
+ InputStream is = conn.getInputStream();
+ bitmap = BitmapFactory.decodeStream(is);
+ is.close();
+ conn.disconnect();
+ return bitmap;
+ }
+ public static Bitmap byteToBitmap(byte[] b){
+ if(b==null){
+ return null;
+ }
+ int len=b.length;
+ if(len!=0){
+ return BitmapFactory.decodeByteArray(b, 0,len);
+ }else{
+ return null;
+ }
+ }
+}
diff --git a/app/src/main/java/com/util/DateUtil.java b/app/src/main/java/com/util/DateUtil.java
new file mode 100644
index 0000000..51f9b10
--- /dev/null
+++ b/app/src/main/java/com/util/DateUtil.java
@@ -0,0 +1,61 @@
+package com.util;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+public class DateUtil {
+ /*
+ * 得到当前日期
+ */
+ public static String getDate() {
+ Date now = new Date();
+// Calendar cal = Calendar.getInstance();
+// DateFormat d1 = DateFormat.getDateInstance(); //默认语言(汉语)下的默认风格(MEDIUM风格,比如:2008-6-16 20:54:53)
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss");
+ return dateFormat.format(now);
+ }
+ public static Date getDate(String s) throws ParseException {
+ SimpleDateFormat dateformat2=new SimpleDateFormat("yyyy-MM-dd");
+ return dateformat2.parse(s);
+ }
+ /*
+ * 得到当前日期
+ */
+ public static String getDate1() {
+ Date now = new Date();
+ SimpleDateFormat dateformat2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return dateformat2.format(now);
+ }
+ /*
+ * 得到当前时间
+ */
+ public static String getTime() {
+ Date now = new Date();
+ Calendar cal = Calendar.getInstance();
+ DateFormat d3 = DateFormat.getTimeInstance();
+ return d3.format(now);
+ }
+ /*
+ * 得到当前日期和时间
+ */
+ public static String getDateAndTime() {
+ Date now = new Date();
+ Calendar cal = Calendar.getInstance();
+ DateFormat d1 = DateFormat.getDateTimeInstance(); //默认语言(汉语)下的默认风格(MEDIUM风格,比如:2008-6-16 20:54:53)
+ return d1.format(now);
+ }
+ // 天数相加减
+ public static Date getDate(Date date, int amount) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(Calendar.DATE, amount);
+ return calendar.getTime();
+ }
+ public static void main(String[] args) {
+ System.out.println(DateUtil.getDateAndTime()+"---"+DateUtil.getTime());
+ }
+}
diff --git a/app/src/main/java/com/util/DialogUtil.java b/app/src/main/java/com/util/DialogUtil.java
new file mode 100644
index 0000000..3a32a75
--- /dev/null
+++ b/app/src/main/java/com/util/DialogUtil.java
@@ -0,0 +1,84 @@
+package com.util;
+
+import com.chaoran.entiry.SelfEditText;
+import com.example.chaoran.DjActivity;
+import com.example.chaoran.MainActivity;
+
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.text.Spannable;
+import android.text.SpannableStringBuilder;
+import android.text.style.AbsoluteSizeSpan;
+import android.util.Log;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+
+public class DialogUtil {
+ // 错误消息对话框
+ public static void builder(final Context context, String title, String message,
+ int fontSize) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ SpannableStringBuilder ssBuilser = new SpannableStringBuilder(message);
+ builder.setTitle(title);
+ if (fontSize > 0) {
+ AbsoluteSizeSpan span = new AbsoluteSizeSpan(fontSize);
+ ssBuilser.setSpan(span, 0, message.length(),
+ Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ builder.setMessage(ssBuilser);
+ } else {
+ builder.setMessage(message);
+ }
+ builder.setPositiveButton("确定", new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ // TODO Auto-generated method stub
+ if (DjActivity.cr5wScanControl != null && "DjActivity".equals(context.getClass().getSimpleName())) {
+ DjActivity.cr5wScanControl.setIsOpen(true);
+ DjActivity.cr5wScanControl.start(context);
+ } else if (DjActivity.nr510ScanControl != null && "DjActivity".equals(context.getClass().getSimpleName())) {
+ DjActivity.nr510ScanControl.start(context);
+ } else if (DjActivity.barcodeReader != null && "DjActivity".equals(context.getClass().getSimpleName())) {
+ try {
+ // DjActivity.triggerState = true;
+ DjActivity.barcodeReader.light(true); //turn on/off backlight
+ DjActivity.barcodeReader.aim(true); //开关瞄准线
+ DjActivity.barcodeReader.decode(true); //开关解码功能
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ if (DjActivity.m_view != null) {
+ if (DjActivity.m_view instanceof SelfEditText) {
+ ((SelfEditText)DjActivity.m_view).selectAll();
+ }
+ DjActivity.m_view = null;
+ }
+ }
+ });
+ builder.create();
+ builder.show();
+ if (DjActivity.cr5wScanControl != null && "DjActivity".equals(context.getClass().getSimpleName()))
+ DjActivity.cr5wScanControl.setIsOpen(false);
+ }
+
+ public static void builderCancel(Context context, String title,
+ String message, OnClickListener okListener) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(title);
+ builder.setMessage(message);
+ builder.setPositiveButton("确定", okListener);
+ builder.setNegativeButton("取消", null);
+ builder.create();
+ builder.show();
+ }
+
+ public static void setDialog(ProgressDialog pd, String title, String message) {
+ pd.setTitle(title);
+ pd.setMessage(message);
+ pd.show();
+ }
+}
diff --git a/app/src/main/java/com/util/DjMenuFun.java b/app/src/main/java/com/util/DjMenuFun.java
new file mode 100644
index 0000000..b756599
--- /dev/null
+++ b/app/src/main/java/com/util/DjMenuFun.java
@@ -0,0 +1,185 @@
+package com.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.text.DateFormat;
+
+import map.baidu.com.BDMapActivity;
+
+import org.kobjects.base64.Base64;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.view.View;
+
+import com.chaoran.imp.InputInterface;
+import com.example.chaoran.DjActivity;
+import com.example.chaoran.ExitThread;
+import com.example.chaoran.MipcaActivityCapture;
+import com.example.chaoran.NetWorkSet;
+import com.example.chaoran.RunYmupThread;
+import com.sys.SysData;
+
+public class DjMenuFun {
+ public void Msave_dj(final DjActivity djActivity) throws Exception {
+// if(djActivity.pd.isShowing()){
+// return;
+// }
+ new AlertDialog.Builder(djActivity).setTitle("确定取消框")
+ .setMessage("确定保存单据")
+ .setPositiveButton("确定", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ Map map = new HashMap();
+ Object ob=DjUtil.saveOrganizationHzData(djActivity.hzTab,djActivity.pageMap.get("GZID"));
+ Map hzData=null;
+ if(ob instanceof Map){
+ hzData=(Map)ob;
+ }else{
+ View view=(View)ob;
+ if(view.isEnabled()){
+ ((View)ob).requestFocus();
+ }
+ DialogUtil.builder(djActivity, "错误信息", ((InputInterface)ob).getLabel().concat("不能为空"),0);
+ djActivity.pd.dismiss();
+ return;
+ }
+// Map hzData = DjUtil.organizationHzData(djActivity.layout);
+ ((HashMap)hzData.get("hzData")).putAll(djActivity.pageMap);
+ map.put("hzData", hzData);
+// if (djActivity.mxData.size() > 0) {
+// map.put("mxSql", djActivity.mxSql);
+// map.put("mxData", DjUtil.organizationMxData(djActivity.mxData,
+// djActivity.pageMap.get("GZID")));
+// } else {
+// map.put("mxSql", "");
+// map.put("mxData", null);
+// }
+ map.put("gzid", djActivity.pageMap.get("GZID"));
+ map.put("mxTempTable", djActivity.mxTempTable);
+ map.put("djlx", djActivity.pageMap.get("DJLX"));
+ map.put("djbs", djActivity.pageMap.get("DJBS"));
+ byte[] b;
+ try {
+ b = IoUtil.getbyte(map);
+ String paramString = Base64.encode(b);
+ DialogUtil.setDialog(djActivity.pd, "消息提示", "单据保存……");
+ new RunYmupThread(paramString, djActivity.runHandler, "saveDj",0).start();
+ } catch (Exception e) {
+ DialogUtil.setDialog(djActivity.pd, "消息提示", "参数转换成流失败……");
+ }
+ }
+ })
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ }).show();
+
+ }
+
+ public void Mdj_over(final DjActivity djActivity) {
+ new AlertDialog.Builder(djActivity).setTitle("确定取消框").setMessage("确定退出")
+ .setPositiveButton("确定", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ exitDj(djActivity);
+ }})
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ }).show();
+ }
+ public void exitDj(DjActivity djActivity){
+ DialogUtil.setDialog(djActivity.pd, "消息提示", "单据退出……");
+ new ExitThread(djActivity.pageMap.get("GZID"), djActivity.mxTempTable,
+ djActivity.runHandler,"exitDj").start();
+ }
+ public String getusername(DjActivity djActivity) {
+ return SysData.lgnname;
+ }
+
+ public String getjigid(DjActivity djActivity) {
+ return SysData.jigid;
+ }
+ public String getclientid(DjActivity djActivity) {
+ return SysData.clientid.replaceAll(":", "");
+ }
+ public String getdate(DjActivity djActivity) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd");
+ Date date1 = dateFormat.parse(djActivity.pageMap.get("RQ"));
+// java.text.DateFormat d3 = DateFormat.getDateInstance();
+ return dateFormat.format(date1);
+ }
+
+ public String getdatetime(DjActivity djActivity) {
+ return djActivity.pageMap.get("RQ");
+ }
+
+ /*
+ * -取得当前月份
+ */
+ public int getmonth(DjActivity djActivity) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd kk:mm:ss");
+ Date date1 = dateFormat.parse(djActivity.pageMap.get("RQ"));
+ Calendar calendar = GregorianCalendar.getInstance();
+ calendar.setTime(date1);
+ return calendar.get(Calendar.MONTH) + 1;
+ }
+
+ /*
+ * -取得当前年份
+ */
+ public int getyear(DjActivity djActivity) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd kk:mm:ss");
+ Date date1 = dateFormat.parse(djActivity.pageMap.get("RQ"));
+ Calendar calendar = GregorianCalendar.getInstance();
+ calendar.setTime(date1);
+ return calendar.get(Calendar.YEAR);
+ }
+
+ /*
+ * -取得当前天数
+ */
+ public int getday(DjActivity djActivity) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd kk:mm:ss");
+ Date date1 = dateFormat.parse(djActivity.pageMap.get("RQ"));
+ Calendar calendar = GregorianCalendar.getInstance();
+ calendar.setTime(date1);
+ return calendar.get(Calendar.DATE);
+ }
+ /*
+ * 定位当前位置
+ */
+ public void Mlocation(DjActivity djActivity){
+ Intent intent = new Intent();
+ intent.setClass(djActivity,BDMapActivity.class);
+ djActivity.startActivityForResult(intent,3);
+ }
+ /*
+ * 调用摄像头扫描条码
+ */
+ public void scan(DjActivity djActivity,String funName){
+ String uiId=funName.substring(5, funName.length()-1);
+ Intent intent = new Intent();
+ intent.setClass(djActivity,MipcaActivityCapture.class);
+ intent.putExtra("uiId", uiId);
+ djActivity.startActivityForResult(intent,4);
+ }
+ public static void main(String[] args) {
+ String funName="scan(ckname)";
+ String uiId=funName.substring(5, funName.length()-6);
+ System.out.println(funName+"----"+uiId);
+ }
+}
diff --git a/app/src/main/java/com/util/DjUtil.java b/app/src/main/java/com/util/DjUtil.java
new file mode 100644
index 0000000..076ba48
--- /dev/null
+++ b/app/src/main/java/com/util/DjUtil.java
@@ -0,0 +1,391 @@
+package com.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.chaoran.entiry.PhotographUi;
+import com.chaoran.entiry.SelfCheckBox;
+import com.chaoran.entiry.SelfEditText;
+import com.chaoran.entiry.SelfImage;
+import com.chaoran.entiry.SelfTextBut;
+import com.chaoran.imp.InputInterface;
+import com.chaoran.thread.ImageUrl;
+
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.CompressFormat;
+import android.os.Handler;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TabHost;
+import android.widget.TextView;
+
+/*
+ * 单据工具类
+ */
+public class DjUtil {
+ public static void setUiValue(TabHost layout, Map map, Map pageMap,
+ Handler imgHandler) {
+ Set set = map.keySet();
+ View view = null;
+ String name = null;
+ Object value = null;
+ int fcolor = -1;
+ int bcolor = -1;
+ if (map.containsKey("__FCOLOR")) {
+ String __fcolor = map.get("__FCOLOR").toString().trim();
+ if (__fcolor.length() > 0) {
+ fcolor = Integer.decode(__fcolor);
+ }
+ }
+ if (map.containsKey("__BCOLOR")) {
+ String __bcolor = map.get("__BCOLOR").toString().trim();
+ if (__bcolor.length() > 0) {
+ bcolor = Integer.decode(__bcolor);
+ }
+ }
+ for (String s : set) {
+ name = s.toUpperCase().trim();
+ value = map.get(s).toString().trim();
+ view = layout.findViewWithTag(name);
+ if (view != null) {
+ setText(view, value, imgHandler, fcolor, bcolor);
+ } else if (pageMap.containsKey(name)) {
+ if (!pageMap.get(name).equals(value)) {
+ pageMap.put(name, value);
+ }
+ }
+ }
+ }
+
+ private static void setText(View view, Object value, Handler imgHandler,
+ int fcolor, int bcolor) {
+ // if (view instanceof SelfEditText) {
+ // System.out.println(value+"=============");
+ // ((EditText) view).setText(value);
+ // }else if(view instanceof CheckBox){
+ // boolean b=false;
+ // if(value.trim().equals("是")){
+ // b=true;
+ // }
+ // ((CheckBox) view).setChecked(b);
+ // }else if(view instanceof SelfTextBut){
+ // ((SelfTextBut) view).setText(value);
+ // }
+ // System.out.println(view.toString()+"---"+value);
+ if (view instanceof InputInterface) {
+ InputInterface iiView = (InputInterface) view;
+ if (fcolor > -1) {
+ iiView.setTextColor(SysUtil.toColor(fcolor));
+ }
+ if (bcolor > -1) {
+ iiView.setBackgroundDrawable(SysUtil.GradientDrawable(SysUtil
+ .toColor(bcolor)));
+ }
+ if(value==null){
+ value="";
+ }
+ iiView.setText(value.toString());
+ if (iiView.getIsTextChange()) {
+ iiView.setIsTextChange(false);
+ }
+ } else if (view instanceof CheckBox) {
+ boolean b = false;
+ if (value.equals("是")) {
+ b = true;
+ }
+ ((CheckBox) view).setChecked(b);
+ } else if (view instanceof ImageView) {
+ // Bitmap bmp =(Bitmap)view.getDrawingCache();
+ SelfImage img = (SelfImage) view;
+ if (img.getBitmap() != null) {
+ img.getBitmap().recycle();
+ }
+ img.setBitmap(null);
+ String val=value.toString();
+ if (val.length() > 0) {
+
+ new Thread(new ImageUrl(img, val, imgHandler)).start();
+ }
+ }else if(view instanceof PhotographUi){
+ PhotographUi photo=(PhotographUi)view;
+ photo.setImageBitmap(BitMapUtil.byteToBitmap((byte[])value));
+ }
+ }
+
+ public static void setUiValue(TabHost layout, List list, Map pageMap,
+ Handler imgHandler) {
+ int len = list.size();
+ Map map = null;
+ String name = null;
+ Object value = null;
+ View view = null;
+// Object ob = null;
+ int fcolor = -1;
+ int bcolor = -1;
+ for (int i = 0; i < len; i++) {
+ map = (Map) list.get(i);
+ name = map.get("fieldname").toString().trim();
+ value = map.get("fieldValue");
+ view = layout.findViewWithTag(name);
+ if (view != null) {
+ if (view instanceof InputInterface) {
+ if (map.containsKey("__FCOLOR")) {
+ String __fcolor = map.get("__FCOLOR").toString().trim();
+ if (__fcolor.length() > 0) {
+ fcolor = Integer.decode(__fcolor);
+ }
+ }
+ if (map.containsKey("__BCOLOR")) {
+ String __bcolor = map.get("__BCOLOR").toString().trim();
+ if (__bcolor.length() > 0) {
+ bcolor = Integer.decode(__bcolor);
+ }
+ }
+ }
+ setText(view, value, imgHandler, fcolor, bcolor);
+ } else if (pageMap.containsKey(name)) {
+ if (!pageMap.get(name).equals(value)) {
+ pageMap.put(name, value);
+ }
+ }
+ }
+ }
+
+ public static void setUiValue2(TabHost layout, Map map, Handler imgHandler) {
+ Set set = map.keySet();
+ View view = null;
+ ArrayList list = new ArrayList();
+ for (String s : set) {
+ view = layout.findViewWithTag(s);
+ if (view != null) {
+ // if (view instanceof SelfEditText) {
+ // ((SelfEditText) view).setText(map.get(s).toString().trim());
+ // } else if (view instanceof TextView) {
+ // ((TextView) view).setText(map.get(s).toString().trim());
+ // }
+ setText(view, map.get(s).toString().trim(), imgHandler, -1, -1);
+ list.add(s);
+ }
+ }
+ for (int i = 0; i < list.size(); i++) {
+ map.remove(list.get(i));
+ }
+ }
+
+ public static Map organizationHzData(TabHost hzhost, String gzid) {
+ FrameLayout fl = hzhost.getTabContentView();
+ int count = fl.getChildCount();
+ MxTabHostContent layout = null;
+ // System.out.println(count + "------------------------总量");
+ Map hzData = new HashMap();
+ ArrayList pzImgList = null;
+ for (int i = 0; i < count; i++) {
+ layout = (MxTabHostContent) fl.getChildAt(i);
+ // System.out.println(layout+"=========");
+ int len = layout.getChildCount();
+ View view = null;
+ String value = null;
+ // System.out.println(len+"---------");
+ for (int j = 0; j < len; j++) {
+ view = layout.getChildAt(j);
+ if (view.getTag() == null) {
+ continue;
+ }
+ if (view instanceof PhotographUi) {
+ if (pzImgList == null) {
+ pzImgList = new ArrayList();
+ }
+ PhotographUi pu = (PhotographUi) view;
+ if (pu.getImageBitmap() != null) {
+ HashMap imgMap = new HashMap();
+ imgMap.put("photo",SysUtil.bitmapToByte(pu.getImageBitmap()));
+ imgMap.put("fieldname", pu.getTag().toString());
+ imgMap.put("gzid", gzid);
+ pzImgList.add(imgMap);
+ }
+ } else {
+ if (view instanceof InputInterface) {
+ InputInterface et = (InputInterface) view;
+ value = et.getText().toString();
+ if (value == null) {
+ value = "";
+ }
+ hzData.put(et.getTag().toString(), value.trim());
+ } else if (view instanceof SelfCheckBox) {
+ SelfCheckBox sfb = (SelfCheckBox) view;
+ boolean b = sfb.isChecked();
+ if (b) {
+ hzData.put(sfb.getTag().toString(), "是");
+ } else {
+ hzData.put(sfb.getTag().toString(), "否");
+ }
+ }
+ }
+ }
+ }
+ HashMap map = new HashMap();
+ map.put("hzData", hzData);
+ if (pzImgList != null) {
+ map.put("pzImgList", pzImgList);
+ }
+ return map;
+ }
+
+ /* 保存方案组织汇总数据 */
+ public static Object saveOrganizationHzData(TabHost hzhost,String gzid) {
+ FrameLayout fl = hzhost.getTabContentView();
+ int count = fl.getChildCount();
+ MxTabHostContent layout = null;
+ ArrayList pzImgList = null;
+ // System.out.println(count + "------------------------总量");
+ Map hzData = new HashMap();
+ for (int i = 0; i < count; i++) {
+ layout = (MxTabHostContent) fl.getChildAt(i);
+ int len = layout.getChildCount();
+ View view = null;
+ String value = null;
+ for (int j = 0; j < len; j++) {
+ view = layout.getChildAt(j);
+ if (view.getTag() == null) {
+ continue;
+ }
+ if (view instanceof PhotographUi) {
+ PhotographUi pu = (PhotographUi) view;
+ if (pu.getImageBitmap() != null) {
+
+ HashMap imgMap = new HashMap();
+ imgMap.put("photo",SysUtil.bitmapToByte(pu.getImageBitmap()));
+ imgMap.put("fieldname", pu.getTag().toString());
+ imgMap.put("gzid", gzid);
+ if (pzImgList == null) {
+ pzImgList = new ArrayList();
+ }
+ pzImgList.add(imgMap);
+ }
+ } else {
+ if (view instanceof InputInterface) {
+ InputInterface et = (InputInterface) view;
+ value = et.getText().toString();
+ if (et.getIsNull()) {
+ if (value == null || value.length() < 1) {
+ return et;
+ }
+ }
+ if (value == null) {
+ value = "";
+ }
+ hzData.put(et.getTag().toString(), value.trim());
+ } else if (view instanceof SelfCheckBox) {
+ SelfCheckBox sfb = (SelfCheckBox) view;
+ boolean b = sfb.isChecked();
+ if (b) {
+ hzData.put(sfb.getTag().toString(), "是");
+ } else {
+ hzData.put(sfb.getTag().toString(), "否");
+ }
+ }
+ }
+ }
+ }
+ HashMap map = new HashMap();
+ map.put("hzData", hzData);
+ if (pzImgList != null) {
+ map.put("pzImgList", pzImgList);
+ }
+ return map;
+ }
+
+ /* 组织明细数据插入sql */
+ public static String createMxSql(ArrayList mxFieldList, String mxTempTable) {
+ int len = mxFieldList.size();
+ if (len < 1) {
+ return null;
+ }
+ StringBuilder mxInsertSql = new StringBuilder();
+ StringBuilder fieldName = new StringBuilder("gzid,dj_sn,dj_sort");// 列名
+ StringBuilder paramName = new StringBuilder(":gzid,:dj_sn,:dj_sort");// 参数名
+ String fdname = null;
+ Map column = null;
+ for (int i = 0; i < len; i++) {
+ column = (Map) mxFieldList.get(i);
+ if (!fieldName.equals("")) {
+ fieldName.append(",");
+ paramName.append(",");
+ }
+ fdname = column.get("fdname").toString().trim();
+ fieldName.append(fdname);
+ paramName.append(":").append(fdname);
+ }
+ mxInsertSql.append("insert ").append(mxTempTable).append("(")
+ .append(fieldName).append(")").append("values(")
+ .append(paramName).append(")");
+ return mxInsertSql.toString();
+ }
+
+ /* 组织明细数据查询sql */
+ public static String createMxQuerySql(ArrayList mxFieldList,
+ String mxTempTable) {
+ int len = mxFieldList.size();
+ if (len < 1) {
+ return null;
+ }
+ StringBuilder mxInsertSql = new StringBuilder();
+ StringBuilder fieldName = new StringBuilder("gzid,dj_sn,dj_sort");// 列名
+ String fdname = null;
+ Map column = null;
+ for (int i = 0; i < len; i++) {
+ column = (Map) mxFieldList.get(i);
+ if (!fieldName.equals("")) {
+ fieldName.append(",");
+ }
+ fdname = column.get("fdname").toString().trim();
+ fieldName.append(fdname);
+ }
+ mxInsertSql.append("select ").append(fieldName).append(" from ")
+ .append(mxTempTable);
+ return mxInsertSql.toString();
+ }
+
+ /* 组织明细数据 */
+ public static ArrayList organizationMxData(List list, String gzid) {
+ ArrayList mxData = new ArrayList();
+ int len = list.size();
+ Map map = null;
+ for (int i = 0; i < len; i++) {
+ map = (Map) list.get(i);
+ map.put("gzid", gzid);
+ map.put("dj_sn", i + 1);
+ map.put("dj_sort", i + 1);
+ mxData.add(map);
+ }
+ return mxData;
+ }
+
+ public static void setFocus(TabHost layout, String focus) {
+ View view = layout.findViewWithTag(focus.toUpperCase().trim());
+ if (view != null) {
+ view.requestFocus();
+ }
+ }
+
+ public static void assembleFangA(HashMap map, ArrayList list) {
+ // if (list != null) {
+ int len = list.size();
+ HashMap tempObMap = null;
+ for (int i = 0; i < len; i++) {
+ tempObMap = (HashMap) list.get(i);
+ map.put(tempObMap.get("funName"), tempObMap);
+ }
+ // }
+ }
+
+}
diff --git a/app/src/main/java/com/util/Dom4jUtil.java b/app/src/main/java/com/util/Dom4jUtil.java
new file mode 100644
index 0000000..d213195
--- /dev/null
+++ b/app/src/main/java/com/util/Dom4jUtil.java
@@ -0,0 +1,591 @@
+package com.util;
+
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import com.chaoran.component.AntLine;
+import com.chaoran.component.SelfHRule;
+import com.chaoran.entiry.PhotographUi;
+import com.chaoran.entiry.SelfButton;
+import com.chaoran.entiry.SelfCheckBox;
+import com.chaoran.entiry.SelfDateField;
+import com.chaoran.entiry.SelfEditText;
+import com.chaoran.entiry.SelfImage;
+import com.chaoran.entiry.SelfTextBut;
+import com.chaoran.entiry.UpdataInfo;
+import com.chaoran.imp.InputInterface;
+import com.chaoran.thread.ImageUrl;
+import com.example.chaoran.DjActivity;
+import com.sys.SysData;
+
+import com.example.chaoran.R;
+import android.app.Activity;
+import android.graphics.Color;
+import android.os.Build.VERSION;
+import android.text.InputType;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+public class Dom4jUtil {
+ public static void testParseXMLData(InputStream in, DjActivity aa)
+ throws DocumentException {
+ // 产生一个解析器对象
+ SAXReader reader = new SAXReader();
+ // 将xml文档转换为Document的对象
+ Document document = reader.read(in);
+ // 获取文档的根元素
+ Element root = document.getRootElement();
+ Iterator i_pe = root.elementIterator();
+ MxTabHostContent layout;
+ int i = 0;
+ String title = null;
+ while (i_pe.hasNext()) {
+ Element e_pe = (Element) i_pe.next();
+ Iterator i_pe1 = e_pe.elementIterator();
+ if (!i_pe1.hasNext()) {
+ continue;
+ }
+ layout = new MxTabHostContent(aa);
+ layout.setFocusable(true);
+ layout.setFocusableInTouchMode(true);
+ if (e_pe.attributeValue("title") != null) {
+ title = e_pe.attributeValue("title").trim();
+ } else {
+ title = "汇总";
+ }
+ if (title.equals("")) {
+ title = "汇总";
+ }
+ aa.hzTab.addTab(aa.hzTab.newTabSpec("hzchild" + i)
+ .setIndicator(title).setContent(layout));
+ aa.hzTab.setCurrentTab(i);
+ i++;
+ while (i_pe1.hasNext()) {
+ Element e_pe1 = (Element) i_pe1.next();
+ String name = e_pe1.attributeValue("name");
+ name = name.substring(name.indexOf("::") + 2, name.length());
+ int w = (int) (Double.parseDouble(e_pe1
+ .elementText("width_attribute")));
+ int h = (int) (Double.parseDouble(e_pe1
+ .elementText("height_attribute")));
+ int x = (int) (Double.parseDouble(e_pe1
+ .elementText("x_attribute")));
+ int y = (int) (Double.parseDouble(e_pe1
+ .elementText("y_attribute")));
+ w = (int) (TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, w, aa.getResources()
+ .getDisplayMetrics()) * SysData.t_scale);
+ h = (int) (TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, h, aa.getResources()
+ .getDisplayMetrics()) * SysData.t_scale);
+ x = (int) (TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, x, aa.getResources()
+ .getDisplayMetrics()) * SysData.t_scale);
+ y = (int) (TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, y, aa.getResources()
+ .getDisplayMetrics()) * SysData.t_scale);
+ // int w = UnitConversionUtil.convertDIP2PX(Double
+ // .parseDouble(e_pe1.elementText("width_attribute")));
+ // int h = UnitConversionUtil.convertDIP2PX(Double
+ // .parseDouble(e_pe1.elementText("height_attribute")));
+ // int x = UnitConversionUtil.convertDIP2PX(Double
+ // .parseDouble(e_pe1.elementText("x_attribute")));
+ // int y = UnitConversionUtil.convertDIP2PX(Double
+ // .parseDouble(e_pe1.elementText("y_attribute")));
+ // System.out.println(h+"================"+name);
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
+ w, h);
+ layoutParams.topMargin = y;
+ layoutParams.leftMargin = x;
+ if (name.equals("SelfButton")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ SelfButton but = new SelfButton(aa);
+ if (SysData.t_scale < 1) {
+ but.setPadding((int) (but.getPaddingLeft() * SysData.t_scale * 0.2f), (int) (but.getPaddingTop() * SysData.t_scale * 0.2f),
+ (int) (but.getPaddingRight() * SysData.t_scale * 0.2f), (int) (but.getPaddingBottom() * SysData.t_scale * 0.2f));
+ }
+ // but.setFocusableInTouchMode(true);
+ but.setText(e_pe1.elementText("label_attribute"));
+ if (e_pe1.element("click_function") != null) {
+ but.setOnClickListener(aa.clickEvent);
+ but.clickFun = e_pe1.elementText("click_function")
+ .toString();
+ }
+ if (e_pe1.element("enterKey_attribute") != null) {
+ but.nextFocus = e_pe1.elementText("enterKey_attribute")
+ .toString().toUpperCase();
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ but.setTextSize(Float.parseFloat(e_pe1.elementText(
+ "fontSize_style").toString()) * SysData.t_scale);
+ }
+ if (e_pe1.element("key_value") != null) {
+ but.setTag(e_pe1.elementText("key_value").toString()
+ .trim().toUpperCase());
+ }
+ // but.setLayoutParams(new
+ // AbsoluteLayout.LayoutParams(w,h,x,y));
+ layout.addView(but, layoutParams);
+ } else if (name.equals("SelfLabel")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ TextView tv = new TextView(aa);
+ // tv.setBackgroundColor(Color.GRAY);
+ tv.setGravity(Gravity.CENTER_VERTICAL);
+ if (e_pe1.element("fontSize_style") != null) {
+ tv.setTextSize(Float.parseFloat(e_pe1.elementText(
+ "fontSize_style").toString()) * SysData.t_scale);
+ }
+ tv.setText(e_pe1.elementText("text_attribute"));
+ // tv.setLayoutParams(new
+ // AbsoluteLayout.LayoutParams(w,h,x,y));
+ layout.addView(tv, layoutParams);
+ } else if (name.equals("SelfTextInput")) {
+ if (!isVisible_attribute(e_pe1, aa)) {
+ continue;
+ }
+ if (e_pe1.attributeValue("isDouble").equals("yes")) {
+ SelfTextBut stb = new SelfTextBut(aa);
+ if (e_pe1.element("doubleClick_function") != null) {
+ stb.setOnClickListener(aa.clickEvent);
+ stb.setClickFun(e_pe1
+ .elementText("doubleClick_function")
+ .toString().toUpperCase());
+ }
+ // setTextButAtt(stb, e_pe1, aa);
+ setTextButAtt((InputInterface) stb, e_pe1, aa);
+ layout.addView(stb, layoutParams);
+ } else {
+ SelfEditText et = new SelfEditText(aa);
+ if (e_pe1.element("borderStyle_style") != null) {
+ et.showBorder = e_pe1.elementText(
+ "borderStyle_style").toString();
+ }
+ et.setSingleLine(true);
+ setTextButAtt((InputInterface) et, e_pe1, aa);
+ layout.addView(et, layoutParams);
+ }
+ } else if (name.equals("SelfTextArea")) {
+ if (!isVisible_attribute(e_pe1, aa)) {
+ continue;
+ }
+ SelfEditText area = new SelfEditText(aa);
+ if (e_pe1.element("borderStyle_style") != null) {
+ area.showBorder = e_pe1
+ .elementText("borderStyle_style").toString();
+ }
+ // setEditTextAtt(area, e_pe1, aa);
+ setTextButAtt((InputInterface) area, e_pe1, aa);
+ area.setSingleLine(false);
+ // if(e_pe1.element("backgroundColor_style") !=
+ // null){//backgroundColor_style
+ // area.setBackgroundColor(SysUtil.toHex(e_pe1.elementText("backgroundColor_style")
+ // .toString()));
+ // }
+ // if(e_pe1.element("color_style") !=
+ // null){//backgroundColor_style
+ // area.setTextColor(SysUtil.toHex(e_pe1.elementText("color_style")
+ // .toString()));
+ // }
+ layout.addView(area, layoutParams);
+ } else if (name.equals("SelfCheckBox")) {
+ // if (isVisible(e_pe1)) {
+ // continue;
+ // }
+ if (!isVisible_attribute(e_pe1, aa)) {
+ continue;
+ }
+ SelfCheckBox box = new SelfCheckBox(aa);
+ if (SysData.t_scale < 1) {
+ box.setPadding((int)(box.getPaddingLeft() * SysData.t_scale * 0.2f), box.getPaddingTop(), box.getPaddingRight(), box.getPaddingBottom());
+ }
+ if (e_pe1.element("name_attribute") != null) {
+ box.setTag(e_pe1.elementText("name_attribute")
+ .toString().trim().toUpperCase());
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ box.setText(e_pe1.elementText("label_attribute")
+ .toString());
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ box.setTextSize(Float.parseFloat(e_pe1.elementText(
+ "fontSize_style").toString()) * SysData.t_scale); //checkbox + 5会变大
+ }
+ if (e_pe1.element("enabled_attribute") != null) {
+ String enabled = e_pe1.elementText("enabled_attribute")
+ .toString();
+ box.setEnabled(Boolean.parseBoolean(enabled));
+ }
+ if (e_pe1.element("text_attribute") != null) {
+ String funName = e_pe1.elementText("text_attribute")
+ .toString().trim().toLowerCase();
+ if (dyhs(funName, aa).equals("是")) {
+ box.setChecked(true);
+ }
+ }
+
+ layout.addView(box, layoutParams);
+ } else if (name.equals("SelfImage")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ SelfImage imageView = new SelfImage(aa);
+ if (e_pe1.element("source_attribute") != null) {
+ String url = e_pe1.elementText("source_attribute")
+ .toString().trim();
+ if (url.substring(0, 7).equals("http://")) {
+ new Thread(new ImageUrl(imageView, url,
+ aa.imgHandler)).start();
+ } else if (url.indexOf(".") > 0) {
+ new Thread(new ImageUrl(imageView, SysData.url
+ .substring(0, SysData.url.lastIndexOf("/"))
+ .concat("/").concat(url), aa.imgHandler))
+ .start();
+ } else if (url.length() > 0) {
+ imageView.setTag(url.toUpperCase());
+ }
+ }
+ imageView.setOnClickListener(aa.imgClickEvent);
+ layout.addView(imageView, layoutParams);
+ } else if (name.equals("SelfHRule") || name.equals("SelfVRule")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ SelfHRule hrule = new SelfHRule(aa);
+ if (e_pe1.element("strokeColor_style") != null) {
+ // System.out.println();
+ hrule.setColor(SysUtil.toHex(e_pe1.elementText(
+ "strokeColor_style").toString()));
+ }
+ layout.addView(hrule, layoutParams);
+ } else if (name.equals("AntLine")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ AntLine al = new AntLine(aa);
+ if (e_pe1.element("lineColor_attribute") != null) {
+ al.setColor(SysUtil.toHex(e_pe1.elementText(
+ "lineColor_attribute").toString()));
+ }
+ if (e_pe1.element("lineThickness_attribute") != null) {
+ al.setSize(Integer.parseInt(e_pe1
+ .elementText("lineThickness_attribute")) * 2);
+ }
+ layout.addView(al, layoutParams);
+ } else if (name.equals("SelfDateField")) {
+ SelfDateField df = new SelfDateField(aa);
+ if (e_pe1.element("formatString_attribute") != null) {
+ df.formatString = e_pe1
+ .elementText("formatString_attribute")
+ .toString().trim().toLowerCase();
+ if (df.formatString.length() < 1) {
+ df.formatString = "yyyy-mm-dd";
+ }
+ df.formatString = df.formatString.replace("mm", "MM");
+ }
+ setTextButAtt((InputInterface) df, e_pe1, aa);
+ layout.addView(df, layoutParams);
+ } else if (name.equals("PhotographUi")) {
+ if (isVisible(e_pe1)) {
+ continue;
+ }
+ int hh = (int) (TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, 36, aa.getResources()
+ .getDisplayMetrics()) * SysData.t_scale);
+ PhotographUi pu = new PhotographUi(aa, h - hh);
+ layout.addView(pu, layoutParams);
+ pu.setOnClickListener(aa.pzClickEvent);
+ pu.setImageOnClickListener(aa.imgClickEvent);
+ if (e_pe1.element("name_attribute") != null) {
+ pu.setTag(e_pe1.elementText("name_attribute")
+ .toString().trim().toUpperCase());
+ }
+ }
+ }
+ aa.setTabwidgetAtt(aa.hzTab.getTabWidget());
+ aa.hzTab.setCurrentTab(0);
+ // break;
+ }
+ }
+
+ // /* 设置属性 */
+ // public static void setEditTextAtt(SelfEditText et, Element e_pe1,
+ // DjActivity djActivity) {
+ // et.setPadding(0, 0, 0, 0);
+ // et.setGravity(Gravity.CENTER_VERTICAL);
+ // if (e_pe1.element("name_attribute") != null) {
+ // et.setTag(e_pe1.elementText("name_attribute").toString().trim()
+ // .toUpperCase());
+ // }
+ // if (e_pe1.element("enterKey") != null) {
+ // et.nextFocus = e_pe1.elementText("enterKey").toString()
+ // .toUpperCase();
+ // }
+ // if (e_pe1.element("fontSize_style") != null) {
+ // et.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style")
+ // .toString()) + 5);
+ // }
+ // // et.setText(e_pe1.elementText("text_attribute"));
+ // boolean b = false;// 判断是否需要加焦点事件
+ // if (e_pe1.element("focusOut_function") != null) {
+ // et.focusOutFun = e_pe1.elementText("focusOut_function").toString();
+ // if (!b) {
+ // b = true;
+ // }
+ // }
+ // if (e_pe1.element("focusIn_function") != null) {
+ // et.focusInFun = e_pe1.elementText("focusIn_function").toString();
+ // if (!b) {
+ // b = true;
+ // }
+ // }
+ // if (b) {
+ // et.setOnFocusChangeListener(djActivity.focusEvent);
+ // }
+ // if (e_pe1.element("enabled_attribute") != null) {
+ // Boolean enabled = Boolean.parseBoolean(e_pe1.elementText(
+ // "enabled_attribute").toString());
+ // et.setEnabled(enabled);
+ // if (!enabled) {
+ // if (e_pe1.element("backgroundColor_style") != null) {//
+ // backgroundColor_style
+ // et.setBackgroundDrawable(SysUtil.GradientDrawable(e_pe1
+ // .elementText("backgroundColor_style").toString()));
+ // }
+ // }
+ // }
+ // if (e_pe1.element("text_attribute") != null) {
+ // String funName = e_pe1.elementText("text_attribute").toString()
+ // .trim();
+ // DjMenuFun menufun = new DjMenuFun();
+ // Class cla = menufun.getClass();
+ // try {
+ // Method method = cla.getDeclaredMethod(funName);
+ // if (method != null) {
+ // et.setText(method.invoke(menufun).toString());
+ // }
+ // } catch (Exception e) {
+ // et.setText(funName);
+ // }
+ // }
+ // }
+ public static boolean isVisible(Element e_pe1) {
+ boolean b = false;
+ if (e_pe1.element("visible_attribute") != null) {
+ if (e_pe1.elementText("visible_attribute").toString().trim()
+ .equals("false")) {
+ b = true;
+ } else {
+ b = false;
+ }
+ }
+ return b;
+ }
+
+ /* 设置属性 */
+ public static void setTextButAtt(InputInterface et, Element e_pe1,
+ DjActivity djActivity) {
+ et.setPadding(0, 0, 0, 0);
+ et.setGravity(Gravity.CENTER_VERTICAL);
+ if (e_pe1.element("name_attribute") != null) {
+ et.setTag(e_pe1.elementText("name_attribute").toString().trim()
+ .toUpperCase());
+ }
+ if (e_pe1.element("enterKey") != null) {
+ et.setNextFocus(e_pe1.elementText("enterKey").toString()
+ .toUpperCase());
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ et.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style")
+ .toString()) * SysData.t_scale + 5);
+ }
+ if (e_pe1.element("closeKeyBoard") != null) {
+ boolean closeKeyBoard = Boolean.parseBoolean(e_pe1
+ .elementText("closeKeyBoard"));
+ et.setCloseKeyBoard(closeKeyBoard);
+ if (closeKeyBoard) {
+ et.setInputType(InputType.TYPE_NULL);
+ }
+ }
+ // if(e_pe1.element("doubleClick_function") != null){
+ // et.setOnClickListener(djActivity.clickEvent);
+ // et.setClickFun(e_pe1.elementText("doubleClick_function").toString().toUpperCase());
+ // }
+ // et.setText(e_pe1.elementText("text_attribute"));
+ // boolean b = false;// 判断是否需要加焦点事件
+ if (e_pe1.element("focusOut_function") != null) {
+ et.setFocusOutFun(e_pe1.elementText("focusOut_function").toString());
+ // if (!b) {
+ // b = true;
+ // }
+ }
+ if (e_pe1.element("focusIn_function") != null) {
+ et.setFocusInFun(e_pe1.elementText("focusIn_function").toString());
+ // if (!b) {
+ // b = true;
+ // }
+ }
+ // if (b) {
+ et.setOnFocusChangeListener(djActivity.focusEvent);
+ // }
+ if (e_pe1.element("enabled_attribute") != null) {
+ Boolean enabled = Boolean.parseBoolean(e_pe1.elementText(
+ "enabled_attribute").toString());
+ et.setEnabled(enabled);
+ // if (!enabled) {
+ // }
+ }
+ if (e_pe1.element("backgroundColor_style") != null) {// backgroundColor_style
+ et.setBackgroundDrawable(SysUtil.GradientDrawable(e_pe1
+ .elementText("backgroundColor_style").toString()));
+ } else {
+ et.setBackgroundDrawable(SysUtil.GradientDrawable());
+ }
+ if (e_pe1.element("text_attribute") != null) {
+ String funName = e_pe1.elementText("text_attribute").toString()
+ .trim().toLowerCase();
+ et.setText(dyhs(funName, djActivity));
+ }
+ if (e_pe1.element("isValue_attribute") != null) {
+ et.setIsNull(Boolean.parseBoolean(e_pe1
+ .elementText("isValue_attribute")));
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ et.setLabel(e_pe1.elementText("label_attribute").toString().trim());
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ et.setLabel(e_pe1.elementText("label_attribute").toString().trim());
+ }
+ if (e_pe1.element("color_style") != null) {
+ et.setTextColor(SysUtil.toHex(e_pe1.elementText("color_style")
+ .toString().trim()));
+ }
+ // if (e_pe1.element("fdtype")!= null) {
+ // String fdtype=e_pe1.elementText("fdtype").toString().trim();
+ // if(fdtype.equals("整数")){
+ // et.setDefaultValue("0");
+ // }else if(fdtype.equals("实数")||fdtype.equals("浮点")){
+ // et.setDefaultValue("0.00");
+ // }
+ // }
+ }
+
+ public static String dyhs(String funName, DjActivity activity) {
+ String val = "";
+ DjMenuFun menufun = new DjMenuFun();
+ Class cla = menufun.getClass();
+ try {
+ Method method = cla.getDeclaredMethod(funName, DjActivity.class);
+ if (method != null) {
+ // if(method.getGenericParameterTypes().length>0){
+ val = method.invoke(menufun, new Object[] { activity })
+ .toString();
+ // }else{
+ // val = method.invoke(menufun).toString();
+ // }
+ } else {
+ val = funName;
+ }
+ } catch (Exception e) {
+ // e.printStackTrace();
+ val = funName;
+ }
+ return val;
+ }
+
+ /* 解析更新xml */
+ public static UpdataInfo parserXml(InputStream in, String version)
+ throws DocumentException {
+ version = version.substring(0, 1).toUpperCase();
+ // 产生一个解析器对象
+ SAXReader reader = new SAXReader();
+ reader.setEncoding("UTF-8");
+ // 将xml文档转换为Document的对象
+ Document document = reader.read(in);
+ // 获取文档的根元素
+ Element root = document.getRootElement();
+ UpdataInfo info = null;
+ List list = root.elements();
+ if (list != null) {
+ for (int i = 0; i < list.size(); i++) {
+ root = list.get(i);
+ if (root.getName().toUpperCase().equals("PDA")) {
+ Iterator i_pe = root.elementIterator();
+ if (root.attributeValue("model").toUpperCase()
+ .equals(version)) {
+ info = gerUpdataInfo(i_pe);
+ break;
+ }
+ }
+ }
+ }
+ return info;
+ }
+
+ public static UpdataInfo gerUpdataInfo(Iterator i_pe) {
+ String name = null;
+ UpdataInfo info = new UpdataInfo();// 实体
+ while (i_pe.hasNext()) {
+ Element e_pe = (Element) i_pe.next();
+ name = e_pe.getName();
+ if ("version".equals(name)) {
+ info.setVersion(e_pe.getText()); // 获取版本号
+ } else if ("url".equals(name)) {
+ info.setUrl(e_pe.getText()); // 获取要升级的APK文件
+ } else if ("description".equals(name)) {
+ info.setDescription(e_pe.getText()); // 获取该文件的信息
+ }
+ }
+ return info;
+ }
+
+ public static boolean isVisible_attribute(Element e_pe11,
+ DjActivity djActivity) {
+ boolean isVisible = true;
+ if (e_pe11.element("visible_attribute") != null) {
+ if (e_pe11.elementText("visible_attribute").toString().trim()
+ .equals("false")) {
+ isVisible = false;
+ String val = "";
+ if (e_pe11.element("text_attribute") != null) {
+ String funName = e_pe11.elementText("text_attribute")
+ .toString().trim();
+ val = dyhs(funName, djActivity);
+ }
+ // if(val==null||val.length()==0){
+ // if (e_pe11.element("fdtype")!= null) {
+ // String fdtype=e_pe11.elementText("fdtype").toString().trim();
+ // if(fdtype.equals("整数")){
+ // val="0";
+ // }else if(fdtype.equals("实数")||fdtype.equals("浮点")){
+ // val="0.00";
+ // }else{
+ // val="";
+ // }
+ // }
+ // }
+ if (e_pe11.element("name_attribute") != null) {
+ djActivity.pageMap.put(e_pe11.elementText("name_attribute")
+ .toString().trim().toUpperCase(), val);
+ }
+ }
+ }
+ return isVisible;
+ }
+}
diff --git a/app/src/main/java/com/util/DownloadManager.java b/app/src/main/java/com/util/DownloadManager.java
new file mode 100644
index 0000000..bbacc3c
--- /dev/null
+++ b/app/src/main/java/com/util/DownloadManager.java
@@ -0,0 +1,48 @@
+package com.util;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+
+public class DownloadManager {
+ public static File getFileFromServer(String path, ProgressDialog pd,Context context)
+ throws Exception {
+ // 如果相等的话表示当前的sdcard挂载在手机上并且是可用的
+// if (Environment.getExternalStorageState().equals(
+// Environment.MEDIA_MOUNTED)) {
+ URL url = new URL(path);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setConnectTimeout(5000);
+ // 获取到文件的大小
+ pd.setMax(conn.getContentLength()/1000);
+ InputStream is = conn.getInputStream();
+// File file = new File(Environment.getExternalStorageDirectory(),
+// "updata.apk");//得到sd卡的目录
+ File file = new File(context.getCacheDir().getParentFile(),
+ "updata.apk"); //放到当前应用程序所在的目录下
+ FileOutputStream fos = new FileOutputStream(file);
+ BufferedInputStream bis = new BufferedInputStream(is);
+ byte[] buffer = new byte[1024];
+ int len;
+ int total = 0;
+ while ((len = bis.read(buffer)) != -1) {
+ fos.write(buffer, 0, len);
+ total += len;
+ // 获取当前下载量
+ pd.setProgress(total/1000);
+ }
+ fos.close();
+ bis.close();
+ is.close();
+ return file;
+// } else {
+// return null;
+// }
+ }
+}
diff --git a/app/src/main/java/com/util/InstallUtil.java b/app/src/main/java/com/util/InstallUtil.java
new file mode 100644
index 0000000..51b01a2
--- /dev/null
+++ b/app/src/main/java/com/util/InstallUtil.java
@@ -0,0 +1,33 @@
+package com.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+
+public class InstallUtil {
+ // 安装apk
+ public void installApk(File file,Activity activity) {
+ chmod("777", file.getPath());
+ Intent intent = new Intent();
+ // 执行动作
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setAction(Intent.ACTION_VIEW);
+ // 执行的数据类型
+ intent.setDataAndType(Uri.fromFile(file),
+ "application/vnd.android.package-archive");
+ activity.startActivity(intent);
+ }
+ // 修改apk权限
+ public static void chmod(String permission, String path) {
+ try {
+ String command = "chmod " + permission + " " + path;
+ Runtime runtime = Runtime.getRuntime();
+ runtime.exec(command);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/app/src/main/java/com/util/IoUtil.java b/app/src/main/java/com/util/IoUtil.java
new file mode 100644
index 0000000..9f02d7d
--- /dev/null
+++ b/app/src/main/java/com/util/IoUtil.java
@@ -0,0 +1,102 @@
+package com.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.StreamCorruptedException;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+import org.kobjects.base64.Base64;
+
+public class IoUtil {
+ /*zip解压缩*/
+ public static Object byte_obj(byte[] b) throws StreamCorruptedException,
+ IOException, ClassNotFoundException {
+ ByteArrayInputStream bin = null;
+ GZIPInputStream gzip = null;
+ ObjectInputStream oin = null;
+ try {
+ bin = new ByteArrayInputStream(b);
+ gzip = new GZIPInputStream(bin);
+ oin = new ObjectInputStream(gzip);
+ return oin.readObject();
+ } finally {
+ if (oin != null) {
+ oin.close();
+ }
+ if (gzip != null) {
+ gzip.close();
+ }
+ if (bin != null) {
+ bin.close();
+ }
+ System.out.println("留关闭---");
+ }
+ }
+
+ public static Object byte_obj2(byte[] b) throws StreamCorruptedException,
+ IOException, ClassNotFoundException {
+ ByteArrayInputStream bin = null;
+ ObjectInputStream oin = null;
+ try {
+ bin = new ByteArrayInputStream(b);
+ oin = new ObjectInputStream(bin);
+ return oin.readObject();
+ } finally {
+ if (oin != null) {
+ oin.close();
+ }
+ if (bin != null) {
+ bin.close();
+ }
+ System.out.println("留关闭");
+ }
+ }
+ /*gzip压缩*/
+ public static byte[] getbyte(Object ob) throws Exception {
+ ByteArrayOutputStream byteOut = null;
+ GZIPOutputStream gziOut = null;
+ ObjectOutputStream objectOut = null;
+ try {
+ byteOut = new ByteArrayOutputStream();
+ gziOut = new GZIPOutputStream(byteOut);
+ objectOut = new ObjectOutputStream(gziOut);
+ objectOut.writeObject(ob);
+ objectOut.flush();
+ objectOut.close();
+ gziOut.close();
+ byteOut.close();
+ return byteOut.toByteArray();
+ } finally {
+// if(objectOut!=null){
+// objectOut.close();
+// }
+// if(gziOut!=null){
+//// gziOut.finish();
+// gziOut.close();
+// }
+// if(byteOut!=null){
+// byteOut.close();
+// }
+ }
+ }
+
+ public static String ob_base64(Object ob) throws IOException {
+ ByteArrayOutputStream bOut = null;
+ ObjectOutputStream objOut = null;
+ try {
+ bOut = new ByteArrayOutputStream();
+ objOut = new ObjectOutputStream(bOut);
+ objOut.writeObject(ob);
+ return Base64.encode(bOut.toByteArray());
+ } finally {
+ objOut.flush();
+ objOut.close();
+ bOut.flush();
+ bOut.close();
+ }
+ }
+}
diff --git a/app/src/main/java/com/util/LxParamPageCreate.java b/app/src/main/java/com/util/LxParamPageCreate.java
new file mode 100644
index 0000000..77d36a2
--- /dev/null
+++ b/app/src/main/java/com/util/LxParamPageCreate.java
@@ -0,0 +1,265 @@
+package com.util;
+
+import java.io.InputStream;
+import java.util.Iterator;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import android.app.Activity;
+import android.text.InputType;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.chaoran.component.AntLine;
+import com.chaoran.component.SelfHRule;
+import com.chaoran.entiry.PhotographUi;
+import com.chaoran.entiry.SelfButton;
+import com.chaoran.entiry.SelfCheckBox;
+import com.chaoran.entiry.SelfDateField;
+import com.chaoran.entiry.SelfEditText;
+import com.chaoran.entiry.SelfImage;
+import com.chaoran.entiry.SelfTextBut;
+import com.chaoran.imp.InputInterface;
+import com.chaoran.thread.ImageUrl;
+import com.example.chaoran.DjActivity;
+import com.sys.SysData;
+
+public class LxParamPageCreate {
+ public static void lxParamPageCreate(InputStream in, Activity activity, RelativeLayout layout) throws DocumentException {
+ SAXReader reader = new SAXReader();
+ // 将xml文档转换为Document的对象
+ Document document = reader.read(in);
+ // 获取文档的根元素
+ Element root = document.getRootElement();
+ Iterator i_pe = root.elementIterator();
+ while (i_pe.hasNext()) {
+ Element e_pe = (Element) i_pe.next();
+ Iterator i_pe1 = e_pe.elementIterator();
+ if (!i_pe1.hasNext()) {
+ continue;
+ }
+ while (i_pe1.hasNext()) {
+ Element e_pe1 = (Element) i_pe1.next();
+ String name = e_pe1.attributeValue("name");
+ name = name.substring(name.indexOf("::") + 2, name.length());
+ int w = (int) (Double.parseDouble(e_pe1.elementText("width_attribute")));
+ int h = (int) (Double.parseDouble(e_pe1.elementText("height_attribute")));
+ int x = (int) (Double.parseDouble(e_pe1.elementText("x_attribute")));
+ int y = (int) (Double.parseDouble(e_pe1.elementText("y_attribute")));
+ w = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, w, activity.getResources().getDisplayMetrics()) * SysData.t_scale);
+ h = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, h, activity.getResources().getDisplayMetrics()) * SysData.t_scale);
+ x = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, x, activity.getResources().getDisplayMetrics()) * SysData.t_scale);
+ y = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, y, activity.getResources().getDisplayMetrics()) * SysData.t_scale);
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(w, h);
+ layoutParams.topMargin = y;
+ layoutParams.leftMargin = x;
+ if (name.equals("SelfButton")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ SelfButton but = new SelfButton(activity);
+ if (SysData.t_scale < 1) {
+ but.setPadding((int) (but.getPaddingLeft() * SysData.t_scale * 0.2f), (int) (but.getPaddingTop() * SysData.t_scale * 0.2f),
+ (int) (but.getPaddingRight() * SysData.t_scale * 0.2f), (int) (but.getPaddingBottom() * SysData.t_scale * 0.2f));
+ }
+ // but.setFocusableInTouchMode(true);
+ but.setText(e_pe1.elementText("label_attribute"));
+ if (e_pe1.element("click_function") != null) {
+ but.clickFun = e_pe1.elementText("click_function").toString();
+ }
+ if (e_pe1.element("enterKey_attribute") != null) {
+ but.nextFocus = e_pe1.elementText("enterKey_attribute").toString().toUpperCase();
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ but.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style").toString()) * SysData.t_scale);
+ }
+ if (e_pe1.element("key_value") != null) {
+ but.setTag(e_pe1.elementText("key_value").toString().trim().toUpperCase());
+ }
+ // but.setLayoutParams(new
+ // AbsoluteLayout.LayoutParams(w,h,x,y));
+ layout.addView(but, layoutParams);
+ } else if (name.equals("SelfLabel")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ TextView tv = new TextView(activity);
+ tv.setGravity(Gravity.CENTER_VERTICAL);
+ if (e_pe1.element("fontSize_style") != null) {
+ tv.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style").toString()) * SysData.t_scale);
+ }
+ tv.setText(e_pe1.elementText("text_attribute"));
+ layout.addView(tv, layoutParams);
+ } else if (name.equals("SelfTextInput")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ if (e_pe1.attributeValue("isDouble").equals("yes")) {
+ SelfTextBut stb = new SelfTextBut(activity);
+ if (e_pe1.element("doubleClick_function") != null) {
+ stb.setClickFun(e_pe1.elementText("doubleClick_function").toString().toUpperCase());
+ }
+ // setTextButAtt(stb, e_pe1, aa);
+ setTextButAtt((InputInterface) stb, e_pe1);
+ layout.addView(stb, layoutParams);
+ } else {
+ SelfEditText et = new SelfEditText(activity);
+ if (e_pe1.element("borderStyle_style") != null) {
+ et.showBorder = e_pe1.elementText("borderStyle_style").toString();
+ }
+ et.setSingleLine(true);
+ setTextButAtt((InputInterface) et, e_pe1);
+ layout.addView(et, layoutParams);
+ }
+ } else if (name.equals("SelfTextArea")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ SelfEditText area = new SelfEditText(activity);
+ if (e_pe1.element("borderStyle_style") != null) {
+ area.showBorder = e_pe1.elementText("borderStyle_style").toString();
+ }
+ // setEditTextAtt(area, e_pe1, aa);
+ setTextButAtt((InputInterface) area, e_pe1);
+ area.setSingleLine(false);
+ // if(e_pe1.element("backgroundColor_style") !=
+ // null){//backgroundColor_style
+ // area.setBackgroundColor(SysUtil.toHex(e_pe1.elementText("backgroundColor_style")
+ // .toString()));
+ // }
+ // if(e_pe1.element("color_style") !=
+ // null){//backgroundColor_style
+ // area.setTextColor(SysUtil.toHex(e_pe1.elementText("color_style")
+ // .toString()));
+ // }
+ layout.addView(area, layoutParams);
+ } else if (name.equals("SelfCheckBox")) {
+ // if (isVisible(e_pe1)) {
+ // continue;
+ // }
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ SelfCheckBox box = new SelfCheckBox(activity);
+ if (SysData.t_scale < 1) {
+ box.setPadding((int) (box.getPaddingLeft() * SysData.t_scale * 0.2f), box.getPaddingTop(), box.getPaddingRight(), box.getPaddingBottom());
+ }
+ if (e_pe1.element("name_attribute") != null) {
+ box.setTag(e_pe1.elementText("name_attribute").toString().trim().toUpperCase());
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ box.setText(e_pe1.elementText("label_attribute").toString());
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ box.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style").toString()) * SysData.t_scale); // checkbox
+ // +
+ // 5会变大
+ }
+ if (e_pe1.element("enabled_attribute") != null) {
+ String enabled = e_pe1.elementText("enabled_attribute").toString();
+ box.setEnabled(Boolean.parseBoolean(enabled));
+ }
+ if (e_pe1.element("text_attribute") != null) {
+ String funName = e_pe1.elementText("text_attribute").toString().trim().toLowerCase();
+ if (funName.equals("是")) {
+ box.setChecked(true);
+ }
+ }
+ layout.addView(box, layoutParams);
+ } else if (name.equals("SelfHRule") || name.equals("SelfVRule")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ SelfHRule hrule = new SelfHRule(activity);
+ if (e_pe1.element("strokeColor_style") != null) {
+ // System.out.println();
+ hrule.setColor(SysUtil.toHex(e_pe1.elementText("strokeColor_style").toString()));
+ }
+ layout.addView(hrule, layoutParams);
+ } else if (name.equals("AntLine")) {
+ if (Dom4jUtil.isVisible(e_pe1)) {
+ continue;
+ }
+ AntLine al = new AntLine(activity);
+ if (e_pe1.element("lineColor_attribute") != null) {
+ al.setColor(SysUtil.toHex(e_pe1.elementText("lineColor_attribute").toString()));
+ }
+ if (e_pe1.element("lineThickness_attribute") != null) {
+ al.setSize(Integer.parseInt(e_pe1.elementText("lineThickness_attribute")) * 2);
+ }
+ layout.addView(al, layoutParams);
+ } else if (name.equals("SelfDateField")) {
+ SelfDateField df = new SelfDateField(activity);
+ if (e_pe1.element("formatString_attribute") != null) {
+ df.formatString = e_pe1.elementText("formatString_attribute").toString().trim().toLowerCase();
+ if (df.formatString.length() < 1) {
+ df.formatString = "yyyy-mm-dd";
+ }
+ df.formatString = df.formatString.replace("mm", "MM");
+ }
+ setTextButAtt((InputInterface) df, e_pe1);
+ layout.addView(df, layoutParams);
+ }
+ }
+ break;
+ }
+ }
+
+ /* 设置属性 */
+ public static void setTextButAtt(InputInterface et, Element e_pe1) {
+ et.setPadding(0, 0, 0, 0);
+ et.setGravity(Gravity.CENTER_VERTICAL);
+ if (e_pe1.element("name_attribute") != null) {
+ et.setTag(e_pe1.elementText("name_attribute").toString().trim().toUpperCase());
+ }
+ if (e_pe1.element("enterKey") != null) {
+ et.setNextFocus(e_pe1.elementText("enterKey").toString().toUpperCase());
+ }
+ if (e_pe1.element("fontSize_style") != null) {
+ et.setTextSize(Float.parseFloat(e_pe1.elementText("fontSize_style").toString()) * SysData.t_scale + 5);
+ }
+ if (e_pe1.element("closeKeyBoard") != null) {
+ boolean closeKeyBoard = Boolean.parseBoolean(e_pe1.elementText("closeKeyBoard"));
+ et.setCloseKeyBoard(closeKeyBoard);
+ if (closeKeyBoard) {
+ et.setInputType(InputType.TYPE_NULL);
+ }
+ }
+ if (e_pe1.element("focusOut_function") != null) {
+ et.setFocusOutFun(e_pe1.elementText("focusOut_function").toString());
+ }
+ if (e_pe1.element("focusIn_function") != null) {
+ et.setFocusInFun(e_pe1.elementText("focusIn_function").toString());
+ }
+ if (e_pe1.element("enabled_attribute") != null) {
+ Boolean enabled = Boolean.parseBoolean(e_pe1.elementText("enabled_attribute").toString());
+ et.setEnabled(enabled);
+ }
+ if (e_pe1.element("backgroundColor_style") != null) {// backgroundColor_style
+ et.setBackgroundDrawable(SysUtil.GradientDrawable(e_pe1.elementText("backgroundColor_style").toString()));
+ } else {
+ et.setBackgroundDrawable(SysUtil.GradientDrawable());
+ }
+ if (e_pe1.element("text_attribute") != null) {
+ String funName = e_pe1.elementText("text_attribute").toString().trim().toLowerCase();
+ et.setText(funName);
+ }
+ if (e_pe1.element("isValue_attribute") != null) {
+ et.setIsNull(Boolean.parseBoolean(e_pe1.elementText("isValue_attribute")));
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ et.setLabel(e_pe1.elementText("label_attribute").toString().trim());
+ }
+ if (e_pe1.element("label_attribute") != null) {
+ et.setLabel(e_pe1.elementText("label_attribute").toString().trim());
+ }
+ if (e_pe1.element("color_style") != null) {
+ et.setTextColor(SysUtil.toHex(e_pe1.elementText("color_style").toString().trim()));
+ }
+ }
+}
diff --git a/app/src/main/java/com/util/MxTabHostContent.java b/app/src/main/java/com/util/MxTabHostContent.java
new file mode 100644
index 0000000..da2a208
--- /dev/null
+++ b/app/src/main/java/com/util/MxTabHostContent.java
@@ -0,0 +1,24 @@
+package com.util;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TabHost.TabContentFactory;
+
+public class MxTabHostContent extends RelativeLayout implements TabContentFactory{
+
+ public MxTabHostContent(Context context) {
+ super(context);
+ }
+ public MxTabHostContent(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+ @Override
+ public View createTabContent(String tag) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+
+}
diff --git a/app/src/main/java/com/util/SqlUtil.java b/app/src/main/java/com/util/SqlUtil.java
new file mode 100644
index 0000000..e482d83
--- /dev/null
+++ b/app/src/main/java/com/util/SqlUtil.java
@@ -0,0 +1,213 @@
+package com.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.chaoran.entiry.SelfCheckBox;
+import com.chaoran.entiry.SelfEditText;
+import com.chaoran.entiry.SelfTextBut;
+import com.chaoran.imp.InputInterface;
+
+import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TabHost;
+import android.widget.TextView;
+
+public class SqlUtil {
+ public static HashMap regSql(String sql, TabHost layout, Map pageMap) {
+ System.out.println("------------------===============================");
+// System.out.println(sql);
+ // String regEx=":[\\w|.]*[\\s]{0}";
+ String regEx = "[:|\\&]([\\w\\.]+)";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(sql);
+ String paramName = null;
+ String oldParam = null;
+ HashMap paramMap = new HashMap();
+ String paramValue = null;
+ String sqlCopy = sql;
+ String paramType = null;
+ while (m.find()) {
+ oldParam = m.group();
+ System.out.println(oldParam+"--------------------");
+ paramType = oldParam.substring(0, 1);
+ paramName = oldParam.toUpperCase();
+ if (paramName.indexOf("MX.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else if (paramName.indexOf("HZ.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else {
+ paramName = paramName.substring(1, paramName.length());
+ }
+ sqlCopy = sqlCopy.replaceFirst(oldParam,
+ paramType.concat(paramName));
+ View view = layout.findViewWithTag(paramName);
+ if (view != null) {
+ // if (view instanceof SelfEditText) {
+ // paramValue = ((SelfEditText) view).getText().toString()
+ // .trim();
+ // } else if (view instanceof SelfCheckBox) {
+ // SelfCheckBox sfb = (SelfCheckBox) view;
+ // boolean b = sfb.isChecked();
+ // if (b) {
+ // paramValue = "是";
+ // } else {
+ // paramValue = "否";
+ // }
+ // } else if (view instanceof TextView) {
+ // paramValue = ((TextView) view).getText().toString().trim();
+ // }else if(view instanceof SelfTextBut){
+ // paramValue = ((SelfTextBut)
+ // view).getText().toString().trim();
+ // }
+ if (view instanceof InputInterface) {
+ InputInterface inView = (InputInterface) view;
+ paramValue = inView.getText().toString();
+ } else if (view instanceof SelfCheckBox) {
+ SelfCheckBox sfb = (SelfCheckBox) view;
+ boolean b = sfb.isChecked();
+ if (b) {
+ paramValue = "是";
+ } else {
+ paramValue = "否";
+ }
+ } else if (view instanceof TextView) {
+ paramValue = ((TextView) view).getText().toString();
+ }
+ } else if (pageMap.containsKey(paramName)) {
+ paramValue = pageMap.get(paramName).toString();
+ }
+ if (paramValue == null) {
+ paramValue = "";
+ } else {
+ paramValue = paramValue.trim();
+ }
+ if (paramType.equals(":")) {
+ paramMap.put(paramName, paramValue);
+ } else {
+ paramValue = paramValue.replace("$", "\\$");
+ sqlCopy = sqlCopy.replaceFirst(paramType.concat(paramName),
+ paramValue);
+ }
+ if (paramValue != null) {
+ paramValue = null;
+ }
+ }
+ HashMap map = new HashMap();
+ System.out.println("============="+sqlCopy+"------------------------sqlCopy");
+ map.put("sql", sqlCopy);
+ map.put("param", paramMap);
+ return map;
+ }
+
+ public static HashMap regSql(String sql, Map item) {
+ // String regEx=":[\\w|.]*[\\s]{0}";
+ String regEx = "[:|\\&]([\\w\\.]+)";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(sql);
+ String paramName = null;
+ String oldParam = null;
+ HashMap paramMap = new HashMap();
+ String paramValue = "";
+ String sqlCopy = sql;
+ String paramType = null;
+ while (m.find()) {
+ oldParam = m.group();
+ System.out.println(oldParam + "--------------------");
+ paramType = oldParam.substring(0, 1);
+ paramName = oldParam.toUpperCase();
+ if (paramName.indexOf("MX.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else if (paramName.indexOf("HZ.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else {
+ paramName = paramName.substring(1, paramName.length());
+ }
+ sqlCopy = sqlCopy.replaceFirst(oldParam,
+ paramType.concat(paramName));
+ if (item.containsKey(paramName)) {
+ paramValue = item.get(paramName).toString();
+ }
+ if (paramType.equals(":")) {
+ paramMap.put(paramName, paramValue);
+ } else {
+ paramValue = paramValue.replace("$", "\\$");
+ sqlCopy = sqlCopy.replaceFirst(paramType.concat(paramName),
+ paramValue);
+ }
+ if (!paramValue.equals("")) {
+ paramValue = "";
+ }
+ }
+ HashMap map = new HashMap();
+ map.put("sql", sqlCopy);
+ map.put("param", paramMap);
+ return map;
+ }
+
+ public static HashMap regSql(String sql, RelativeLayout layout) {
+ System.out.println(sql);
+ String regEx = "[:|\\&]([\\w\\.]+)";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(sql);
+ String paramName = null;
+ String oldParam = null;
+ HashMap paramMap = new HashMap();
+ String paramValue = null;
+ String sqlCopy = sql;
+ String paramType = null;
+ while (m.find()) {
+ oldParam = m.group();
+ paramType = oldParam.substring(0, 1);
+ paramName = oldParam.toUpperCase();
+ if (paramName.indexOf("MX.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else if (paramName.indexOf("HZ.") > -1) {
+ paramName = paramName.substring(4, paramName.length());
+ } else {
+ paramName = paramName.substring(1, paramName.length());
+ }
+ sqlCopy = sqlCopy.replaceFirst(oldParam,
+ paramType.concat(paramName));
+ View view = layout.findViewWithTag(paramName);
+ if (view != null) {
+ if (view instanceof InputInterface) {
+ InputInterface inView = (InputInterface) view;
+ paramValue = inView.getText().toString();
+ } else if (view instanceof SelfCheckBox) {
+ SelfCheckBox sfb = (SelfCheckBox) view;
+ boolean b = sfb.isChecked();
+ if (b) {
+ paramValue = "是";
+ } else {
+ paramValue = "否";
+ }
+ } else if (view instanceof TextView) {
+ paramValue = ((TextView) view).getText().toString();
+ }
+ }
+ if (paramValue == null) {
+ paramValue = "";
+ } else {
+ paramValue = paramValue.trim();
+ }
+ if (paramType.equals(":")) {
+ paramMap.put(paramName, paramValue);
+ } else {
+ paramValue = paramValue.replace("$", "\\$");
+ sqlCopy = sqlCopy.replaceFirst(paramType.concat(paramName),
+ paramValue);
+ }
+ if (paramValue != null) {
+ paramValue = null;
+ }
+ }
+ HashMap map = new HashMap();
+ map.put("sql", sqlCopy);
+ map.put("param", paramMap);
+ return map;
+ }
+
+}
diff --git a/app/src/main/java/com/util/SysUtil.java b/app/src/main/java/com/util/SysUtil.java
new file mode 100644
index 0000000..801fb0f
--- /dev/null
+++ b/app/src/main/java/com/util/SysUtil.java
@@ -0,0 +1,329 @@
+package com.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.lang.reflect.Method;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningTaskInfo;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.graphics.Bitmap.CompressFormat;
+import android.graphics.drawable.GradientDrawable;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Environment;
+
+public class SysUtil {
+
+ private static String mac = "";
+
+ /* 把数字转换成颜色 */
+ public static int toHex(String value) {
+ int color = (int) Long.parseLong("ff" + Integer.toHexString(Integer.parseInt(value)), 16);
+ if (color == 4080)
+ color = Color.BLACK;
+ return color;
+ }
+
+ /* 把6位颜色直(0xff0000) 转换成颜色 */
+ public static int toColor(int color) {
+ int red = (color & 0xff0000) >> 16;
+ int green = (color & 0x00ff00) >> 8;
+ int blue = (color & 0x0000ff);
+ return Color.rgb(red, green, blue);
+ }
+
+ public static GradientDrawable GradientDrawable(String color) {
+ GradientDrawable gd = new GradientDrawable();
+ gd.setCornerRadius(3);
+ gd.setColor(toHex(color));// 设置颜色
+ // gd.setStroke(3, toHex("14079443"));
+ return gd;
+ }
+
+ public static GradientDrawable GradientDrawable(int color) {
+ GradientDrawable gd = new GradientDrawable();
+ gd.setCornerRadius(3);
+ gd.setColor(color);// 设置颜色
+ // gd.setStroke(3, toHex("14079443"));
+ return gd;
+ }
+
+ public static GradientDrawable GradientDrawable() {
+ GradientDrawable gd = new GradientDrawable();
+ gd.setCornerRadius(3);
+ gd.setColor(Color.WHITE);// 设置颜色
+ // gd.setStroke(3, toHex("14079443"));
+ return gd;
+ }
+
+ public static boolean isTopApp(Context context) {
+ ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE);
+ List tasks = activityManager.getRunningTasks(1);
+ if (tasks == null || tasks.isEmpty()) {
+ return false;
+ }
+ RunningTaskInfo task = tasks.get(0);
+ String className = task.topActivity.getClassName();
+ System.out.println(className + "-----------------------------");
+ return className.equals(((Activity) context).getComponentName().getClassName());
+ }
+
+ // public static String getMac() {
+ // String macSerial = null;
+ // String str = "";
+ // try {
+ // Process pp = Runtime.getRuntime().exec(
+ // "cat /sys/class/net/wlan0/address ");
+ // InputStreamReader ir = new InputStreamReader(pp.getInputStream());
+ // LineNumberReader input = new LineNumberReader(ir);
+ //
+ // for (; null != str;) {
+ // str = input.readLine();
+ // if (str != null) {
+ // macSerial = str.trim();// 去空格
+ // break;
+ // }
+ // }
+ // } catch (IOException ex) {
+ // // 赋予默认值
+ // ex.printStackTrace();
+ // }
+ // return macSerial;
+ //
+ // }
+ public static boolean isNetworkConnected(Context context) {
+ if (context != null) {
+ ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
+ if (mNetworkInfo != null) {
+ return mNetworkInfo.isAvailable();
+ }
+ }
+ return false;
+ }
+
+/* *//**
+ * 获取移动设备本地IP
+ *
+ * @return
+ *//*
+ private static InetAddress getLocalInetAddress() {
+ InetAddress ip = null;
+ try {
+ // 列举
+ Enumeration en_netInterface = NetworkInterface
+ .getNetworkInterfaces();
+ while (en_netInterface.hasMoreElements()) {// 是否还有元素
+ NetworkInterface ni = (NetworkInterface) en_netInterface
+ .nextElement();// 得到下一个元素
+ Enumeration en_ip = ni.getInetAddresses();// 得到一个ip地址的列举
+ while (en_ip.hasMoreElements()) {
+ ip = en_ip.nextElement();
+ if (!ip.isLoopbackAddress()
+ && ip.getHostAddress().indexOf(":") == -1)
+ break;
+ else
+ ip = null;
+ }
+
+ if (ip != null) {
+ break;
+ }
+ }
+ } catch (SocketException e) {
+
+ e.printStackTrace();
+ }
+ return ip;
+ }*/
+ public static String getLocalMacAddress(Activity activity) {
+ WifiManager wifi = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE);
+ WifiInfo info = wifi.getConnectionInfo();
+ mac = info.getMacAddress();
+
+ if (mac == null || mac.length() < 1 || mac.startsWith("02:00:00:00:00:"))
+ mac = getMacAddress();
+
+ mac = mac.toUpperCase();
+
+ return mac;
+ }
+
+ @SuppressLint("NewApi")
+ public static String getMacAddress() {
+ /*
+ * 获取mac地址有一点需要注意的就是android
+ * 6.0版本后,以下注释方法不再适用,不管任何手机都会返回"02:00:00:00:00:00"
+ * 这个默认的mac地址,这是googel官方为了加强权限管理而禁用了getSYstemService
+ * (Context.WIFI_SERVICE)方法来获得mac地址。
+ */
+ // String macAddress= "";
+ // WifiManager wifiManager = (WifiManager)
+ // MyApp.getContext().getSystemService(Context.WIFI_SERVICE);
+ // WifiInfo wifiInfo = wifiManager.getConnectionInfo();
+ // macAddress = wifiInfo.getMacAddress();
+ // return macAddress;
+
+ String macAddress = null;
+ StringBuffer buf = new StringBuffer();
+ NetworkInterface networkInterface = null;
+ try {
+ networkInterface = NetworkInterface.getByName("eth1");
+ if (networkInterface == null) {
+ networkInterface = NetworkInterface.getByName("wlan0");
+ }
+ if (networkInterface == null) {
+ return "02:00:00:00:00:02";
+ }
+ byte[] addr = networkInterface.getHardwareAddress();
+ for (byte b : addr) {
+ buf.append(String.format("%02X:", b));
+ }
+ if (buf.length() > 0) {
+ buf.deleteCharAt(buf.length() - 1);
+ }
+ macAddress = buf.toString();
+ } catch (SocketException e) {
+ e.printStackTrace();
+ return "02:00:00:00:00:02";
+ }
+ return macAddress;
+ }
+
+ public static String mapFirst(List list) {
+ String filedName = null;
+ Set set = ((HashMap) list.get(0)).keySet();
+ for (String s : set) {
+ filedName = s;
+ break;
+ }
+ return filedName;
+ }
+
+ @SuppressLint({ "NewApi", "NewApi" })
+ public static String getSerialNum() {
+ // String serialNum = null;
+ // try {
+ // Class> classZ = Class.forName("android.os.SystemProperties");
+ // Method get = classZ.getMethod("get", String.class);
+ // serialNum = (String) get.invoke(classZ, "ro.serialno");
+ // } catch (Exception e) {
+ // }
+ String serialNum = android.os.Build.SERIAL;
+ return serialNum;
+ }
+
+ /* 东集pda专用获取SN */
+ public static String getSn() {
+ //return mac.toLowerCase().replace(":", "");
+
+ String sn = getSn0("data/data/sn");
+ if (sn == null || sn.trim().length() < 1)
+ sn = getSn1();
+ if (sn.length() >= 15) {
+ sn = getSn0("/sys/class/net/wlan0/address");
+ sn = sn.replace(":", "");
+ }
+
+ if (sn != null && sn.trim().length() > 0)
+ return sn;
+ else
+ return mac.toLowerCase().replace(":", "");
+ }
+
+ public static String getSn0(String fileName) {
+ String SN_FILE = fileName;
+ InputStreamReader isr = null;
+ FileInputStream inputStream = null;
+ byte[] buffer = new byte[64];
+ File file = new File(SN_FILE);
+ int code = 0;
+ try {
+ inputStream = new FileInputStream(file);
+ inputStream.read(buffer, 0, buffer.length);
+
+ String str = new String(buffer).toString();
+
+ return str.trim().length() > 0 ? str.trim() : "";
+ } catch (IOException e) {
+ return "";
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static String getSn1() {
+ try {
+ Method systemProperties_get = Class.forName("android.os.SystemProperties").getMethod("get", String.class);
+ // String []propertys = {"ro.boot.serialno", "ro.serialno"};
+ String rtn = (String) systemProperties_get.invoke(null, "ro.boot.serialno");
+ if (rtn == null || rtn.trim().length() < 1)
+ rtn = (String) systemProperties_get.invoke(null, "ro.serialno");
+ return rtn == null ? "" : rtn;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
+
+ }
+
+ /*
+ * 检查存储卡是否插入
+ *
+ * @return
+ */
+ public static boolean isHasSdcard() {
+ String status = Environment.getExternalStorageState();
+ if (status.equals(Environment.MEDIA_MOUNTED)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * 拍照图片文件名
+ */
+ private static String getPhotoFileName() {
+ Date date = new Date(System.currentTimeMillis());
+ SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
+ return dateFormat.format(date) + ".jpg";
+ }
+
+ public static byte[] bitmapToByte(Bitmap bitmap) {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ bitmap.compress(CompressFormat.JPEG, 60, output);
+ byte[] result = output.toByteArray();
+ try {
+ output.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+}
diff --git a/app/src/main/java/com/util/UnitConversionUtil.java b/app/src/main/java/com/util/UnitConversionUtil.java
new file mode 100644
index 0000000..d9e48e8
--- /dev/null
+++ b/app/src/main/java/com/util/UnitConversionUtil.java
@@ -0,0 +1,19 @@
+package com.util;
+
+import com.sys.SysData;
+
+import android.content.Context;
+
+public class UnitConversionUtil {
+ //转换dip为px
+ public static int convertDIP2PX(Double dip) {
+ return (int)(dip*SysData.scale + 0.5f*(dip>=0?1:-1));
+ }
+
+ //转换px为dip
+ public static int convertPX2DIP(int px) {
+ return (int)(px/SysData.scale + 0.5f*(px>=0?1:-1));
+ }
+
+
+}
diff --git a/app/src/main/java/com/util/WakeLockUtil.java b/app/src/main/java/com/util/WakeLockUtil.java
new file mode 100644
index 0000000..be9a266
--- /dev/null
+++ b/app/src/main/java/com/util/WakeLockUtil.java
@@ -0,0 +1,51 @@
+package com.util;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiManager.WifiLock;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+
+public class WakeLockUtil {
+ private static WifiLock wifiLock;
+
+ public static void acquireWakeLock(Activity activity, WakeLock wakeLock) {
+ if (wakeLock == null) {
+ PowerManager pm = (PowerManager) activity
+ .getSystemService(Context.POWER_SERVICE);
+ wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK
+ | PowerManager.ACQUIRE_CAUSES_WAKEUP, "crtech");
+ }
+ if (wifiLock == null) {
+ WifiManager manager = (WifiManager) activity
+ .getSystemService(Context.WIFI_SERVICE);
+ wifiLock = manager.createWifiLock("SwiFTP");
+ wifiLock.setReferenceCounted(false);
+ }
+ if (wakeLock != null) {
+ System.out.println(wakeLock+"------------------锁定");
+ wakeLock.acquire();
+ System.out.println(wakeLock+"----------==--------锁定");
+ }
+ if (wifiLock != null) {
+ System.out.println("------------------wifi锁定");
+ wifiLock.acquire();
+ }
+ }
+
+ // 释放设备电源锁
+ public static void releaseWakeLock(WakeLock wakeLock) {
+ System.out.println("------------------解除锁定=====================");
+ if (wakeLock != null) {
+ wakeLock.release();
+ System.out.println("------------------解除锁定");
+ wakeLock = null;
+ }
+ if (wifiLock != null) {
+ wifiLock.release();
+ wifiLock = null;
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/zebra/adc/decoder/compatible/BarCodeReader.java b/app/src/main/java/com/zebra/adc/decoder/compatible/BarCodeReader.java
new file mode 100644
index 0000000..4bb6125
--- /dev/null
+++ b/app/src/main/java/com/zebra/adc/decoder/compatible/BarCodeReader.java
@@ -0,0 +1,3443 @@
+/* */ package com.zebra.adc.decoder.compatible;
+/* */
+/* */ import android.content.Context;
+/* */ import android.os.Handler;
+/* */ import android.os.Looper;
+/* */ import android.os.Message;
+/* */ import android.util.Log;
+/* */ import android.view.Surface;
+/* */ import android.view.SurfaceHolder;
+/* */ import java.io.IOException;
+/* */ import java.lang.ref.WeakReference;
+/* */ import java.util.ArrayList;
+/* */ import java.util.HashMap;
+/* */ import java.util.List;
+/* */ import java.util.StringTokenizer;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class BarCodeReader
+/* */ {
+/* */ private static final String TAG = "BarCodeReader";
+/* */ private static final int BCRDR_MSG_ERROR = 1;
+/* */ private static final int BCRDR_MSG_SHUTTER = 2;
+/* */ private static final int BCRDR_MSG_FOCUS = 4;
+/* */ private static final int BCRDR_MSG_ZOOM = 8;
+/* */ private static final int BCRDR_MSG_PREVIEW_FRAME = 16;
+/* */ private static final int BCRDR_MSG_VIDEO_FRAME = 32;
+/* */ private static final int BCRDR_MSG_POSTVIEW_FRAME = 64;
+/* */ private static final int BCRDR_MSG_RAW_IMAGE = 128;
+/* */ private static final int BCRDR_MSG_COMPRESSED_IMAGE = 256;
+/* */ private static final int BCRDR_MSG_LAST_DEC_IMAGE = 512;
+/* */ private static final int BCRDR_MSG_DEC_COUNT = 1024;
+/* */ private static final int BCRDR_MSG_DECODE_COMPLETE = 65536;
+/* */ private static final int BCRDR_MSG_DECODE_TIMEOUT = 131072;
+/* */ private static final int BCRDR_MSG_DECODE_CANCELED = 262144;
+/* */ private static final int BCRDR_MSG_DECODE_ERROR = 524288;
+/* */ private static final int BCRDR_MSG_DECODE_EVENT = 1048576;
+/* */ private static final int BCRDR_MSG_FRAME_ERROR = 2097152;
+/* */ private static final int BCRDR_MSG_ALL_MSGS = 4129791;
+/* */ private static final int DECODE_MODE_PREVIEW = 1;
+/* */ private static final int DECODE_MODE_VIEWFINDER = 2;
+/* */ private static final int DECODE_MODE_VIDEO = 3;
+/* */ private int mNativeContext;
+/* */ private EventHandler mEventHandler;
+/* */ private AutoFocusCallback mAutoFocusCallback;
+/* */ private DecodeCallback mDecodeCallback;
+/* */ private ErrorCallback mErrorCallback;
+/* */ private VideoCallback mVideoCallback;
+/* */ private PictureCallback mSnapshotCallback;
+/* */ private PreviewCallback mPreviewCallback;
+/* */ private OnZoomChangeListener mZoomListener;
+/* */ private boolean mOneShot;
+/* */ private boolean mWithBuffer;
+/* */ public static final int BCR_SUCCESS = 0;
+/* */ public static final int BCR_ERROR = -1;
+/* */ public static final int DECODE_STATUS_TIMEOUT = 0;
+/* */ public static final int DECODE_STATUS_CANCELED = -1;
+/* */ public static final int DECODE_STATUS_ERROR = -2;
+/* */ public static final int DECODE_STATUS_MULTI_DEC_COUNT = -3;
+/* */ public static final int BCRDR_EVENT_SCAN_MODE_CHANGED = 5;
+/* */ public static final int BCRDR_EVENT_MOTION_DETECTED = 6;
+/* */ public static final int BCRDR_EVENT_SCANNER_RESET = 7;
+/* */ public static final int BCRDR_ERROR_UNKNOWN = 1;
+/* */ public static final int BCRDR_ERROR_SERVER_DIED = 100;
+/* */ String LOG_TAG;
+/* */ public Boolean scanFinished;
+/* */
+/* */ public final int setParameter(int paramNum, int paramVal) {
+/* 218 */ return setNumParameter(paramNum, paramVal);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final int setParameter(int paramNum, String paramVal) {
+/* 232 */ return setStrParameter(paramNum, paramVal);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final void startVideoCapture(VideoCallback cb) {
+/* 287 */ this.mVideoCallback = cb;
+/* 288 */ native_startPreview(3);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final void startViewFinder() {
+/* 298 */ native_startPreview(2);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final void startPreview() {
+/* 319 */ native_startPreview(1);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public static class ReaderInfo
+/* */ {
+/* */ public static final int BCRDR_FACING_BACK = 0;
+/* */
+/* */
+/* */ public static final int BCRDR_FACING_FRONT = 1;
+/* */
+/* */
+/* */ public int facing;
+/* */
+/* */
+/* */ public int orientation;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public static class ParamNum
+/* */ {
+/* */ public static final short CODE39 = 0;
+/* */
+/* */
+/* */ public static final short UPCA = 1;
+/* */
+/* */
+/* */ public static final short UPCE = 2;
+/* */
+/* */
+/* */ public static final short EAN13 = 3;
+/* */
+/* */
+/* */ public static final short EAN8 = 4;
+/* */
+/* */
+/* */ public static final short D25 = 5;
+/* */
+/* */
+/* */ public static final short I25 = 6;
+/* */
+/* */
+/* */ public static final short CODABAR = 7;
+/* */
+/* */
+/* */ public static final short CODE128 = 8;
+/* */
+/* */
+/* */ public static final short CODE93 = 9;
+/* */
+/* */
+/* */ public static final short CODE11 = 10;
+/* */
+/* */
+/* */ public static final short MSI = 11;
+/* */
+/* */
+/* */ public static final short UPCE1 = 12;
+/* */
+/* */
+/* */ public static final short TRIOPTIC = 13;
+/* */
+/* */
+/* */ public static final short EAN128 = 14;
+/* */
+/* */
+/* */ public static final short PDF = 15;
+/* */
+/* */
+/* */ public static final short SUPPS = 16;
+/* */
+/* */
+/* */ public static final short C39_FULL_ASCII = 17;
+/* */
+/* */
+/* */ public static final short C39_LEN1 = 18;
+/* */
+/* */
+/* */ public static final short C39_LEN2 = 19;
+/* */
+/* */
+/* */ public static final short D25_LEN1 = 20;
+/* */
+/* */
+/* */ public static final short D25_LEN2 = 21;
+/* */
+/* */
+/* */ public static final short I25_LEN1 = 22;
+/* */
+/* */
+/* */ public static final short I25_LEN2 = 23;
+/* */
+/* */
+/* */ public static final short CBR_LEN1 = 24;
+/* */
+/* */
+/* */ public static final short CBR_LEN2 = 25;
+/* */
+/* */
+/* */ public static final short C93_LEN1 = 26;
+/* */
+/* */
+/* */ public static final short C93_LEN2 = 27;
+/* */
+/* */
+/* */ public static final short C11_LEN1 = 28;
+/* */
+/* */
+/* */ public static final short C11_LEN2 = 29;
+/* */
+/* */
+/* */ public static final short MSI_LEN1 = 30;
+/* */
+/* */
+/* */ public static final short MSI_LEN2 = 31;
+/* */
+/* */
+/* */ public static final short UPCA_PREAM = 34;
+/* */
+/* */
+/* */ public static final short UPCE_PREAM = 35;
+/* */
+/* */
+/* */ public static final short UPCE1_PREAM = 36;
+/* */
+/* */
+/* */ public static final short UPCE_TO_A = 37;
+/* */
+/* */
+/* */ public static final short UPCE1_TO_A = 38;
+/* */
+/* */
+/* */ public static final short EAN8_TO_13 = 39;
+/* */
+/* */
+/* */ public static final short UPCA_CHK = 40;
+/* */
+/* */
+/* */ public static final short UPCE_CHK = 41;
+/* */
+/* */
+/* */ public static final short UPCE1_CHK = 42;
+/* */
+/* */
+/* */ public static final short XMIT_C39_CHK = 43;
+/* */
+/* */
+/* */ public static final short XMIT_I25_CHK = 44;
+/* */
+/* */
+/* */ public static final short XMIT_CODE_ID = 45;
+/* */
+/* */
+/* */ public static final short XMIT_MSI_CHK = 46;
+/* */
+/* */
+/* */ public static final short XMIT_C11_CHK = 47;
+/* */
+/* */
+/* */ public static final short C39_CHK_EN = 48;
+/* */
+/* */
+/* */ public static final short I25_CHK_TYPE = 49;
+/* */
+/* */
+/* */ public static final short MSI_CHK_1_2 = 50;
+/* */
+/* */
+/* */ public static final short MSI_CHK_SCHEME = 51;
+/* */
+/* */
+/* */ public static final short C11_CHK_TYPE = 52;
+/* */
+/* */
+/* */ public static final short CLSI = 54;
+/* */
+/* */
+/* */ public static final short NOTIS = 55;
+/* */
+/* */
+/* */ public static final short UPC_SEC_LEV = 77;
+/* */
+/* */
+/* */ public static final short LIN_SEC_LEV = 78;
+/* */
+/* */
+/* */ public static final short SUPP_REDUN = 80;
+/* */
+/* */
+/* */ public static final short I25_TO_EAN13 = 82;
+/* */
+/* */
+/* */ public static final short BOOKLAND = 83;
+/* */
+/* */
+/* */ public static final short ISBT_128 = 84;
+/* */
+/* */
+/* */ public static final short COUPON = 85;
+/* */
+/* */
+/* */ public static final short CODE32 = 86;
+/* */
+/* */
+/* */ public static final short POST_US1 = 89;
+/* */
+/* */
+/* */ public static final short POST_US2 = 90;
+/* */
+/* */
+/* */ public static final short POST_UK = 91;
+/* */
+/* */
+/* */ public static final short SIGNATURE = 93;
+/* */
+/* */
+/* */ public static final short XMIT_NO_READ = 94;
+/* */
+/* */
+/* */ public static final short POST_US_PARITY = 95;
+/* */
+/* */
+/* */ public static final short POST_UK_PARITY = 96;
+/* */
+/* */
+/* */ public static final short EMUL_EAN128 = 123;
+/* */
+/* */
+/* */ public static final short LASER_ON_PRIM = 136;
+/* */
+/* */
+/* */ public static final short LASER_OFF_PRIM = 137;
+/* */
+/* */
+/* */ public static final short PRIM_TRIG_MODE = 138;
+/* */
+/* */
+/* */ public static final short C128_LEN1 = 209;
+/* */
+/* */
+/* */ public static final short C128_LEN2 = 210;
+/* */
+/* */
+/* */ public static final short ISBT_MAX_TRY = 223;
+/* */
+/* */
+/* */ public static final short UPDF = 227;
+/* */
+/* */
+/* */ public static final short C32_PREFIX = 231;
+/* */
+/* */
+/* */ public static final short POSTAL_JAP = 290;
+/* */
+/* */
+/* */ public static final short POSTAL_AUS = 291;
+/* */
+/* */
+/* */ public static final short DATAMATRIX = 292;
+/* */
+/* */
+/* */ public static final short QRCODE = 293;
+/* */
+/* */
+/* */ public static final short MAXICODE = 294;
+/* */
+/* */
+/* */ public static final short IMG_ILLUM = 298;
+/* */
+/* */
+/* */ public static final short IMG_AIM_SNAPSHOT = 300;
+/* */
+/* */
+/* */ public static final short IMG_CROP = 301;
+/* */
+/* */
+/* */ public static final short IMG_SUBSAMPLE = 302;
+/* */
+/* */
+/* */ public static final short IMG_BPP = 303;
+/* */
+/* */
+/* */ public static final short IMG_FILE_FORMAT = 304;
+/* */
+/* */
+/* */ public static final short IMG_JPEG_QUAL = 305;
+/* */
+/* */
+/* */ public static final short IMG_AIM_MODE = 306;
+/* */
+/* */
+/* */ public static final short IMG_SIG_FMT = 313;
+/* */
+/* */
+/* */ public static final short IMG_SIG_BPP = 314;
+/* */
+/* */
+/* */ public static final short IMG_CROP_TOP = 315;
+/* */
+/* */
+/* */ public static final short IMG_CROP_LEFT = 316;
+/* */
+/* */
+/* */ public static final short IMG_CROP_BOT = 317;
+/* */
+/* */
+/* */ public static final short IMG_CROP_RIGHT = 318;
+/* */
+/* */
+/* */ public static final short IMG_SNAPTIMEOUT = 323;
+/* */
+/* */
+/* */ public static final short IMG_VIDEOVF = 324;
+/* */
+/* */
+/* */ public static final short POSTAL_DUTCH = 326;
+/* */
+/* */
+/* */ public static final short RSS_14 = 338;
+/* */
+/* */
+/* */ public static final short RSS_LIM = 339;
+/* */
+/* */
+/* */ public static final short RSS_EXP = 340;
+/* */
+/* */
+/* */ public static final short CCC_ENABLE = 341;
+/* */
+/* */
+/* */ public static final short CCAB_ENABLE = 342;
+/* */
+/* */
+/* */ public static final short UPC_COMPOSITE = 344;
+/* */
+/* */
+/* */ public static final short IMG_IMAGE_ILLUM = 361;
+/* */
+/* */
+/* */ public static final short SIGCAP_WIDTH = 366;
+/* */
+/* */
+/* */ public static final short SIGCAP_HEIGHT = 367;
+/* */
+/* */
+/* */ public static final short TCIF = 371;
+/* */
+/* */
+/* */ public static final short MARGIN_RATIO = 381;
+/* */
+/* */
+/* */ public static final short DEMOTE_RSS = 397;
+/* */
+/* */
+/* */ public static final short PICKLIST_MODE = 402;
+/* */
+/* */
+/* */ public static final short C25 = 408;
+/* */
+/* */
+/* */ public static final short IMAGE_SIG_JPEG_QUALITY = 421;
+/* */
+/* */
+/* */ public static final short EMUL_UCCEAN128 = 427;
+/* */
+/* */
+/* */ public static final short MIRROR_IMAGE = 537;
+/* */
+/* */
+/* */ public static final short IMG_ENHANCEMENT = 564;
+/* */
+/* */
+/* */ public static final short UQR_EN = 573;
+/* */
+/* */
+/* */ public static final short AZTEC = 574;
+/* */
+/* */
+/* */ public static final short BOOKLAND_FORMAT = 576;
+/* */
+/* */
+/* */ public static final short ISBT_CONCAT_MODE = 577;
+/* */
+/* */
+/* */ public static final short CHECK_ISBT_TABLE = 578;
+/* */
+/* */
+/* */ public static final short SUPP_USER_1 = 579;
+/* */
+/* */
+/* */ public static final short SUPP_USER_2 = 580;
+/* */
+/* */
+/* */ public static final short K35 = 581;
+/* */
+/* */
+/* */ public static final short ONE_D_INVERSE = 586;
+/* */
+/* */
+/* */ public static final short QR_INVERSE = 587;
+/* */
+/* */
+/* */ public static final short DATAMATRIX_INVERSE = 588;
+/* */
+/* */
+/* */ public static final short AZTEC_INVERSE = 589;
+/* */
+/* */
+/* */ public static final short AIMMODEHANDSFREE = 590;
+/* */
+/* */
+/* */ public static final short POST_US3 = 592;
+/* */
+/* */
+/* */ public static final short POST_US4 = 611;
+/* */
+/* */
+/* */ public static final short ISSN_EAN_EN = 617;
+/* */
+/* */
+/* */ public static final short MATRIX_25_EN = 618;
+/* */
+/* */
+/* */ public static final short MATRIX_25_LEN1 = 619;
+/* */
+/* */
+/* */ public static final short MATRIX_25_LEN2 = 620;
+/* */
+/* */
+/* */ public static final short MATRIX_25_REDUN = 621;
+/* */
+/* */
+/* */ public static final short MATRIX_25_CHK_EN = 622;
+/* */
+/* */
+/* */ public static final short MATRIX_25_XMIT_CHK = 623;
+/* */
+/* */
+/* */ public static final short AIMID_SUPP_FORMAT = 672;
+/* */
+/* */
+/* */ public static final short CELL_DISPLAY_MODE = 716;
+/* */
+/* */
+/* */ public static final short POST_AUS_FMT = 718;
+/* */
+/* */
+/* */ public static final short DATABAR_LIM_SEC_LEV = 728;
+/* */
+/* */
+/* */ public static final short COUPON_REPORT = 730;
+/* */
+/* */
+/* */ public static final short VIDEO_SUBSMAPLE = 761;
+/* */
+/* */
+/* */ public static final short IMG_MOTIONILLUM = 762;
+/* */
+/* */
+/* */ public static final short ILLUMINATION_POWER_LEVEL = 764;
+/* */
+/* */
+/* */ public static final short MULTI_DECODE = 900;
+/* */
+/* */
+/* */ public static final short FULL_READ_MODE = 901;
+/* */
+/* */ public static final short NUM_BR_TO_READ = 902;
+/* */
+/* */ public static final short RETRIEVE_LAST_DECODE = 905;
+/* */
+/* */ public static final short SECURITY_LEVEL = 1121;
+/* */
+/* */ public static final short ENABLE_HANXIN = 1167;
+/* */
+/* */ public static final short HANXIN_INVERSE = 1168;
+/* */ }
+/* */
+/* */
+/* */ public static class ParamVal
+/* */ {
+/* */ public static final byte SUPP_NONE = 0;
+/* */
+/* */ public static final byte SUPP_ONLY = 1;
+/* */
+/* */ public static final byte SUPP_AUTOD = 2;
+/* */
+/* */ public static final byte SUPP_SMART = 3;
+/* */
+/* */ public static final byte SUPP_378_379 = 4;
+/* */
+/* */ public static final byte SUPP_978_979 = 5;
+/* */
+/* */ public static final byte SUPP_414_419_434_439 = 6;
+/* */
+/* */ public static final byte SUPP_977 = 7;
+/* */
+/* */ public static final byte SUPP_491 = 8;
+/* */
+/* */ public static final byte SUPP_PROG_1 = 9;
+/* */
+/* */ public static final byte SUPP_PROG_1_AND_2 = 10;
+/* */
+/* */ public static final byte SUPP_SMART_PLUS_1 = 11;
+/* */
+/* */ public static final byte SUPP_SMART_PLUS_1_2 = 12;
+/* */
+/* */ public static final byte LEVEL = 0;
+/* */
+/* */ public static final byte HANDSFREE = 7;
+/* */
+/* */ public static final byte AUTO_AIM = 9;
+/* */
+/* */ public static final byte IMG_BPP_1 = 0;
+/* */
+/* */ public static final byte IMG_BPP_4 = 1;
+/* */
+/* */ public static final byte IMG_BPP_8 = 2;
+/* */
+/* */ public static final byte IMG_FORMAT_JPEG = 1;
+/* */
+/* */ public static final byte IMG_FORMAT_BMP = 3;
+/* */
+/* */ public static final byte IMG_FORMAT_TIFF = 4;
+/* */
+/* */ public static final byte IMG_SUBSAMPLE_FACTOR_1 = 0;
+/* */
+/* */ public static final byte IMG_SUBSAMPLE_FACTOR_2 = 1;
+/* */
+/* */ public static final byte IMG_SUBSAMPLE_FACTOR_3 = 2;
+/* */
+/* */ public static final byte IMG_SUBSAMPLE_FACTOR_4 = 3;
+/* */
+/* */ public static final byte AIM_OFF = 0;
+/* */
+/* */ public static final byte AIM_ON = 1;
+/* */
+/* */ public static final byte AIM_ON_ALWAYS = 2;
+/* */
+/* */ public static final byte UPC_NEVER = 0;
+/* */
+/* */ public static final byte UPC_ALWAYS = 1;
+/* */
+/* */ public static final byte UPC_AUTOD = 2;
+/* */
+/* */ public static final byte PICKLIST_NEVER = 0;
+/* */
+/* */ public static final byte PICKLIST_OUT_OF_SCANSTAND = 1;
+/* */
+/* */ public static final byte PICKLIST_ALWAYS = 1;
+/* */
+/* */ public static final byte MIRROR_NEVER = 0;
+/* */
+/* */ public static final byte MIRROR_ALWAYS = 1;
+/* */
+/* */ public static final byte MIRROR_AUTO = 2;
+/* */
+/* */ public static final byte IMG_ENHANCE_OFF = 0;
+/* */
+/* */ public static final byte IMG_ENHANCE_LOW = 1;
+/* */
+/* */ public static final byte IMG_ENHANCE_MED = 2;
+/* */
+/* */ public static final byte IMG_ENHANCE_HIGH = 3;
+/* */
+/* */ public static final byte IMG_ENHANCE_CUSTOM = 4;
+/* */
+/* */ public static final byte ISBT_CONCAT_NONE = 0;
+/* */
+/* */ public static final byte ISBT_CONCAT_ONLY = 1;
+/* */
+/* */ public static final byte ISBT_CONCAT_AUTOD = 2;
+/* */
+/* */ public static final byte REGULAR_ONLY = 0;
+/* */
+/* */ public static final byte INVERSE_ONLY = 1;
+/* */
+/* */ public static final byte INVERSE_AUTOD = 2;
+/* */
+/* */ public static final byte PDF_SECURITY_STRICT = 0;
+/* */
+/* */ public static final byte PDF_CWLEN_ZERO_OK = 1;
+/* */ }
+/* */
+/* */
+/* */ public static class PropertyNum
+/* */ {
+/* */ public static final int MODEL_NUMBER = 1;
+/* */
+/* */ public static final int SERIAL_NUM = 2;
+/* */
+/* */ public static final int MAX_FRAME_BUFFER_SIZE = 3;
+/* */
+/* */ public static final int HORIZONTAL_RES = 4;
+/* */
+/* */ public static final int VERTICAL_RES = 5;
+/* */
+/* */ public static final int IMGKIT_VER = 6;
+/* */
+/* */ public static final int ENGINE_VER = 7;
+/* */
+/* */ public static final int BTLD_FW_VER = 11;
+/* */
+/* */ public static final int SDL_VER = 99;
+/* */ }
+/* */
+/* */
+/* */ public static BarCodeReader open(int readerId) {
+/* 929 */ return new BarCodeReader(readerId);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static BarCodeReader open() {
+/* 945 */ int iNumReaders = getNumberOfReaders();
+/* 946 */ ReaderInfo readerInfo = new ReaderInfo();
+/* 947 */ for (int iIdx = 0; iIdx < iNumReaders; iIdx++) {
+/* */
+/* 949 */ getReaderInfo(iIdx, readerInfo);
+/* 950 */ if (readerInfo.facing == 1)
+/* */ {
+/* 952 */ return new BarCodeReader(iIdx);
+/* */ }
+/* */ }
+/* 955 */ return null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static BarCodeReader open(int readerId, Context context) {
+/* 988 */ return new BarCodeReader(readerId, context);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static BarCodeReader open(Context context) {
+/* 1004 */ int iNumReaders = getNumberOfReaders();
+/* 1005 */ ReaderInfo readerInfo = new ReaderInfo();
+/* */
+/* */
+/* 1008 */ if (iNumReaders == 3) {
+/* 1009 */ return new BarCodeReader(2, context);
+/* */ }
+/* */
+/* 1012 */ for (int iIdx = 0; iIdx < iNumReaders; iIdx++) {
+/* */
+/* 1014 */ getReaderInfo(iIdx, readerInfo);
+/* 1015 */ if (readerInfo.facing == 1)
+/* */ {
+/* 1017 */ return new BarCodeReader(iIdx, context);
+/* */ }
+/* */ }
+/* 1020 */ return null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ BarCodeReader(int readerId)
+/* */ {
+/* 1046 */ this.LOG_TAG = "BarCode";
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 1411 */ this.scanFinished = Boolean.valueOf(true); this.mEventHandler = null; this.mAutoFocusCallback = null; this.mDecodeCallback = null; this.mErrorCallback = null; this.mPreviewCallback = null; this.mSnapshotCallback = null; this.mVideoCallback = null; this.mZoomListener = null; Looper aLooper = Looper.myLooper(); if (aLooper == null) aLooper = Looper.getMainLooper(); if (aLooper != null) this.mEventHandler = new EventHandler(this, aLooper); native_setup(new WeakReference(this), readerId); } BarCodeReader(int readerId, Context context) { this.LOG_TAG = "BarCode"; this.scanFinished = Boolean.valueOf(true); this.mEventHandler = null; this.mAutoFocusCallback = null; this.mDecodeCallback = null; this.mErrorCallback = null; this.mPreviewCallback = null; this.mSnapshotCallback = null; this.mVideoCallback = null; this.mZoomListener = null; Looper aLooper = Looper.myLooper(); if (aLooper == null) aLooper = Looper.getMainLooper(); if (aLooper != null) this.mEventHandler = new EventHandler(this, aLooper); native_setup(new WeakReference(this), readerId, context); }
+/* */ protected void finalize() { native_release(); }
+/* */ public final void release() { native_release(); }
+/* 1414 */ public final void setPreviewDisplay(SurfaceHolder holder) throws IOException { if (holder != null) { setPreviewDisplay(holder.getSurface()); } else { setPreviewDisplay((Surface)null); } } public final void autoFocus(AutoFocusCallback cb) { this.mAutoFocusCallback = cb; native_autoFocus(); } public boolean isScanFinished() { return this.scanFinished.booleanValue(); }
+/* */ public final void cancelAutoFocus() { this.mAutoFocusCallback = null; native_cancelAutoFocus(); }
+/* */ public final void setDecodeCallback(DecodeCallback cb) { this.mDecodeCallback = cb; }
+/* */ public final void takePicture(PictureCallback cb) { this.mSnapshotCallback = cb; try { native_takePicture(); } catch (Throwable throwable) {} }
+/* 1418 */ public final void setOneShotPreviewCallback(PreviewCallback cb) { this.mPreviewCallback = cb; this.mOneShot = true; this.mWithBuffer = false; setHasPreviewCallback((cb != null), false); } public final void setPreviewCallbackWithBuffer(PreviewCallback cb) { this.mPreviewCallback = cb; this.mOneShot = false; this.mWithBuffer = true; setHasPreviewCallback((cb != null), true); } public void setScanFinished(boolean finished) { this.scanFinished = Boolean.valueOf(finished); }
+/* */
+/* */
+/* */ private class EventHandler
+/* */ extends Handler
+/* */ {
+/* */ private BarCodeReader mReader;
+/* */
+/* */ public EventHandler(BarCodeReader rdr, Looper looper) {
+/* 1427 */ super(looper);
+/* 1428 */ this.mReader = rdr;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void handleMessage(Message msg) {
+/* 1434 */ Log.i("BarCodeReader", String.format("Event message: %X, arg1=%d, arg2=%d", new Object[] { Integer.valueOf(msg.what), Integer.valueOf(msg.arg1), Integer.valueOf(msg.arg2) }));
+/* 1435 */ switch (msg.what) {
+/* */
+/* */ case 65536:
+/* 1438 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1440 */ BarCodeReader.this.mDecodeCallback.onDecodeComplete(msg.arg1, msg.arg2, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 131072:
+/* 1445 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1447 */ BarCodeReader.this.mDecodeCallback.onDecodeComplete(0, 0, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 262144:
+/* 1452 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1454 */ BarCodeReader.this.mDecodeCallback.onDecodeComplete(0, -1, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */
+/* */ case 524288:
+/* */ case 2097152:
+/* 1461 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1463 */ BarCodeReader.this.mDecodeCallback.onDecodeComplete(0, -2, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 1048576:
+/* 1468 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1470 */ BarCodeReader.this.mDecodeCallback.onEvent(msg.arg1, msg.arg2, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */
+/* */ case 2:
+/* */ return;
+/* */
+/* */ case 256:
+/* 1479 */ if (BarCodeReader.this.mSnapshotCallback != null) {
+/* */
+/* */
+/* */
+/* */
+/* 1484 */ int iCX = msg.arg1 >> 0 & 0xFFFF;
+/* 1485 */ int iCY = msg.arg1 >> 16 & 0xFFFF;
+/* 1486 */ BarCodeReader.this.mSnapshotCallback.onPictureTaken(msg.arg2, iCX, iCY, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ else {
+/* */
+/* 1490 */ Log.e("BarCodeReader", "BCRDR_MSG_COMPRESSED_IMAGE event with no snapshot callback");
+/* */ }
+/* */ return;
+/* */
+/* */ case 32:
+/* 1495 */ if (BarCodeReader.this.mVideoCallback != null) {
+/* */
+/* */
+/* */
+/* */
+/* 1500 */ int iCX = msg.arg1 >> 0 & 0xFFFF;
+/* 1501 */ int iCY = msg.arg1 >> 16 & 0xFFFF;
+/* 1502 */ BarCodeReader.this.mVideoCallback.onVideoFrame(msg.arg2, iCX, iCY, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ else {
+/* */
+/* 1506 */ Log.e("BarCodeReader", "BCRDR_MSG_VIDEO_FRAME event with no video callback");
+/* */ }
+/* */ return;
+/* */
+/* */ case 16:
+/* 1511 */ if (BarCodeReader.this.mPreviewCallback != null) {
+/* */
+/* 1513 */ PreviewCallback cb = BarCodeReader.this.mPreviewCallback;
+/* 1514 */ if (BarCodeReader.this.mOneShot) {
+/* */
+/* */
+/* */
+/* */
+/* 1519 */ BarCodeReader.this.mPreviewCallback = null;
+/* */ }
+/* 1521 */ else if (!BarCodeReader.this.mWithBuffer) {
+/* */
+/* */
+/* */
+/* */
+/* 1526 */ BarCodeReader.this.setHasPreviewCallback(true, false);
+/* */ }
+/* 1528 */ cb.onPreviewFrame((byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 4:
+/* 1533 */ if (BarCodeReader.this.mAutoFocusCallback != null)
+/* */ {
+/* 1535 */ BarCodeReader.this.mAutoFocusCallback.onAutoFocus(!(msg.arg1 == 0), this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 8:
+/* 1540 */ if (BarCodeReader.this.mZoomListener != null)
+/* */ {
+/* 1542 */ BarCodeReader.this.mZoomListener.onZoomChange(msg.arg1, (msg.arg2 != 0), this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 1:
+/* 1547 */ Log.e("BarCodeReader", "Error " + msg.arg1);
+/* 1548 */ if (BarCodeReader.this.mErrorCallback != null)
+/* */ {
+/* 1550 */ BarCodeReader.this.mErrorCallback.onError(msg.arg1, this.mReader);
+/* */ }
+/* */ return;
+/* */
+/* */ case 1024:
+/* 1555 */ if (BarCodeReader.this.mDecodeCallback != null)
+/* */ {
+/* 1557 */ BarCodeReader.this.mDecodeCallback.onDecodeComplete(msg.arg1, -3, (byte[])msg.obj, this.mReader);
+/* */ }
+/* */ return;
+/* */ }
+/* */
+/* 1562 */ Log.e("BarCodeReader", "Unknown message type " + msg.what);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private static void postEventFromNative(Object reader_ref, int what, int arg1, int arg2, Object obj) {
+/* 1571 */ BarCodeReader c = ((WeakReference)reader_ref).get();
+/* 1572 */ if (c != null && c.mEventHandler != null) {
+/* */
+/* 1574 */ Message m = c.mEventHandler.obtainMessage(what, arg1, arg2, obj);
+/* 1575 */ c.mEventHandler.sendMessage(m);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final void setZoomChangeListener(OnZoomChangeListener listener) {
+/* 1608 */ this.mZoomListener = listener;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public final void setErrorCallback(ErrorCallback cb) {
+/* 1636 */ this.mErrorCallback = cb;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setParameters(Parameters params) {
+/* 1648 */ native_setParameters(params.flatten());
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Parameters getParameters() {
+/* 1660 */ Parameters p = new Parameters();
+/* 1661 */ String s = native_getParameters();
+/* 1662 */ p.unflatten(s);
+/* 1663 */ return p;
+/* */ } private final native void native_autoFocus(); private final native void native_cancelAutoFocus(); private final native String native_getParameters(); private final native void native_release(); private final native int setNumParameter(int paramInt1, int paramInt2); private final native int setStrParameter(int paramInt, String paramString); private final native void native_setParameters(String paramString); private final native void native_setup(Object paramObject, int paramInt); private final native void native_setup(Object paramObject1, int paramInt, Object paramObject2); private final native void native_startPreview(int paramInt); private final native void native_takePicture(); private final native void setHasPreviewCallback(boolean paramBoolean1, boolean paramBoolean2); private final native void setPreviewDisplay(Surface paramSurface); public static native int getNumberOfReaders(); public static native void getReaderInfo(int paramInt, ReaderInfo paramReaderInfo); public final native void lock(); public final native void unlock(); public final native void reconnect() throws IOException; public final native int getNumProperty(int paramInt); public final native String getStrProperty(int paramInt); public final native int getNumParameter(int paramInt); public final native String getStrParameter(int paramInt); public final native void setDefaultParameters(); public final native void addCallbackBuffer(byte[] paramArrayOfbyte); public final native int FWUpdate(String paramString, boolean paramBoolean1, boolean paramBoolean2);
+/* */ public final native void stopPreview();
+/* */ public final native void startDecode();
+/* */ public final native int startHandsFreeDecode(int paramInt);
+/* */ public final native void stopDecode();
+/* */ public final native boolean previewEnabled();
+/* */ public final native void startSmoothZoom(int paramInt);
+/* */ public final native void stopSmoothZoom();
+/* */ public final native void setDisplayOrientation(int paramInt);
+/* */ public final native int getDecodeCount();
+/* */ public final native void enableAllCodeTypes();
+/* */ public final native void disableAllCodeTypes();
+/* */ public final native byte[] getLastDecImage();
+/* */ public final native void setAutoFocusDelay(int paramInt1, int paramInt2);
+/* */ public class Size { public Size(int w, int h) {
+/* 1679 */ this.width = w;
+/* 1680 */ this.height = h;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public int width;
+/* */
+/* */
+/* */ public int height;
+/* */
+/* */
+/* */ public boolean equals(Object obj) {
+/* 1692 */ if (!(obj instanceof Size))
+/* */ {
+/* 1694 */ return false;
+/* */ }
+/* 1696 */ Size s = (Size)obj;
+/* 1697 */ return (this.width == s.width && this.height == s.height);
+/* */ }
+/* */
+/* */
+/* */ public int hashCode() {
+/* 1702 */ return this.width * 32713 + this.height;
+/* */ } }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class Parameters
+/* */ {
+/* */ private static final String KEY_PREVIEW_SIZE = "preview-size";
+/* */
+/* */
+/* */ private static final String KEY_PREVIEW_FORMAT = "preview-format";
+/* */
+/* */
+/* */ private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate";
+/* */
+/* */
+/* */ private static final String KEY_PREVIEW_FPS_RANGE = "preview-fps-range";
+/* */
+/* */
+/* */ private static final String KEY_PICTURE_SIZE = "picture-size";
+/* */
+/* */
+/* */ private static final String KEY_PICTURE_FORMAT = "picture-format";
+/* */
+/* */
+/* */ private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size";
+/* */
+/* */
+/* */ private static final String KEY_JPEG_THUMBNAIL_WIDTH = "jpeg-thumbnail-width";
+/* */
+/* */
+/* */ private static final String KEY_JPEG_THUMBNAIL_HEIGHT = "jpeg-thumbnail-height";
+/* */
+/* */
+/* */ private static final String KEY_JPEG_THUMBNAIL_QUALITY = "jpeg-thumbnail-quality";
+/* */
+/* */
+/* */ private static final String KEY_JPEG_QUALITY = "jpeg-quality";
+/* */
+/* */
+/* */ private static final String KEY_ROTATION = "rotation";
+/* */
+/* */
+/* */ private static final String KEY_GPS_LATITUDE = "gps-latitude";
+/* */
+/* */
+/* */ private static final String KEY_GPS_LONGITUDE = "gps-longitude";
+/* */
+/* */
+/* */ private static final String KEY_GPS_ALTITUDE = "gps-altitude";
+/* */
+/* */
+/* */ private static final String KEY_GPS_TIMESTAMP = "gps-timestamp";
+/* */
+/* */
+/* */ private static final String KEY_GPS_PROCESSING_METHOD = "gps-processing-method";
+/* */
+/* */
+/* */ private static final String KEY_WHITE_BALANCE = "whitebalance";
+/* */
+/* */
+/* */ private static final String KEY_EFFECT = "effect";
+/* */
+/* */
+/* */ private static final String KEY_ANTIBANDING = "antibanding";
+/* */
+/* */
+/* */ private static final String KEY_SCENE_MODE = "scene-mode";
+/* */
+/* */
+/* */ private static final String KEY_FLASH_MODE = "flash-mode";
+/* */
+/* */
+/* */ private static final String KEY_FOCUS_MODE = "focus-mode";
+/* */
+/* */
+/* */ private static final String KEY_FOCAL_LENGTH = "focal-length";
+/* */
+/* */
+/* */ private static final String KEY_HORIZONTAL_VIEW_ANGLE = "horizontal-view-angle";
+/* */
+/* */
+/* */ private static final String KEY_VERTICAL_VIEW_ANGLE = "vertical-view-angle";
+/* */
+/* */
+/* */ private static final String KEY_EXPOSURE_COMPENSATION = "exposure-compensation";
+/* */
+/* */
+/* */ private static final String KEY_MAX_EXPOSURE_COMPENSATION = "max-exposure-compensation";
+/* */
+/* */
+/* */ private static final String KEY_MIN_EXPOSURE_COMPENSATION = "min-exposure-compensation";
+/* */
+/* */
+/* */ private static final String KEY_EXPOSURE_COMPENSATION_STEP = "exposure-compensation-step";
+/* */
+/* */
+/* */ private static final String KEY_ZOOM = "zoom";
+/* */
+/* */
+/* */ private static final String KEY_MAX_ZOOM = "max-zoom";
+/* */
+/* */
+/* */ private static final String KEY_ZOOM_RATIOS = "zoom-ratios";
+/* */
+/* */
+/* */ private static final String KEY_ZOOM_SUPPORTED = "zoom-supported";
+/* */
+/* */
+/* */ private static final String KEY_SMOOTH_ZOOM_SUPPORTED = "smooth-zoom-supported";
+/* */
+/* */
+/* */ private static final String KEY_FOCUS_DISTANCES = "focus-distances";
+/* */
+/* */
+/* */ private static final String SUPPORTED_VALUES_SUFFIX = "-values";
+/* */
+/* */
+/* */ private static final String TRUE = "true";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_AUTO = "auto";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_INCANDESCENT = "incandescent";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_FLUORESCENT = "fluorescent";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_WARM_FLUORESCENT = "warm-fluorescent";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_DAYLIGHT = "daylight";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_TWILIGHT = "twilight";
+/* */
+/* */
+/* */ public static final String WHITE_BALANCE_SHADE = "shade";
+/* */
+/* */
+/* */ public static final String EFFECT_NONE = "none";
+/* */
+/* */
+/* */ public static final String EFFECT_MONO = "mono";
+/* */
+/* */
+/* */ public static final String EFFECT_NEGATIVE = "negative";
+/* */
+/* */
+/* */ public static final String EFFECT_SOLARIZE = "solarize";
+/* */
+/* */
+/* */ public static final String EFFECT_SEPIA = "sepia";
+/* */
+/* */
+/* */ public static final String EFFECT_POSTERIZE = "posterize";
+/* */
+/* */
+/* */ public static final String EFFECT_WHITEBOARD = "whiteboard";
+/* */
+/* */
+/* */ public static final String EFFECT_BLACKBOARD = "blackboard";
+/* */
+/* */
+/* */ public static final String EFFECT_AQUA = "aqua";
+/* */
+/* */
+/* */ public static final String ANTIBANDING_AUTO = "auto";
+/* */
+/* */
+/* */ public static final String ANTIBANDING_50HZ = "50hz";
+/* */
+/* */
+/* */ public static final String ANTIBANDING_60HZ = "60hz";
+/* */
+/* */
+/* */ public static final String ANTIBANDING_OFF = "off";
+/* */
+/* */
+/* */ public static final String FLASH_MODE_OFF = "off";
+/* */
+/* */
+/* */ public static final String FLASH_MODE_AUTO = "auto";
+/* */
+/* */
+/* */ public static final String FLASH_MODE_ON = "on";
+/* */
+/* */
+/* */ public static final String FLASH_MODE_RED_EYE = "red-eye";
+/* */
+/* */
+/* */ public static final String FLASH_MODE_TORCH = "torch";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_AUTO = "auto";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_ACTION = "action";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_PORTRAIT = "portrait";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_LANDSCAPE = "landscape";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_NIGHT = "night";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_NIGHT_PORTRAIT = "night-portrait";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_THEATRE = "theatre";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_BEACH = "beach";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_SNOW = "snow";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_SUNSET = "sunset";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_STEADYPHOTO = "steadyphoto";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_FIREWORKS = "fireworks";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_SPORTS = "sports";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_PARTY = "party";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_CANDLELIGHT = "candlelight";
+/* */
+/* */
+/* */ public static final String SCENE_MODE_BARCODE = "barcode";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_AUTO = "auto";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_INFINITY = "infinity";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_MACRO = "macro";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_FIXED = "fixed";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_EDOF = "edof";
+/* */
+/* */
+/* */ public static final String FOCUS_MODE_CONTINUOUS_VIDEO = "continuous-video";
+/* */
+/* */
+/* */ public static final int FOCUS_DISTANCE_NEAR_INDEX = 0;
+/* */
+/* */
+/* */ public static final int FOCUS_DISTANCE_OPTIMAL_INDEX = 1;
+/* */
+/* */
+/* */ public static final int FOCUS_DISTANCE_FAR_INDEX = 2;
+/* */
+/* */
+/* */ public static final int PREVIEW_FPS_MIN_INDEX = 0;
+/* */
+/* */
+/* */ public static final int PREVIEW_FPS_MAX_INDEX = 1;
+/* */
+/* */
+/* */ private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp";
+/* */
+/* */
+/* */ private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp";
+/* */
+/* */
+/* */ private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv";
+/* */
+/* */
+/* */ private static final String PIXEL_FORMAT_RGB565 = "rgb565";
+/* */
+/* */
+/* */ private static final String PIXEL_FORMAT_JPEG = "jpeg";
+/* */
+/* */
+/* 1999 */ private HashMap mMap = new HashMap();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void dump() {
+/* 2009 */ Log.e("BarCodeReader", "dump: size=" + this.mMap.size());
+/* 2010 */ for (String k : this.mMap.keySet())
+/* */ {
+/* 2012 */ Log.e("BarCodeReader", "dump: " + k + "=" + (String)this.mMap.get(k));
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String flatten() {
+/* 2026 */ StringBuilder flattened = new StringBuilder();
+/* 2027 */ for (String k : this.mMap.keySet()) {
+/* */
+/* 2029 */ flattened.append(k);
+/* 2030 */ flattened.append("=");
+/* 2031 */ flattened.append(this.mMap.get(k));
+/* 2032 */ flattened.append(";");
+/* */ }
+/* */
+/* 2035 */ flattened.deleteCharAt(flattened.length() - 1);
+/* 2036 */ return flattened.toString();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void unflatten(String flattened) {
+/* 2054 */ this.mMap.clear();
+/* */
+/* 2056 */ StringTokenizer tokenizer = new StringTokenizer(flattened, ";");
+/* 2057 */ while (tokenizer.hasMoreElements()) {
+/* */
+/* 2059 */ String strKV = tokenizer.nextToken();
+/* 2060 */ int iPos = strKV.indexOf('=');
+/* 2061 */ if (iPos == -1) {
+/* */ continue;
+/* */ }
+/* */
+/* 2065 */ this.mMap.put(strKV.substring(0, iPos), strKV.substring(iPos + 1));
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void remove(String key) {
+/* 2071 */ this.mMap.remove(key);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void set(String key, String value) {
+/* 2082 */ if (key.indexOf('=') != -1 || key.indexOf(';') != -1) {
+/* */
+/* 2084 */ Log.e("BarCodeReader", "Key \"" + key + "\" contains invalid character (= or ;)");
+/* */ return;
+/* */ }
+/* 2087 */ if (value.indexOf('=') != -1 || value.indexOf(';') != -1) {
+/* */
+/* 2089 */ Log.e("BarCodeReader", "Value \"" + value + "\" contains invalid character (= or ;)");
+/* */
+/* */ return;
+/* */ }
+/* 2093 */ this.mMap.put(key, value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void set(String key, int value) {
+/* 2104 */ if (key.indexOf('=') != -1 || key.indexOf(';') != -1) {
+/* */
+/* 2106 */ Log.e("BarCodeReader", "Key \"" + key + "\" contains invalid character (= or ;)");
+/* */ return;
+/* */ }
+/* 2109 */ this.mMap.put(key, Integer.toString(value));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String get(String key) {
+/* 2120 */ return this.mMap.get(key);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getInt(String key) {
+/* 2131 */ return getInt(key, -1);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setPreviewSize(int width, int height) {
+/* 2158 */ String v = String.valueOf(Integer.toString(width)) + "x" + Integer.toString(height);
+/* 2159 */ set("preview-size", v);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Size getPreviewSize() {
+/* 2170 */ String pair = get("preview-size");
+/* 2171 */ return strToSize(pair);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedPreviewSizes() {
+/* 2182 */ String str = get("preview-size-values");
+/* 2183 */ return splitSize(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setJpegThumbnailSize(int width, int height) {
+/* 2250 */ set("jpeg-thumbnail-width", width);
+/* 2251 */ set("jpeg-thumbnail-height", height);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Size getJpegThumbnailSize() {
+/* 2262 */ return new Size(getInt("jpeg-thumbnail-width"), getInt("jpeg-thumbnail-height"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedJpegThumbnailSizes() {
+/* 2274 */ String str = get("jpeg-thumbnail-size-values");
+/* 2275 */ return splitSize(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setJpegThumbnailQuality(int quality) {
+/* 2286 */ set("jpeg-thumbnail-quality", quality);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getJpegThumbnailQuality() {
+/* 2296 */ return getInt("jpeg-thumbnail-quality");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setJpegQuality(int quality) {
+/* 2307 */ set("jpeg-quality", quality);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getJpegQuality() {
+/* 2317 */ return getInt("jpeg-quality");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ @Deprecated
+/* */ public void setPreviewFrameRate(int fps) {
+/* 2330 */ set("preview-frame-rate", fps);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ @Deprecated
+/* */ public int getPreviewFrameRate() {
+/* 2344 */ return getInt("preview-frame-rate");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ @Deprecated
+/* */ public List getSupportedPreviewFrameRates() {
+/* 2357 */ String str = get("preview-frame-rate-values");
+/* 2358 */ return splitInt(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setPreviewFpsRange(int min, int max) {
+/* 2375 */ set("preview-fps-range", min + "," + max);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void getPreviewFpsRange(int[] range) {
+/* 2389 */ if (range == null || range.length != 2)
+/* */ {
+/* 2391 */ throw new IllegalArgumentException("range must be an array with two elements.");
+/* */ }
+/* 2393 */ splitInt(get("preview-fps-range"), range);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedPreviewFpsRange() {
+/* 2415 */ String str = get("preview-fps-range-values");
+/* 2416 */ return (List)splitRange(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setPreviewFormat(int pixel_format) {
+/* 2434 */ String s = readerFormatForPixelFormat(pixel_format);
+/* 2435 */ if (s == null)
+/* */ {
+/* 2437 */ throw new IllegalArgumentException("Invalid pixel_format=" + pixel_format);
+/* */ }
+/* */
+/* 2440 */ set("preview-format", s);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getPreviewFormat() {
+/* 2452 */ return pixelFormatForReaderFormat(get("preview-format"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedPreviewFormats() {
+/* 2464 */ String str = get("preview-format-values");
+/* 2465 */ ArrayList formats = new ArrayList();
+/* 2466 */ for (String s : split(str)) {
+/* */
+/* 2468 */ int f = pixelFormatForReaderFormat(s);
+/* 2469 */ if (f == 0)
+/* */ continue;
+/* 2471 */ formats.add(Integer.valueOf(f));
+/* */ }
+/* 2473 */ return formats;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setPictureSize(int width, int height) {
+/* 2489 */ String v = String.valueOf(Integer.toString(width)) + "x" + Integer.toString(height);
+/* 2490 */ set("picture-size", v);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Size getPictureSize() {
+/* 2501 */ String pair = get("picture-size");
+/* 2502 */ return strToSize(pair);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedPictureSizes() {
+/* 2513 */ String str = get("picture-size-values");
+/* 2514 */ return splitSize(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setPictureFormat(int pixel_format) {
+/* 2528 */ String s = readerFormatForPixelFormat(pixel_format);
+/* 2529 */ if (s == null)
+/* */ {
+/* 2531 */ throw new IllegalArgumentException("Invalid pixel_format=" + pixel_format);
+/* */ }
+/* */
+/* 2534 */ set("picture-format", s);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getPictureFormat() {
+/* 2545 */ return pixelFormatForReaderFormat(get("picture-format"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedPictureFormats() {
+/* 2557 */ String str = get("picture-format-values");
+/* 2558 */ ArrayList formats = new ArrayList();
+/* 2559 */ for (String s : split(str)) {
+/* */
+/* 2561 */ int f = pixelFormatForReaderFormat(s);
+/* 2562 */ if (f == 0)
+/* */ continue;
+/* 2564 */ formats.add(Integer.valueOf(f));
+/* */ }
+/* 2566 */ return formats;
+/* */ }
+/* */
+/* */
+/* */ private String readerFormatForPixelFormat(int pixel_format) {
+/* 2571 */ switch (pixel_format) {
+/* */
+/* */ case 16:
+/* 2574 */ return "yuv422sp";
+/* */ case 17:
+/* 2576 */ return "yuv420sp";
+/* */ case 20:
+/* 2578 */ return "yuv422i-yuyv";
+/* */ case 4:
+/* 2580 */ return "rgb565";
+/* */ case 256:
+/* 2582 */ return "jpeg";
+/* */ }
+/* */
+/* */
+/* 2586 */ return null;
+/* */ }
+/* */
+/* */
+/* */ private int pixelFormatForReaderFormat(String format) {
+/* 2591 */ if (format == null) {
+/* 2592 */ return 0;
+/* */ }
+/* 2594 */ if (format.equals("yuv422sp")) {
+/* 2595 */ return 16;
+/* */ }
+/* 2597 */ if (format.equals("yuv420sp")) {
+/* 2598 */ return 17;
+/* */ }
+/* 2600 */ if (format.equals("yuv422i-yuyv")) {
+/* 2601 */ return 20;
+/* */ }
+/* 2603 */ if (format.equals("rgb565")) {
+/* 2604 */ return 4;
+/* */ }
+/* 2606 */ if (format.equals("jpeg")) {
+/* 2607 */ return 256;
+/* */ }
+/* 2609 */ return 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setRotation(int rotation) {
+/* 2676 */ if (rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270) {
+/* */
+/* 2678 */ set("rotation", Integer.toString(rotation));
+/* */ }
+/* */ else {
+/* */
+/* 2682 */ throw new IllegalArgumentException("Invalid rotation=" + rotation);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setGpsLatitude(double latitude) {
+/* 2694 */ set("gps-latitude", Double.toString(latitude));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setGpsLongitude(double longitude) {
+/* 2705 */ set("gps-longitude", Double.toString(longitude));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setGpsAltitude(double altitude) {
+/* 2715 */ set("gps-altitude", Double.toString(altitude));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setGpsTimestamp(long timestamp) {
+/* 2726 */ set("gps-timestamp", Long.toString(timestamp));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setGpsProcessingMethod(String processing_method) {
+/* 2737 */ set("gps-processing-method", processing_method);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void removeGpsData() {
+/* 2746 */ remove("gps-latitude");
+/* 2747 */ remove("gps-longitude");
+/* 2748 */ remove("gps-altitude");
+/* 2749 */ remove("gps-timestamp");
+/* 2750 */ remove("gps-processing-method");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getWhiteBalance() {
+/* 2770 */ return get("whitebalance");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setWhiteBalance(String value) {
+/* 2781 */ set("whitebalance", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedWhiteBalance() {
+/* 2793 */ String str = get("whitebalance-values");
+/* 2794 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getColorEffect() {
+/* 2814 */ return get("effect");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setColorEffect(String value) {
+/* 2825 */ set("effect", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedColorEffects() {
+/* 2837 */ String str = get("effect-values");
+/* 2838 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getAntibanding() {
+/* 2854 */ return get("antibanding");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setAntibanding(String antibanding) {
+/* 2865 */ set("antibanding", antibanding);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedAntibanding() {
+/* 2877 */ String str = get("antibanding-values");
+/* 2878 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getSceneMode() {
+/* 2904 */ return get("scene-mode");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setSceneMode(String value) {
+/* 2921 */ set("scene-mode", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedSceneModes() {
+/* 2933 */ String str = get("scene-mode-values");
+/* 2934 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getFlashMode() {
+/* 2950 */ return get("flash-mode");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setFlashMode(String value) {
+/* 2961 */ set("flash-mode", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedFlashModes() {
+/* 2973 */ String str = get("flash-mode-values");
+/* 2974 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public String getFocusMode() {
+/* 2993 */ return get("focus-mode");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setFocusMode(String value) {
+/* 3004 */ set("focus-mode", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getSupportedFocusModes() {
+/* 3016 */ String str = get("focus-mode-values");
+/* 3017 */ return split(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float getFocalLength() {
+/* 3028 */ return Float.parseFloat(get("focal-length"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float getHorizontalViewAngle() {
+/* 3039 */ return Float.parseFloat(get("horizontal-view-angle"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float getVerticalViewAngle() {
+/* 3050 */ return Float.parseFloat(get("vertical-view-angle"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getExposureCompensation() {
+/* 3063 */ return getInt("exposure-compensation", 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setExposureCompensation(int value) {
+/* 3078 */ set("exposure-compensation", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getMaxExposureCompensation() {
+/* 3090 */ return getInt("max-exposure-compensation", 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getMinExposureCompensation() {
+/* 3102 */ return getInt("min-exposure-compensation", 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float getExposureCompensationStep() {
+/* 3115 */ return getFloat("exposure-compensation-step", 0.0F);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getZoom() {
+/* 3128 */ return getInt("zoom", 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setZoom(int value) {
+/* 3143 */ set("zoom", value);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public boolean isZoomSupported() {
+/* 3154 */ String str = get("zoom-supported");
+/* 3155 */ return "true".equals(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getMaxZoom() {
+/* 3169 */ return getInt("max-zoom", 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public List getZoomRatios() {
+/* 3184 */ return splitInt(get("zoom-ratios"));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public boolean isSmoothZoomSupported() {
+/* 3195 */ String str = get("smooth-zoom-supported");
+/* 3196 */ return "true".equals(str);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void getFocusDistances(float[] output) {
+/* 3230 */ if (output == null || output.length != 3)
+/* */ {
+/* 3232 */ throw new IllegalArgumentException("output must be an float array with three elements.");
+/* */ }
+/* 3234 */ splitFloat(get("focus-distances"), output);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private ArrayList split(String str) {
+/* 3241 */ if (str == null) {
+/* 3242 */ return null;
+/* */ }
+/* */
+/* 3245 */ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+/* 3246 */ ArrayList substrings = new ArrayList();
+/* 3247 */ while (tokenizer.hasMoreElements())
+/* */ {
+/* 3249 */ substrings.add(tokenizer.nextToken());
+/* */ }
+/* 3251 */ return substrings;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private ArrayList splitInt(String str) {
+/* 3258 */ if (str == null) {
+/* 3259 */ return null;
+/* */ }
+/* 3261 */ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+/* 3262 */ ArrayList substrings = new ArrayList();
+/* 3263 */ while (tokenizer.hasMoreElements()) {
+/* */
+/* 3265 */ String token = tokenizer.nextToken();
+/* 3266 */ substrings.add(Integer.valueOf(Integer.parseInt(token)));
+/* */ }
+/* 3268 */ if (substrings.size() == 0) {
+/* 3269 */ return null;
+/* */ }
+/* 3271 */ return substrings;
+/* */ }
+/* */
+/* */
+/* */ private void splitInt(String str, int[] output) {
+/* 3276 */ if (str == null) {
+/* */ return;
+/* */ }
+/* 3279 */ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+/* 3280 */ int index = 0;
+/* 3281 */ while (tokenizer.hasMoreElements()) {
+/* */
+/* 3283 */ String token = tokenizer.nextToken();
+/* 3284 */ output[index++] = Integer.parseInt(token);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ private void splitFloat(String str, float[] output) {
+/* 3291 */ if (str == null) {
+/* */ return;
+/* */ }
+/* 3294 */ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+/* 3295 */ int index = 0;
+/* 3296 */ while (tokenizer.hasMoreElements()) {
+/* */
+/* 3298 */ String token = tokenizer.nextToken();
+/* 3299 */ output[index++] = Float.parseFloat(token);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private float getFloat(String key, float defaultValue) {
+/* */ try {
+/* 3310 */ float flRetVal = Float.parseFloat(this.mMap.get(key));
+/* 3311 */ return flRetVal;
+/* */ }
+/* 3313 */ catch (Throwable throwable) {
+/* */
+/* */
+/* 3316 */ return defaultValue;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private int getInt(String key, int defaultValue) {
+/* */ try {
+/* 3326 */ int iRetVal = Integer.parseInt(this.mMap.get(key));
+/* 3327 */ return iRetVal;
+/* */ }
+/* 3329 */ catch (Throwable throwable) {
+/* */
+/* */
+/* 3332 */ return defaultValue;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ private ArrayList splitSize(String str) {
+/* 3339 */ if (str == null) {
+/* 3340 */ return null;
+/* */ }
+/* 3342 */ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+/* 3343 */ ArrayList sizeList = new ArrayList();
+/* 3344 */ while (tokenizer.hasMoreElements()) {
+/* */
+/* 3346 */ Size size = strToSize(tokenizer.nextToken());
+/* 3347 */ if (size != null)
+/* 3348 */ sizeList.add(size);
+/* */ }
+/* 3350 */ if (sizeList.size() == 0) {
+/* 3351 */ return null;
+/* */ }
+/* 3353 */ return sizeList;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private Size strToSize(String str) {
+/* 3360 */ if (str == null) {
+/* 3361 */ return null;
+/* */ }
+/* 3363 */ int pos = str.indexOf('x');
+/* 3364 */ if (pos != -1) {
+/* */
+/* 3366 */ String width = str.substring(0, pos);
+/* 3367 */ String height = str.substring(pos + 1);
+/* 3368 */ return new Size(Integer.parseInt(width), Integer.parseInt(height));
+/* */ }
+/* 3370 */ Log.e("BarCodeReader", "Invalid size parameter string=" + str);
+/* 3371 */ return null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private ArrayList splitRange(String str) {
+/* */ int endIndex;
+/* 3379 */ if (str == null || str.charAt(0) != '(' || str.charAt(str.length() - 1) != ')') {
+/* */
+/* 3381 */ Log.e("BarCodeReader", "Invalid range list string=" + str);
+/* 3382 */ return null;
+/* */ }
+/* */
+/* 3385 */ ArrayList rangeList = (ArrayList)new ArrayList<>();
+/* 3386 */ int fromIndex = 1;
+/* */
+/* */ do {
+/* 3389 */ int[] range = new int[2];
+/* 3390 */ endIndex = str.indexOf("),(", fromIndex);
+/* 3391 */ if (endIndex == -1)
+/* 3392 */ endIndex = str.length() - 1;
+/* 3393 */ splitInt(str.substring(fromIndex, endIndex), range);
+/* 3394 */ rangeList.add(range);
+/* 3395 */ fromIndex = endIndex + 3;
+/* */ }
+/* 3397 */ while (endIndex != str.length() - 1);
+/* */
+/* 3399 */ if (rangeList.size() == 0) {
+/* 3400 */ return null;
+/* */ }
+/* 3402 */ return rangeList;
+/* */ }
+/* */
+/* */ private Parameters() {}
+/* */ }
+/* */
+/* */ public static interface AutoFocusCallback {
+/* */ void onAutoFocus(boolean param1Boolean, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface DecodeCallback {
+/* */ void onDecodeComplete(int param1Int1, int param1Int2, byte[] param1ArrayOfbyte, BarCodeReader param1BarCodeReader);
+/* */
+/* */ void onEvent(int param1Int1, int param1Int2, byte[] param1ArrayOfbyte, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface ErrorCallback {
+/* */ void onError(int param1Int, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface OnZoomChangeListener {
+/* */ void onZoomChange(int param1Int, boolean param1Boolean, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface PictureCallback {
+/* */ void onPictureTaken(int param1Int1, int param1Int2, int param1Int3, byte[] param1ArrayOfbyte, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface PreviewCallback {
+/* */ void onPreviewFrame(byte[] param1ArrayOfbyte, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */
+/* */ public static interface VideoCallback {
+/* */ void onVideoFrame(int param1Int1, int param1Int2, int param1Int3, byte[] param1ArrayOfbyte, BarCodeReader param1BarCodeReader);
+/* */ }
+/* */ }
+
+
+/* Location: E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\zebra\adc\decoder\BarCodeReader.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 1.1.3
+ */
\ No newline at end of file
diff --git a/app/src/main/java/map/baidu/com/BDMapActivity.java b/app/src/main/java/map/baidu/com/BDMapActivity.java
new file mode 100644
index 0000000..e3f3dbb
--- /dev/null
+++ b/app/src/main/java/map/baidu/com/BDMapActivity.java
@@ -0,0 +1,141 @@
+package map.baidu.com;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.ZoomControls;
+import com.baidu.location.BDLocation;
+import com.baidu.location.BDLocationListener;
+import com.baidu.mapapi.*;
+import com.example.chaoran.R;
+import com.util.DialogUtil;
+
+import java.util.HashMap;
+
+public class BDMapActivity extends MapActivity {
+ private MapView mMapView = null; // 地图View
+ private MapController mMapController;
+ private LBSLocationClientController mLocationClientController;
+ private BMapManagerUtil app;
+ private BDLocation bdLocation;
+
+ @Override
+ protected boolean isRouteDisplayed() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_bdmap);
+ this.setTitle("正在定位......");
+ app = (BMapManagerUtil) this.getApplication();
+ if (app.mBMapMan == null) {
+ app.mBMapMan = new BMapManager(getApplication());
+ app.mBMapMan.init(app.mStrKey,
+ new BMapManagerUtil.MyGeneralListener());
+ }
+ super.initMapActivity(app.mBMapMan);
+ mMapView = (MapView) findViewById(R.id.bmapView);
+ mMapView.setBuiltInZoomControls(true);
+ mMapController = mMapView.getController();
+ mMapController.setZoom(24);
+ mLocationClientController = new LBSLocationClientController(this,
+ new MyBDLocationListener());
+ mLocationClientController.initializeLocationClientOption(); // 初始化定位选项(可调节)
+ MyLocationOverlay myLocation = new MyLocationOverlay(this, mMapView);
+ // 注册GPS位置更新的事件,让地图能实时显示当前位置
+ myLocation.enableMyLocation();
+ // 开启磁场感应传感器
+ myLocation.enableCompass();
+ mMapView.getOverlays().add(myLocation);
+ ZoomControls zoomControls = (ZoomControls) mMapView.getChildAt(2);
+ // mapView.removeViewAt(2);
+ // 调整缩放控件的位置
+ zoomControls.setPadding(0, 0, 0, 100);
+ // 获取mapview中的百度地图图标
+ ImageView iv = (ImageView) mMapView.getChildAt(1);
+ // mapView.removeViewAt(1);
+ // 调整百度地图图标的位置
+ iv.setPadding(0, 0, 0, 100);
+ }
+
+ @Override
+ protected void onPause() {
+ mLocationClientController.stopLocationClient();
+ app.mBMapMan.stop();
+ super.onPause();
+ }
+
+ @Override
+ protected void onResume() {
+ mLocationClientController.startLocationClient();
+ app.mBMapMan.start();
+ super.onResume();
+ }
+
+ @Override
+ protected void onDestroy() {
+ // TODO Auto-generated method stub
+ super.onDestroy();
+ app.onTerminate();
+ bdLocation = null;
+ app = null;
+ mLocationClientController = null;
+ mMapController = null;
+ mMapView = null;
+ }
+
+ public void onSub(View v) {
+ if (bdLocation != null) {
+ HashMap map = new HashMap();
+ map.put("latitude", bdLocation.getLatitude());
+ map.put("longitude", bdLocation.getLongitude());
+ map.put("gpsAddress", bdLocation.getAddrStr());
+ Intent intent = getIntent();
+ intent.putExtra("param", map);
+ setResult(3, intent);
+ finish();
+ }else{
+ DialogUtil.builder(BDMapActivity.this, "提示信息",
+ "正在定位",0);
+ }
+ }
+
+ public void onCurrentLocal(View v) {
+ this.setTitle("正在定位......");
+ mLocationClientController.requestLocationInformation();
+ }
+
+ // @Override
+ // public boolean onCreateOptionsMenu(Menu menu) {
+ // // TODO Auto-generated method stub
+ // super.onCreateOptionsMenu(menu);
+ // menu.add(0, 1, Menu.NONE, "放大");
+ // menu.add(0, 2, Menu.NONE, "缩小");
+ // return true;
+ // }
+ private class MyBDLocationListener implements BDLocationListener {
+ @Override
+ public void onReceiveLocation(BDLocation location) {
+ Log.i("onReceiveLocation", "onReceiveLocation");
+ if (location == null)
+ return;
+ bdLocation = location;
+ mMapController.setCenter(new GeoPoint(
+ (int) (location.getLatitude() * 1E6), (int) (location
+ .getLongitude() * 1E6)));
+ BDMapActivity.this.setTitle("定位成功 _" + location.getAddrStr());
+ }
+
+ @Override
+ public void onReceivePoi(BDLocation poiLocation) {
+ if (poiLocation == null)
+ return;
+ }
+ }
+
+}
diff --git a/app/src/main/java/map/baidu/com/BMapManagerUtil.java b/app/src/main/java/map/baidu/com/BMapManagerUtil.java
new file mode 100644
index 0000000..9b0af7c
--- /dev/null
+++ b/app/src/main/java/map/baidu/com/BMapManagerUtil.java
@@ -0,0 +1,61 @@
+package map.baidu.com;
+
+import android.app.Application;
+import android.widget.Toast;
+import com.baidu.mapapi.BMapManager;
+import com.baidu.mapapi.MKEvent;
+import com.baidu.mapapi.MKGeneralListener;
+
+public class BMapManagerUtil extends Application {
+ private static BMapManagerUtil bMapManagerUtil;
+ // 百度MapAPI的管理类
+ public BMapManager mBMapMan = null;
+
+ // 授权Key
+ // TODO: 请输入您的Key,
+ // 申请地址:http://dev.baidu.com/wiki/static/imap/key/
+ public String mStrKey = "F49D31823069482466999FADEE70C34C80055379";
+ private boolean m_bKeyRight = true; // 授权Key正确,验证通过
+
+ // 常用事件监听,用来处理通常的网络错误,授权验证错误等
+ static class MyGeneralListener implements MKGeneralListener {
+ @Override
+ public void onGetNetworkState(int iError) {
+ Toast.makeText(bMapManagerUtil.getApplicationContext(), "您的网络出错啦!",
+ Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onGetPermissionState(int iError) {
+ if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
+ // 授权Key错误:
+ Toast.makeText(bMapManagerUtil.getApplicationContext(),
+ "请在BMapApiDemoApp.java文件输入正确的授权Key!", Toast.LENGTH_LONG)
+ .show();
+ bMapManagerUtil.m_bKeyRight = false;
+
+ }
+ }
+
+ }
+
+ @Override
+ public void onCreate() {
+ bMapManagerUtil = this;
+ mBMapMan = new BMapManager(this);
+ mBMapMan.init(this.mStrKey, new MyGeneralListener());
+ super.onCreate();
+ }
+
+ @Override
+ // 建议在您app的退出之前调用mapadpi的destroy()函数,避免重复初始化带来的时间消耗
+ public void onTerminate() {
+ // TODO Auto-generated method stub
+ if (mBMapMan != null) {
+ mBMapMan.destroy();
+ mBMapMan = null;
+ }
+ super.onTerminate();
+ }
+
+}
diff --git a/app/src/main/java/map/baidu/com/LBSLocationClientController.java b/app/src/main/java/map/baidu/com/LBSLocationClientController.java
new file mode 100644
index 0000000..732885f
--- /dev/null
+++ b/app/src/main/java/map/baidu/com/LBSLocationClientController.java
@@ -0,0 +1,126 @@
+package map.baidu.com;
+
+import android.content.Context;
+import android.util.Log;
+import com.baidu.location.BDLocation;
+import com.baidu.location.BDLocationListener;
+import com.baidu.location.LocationClient;
+import com.baidu.location.LocationClientOption;
+
+public class LBSLocationClientController {
+
+ private LocationClient mLocationClient;
+
+ public LBSLocationClientController(Context context,
+ BDLocationListener listener) {
+ initializeLocationClient(context, listener);
+ }
+
+ private void initializeLocationClient(Context context,
+ BDLocationListener listener) {
+
+ mLocationClient = new LocationClient(context);
+ mLocationClient.registerLocationListener(listener);
+ }
+
+ private boolean isLocationClientPrepared() {
+ return mLocationClient != null && mLocationClient.isStarted();
+ }
+
+ public void setLocationOption(LocationClientOption option) {
+ mLocationClient.setLocOption(option);
+ }
+
+ public void startLocationClient() {
+ if (mLocationClient != null) {
+ System.out.println("------------------------------------------启动");
+ mLocationClient.start();
+ }
+ }
+
+ public void stopLocationClient() {
+ if (mLocationClient != null) {
+ mLocationClient.stop();
+ }
+ }
+
+ public void requestPIOInformation() {
+ if (isLocationClientPrepared()) {
+ Log.i("requestPoi", "requestPoi");
+ mLocationClient.requestPoi();
+ }
+ }
+
+ public void requestLocationInformation() {
+ if (isLocationClientPrepared()) {
+ Log.i("requestLocation", "requestLocation");
+ mLocationClient.requestLocation();
+ }
+ }
+
+ public StringBuffer buildLocationStringBuffer(BDLocation location) {
+ StringBuffer sb = new StringBuffer(256);
+ sb.append("time : ");
+ sb.append(location.getTime());
+ sb.append("\nerror code : ");
+ sb.append(location.getLocType());
+ sb.append("\nlatitude : ");
+ sb.append(location.getLatitude());
+ sb.append("\nlontitude : ");
+ sb.append(location.getLongitude());
+ sb.append("\nradius : ");
+ sb.append(location.getRadius());
+ if (location.getLocType() == BDLocation.TypeGpsLocation) {
+ sb.append("\nspeed : ");
+ sb.append(location.getSpeed());
+ sb.append("\nsatellite : ");
+ sb.append(location.getSatelliteNumber());
+ } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {
+ sb.append("\naddr : ");
+ sb.append(location.getAddrStr());
+ }
+ return sb;
+ }
+
+ public StringBuffer buildPIOStringBuffer(BDLocation poiLocation) {
+ StringBuffer sb = new StringBuffer(256);
+ sb.append("Poi time : ");
+ sb.append(poiLocation.getTime());
+ sb.append("\nerror code : ");
+ sb.append(poiLocation.getLocType());
+ sb.append("\nlatitude : ");
+ sb.append(poiLocation.getLatitude());
+ sb.append("\nlontitude : ");
+ sb.append(poiLocation.getLongitude());
+ sb.append("\nradius : ");
+ sb.append(poiLocation.getRadius());
+ if (poiLocation.getLocType() == BDLocation.TypeNetWorkLocation) {
+ sb.append("\naddr : ");
+ sb.append(poiLocation.getAddrStr());
+ }
+ if (poiLocation.hasPoi()) {
+ sb.append("\nPoi:");
+ sb.append(poiLocation.getPoi());
+ } else {
+ sb.append("noPoi information");
+ }
+ return sb;
+ }
+
+ public void initializeLocationClientOption() {
+ LocationClientOption option = new LocationClientOption();
+ option.setOpenGps(true);// 开启GPS
+// option.setAddrType("detail");
+ option.setCoorType("bd09ll");// gcj02
+// option.setScanSpan(800);
+ option.setServiceName("crtech");
+ option.setProdName("crtech");
+ option.setAddrType("all");
+ option.disableCache(true);// 禁止启用缓存定位
+ option.setPoiNumber(5); // 最多返回POI个数
+ option.setPoiDistance(500); // poi查询距离
+ option.setPoiExtraInfo(true); // 是否需要POI的电话和地址等详细信息
+ setLocationOption(option);
+ }
+
+}
diff --git a/app/src/main/res/drawable-hdpi/calendar.png b/app/src/main/res/drawable-hdpi/calendar.png
new file mode 100644
index 0000000..ef1038b
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/calendar.png differ
diff --git a/app/src/main/res/drawable-hdpi/checkbox_empty.png b/app/src/main/res/drawable-hdpi/checkbox_empty.png
new file mode 100644
index 0000000..b50cbfa
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/checkbox_empty.png differ
diff --git a/app/src/main/res/drawable-hdpi/checkbox_full.png b/app/src/main/res/drawable-hdpi/checkbox_full.png
new file mode 100644
index 0000000..9c25249
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/checkbox_full.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_search.png b/app/src/main/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 0000000..67de12d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_search.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..4fd7458
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-hdpi/logo.png b/app/src/main/res/drawable-hdpi/logo.png
new file mode 100644
index 0000000..4fd7458
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/logo.png differ
diff --git a/app/src/main/res/drawable-hdpi/mm_title_back_focused.png b/app/src/main/res/drawable-hdpi/mm_title_back_focused.png
new file mode 100644
index 0000000..e979613
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/mm_title_back_focused.png differ
diff --git a/app/src/main/res/drawable-hdpi/mm_title_back_normal.png b/app/src/main/res/drawable-hdpi/mm_title_back_normal.png
new file mode 100644
index 0000000..f57da3d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/mm_title_back_normal.png differ
diff --git a/app/src/main/res/drawable-hdpi/mm_title_back_pressed.png b/app/src/main/res/drawable-hdpi/mm_title_back_pressed.png
new file mode 100644
index 0000000..8cb91f6
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/mm_title_back_pressed.png differ
diff --git a/app/src/main/res/drawable-hdpi/mmtitle_bg_alpha.png b/app/src/main/res/drawable-hdpi/mmtitle_bg_alpha.png
new file mode 100644
index 0000000..99528cc
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/mmtitle_bg_alpha.png differ
diff --git a/app/src/main/res/drawable-ldpi/ic_launcher.png b/app/src/main/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..2206095
Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_search.png b/app/src/main/res/drawable-mdpi/ic_action_search.png
new file mode 100644
index 0000000..134d549
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_search.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..59ebb8e
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_search.png b/app/src/main/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 0000000..d699c6b
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_search.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..8a0e38d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable/mm_title_back_btn.xml b/app/src/main/res/drawable/mm_title_back_btn.xml
new file mode 100644
index 0000000..a2d1086
--- /dev/null
+++ b/app/src/main/res/drawable/mm_title_back_btn.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_bdmap.xml b/app/src/main/res/layout/activity_bdmap.xml
new file mode 100644
index 0000000..566b7ed
--- /dev/null
+++ b/app/src/main/res/layout/activity_bdmap.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_dj.xml b/app/src/main/res/layout/activity_dj.xml
new file mode 100644
index 0000000..b630e0c
--- /dev/null
+++ b/app/src/main/res/layout/activity_dj.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..eba4441
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,191 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_menu.xml b/app/src/main/res/layout/activity_menu.xml
new file mode 100644
index 0000000..7a7d7f8
--- /dev/null
+++ b/app/src/main/res/layout/activity_menu.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_net_work_set.xml b/app/src/main/res/layout/activity_net_work_set.xml
new file mode 100644
index 0000000..c5446dd
--- /dev/null
+++ b/app/src/main/res/layout/activity_net_work_set.xml
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_param.xml b/app/src/main/res/layout/activity_param.xml
new file mode 100644
index 0000000..4e45fac
--- /dev/null
+++ b/app/src/main/res/layout/activity_param.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_pda_reg.xml b/app/src/main/res/layout/activity_pda_reg.xml
new file mode 100644
index 0000000..74fd80a
--- /dev/null
+++ b/app/src/main/res/layout/activity_pda_reg.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_title.xml b/app/src/main/res/layout/activity_title.xml
new file mode 100644
index 0000000..a003f85
--- /dev/null
+++ b/app/src/main/res/layout/activity_title.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_update_pwd.xml b/app/src/main/res/layout/activity_update_pwd.xml
new file mode 100644
index 0000000..682ed9d
--- /dev/null
+++ b/app/src/main/res/layout/activity_update_pwd.xml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/butadapter_list_child.xml b/app/src/main/res/layout/butadapter_list_child.xml
new file mode 100644
index 0000000..afbbb34
--- /dev/null
+++ b/app/src/main/res/layout/butadapter_list_child.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/camerascansctivity.xml b/app/src/main/res/layout/camerascansctivity.xml
new file mode 100644
index 0000000..f3ea17d
--- /dev/null
+++ b/app/src/main/res/layout/camerascansctivity.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/down_data_activity.xml b/app/src/main/res/layout/down_data_activity.xml
new file mode 100644
index 0000000..3488322
--- /dev/null
+++ b/app/src/main/res/layout/down_data_activity.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/imageadpter.xml b/app/src/main/res/layout/imageadpter.xml
new file mode 100644
index 0000000..96ab128
--- /dev/null
+++ b/app/src/main/res/layout/imageadpter.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list.xml b/app/src/main/res/layout/list.xml
new file mode 100644
index 0000000..ad08bcd
--- /dev/null
+++ b/app/src/main/res/layout/list.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_child.xml b/app/src/main/res/layout/list_child.xml
new file mode 100644
index 0000000..eaa8156
--- /dev/null
+++ b/app/src/main/res/layout/list_child.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/lx_param_activity.xml b/app/src/main/res/layout/lx_param_activity.xml
new file mode 100644
index 0000000..7fed4b9
--- /dev/null
+++ b/app/src/main/res/layout/lx_param_activity.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/popup.xml b/app/src/main/res/layout/popup.xml
new file mode 100644
index 0000000..d77cf89
--- /dev/null
+++ b/app/src/main/res/layout/popup.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/title.xml b/app/src/main/res/layout/title.xml
new file mode 100644
index 0000000..e8c215d
--- /dev/null
+++ b/app/src/main/res/layout/title.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_bdmap.xml b/app/src/main/res/menu/activity_bdmap.xml
new file mode 100644
index 0000000..44a11e7
--- /dev/null
+++ b/app/src/main/res/menu/activity_bdmap.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/activity_dj.xml b/app/src/main/res/menu/activity_dj.xml
new file mode 100644
index 0000000..ec9baaa
--- /dev/null
+++ b/app/src/main/res/menu/activity_dj.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/activity_main.xml b/app/src/main/res/menu/activity_main.xml
new file mode 100644
index 0000000..ddc2909
--- /dev/null
+++ b/app/src/main/res/menu/activity_main.xml
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_menu.xml b/app/src/main/res/menu/activity_menu.xml
new file mode 100644
index 0000000..44a11e7
--- /dev/null
+++ b/app/src/main/res/menu/activity_menu.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/activity_net_work_set.xml b/app/src/main/res/menu/activity_net_work_set.xml
new file mode 100644
index 0000000..44a11e7
--- /dev/null
+++ b/app/src/main/res/menu/activity_net_work_set.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/activity_param.xml b/app/src/main/res/menu/activity_param.xml
new file mode 100644
index 0000000..44a11e7
--- /dev/null
+++ b/app/src/main/res/menu/activity_param.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/activity_pda_reg.xml b/app/src/main/res/menu/activity_pda_reg.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/app/src/main/res/menu/activity_pda_reg.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/menu/activity_seuic_scan.xml b/app/src/main/res/menu/activity_seuic_scan.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/app/src/main/res/menu/activity_seuic_scan.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/menu/activity_update_pwd.xml b/app/src/main/res/menu/activity_update_pwd.xml
new file mode 100644
index 0000000..44a11e7
--- /dev/null
+++ b/app/src/main/res/menu/activity_update_pwd.xml
@@ -0,0 +1,5 @@
+
diff --git a/app/src/main/res/menu/camerascansctivity.xml b/app/src/main/res/menu/camerascansctivity.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/app/src/main/res/menu/camerascansctivity.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/menu/down_data_activity.xml b/app/src/main/res/menu/down_data_activity.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/app/src/main/res/menu/down_data_activity.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/menu/lx_param_activity.xml b/app/src/main/res/menu/lx_param_activity.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/app/src/main/res/menu/lx_param_activity.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/raw/beep.ogg b/app/src/main/res/raw/beep.ogg
new file mode 100644
index 0000000..1419947
Binary files /dev/null and b/app/src/main/res/raw/beep.ogg differ
diff --git a/app/src/main/res/raw/didi.ogg b/app/src/main/res/raw/didi.ogg
new file mode 100644
index 0000000..3ea31f3
Binary files /dev/null and b/app/src/main/res/raw/didi.ogg differ
diff --git a/app/src/main/res/raw/dudu.ogg b/app/src/main/res/raw/dudu.ogg
new file mode 100644
index 0000000..265cc4b
Binary files /dev/null and b/app/src/main/res/raw/dudu.ogg differ
diff --git a/app/src/main/res/values/color.xml b/app/src/main/res/values/color.xml
new file mode 100644
index 0000000..a1ea206
--- /dev/null
+++ b/app/src/main/res/values/color.xml
@@ -0,0 +1,7 @@
+
+
+
+ #b0000000
+ #60000000
+ #c0ffff00
+
\ No newline at end of file
diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml
new file mode 100644
index 0000000..de2e23a
--- /dev/null
+++ b/app/src/main/res/values/ids.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..0855c6d
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,34 @@
+
+
+ ChaoRan
+ Hello world!
+ Settings
+ 超然系统
+ 网络设置
+ 菜单
+ 单据主页面
+ 明细界面
+ Barcode Scan
+ Start Scan
+ Stop Scan
+ Close
+ Clear
+ Content
+ Scan key choose
+ Device open failed!Software will quit!
+ Warning!
+ Confirm
+ 检索方案窗口
+ 提取方案窗口
+ 密码修改界面
+ BDMapActivity
+ 离线数据下载
+ 离线登录
+ 数据下载页面
+ 参数页面
+ 条码扫描
+ 将二维码放入框内,即可自动扫描
+ PdaRegActivity
+ SeuicScan
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..4dba0d0
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..c8d7712
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,24 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:4.1.0"
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..01b80d7
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,19 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..d09120f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Nov 09 22:43:28 CST 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..ddb6a83
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name = "ChaoRan-PDA-Client"
\ No newline at end of file