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.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
@ -39,7 +42,9 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
private Spinner spinnerVehicle;
private ImageView changeMapType, checkTraffic, slideLayoutImage;
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<String> allVehicleNames = new ArrayList<>();
@ -76,6 +81,23 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
slidelayout = findViewById(R.id.slidelayout);
slideLayoutImage = findViewById(R.id.slideLayoutImage);
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) -> {
// if (showVehicle) {
// layoutVehicles.setVisibility(View.GONE);
@ -90,17 +112,13 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
// });
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) {
LatLng latLng = new LatLng(demoPositions.get(0).lat, demoPositions.get(0).lng);
private void displayHistory(ArrayList<HistPos> positions) {
LatLng latLng = null;
PolylineOptions polylineOptions = new PolylineOptions();
BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.bus);
for (HistPos pos : demoPositions) {
for (HistPos pos : positions) {
latLng = new LatLng(pos.lat, pos.lng);
polylineOptions.add(latLng);
@ -110,6 +128,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
}
Polyline polyline1 = googleMap.addPolyline(polylineOptions);
if (latLng != null)
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14));
}
@ -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() {
myHandler.post(UpdateMapResults);
SM.Debug("Do the updateMAP post");
}
@ -196,8 +224,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
public void onMapReady(@NonNull GoogleMap googleMap) {
this.googleMap = googleMap;
// replace this with parentTab.HistPosList
parentTab.demoPositionsList();
displayHistory(parentTab.demoPositions);
displayButton.performClick();
}
}