Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map
This commit is contained in:
@@ -27,7 +27,7 @@ public class WebSocketHandlerThread extends HandlerThread {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_SEND) {
|
||||
Logger.d(tag, "WebSocketHandlerThread handleMessage = " + msg.obj.toString());
|
||||
SocketClient.getInstance().getClientProxy().sendMessage(msg.obj.toString());
|
||||
WebSocketInstanceHolder.getClientProxy().sendMessage(msg.obj.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.base.websocket;
|
||||
|
||||
import com.mogo.websocket.SocketClient;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/24
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class WebSocketInstanceHolder {
|
||||
|
||||
private volatile static SocketClient sClient;
|
||||
|
||||
public static SocketClient getClientProxy() {
|
||||
if ( sClient == null ) {
|
||||
synchronized ( WebSocketInstanceHolder.class ) {
|
||||
if ( sClient == null ) {
|
||||
sClient = new SocketClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sClient;
|
||||
}
|
||||
}
|
||||
@@ -82,8 +82,8 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
@Override
|
||||
public void ttlIp(String url) {
|
||||
Logger.d(TAG,"ttlIp url : " + url);
|
||||
SocketClient.getInstance().getClientProxy().stop();
|
||||
SocketClient.getInstance().getClientProxy().disConnect();
|
||||
WebSocketInstanceHolder.getClientProxy().stop();
|
||||
WebSocketInstanceHolder.getClientProxy().disConnect();
|
||||
Logger.d(TAG,"ready to re initWebSocket : " + url);
|
||||
initWebSocket(url);
|
||||
}
|
||||
@@ -91,10 +91,10 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
}
|
||||
|
||||
private void initWebSocket(String ip){
|
||||
SocketClient.getInstance().getClientProxy().initSocketServer(ip);
|
||||
SocketClient.getInstance().getClientProxy().getMessageSettings(this);
|
||||
SocketClient.getInstance().getClientProxy().addISocketMsgCallBack(this);
|
||||
SocketClient.getInstance().getClientProxy().startConnect();
|
||||
WebSocketInstanceHolder.getClientProxy().initSocketServer(ip);
|
||||
WebSocketInstanceHolder.getClientProxy().getMessageSettings(this);
|
||||
WebSocketInstanceHolder.getClientProxy().addISocketMsgCallBack(this);
|
||||
WebSocketInstanceHolder.getClientProxy().startConnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,8 +224,8 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
@Override
|
||||
public void onConnectClose() {
|
||||
Logger.d(TAG, "websocket ready to reconnect");
|
||||
SocketClient.getInstance().getClientProxy().stop();
|
||||
SocketClient.getInstance().getClientProxy().reConnect();
|
||||
WebSocketInstanceHolder.getClientProxy().stop();
|
||||
WebSocketInstanceHolder.getClientProxy().reConnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.commons.layoutinflater;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/23
|
||||
*
|
||||
* 系统实现的布局加载
|
||||
*/
|
||||
class OriginalLayoutInflater {
|
||||
|
||||
private static LayoutInflater sLayoutInflater;
|
||||
|
||||
public static void init( Context context ) {
|
||||
sLayoutInflater = LayoutInflater.from( context ).cloneInContext( context );
|
||||
}
|
||||
|
||||
public static View inflate( @LayoutRes int layoutId, ViewGroup container, boolean attachToRoot ) {
|
||||
return sLayoutInflater.inflate( layoutId, container, attachToRoot );
|
||||
}
|
||||
|
||||
public static View inflate( @LayoutRes int layoutId, ViewGroup container ) {
|
||||
return sLayoutInflater.inflate( layoutId, container, container != null );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user