From 5a7bb83ba4379382d44fd6a2d876d4463be16c7e Mon Sep 17 00:00:00 2001 From: "Chris J. Karr" Date: Thu, 29 Dec 2016 12:24:57 -0600 Subject: [PATCH] More graceful behavior when no locations have been collected --- .../passive_data_kit/generators/device/Location.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/audacious_software/passive_data_kit/generators/device/Location.java b/src/com/audacious_software/passive_data_kit/generators/device/Location.java index 7363344..f00204c 100755 --- a/src/com/audacious_software/passive_data_kit/generators/device/Location.java +++ b/src/com/audacious_software/passive_data_kit/generators/device/Location.java @@ -379,7 +379,12 @@ public static void bindViewHolder(DataPointViewHolder holder) { c.close(); TextView dateLabel = (TextView) holder.itemView.findViewById(R.id.generator_data_point_date); - dateLabel.setText(Generator.formatTimestamp(context, timestamp / 1000)); + + if (timestamp > 0) { + dateLabel.setText(Generator.formatTimestamp(context, timestamp / 1000)); + } else { + dateLabel.setText(R.string.label_never_pdk); + } final double finalLatitude = lastLatitude; final double finalLongitude = lastLongitude; @@ -473,7 +478,9 @@ public void onMapReady(GoogleMap googleMap) { builder.include(latlng); } - googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), (int) (16 * metrics.density))); + if (locations.size() > 0) { + googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), (int) (16 * metrics.density))); + } DisplayMetrics metrics = context.getResources().getDisplayMetrics();