Compare commits
21 Commits
features/S
...
feature/ne
Author | SHA1 | Date | |
---|---|---|---|
2855e9bde6 | |||
ee8bfe56b4 | |||
d519a2be14 | |||
1b3912c682 | |||
ba9383248c | |||
07127cea18 | |||
6a235d1d3f | |||
bac12825c9 | |||
bbed107c42 | |||
bca16caf94 | |||
0b887deb99 | |||
c85dc279dc | |||
db360c4d45 | |||
89f8cbfcae | |||
456c27b829 | |||
8127caa949 | |||
4420af337d | |||
6b6543ca3f | |||
f554356af1 | |||
2540b5f511 | |||
0fabbc73be |
@ -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 {
|
||||||
|
@ -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>
|
||||||
|
@ -155,12 +155,12 @@ public abstract class AbstractSDParentActivity extends TabActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean sendAlarmAcknowledge(int alarm_id, int type)
|
public boolean sendAlarmAcknowledge(int alarm_id, int type, String unitName)
|
||||||
{
|
{
|
||||||
if(tcp == null)
|
if(tcp == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean res = tcp.Write("0.0", "#28#" + alarm_id + "#" + type + "#");
|
boolean res = tcp.Write("0.0", "#28#" + alarm_id + "#" + type + "#" + AppParams.USERID + "#" + unitName + "#");
|
||||||
if(res)
|
if(res)
|
||||||
SM.Debug("Message [sendAlarmAcknowledge] sent to app server alarm_id:" + alarm_id + " type:" + type);
|
SM.Debug("Message [sendAlarmAcknowledge] sent to app server alarm_id:" + alarm_id + " type:" + type);
|
||||||
else
|
else
|
||||||
@ -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;
|
||||||
|
|
||||||
|
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,5 +1,24 @@
|
|||||||
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
|
||||||
@ -9,6 +28,9 @@ android {
|
|||||||
applicationId "com.safemobile.dispatch"
|
applicationId "com.safemobile.dispatch"
|
||||||
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')
|
||||||
|
20
safeDispatch/release/output-metadata.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "com.safemobile.dispatch",
|
||||||
|
"variantName": "release",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"attributes": [],
|
||||||
|
"versionCode": 8000033,
|
||||||
|
"versionName": "8.0.33",
|
||||||
|
"outputFile": "SafeDispatchMobile_v.8.0.33-release.apk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"elementType": "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.dispatch">
|
||||||
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
|
||||||
@ -28,7 +25,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">
|
||||||
|
BIN
safeDispatch/src/main/ic_launcher-playstore.png
Normal file
After Width: | Height: | Size: 18 KiB |
@ -3,7 +3,6 @@ package com.safemobile.dispatch;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/** fix import*/
|
|
||||||
import com.safemobile.adapters.AlertGridViewAdapter;
|
import com.safemobile.adapters.AlertGridViewAdapter;
|
||||||
import com.safemobile.adapters.AlertGridViewAdapter.ViewHolder;
|
import com.safemobile.adapters.AlertGridViewAdapter.ViewHolder;
|
||||||
|
|
||||||
@ -15,11 +14,11 @@ import com.safemobile.lib.SM;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -28,30 +27,33 @@ import android.widget.GridView;
|
|||||||
|
|
||||||
public class AlarmActivity extends Activity {
|
public class AlarmActivity extends Activity {
|
||||||
private Context context;
|
private Context context;
|
||||||
public TabLayoutActivity parentTab;
|
private TabLayoutActivity parentTab;
|
||||||
public ArrayList<Alarm> allAlarms = new ArrayList<Alarm>();
|
private ArrayList<Alarm> allAlarms = new ArrayList<>();
|
||||||
private ArrayList<Boolean> acknowledged = new ArrayList<Boolean>();
|
private ArrayList<Boolean> acknowledged = new ArrayList<>();
|
||||||
private AlertGridViewAdapter adapter;
|
private AlertGridViewAdapter adapter;
|
||||||
|
|
||||||
/* Visual resources */
|
/* Visual resources */
|
||||||
private GridView gridView;
|
private GridView gridView;
|
||||||
public View convertViewAlarm;
|
private View convertViewAlarm;
|
||||||
|
|
||||||
private int ack_position;
|
private int ackPosition;
|
||||||
|
private Bundle savedInstanceState;
|
||||||
public Bundle savedInstanceState;
|
|
||||||
|
|
||||||
// Need handler for callbacks to the UI thread
|
// Need handler for callbacks to the UI thread
|
||||||
private final Handler myHandler = new Handler();
|
private final Handler myHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
private static final String ALARM = "alarm";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the activity is first created.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
this.savedInstanceState = savedInstanceState;
|
this.setSavedInstanceState(savedInstanceState);
|
||||||
// get parentTab
|
// get parentTab
|
||||||
parentTab = (TabLayoutActivity)getParent();
|
setParentTab((TabLayoutActivity) getParent());
|
||||||
|
|
||||||
Locale locale = new Locale(AppParams.LANGUAGETMP);
|
Locale locale = new Locale(AppParams.LANGUAGETMP);
|
||||||
Locale.setDefault(locale);
|
Locale.setDefault(locale);
|
||||||
@ -60,200 +62,178 @@ public class AlarmActivity extends Activity {
|
|||||||
getBaseContext().getResources().updateConfiguration(config,
|
getBaseContext().getResources().updateConfiguration(config,
|
||||||
getBaseContext().getResources().getDisplayMetrics());
|
getBaseContext().getResources().getDisplayMetrics());
|
||||||
|
|
||||||
|
|
||||||
context = this;
|
context = this;
|
||||||
setContentView(R.layout.tabalarm);
|
setContentView(R.layout.tabalarm);
|
||||||
|
|
||||||
gridView = (GridView) findViewById(R.id.gridViewAlarms);
|
gridView = findViewById(R.id.gridViewAlarms);
|
||||||
adapter = new AlertGridViewAdapter(this, allAlarms, context, acknowledged);
|
adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged);
|
||||||
gridView.setAdapter(adapter);
|
gridView.setAdapter(adapter);
|
||||||
|
|
||||||
gridView.setOnItemClickListener(onItemClickListener);
|
gridView.setOnItemClickListener(onItemClickListener);
|
||||||
|
|
||||||
// change tab header fontface
|
// change tab header fontFace
|
||||||
TextView textView1 = (TextView) findViewById(R.id.textView1);
|
TextView textView1 = findViewById(R.id.textView1);
|
||||||
textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf"));
|
textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf"));
|
||||||
textView1.setTextSize(24);
|
textView1.setTextSize(24);
|
||||||
|
|
||||||
parentTab.alarmActivity = this;
|
getParentTab().alarmActivity = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed()
|
public void onBackPressed() {
|
||||||
{
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setMessage(getString(R.string.exit))
|
builder.setMessage(getString(R.string.exit))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setNeutralButton(getString(R.string.logout), new DialogInterface.OnClickListener() {
|
.setNeutralButton(getString(R.string.logout), (dialog, id) -> getParentTab().whenBackPressed(AppParams.ActivityResult.logout))
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
.setPositiveButton(getString(R.string.ext), (dialog, id) -> getParentTab().whenBackPressed(AppParams.ActivityResult.exit))
|
||||||
parentTab.whenBackPressed(AppParams.ActivityResult.logout);
|
.setNegativeButton(getString(R.string.cancel), (dialog, id) -> dialog.cancel());
|
||||||
}
|
|
||||||
})
|
|
||||||
.setPositiveButton(getString(R.string.ext), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
parentTab.whenBackPressed(AppParams.ActivityResult.exit);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
dialog.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause()
|
public void onPause() {
|
||||||
{
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
SM.Debug("onPause");
|
SM.Debug("onPause");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume() {
|
||||||
{
|
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if(!AppParams.DEMO)
|
if (!AppParams.DEMO)
|
||||||
GetAlarms();
|
getAlarms();
|
||||||
else if (AppParams.DEMO)
|
else {
|
||||||
{
|
for (int i = getAllAlarms().size() - 1; i >= 0; i--) {
|
||||||
for(int i=allAlarms.size()-1; i>=0; i--)
|
Alarm alarm = getAllAlarms().get(i);
|
||||||
{
|
if (alarm.ack == 1)
|
||||||
Alarm alarm = allAlarms.get(i);
|
getAllAlarms().remove(i);
|
||||||
if(alarm.ack==1)
|
|
||||||
allAlarms.remove(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acknowledged = new ArrayList<Boolean>();
|
acknowledged = new ArrayList<>();
|
||||||
|
|
||||||
for(int i=0;i<allAlarms.size();i++)
|
for (int i = 0; i < getAllAlarms().size(); i++)
|
||||||
acknowledged.add(false);
|
acknowledged.add(false);
|
||||||
updateResultsInUi("alarm");
|
updateResultsInUi(ALARM);
|
||||||
}
|
}
|
||||||
SM.Debug("onResume");
|
SM.Debug("onResume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private OnItemClickListener onItemClickListener = new OnItemClickListener() {
|
private final OnItemClickListener onItemClickListener = new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
|
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
|
||||||
long arg3) {
|
long arg3) {
|
||||||
SM.Debug(" ### CLICK Alarm : " + position);
|
SM.Debug(" ### CLICK Alarm : " + position);
|
||||||
convertViewAlarm = arg1;
|
setConvertViewAlarm(arg1);
|
||||||
// save position
|
// save position
|
||||||
ack_position = position;
|
ackPosition = position;
|
||||||
//Toast.makeText(context, "SETACK " + idx, 1000).show();
|
if (!AppParams.DEMO)
|
||||||
if(!AppParams.DEMO)
|
setACK(getAllAlarms().get(position).idx, getAllAlarms().get(position).type, getAllAlarms().get(position).unitName);
|
||||||
setACK(allAlarms.get(position).idx,allAlarms.get(position).type);
|
else {
|
||||||
else
|
getAllAlarms().get(position).ack = 1;
|
||||||
{
|
|
||||||
allAlarms.get(position).ack = 1;
|
|
||||||
updateResultsInUi("else");
|
updateResultsInUi("else");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send ACK to AppServer
|
||||||
|
private void setACK(int idx, int type, String unitName) {
|
||||||
|
getParentTab().executeNetworkStuff(new String[]{OperationCodes.SendAlarmAcknoledge + "", idx + "", type + "", unitName});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update Alarms received from AppServer
|
// Update Alarms received from AppServer
|
||||||
public void UpdateAlarms(ArrayList<Alarm> list)
|
public void updateAlarms(ArrayList<Alarm> list) {
|
||||||
{
|
SM.Debug("## updateAlarms: " + list.size());
|
||||||
SM.Debug("## UpdateAlarms: " + list.size());
|
setAllAlarms(list);
|
||||||
allAlarms = list;
|
acknowledged = new ArrayList<>();
|
||||||
acknowledged = new ArrayList<Boolean>();
|
|
||||||
// set acknowledged based on alarm.ack value
|
// set acknowledged based on alarm.ack value
|
||||||
|
|
||||||
for(Alarm alarm: allAlarms)
|
for (Alarm alarm : getAllAlarms()) {
|
||||||
{
|
acknowledged.add(alarm.ack == 1);
|
||||||
acknowledged.add((alarm.ack == 1)? true: false);
|
|
||||||
SM.Debug("ALARM", "SC_ID> " + alarm.sc_id + " | "
|
SM.Debug("ALARM", "SC_ID> " + alarm.sc_id + " | "
|
||||||
+ (parentTab.getVehHashByScId().get(alarm.sc_id) == null ? "null" : parentTab.getVehHashByScId().get(alarm.sc_id).name ));
|
+ (getParentTab().getVehHashByScId().get(alarm.sc_id) == null ? "null" : getParentTab().getVehHashByScId().get(alarm.sc_id).name));
|
||||||
|
|
||||||
|
|
||||||
if (parentTab.getVehHashByScId().get(alarm.sc_id)!=null)
|
if (getParentTab().getVehHashByScId().get(alarm.sc_id) != null)
|
||||||
alarm.unitName = parentTab.getVehHashByScId().get(alarm.sc_id).name;
|
alarm.unitName = getParentTab().getVehHashByScId().get(alarm.sc_id).name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*Enumeration<Long> keylist = parentTab.SuperVehHash.keys();
|
|
||||||
while(keylist.hasMoreElements())
|
|
||||||
{
|
|
||||||
SuperVehicle tmp = (SuperVehicle)((parentTab.SuperVehHash.get((long)keylist.nextElement())));
|
|
||||||
if (tmp.sc_id==alarm.sc_id)
|
|
||||||
{
|
|
||||||
alarm.unitName = tmp.name;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}*/
|
myHandler.post(updateResultsRUN);
|
||||||
}
|
|
||||||
|
|
||||||
myHandler.post(UpdateResultsRUN);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create runnable for posting
|
// Create runnable for posting
|
||||||
final Runnable UpdateResultsRUN = new Runnable() {
|
final Runnable updateResultsRUN = () -> updateResultsInUi(ALARM);
|
||||||
public void run() {
|
|
||||||
updateResultsInUi("alarm");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void updateResultsInUi(String param)
|
private void updateResultsInUi(String param) {
|
||||||
{
|
if (param.equals(ALARM)) {
|
||||||
if(param.equals("alarm"))
|
|
||||||
{
|
|
||||||
// set adapter
|
// set adapter
|
||||||
adapter = new AlertGridViewAdapter(this, allAlarms, context, acknowledged);
|
adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged);
|
||||||
gridView.setAdapter(adapter);
|
gridView.setAdapter(adapter);
|
||||||
}
|
} else {
|
||||||
else
|
adapter.changeACK(ackPosition);
|
||||||
{
|
SM.Debug("Set ACK: " + ackPosition + " | " + (Boolean.TRUE.equals(acknowledged.get(ackPosition)) ? "true" : "false"));
|
||||||
adapter.changeACK(ack_position);
|
|
||||||
SM.Debug("Set ACK: " + ack_position + " | " + (acknowledged.get(ack_position) ? "true": "false"));
|
|
||||||
|
|
||||||
ViewHolder viewAlarm = new ViewHolder();
|
ViewHolder viewAlarm;
|
||||||
viewAlarm = (ViewHolder) convertViewAlarm.getTag();
|
viewAlarm = (ViewHolder) getConvertViewAlarm().getTag();
|
||||||
|
|
||||||
switch(acknowledged.get(ack_position) ? 1 : 0)
|
switch (Boolean.TRUE.equals(acknowledged.get(ackPosition)) ? 1 : 0) {
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
viewAlarm.imageViewAlert.setImageResource(R.drawable.alert_off);
|
viewAlarm.imageViewAlert.setImageResource(R.drawable.alert_off);
|
||||||
//view.imgViewIcon.setImageDrawable(adapter.convertToGrayscale(activity.getResources().getDrawable(liveVehicle.get(position).getSmallIcon())));
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
//view.imgViewAlarm.setImageResource(R.drawable.siren);
|
viewAlarm.imageViewAlert.setImageResource(R.drawable.siren);
|
||||||
//view.imgViewIcon.setImageResource(liveVehicle.get(position).getSmallIcon());
|
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unexpected value: " + (Boolean.TRUE.equals(acknowledged.get(ackPosition)) ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update ACK received from AppServer
|
// update ACK received from AppServer
|
||||||
public void UpdateACK()
|
public void updateACK() {
|
||||||
{
|
myHandler.post(updateAckRUN);
|
||||||
myHandler.post(UpdateAckRUN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create runnable for posting
|
// Create runnable for posting
|
||||||
final Runnable UpdateAckRUN = new Runnable() {
|
final Runnable updateAckRUN = () -> {
|
||||||
public void run() {
|
SM.Debug(" updateACK: ");
|
||||||
SM.Debug(" UpdateACK: ");
|
|
||||||
updateResultsInUi("adapter");
|
updateResultsInUi("adapter");
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// send to AppServer
|
// send to AppServer
|
||||||
private void GetAlarms()
|
private void getAlarms() {
|
||||||
{
|
getParentTab().executeNetworkStuff(new String[]{OperationCodes.GetAlarms + "", AppParams.USERID + ""});
|
||||||
parentTab.executeNetworkStuff(new String[]{OperationCodes.GetAlarms +"", AppParams.USERID + ""});
|
|
||||||
//parentTab.getAlarms(AppParams.USERID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// send ACK to AppServer
|
public TabLayoutActivity getParentTab() {
|
||||||
private void setACK(int idx, int type)
|
return parentTab;
|
||||||
{
|
}
|
||||||
parentTab.executeNetworkStuff(new String[]{OperationCodes.SendAlarmAcknoledge +"", idx + "", type + ""});
|
|
||||||
//parentTab.sendAlarmAcknowledge(idx, type);
|
public void setParentTab(TabLayoutActivity parentTab) {
|
||||||
|
this.parentTab = parentTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Alarm> getAllAlarms() {
|
||||||
|
return allAlarms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllAlarms(ArrayList<Alarm> allAlarms) {
|
||||||
|
this.allAlarms = allAlarms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getConvertViewAlarm() {
|
||||||
|
return convertViewAlarm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConvertViewAlarm(View convertViewAlarm) {
|
||||||
|
this.convertViewAlarm = convertViewAlarm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bundle getSavedInstanceState() {
|
||||||
|
return savedInstanceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSavedInstanceState(Bundle savedInstanceState) {
|
||||||
|
this.savedInstanceState = savedInstanceState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
if (isLiveTab) {
|
||||||
try {
|
try {
|
||||||
key = Long.parseLong(marker.getTitle());
|
key = Long.parseLong(marker.getTitle());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title");
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,33 @@
|
|||||||
package com.safemobile.dispatch;
|
package com.safemobile.dispatch;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
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.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||||
import com.google.android.gms.maps.GoogleMap;
|
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.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.AppParams;
|
||||||
|
import com.safemobile.lib.HistPos;
|
||||||
|
import com.safemobile.lib.OperationCodes;
|
||||||
import com.safemobile.lib.SM;
|
import com.safemobile.lib.SM;
|
||||||
import com.safemobile.lib.Vehicle;
|
import com.safemobile.lib.Vehicle;
|
||||||
|
|
||||||
@ -21,19 +37,21 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class HistoryActivity extends AppCompatActivity {
|
public class HistoryActivity extends AppCompatActivity implements OnMapReadyCallback {
|
||||||
|
|
||||||
public Bundle savedInstanceState;
|
public Bundle savedInstanceState;
|
||||||
private TabLayoutActivity parentTab;
|
private TabLayoutActivity parentTab;
|
||||||
private GoogleMap googleMap;
|
private GoogleMap googleMap;
|
||||||
private Spinner spinnerVehicle;
|
private Spinner spinnerVehicle;
|
||||||
private ImageView changeMapType, checkTraffic, slideLayoutImage;
|
private Button displayButton;
|
||||||
private LinearLayout layoutTraffic, slidelayout, layoutVehicles;
|
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");
|
||||||
|
|
||||||
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
|
||||||
private ArrayList<String> allVehicleNames = new ArrayList<>();
|
|
||||||
private ArrayAdapter<String> adapter;
|
|
||||||
private boolean showVehicle = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -47,14 +65,15 @@ public class HistoryActivity extends AppCompatActivity {
|
|||||||
Locale locale = new Locale(AppParams.LANGUAGETMP);
|
Locale locale = new Locale(AppParams.LANGUAGETMP);
|
||||||
Locale.setDefault(locale);
|
Locale.setDefault(locale);
|
||||||
|
|
||||||
googleMap = parentTab.liveActivity.getMap();
|
|
||||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||||
.findFragmentById(R.id.map);
|
.findFragmentById(R.id.map);
|
||||||
|
if (mapFragment != null)
|
||||||
|
mapFragment.getMapAsync(this);
|
||||||
|
|
||||||
spinnerVehicle = findViewById(R.id.spinnerVehicle);
|
spinnerVehicle = findViewById(R.id.spinnerVehicle);
|
||||||
getVehicles();
|
getVehicles();
|
||||||
|
|
||||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, allVehicleNames);
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, allVehicleNames);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
|
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
|
||||||
spinnerVehicle.setAdapter(adapter);
|
spinnerVehicle.setAdapter(adapter);
|
||||||
spinnerVehicle.setSelection(0);
|
spinnerVehicle.setSelection(0);
|
||||||
@ -62,49 +81,87 @@ public class HistoryActivity extends AppCompatActivity {
|
|||||||
changeMapType();
|
changeMapType();
|
||||||
changeTraffic();
|
changeTraffic();
|
||||||
|
|
||||||
slidelayout = findViewById(R.id.slidelayout);
|
displayButton = findViewById(R.id.buttonDisplay);
|
||||||
slideLayoutImage = findViewById(R.id.slideLayoutImage);
|
displayButton.setOnClickListener(view -> {
|
||||||
layoutVehicles = findViewById(R.id.layoutBig);
|
googleMap.clear();
|
||||||
// slidelayout.setOnTouchListener((v, event) -> {
|
if (!AppParams.DEMO) {
|
||||||
// if (showVehicle) {
|
parentTab.dropAllData =false;
|
||||||
// layoutVehicles.setVisibility(View.GONE);
|
parentTab.firstHistData = true;
|
||||||
// slideLayoutImage.setImageResource(R.drawable.arrow_right);
|
parentTab.HistMsgList.clear();
|
||||||
// showVehicle = false;
|
parentTab.HistPosList.clear();
|
||||||
// } else {
|
|
||||||
// layoutVehicles.setVisibility(View.VISIBLE);
|
// request history
|
||||||
// slideLayoutImage.setImageResource(R.drawable.arrow_left);
|
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetHistoryPositions + "", allVehicle.get(spinnerVehicle.getSelectedItemPosition()).sc_id + "",
|
||||||
// showVehicle = true;
|
(startDate.getTime()/ 1000L) + "", (endDate.getTime()/ 1000L) + ""});
|
||||||
// }
|
} else {
|
||||||
// return false;
|
parentTab.demoPositionsList();
|
||||||
// });
|
displayHistory(parentTab.demoPositions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setDate();
|
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() {
|
private void setDate() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
Date endDate = calendar.getTime();
|
endDate = calendar.getTime();
|
||||||
calendar.add(Calendar.DATE, -1);
|
calendar.add(Calendar.DATE, -1);
|
||||||
Date startDate = calendar.getTime();
|
startDate = calendar.getTime();
|
||||||
|
|
||||||
LinearLayout layoutStartPicker = findViewById(R.id.layoutStartPicker);
|
TextView textViewStartDate = findViewById(R.id.textViewStartDate);
|
||||||
TextView textViewDate = findViewById(R.id.textViewStartDate);
|
TextView textViewEndDate = findViewById(R.id.textViewEndDate);
|
||||||
|
|
||||||
textViewDate.setText(new SimpleDateFormat("HH:mm, dd.MM.yyyy").format(startDate));
|
textViewStartDate.setText(sdf.format(startDate));
|
||||||
// layoutStartPicker.setOnTouchListener((v, event) -> {
|
textViewEndDate.setText(sdf.format(endDate));
|
||||||
// showDialog(layoutStartPicker);
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// layoutEndPicker.setOnTouchListener(new OnTouchListener() {
|
textViewStartDate.setOnClickListener(view -> openDialog(textViewStartDate, true));
|
||||||
// @Override
|
textViewEndDate.setOnClickListener(view -> openDialog(textViewEndDate, false));
|
||||||
// public boolean onTouch(View v, MotionEvent event) {
|
}
|
||||||
// showDialog(layoutEndPicker);
|
|
||||||
// return 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() {
|
private void changeTraffic() {
|
||||||
@ -121,14 +178,13 @@ public class HistoryActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void changeMapType() {
|
private void changeMapType() {
|
||||||
changeMapType = findViewById(R.id.changeMapType);
|
ImageView changeMapType = findViewById(R.id.changeMapType);
|
||||||
ImageView changeMapTypeImageView = findViewById(R.id.changeMapType);
|
|
||||||
changeMapType.setOnClickListener(view -> {
|
changeMapType.setOnClickListener(view -> {
|
||||||
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
|
if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) {
|
||||||
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
changeMapType.setImageResource(R.drawable.satellite);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||||
} else {
|
} else {
|
||||||
changeMapTypeImageView.setImageResource(R.drawable.map);
|
changeMapType.setImageResource(R.drawable.map);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -136,15 +192,27 @@ public class HistoryActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void getVehicles() {
|
public void getVehicles() {
|
||||||
try {
|
try {
|
||||||
|
allVehicle.clear();
|
||||||
|
allVehicleNames.clear();
|
||||||
for (Vehicle vehicle : parentTab.getAllVehicle()) {
|
for (Vehicle vehicle : parentTab.getAllVehicle()) {
|
||||||
allVehicleNames.add(vehicle.name);
|
allVehicleNames.add(vehicle.name);
|
||||||
allVehicle.add(vehicle);
|
allVehicle.add(vehicle);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) { }
|
} 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() {
|
public void UpdateMap() {
|
||||||
|
myHandler.post(UpdateMapResults);
|
||||||
SM.Debug("Do the updateMAP post");
|
SM.Debug("Do the updateMAP post");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,4 +227,15 @@ public class HistoryActivity extends AppCompatActivity {
|
|||||||
public void UpdateNrPos(int size) {
|
public void UpdateNrPos(int size) {
|
||||||
SM.Debug("Do Cancelwindow");
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
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_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"
|
||||||
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
@ -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"
|
||||||
|
@ -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"?>
|
<?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>
|
||||||
|
@ -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">
|
||||||
|