Compare commits

..

3 Commits

4 changed files with 12 additions and 18 deletions

View File

@ -1,15 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?>
Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -74,17 +63,17 @@
android:id="@+id/tvTimeAgo" android:id="@+id/tvTimeAgo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@+id/time"
android:layout_alignTop="@+id/time" android:layout_alignTop="@+id/time"
android:layout_alignBottom="@+id/time"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_toEndOf="@+id/time" android:layout_toEndOf="@+id/time"
android:layout_toRightOf="@+id/time" android:layout_toRightOf="@+id/time"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
tools:text="a year ago [01:05:01]"
android:textColor="#ff000000" android:textColor="#ff000000"
android:textSize="10sp" /> android:textSize="10sp"
tools:text="a year ago [01:05:01]" />
<ImageView <ImageView
android:id="@+id/speed" android:id="@+id/speed"

View File

@ -93,14 +93,14 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter {
String speed, address, gpsLocation, name = ""; String speed, address, gpsLocation, name = "";
if (isLiveTab) { if (isLiveTab) {
SuperVehicle vehicle = superVehHash.get(key); SuperVehicle vehicle = superVehHash.get(key);
positionTime = new Date(vehicle.timeGMT); positionTime = new Date((new Date()).getTime() - vehicle.timeGMT);
address = vehicle.Address != null ? vehicle.Address : ""; address = vehicle.Address != null ? vehicle.Address : "";
name = vehicle.name; name = vehicle.name;
speed = String.format(context.getResources().getString(R.string.speedMph), vehicle.speed); speed = String.format(context.getResources().getString(R.string.speedMph), vehicle.speed);
gpsLocation = "[" + String.format("%.4f", vehicle.lat) + "," + String.format("%.4f",vehicle.lng) + "]"; gpsLocation = "[" + String.format("%.4f", vehicle.lat) + "," + String.format("%.4f",vehicle.lng) + "]";
} else { } else {
HistPos histPos = histPosList.get(position); HistPos histPos = histPosList.get(position);
positionTime = new Date(histPos.timeGMT); positionTime = new Date((new Date()).getTime() - histPos.timeGMT);
address = histPos.Address != null ? histPos.Address : ""; address = histPos.Address != null ? histPos.Address : "";
speed = String.format(context.getResources().getString(R.string.speedMph), histPos.speed); speed = String.format(context.getResources().getString(R.string.speedMph), histPos.speed);
gpsLocation = "[" + String.format("%.4f", histPos.lat) + "," + String.format("%.4f",histPos.lng) + "]"; gpsLocation = "[" + String.format("%.4f", histPos.lat) + "," + String.format("%.4f",histPos.lng) + "]";

View File

@ -258,6 +258,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this); infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this);
this.googleMap.setInfoWindowAdapter(infoBubble); this.googleMap.setInfoWindowAdapter(infoBubble);
this.googleMap.getUiSettings().setMapToolbarEnabled(false);
parentTab.demoPositionsList(); parentTab.demoPositionsList();
displayButton.performClick(); displayButton.performClick();

View File

@ -32,6 +32,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
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.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.SupportMapFragment;
@ -309,6 +310,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
this.googleMap = googleMap; this.googleMap = googleMap;
GoogleMapsInfoBubble infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this, getParentTab().getSuperVehHash()); GoogleMapsInfoBubble infoBubble = new GoogleMapsInfoBubble(getLayoutInflater(), this, getParentTab().getSuperVehHash());
this.googleMap.setInfoWindowAdapter(infoBubble); this.googleMap.setInfoWindowAdapter(infoBubble);
this.googleMap.getUiSettings().setMapToolbarEnabled(false);
} }
@ -462,8 +464,10 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
markerOptions.icon(markerIcon); markerOptions.icon(markerIcon);
Marker marker = this.googleMap.addMarker(markerOptions); Marker marker = this.googleMap.addMarker(markerOptions);
if (openWindow.equals(marker.getTitle())) if (openWindow.equals(marker.getTitle())) {
marker.showInfoWindow(); marker.showInfoWindow();
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 14));
}
markers.add(marker); markers.add(marker);
} }