Merge pull request 'radio for App Server Mobile + refactor' (#26) from SD-205_Radio_App_Server_Mobile into develop

Reviewed-on: #26
This commit is contained in:
Laurențiu Constantin 2022-04-08 15:26:34 +00:00
commit e22f6eb24b
7 changed files with 1569 additions and 1370 deletions

View File

@ -15,7 +15,7 @@ public class RadioMSG extends TCPmsg {
public int rOpcode; public int rOpcode;
public String payload=""; public String payload="";
public ArrayList<RadioGW> RadioGWList=null; public ArrayList<RadioGW> RadioGWList = null;
//zone and channel; //zone and channel;
public Zone_and_channel zac= null; public Zone_and_channel zac= null;
@ -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,7 +227,8 @@ 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)
continue; continue;
@ -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();
@ -265,24 +271,25 @@ public class TCPmsgParser implements Runnable {
case OperationCodes.RECEIVED_TM:{ case OperationCodes.RECEIVED_TM:{
_fireNewSMS(); _fireNewSMS();
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

@ -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)
{ {
@ -89,7 +90,7 @@ public class AudioHandle implements Runnable{
t_micListner.start(); t_micListner.start();
if(typeUDP==1) if(typeUDP == 1)
{ {
udp.addUDPListener(new IUDPListener() udp.addUDPListener(new IUDPListener()
{ {
@ -99,7 +100,7 @@ public class AudioHandle implements Runnable{
byte[] data = event.data(); byte[] data = event.data();
int len = event.len(); int len = event.len();
SM.Debug("recv b:"+len+" data.length:"+data.length); SM.Debug("recv b:"+len+" data.length:"+data.length);
if(data!=null) if(data != null)
PlaySound(data, len); PlaySound(data, len);
} }
@ -141,20 +142,22 @@ public class AudioHandle implements Runnable{
if (soundNeeded) if (soundNeeded)
{ {
//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

@ -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

@ -151,17 +151,17 @@
android:textColor="#000000" android:textColor="#000000"
android:layout_marginBottom="5sp" /> android:layout_marginBottom="5sp" />
<ImageView <ImageView
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:layout_alignTop="@+id/imageLanguage"
android:src="@drawable/change_ip" android:layout_alignBottom="@+id/imageLanguage"
android:adjustViewBounds="true" android:layout_alignParentRight="true"
android:scaleType="fitCenter" android:adjustViewBounds="true"
android:layout_alignTop="@+id/imageLanguage" android:contentDescription="holds the icon for language"
android:layout_alignBottom="@+id/imageLanguage" android:scaleType="fitCenter"
android:layout_alignParentRight="true" /> android:src="@drawable/change_ip" />
<Button <Button
android:id="@+id/buttonLogin" android:id="@+id/buttonLogin"