Compare commits
No commits in common. "07127cea189eb0fb79cdb6647932760d5e8df048" and "456c27b82989c2b629b8acaec003011f600c0605" have entirely different histories.
07127cea18
...
456c27b829
@ -198,11 +198,12 @@ 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."+ (int) (System.currentTimeMillis() / 1000L);
|
String histSeqID = "1."+Integer.toString((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");
|
||||||
@ -212,7 +213,8 @@ 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;
|
||||||
|
|
||||||
|
@ -1,24 +1,5 @@
|
|||||||
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
|
||||||
@ -28,9 +9,6 @@ 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 {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?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"
|
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
|
||||||
|
@ -12,12 +12,10 @@ 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;
|
||||||
@ -27,10 +25,8 @@ 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 Hashtable<Long, SuperVehicle> superVehHash;
|
private final 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) {
|
||||||
@ -39,17 +35,6 @@ 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);
|
||||||
@ -64,21 +49,13 @@ 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 {
|
|
||||||
key = Long.parseLong(marker.getTitle());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
position = Integer.getInteger(marker.getTitle());
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.v(TAG, "Unable to parse Google Maps Info Bubble title on History");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
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);
|
||||||
@ -90,39 +67,27 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
|
|||||||
rlMapInfoBubbleInfo.setVisibility(View.VISIBLE);
|
rlMapInfoBubbleInfo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
boolean isMilitaryTime = false;
|
boolean isMilitaryTime = false;
|
||||||
Date positionTime;
|
Date positionTime = new Date(vehicle.timeGMT);
|
||||||
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);
|
||||||
if (!isLiveTab)
|
tvUnitName.setText(vehicle.name);
|
||||||
tvUnitName.setVisibility(View.GONE);
|
tvGPSLocation.setText("[" + String.format("%.4f", vehicle.lat)
|
||||||
else
|
+ "," + String.format("%.4f",vehicle.lng) + "]");
|
||||||
tvUnitName.setText(name);
|
|
||||||
|
|
||||||
tvSpeed.setText(speed);
|
|
||||||
tvGPSLocation.setText(gpsLocation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,17 @@
|
|||||||
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;
|
||||||
|
|
||||||
@ -37,21 +21,19 @@ 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 implements OnMapReadyCallback {
|
public class HistoryActivity extends AppCompatActivity {
|
||||||
|
|
||||||
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 Button displayButton;
|
private ImageView changeMapType, checkTraffic, slideLayoutImage;
|
||||||
private Date startDate, endDate;
|
private LinearLayout layoutTraffic, slidelayout, layoutVehicles;
|
||||||
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) {
|
||||||
@ -65,15 +47,14 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
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();
|
||||||
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, allVehicleNames);
|
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);
|
||||||
@ -81,87 +62,49 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
changeMapType();
|
changeMapType();
|
||||||
changeTraffic();
|
changeTraffic();
|
||||||
|
|
||||||
displayButton = findViewById(R.id.buttonDisplay);
|
slidelayout = findViewById(R.id.slidelayout);
|
||||||
displayButton.setOnClickListener(view -> {
|
slideLayoutImage = findViewById(R.id.slideLayoutImage);
|
||||||
googleMap.clear();
|
layoutVehicles = findViewById(R.id.layoutBig);
|
||||||
if (!AppParams.DEMO) {
|
// slidelayout.setOnTouchListener((v, event) -> {
|
||||||
parentTab.dropAllData =false;
|
// if (showVehicle) {
|
||||||
parentTab.firstHistData = true;
|
// layoutVehicles.setVisibility(View.GONE);
|
||||||
parentTab.HistMsgList.clear();
|
// slideLayoutImage.setImageResource(R.drawable.arrow_right);
|
||||||
parentTab.HistPosList.clear();
|
// showVehicle = false;
|
||||||
|
// } else {
|
||||||
// request history
|
// layoutVehicles.setVisibility(View.VISIBLE);
|
||||||
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetHistoryPositions + "", allVehicle.get(spinnerVehicle.getSelectedItemPosition()).sc_id + "",
|
// slideLayoutImage.setImageResource(R.drawable.arrow_left);
|
||||||
(startDate.getTime()/ 1000L) + "", (endDate.getTime()/ 1000L) + ""});
|
// showVehicle = true;
|
||||||
} else {
|
// }
|
||||||
parentTab.demoPositionsList();
|
// return false;
|
||||||
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();
|
||||||
endDate = calendar.getTime();
|
Date endDate = calendar.getTime();
|
||||||
calendar.add(Calendar.DATE, -1);
|
calendar.add(Calendar.DATE, -1);
|
||||||
startDate = calendar.getTime();
|
Date startDate = calendar.getTime();
|
||||||
|
|
||||||
TextView textViewStartDate = findViewById(R.id.textViewStartDate);
|
LinearLayout layoutStartPicker = findViewById(R.id.layoutStartPicker);
|
||||||
TextView textViewEndDate = findViewById(R.id.textViewEndDate);
|
TextView textViewDate = findViewById(R.id.textViewStartDate);
|
||||||
|
|
||||||
textViewStartDate.setText(sdf.format(startDate));
|
textViewDate.setText(new SimpleDateFormat("HH:mm, dd.MM.yyyy").format(startDate));
|
||||||
textViewEndDate.setText(sdf.format(endDate));
|
// layoutStartPicker.setOnTouchListener((v, event) -> {
|
||||||
|
// showDialog(layoutStartPicker);
|
||||||
|
// return false;
|
||||||
|
// });
|
||||||
|
|
||||||
textViewStartDate.setOnClickListener(view -> openDialog(textViewStartDate, true));
|
// layoutEndPicker.setOnTouchListener(new OnTouchListener() {
|
||||||
textViewEndDate.setOnClickListener(view -> openDialog(textViewEndDate, false));
|
// @Override
|
||||||
}
|
// 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() {
|
||||||
@ -178,13 +121,14 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void changeMapType() {
|
private void changeMapType() {
|
||||||
ImageView changeMapType = findViewById(R.id.changeMapType);
|
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) {
|
||||||
changeMapType.setImageResource(R.drawable.satellite);
|
changeMapTypeImageView.setImageResource(R.drawable.satellite);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||||
} else {
|
} else {
|
||||||
changeMapType.setImageResource(R.drawable.map);
|
changeMapTypeImageView.setImageResource(R.drawable.map);
|
||||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -192,27 +136,15 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
|
|
||||||
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 ignored) { }
|
} catch (Exception ex) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,15 +159,4 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
@ -162,11 +162,10 @@
|
|||||||
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"
|
||||||
@ -203,7 +202,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"
|
||||||
@ -285,15 +284,14 @@
|
|||||||
</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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user