Compare commits

...

11 Commits

17 changed files with 1563 additions and 1355 deletions

View File

@ -97,6 +97,10 @@ public class AlertGridViewAdapter extends BaseAdapter
switch(acknowledged.get(position) ? 1 : 0) switch(acknowledged.get(position) ? 1 : 0)
{ {
case 1: case 1:
ViewGroup.LayoutParams params = convertView.getLayoutParams();
if (params != null) {
params.height = 0;
}
view.imageViewAlert.setImageResource(R.drawable.alert_off); view.imageViewAlert.setImageResource(R.drawable.alert_off);
//view.layoutAlarm.setBackgroundColor(0xffffffff); //view.layoutAlarm.setBackgroundColor(0xffffffff);
break; break;

View File

@ -36,6 +36,8 @@ public class RadioMSG extends TCPmsg {
public ArrayList<Contact> contacts; public ArrayList<Contact> contacts;
public RadioMSG(TCPmsg tcp) { public RadioMSG(TCPmsg tcp) {
super(tcp); super(tcp);
String date4parsing = super.data; String date4parsing = super.data;
@ -47,148 +49,34 @@ public class RadioMSG extends TCPmsg {
switch(rOpcode) switch(rOpcode)
{ {
case 200: case 200 /* gw list */:
{ RadioGWList = getRadioGWList();
RadioGWList = new ArrayList<RadioGW>();
String[] tempArr = payload.split(";");
int count = 0;
for(int i =0; i<tempArr.length;i++)
{
String[] oneRadio = tempArr[i].split("&");
if(oneRadio.length<5)
continue;
RadioGW rgw = new RadioGW();
rgw.ID = Integer.parseInt(oneRadio[0]);
rgw.GW_ID = Integer.parseInt(oneRadio[1]);
rgw.IMEI = oneRadio[2];
rgw.IP = oneRadio[3];
String zonelistStr =oneRadio[4];
String[] zoneArr = zonelistStr.split("@");
for(int j =0; j<zoneArr.length;j++)
{
Zone zon = new Zone();
String[] oneZoneArr = zoneArr[j].split(":");
//TODO check what this values are from SD
zon.dbID = Integer.parseInt(oneZoneArr[0]);
zon.id = Integer.parseInt(oneZoneArr[1]);
zon.ZoneName = oneZoneArr[2];
String channelListStr = oneZoneArr[3];
String[] channelArr = channelListStr.split(",");
for(int k =0; k < channelArr.length; k++)
{
Channel chn = new Channel();
String[] oneChnArr = channelArr[k].split("/");
chn.dbID = Integer.parseInt(oneChnArr[0]);
chn.id = Integer.parseInt(oneChnArr[1]);
chn.chName = oneChnArr[2];
//add channel to zone
zon.channelList.add(chn);
}
//add zone to radio GW
rgw.zoneList.add(zon);
}
RadioGWList.add(rgw);
count++;
}
count +=this.RadioGWList.size();
SM.Debug("radio","RadioGWList size:" +this.RadioGWList.size() + " total:" +count);
break; break;
}
case OperationCodes.CHANNEL_BRDCST: case OperationCodes.CHANNEL_BRDCST:
{
try {
zac = new Zone_and_channel();
String[] tempArr = payload.split("&");
String[] gwID_and_rgwID = tempArr[0].split("/"); zac = parse_CHANNEL_BRDCST(payload);
zac.gwID = Integer.parseInt(gwID_and_rgwID[0]);
zac.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
String[] zoneNr_and_channelNr = tempArr[1].split("/");
zac.zoneNr = Integer.parseInt(zoneNr_and_channelNr[0]);
zac.channelNr = Integer.parseInt(zoneNr_and_channelNr[1]);
} catch (Exception e) {
SM.Debug("Cmd 204 error:"+e.toString());
}
break; break;
}
case OperationCodes.RADIO_STATUS_REP: case OperationCodes.RADIO_STATUS_REP:
{
try {
rStatus = new RadioStatus();
String[] tempArr = payload.split("&");
if(tempArr.length == 4 || tempArr.length == 5) { rStatus = parse_RADIO_STATUS_REP(payload);
rStatus.status = 1;
rStatus.incCall.callStatus = Integer.parseInt(tempArr[0]);
rStatus.incCall.callType = Integer.parseInt(tempArr[1]);
rStatus.incCall.Imei = Integer.parseInt(tempArr[2]);
rStatus.incCall.callerID = Integer.parseInt(tempArr[2]);
rStatus.incCall.groupId = Integer.parseInt(tempArr[3]);
rStatus.incCall.callDestID = Integer.parseInt(tempArr[3]);
if(tempArr.length == 5)
rStatus.incCall.userID = Integer.parseInt(tempArr[4]);
}
else {
String[] gwID_and_rgwID = tempArr[0].split("/");
rStatus.gwID = Integer.parseInt(gwID_and_rgwID[0]);
rStatus.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
rStatus.status = Integer.parseInt(tempArr[1]);
}
} catch (Exception e) {
SM.Debug("Cmd 199 error:"+e.toString());
}
break; break;
}
case 250:
{
try {
suStatus = new SUstatus();
String[] tempArr = payload.split("&");
suStatus.imei = Integer.parseInt(tempArr[0]); case OperationCodes.UNIT_STATUS_UPDATE :
suStatus = parse_UNIT_STATUS_UPDATE(payload);
suStatus.status = Integer.parseInt(tempArr[1]);
} catch (Exception e) {
SM.Debug("Cmd 250 error:"+e.toString());
}
break; break;
}
case 125: case 125:
case OperationCodes.CALL_STATUS_BRDCST: case OperationCodes.CALL_STATUS_BRDCST:
{
try {
incCall = new IncCall();
incCall.opCode = rOpcode;
String[] tempArr = payload.split("&");
String[] gwID_and_rgwID_imei = tempArr[0].split("/"); incCall = parse_CALL_STATUS_BRDCST(payload);
incCall.gwID = Integer.parseInt(gwID_and_rgwID_imei[0]);
incCall.rgwID = Integer.parseInt(gwID_and_rgwID_imei[1]);
incCall.Imei = Long.parseLong(gwID_and_rgwID_imei[2]);
incCall.callStatus = Integer.parseInt(tempArr[1]);
incCall.callType = Integer.parseInt(tempArr[2]);
incCall.groupId = Integer.parseInt(tempArr[3]);
incCall.userID = Integer.parseInt(tempArr[4]);
} catch (Exception e) {
SM.Debug("Cmd 125, 126 error:"+e.toString());
}
break; break;
}
case 121: case 121:
case 122: case 122:
@ -265,21 +153,9 @@ public class RadioMSG extends TCPmsg {
} }
case OperationCodes.CALL_TYPE_REP: case OperationCodes.CALL_TYPE_REP:
{ incCall = parse_CALL_TYPE_REP(payload);
try {
incCall = new IncCall();
incCall.opCode = rOpcode;
String[] tempArr = payload.split("/");
incCall.callType = Integer.parseInt(tempArr[0]);
incCall.callStatus = Integer.parseInt(tempArr[1]);
SM.Debug("GOT CHANGE CALL TYPE MSG", incCall.opCode + " # " + incCall.callType + " # " + incCall.callStatus);
} catch (Exception e) {
SM.Debug("Cmd 115,116,117 error:"+e.toString());
}
break; break;
}
case 172: case 172:
{ {
@ -302,20 +178,10 @@ public class RadioMSG extends TCPmsg {
} }
case OperationCodes.EMERGENCY_REP: case OperationCodes.EMERGENCY_REP:
{
try {
emerg = new Emerg();
String[] tempArr = payload.split("/");
emerg.function = Integer.parseInt(tempArr[0]); emerg = parse_EMERGENCY_REP(payload);
emerg.status = Integer.parseInt(tempArr[1]);
// emerg.userID = Integer.parseInt(tempArr[2]);
} catch (Exception e) {
SM.Debug("Cmd 230 error:"+e.toString());
}
break; break;
}
/* /*
case OperationCodes.CONTACTS_REP: case OperationCodes.CONTACTS_REP:
@ -341,4 +207,254 @@ public class RadioMSG extends TCPmsg {
} }
private RadioGW parseRadioGW(String buffer)
{
RadioGW rgw = new RadioGW();
String[] radioFields = buffer.split("&");
if( radioFields.length > 3 ) {
rgw.ID = Integer.parseInt(radioFields[0].trim());
rgw.GW_ID = Integer.parseInt(radioFields[1].trim());
rgw.IMEI = radioFields[2];
rgw.IP = radioFields[3];
}
return rgw;
}
private Zone parseZone(String buffer)
{
Zone zone = new Zone();
String[] zoneFields = buffer.split(":");
if( zoneFields.length > 2 ) {
zone.dbID = Integer.parseInt(zoneFields[0].trim());
zone.id = Integer.parseInt(zoneFields[1].trim());
zone.ZoneName = zoneFields[2];
}
return zone;
}
private Channel parseChannel(String buffer)
{
Channel channel = new Channel();
String[] channelFields = buffer.split("/");
if( channelFields.length > 2 ) {
channel.dbID = Integer.parseInt(channelFields[0].trim());
channel.id = Integer.parseInt(channelFields[1].trim());
channel.chName = channelFields[2].trim();
}
return channel;
}
private String[] getChannelList(String zone)
{
String[] zoneArr = zone.split(":");
if ( zoneArr.length > 3)
return zoneArr[3].split(",");
return null;
}
private String[] getZoneList(String gw)
{
String[] zoneArr = gw.split("&");
if ( zoneArr.length > 4)
return zoneArr[4].split("@");
return null;
}
private ArrayList<RadioGW> getRadioGWList()
{
ArrayList<RadioGW> radioGWList = new ArrayList<RadioGW>();
String[] radioGWArr = payload.split(";");
for(int i=0; i < radioGWArr.length; i++)
{
RadioGW rgw = parseRadioGW(radioGWArr[i]);
String[] zoneArr = getZoneList(radioGWArr[i]);
if( zoneArr == null)
continue;
for(int j=0; j < zoneArr.length; j++)
{
Zone zone = parseZone(zoneArr[j]);
String[] channelArr = getChannelList(zoneArr[j]);
if( channelArr == null)
continue;
for(int k =0; k < channelArr.length; k++)
{
Channel channel = parseChannel(channelArr[k]);
//add channel to zone
zone.channelList.add(channel);
}
//add zone to radio GW
rgw.zoneList.add(zone);
}
radioGWList.add(rgw);
}
return radioGWList;
}
private Zone_and_channel parse_CHANNEL_BRDCST(String payload) {
Zone_and_channel zacObj = new Zone_and_channel();
try {
String[] tempArr = payload.split("&");
String[] gwID_and_rgwID = tempArr[0].split("/");
zacObj.gwID = Integer.parseInt(gwID_and_rgwID[0].trim());
zacObj.rgwID = Integer.parseInt(gwID_and_rgwID[1].trim());
String[] zoneNr_and_channelNr = tempArr[1].split("/");
zacObj.zoneNr = Integer.parseInt(zoneNr_and_channelNr[0].trim());
zacObj.channelNr = Integer.parseInt(zoneNr_and_channelNr[1].trim());
} catch (Exception e) {
SM.Debug("Cmd 204 error:"+e.toString());
}
return zacObj;
}
private IncCall parse_CALL_STATUS_BRDCST(String payload)
{
IncCall incCallObj = new IncCall();
try {
incCallObj.opCode = rOpcode;
String[] tempArr = payload.split("&");
String[] gwID_and_rgwID_imei = tempArr[0].split("/");
incCallObj.gwID = Integer.parseInt(gwID_and_rgwID_imei[0]);
incCallObj.rgwID = Integer.parseInt(gwID_and_rgwID_imei[1]);
incCallObj.Imei = Long.parseLong(gwID_and_rgwID_imei[2]);
incCallObj.callStatus = Integer.parseInt(tempArr[1]);
incCallObj.callType = Integer.parseInt(tempArr[2]);
incCallObj.groupId = Integer.parseInt(tempArr[3]);
if (tempArr.length > 4 )
incCallObj.userID = Integer.parseInt(tempArr[4]);
} catch (Exception e) {
SM.Debug("Cmd 125, 126 error:"+e.toString());
}
return incCallObj;
}
private RadioStatus parse_RADIO_STATUS_REP(String payload)
{
RadioStatus radioStatus = new RadioStatus();
try
{
String[] tempArr = payload.split("&");
if(tempArr.length == 4 || tempArr.length == 5) {
radioStatus.status = 1;
radioStatus.incCall.callStatus = Integer.parseInt(tempArr[0]);
radioStatus.incCall.callType = Integer.parseInt(tempArr[1]);
radioStatus.incCall.Imei = Integer.parseInt(tempArr[2]);
radioStatus.incCall.callerID = Integer.parseInt(tempArr[2]);
radioStatus.incCall.groupId = Integer.parseInt(tempArr[3]);
radioStatus.incCall.callDestID = Integer.parseInt(tempArr[3]);
if(tempArr.length == 5)
radioStatus.incCall.userID = Integer.parseInt(tempArr[4]);
}
else {
String[] gwID_and_rgwID = tempArr[0].split("/");
radioStatus.gwID = Integer.parseInt(gwID_and_rgwID[0]);
radioStatus.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
radioStatus.status = Integer.parseInt(tempArr[1]);
}
}
catch (Exception e) {
SM.Debug("Cmd 199 error:"+e.toString());
}
return radioStatus;
}
private Emerg parse_EMERGENCY_REP(String payload)
{
Emerg emergObj = new Emerg();
try {
String[] tempArr = payload.split("/");
emergObj.function = Integer.parseInt(tempArr[0]);
emergObj.status = Integer.parseInt(tempArr[1]);
// emerg.userID = Integer.parseInt(tempArr[2]);
} catch (Exception e) {
SM.Debug("Cmd 230 error:"+e.toString());
}
return emergObj;
}
private SUstatus parse_UNIT_STATUS_UPDATE(String payload)
{
SUstatus suStatusObj = new SUstatus();
try {
String[] tempArr = payload.split("&");
suStatusObj.imei = Integer.parseInt(tempArr[0]);
suStatusObj.status = Integer.parseInt(tempArr[1]);
} catch (Exception e) {
SM.Debug("Cmd 250 error:"+e.toString());
}
return suStatusObj;
}
private IncCall parse_CALL_TYPE_REP(String payload)
{
IncCall incCallObj = new IncCall();
try {
incCallObj.opCode = rOpcode;
String[] tempArr = payload.split("/");
incCallObj.callType = Integer.parseInt(tempArr[0]);
incCallObj.callStatus = Integer.parseInt(tempArr[1]);
SM.Debug("GOT CHANGE CALL TYPE MSG", incCallObj.opCode + " # " + incCallObj.callType + " # " + incCallObj.callStatus);
} catch (Exception e) {
SM.Debug("Cmd 115,116,117 error:"+e.toString());
}
return incCallObj;
}
} }

View File

@ -227,6 +227,7 @@ public class TCPmsgParser implements Runnable {
if (TCPhandler.msgList == null) if (TCPhandler.msgList == null)
continue; continue;
if(!TCPhandler.msgList.isEmpty()) { if(!TCPhandler.msgList.isEmpty()) {
try { try {
_msg = TCPhandler.msgList.poll(); _msg = TCPhandler.msgList.poll();
if(_msg == null) if(_msg == null)
@ -235,27 +236,32 @@ public class TCPmsgParser implements Runnable {
continue; continue;
//parse the rest of the message; //parse the rest of the message;
switch(_msg.opCode) {
case 40:{ switch(_msg.opCode)
{
case 40: /* login */{
_fireLoginEvent(); _fireLoginEvent();
break; break;
} }
case 41:{ case 41: /* vehicle */ {
_fireVehEvent(); _fireVehEvent();
break; break;
} }
case 42:{
case 42: /* Text Message */{
_fireSMSEvent(); _fireSMSEvent();
break; break;
} }
case 43:{
case 43: /* Last text message */ {
_fireLastSMSEvent(); _fireLastSMSEvent();
break; break;
} }
case OperationCodes.TM_ACK: case OperationCodes.TM_ACK:
case OperationCodes.TM_ACK_SD: { case OperationCodes.TM_ACK_SD: {
_fireSMSconfirm(); _fireSMSconfirm();
@ -267,22 +273,23 @@ public class TCPmsgParser implements Runnable {
break; break;
} }
case 45:{ case 45: /* last position */ {
_fireLastPos(); _fireLastPos();
break; break;
} }
case 131:{ case 131: /* gps */ {
_fireGPSEvent(); _fireGPSEvent();
break; break;
} }
case 231:{ case 231: /* pool */ {
_firePOLLEvent(); _firePOLLEvent();
break; break;
} }
case 50:{
case 50: /* radio */ {
_fireRadioEvent(); _fireRadioEvent();
break; break;
} }
@ -297,12 +304,14 @@ public class TCPmsgParser implements Runnable {
break; break;
} }
case 47:{
case 47: /* alert list */ {
_fireAlarmList(); _fireAlarmList();
break; break;
} }
case 48:{
case 48: /* alert ack */ {
_fireAlarmACK(); _fireAlarmACK();
break; break;
} }
@ -359,8 +368,10 @@ public class TCPmsgParser implements Runnable {
default: default:
break; break;
} }
} catch(Exception ex) { }
catch(Exception ex) {
try { try {
if(TCPhandler.msgList.size() > 0) if(TCPhandler.msgList.size() > 0)
_msg = TCPhandler.msgList.remove(0); _msg = TCPhandler.msgList.remove(0);
@ -370,6 +381,7 @@ public class TCPmsgParser implements Runnable {
} }
} }
} }
SM.Debug("TCPmsgParser listen thread stoped."); SM.Debug("TCPmsgParser listen thread stoped.");
} }

View File

@ -11,9 +11,9 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 8000035, "versionCode": 8000091,
"versionName": "8.0.35", "versionName": "8.0.91",
"outputFile": "SafeDispatchMobile_v.8.0.35-release.apk" "outputFile": "SafeDispatchMobile_v.8.0.91-release.apk"
} }
], ],
"elementType": "File" "elementType": "File"

View File

@ -25,6 +25,7 @@ public class AudioHandle implements Runnable{
private TcpAudioClient tcp; private TcpAudioClient tcp;
private int audioport = 50001; private int audioport = 50001;
public int typeUDP; public int typeUDP;
public AudioHandle(String IP, int _typeUDP) public AudioHandle(String IP, int _typeUDP)
{ {
@ -143,18 +144,20 @@ public class AudioHandle implements Runnable{
//SM.Debug("sending b:"+bRead); //SM.Debug("sending b:"+bRead);
if(typeUDP == 1) if(typeUDP == 1)
{ {
tempBuffer = new byte[512];//128];//invers3.bufferSize]; int size = 512; // 2048
bRead = recDev.read(tempBuffer, 0, 512);// 128);//invers3.bufferSize);
tempBuffer = new byte[size];
bRead = recDev.read(tempBuffer, 0, size);
udp.Send(tempBuffer,bRead); udp.Send(tempBuffer,bRead);
SM.Debug("UDP sending b:"+bRead); SM.Debug("UDP sending b:"+bRead);
} }
else else
{ {
tempBuffer = new byte[2048];//128];//invers3.bufferSize]; int size = 1024; //
bRead = recDev.read(tempBuffer, 0, 2048);// 128);//invers3.bufferSize); tempBuffer = new byte[size];
/* bRead = recDev.read(tempBuffer, 0, size);
tempBuffer = new byte[16384];//128];//invers3.bufferSize];
bRead = recDev.read(tempBuffer, 0,16384);// 128);//invers3.bufferSize);*/
tcp.send(tempBuffer,bRead); tcp.send(tempBuffer,bRead);
SM.Debug("TCP sending b:"+bRead); SM.Debug("TCP sending b:"+bRead);
} }

View File

@ -128,9 +128,12 @@ public class AlarmActivity extends Activity {
setConvertViewAlarm(arg1); setConvertViewAlarm(arg1);
// save position // save position
ackPosition = position; ackPosition = position;
if (!AppParams.DEMO) if (!AppParams.DEMO) {
getParentTab().getAlarms(AppParams.USERID);
setACK(getAllAlarms().get(position).idx, getAllAlarms().get(position).type, getAllAlarms().get(position).unitName); setACK(getAllAlarms().get(position).idx, getAllAlarms().get(position).type, getAllAlarms().get(position).unitName);
else { acknowledged.set(position, true);
updateResultsInUi(ALARM);
} else {
getAllAlarms().get(position).ack = 1; getAllAlarms().get(position).ack = 1;
updateResultsInUi("else"); updateResultsInUi("else");
} }

View File

@ -11,9 +11,11 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
@ -52,6 +54,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
private final ArrayList<Vehicle> allVehicle = new ArrayList<>(); private final ArrayList<Vehicle> allVehicle = new ArrayList<>();
private final ArrayList<String> allVehicleNames = new ArrayList<>(); private final ArrayList<String> allVehicleNames = new ArrayList<>();
private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy"); private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy");
private boolean showVehicles = true;
@Override @Override
@ -111,6 +114,21 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
} }
}); });
LinearLayout slideLayout = findViewById(R.id.slidelayout);
LinearLayout linearLayoutVehicles = findViewById(R.id.layoutBig);
ImageView slideLayoutImageView = findViewById(R.id.slideLayoutImage);
slideLayout.setOnClickListener(v -> {
if (showVehicles) {
linearLayoutVehicles.setVisibility(View.GONE);
slideLayoutImageView.setImageResource(R.drawable.arrow_right);
showVehicles = false;
} else {
linearLayoutVehicles.setVisibility(View.VISIBLE);
slideLayoutImageView.setImageResource(R.drawable.arrow_left);
showVehicles = true;
}
});
setDate(); setDate();
} }

View File

@ -89,7 +89,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
private boolean isAck = false; private boolean isAck = false;
private boolean showVehicle = true; private boolean showVehicle = true;
private int contextMenuPosition; private int contextMenuPosition;
private int vehStatus; private int vehStatus, lastItemClicked;
private int position; // vehStatus = vehicle status received from apps private int position; // vehStatus = vehicle status received from apps
/* Live Vehicle GridView */ /* Live Vehicle GridView */
@ -255,7 +255,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
} }
// refresh UI // refresh UI
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
}); });
displayButton = findViewById(R.id.buttonDisplay); displayButton = findViewById(R.id.buttonDisplay);
@ -286,11 +286,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
} }
// refresh UI // refresh UI
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
}); });
// display Vehicles // display Vehicles
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
// register to receive broadcasts // register to receive broadcasts
registerBroadcastIntents(); registerBroadcastIntents();
@ -373,7 +373,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
// clear previous vehicles // clear previous vehicles
SM.Debug("onResume"); SM.Debug("onResume");
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
} }
final Runnable cancelLoadingDialogRUN = LiveActivity.this::cancelLoadingDialog; final Runnable cancelLoadingDialogRUN = LiveActivity.this::cancelLoadingDialog;
@ -442,7 +442,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
}); });
} }
public void displayVehicle(boolean withZoom, double latZoom, double lngZoom) { public void displayVehicle(double latZoom, double lngZoom) {
if (googleMap != null) { if (googleMap != null) {
String openWindow = ""; String openWindow = "";
for (Marker marker : markers) { for (Marker marker : markers) {
@ -464,7 +464,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
markerOptions.icon(markerIcon); markerOptions.icon(markerIcon);
Marker marker = this.googleMap.addMarker(markerOptions); Marker marker = this.googleMap.addMarker(markerOptions);
if (openWindow.equals(marker.getTitle())) { if (openWindow.equals(marker.getTitle()) || i == lastItemClicked) {
marker.showInfoWindow(); marker.showInfoWindow();
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 14)); googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 14));
} }
@ -474,10 +474,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
} }
} }
} }
} lastItemClicked = 0;
public void showOpenedBalloon(boolean demo) {
//TODO: add show balloon
} }
private BitmapDescriptor getProperBitmap(int largeIcon, String text) { private BitmapDescriptor getProperBitmap(int largeIcon, String text) {
@ -654,7 +651,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
} }
// Create runnable for posting // Create runnable for posting
final Runnable updateMapResults = () -> displayVehicle(false, LAT_OUTLIMIT, LNG_OUTLIMIT); final Runnable updateMapResults = () -> displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
// Create runnable for posting // Create runnable for posting
final Runnable updatePollResults = () -> { final Runnable updatePollResults = () -> {
@ -664,7 +661,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
adapter.changeDisplayed(position, true); adapter.changeDisplayed(position, true);
} }
displayVehicle(true, latPoll, lngPoll); }; displayVehicle(latPoll, lngPoll); };
// Create runnable for posting // Create runnable for posting
final Runnable updateOptionsRUN = this::updateOptionsUI; final Runnable updateOptionsRUN = this::updateOptionsUI;
@ -682,8 +679,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
* @param view View in which will do the modifications * @param view View in which will do the modifications
*/ */
private void itemClick(int position, View view) { private void itemClick(int position, View view) {
lastItemClicked = position;
// change displayed state // change displayed state
displayedVehicles.set(position, !Boolean.TRUE.equals(displayedVehicles.get(position))); displayedVehicles.set(position, !displayedVehicles.get(position));
// change in the adapter // change in the adapter
adapter.changeDisplayed(position, displayedVehicles.get(position)); adapter.changeDisplayed(position, displayedVehicles.get(position));
@ -697,15 +695,15 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked); viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
// check if all values are identical // check if all values are identical
boolean identical = true; boolean allDisplayed = true;
for (Boolean displ : displayedVehicles) for (Boolean displayed : displayedVehicles)
if (displ != displayedVehicles.get(0)) { if (!displayed) {
identical = false; allDisplayed = false;
break; break;
} }
// change image when all values are identical // change image when all values are identical
if (identical && displayedVehicles.get(0)) { if (allDisplayed) {
imageViewCheckAll.setSelected(true); imageViewCheckAll.setSelected(true);
imageViewCheckAll.setBackgroundResource(R.drawable.check_all); imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
} else { } else {
@ -714,7 +712,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
} }
// display vehicle // display vehicle
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
} }
/** /**

View File

@ -124,16 +124,6 @@ public class MessagesActivity extends Activity {
textViewSelectedContact = findViewById(R.id.textViewSelectedContact); textViewSelectedContact = findViewById(R.id.textViewSelectedContact);
imageViewSelectedContact = findViewById(R.id.imageViewSelectedContact); imageViewSelectedContact = findViewById(R.id.imageViewSelectedContact);
ImageView imageBarcode = findViewById(R.id.imageBarcode);
imageBarcode.setOnClickListener(v -> {
try {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
} catch (Exception e) {
showErrorDialog(getResources().getString(R.string.barcodeError));
}
});
// change tab header fontFace // change tab header fontFace
TextView textView1 = findViewById(R.id.textView1); TextView textView1 = findViewById(R.id.textView1);
textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf")); textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf"));

View File

@ -10,19 +10,13 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -120,17 +114,6 @@ public class SDMobileActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SM.Debug("##### onCREATE ##### with LANGUAGE " + AppParams.LANGUAGETMP); SM.Debug("##### onCREATE ##### with LANGUAGE " + AppParams.LANGUAGETMP);
ConnectivityManager connectivityManager =
(ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
connectivityManager.registerDefaultNetworkCallback(networkCallback);
} else {
NetworkRequest request = new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build();
connectivityManager.registerNetworkCallback(request, networkCallback);
}
AppParams.theme = AppParams.Theme.SAFEDISPATCH; AppParams.theme = AppParams.Theme.SAFEDISPATCH;
if (AppParams.theme == AppParams.Theme.SAFENET) if (AppParams.theme == AppParams.Theme.SAFENET)
this.setTheme(R.style.Theme_Safenet); this.setTheme(R.style.Theme_Safenet);
@ -182,37 +165,16 @@ public class SDMobileActivity extends Activity {
ImageView imageLoading = (ImageView) findViewById(R.id.imageLoading); ImageView imageLoading = (ImageView) findViewById(R.id.imageLoading);
imageLoading.setBackgroundResource(R.drawable.loading); imageLoading.setBackgroundResource(R.drawable.loading);
// language
imageLanguage = (ImageView) findViewById(R.id.imageLanguage); imageLanguage = (ImageView) findViewById(R.id.imageLanguage);
// change spinner icon and selected language according to tmpLanguage
switch (AppParams.LANGUAGETMP) {
case "en":
imageLanguage.setImageResource(R.drawable.en);
break;
case "de":
imageLanguage.setImageResource(R.drawable.de);
break;
case "tr":
imageLanguage.setImageResource(R.drawable.tr);
break;
case "ro":
imageLanguage.setImageResource(R.drawable.ro);
break;
case "es":
imageLanguage.setImageResource(R.drawable.es);
break;
case "ru":
imageLanguage.setImageResource(R.drawable.ru);
break;
default:
throw new IllegalStateException("Unexpected value: " + AppParams.LANGUAGETMP);
}
imageLanguage.setOnClickListener(LanguageListener); imageLanguage.setOnClickListener(LanguageListener);
setLanguageIcon();
// username and password
etUsername = (EditText) findViewById(R.id.etUsername); etUsername = (EditText) findViewById(R.id.etUsername);
etPassword = (EditText) findViewById(R.id.etPassword); etPassword = (EditText) findViewById(R.id.etPassword);
// login button
btLogin = (Button) findViewById(R.id.btLogin); btLogin = (Button) findViewById(R.id.btLogin);
btLogin.setOnClickListener(arg0 -> { btLogin.setOnClickListener(arg0 -> {
@ -304,6 +266,35 @@ public class SDMobileActivity extends Activity {
} }
} }
private void setLanguageIcon()
{
// change spinner icon and selected language according to tmpLanguage
switch (AppParams.LANGUAGETMP) {
case "en":
imageLanguage.setImageResource(R.drawable.en);
break;
case "de":
imageLanguage.setImageResource(R.drawable.de);
break;
case "tr":
imageLanguage.setImageResource(R.drawable.tr);
break;
case "ro":
imageLanguage.setImageResource(R.drawable.ro);
break;
case "es":
imageLanguage.setImageResource(R.drawable.es);
break;
case "ru":
imageLanguage.setImageResource(R.drawable.ru);
break;
default:
throw new IllegalStateException("Unexpected value: " + AppParams.LANGUAGETMP);
}
}
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (loadingDialog.isShowing()) if (loadingDialog.isShowing())
@ -541,22 +532,6 @@ public class SDMobileActivity extends Activity {
SM.Debug("##### onRESUME #####"); SM.Debug("##### onRESUME #####");
} }
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
// network available
Log.v("NetworkAvailability", "available");
if (tcp != null && !tcp.isConnectionUP)
saveIPandRestartTCP(AppParams.IP, AppParams.PORT);
}
@Override
public void onLost(Network network) {
// network unavailable
Log.v("NetworkAvailability", "unavailable");
}
};
private void startTabActivity(long userID) { private void startTabActivity(long userID) {
// good login - load activity // good login - load activity

View File

@ -214,20 +214,6 @@
android:autofillHints=""> android:autofillHints="">
</EditText> </EditText>
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="4dp">
<ImageView
android:id="@+id/imageBarcode"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:src="@drawable/barcode"
android:paddingTop="2dp"
android:layout_margin="3dp" />
</LinearLayout>
<Button <Button
android:id="@+id/imageButtonSend" android:id="@+id/imageButtonSend"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -155,13 +155,13 @@
android:id="@+id/imageSettings" android:id="@+id/imageSettings"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:contentDescription="holds the icon for language"
android:src="@drawable/change_ip"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_alignTop="@+id/imageLanguage" android:layout_alignTop="@+id/imageLanguage"
android:layout_alignBottom="@+id/imageLanguage" android:layout_alignBottom="@+id/imageLanguage"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true"
android:adjustViewBounds="true"
android:contentDescription="holds the icon for language"
android:scaleType="fitCenter"
android:src="@drawable/change_ip" />
<Button <Button
android:id="@+id/buttonLogin" android:id="@+id/buttonLogin"

View File

@ -213,19 +213,6 @@
android:autofillHints=""> android:autofillHints="">
</EditText> </EditText>
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="4dp">
<ImageView
android:id="@+id/imageBarcode"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:src="@drawable/barcode"
android:layout_margin="3dp" />
</LinearLayout>
<Button <Button
android:id="@+id/imageButtonSend" android:id="@+id/imageButtonSend"
android:layout_width="wrap_content" android:layout_width="wrap_content"