merge branch

This commit is contained in:
tongchenfei
2021-01-07 19:33:30 +08:00
77 changed files with 1349 additions and 495 deletions

View File

@@ -26,13 +26,13 @@ class HttpDnsNoop implements IMogoHttpDns {
@Override
public String getCachedHttpDnsIps( String host,int type ) {
return null;
return host;
}
@Override
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
if ( callback != null ) {
callback.onParsed( null );
callback.onParsed( host );
}
}

View File

@@ -8,11 +8,11 @@ import com.mogo.commons.debug.DebugConfig;
@Keep
public class WebSocketConstant {
private static final String HOST_DEV = "ws://62.234.196.121";
private static final String HOST_QA = "ws://62.234.196.121";
private static final String HOST_DEMO = "ws://62.234.196.121";
private static final String HOST_DEV = "ws://119.45.249.167";
private static final String HOST_QA = "ws://119.45.249.167";
private static final String HOST_DEMO = "ws://119.45.249.167";
@Keep
private static final String HOST_RELEASE = "ws://62.234.196.121";
private static final String HOST_RELEASE = "ws://119.45.249.167";
// private static final String PORT = ":14001/ws";
@Keep
public static final String PATH = "/ws";

View File

@@ -2,6 +2,7 @@ package com.mogo.base.websocket;
import android.content.Context;
import android.os.SystemClock;
import android.util.Log;
import androidx.annotation.Keep;
@@ -186,7 +187,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
@Override
public void handleMessage(String message) {
Logger.d(TAG, "websocket received msg = " + message);
Logger.d(TAG, "websocket received msg = %s", message);
WebSocketData webSocketData = GsonUtil.objectFromJson(message, WebSocketData.class);
int msgType = webSocketData.getMsgType();
Logger.d(TAG, "websocket received msg type = " + msgType);
@@ -198,9 +199,11 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
while (iterator.hasNext()) {
IMogoOnWebSocketMessageListener listener = iterator.next();
if (listener != null) {
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = %s", webSocketData.getData());
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
final long start = System.currentTimeMillis();
listener.onMsgReceived(receiveObj);
Logger.d("WebSocketManager-sdk-timer", "cost " + (System.currentTimeMillis() - start) + "ms");
}
}
}

View File

@@ -76,4 +76,44 @@ public class CoordinateUtils {
return var10000;
}
/**
* @param lon1
* @param lat1
* @param lon2
* @param lat2
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance( double lon1, double lat1, double lon2, double lat2 ) {
try {
double var2 = lon1;
double var4 = lat1;
double var6 = lon2;
double var8 = lat2;
var2 *= 0.01745329251994329D;
var4 *= 0.01745329251994329D;
var6 *= 0.01745329251994329D;
var8 *= 0.01745329251994329D;
double var10 = Math.sin( var2 );
double var12 = Math.sin( var4 );
double var14 = Math.cos( var2 );
double var16 = Math.cos( var4 );
double var18 = Math.sin( var6 );
double var20 = Math.sin( var8 );
double var22 = Math.cos( var6 );
double var24 = Math.cos( var8 );
double[] var28 = new double[3];
double[] var29 = new double[3];
var28[0] = var16 * var14;
var28[1] = var16 * var10;
var28[2] = var12;
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 );
} catch ( Throwable var26 ) {
var26.printStackTrace();
return 0.0F;
}
}
}

View File

@@ -20,11 +20,12 @@ public class ViewUtils {
view.destroyDrawingCache();
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas( bitmap );
view.draw( canvas );
return bitmap;
// return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas( bitmap );
// view.draw( canvas );
// return bitmap;
Bitmap bitmap = null;
return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
}
public static void processChildView(View view) {