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
@ -19,6 +19,13 @@ android {
|
||||
buildFeatures {
|
||||
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 {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
</application>
|
||||
|
@ -198,12 +198,11 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
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)
|
||||
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+"#");
|
||||
if(res)
|
||||
SM.Debug("Message [getHistoryPositions] sent to app server");
|
||||
@ -213,8 +212,7 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean getRadiosList()
|
||||
{
|
||||
public boolean getRadiosList() {
|
||||
if(tcp == null)
|
||||
return false;
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB |
@ -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>
|
@ -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>
|
BIN
libSafeMobile/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
BIN
libSafeMobile/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
libSafeMobile/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1020 B |
After Width: | Height: | Size: 1.0 KiB |
BIN
libSafeMobile/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.4 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 6.3 KiB |
BIN
libSafeMobile/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -1,14 +1,36 @@
|
||||
apply plugin: 'com.android.application'
|
||||
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 {
|
||||
compileSdkVersion 31
|
||||
buildToolsVersion "31.0.0"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.safemobile.dispatch"
|
||||
applicationId "com.safemobile.safedispatch"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionName androidGitVersion.name()
|
||||
versionCode androidGitVersion.code()
|
||||
archivesBaseName = "SafeDispatchMobile_v.$versionName"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -20,6 +42,13 @@ android {
|
||||
buildFeatures {
|
||||
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 {
|
||||
implementation project(':libSafeMobile')
|
||||
|
BIN
safeDispatch/release/SafeDispatchMobile_v.8.0.35-release.aab
Normal file
20
safeDispatch/release/output-metadata.json
Normal 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"
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.safemobile.dispatch"
|
||||
android:versionCode="9"
|
||||
android:versionName="1.0.9">
|
||||
package="com.safemobile.safedispatch">
|
||||
|
||||
<!-- require OpenGL ES version 2 for Google Maps -->
|
||||
<uses-feature
|
||||
@ -30,7 +27,7 @@
|
||||
|
||||
<application
|
||||
android:configChanges="orientation"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@style/AppTheme">
|
||||
@ -45,7 +42,7 @@
|
||||
<service android:name="com.safemobile.services.TCPService" />
|
||||
|
||||
<activity
|
||||
android:name=".SDMobileActivity"
|
||||
android:name="com.safemobile.safedispatch.SDMobileActivity"
|
||||
android:configChanges="orientation"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name_demo"
|
||||
@ -57,41 +54,41 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".SetupActivity"
|
||||
android:name="com.safemobile.safedispatch.SetupActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".TabLayoutActivity"
|
||||
android:name="com.safemobile.safedispatch.TabLayoutActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".LiveActivity"
|
||||
android:name="com.safemobile.safedispatch.LiveActivity"
|
||||
android:exported="false"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape"
|
||||
android:label="@string/title_activity_google_maps" />
|
||||
<activity
|
||||
android:name=".HistoryActivity"
|
||||
android:name="com.safemobile.safedispatch.HistoryActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".MessagesActivity"
|
||||
android:name="com.safemobile.safedispatch.MessagesActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".AlarmActivity"
|
||||
android:name="com.safemobile.safedispatch.AlarmActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".RadioActivity"
|
||||
android:name="com.safemobile.safedispatch.RadioActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".RecordingsActivity"
|
||||
android:name="com.safemobile.safedispatch.RecordingsActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".NotificationActivity"
|
||||
android:name="com.safemobile.safedispatch.NotificationActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="landscape" />
|
||||
</application>
|
||||
|
BIN
safeDispatch/src/main/ic_launcher-playstore.png
Normal file
After Width: | Height: | Size: 18 KiB |
@ -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");
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.content.Context;
|
||||
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.model.Marker;
|
||||
import com.safemobile.lib.HistPos;
|
||||
import com.safemobile.lib.SuperVehicle;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
@ -25,8 +27,10 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
||||
private final String TAG = GoogleMapsInfoBubble.class.getName();
|
||||
|
||||
private final View mWindow;
|
||||
private final Hashtable<Long, SuperVehicle> superVehHash;
|
||||
private Hashtable<Long, SuperVehicle> superVehHash;
|
||||
private final Context context;
|
||||
private ArrayList<HistPos> histPosList;
|
||||
private boolean isLiveTab = true;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
public View getInfoWindow(@NonNull Marker marker) {
|
||||
render(marker, mWindow);
|
||||
@ -49,13 +64,21 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
||||
|
||||
private void render(Marker marker, View view) {
|
||||
long key = 0;
|
||||
|
||||
int position = 0;
|
||||
if (isLiveTab) {
|
||||
try {
|
||||
key = Long.parseLong(marker.getTitle());
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title");
|
||||
}
|
||||
SuperVehicle vehicle = superVehHash.get(key);
|
||||
} else {
|
||||
try {
|
||||
position = Integer.getInteger(marker.getTitle());
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RelativeLayout rlMapInfoBubbleInfo = view.findViewById(R.id.rlMapInfoBubbleInfo);
|
||||
TextView tvUnitName = view.findViewById(R.id.tvUnitName);
|
||||
@ -67,27 +90,39 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
||||
rlMapInfoBubbleInfo.setVisibility(View.VISIBLE);
|
||||
|
||||
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
|
||||
? "HH:mm:ss dd.MMM.yyyy"
|
||||
: "hh:mm:ss a dd.MMM.yyy";
|
||||
|
||||
DateFormat format = new SimpleDateFormat(timeFormat, Locale.ENGLISH);
|
||||
|
||||
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);
|
||||
streetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE);
|
||||
tvStreetView.setVisibility(address.length() > 0 ? View.VISIBLE : View.GONE);
|
||||
tvUnitName.setText(vehicle.name);
|
||||
tvGPSLocation.setText("[" + String.format("%.4f", vehicle.lat)
|
||||
+ "," + String.format("%.4f",vehicle.lng) + "]");
|
||||
if (!isLiveTab)
|
||||
tvUnitName.setVisibility(View.GONE);
|
||||
else
|
||||
tvUnitName.setText(name);
|
||||
|
||||
tvSpeed.setText(speed);
|
||||
tvGPSLocation.setText(gpsLocation);
|
||||
}
|
||||
}
|
||||
|
@ -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.historyActivity = 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.dropAllData =false;
|
||||
parentTab.firstHistData = true;
|
||||
parentTab.HistMsgList.clear();
|
||||
parentTab.HistPosList.clear();
|
||||
|
||||
// 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.demoPositions);
|
||||
}
|
||||
});
|
||||
|
||||
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.HistPosList.toString());
|
||||
SM.Debug("Do the Display");
|
||||
infoBubble.setHistoryPositions(parentTab.HistPosList);
|
||||
displayHistory(parentTab.HistPosList);
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentActivity;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -673,10 +673,10 @@ public class RadioActivity extends Activity {
|
||||
dialog.setCancelable(true);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
|
||||
TextView text = (TextView) dialog.findViewById(R.id.text);
|
||||
ImageView image = (ImageView) dialog.findViewById(R.id.image);
|
||||
TextView text = dialog.findViewById(R.id.text);
|
||||
ImageView image = dialog.findViewById(R.id.image);
|
||||
|
||||
image.setImageResource(R.drawable.ic_launcher);
|
||||
image.setImageResource(R.mipmap.ic_launcher);
|
||||
text.setText(errorMsg);
|
||||
dialog.show();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -184,10 +184,10 @@ public class RecordingsActivity extends Activity {
|
||||
dialog.setCancelable(true);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
|
||||
TextView text = (TextView) dialog.findViewById(R.id.text);
|
||||
ImageView image = (ImageView) dialog.findViewById(R.id.image);
|
||||
TextView text = dialog.findViewById(R.id.text);
|
||||
ImageView image = dialog.findViewById(R.id.image);
|
||||
|
||||
image.setImageResource(R.drawable.ic_launcher);
|
||||
image.setImageResource(R.mipmap.ic_launcher);
|
||||
text.setText(errorMsg);
|
||||
dialog.show();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package com.safemobile.dispatch;
|
||||
package com.safemobile.safedispatch;
|
||||
|
||||
import java.util.Locale;
|
||||
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 207 KiB |
Before Width: | Height: | Size: 66 KiB |
BIN
safeDispatch/src/main/res/drawable-hdpi/safedispatch_logo.png
Normal file
After Width: | Height: | Size: 145 KiB |
BIN
safeDispatch/src/main/res/drawable-mdpi/history_pin.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@ -11,7 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_launcher"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -24,7 +24,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_launcher"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:contentDescription="image for dialog"
|
||||
/>
|
||||
<LinearLayout
|
||||
|
@ -7,7 +7,7 @@
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_launcher"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:id="@+id/tab1Layout" android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/tab1Layout"
|
||||
android:orientation="horizontal"
|
||||
style="?bg">
|
||||
|
||||
<RelativeLayout
|
||||
@ -162,10 +164,11 @@
|
||||
android:text="@string/startDate"
|
||||
android:textSize="22dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:layout_marginTop="15sp"
|
||||
android:textColor="#000000"
|
||||
android:gravity="left"
|
||||
android:id="@+id/labelStartDate"
|
||||
android:visibility="gone"/>
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutStartPicker"
|
||||
android:layout_height="wrap_content"
|
||||
@ -202,7 +205,7 @@
|
||||
android:textColor="#000000"
|
||||
android:gravity="left"
|
||||
android:id="@+id/labelEndDate"
|
||||
android:visibility="gone"/>
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutEndPicker"
|
||||
android:layout_height="wrap_content"
|
||||
@ -284,14 +287,15 @@
|
||||
</LinearLayout>
|
||||
|
||||
<fragment
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/map"
|
||||
android:layout_toRightOf="@id/slidelayout"
|
||||
android:layout_weight="1"
|
||||
tools:context=".HistoryActivity"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/changeMapType"
|
||||
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">SafeMobile Dispatch</string>
|
||||
<string name="app_name_demo">SafeMobile Dispatch Demo</string>
|
||||
<string name="app_name">SafeDispatch Mobile</string>
|
||||
<string name="app_name_demo">SafeDispatch Mobile Demo</string>
|
||||
<string name="app_name_radiopod">RadioPod</string>
|
||||
<string name="app_name_radiopad">RadioPad</string>
|
||||
<string name="app_name_radiopodd">RadioPod</string>
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
<style name="mainBackground_sd">
|
||||
<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>
|
||||
</style>
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
</style>
|
||||
|
||||
<style name="bg_sd">
|
||||
<item name="android:background">@drawable/safedispatch</item>
|
||||
<item name="android:background">@drawable/safedispatch_logo</item>
|
||||
</style>
|
||||
|
||||
<style name="header_sd">
|
||||
@ -155,7 +155,7 @@
|
||||
|
||||
<style name="mainBackground_hy">
|
||||
<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>
|
||||
</style>
|
||||
|
||||
@ -211,7 +211,7 @@
|
||||
</style>
|
||||
|
||||
<style name="bg_hy">
|
||||
<item name="android:background">@drawable/safedispatch</item>
|
||||
<item name="android:background">@drawable/safedispatch_logo</item>
|
||||
</style>
|
||||
|
||||
<style name="header_hy">
|
||||
@ -228,7 +228,7 @@
|
||||
|
||||
<style name="mainBackground_vi">
|
||||
<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>
|
||||
</style>
|
||||
|
||||
@ -285,7 +285,7 @@
|
||||
</style>
|
||||
|
||||
<style name="bg_vi">
|
||||
<item name="android:background">@drawable/safedispatch</item>
|
||||
<item name="android:background">@drawable/safedispatch_logo</item>
|
||||
</style>
|
||||
|
||||
<style name="header_vi">
|
||||
|