fixes a certain condition where start date equaled end date (#7)
This commit is contained in:
parent
cb56291dee
commit
56ee80b1b4
4 changed files with 37 additions and 14 deletions
|
@ -293,6 +293,14 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
|||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// protected void onNewIntent(Intent intent) {
|
||||
// super.onNewIntent(intent);
|
||||
// LogHelper.v(LOG_TAG, "onNewIntent called.");
|
||||
// handleIncomingIntent(intent);
|
||||
// }
|
||||
//
|
||||
//
|
||||
/* Loads state of Floating Action Button from preferences */
|
||||
private void loadFloatingActionButtonState(Context context) {
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -583,13 +591,22 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
|||
case ACTION_SHOW_MAP:
|
||||
mSelectedTab = FRAGMENT_ID_MAP;
|
||||
mViewPager.setCurrentItem(mSelectedTab);
|
||||
if (intent.hasExtra(EXTRA_TRACKING_STATE)) {
|
||||
mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
||||
if (mTrackerServiceRunning) {
|
||||
// set FAB state
|
||||
mFloatingActionButtonState = FAB_STATE_RECORDING;
|
||||
}
|
||||
}
|
||||
// if (intent.hasExtra(EXTRA_TRACKING_STATE)) {
|
||||
// mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
||||
// if (mTrackerServiceRunning) {
|
||||
// // set FAB state
|
||||
// mFloatingActionButtonState = FAB_STATE_RECORDING;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Intent i = new Intent();
|
||||
// i.setAction(ACTION_TRACK_REQUEST);
|
||||
// LocalBroadcastManager.getInstance(this).sendBroadcast(i);
|
||||
// LogHelper.v(LOG_TAG, "MapActivity: requesting updated track from service.");
|
||||
|
||||
// clear intent
|
||||
intent.setAction(ACTION_DEFAULT);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -391,12 +391,13 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
|||
public void setTrackingState(boolean trackingState) {
|
||||
mTrackerServiceRunning = trackingState;
|
||||
|
||||
// got a new track (from notification)
|
||||
Intent intent = mActivity.getIntent();
|
||||
if (intent != null && intent.hasExtra(EXTRA_TRACK)) {
|
||||
mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
||||
LogHelper.v(LOG_TAG, "MapFragment: getting track from intent.");
|
||||
}
|
||||
// // got a new track (from notification)
|
||||
// // todo check for ACTION
|
||||
// Intent intent = mActivity.getIntent();
|
||||
// if (intent != null && intent.hasExtra(EXTRA_TRACK)) {
|
||||
// mTrack = intent.getParcelableExtra(EXTRA_TRACK);
|
||||
// LogHelper.v(LOG_TAG, "MapFragment: getting track from intent.");
|
||||
// }
|
||||
|
||||
// turn on/off tracking for MainActivity Fragment - prevent double tracking
|
||||
if (mTrackerServiceRunning) {
|
||||
|
@ -406,7 +407,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
|||
}
|
||||
|
||||
if (mTrack != null) {
|
||||
drawTrackOverlay(mTrack);
|
||||
drawTrackOverlay(mTrack); // TODO check if redundant
|
||||
}
|
||||
|
||||
// update marker
|
||||
|
@ -435,6 +436,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
|||
SaveTrackAsyncHelper saveTrackAsyncHelper = new SaveTrackAsyncHelper();
|
||||
saveTrackAsyncHelper.execute();
|
||||
Toast.makeText(mActivity, mActivity.getString(R.string.toast_message_save_track), Toast.LENGTH_LONG).show();
|
||||
LogHelper.v(LOG_TAG, "!!! MapFragment: Saving current track. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
||||
} else {
|
||||
// clear track object and delete temp file
|
||||
mTrack = null;
|
||||
|
@ -625,6 +627,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
|||
// clear intent
|
||||
intent.setAction(ACTION_DEFAULT);
|
||||
LogHelper.v(LOG_TAG, "MapFragment: Track update received - drawing map.");
|
||||
LogHelper.v(LOG_TAG, "!!! MapFragment: Track update received. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -318,6 +318,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
|||
i.putExtra(EXTRA_TRACK, mTrack);
|
||||
i.putExtra(EXTRA_LAST_LOCATION, mCurrentBestLocation);
|
||||
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
|
||||
LogHelper.v(LOG_TAG, "!!! sendTrackUpdate. Start == End -> " + (mTrack.getRecordingStart().equals(mTrack.getRecordingStop())) ); // TODO REMOVE
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ public class NotificationHelper implements TrackbookKeys {
|
|||
NotificationManager notificationManager = (NotificationManager) mService.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(TRACKER_SERVICE_NOTIFICATION_ID, mNotification);
|
||||
|
||||
LogHelper.v(LOG_TAG, "!!! Notification: Received updated Track. Start == End -> " + (track.getRecordingStart().equals(track.getRecordingStop())) ); // TODO REMOVE
|
||||
|
||||
if (!tracking) {
|
||||
// make notification swipe-able
|
||||
mService.stopForeground(false);
|
||||
|
|
Loading…
Reference in a new issue