diff --git a/libSafeMobile/src/main/res/layout/map_marker_info_bubble.xml b/libSafeMobile/src/main/res/layout/map_marker_info_bubble.xml index 08ce499..66846e0 100644 --- a/libSafeMobile/src/main/res/layout/map_marker_info_bubble.xml +++ b/libSafeMobile/src/main/res/layout/map_marker_info_bubble.xml @@ -1,15 +1,4 @@ - + + android:textSize="10sp" + tools:text="a year ago [01:05:01]" /> allVehicle = new ArrayList<>(); private final ArrayList allVehicleNames = new ArrayList<>(); private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy"); + private boolean showVehicles = true; @Override @@ -111,6 +114,21 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall } }); + LinearLayout slideLayout = findViewById(R.id.slidelayout); + LinearLayout linearLayoutVehicles = findViewById(R.id.layoutBig); + ImageView slideLayoutImageView = findViewById(R.id.slideLayoutImage); + slideLayout.setOnClickListener(v -> { + if (showVehicles) { + linearLayoutVehicles.setVisibility(View.GONE); + slideLayoutImageView.setImageResource(R.drawable.arrow_right); + showVehicles = false; + } else { + linearLayoutVehicles.setVisibility(View.VISIBLE); + slideLayoutImageView.setImageResource(R.drawable.arrow_left); + showVehicles = true; + } + }); + setDate(); } @@ -258,6 +276,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this); this.googleMap.setInfoWindowAdapter(infoBubble); + this.googleMap.getUiSettings().setMapToolbarEnabled(false); parentTab.demoPositionsList(); displayButton.performClick(); diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java index a13db99..0daa7c7 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java @@ -32,6 +32,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; +import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; @@ -88,7 +89,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall private boolean isAck = false; private boolean showVehicle = true; private int contextMenuPosition; - private int vehStatus; + private int vehStatus, lastItemClicked; private int position; // vehStatus = vehicle status received from apps /* Live Vehicle GridView */ @@ -254,7 +255,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall } // refresh UI - displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); + displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); }); displayButton = findViewById(R.id.buttonDisplay); @@ -285,11 +286,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall } // refresh UI - displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); + displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); }); // display Vehicles - displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); + displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); // register to receive broadcasts registerBroadcastIntents(); @@ -309,6 +310,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall this.googleMap = googleMap; GoogleMapsInfoBubble infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this, getParentTab().getSuperVehHash()); this.googleMap.setInfoWindowAdapter(infoBubble); + this.googleMap.getUiSettings().setMapToolbarEnabled(false); } @@ -371,7 +373,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall // clear previous vehicles SM.Debug("onResume"); - displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); + displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); } final Runnable cancelLoadingDialogRUN = LiveActivity.this::cancelLoadingDialog; @@ -440,7 +442,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall }); } - public void displayVehicle(boolean withZoom, double latZoom, double lngZoom) { + public void displayVehicle(double latZoom, double lngZoom) { if (googleMap != null) { String openWindow = ""; for (Marker marker : markers) { @@ -462,18 +464,17 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall markerOptions.icon(markerIcon); Marker marker = this.googleMap.addMarker(markerOptions); - if (openWindow.equals(marker.getTitle())) + if (openWindow.equals(marker.getTitle()) || i == lastItemClicked) { marker.showInfoWindow(); + googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 14)); + } markers.add(marker); } } } } - } - - public void showOpenedBalloon(boolean demo) { - //TODO: add show balloon + lastItemClicked = 0; } private BitmapDescriptor getProperBitmap(int largeIcon, String text) { @@ -650,7 +651,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall } // Create runnable for posting - final Runnable updateMapResults = () -> displayVehicle(false, LAT_OUTLIMIT, LNG_OUTLIMIT); + final Runnable updateMapResults = () -> displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); // Create runnable for posting final Runnable updatePollResults = () -> { @@ -660,7 +661,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall adapter.changeDisplayed(position, true); } - displayVehicle(true, latPoll, lngPoll); }; + displayVehicle(latPoll, lngPoll); }; // Create runnable for posting final Runnable updateOptionsRUN = this::updateOptionsUI; @@ -678,8 +679,9 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall * @param view View in which will do the modifications */ private void itemClick(int position, View view) { + lastItemClicked = position; // change displayed state - displayedVehicles.set(position, !Boolean.TRUE.equals(displayedVehicles.get(position))); + displayedVehicles.set(position, !displayedVehicles.get(position)); // change in the adapter adapter.changeDisplayed(position, displayedVehicles.get(position)); @@ -693,15 +695,15 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall viewLive.imgViewChecked.setImageResource(R.drawable.unchecked); // check if all values are identical - boolean identical = true; - for (Boolean displ : displayedVehicles) - if (displ != displayedVehicles.get(0)) { - identical = false; + boolean allDisplayed = true; + for (Boolean displayed : displayedVehicles) + if (!displayed) { + allDisplayed = false; break; } // change image when all values are identical - if (identical && displayedVehicles.get(0)) { + if (allDisplayed) { imageViewCheckAll.setSelected(true); imageViewCheckAll.setBackgroundResource(R.drawable.check_all); } else { @@ -710,7 +712,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall } // display vehicle - displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT); + displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT); } /** diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/MessagesActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/MessagesActivity.java index 577a653..61c4852 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/MessagesActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/MessagesActivity.java @@ -124,16 +124,6 @@ public class MessagesActivity extends Activity { textViewSelectedContact = findViewById(R.id.textViewSelectedContact); imageViewSelectedContact = findViewById(R.id.imageViewSelectedContact); - ImageView imageBarcode = findViewById(R.id.imageBarcode); - imageBarcode.setOnClickListener(v -> { - try { - Intent intent = new Intent("com.google.zxing.client.android.SCAN"); - startActivityForResult(intent, 0); - } catch (Exception e) { - showErrorDialog(getResources().getString(R.string.barcodeError)); - } - }); - // change tab header fontFace TextView textView1 = findViewById(R.id.textView1); textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf")); diff --git a/safeDispatch/src/main/res/layout-large/tabtext.xml b/safeDispatch/src/main/res/layout-large/tabtext.xml index 258195e..956ae1a 100644 --- a/safeDispatch/src/main/res/layout-large/tabtext.xml +++ b/safeDispatch/src/main/res/layout-large/tabtext.xml @@ -214,20 +214,6 @@ android:autofillHints=""> - - -