Skip to content

Commit

Permalink
More graceful behavior when no locations have been collected
Browse files Browse the repository at this point in the history
  • Loading branch information
audaciouscode committed Dec 29, 2016
1 parent bef5270 commit 5a7bb83
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 5a7bb83

Please sign in to comment.