[sonar] fix
This commit is contained in:
@@ -170,7 +170,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker
|
||||
if(markerBytes.isEmpty()){
|
||||
return
|
||||
}
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerBytes)
|
||||
//缓存图片
|
||||
if (!containMarkerIcon(markerIconName)) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AMapUtils {
|
||||
var29[0] = var24 * var22;
|
||||
var29[1] = var24 * var18;
|
||||
var29[2] = var20;
|
||||
return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||
return (float) (Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||
} catch (Throwable var26) {
|
||||
var26.printStackTrace();
|
||||
return 0.0F;
|
||||
@@ -83,8 +83,6 @@ public class AMapUtils {
|
||||
|
||||
/**
|
||||
* 是否有GPS
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean hasGPSDevice(Context context) {
|
||||
final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
@@ -92,10 +90,7 @@ public class AMapUtils {
|
||||
return false;
|
||||
}
|
||||
final List<String> providers = mgr.getAllProviders();
|
||||
if (providers == null) {
|
||||
return false;
|
||||
}
|
||||
return providers.contains(LocationManager.GPS_PROVIDER);
|
||||
return providers != null && providers.contains(LocationManager.GPS_PROVIDER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,21 +64,21 @@ object MapDataApi {
|
||||
* @return
|
||||
*/
|
||||
fun isServiceRunning(context: Context, ServiceName: String): Boolean {
|
||||
if (true) {
|
||||
return false
|
||||
}
|
||||
if (TextUtils.isEmpty(ServiceName)) {
|
||||
return false
|
||||
}
|
||||
val myManager = context
|
||||
.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
val runningServices = myManager
|
||||
.getRunningServices(50) as ArrayList<ActivityManager.RunningServiceInfo>
|
||||
for (info in runningServices) {
|
||||
if (info.service.className == ServiceName) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// if (true) {
|
||||
// return false
|
||||
// }
|
||||
// if (TextUtils.isEmpty(ServiceName)) {
|
||||
// return false
|
||||
// }
|
||||
// val myManager = context
|
||||
// .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
// val runningServices = myManager
|
||||
// .getRunningServices(50) as ArrayList<ActivityManager.RunningServiceInfo>
|
||||
// for (info in runningServices) {
|
||||
// if (info.service.className == ServiceName) {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -336,10 +336,6 @@ public class BlurView extends View {
|
||||
|
||||
/**
|
||||
* Custom draw the blurred bitmap and color to define your own shape
|
||||
*
|
||||
* @param canvas
|
||||
* @param blurredBitmap
|
||||
* @param overlayColor
|
||||
*/
|
||||
protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) {
|
||||
if (blurredBitmap != null) {
|
||||
@@ -371,16 +367,16 @@ public class BlurView extends View {
|
||||
private static class StopException extends RuntimeException {
|
||||
}
|
||||
|
||||
private static StopException STOP_EXCEPTION = new StopException();
|
||||
private static final StopException STOP_EXCEPTION = new StopException();
|
||||
|
||||
static {
|
||||
// static {
|
||||
// try {
|
||||
// BlurView.class.getClassLoader().loadClass("androidx.renderscript.RenderScript");
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// throw new RuntimeException("\n错误!\nRenderScript支持库未启用,要启用模糊效果,请在您的app的Gradle配置文件中添加以下语句:" +
|
||||
// "\nandroid { \n...\n defaultConfig { \n ...\n renderscriptTargetApi 19 \n renderscriptSupportModeEnabled true \n }\n}");
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
// android:debuggable="true" in AndroidManifest.xml (auto set by build tool)
|
||||
static Boolean DEBUG = null;
|
||||
@@ -389,6 +385,6 @@ public class BlurView extends View {
|
||||
if (DEBUG == null && ctx != null) {
|
||||
DEBUG = (ctx.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
|
||||
}
|
||||
return DEBUG.equals(Boolean.TRUE);
|
||||
return DEBUG != null && DEBUG.equals(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
@@ -800,7 +800,7 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon
|
||||
mMapController?.getContext()?.let {context->
|
||||
val markerView = BitmapDescriptorFactory.from3DResource(context, icon)
|
||||
markerView?.let {
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val anchor3dName = MD5Utils.getMD5String(markerView)
|
||||
if (mMarkerCall?.containMarkerIcon(anchor3dName) == false) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
@@ -830,7 +830,7 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon
|
||||
if (icons != null) {
|
||||
for (icon in icons) {
|
||||
val markerView = icon.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerView)
|
||||
if (mMarkerCall?.containMarkerIcon(markerIconName) == false) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
|
||||
@@ -255,7 +255,7 @@ class MarkerController(mapController: IMapController) : IMarkerController {
|
||||
}
|
||||
val markerView = OperationUtils.fromRawResource(modelRes,mMapController.getContext())
|
||||
if(markerView != null){
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val modelKey = MD5Utils.getMD5String(markerView)
|
||||
|
||||
mMarkerCall.addMarkerIconCache(modelRes,modelKey)
|
||||
|
||||
@@ -200,7 +200,7 @@ class MarkerOptions {
|
||||
if(markerInfoView.isEmpty()){
|
||||
return this
|
||||
}
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerInfoMd5 = MD5Utils.getMD5String(markerInfoView)
|
||||
if(!markerInfoUseCache){
|
||||
if(!TextUtils.isEmpty(markerInfoName) && !TextUtils.equals(markerInfoMd5,markerInfoName)){
|
||||
@@ -226,7 +226,7 @@ class MarkerOptions {
|
||||
fun markerIcon(bitmap: Bitmap,mapController: IMapController?): MarkerOptions {
|
||||
val markerBitmap = BitmapDescriptorFactory.fromBitmap(bitmap)
|
||||
val markerView = markerBitmap.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerView)
|
||||
this.markerIconName = markerIconName
|
||||
this.vrIcon = false
|
||||
@@ -279,7 +279,7 @@ class MarkerOptions {
|
||||
|
||||
fun markerIcon(markerBitmap: BitmapDescriptor,mapController: IMapController?): MarkerOptions {
|
||||
val markerView = markerBitmap.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerView)
|
||||
this.markerIconName = markerIconName
|
||||
this.vrIcon = false
|
||||
@@ -306,7 +306,7 @@ class MarkerOptions {
|
||||
mapController?.getContext()?.let {
|
||||
val markerView = BitmapDescriptorFactory.from3DResource(it, icon)
|
||||
markerView?.let {
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val anchor3dName = MD5Utils.getMD5String(markerView)
|
||||
this.icons.add(anchor3dName)
|
||||
if (mapController.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) {
|
||||
@@ -332,7 +332,7 @@ class MarkerOptions {
|
||||
}else {
|
||||
for (icon in icons as ArrayList<BitmapDescriptor> ) {
|
||||
val markerView = icon.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerView)
|
||||
this.icons.add(markerIconName)
|
||||
if (mapController?.getMarkerCall()?.containMarkerIcon(markerIconName) == false) {
|
||||
@@ -372,7 +372,7 @@ class MarkerOptions {
|
||||
mapController?.getContext()?.let {
|
||||
val markerBitmap = BitmapDescriptorFactory.fromResource(it, resId)
|
||||
val markerView = markerBitmap.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val markerIconName = MD5Utils.getMD5String(markerView)
|
||||
this.markerIconName = markerIconName
|
||||
this.vrIcon = false
|
||||
@@ -402,7 +402,7 @@ class MarkerOptions {
|
||||
}
|
||||
|
||||
if(markerView != null) {
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val anchor3dName = MD5Utils.getMD5String(markerView)
|
||||
|
||||
if (mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) {
|
||||
@@ -451,7 +451,7 @@ class MarkerOptions {
|
||||
}
|
||||
val markerView = OperationUtils.fromRawResource(resId,mapController?.getContext())
|
||||
if(markerView != null) {
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
val anchor3dName = MD5Utils.getMD5String(markerView)
|
||||
|
||||
if (mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class MultiPointOverlayOptions {
|
||||
mapController?.getContext()?.let {
|
||||
val descriptor = fromResource(it, icon)
|
||||
val markerBytes = descriptor.getBytes()
|
||||
MD5Utils.getInstanse()
|
||||
MD5Utils.getInstance()
|
||||
this.markerIconName = MD5Utils.getMD5String(markerBytes)
|
||||
if (mapController.getMarkerCall()?.containMarkerIcon(markerIconName) == false) {
|
||||
if(DEBUG){
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class MD5Utils {
|
||||
protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
protected static char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
protected static MessageDigest messagedigest = null;
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@ public class MD5Utils {
|
||||
* *
|
||||
*
|
||||
*/
|
||||
public static MessageDigest getInstanse() {
|
||||
public static MessageDigest getInstance() {
|
||||
if (messagedigest == null) {
|
||||
|
||||
try {
|
||||
@@ -31,11 +31,11 @@ public class MD5Utils {
|
||||
messagedigest.update(bytes);
|
||||
return bufferToHex(messagedigest.digest());
|
||||
}
|
||||
public static String bufferToHex(byte bytes[]) {
|
||||
public static String bufferToHex(byte[] bytes) {
|
||||
return bufferToHex(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
private static String bufferToHex(byte bytes[], int m, int n) {
|
||||
private static String bufferToHex(byte[] bytes, int m, int n) {
|
||||
StringBuffer stringbuffer = new StringBuffer(2 * n);
|
||||
int k = m + n;
|
||||
for (int l = m; l < k; l++) {
|
||||
@@ -51,9 +51,12 @@ public class MD5Utils {
|
||||
public static boolean isSameImage(byte[] bytes, Context context){
|
||||
SharedPrefsMgr mgr = SharedPrefsMgr.getInstance(context);
|
||||
String imageStr = mgr.getString(MARKERIMAGE);
|
||||
MessageDigest md = MD5Utils.getInstanse();
|
||||
MessageDigest md = MD5Utils.getInstance();
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(imageStr);
|
||||
if(md == null){
|
||||
return false;
|
||||
}
|
||||
md.update(bytes);
|
||||
String Md5Str = MD5Utils.bufferToHex(md.digest());
|
||||
if (imageStr.contains(Md5Str)){
|
||||
|
||||
Reference in New Issue
Block a user