@Override
  protected void onDestroy() {
    super.onDestroy();

    if (isLogging()) {
      stopLogging();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_acquire_gps);

    setUseExitWarning(true);
    setUseLostConnectionWarning(true);

    setResult(RESULT_CANCELED);

    if (!isCanceling()) {
      SheetLayoutEx.enterFromBottomAnimation(this);
      Intent intent = getIntent();
      if (intent != null && intent.getExtras() != null) {
        _Bursts = new ArrayList<>();

        try {
          _Point = (GpsPoint) intent.getSerializableExtra(Consts.Codes.Data.POINT_DATA);
          _Metadata = intent.getParcelableExtra(Consts.Codes.Data.METADATA_DATA);

          setZone(_Metadata.getZone());

          if (intent.getExtras().containsKey(Consts.Codes.Data.ADDITIVE_NMEA_DATA)) {
            _Bursts =
                TtNmeaBurst.bytesToBursts(
                    intent.getByteArrayExtra(Consts.Codes.Data.ADDITIVE_NMEA_DATA));
            setLoggedCount(_Bursts.size());
          }

        } catch (Exception e) {
          e.printStackTrace();
        }
      } else {
        setResult(Consts.Codes.Results.NO_POINT_DATA);
        finish();
        return;
      }

      ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
      }

      tvLogged = (TextView) findViewById(R.id.acquireGpsToolbarLblLoggedValue);
      tvRecv = (TextView) findViewById(R.id.acquireGpsToolbarLblReceivedValue);

      btnLog = (Button) findViewById(R.id.aqrBtnLog);
      btnCalc = (Button) findViewById(R.id.aqrBtnCalc);

      if (_Bursts.size() > 0) {
        btnCalc.setEnabled(true);
      } else {
        btnCalc.setBackgroundColor(AndroidUtils.UI.getColor(this, R.color.primaryLighter));
      }

      // setupMap();
    }
  }
  @Override
  public void gpsError(GpsService.GpsError error) {
    switch (error) {
      case LostDeviceConnection:
        stopLogging();
        break;
      case NoExternalGpsSocket:
        break;
      case Unkown:
        break;
    }

    super.gpsError(error);
  }
  @Override
  public void onNmeaBurstReceived(final INmeaBurst nmeaBurst) {
    super.onNmeaBurstReceived(nmeaBurst);

    if (isLogging() && nmeaBurst.hasPosition()) {
      onLoggedNmeaBurst(nmeaBurst);
      loggedCount++;
    }

    receivedCount++;

    tvRecv.setText(StringEx.toString(getReceivedCount()));
    tvLogged.setText(StringEx.toString(getLoggedCount()));
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == Consts.Codes.Activites.CALCULATE) {
      switch (resultCode) {
        case Consts.Codes.Results.POINT_CREATED:
          {
            setResult(Consts.Codes.Results.POINT_CREATED, data);
            finish();
            break;
          }
      }
    }
  }
 protected void stopLogging() {
   super.stopLogging();
   btnLog.setText(R.string.aqr_log);
 }
 @Override
 protected void startLogging() {
   super.startLogging();
   btnLog.setText(R.string.aqr_log_pause);
 }
 @Override
 protected void onPause() {
   SheetLayoutEx.exitToBottomAnimation(this);
   super.onPause();
 }