Compare commits

...

23 Commits

Author SHA1 Message Date
3268286e76 #SD-188 - fix merge conflicts 2022-03-24 12:55:53 +02:00
c07986d604 Merge branch 'develop' into features/SD-188-Create_Permission_module_and_request_audio
# Conflicts:
#	safeDispatch/src/main/java/com/safemobile/dispatch/HistoryActivity.java
#	safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java
2022-03-24 12:29:12 +02:00
c70a1b71a1 Merge pull request 'change package name + apk && aab' (#10) from feature/change_package_name into develop
Reviewed-on: #10
2022-03-24 09:42:32 +00:00
142558d057 change package name + apk && aab 2022-03-24 11:18:49 +02:00
968d9e7296 Merge pull request 'new credential generated' (#9) from feature/new_signature into develop
Reviewed-on: #9
2022-03-23 11:35:40 +00:00
2855e9bde6 new credential generated 2022-03-23 13:33:54 +02:00
ee8bfe56b4 Merge pull request 'feature/icon_and_background' (#8) from feature/icon_and_background into develop
Reviewed-on: #8
2022-03-23 09:23:35 +00:00
d519a2be14 change app name 2022-03-23 11:12:20 +02:00
1b3912c682 change background image 2022-03-23 11:12:00 +02:00
ba9383248c chage icon 2022-03-23 10:56:09 +02:00
07127cea18 Merge pull request 'feature/apk_versioning_mechanism' (#7) from feature/apk_versioning_mechanism into develop
Reviewed-on: #7
2022-03-22 13:19:47 +00:00
6a235d1d3f merge with develop 2022-03-22 15:18:25 +02:00
bac12825c9 edit apk name 2022-03-22 15:10:29 +02:00
bbed107c42 get versionCode & name from tag 2022-03-22 12:11:08 +02:00
bca16caf94 new marker icon 2022-03-21 13:01:04 +02:00
0b887deb99 remove marker icon 2022-03-21 12:19:23 +02:00
c85dc279dc clean history activity 2022-03-21 11:58:34 +02:00
db360c4d45 speed limit 2022-03-21 11:50:52 +02:00
89f8cbfcae WIP 2022-03-18 23:12:20 +02:00
4420af337d cleanups 2022-03-18 15:40:15 +02:00
6b6543ca3f display test positions 2022-03-18 15:22:35 +02:00
f554356af1 small cleanups 2022-03-18 15:03:34 +02:00
0fabbc73be comment line in order to move vehicle 2022-03-17 15:13:25 +02:00
56 changed files with 433 additions and 241 deletions

0
gradlew vendored Normal file → Executable file
View File

View File

@ -19,6 +19,13 @@ android {
buildFeatures { buildFeatures {
viewBinding false viewBinding false
} }
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
//abortOnError false
}
} }
dependencies { dependencies {

View File

@ -6,7 +6,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
</application> </application>

View File

@ -198,12 +198,11 @@ public abstract class AbstractSDParentActivity extends TabActivity {
return res; return res;
} }
public boolean getHistoryPositions(int sc_id, long timeGMTStart, long timeGMTStop) public boolean getHistoryPositions(int sc_id, long timeGMTStart, long timeGMTStop) {
{
if(tcp == null) if(tcp == null)
return false; return false;
String histSeqID = "1."+Integer.toString((int) (System.currentTimeMillis() / 1000L)); String histSeqID = "1."+ (int) (System.currentTimeMillis() / 1000L);
boolean res = tcp.Write(histSeqID,"#26#"+sc_id+"#"+timeGMTStart+"#"+timeGMTStop+"#"); boolean res = tcp.Write(histSeqID,"#26#"+sc_id+"#"+timeGMTStart+"#"+timeGMTStop+"#");
if(res) if(res)
SM.Debug("Message [getHistoryPositions] sent to app server"); SM.Debug("Message [getHistoryPositions] sent to app server");
@ -213,8 +212,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
return res; return res;
} }
public boolean getRadiosList() public boolean getRadiosList() {
{
if(tcp == null) if(tcp == null)
return false; return false;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,14 +1,36 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' apply plugin: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
apply plugin: "com.gladed.androidgitversion"
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath "gradle.plugin.com.gladed.gradle.androidgitversion:gradle-android-git-version:0.4.3"
}
}
androidGitVersion {
codeFormat 'MNNBBBB'
format '%tag%%.count%'
hideBranches = ['develop']
}
android { android {
compileSdkVersion 31 compileSdkVersion 31
buildToolsVersion "31.0.0" buildToolsVersion "31.0.0"
defaultConfig { defaultConfig {
applicationId "com.safemobile.dispatch" applicationId "com.safemobile.safedispatch"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 31 targetSdkVersion 31
versionName androidGitVersion.name()
versionCode androidGitVersion.code()
archivesBaseName = "SafeDispatchMobile_v.$versionName"
} }
buildTypes { buildTypes {
@ -20,6 +42,13 @@ android {
buildFeatures { buildFeatures {
viewBinding false viewBinding false
} }
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
//abortOnError false
}
} }
dependencies { dependencies {
implementation project(':libSafeMobile') implementation project(':libSafeMobile')

View File

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.safemobile.safedispatch",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 8000035,
"versionName": "8.0.35",
"outputFile": "SafeDispatchMobile_v.8.0.35-release.apk"
}
],
"elementType": "File"
}

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.safemobile.safedispatch">
package="com.safemobile.dispatch"
android:versionCode="9"
android:versionName="1.0.9">
<!-- require OpenGL ES version 2 for Google Maps --> <!-- require OpenGL ES version 2 for Google Maps -->
<uses-feature <uses-feature
@ -30,7 +27,7 @@
<application <application
android:configChanges="orientation" android:configChanges="orientation"
android:icon="@drawable/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
@ -45,7 +42,7 @@
<service android:name="com.safemobile.services.TCPService" /> <service android:name="com.safemobile.services.TCPService" />
<activity <activity
android:name=".SDMobileActivity" android:name="com.safemobile.safedispatch.SDMobileActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:exported="true" android:exported="true"
android:label="@string/app_name_demo" android:label="@string/app_name_demo"
@ -57,41 +54,41 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".SetupActivity" android:name="com.safemobile.safedispatch.SetupActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".TabLayoutActivity" android:name="com.safemobile.safedispatch.TabLayoutActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".LiveActivity" android:name="com.safemobile.safedispatch.LiveActivity"
android:exported="false" android:exported="false"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:label="@string/title_activity_google_maps" /> android:label="@string/title_activity_google_maps" />
<activity <activity
android:name=".HistoryActivity" android:name="com.safemobile.safedispatch.HistoryActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".MessagesActivity" android:name="com.safemobile.safedispatch.MessagesActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".AlarmActivity" android:name="com.safemobile.safedispatch.AlarmActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".RadioActivity" android:name="com.safemobile.safedispatch.RadioActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".RecordingsActivity" android:name="com.safemobile.safedispatch.RecordingsActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity <activity
android:name=".NotificationActivity" android:name="com.safemobile.safedispatch.NotificationActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
</application> </application>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,162 +0,0 @@
package com.safemobile.dispatch;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.safemobile.lib.AppParams;
import com.safemobile.lib.SM;
import com.safemobile.lib.Vehicle;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class HistoryActivity extends AppCompatActivity {
public Bundle savedInstanceState;
private TabLayoutActivity parentTab;
private GoogleMap googleMap;
private Spinner spinnerVehicle;
private ImageView changeMapType, checkTraffic, slideLayoutImage;
private LinearLayout layoutTraffic, slidelayout, layoutVehicles;
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
private ArrayList<String> allVehicleNames = new ArrayList<>();
private ArrayAdapter<String> adapter;
private boolean showVehicle = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.savedInstanceState = savedInstanceState;
setContentView(R.layout.tabhistory);
parentTab = (TabLayoutActivity) getParent();
parentTab.setHistoryActivity(this);
Locale locale = new Locale(AppParams.LANGUAGETMP);
Locale.setDefault(locale);
googleMap = parentTab.getLiveActivity().getMap();
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
spinnerVehicle = findViewById(R.id.spinnerVehicle);
getVehicles();
adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, allVehicleNames);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinnerVehicle.setAdapter(adapter);
spinnerVehicle.setSelection(0);
changeMapType();
changeTraffic();
slidelayout = findViewById(R.id.slidelayout);
slideLayoutImage = findViewById(R.id.slideLayoutImage);
layoutVehicles = findViewById(R.id.layoutBig);
// slidelayout.setOnTouchListener((v, event) -> {
// if (showVehicle) {
// layoutVehicles.setVisibility(View.GONE);
// slideLayoutImage.setImageResource(R.drawable.arrow_right);
// showVehicle = false;
// } else {
// layoutVehicles.setVisibility(View.VISIBLE);
// slideLayoutImage.setImageResource(R.drawable.arrow_left);
// showVehicle = true;
// }
// return false;
// });
setDate();
}
private void setDate() {
Calendar calendar = Calendar.getInstance();
Date endDate = calendar.getTime();
calendar.add(Calendar.DATE, -1);
Date startDate = calendar.getTime();
LinearLayout layoutStartPicker = findViewById(R.id.layoutStartPicker);
TextView textViewDate = findViewById(R.id.textViewStartDate);
textViewDate.setText(new SimpleDateFormat("HH:mm, dd.MM.yyyy").format(startDate));
// layoutStartPicker.setOnTouchListener((v, event) -> {
// showDialog(layoutStartPicker);
// return false;
// });
// layoutEndPicker.setOnTouchListener(new OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// showDialog(layoutEndPicker);
// return false;
// }
// });
}
private void changeTraffic() {
ImageView changeTrafficImageView = findViewById(R.id.changeTraffic);
changeTrafficImageView.setOnClickListener(v -> {
if (googleMap.isTrafficEnabled()) {
changeTrafficImageView.setImageResource(R.drawable.traffic_off);
googleMap.setTrafficEnabled(false);
} else {
changeTrafficImageView.setImageResource(R.drawable.traffic);
googleMap.setTrafficEnabled(true);
}
});
}
private void changeMapType() {
changeMapType = findViewById(R.id.changeMapType);
ImageView changeMapTypeImageView = findViewById(R.id.changeMapType);
changeMapType.setOnClickListener(view -> {
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
changeMapTypeImageView.setImageResource(R.drawable.satellite);
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
} else {
changeMapTypeImageView.setImageResource(R.drawable.map);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
});
}
public void getVehicles() {
try {
for (Vehicle vehicle : parentTab.getAllVehicle()) {
allVehicleNames.add(vehicle.name);
allVehicle.add(vehicle);
}
} catch (Exception ex) { }
}
public void UpdateMap() {
SM.Debug("Do the updateMAP post");
}
public void UpdateUnableDisp() {
SM.Debug("Do Cancelwindow");
}
public void UpdateCancel() {
SM.Debug("Do Cancelwindow");
}
public void UpdateNrPos(int size) {
SM.Debug("Do Cancelwindow");
}
}

View File

@ -5,7 +5,7 @@ import android.app.AlertDialog;
import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource; import com.google.android.gms.tasks.TaskCompletionSource;
import com.safemobile.dispatch.R; import com.safemobile.safedispatch.R;
import com.safemobile.interfaces.IDialogService; import com.safemobile.interfaces.IDialogService;
public class DialogService implements IDialogService { public class DialogService implements IDialogService {

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@ -12,10 +12,12 @@ import androidx.annotation.NonNull;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.Marker;
import com.safemobile.lib.HistPos;
import com.safemobile.lib.SuperVehicle; import com.safemobile.lib.SuperVehicle;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Locale; import java.util.Locale;
@ -25,8 +27,10 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
private final String TAG = GoogleMapsInfoBubble.class.getName(); private final String TAG = GoogleMapsInfoBubble.class.getName();
private final View mWindow; private final View mWindow;
private final Hashtable<Long, SuperVehicle> superVehHash; private Hashtable<Long, SuperVehicle> superVehHash;
private final Context context; private final Context context;
private ArrayList<HistPos> histPosList;
private boolean isLiveTab = true;
public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context, Hashtable<Long, SuperVehicle> vehicles) { public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context, Hashtable<Long, SuperVehicle> vehicles) {
@ -35,6 +39,17 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null); mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null);
} }
public GoogleMapsInfoBubble(LayoutInflater layoutInflater, Context context) {
isLiveTab = false;
this.context = context;
// this.superVehHash = vehicles;
mWindow = layoutInflater.inflate(R.layout.map_marker_info_bubble, null);
}
public void setHistoryPositions(ArrayList<HistPos> positions) {
this.histPosList = positions;
}
@Override @Override
public View getInfoWindow(@NonNull Marker marker) { public View getInfoWindow(@NonNull Marker marker) {
render(marker, mWindow); render(marker, mWindow);
@ -49,13 +64,21 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
private void render(Marker marker, View view) { private void render(Marker marker, View view) {
long key = 0; long key = 0;
int position = 0;
try { if (isLiveTab) {
key = Long.parseLong(marker.getTitle()); try {
} catch (Exception ex) { key = Long.parseLong(marker.getTitle());
Log.v(TAG, "Unable to parse Google Maps Info Bubble title"); } catch (Exception ex) {
Log.v(TAG, "Unable to parse Google Maps Info Bubble title");
}
} else {
try {
position = Integer.getInteger(marker.getTitle());
} catch (Exception e) {
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
}
} }
SuperVehicle vehicle = superVehHash.get(key);
RelativeLayout rlMapInfoBubbleInfo = view.findViewById(R.id.rlMapInfoBubbleInfo); RelativeLayout rlMapInfoBubbleInfo = view.findViewById(R.id.rlMapInfoBubbleInfo);
TextView tvUnitName = view.findViewById(R.id.tvUnitName); TextView tvUnitName = view.findViewById(R.id.tvUnitName);
@ -67,27 +90,39 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
rlMapInfoBubbleInfo.setVisibility(View.VISIBLE); rlMapInfoBubbleInfo.setVisibility(View.VISIBLE);
boolean isMilitaryTime = false; boolean isMilitaryTime = false;
Date positionTime = new Date(vehicle.timeGMT); Date positionTime;
String speed, address, gpsLocation, name = "";
if (isLiveTab) {
SuperVehicle vehicle = superVehHash.get(key);
positionTime = new Date(vehicle.timeGMT);
address = vehicle.Address != null ? vehicle.Address : "";
name = vehicle.name;
speed = String.format(context.getResources().getString(R.string.speedMph), vehicle.speed);
gpsLocation = "[" + String.format("%.4f", vehicle.lat) + "," + String.format("%.4f",vehicle.lng) + "]";
} else {
HistPos histPos = histPosList.get(position);
positionTime = new Date(histPos.timeGMT);
address = histPos.Address != null ? histPos.Address : "";
speed = String.format(context.getResources().getString(R.string.speedMph), histPos.speed);
gpsLocation = "[" + String.format("%.4f", histPos.lat) + "," + String.format("%.4f",histPos.lng) + "]";
}
String timeFormat = isMilitaryTime String timeFormat = isMilitaryTime
? "HH:mm:ss dd.MMM.yyyy" ? "HH:mm:ss dd.MMM.yyyy"
: "hh:mm:ss a dd.MMM.yyy"; : "hh:mm:ss a dd.MMM.yyy";
DateFormat format = new SimpleDateFormat(timeFormat, Locale.ENGLISH); DateFormat format = new SimpleDateFormat(timeFormat, Locale.ENGLISH);
tvTimeAgo.setText(format.format(positionTime)); tvTimeAgo.setText(format.format(positionTime));
tvSpeed.setText(String.format(context.getResources().getString(R.string.speedMph), vehicle.speed));
String address = vehicle.Address != null ? vehicle.Address : "";
tvStreetView.setText(address); tvStreetView.setText(address);
streetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE); streetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE);
tvStreetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE); tvStreetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE);
tvUnitName.setText(vehicle.name); if (!isLiveTab)
tvGPSLocation.setText("[" + String.format("%.4f", vehicle.lat) tvUnitName.setVisibility(View.GONE);
+ "," + String.format("%.4f",vehicle.lng) + "]"); else
tvUnitName.setText(name);
tvSpeed.setText(speed);
tvGPSLocation.setText(gpsLocation);
} }
} }

View File

@ -0,0 +1,241 @@
package com.safemobile.safedispatch;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.safemobile.lib.AppParams;
import com.safemobile.lib.HistPos;
import com.safemobile.lib.OperationCodes;
import com.safemobile.lib.SM;
import com.safemobile.lib.Vehicle;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class HistoryActivity extends AppCompatActivity implements OnMapReadyCallback {
public Bundle savedInstanceState;
private TabLayoutActivity parentTab;
private GoogleMap googleMap;
private Spinner spinnerVehicle;
private Button displayButton;
private Date startDate, endDate;
private final Handler myHandler = new Handler();
private GoogleMapsInfoBubble infoBubble;
private final ArrayList<Vehicle> allVehicle = new ArrayList<>();
private final ArrayList<String> allVehicleNames = new ArrayList<>();
private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.savedInstanceState = savedInstanceState;
setContentView(R.layout.tabhistory);
parentTab = (TabLayoutActivity) getParent();
parentTab.setHistoryActivity(this);
Locale locale = new Locale(AppParams.LANGUAGETMP);
Locale.setDefault(locale);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
if (mapFragment != null)
mapFragment.getMapAsync(this);
spinnerVehicle = findViewById(R.id.spinnerVehicle);
getVehicles();
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, allVehicleNames);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinnerVehicle.setAdapter(adapter);
spinnerVehicle.setSelection(0);
changeMapType();
changeTraffic();
displayButton = findViewById(R.id.buttonDisplay);
displayButton.setOnClickListener(view -> {
googleMap.clear();
if (!AppParams.DEMO) {
parentTab.setDropAllData(false);
parentTab.setFirstHistoryData(true);
parentTab.clearHistoryMessageList();
parentTab.clearHistoryPositionList();
// request history
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetHistoryPositions + "", allVehicle.get(spinnerVehicle.getSelectedItemPosition()).sc_id + "",
(startDate.getTime()/ 1000L) + "", (endDate.getTime()/ 1000L) + ""});
} else {
parentTab.demoPositionsList();
displayHistory(parentTab.getDemoPositions());
}
});
setDate();
}
private void displayHistory(ArrayList<HistPos> positions) {
LatLng latLng = null;
PolylineOptions polylineOptions = new PolylineOptions();
BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.history_pin);
for (int i = 0; i < positions.size(); i++) {
HistPos pos = positions.get(i);
if (pos.speed > 0) {
latLng = new LatLng(pos.lat, pos.lng);
polylineOptions.add(latLng);
googleMap.addMarker(new MarkerOptions()
.position(latLng)
.icon(markerIcon)
.title(String.valueOf(i)));
}
}
googleMap.addPolyline(polylineOptions);
if (latLng != null)
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14));
}
private void setDate() {
Calendar calendar = Calendar.getInstance();
endDate = calendar.getTime();
calendar.add(Calendar.DATE, -1);
startDate = calendar.getTime();
TextView textViewStartDate = findViewById(R.id.textViewStartDate);
TextView textViewEndDate = findViewById(R.id.textViewEndDate);
textViewStartDate.setText(sdf.format(startDate));
textViewEndDate.setText(sdf.format(endDate));
textViewStartDate.setOnClickListener(view -> openDialog(textViewStartDate, true));
textViewEndDate.setOnClickListener(view -> openDialog(textViewEndDate, false));
}
private void openDialog(TextView textView, Boolean isStartDate) {
Date date = startDate;
if (!isStartDate)
date = endDate;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
DatePickerDialog.OnDateSetListener setListener = (datePicker, y, m, d) -> {
calendar.set(y, m, d);
String dateString = sdf.format(calendar.getTime());
textView.setText(dateString);
if (isStartDate)
startDate = calendar.getTime();
else
endDate = calendar.getTime();
};
Dialog dialog = new DatePickerDialog(this, android.R.style.Theme_Holo_Light_Dialog_MinWidth, setListener,
calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.show();
}
private void changeTraffic() {
ImageView changeTrafficImageView = findViewById(R.id.changeTraffic);
changeTrafficImageView.setOnClickListener(v -> {
if (googleMap.isTrafficEnabled()) {
changeTrafficImageView.setImageResource(R.drawable.traffic_off);
googleMap.setTrafficEnabled(false);
} else {
changeTrafficImageView.setImageResource(R.drawable.traffic);
googleMap.setTrafficEnabled(true);
}
});
}
private void changeMapType() {
ImageView changeMapType = findViewById(R.id.changeMapType);
changeMapType.setOnClickListener(view -> {
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
changeMapType.setImageResource(R.drawable.satellite);
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
} else {
changeMapType.setImageResource(R.drawable.map);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
});
}
public void getVehicles() {
try {
allVehicle.clear();
allVehicleNames.clear();
for (Vehicle vehicle : parentTab.getAllVehicle()) {
allVehicleNames.add(vehicle.name);
allVehicle.add(vehicle);
}
} catch (Exception ignored) { }
}
final Runnable UpdateMapResults = new Runnable() {
public void run() {
Log.v("updateMap", parentTab.getHistoryPositionList().toString());
SM.Debug("Do the Display");
infoBubble.setHistoryPositions(parentTab.getHistoryPositionList());
displayHistory(parentTab.getHistoryPositionList());
}
};
public void UpdateMap() {
myHandler.post(UpdateMapResults);
SM.Debug("Do the updateMAP post");
}
public void UpdateUnableDisp() {
SM.Debug("Do Cancelwindow");
}
public void UpdateCancel() {
SM.Debug("Do Cancelwindow");
}
public void UpdateNrPos(int size) {
SM.Debug("Do Cancelwindow");
}
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
this.googleMap = googleMap;
infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this);
this.googleMap.setInfoWindowAdapter(infoBubble);
parentTab.demoPositionsList();
displayButton.performClick();
}
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -673,10 +673,10 @@ public class RadioActivity extends Activity {
dialog.setCancelable(true); dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
TextView text = (TextView) dialog.findViewById(R.id.text); TextView text = dialog.findViewById(R.id.text);
ImageView image = (ImageView) dialog.findViewById(R.id.image); ImageView image = dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher); image.setImageResource(R.mipmap.ic_launcher);
text.setText(errorMsg); text.setText(errorMsg);
dialog.show(); dialog.show();
} }

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -184,10 +184,10 @@ public class RecordingsActivity extends Activity {
dialog.setCancelable(true); dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
TextView text = (TextView) dialog.findViewById(R.id.text); TextView text = dialog.findViewById(R.id.text);
ImageView image = (ImageView) dialog.findViewById(R.id.image); ImageView image = dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher); image.setImageResource(R.mipmap.ic_launcher);
text.setText(errorMsg); text.setText(errorMsg);
dialog.show(); dialog.show();
} }

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import java.util.Locale; import java.util.Locale;

View File

@ -1,4 +1,4 @@
package com.safemobile.dispatch; package com.safemobile.safedispatch;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -20,6 +20,7 @@ import com.safemobile.activities.AbstractLiveActivity;
import com.safemobile.activities.AbstractMessagesActivity; import com.safemobile.activities.AbstractMessagesActivity;
import com.safemobile.activities.AbstractRadioActivity; import com.safemobile.activities.AbstractRadioActivity;
import com.safemobile.activities.AbstractSDParentActivity; import com.safemobile.activities.AbstractSDParentActivity;
import com.safemobile.safedispatch.R;
import com.safemobile.enums.AuthorizationCode; import com.safemobile.enums.AuthorizationCode;
import com.safemobile.enums.AuthorizationStatus; import com.safemobile.enums.AuthorizationStatus;
import com.safemobile.enums.ProviderSettingsStatus; import com.safemobile.enums.ProviderSettingsStatus;
@ -260,6 +261,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
this.historyPositionList = historyPositionList; this.historyPositionList = historyPositionList;
} }
public void clearHistoryPositionList() {
this.historyPositionList.clear();
}
public Boolean getFirstHistoryData() { public Boolean getFirstHistoryData() {
return firstHistoryData; return firstHistoryData;
} }
@ -284,6 +289,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
this.historyMessageList = historyMessageList; this.historyMessageList = historyMessageList;
} }
public void clearHistoryMessageList() {
this.historyMessageList.clear();
}
public ArrayList<SMS> getDemoSmsList() { public ArrayList<SMS> getDemoSmsList() {
return demoSmsList; return demoSmsList;
} }
@ -465,7 +474,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
// add radio tab // add radio tab
intent[6] = new Intent(context, AbstractEmptyActivity.class); intent[6] = new Intent(context, AbstractEmptyActivity.class);
tabSpecs[6] = tabHost.newTabSpec(ABOUT) tabSpecs[6] = tabHost.newTabSpec(ABOUT)
.setIndicator(ABOUT, res.getDrawable(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher)) .setIndicator(ABOUT, res.getDrawable(AppParams.DEMO ? R.drawable.icon_demo : R.mipmap.ic_launcher))
.setContent(intent[6]); .setContent(intent[6]);
// add history tab // add history tab
@ -744,7 +753,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
dialog.setTitle(AppParams.DEMO ? getString(R.string.app_name_demo) : getString(R.string.app_name)); dialog.setTitle(AppParams.DEMO ? getString(R.string.app_name_demo) : getString(R.string.app_name));
dialog.setContentView(R.layout.dialog); dialog.setContentView(R.layout.dialog);
ImageView image = dialog.findViewById(R.id.image); ImageView image = dialog.findViewById(R.id.image);
image.setImageResource(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher); image.setImageResource(AppParams.DEMO ? R.drawable.icon_demo : R.mipmap.ic_launcher);
TextView text = dialog.findViewById(R.id.text); TextView text = dialog.findViewById(R.id.text);
TextView text2 = dialog.findViewById(R.id.text2); TextView text2 = dialog.findViewById(R.id.text2);
text.setText(String.format("%s1.0.8", getString(R.string.version))); text.setText(String.format("%s1.0.8", getString(R.string.version)));
@ -935,7 +944,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
} }
} }
private void demoPositionsList() { public void demoPositionsList() {
AssetManager assetManager = res.getAssets(); AssetManager assetManager = res.getAssets();
SM.Debug("TRY 2 OPEN demo_positions.txt"); SM.Debug("TRY 2 OPEN demo_positions.txt");
InputStream input = null; InputStream input = null;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -11,7 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_launcher" android:src="@mipmap/ic_launcher"
/> />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -24,7 +24,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_launcher" android:src="@mipmap/ic_launcher"
android:contentDescription="image for dialog" android:contentDescription="image for dialog"
/> />
<LinearLayout <LinearLayout

View File

@ -7,7 +7,7 @@
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" android:src="@mipmap/ic_launcher"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:paddingTop="5dp" android:paddingTop="5dp"

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_width="fill_parent"
android:id="@+id/tab1Layout" android:orientation="horizontal" android:layout_height="fill_parent"
android:id="@+id/tab1Layout"
android:orientation="horizontal"
style="?bg"> style="?bg">
<RelativeLayout <RelativeLayout
@ -162,10 +164,11 @@
android:text="@string/startDate" android:text="@string/startDate"
android:textSize="22dp" android:textSize="22dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:layout_marginTop="15sp"
android:textColor="#000000" android:textColor="#000000"
android:gravity="left" android:gravity="left"
android:id="@+id/labelStartDate" android:id="@+id/labelStartDate"
android:visibility="gone"/> />
<LinearLayout <LinearLayout
android:id="@+id/layoutStartPicker" android:id="@+id/layoutStartPicker"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -202,7 +205,7 @@
android:textColor="#000000" android:textColor="#000000"
android:gravity="left" android:gravity="left"
android:id="@+id/labelEndDate" android:id="@+id/labelEndDate"
android:visibility="gone"/> />
<LinearLayout <LinearLayout
android:id="@+id/layoutEndPicker" android:id="@+id/layoutEndPicker"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -284,14 +287,15 @@
</LinearLayout> </LinearLayout>
<fragment <fragment
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:id="@+id/map" android:id="@+id/map"
android:layout_toRightOf="@id/slidelayout" android:layout_toRightOf="@id/slidelayout"
android:layout_weight="1" android:layout_weight="1"
tools:context=".HistoryActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" /> android:name="com.google.android.gms.maps.SupportMapFragment" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/changeMapType" android:id="@+id/changeMapType"

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">SafeMobile Dispatch</string> <string name="app_name">SafeDispatch Mobile</string>
<string name="app_name_demo">SafeMobile Dispatch Demo</string> <string name="app_name_demo">SafeDispatch Mobile Demo</string>
<string name="app_name_radiopod">RadioPod</string> <string name="app_name_radiopod">RadioPod</string>
<string name="app_name_radiopad">RadioPad</string> <string name="app_name_radiopad">RadioPad</string>
<string name="app_name_radiopodd">RadioPod</string> <string name="app_name_radiopodd">RadioPod</string>

View File

@ -82,7 +82,7 @@
<style name="mainBackground_sd"> <style name="mainBackground_sd">
<item name="android:orientation">vertical</item> <item name="android:orientation">vertical</item>
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
<item name="android:scaleType">centerInside</item> <item name="android:scaleType">centerInside</item>
</style> </style>
@ -138,7 +138,7 @@
</style> </style>
<style name="bg_sd"> <style name="bg_sd">
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
</style> </style>
<style name="header_sd"> <style name="header_sd">
@ -155,7 +155,7 @@
<style name="mainBackground_hy"> <style name="mainBackground_hy">
<item name="android:orientation">vertical</item> <item name="android:orientation">vertical</item>
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
<item name="android:scaleType">centerInside</item> <item name="android:scaleType">centerInside</item>
</style> </style>
@ -211,7 +211,7 @@
</style> </style>
<style name="bg_hy"> <style name="bg_hy">
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
</style> </style>
<style name="header_hy"> <style name="header_hy">
@ -228,7 +228,7 @@
<style name="mainBackground_vi"> <style name="mainBackground_vi">
<item name="android:orientation">vertical</item> <item name="android:orientation">vertical</item>
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
<item name="android:scaleType">centerInside</item> <item name="android:scaleType">centerInside</item>
</style> </style>
@ -285,7 +285,7 @@
</style> </style>
<style name="bg_vi"> <style name="bg_vi">
<item name="android:background">@drawable/safedispatch</item> <item name="android:background">@drawable/safedispatch_logo</item>
</style> </style>
<style name="header_vi"> <style name="header_vi">