修复 app 中的 SocketTestBroadCastReceiver.java

This commit is contained in:
董宏宇
2021-08-31 17:16:47 +08:00
parent 0278543d78
commit e943575929
2 changed files with 0 additions and 106 deletions

View File

@@ -49,13 +49,6 @@
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver android:name=".SocketTestBroadCastReceiver">
<intent-filter>
<action android:name="com.socket.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>

View File

@@ -1,99 +0,0 @@
package com.mogo.launcher;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.utils.logger.Logger;
public class SocketTestBroadCastReceiver extends BroadcastReceiver {
private static final String TAG = "SocketTestBroadCastReceiver";
/**
* Adas测试控制面板广播Action
*/
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
private Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
try {
this.mContext = context;
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
Logger.d(TAG, "textPanelOpenType:" + sceneType);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
private void dispatchSceneTest(int sceneType) {
if (sceneType == 0) {
// 更改地址为衡阳
SocketTestData socketTestData = SocketTestData.getInstance();
socketTestData.setCityCode("0734");
socketTestData.setLat(26.81624);
socketTestData.setLon(112.580089);
}
if (sceneType == 1) {
// 更改地址为北京
SocketTestData socketTestData = SocketTestData.getInstance();
socketTestData.setCityCode("010");
socketTestData.setLat(40.1993457314);
socketTestData.setLon(116.7355931215);
}
}
public static class SocketTestData {
private SocketTestData(){}
private static final byte[] bytes = new byte[0];
private volatile static SocketTestData instance;
public static SocketTestData getInstance(){
if(instance == null){
synchronized (bytes){
if(instance == null){
instance = new SocketTestData();
}
}
}
return instance;
}
private String cityCode = "010";
private Double lat = 0.0;
private Double lon = 0.0;
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLon() {
return lon;
}
public void setLon(Double lon) {
this.lon = lon;
}
}
}