Ejemplo n.º 1
0
  private void onActionStopReceived() {
    stopRecord();
    ArrayList<SamplePoint> samplePonitList = mDJDatabase.querySPList();
    if (mOnRoadDistance >= 1d) {
      mDJDatabase.clearSamplePoints();
      return;
    } else {
      mCurrDrivingJournal.setPlaceNotes(SomeUtil.getStrSamplePoints(samplePonitList));
    }
    mCurrDrivingJournal.setEndTime(System.currentTimeMillis());
    mCurrDrivingJournal.setEndLat(mCurrBDLocation.getLatitude() + "");
    mCurrDrivingJournal.setEndLon(mCurrBDLocation.getLongitude() + "");
    mCurrDrivingJournal.setEndPlace(mCurrBDLocation.getAddrStr());
    mCurrDrivingJournal.setTravelTime(
        mCurrDrivingJournal.getEndTime() - mCurrDrivingJournal.getStartTime());
    mCurrDrivingJournal.setDistance(mOnRoadDistance);
    double oilPrice =
        SomeUtil.stringToDouble(mPreferences.getString(BaseActivity.EXTRA_DEFAULT_OIL_PRICE, ""));
    mCurrDrivingJournal.setOilPrice(oilPrice);
    mCurrDrivingJournal.setOilWear(mAvgOilWear);
    mCurrDrivingJournal.setTotalOilMoney(getOilCost(oilPrice));
    mCurrDrivingJournal.setStatus(DrivingJournalStatus.NOT_UPLOAD.toString());
    mCurrDrivingJournal.setLastUpdateTime(System.currentTimeMillis());
    mDJDatabase.insertDJItem(mCurrDrivingJournal);
    mDJDatabase.clearSamplePoints();

    saveCC();
  }
Ejemplo n.º 2
0
  private void onLocationFirstReceived() {
    mDJDatabase.clearSamplePoints();
    mCurrDrivingJournal = new DrivingJournalItem();
    mCurrDrivingJournal.setAppDriveLogId(
        UUID.randomUUID().toString().toUpperCase(Locale.getDefault()));
    mCurrDrivingJournal.setAppUserNo(mPreferences.getString(BaseActivity.NAME, ""));
    mCurrDrivingJournal.setAppPlatform(INFO.MOBILE_PLATFORM);
    mCurrDrivingJournal.setVehicleNo(mPreferences.getString(BaseActivity.VEHICLENUM, ""));
    mCurrDrivingJournal.setStartTime(System.currentTimeMillis());
    mCurrDrivingJournal.setStartLat(mCurrBDLocation.getLatitude() + "");
    mCurrDrivingJournal.setStartLon(mCurrBDLocation.getLongitude() + "");
    mCurrDrivingJournal.setStartPlace(mCurrBDLocation.getAddrStr());
    mCurrDrivingJournal.setOilKind(mPreferences.getString(BaseActivity.EXTRA_DEFAUL_TOIL_KIND, ""));

    startRecord();
  }
Ejemplo n.º 3
0
 private void initCommon() {
   mDJDatabase = DJDatabase.getInstance(this);
   mPreferences = getSharedPreferences(BaseActivity.SETTING_INFOS, Context.MODE_PRIVATE);
 }