feature/apk_versioning_mechanism #7

Merged
CiufudeanDani merged 12 commits from feature/apk_versioning_mechanism into develop 2022-03-22 13:19:48 +00:00
Showing only changes of commit 89f8cbfcae - Show all commits

View File

@ -3,7 +3,10 @@ package com.safemobile.dispatch;
import androidx.annotation.NonNull; 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;
@ -39,7 +42,9 @@ 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 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<>();
@ -76,6 +81,23 @@ 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);
@ -90,17 +112,13 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
// }); // });
setDate(); setDate();
parentTab.executeNetworkStuff(new String[] {OperationCodes.GetHistoryPositions + "", allVehicle.get(spinnerVehicle.getSelectedItemPosition()).sc_id + "",
(startDate.getTime()/ 1000L) + "", (endDate.getTime()/ 1000L) + ""});
} }
private void displayHistory(ArrayList<HistPos> demoPositions) { private void displayHistory(ArrayList<HistPos> positions) {
LatLng latLng = new LatLng(demoPositions.get(0).lat, demoPositions.get(0).lng); LatLng latLng = null;
PolylineOptions polylineOptions = new PolylineOptions(); PolylineOptions polylineOptions = new PolylineOptions();
BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.bus); BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.bus);
for (HistPos pos : positions) {
for (HistPos pos : demoPositions) {
latLng = new LatLng(pos.lat, pos.lng); latLng = new LatLng(pos.lat, pos.lng);
polylineOptions.add(latLng); polylineOptions.add(latLng);
@ -110,7 +128,8 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
} }
Polyline polyline1 = googleMap.addPolyline(polylineOptions); Polyline polyline1 = googleMap.addPolyline(polylineOptions);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14)); if (latLng != null)
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14));
} }
private void setDate() { private void setDate() {
@ -176,7 +195,16 @@ 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");
} }
@ -196,8 +224,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
public void onMapReady(@NonNull GoogleMap googleMap) { public void onMapReady(@NonNull GoogleMap googleMap) {
this.googleMap = googleMap; this.googleMap = googleMap;
// replace this with parentTab.HistPosList
parentTab.demoPositionsList(); parentTab.demoPositionsList();
displayHistory(parentTab.demoPositions); displayButton.performClick();
} }
} }