优化细节
This commit is contained in:
@@ -17,8 +17,6 @@ package com.king.zxing;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
@@ -36,12 +34,6 @@ import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -641,8 +641,9 @@ public final class CodeUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight + textSize + offset * 2, Bitmap.Config.ARGB_8888);
|
||||
Bitmap bitmap;
|
||||
try {
|
||||
bitmap = Bitmap.createBitmap(srcWidth, srcHeight + textSize + offset * 2, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
canvas.drawBitmap(src, 0, 0, null);
|
||||
TextPaint paint = new TextPaint();
|
||||
|
||||
@@ -26,8 +26,6 @@ public class LogUtils {
|
||||
|
||||
public static final String TAG = "ZXingLite";
|
||||
|
||||
public static final String COLON = ":";
|
||||
|
||||
public static final String VERTICAL = "|";
|
||||
|
||||
/** 是否显示Log日志 */
|
||||
@@ -71,7 +69,7 @@ public class LogUtils {
|
||||
*/
|
||||
public static final int ASSERT = 7;
|
||||
|
||||
public static final String TAG_FORMAT = "%s.%s(L:%d)";
|
||||
public static final String TAG_FORMAT = "%s.%s(%s:%d)";
|
||||
|
||||
private LogUtils(){
|
||||
throw new AssertionError();
|
||||
@@ -99,13 +97,13 @@ public class LogUtils {
|
||||
|
||||
/**
|
||||
* 根据堆栈生成TAG
|
||||
* @return TAG|className.methodName(L:lineNumber)
|
||||
* @return TAG|className.methodName(fileName:lineNumber)
|
||||
*/
|
||||
private static String generateTag(StackTraceElement caller) {
|
||||
String tag = TAG_FORMAT;
|
||||
String callerClazzName = caller.getClassName();
|
||||
callerClazzName = callerClazzName.substring(callerClazzName.lastIndexOf(".") + 1);
|
||||
tag = String.format(tag,new Object[] { callerClazzName, caller.getMethodName(),Integer.valueOf(caller.getLineNumber()) });
|
||||
tag = String.format(tag,new Object[] { callerClazzName, caller.getMethodName(),caller.getFileName(),Integer.valueOf(caller.getLineNumber()) });
|
||||
return new StringBuilder().append(TAG).append(VERTICAL).append(tag).toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user