Skip to content

Commit

Permalink
去掉无用方法
Browse files Browse the repository at this point in the history
  • Loading branch information
hupei committed Aug 25, 2016
1 parent b87f075 commit b65d95c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.graphics.Rect;
import android.hardware.Camera;
import android.os.Build;
import android.util.Log;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -48,8 +47,8 @@ public final class CameraConfigurationUtils {
private static final float MAX_EXPOSURE_COMPENSATION = 1.5f;
private static final float MIN_EXPOSURE_COMPENSATION = 0.0f;
private static final double MAX_ASPECT_DISTORTION = 0.15;
private static final int MIN_FPS = 10;
private static final int MAX_FPS = 20;
/* private static final int MIN_FPS = 10;
private static final int MAX_FPS = 20;*/
private static final int AREA_PER_1000 = 400;

private CameraConfigurationUtils() {
Expand Down Expand Up @@ -134,11 +133,11 @@ public static void setBestExposure(Camera.Parameters parameters, boolean lightOn
}
}

public static void setBestPreviewFPS(Camera.Parameters parameters) {
/* public static void setBestPreviewFPS(Camera.Parameters parameters) {
setBestPreviewFPS(parameters, MIN_FPS, MAX_FPS);
}
}*/

public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) {
/* public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) {
List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
// Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges));
if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) {
Expand All @@ -165,7 +164,7 @@ public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, i
}
}
}
}
}*/

public static void setFocusArea(Camera.Parameters parameters) {
if (parameters.getMaxNumFocusAreas() > 0) {
Expand Down Expand Up @@ -220,7 +219,7 @@ public static void setBarcodeSceneMode(Camera.Parameters parameters) {
}
}

public static void setZoom(Camera.Parameters parameters, double targetZoomRatio) {
/* public static void setZoom(Camera.Parameters parameters, double targetZoomRatio) {
if (parameters.isZoomSupported()) {
Integer zoom = indexOfClosestZoom(parameters, targetZoomRatio);
if (zoom == null) {
Expand All @@ -235,9 +234,9 @@ public static void setZoom(Camera.Parameters parameters, double targetZoomRatio)
// } else {
// Log.i(TAG, "Zoom is not supported");
}
}
}*/

private static Integer indexOfClosestZoom(Camera.Parameters parameters, double targetZoomRatio) {
/* private static Integer indexOfClosestZoom(Camera.Parameters parameters, double targetZoomRatio) {
List<Integer> ratios = parameters.getZoomRatios();
// Log.i(TAG, "Zoom ratios: " + ratios);
int maxZoom = parameters.getMaxZoom();
Expand All @@ -257,7 +256,7 @@ private static Integer indexOfClosestZoom(Camera.Parameters parameters, double t
}
// Log.i(TAG, "Chose zoom ratio of " + (ratios.get(closestIndex) / 100.0));
return closestIndex;
}
}*/

public static void setInvertColor(Camera.Parameters parameters) {
if (Camera.Parameters.EFFECT_NEGATIVE.equals(parameters.getColorEffect())) {
Expand Down Expand Up @@ -377,7 +376,7 @@ private static String findSettableValue(String name,
return null;
}

private static String toString(Collection<int[]> arrays) {
/* private static String toString(Collection<int[]> arrays) {
if (arrays == null || arrays.isEmpty()) {
return "[]";
}
Expand Down Expand Up @@ -407,9 +406,9 @@ private static String toString(Iterable<Camera.Area> areas) {
public static String collectStats(Camera.Parameters parameters) {
return collectStats(parameters.flatten());
}
}*/

public static String collectStats(CharSequence flattenedParams) {
/* public static String collectStats(CharSequence flattenedParams) {
StringBuilder result = new StringBuilder(1000);
result.append("BOARD=").append(Build.BOARD).append('\n');
Expand Down Expand Up @@ -441,6 +440,6 @@ public static String collectStats(CharSequence flattenedParams) {
}
return result.toString();
}
}*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ public synchronized Rect getFramingRectInPreview() {
*
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
*/
public synchronized void setManualCameraId(int cameraId) {
/* public synchronized void setManualCameraId(int cameraId) {
requestedCameraId = cameraId;
}
}*/

/**
* Allows third party apps to specify the scanning rectangle dimensions, rather than determine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,32 +89,32 @@ public static final class Scan {
* Overrides the default camera that would otherwise would have been selected.
* If provided, should be an int.
*/
public static final String CAMERA_ID = "SCAN_CAMERA_ID";
// public static final String CAMERA_ID = "SCAN_CAMERA_ID";

/**
* @see com.google.zxing.DecodeHintType#CHARACTER_SET
*/
public static final String CHARACTER_SET = "CHARACTER_SET";
// public static final String CHARACTER_SET = "CHARACTER_SET";

/**
* Optional parameters to specify the width and height of the scanning rectangle in pixels.
* The app will try to honor these, but will clamp them to the size of the preview frame.
* You should specify both or neither, and pass the size as an int.
*/
public static final String WIDTH = "SCAN_WIDTH";
public static final String HEIGHT = "SCAN_HEIGHT";
// public static final String WIDTH = "SCAN_WIDTH";
// public static final String HEIGHT = "SCAN_HEIGHT";

/**
* Desired duration in milliseconds for which to pause after a successful scan before
* returning to the calling intent. Specified as a long, not an integer!
* For example: 1000L, not 1000.
*/
public static final String RESULT_DISPLAY_DURATION_MS = "RESULT_DISPLAY_DURATION_MS";
// public static final String RESULT_DISPLAY_DURATION_MS = "RESULT_DISPLAY_DURATION_MS";

/**
* Prompt to show on-screen when scanning by intent. Specified as a {@link String}.
*/
public static final String PROMPT_MESSAGE = "PROMPT_MESSAGE";
// public static final String PROMPT_MESSAGE = "PROMPT_MESSAGE";

/**
* If a barcode is found, Barcodes returns {@link android.app.Activity#RESULT_OK} to
Expand All @@ -140,33 +140,33 @@ public static final class Scan {
* to {@link com.google.zxing.BarcodeFormat#UPC_A} and {@link com.google.zxing.BarcodeFormat#EAN_13}
* formats.
*/
public static final String RESULT_UPC_EAN_EXTENSION = "SCAN_RESULT_UPC_EAN_EXTENSION";
// public static final String RESULT_UPC_EAN_EXTENSION = "SCAN_RESULT_UPC_EAN_EXTENSION";

/**
* Call {@link android.content.Intent#getByteArrayExtra(String)} with {@link #RESULT_BYTES}
* to get a {@code byte[]} of raw bytes in the barcode, if available.
*/
public static final String RESULT_BYTES = "SCAN_RESULT_BYTES";
// public static final String RESULT_BYTES = "SCAN_RESULT_BYTES";

/**
* Key for the value of {@link com.google.zxing.ResultMetadataType#ORIENTATION}, if available.
* Call {@link android.content.Intent#getIntArrayExtra(String)} with {@link #RESULT_ORIENTATION}.
*/
public static final String RESULT_ORIENTATION = "SCAN_RESULT_ORIENTATION";
// public static final String RESULT_ORIENTATION = "SCAN_RESULT_ORIENTATION";

/**
* Key for the value of {@link com.google.zxing.ResultMetadataType#ERROR_CORRECTION_LEVEL}, if available.
* Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_ERROR_CORRECTION_LEVEL}.
*/
public static final String RESULT_ERROR_CORRECTION_LEVEL = "SCAN_RESULT_ERROR_CORRECTION_LEVEL";
// public static final String RESULT_ERROR_CORRECTION_LEVEL = "SCAN_RESULT_ERROR_CORRECTION_LEVEL";

/**
* Prefix for keys that map to the values of {@link com.google.zxing.ResultMetadataType#BYTE_SEGMENTS},
* if available. The actual values will be set under a series of keys formed by adding 0, 1, 2, ...
* to this prefix. So the first byte segment is under key "SCAN_RESULT_BYTE_SEGMENTS_0" for example.
* Call {@link android.content.Intent#getByteArrayExtra(String)} with these keys.
*/
public static final String RESULT_BYTE_SEGMENTS_PREFIX = "SCAN_RESULT_BYTE_SEGMENTS_";
// public static final String RESULT_BYTE_SEGMENTS_PREFIX = "SCAN_RESULT_BYTE_SEGMENTS_";

private Scan() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ final class DecodeFormatManager {

private DecodeFormatManager() {}

static Set<BarcodeFormat> parseDecodeFormats(Intent intent) {
/* static Set<BarcodeFormat> parseDecodeFormats(Intent intent) {
Iterable<String> scanFormats = null;
CharSequence scanFormatsString = intent.getStringExtra(Intents.Scan.FORMATS);
if (scanFormatsString != null) {
scanFormats = Arrays.asList(COMMA_PATTERN.split(scanFormatsString));
}
return parseDecodeFormats(scanFormats, intent.getStringExtra(Intents.Scan.MODE));
}
}*/

static Set<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
/* static Set<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
List<String> formats = inputUri.getQueryParameters(Intents.Scan.FORMATS);
if (formats != null && formats.size() == 1 && formats.get(0) != null) {
formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
}
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
}
}*/

private static Set<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats, String decodeMode) {
/* private static Set<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats, String decodeMode) {
if (scanFormats != null) {
Set<BarcodeFormat> formats = EnumSet.noneOf(BarcodeFormat.class);
try {
Expand All @@ -102,6 +102,6 @@ private static Set<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormat
return FORMATS_FOR_MODE.get(decodeMode);
}
return null;
}
}*/

}

0 comments on commit b65d95c

Please sign in to comment.