Rename STATE_TRACKING_NOT -> STATE_TRACKING_NOT_STARTED.

This commit is contained in:
voussoir 2022-04-06 21:26:49 -07:00
parent 4d17f64766
commit 7cb9904ab9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
7 changed files with 14 additions and 14 deletions

View file

@ -62,7 +62,7 @@ object Keys {
const val PREF_LOCATION_AGE_THRESHOLD: String = "prefLocationAgeThreshold" const val PREF_LOCATION_AGE_THRESHOLD: String = "prefLocationAgeThreshold"
// states // states
const val STATE_TRACKING_NOT: Int = 0 const val STATE_TRACKING_NOT_STARTED: Int = 0
const val STATE_TRACKING_ACTIVE: Int = 1 const val STATE_TRACKING_ACTIVE: Int = 1
const val STATE_TRACKING_PAUSED: Int = 2 const val STATE_TRACKING_PAUSED: Int = 2
const val STATE_THEME_FOLLOW_SYSTEM: String = "stateFollowSystem" const val STATE_THEME_FOLLOW_SYSTEM: String = "stateFollowSystem"

View file

@ -53,7 +53,7 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe
/* Main class variables */ /* Main class variables */
private var bound: Boolean = false private var bound: Boolean = false
private val handler: Handler = Handler(Looper.getMainLooper()) private val handler: Handler = Handler(Looper.getMainLooper())
private var trackingState: Int = Keys.STATE_TRACKING_NOT private var trackingState: Int = Keys.STATE_TRACKING_NOT_STARTED
private var gpsProviderActive: Boolean = false private var gpsProviderActive: Boolean = false
private var networkProviderActive: Boolean = false private var networkProviderActive: Boolean = false
private var track: Track = Track() private var track: Track = Track()
@ -269,7 +269,7 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe
when (trackingState) { when (trackingState) {
Keys.STATE_TRACKING_PAUSED -> resumeTracking() Keys.STATE_TRACKING_PAUSED -> resumeTracking()
Keys.STATE_TRACKING_ACTIVE -> trackerService.stopTracking() Keys.STATE_TRACKING_ACTIVE -> trackerService.stopTracking()
Keys.STATE_TRACKING_NOT -> startTracking() Keys.STATE_TRACKING_NOT_STARTED -> startTracking()
} }
} }

View file

@ -53,7 +53,7 @@ class TrackerService: Service(), SensorEventListener {
/* Main class variables */ /* Main class variables */
var trackingState: Int = Keys.STATE_TRACKING_NOT var trackingState: Int = Keys.STATE_TRACKING_NOT_STARTED
var gpsProviderActive: Boolean = false var gpsProviderActive: Boolean = false
var networkProviderActive: Boolean = false var networkProviderActive: Boolean = false
var useImperial: Boolean = false var useImperial: Boolean = false
@ -268,7 +268,7 @@ class TrackerService: Service(), SensorEventListener {
fun clearTrack() { fun clearTrack() {
track = Track() track = Track()
FileHelper.deleteTempFile(this) FileHelper.deleteTempFile(this)
trackingState = Keys.STATE_TRACKING_NOT trackingState = Keys.STATE_TRACKING_NOT_STARTED
PreferencesHelper.saveTrackingState(trackingState) PreferencesHelper.saveTrackingState(trackingState)
stopForeground(true) stopForeground(true)
notificationManager.cancel(Keys.TRACKER_SERVICE_NOTIFICATION_ID) // this call was not necessary prior to Android 12 notificationManager.cancel(Keys.TRACKER_SERVICE_NOTIFICATION_ID) // this call was not necessary prior to Android 12

View file

@ -38,7 +38,7 @@ class TrackingToggleTileService: TileService() {
/* Main class variables */ /* Main class variables */
private var bound: Boolean = false private var bound: Boolean = false
private var trackingState: Int = Keys.STATE_TRACKING_NOT private var trackingState: Int = Keys.STATE_TRACKING_NOT_STARTED
private lateinit var trackerService: TrackerService private lateinit var trackerService: TrackerService

View file

@ -63,7 +63,7 @@ object PreferencesHelper {
/* Loads tracking state */ /* Loads tracking state */
fun loadTrackingState(): Int { fun loadTrackingState(): Int {
// load tracking state // load tracking state
return sharedPreferences.getInt(Keys.PREF_TRACKING_STATE, Keys.STATE_TRACKING_NOT) return sharedPreferences.getInt(Keys.PREF_TRACKING_STATE, Keys.STATE_TRACKING_NOT_STARTED)
} }

View file

@ -177,7 +177,7 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
/* Mark current position on map */ /* Mark current position on map */
fun markCurrentPosition(location: Location, trackingState: Int = Keys.STATE_TRACKING_NOT) { fun markCurrentPosition(location: Location, trackingState: Int = Keys.STATE_TRACKING_NOT_STARTED) {
mapView.overlays.remove(currentPositionOverlay) mapView.overlays.remove(currentPositionOverlay)
currentPositionOverlay = MapOverlayHelper(markerListener).createMyLocationOverlay(context, location, trackingState) currentPositionOverlay = MapOverlayHelper(markerListener).createMyLocationOverlay(context, location, trackingState)
mapView.overlays.add(currentPositionOverlay) mapView.overlays.add(currentPositionOverlay)
@ -205,7 +205,7 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
/* Update live statics */ /* Update live statics */
fun updateLiveStatics(length: Float, duration: Long, trackingState: Int) { fun updateLiveStatics(length: Float, duration: Long, trackingState: Int) {
// toggle visibility // toggle visibility
val trackingActive: Boolean = trackingState != Keys.STATE_TRACKING_NOT val trackingActive: Boolean = trackingState != Keys.STATE_TRACKING_NOT_STARTED
liveStatisticsDistanceView.isVisible = trackingActive liveStatisticsDistanceView.isVisible = trackingActive
liveStatisticsDurationView.isVisible = trackingActive liveStatisticsDurationView.isVisible = trackingActive
// update distance and duration (and add outline) // update distance and duration (and add outline)
@ -226,7 +226,7 @@ data class MapFragmentLayoutHolder(private var context: Context, private var mar
/* Toggles state of main button and additional buttons (save & resume) */ /* Toggles state of main button and additional buttons (save & resume) */
fun updateMainButton(trackingState: Int) { fun updateMainButton(trackingState: Int) {
when (trackingState) { when (trackingState) {
Keys.STATE_TRACKING_NOT -> { Keys.STATE_TRACKING_NOT_STARTED -> {
mainButton.setIconResource(R.drawable.ic_fiber_manual_record_inactive_24dp) mainButton.setIconResource(R.drawable.ic_fiber_manual_record_inactive_24dp)
mainButton.text = context.getString(R.string.button_start) mainButton.text = context.getString(R.string.button_start)
mainButton.contentDescription = context.getString(R.string.descr_button_start) mainButton.contentDescription = context.getString(R.string.descr_button_start)

View file

@ -154,8 +154,8 @@ data class TrackFragmentLayoutHolder(private var context: Context, private var m
// create map overlay // create map overlay
val mapOverlayHelper: MapOverlayHelper = MapOverlayHelper(markerListener) val mapOverlayHelper: MapOverlayHelper = MapOverlayHelper(markerListener)
trackOverlay = mapOverlayHelper.createTrackOverlay(context, track, Keys.STATE_TRACKING_NOT) trackOverlay = mapOverlayHelper.createTrackOverlay(context, track, Keys.STATE_TRACKING_NOT_STARTED)
trackSpecialMarkersOverlay = mapOverlayHelper.createSpecialMakersTrackOverlay(context, track, Keys.STATE_TRACKING_NOT, displayStartEndMarker = true) trackSpecialMarkersOverlay = mapOverlayHelper.createSpecialMakersTrackOverlay(context, track, Keys.STATE_TRACKING_NOT_STARTED, displayStartEndMarker = true)
if (track.wayPoints.isNotEmpty()) { if (track.wayPoints.isNotEmpty()) {
mapView.overlays.add(trackSpecialMarkersOverlay) mapView.overlays.add(trackSpecialMarkersOverlay)
mapView.overlays.add(trackOverlay) mapView.overlays.add(trackOverlay)
@ -179,8 +179,8 @@ data class TrackFragmentLayoutHolder(private var context: Context, private var m
} }
if (track.wayPoints.isNotEmpty()) { if (track.wayPoints.isNotEmpty()) {
val mapOverlayHelper: MapOverlayHelper = MapOverlayHelper(markerListener) val mapOverlayHelper: MapOverlayHelper = MapOverlayHelper(markerListener)
trackOverlay = mapOverlayHelper.createTrackOverlay(context, track, Keys.STATE_TRACKING_NOT) trackOverlay = mapOverlayHelper.createTrackOverlay(context, track, Keys.STATE_TRACKING_NOT_STARTED)
trackSpecialMarkersOverlay = mapOverlayHelper.createSpecialMakersTrackOverlay(context, track, Keys.STATE_TRACKING_NOT, displayStartEndMarker = true) trackSpecialMarkersOverlay = mapOverlayHelper.createSpecialMakersTrackOverlay(context, track, Keys.STATE_TRACKING_NOT_STARTED, displayStartEndMarker = true)
mapView.overlays.add(trackOverlay) mapView.overlays.add(trackOverlay)
mapView.overlays.add(trackSpecialMarkersOverlay) mapView.overlays.add(trackSpecialMarkersOverlay)
} }