Exemplo n.º 1
0
        @Override
        public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
          int resultCount = cursor.getCount();
          Log.d(TAG, String.format("### Found %s Geotracks for %s", resultCount, person));
          ArrayList<GeoTrack> points = new ArrayList<GeoTrack>(resultCount);
          if (cursor.moveToFirst()) {
            GeoTrackHelper helper = new GeoTrackHelper().initWrapper(cursor);
            geoTrackRangeTimeValueMin = Long.MAX_VALUE;
            geoTrackRangeTimeValueMax = Long.MIN_VALUE;
            boolean isRangeChange = false;
            GeoTrack geoTrack = null;
            do {
              geoTrack = helper.getEntity(cursor);
              // Log.d(TAG, String.format("Cursor : %s", geoTrack));
              // Adding to list
              points.add(geoTrack);
              isRangeChange |= computeGeoTrackTimeRange(geoTrack.getTime(), false);
              Log.d(TAG, String.format("Add New GeoTrack : %s", geoTrack));
            } while (cursor.moveToNext());

            if (isRangeChange) {
              notifyChangeOnRangeGeoTrackValuesChangeListener();
            }
            Log.d(TAG, "------------------------------------------");
            Log.d(TAG, "------------------------------------------");
            Log.d(
                TAG,
                "------- Added last Geopoint : "
                    + geoTrack
                    + " // with LastAddedListener "
                    + (geotrackLastAddedListener != null));
            Log.d(TAG, "------------------------------------------");
            Log.d(TAG, "------------------------------------------");
            if (geoTrack != null && geotrackLastAddedListener != null) {
              geotrackLastAddedListener.addedLastGeoTrack(geoTrack);
            }
          }
          geoTracks = new ConcurrentSkipListSet<GeoTrack>(points);
        }
Exemplo n.º 2
0
 private GeoTrack loadGeoTrackById(Uri geoTrackUri) {
   GeoTrack result = null;
   Cursor c = context.getContentResolver().query(geoTrackUri, null, null, null, null);
   try {
     // Read value
     if (c != null && c.moveToFirst()) {
       GeoTrackHelper helper = new GeoTrackHelper().initWrapper(c);
       result = helper.getEntity(c);
       // Validate
       String resultUserId = result.phone;
       if (!getPersonPhone().equals(resultUserId)) {
         Log.w(
             TAG,
             String.format(
                 "Ignore geoTrack %s for user %s : Current overlay for %s",
                 geoTrackUri, resultUserId, person));
       }
     }
   } finally {
     c.close();
   }
   return result;
 }