Compare commits
13 Commits
SD-225
...
f6cb72368d
Author | SHA1 | Date | |
---|---|---|---|
f6cb72368d | |||
97b7e2d9a7 | |||
33d00c27d7 | |||
cc78f29f26 | |||
e7c3672b93 | |||
feb7bd654c | |||
539170109d | |||
0bdd161d69 | |||
680dd0f803 | |||
0b890b74e0 | |||
73d2cedfba | |||
5c075ee168 | |||
1299ff2d2e |
@ -255,13 +255,12 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getAlarms(long userID)
|
||||
{
|
||||
if(tcp == null)
|
||||
public boolean getAlarms(long userID) {
|
||||
if (tcp == null)
|
||||
return false;
|
||||
|
||||
boolean res = tcp.Write("0.0", "#27#" + userID + "#");
|
||||
if(res)
|
||||
if (res)
|
||||
SM.Debug("Message [GetAlarms] sent to app server");
|
||||
else
|
||||
SM.Debug("Could not send message [GetAlarms]!!");
|
||||
|
@ -42,7 +42,6 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
||||
public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context) {
|
||||
isLiveTab = false;
|
||||
this.context = context;
|
||||
// this.superVehHash = vehicles;
|
||||
mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null);
|
||||
}
|
||||
|
||||
@ -73,7 +72,7 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
position = Integer.getInteger(marker.getTitle());
|
||||
position = Integer.parseInt(marker.getTitle());
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
|
||||
}
|
||||
|
@ -100,6 +100,17 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
||||
}
|
||||
});
|
||||
|
||||
ImageView mapType = findViewById(R.id.changeMapTypeHeader);
|
||||
mapType.setOnClickListener(view -> {
|
||||
if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) {
|
||||
mapType.setImageResource(R.drawable.map);
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||
} else {
|
||||
mapType.setImageResource(R.drawable.satellite);
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||
}
|
||||
});
|
||||
|
||||
setDate();
|
||||
}
|
||||
|
||||
|
@ -145,11 +145,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
// image View for changing map type satellite or map
|
||||
ImageView changeMapTypeImageView = findViewById(R.id.changeMapType);
|
||||
changeMapTypeImageView.setOnClickListener(v -> {
|
||||
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
|
||||
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
||||
if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) {
|
||||
changeMapTypeImageView.setImageResource(R.drawable.map);
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||
} else {
|
||||
changeMapTypeImageView.setImageResource(R.drawable.map);
|
||||
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||
}
|
||||
});
|
||||
@ -687,7 +687,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
// change check image for selected value
|
||||
VehiclesGridViewAdapter.ViewHolder viewLive = (VehiclesGridViewAdapter.ViewHolder) view.getTag();
|
||||
|
||||
if (Boolean.TRUE.equals(displayedVehicles.get(position)))
|
||||
if (displayedVehicles.get(position))
|
||||
viewLive.imgViewChecked.setImageResource(R.drawable.checked);
|
||||
else
|
||||
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
||||
@ -695,16 +695,16 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
// check if all values are identical
|
||||
boolean identical = true;
|
||||
for (Boolean displ : displayedVehicles)
|
||||
if (!Objects.equals(displ, displayedVehicles.get(0))) {
|
||||
if (displ != displayedVehicles.get(0)) {
|
||||
identical = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// change image when all values are identical
|
||||
if (identical && Boolean.TRUE.equals(displayedVehicles.get(0))) {
|
||||
if (identical && displayedVehicles.get(0)) {
|
||||
imageViewCheckAll.setSelected(true);
|
||||
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
|
||||
} else if (identical && Boolean.TRUE.equals(!displayedVehicles.get(0))) {
|
||||
} else {
|
||||
imageViewCheckAll.setSelected(false);
|
||||
imageViewCheckAll.setBackgroundResource(R.drawable.uncheck_all);
|
||||
}
|
||||
|
@ -10,13 +10,19 @@ import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
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.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -114,6 +120,17 @@ public class SDMobileActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
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;
|
||||
if (AppParams.theme == AppParams.Theme.SAFENET)
|
||||
this.setTheme(R.style.Theme_Safenet);
|
||||
@ -524,6 +541,22 @@ public class SDMobileActivity extends Activity {
|
||||
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) {
|
||||
// good login - load activity
|
||||
|
@ -1688,64 +1688,61 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
SM.Debug("Unit imei:" + tempArr[0]);
|
||||
String unitIMEI = tempArr[0];
|
||||
|
||||
//list for SMS
|
||||
if (AppParams.crtTab == AppParams.Tabs.alarms) {
|
||||
SM.Debug("currentActivity instanceof AlarmActivity - newSMS | " + tempArr[0] + " | " + tempArr[1]);
|
||||
getAlarms(AppParams.USERID);
|
||||
}
|
||||
// if tab is not TextTab
|
||||
if (tabHost.getCurrentTab() != 5) {
|
||||
// change Visual Elements
|
||||
setImei(unitIMEI);
|
||||
switch (msg.opCode) {
|
||||
case 135:
|
||||
setMess("speed " + tempArr[1]);
|
||||
break;
|
||||
case 136:
|
||||
setMess("landmark " + tempArr[1]);
|
||||
break;
|
||||
case 137:
|
||||
setMess("zone " + tempArr[1]);
|
||||
break;
|
||||
case 140:
|
||||
setMess("telemetry " + tempArr[1]);
|
||||
break;
|
||||
default:
|
||||
|
||||
// change Visual Elements
|
||||
setImei(unitIMEI);
|
||||
switch (msg.opCode) {
|
||||
case 135:
|
||||
setMess("speed " + tempArr[1]);
|
||||
break;
|
||||
case 136:
|
||||
setMess("landmark " + tempArr[1]);
|
||||
break;
|
||||
case 137:
|
||||
setMess("zone " + tempArr[1]);
|
||||
break;
|
||||
case 140:
|
||||
setMess("telemetry " + tempArr[1]);
|
||||
break;
|
||||
default:
|
||||
// 138
|
||||
setMess("emergency");
|
||||
}
|
||||
myHandler.post(updateResultsAlarm);
|
||||
setMess("emergency");
|
||||
}
|
||||
myHandler.post(updateResultsAlarm);
|
||||
|
||||
if ((msg.opCode == 138) && (AppParams.crtTab == AppParams.Tabs.live)) {
|
||||
SuperVehicle superVehicle = getSuperVehHash().get(Long.parseLong(unitIMEI));
|
||||
if ((msg.opCode == 138) && (AppParams.crtTab == AppParams.Tabs.live)) {
|
||||
SuperVehicle superVehicle = getSuperVehHash().get(Long.parseLong(unitIMEI));
|
||||
|
||||
if (superVehicle != null) {
|
||||
//if is not check i need to force check to put on the map
|
||||
boolean forceChecked = false;
|
||||
if (!superVehicle.needUpdate) {
|
||||
superVehicle.needUpdate = true;
|
||||
forceChecked = true;
|
||||
}
|
||||
try {
|
||||
int x = 0;
|
||||
if (forceChecked) {
|
||||
for (Vehicle veh : getAllVehicle()) {
|
||||
if (veh.imei.compareTo(unitIMEI) == 0) break;
|
||||
x++;
|
||||
}
|
||||
} else x = -1;
|
||||
if (getLiveActivity() != null) {
|
||||
if (x != getAllVehicle().size())
|
||||
getLiveActivity().emergencyAlarmReceived(x, superVehicle.lat, superVehicle.lng);
|
||||
else
|
||||
getLiveActivity().emergencyAlarmReceived(-1, superVehicle.lat, superVehicle.lng);
|
||||
if (superVehicle != null) {
|
||||
//if is not check i need to force check to put on the map
|
||||
boolean forceChecked = false;
|
||||
if (!superVehicle.needUpdate) {
|
||||
superVehicle.needUpdate = true;
|
||||
forceChecked = true;
|
||||
}
|
||||
try {
|
||||
int x = 0;
|
||||
if (forceChecked) {
|
||||
for (Vehicle veh : getAllVehicle()) {
|
||||
if (veh.imei.compareTo(unitIMEI) == 0) break;
|
||||
x++;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SM.Debug(HASH_ERROR_MESSAGE + ex);
|
||||
} else x = -1;
|
||||
if (getLiveActivity() != null) {
|
||||
if (x != getAllVehicle().size())
|
||||
getLiveActivity().emergencyAlarmReceived(x, superVehicle.lat, superVehicle.lng);
|
||||
else
|
||||
getLiveActivity().emergencyAlarmReceived(-1, superVehicle.lat, superVehicle.lng);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SM.Debug(HASH_ERROR_MESSAGE + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//list for SMS
|
||||
if (AppParams.crtTab == AppParams.Tabs.alarms)
|
||||
getAlarms(AppParams.USERID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2052,7 +2049,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
|
||||
Log.v("test111", "test");
|
||||
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(context);
|
||||
managerCompat.notify(icon, builder.build());
|
||||
}
|
||||
|
Reference in New Issue
Block a user