SD-222 #27
@ -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"
|
||||||
|
@ -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) + "]";
|
||||||
|
@ -11,9 +11,11 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -52,6 +54,7 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
|||||||
private final ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
private final ArrayList<Vehicle> allVehicle = new ArrayList<>();
|
||||||
private final ArrayList<String> allVehicleNames = new ArrayList<>();
|
private final ArrayList<String> allVehicleNames = new ArrayList<>();
|
||||||
private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy");
|
private final SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy");
|
||||||
|
private boolean showVehicles = true;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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();
|
setDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,6 +276,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();
|
||||||
|
@ -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;
|
||||||
@ -88,7 +89,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
private boolean isAck = false;
|
private boolean isAck = false;
|
||||||
private boolean showVehicle = true;
|
private boolean showVehicle = true;
|
||||||
private int contextMenuPosition;
|
private int contextMenuPosition;
|
||||||
private int vehStatus;
|
private int vehStatus, lastItemClicked;
|
||||||
private int position; // vehStatus = vehicle status received from apps
|
private int position; // vehStatus = vehicle status received from apps
|
||||||
|
|
||||||
/* Live Vehicle GridView */
|
/* Live Vehicle GridView */
|
||||||
@ -254,7 +255,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
// refresh UI
|
// refresh UI
|
||||||
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT);
|
displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
|
||||||
});
|
});
|
||||||
|
|
||||||
displayButton = findViewById(R.id.buttonDisplay);
|
displayButton = findViewById(R.id.buttonDisplay);
|
||||||
@ -285,11 +286,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
// refresh UI
|
// refresh UI
|
||||||
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT);
|
displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
|
||||||
});
|
});
|
||||||
|
|
||||||
// display Vehicles
|
// display Vehicles
|
||||||
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT);
|
displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
|
||||||
|
|
||||||
// register to receive broadcasts
|
// register to receive broadcasts
|
||||||
registerBroadcastIntents();
|
registerBroadcastIntents();
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -371,7 +373,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
|
|
||||||
// clear previous vehicles
|
// clear previous vehicles
|
||||||
SM.Debug("onResume");
|
SM.Debug("onResume");
|
||||||
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT);
|
displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Runnable cancelLoadingDialogRUN = LiveActivity.this::cancelLoadingDialog;
|
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) {
|
if (googleMap != null) {
|
||||||
String openWindow = "";
|
String openWindow = "";
|
||||||
for (Marker marker : markers) {
|
for (Marker marker : markers) {
|
||||||
@ -462,18 +464,17 @@ 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()) || i == lastItemClicked) {
|
||||||
marker.showInfoWindow();
|
marker.showInfoWindow();
|
||||||
|
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 14));
|
||||||
|
}
|
||||||
|
|
||||||
markers.add(marker);
|
markers.add(marker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
lastItemClicked = 0;
|
||||||
|
|
||||||
public void showOpenedBalloon(boolean demo) {
|
|
||||||
//TODO: add show balloon
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BitmapDescriptor getProperBitmap(int largeIcon, String text) {
|
private BitmapDescriptor getProperBitmap(int largeIcon, String text) {
|
||||||
@ -650,7 +651,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create runnable for posting
|
// 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
|
// Create runnable for posting
|
||||||
final Runnable updatePollResults = () -> {
|
final Runnable updatePollResults = () -> {
|
||||||
@ -660,7 +661,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
adapter.changeDisplayed(position, true);
|
adapter.changeDisplayed(position, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayVehicle(true, latPoll, lngPoll); };
|
displayVehicle(latPoll, lngPoll); };
|
||||||
|
|
||||||
// Create runnable for posting
|
// Create runnable for posting
|
||||||
final Runnable updateOptionsRUN = this::updateOptionsUI;
|
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
|
* @param view View in which will do the modifications
|
||||||
*/
|
*/
|
||||||
private void itemClick(int position, View view) {
|
private void itemClick(int position, View view) {
|
||||||
|
lastItemClicked = position;
|
||||||
// change displayed state
|
// change displayed state
|
||||||
displayedVehicles.set(position, !Boolean.TRUE.equals(displayedVehicles.get(position)));
|
displayedVehicles.set(position, !displayedVehicles.get(position));
|
||||||
|
|
||||||
// change in the adapter
|
// change in the adapter
|
||||||
adapter.changeDisplayed(position, displayedVehicles.get(position));
|
adapter.changeDisplayed(position, displayedVehicles.get(position));
|
||||||
@ -693,15 +695,15 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
|
||||||
|
|
||||||
// check if all values are identical
|
// check if all values are identical
|
||||||
boolean identical = true;
|
boolean allDisplayed = true;
|
||||||
for (Boolean displ : displayedVehicles)
|
for (Boolean displayed : displayedVehicles)
|
||||||
if (displ != displayedVehicles.get(0)) {
|
if (!displayed) {
|
||||||
identical = false;
|
allDisplayed = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// change image when all values are identical
|
// change image when all values are identical
|
||||||
if (identical && displayedVehicles.get(0)) {
|
if (allDisplayed) {
|
||||||
imageViewCheckAll.setSelected(true);
|
imageViewCheckAll.setSelected(true);
|
||||||
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
|
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
|
||||||
} else {
|
} else {
|
||||||
@ -710,7 +712,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
// display vehicle
|
// display vehicle
|
||||||
displayVehicle(true, LAT_OUTLIMIT, LNG_OUTLIMIT);
|
displayVehicle(LAT_OUTLIMIT, LNG_OUTLIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,16 +124,6 @@ public class MessagesActivity extends Activity {
|
|||||||
textViewSelectedContact = findViewById(R.id.textViewSelectedContact);
|
textViewSelectedContact = findViewById(R.id.textViewSelectedContact);
|
||||||
imageViewSelectedContact = findViewById(R.id.imageViewSelectedContact);
|
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
|
// change tab header fontFace
|
||||||
TextView textView1 = findViewById(R.id.textView1);
|
TextView textView1 = findViewById(R.id.textView1);
|
||||||
textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf"));
|
textView1.setTypeface(Typeface.createFromAsset(getAssets(), "Sketch_Block.ttf"));
|
||||||
|
@ -214,20 +214,6 @@
|
|||||||
android:autofillHints="">
|
android:autofillHints="">
|
||||||
</EditText>
|
</EditText>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingTop="4dp">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageBarcode"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:src="@drawable/barcode"
|
|
||||||
android:paddingTop="2dp"
|
|
||||||
android:layout_margin="3dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/imageButtonSend"
|
android:id="@+id/imageButtonSend"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -213,19 +213,6 @@
|
|||||||
android:autofillHints="">
|
android:autofillHints="">
|
||||||
</EditText>
|
</EditText>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingTop="4dp">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageBarcode"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:src="@drawable/barcode"
|
|
||||||
android:layout_margin="3dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/imageButtonSend"
|
android:id="@+id/imageButtonSend"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user