Compare commits
No commits in common. "89f8cbfcae30366c8221ed73f3b851d37b3ec59a" and "0fabbc73befee0b71d66626bb4b8399982e974ed" have entirely different histories.
89f8cbfcae
...
0fabbc73be
@ -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,30 +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.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.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.Polyline;
|
|
||||||
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;
|
||||||
|
|
||||||
@ -34,7 +21,7 @@ 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;
|
||||||
@ -42,9 +29,6 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
private Spinner spinnerVehicle;
|
private Spinner spinnerVehicle;
|
||||||
private ImageView changeMapType, checkTraffic, slideLayoutImage;
|
private ImageView changeMapType, checkTraffic, slideLayoutImage;
|
||||||
private LinearLayout layoutTraffic, slidelayout, layoutVehicles;
|
private LinearLayout layoutTraffic, slidelayout, layoutVehicles;
|
||||||
private Button displayButton;
|
|
||||||
private Date startDate, endDate;
|
|
||||||
private final Handler myHandler = new Handler();
|
|
||||||
|
|
||||||
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
private ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
||||||
private ArrayList<String> allVehicleNames = new ArrayList<>();
|
private ArrayList<String> allVehicleNames = new ArrayList<>();
|
||||||
@ -63,9 +47,9 @@ 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);
|
||||||
mapFragment.getMapAsync(this);
|
|
||||||
|
|
||||||
spinnerVehicle = findViewById(R.id.spinnerVehicle);
|
spinnerVehicle = findViewById(R.id.spinnerVehicle);
|
||||||
getVehicles();
|
getVehicles();
|
||||||
@ -81,23 +65,6 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
slidelayout = findViewById(R.id.slidelayout);
|
slidelayout = findViewById(R.id.slidelayout);
|
||||||
slideLayoutImage = findViewById(R.id.slideLayoutImage);
|
slideLayoutImage = findViewById(R.id.slideLayoutImage);
|
||||||
layoutVehicles = findViewById(R.id.layoutBig);
|
layoutVehicles = findViewById(R.id.layoutBig);
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// slidelayout.setOnTouchListener((v, event) -> {
|
// slidelayout.setOnTouchListener((v, event) -> {
|
||||||
// if (showVehicle) {
|
// if (showVehicle) {
|
||||||
// layoutVehicles.setVisibility(View.GONE);
|
// layoutVehicles.setVisibility(View.GONE);
|
||||||
@ -114,29 +81,11 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
setDate();
|
setDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayHistory(ArrayList<HistPos> positions) {
|
|
||||||
LatLng latLng = null;
|
|
||||||
PolylineOptions polylineOptions = new PolylineOptions();
|
|
||||||
BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.bus);
|
|
||||||
for (HistPos pos : positions) {
|
|
||||||
latLng = new LatLng(pos.lat, pos.lng);
|
|
||||||
polylineOptions.add(latLng);
|
|
||||||
|
|
||||||
googleMap.addMarker(new MarkerOptions()
|
|
||||||
.position(latLng)
|
|
||||||
.icon(markerIcon));
|
|
||||||
}
|
|
||||||
|
|
||||||
Polyline polyline1 = 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();
|
||||||
|
|
||||||
LinearLayout layoutStartPicker = findViewById(R.id.layoutStartPicker);
|
LinearLayout layoutStartPicker = findViewById(R.id.layoutStartPicker);
|
||||||
TextView textViewDate = findViewById(R.id.textViewStartDate);
|
TextView textViewDate = findViewById(R.id.textViewStartDate);
|
||||||
@ -195,16 +144,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Runnable UpdateMapResults = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
Log.v("updateMap", parentTab.HistPosList.toString());
|
|
||||||
SM.Debug("Do the Display");
|
|
||||||
displayHistory(parentTab.HistPosList);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public void UpdateMap() {
|
public void UpdateMap() {
|
||||||
myHandler.post(UpdateMapResults);
|
|
||||||
SM.Debug("Do the updateMAP post");
|
SM.Debug("Do the updateMAP post");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,12 +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;
|
|
||||||
|
|
||||||
parentTab.demoPositionsList();
|
|
||||||
displayButton.performClick();
|
|
||||||
}
|
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -284,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