예제 #1
0
  @Override
  public void addMonitorActions(
      final ContextMenuAdapter qa, final MonitoringInfoControl li, final OsmandMapTileView view) {
    boolean o = true;
    try {
      o = mIRemoteService.isActive();
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
    final boolean off = !o;
    qa.item(off ? R.string.osmodroid_mode_off : R.string.osmodroid_mode_on)
        .icon(off ? R.drawable.monitoring_rec_inactive : R.drawable.monitoring_rec_big)
        .listen(
            new OnContextMenuClick() {

              @Override
              public void onContextMenuClick(
                  int itemId, int pos, boolean isChecked, DialogInterface dialog) {
                try {
                  if (off) {
                    mIRemoteService.Activate();
                  } else {
                    mIRemoteService.Deactivate();
                  }
                } catch (Exception e) {
                  log.error(e.getMessage(), e);
                }
              }
            })
        .reg();
  }
예제 #2
0
 private void shutdown(OsmandApplication app) {
   if (mIRemoteService != null) {
     if (connected) {
       try {
         mIRemoteService.unregisterListener(inter);
       } catch (RemoteException e) {
         log.error(e.getMessage(), e);
       }
     }
     app.unbindService(mConnection);
     mIRemoteService = null;
   }
 }
예제 #3
0
  void requestLayersFromOsMoDroid(MapActivity activity) {
    try {
      for (int i = 0; i < mIRemoteService.getNumberOfLayers(); i++) {
        osmoDroidLayerList.add(
            new OsMoDroidLayer(
                activity,
                mIRemoteService.getLayerId(i),
                this,
                mIRemoteService.getLayerName(mIRemoteService.getLayerId(i)),
                mIRemoteService.getLayerDescription(mIRemoteService.getLayerId(i))));
      }
    } catch (RemoteException e) {

      log.error(e.getMessage(), e);
    }
  }
예제 #4
0
  public ArrayList<OsMoDroidPoint> getOsMoDroidPointArrayList(int id) {
    ArrayList<OsMoDroidPoint> result = new ArrayList<OsMoDroidPoint>();
    try {
      for (int i = 0; i < mIRemoteService.getNumberOfObjects(id); i++) {
        result.add(
            new OsMoDroidPoint(
                mIRemoteService.getObjectLat(id, mIRemoteService.getObjectId(id, i)),
                mIRemoteService.getObjectLon(id, mIRemoteService.getObjectId(id, i)),
                mIRemoteService.getObjectName(id, mIRemoteService.getObjectId(id, i)),
                mIRemoteService.getObjectDescription(id, mIRemoteService.getObjectId(id, i)),
                mIRemoteService.getObjectId(id, i),
                id,
                mIRemoteService.getObjectSpeed(id, mIRemoteService.getObjectId(id, i)),
                mIRemoteService.getObjectColor(id, mIRemoteService.getObjectId(id, i))));
      }
    } catch (RemoteException e) {

      log.error(e.getMessage(), e);
    }

    return result;
  }