make marker move
This commit is contained in:
parent
3da44593dd
commit
2334dc2e3c
@ -24,7 +24,6 @@ public abstract class AbstractLiveActivity extends AppCompatActivity {
|
||||
public abstract void vehicleStatusReceived(long imei, int opCode, int status); // --> UpdateOptions
|
||||
public abstract void emergencyAlarmReceived(int position, double lat, double lng); // --> UpdateEmergencyAlarm
|
||||
|
||||
|
||||
/** Misc */
|
||||
public AbstractSDParentActivity getParentTab() {
|
||||
return parentTab;
|
||||
|
@ -471,7 +471,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
|
||||
for (int i = 0; i < displayedVehicles.size(); i++) {
|
||||
if (displayedVehicles.get(i)) {
|
||||
SuperVehicle tmpSuper = Objects.requireNonNull(tableHashOverlay.get((int) liveVehicle.get(i).driver_id)).get(0);
|
||||
SuperVehicle tmpSuper = getParentTab().SuperVehHash.get(Long.valueOf(liveVehicle.get(i).imei));
|
||||
|
||||
if (tmpSuper != null) {
|
||||
LatLng newLocation = new LatLng(tmpSuper.lat, tmpSuper.lng);
|
||||
@ -481,7 +481,6 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
markerOptions.icon(markerIcon);
|
||||
|
||||
Marker marker = this.googleMap.addMarker(markerOptions);
|
||||
this.googleMap.moveCamera(CameraUpdateFactory.newLatLng(newLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -665,7 +664,6 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
pollReceived(position,lat,lng);
|
||||
}
|
||||
|
||||
|
||||
public void updatePosition(int pos) {
|
||||
contextMenuPosition = pos;
|
||||
}
|
||||
|
@ -1237,35 +1237,24 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
GPSmsg GPSPos= new GPSmsg(msg);
|
||||
//SM.Debug("Got new GPS pos data:" + GPSPos.data);
|
||||
|
||||
if(SuperVehHash.get(GPSPos.gpsValue.imei) != null)
|
||||
{
|
||||
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
||||
|
||||
if(SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate)
|
||||
{
|
||||
|
||||
//list for live
|
||||
if(AppParams.crtTab == AppParams.Tabs.live)
|
||||
{
|
||||
//SM.Debug("+++++ duda +++++");
|
||||
SM.Debug("currentActivity instanceof LiveActivity");
|
||||
try
|
||||
{
|
||||
if(liveActivity != null)
|
||||
liveActivity.refreshMap();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SM.Debug("Error load hash:"+ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SuperVehHash.get(GPSPos.gpsValue.imei) != null) {
|
||||
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
||||
// if (SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate) {
|
||||
if (AppParams.crtTab == AppParams.Tabs.live) {
|
||||
SM.Debug("currentActivity instanceof LiveActivity");
|
||||
try {
|
||||
if (liveActivity != null)
|
||||
liveActivity.refreshMap();
|
||||
} catch (Exception ex) {
|
||||
SM.Debug("Error load hash: "+ ex);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPollReceived(TCPEvent event)
|
||||
{
|
||||
public void onPollReceived(TCPEvent event) {
|
||||
SM.Debug("Got POLL GPS message");
|
||||
TCPmsg msg= event.msg();
|
||||
GPSmsg GPSPos= new GPSmsg(msg);
|
||||
@ -1273,13 +1262,11 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
mess = "LAT:"+Double.toString(GPSPos.gpsValue.lat)+" LNG:"+Double.toString(GPSPos.gpsValue.lng);
|
||||
SM.Debug("Got new Poll pos data:" + GPSPos.data);
|
||||
|
||||
if(SuperVehHash.get(GPSPos.gpsValue.imei) != null)
|
||||
{
|
||||
if (SuperVehHash.get(GPSPos.gpsValue.imei) != null) {
|
||||
((SuperVehicle)SuperVehHash.get(GPSPos.gpsValue.imei)).SetNewPosition(GPSPos.gpsValue.lat, GPSPos.gpsValue.lng, GPSPos.gpsValue.timeGMT, GPSPos.gpsValue.speed);
|
||||
//if is not check i need to force check to put on the map
|
||||
Boolean forceChecked =false;
|
||||
if (!SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate)
|
||||
{
|
||||
if (!SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate) {
|
||||
SuperVehHash.get(GPSPos.gpsValue.imei).needUpdate =true;
|
||||
forceChecked =true;
|
||||
}
|
||||
@ -1525,15 +1512,12 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
|
||||
@Override
|
||||
public void onLastPositionsReceived(TCPEvent event) {
|
||||
TCPmsg msg= event.msg();
|
||||
SM.Debug("Got lastpos");
|
||||
//SM.Debug("Got lastpos :" + msg.allData);
|
||||
|
||||
SM.Debug("Got last pos");
|
||||
|
||||
LastPosmsg lastPos= new LastPosmsg(msg);
|
||||
//SM.Debug("Got LastPost msg.data:" + msg.data);
|
||||
for(LastPos posMsg: lastPos.PosList)
|
||||
{
|
||||
if(SuperVehHash.get(posMsg.imei) != null)
|
||||
((SuperVehicle)SuperVehHash.get(posMsg.imei)).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
||||
for (LastPos posMsg: lastPos.PosList) {
|
||||
if (SuperVehHash.get(posMsg.imei) != null)
|
||||
((SuperVehicle) SuperVehHash.get(posMsg.imei)).SetDataFromLastPos(posMsg.lat, posMsg.lng, posMsg.timeGMT, posMsg.speed, posMsg.Address, posMsg.isON);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user