예제 #1
0
  protected ElevationUpdater(CacheService c, BackgroundService b) {
    cache = c;
    context = c;
    background = b;

    AppBroadcaster.register(c, onRequestElevationUpdate, AppBroadcaster.REQUEST_ELEVATION_UPDATE);
    AppBroadcaster.register(c, onFileChanged, AppBroadcaster.FILE_CHANGED_INCACHE);
  }
예제 #2
0
        @Override
        public void onReceive(Context context, Intent intent) {
          String id = AppBroadcaster.getFile(intent);

          if (id.contains(srtmAccess.toString()) || pendingFiles.get(id.hashCode()) != null) {
            state.ping();
          }
        }
예제 #3
0
    private void removeFilesFromDatabase() throws IOException {
      if (canContinue && filesToRemove.size() > 0) {
        for (int i = 0; canContinue && i < filesToRemove.size(); i++) {

          removeFileFromDatabase(filesToRemove.get(i));
        }
        AppBroadcaster.broadcast(scontext.getContext(), AppBroadcaster.DB_SYNC_CHANGED);
      }
    }
예제 #4
0
 @Override
 public void ping() {
   if (canContinue == false) {
     terminate();
   } else if (pendingPreviewGenerator.isReady()) {
     pendingPreviewGenerator.generateBitmapFile();
     AppBroadcaster.broadcast(scontext.getContext(), AppBroadcaster.DB_SYNC_CHANGED);
     setState(new StateLoadNextGpx());
   }
 }
예제 #5
0
 /** TODO: move db open into background */
 @Override
 public void start() {
   AppBroadcaster.register(
       scontext.getContext(), onFileChanged, AppBroadcaster.FILE_CHANGED_INCACHE);
   try {
     database = openDatabase();
     setState(new StatePrepareSync());
   } catch (Exception e) {
     terminate(e);
   }
 }
예제 #6
0
    @Override
    public void start() {
      scontext.getContext().unregisterReceiver(onFileChanged);

      if (database != null) {
        database.close();
      }

      setPendingGpxHandle(null);
      setPendingPreviewGenerator(null);

      AppBroadcaster.broadcast(scontext.getContext(), AppBroadcaster.DBSYNC_DONE);
    }
예제 #7
0
    @Override
    public void start() {
      AppBroadcaster.broadcast(scontext.getContext(), AppBroadcaster.DBSYNC_START);

      scontext.getBackgroundService().process(bgProcess);
    }
예제 #8
0
 @Override
 public void broadcast(Context context) {
   AppBroadcaster.broadcast(
       context, AppBroadcaster.FILE_CHANGED_INCACHE, directory.toString());
 }
예제 #9
0
 @Override
 public void onReceive(Context context, Intent intent) {
   String id = AppBroadcaster.getFile(intent);
   pendingFiles.put(id.hashCode(), new ElevationUpdaterEntry(cache, id));
   state.ping();
 }