@@ -14,6 +14,9 @@ import CoreGPX
14
14
15
15
// swiftlint:disable line_length
16
16
17
+ /// App title
18
+
19
+ let kAppTitle : String = " Open GPX Tracker "
17
20
/// Purple color for button background
18
21
let kPurpleButtonBackgroundColor : UIColor = UIColor ( red: 146.0 / 255.0 , green: 166.0 / 255.0 , blue: 218.0 / 255.0 , alpha: 0.90 )
19
22
@@ -126,7 +129,20 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
126
129
var stopWatch = StopWatch ( )
127
130
128
131
/// Name of the last file that was saved (without extension)
129
- var lastGpxFilename : String = " "
132
+ var lastGpxFilename : String = " " {
133
+ didSet {
134
+ if lastGpxFilename == " " {
135
+ appTitleLabel. text = kAppTitle
136
+ } else {
137
+ // if name is too long arbitrary cut
138
+ var displayedName = lastGpxFilename
139
+ if lastGpxFilename. count > 20 {
140
+ displayedName = lastGpxFilename. prefix ( 10 ) + " ... " + lastGpxFilename. suffix ( 3 )
141
+ }
142
+ appTitleLabel. text = " " + displayedName + " .gpx "
143
+ }
144
+ }
145
+ }
130
146
131
147
/// Status variable that indicates if the app was sent to background.
132
148
var wasSentToBackground : Bool = false
@@ -411,9 +427,6 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
411
427
locationManager. startUpdatingLocation ( )
412
428
locationManager. startUpdatingHeading ( )
413
429
414
- //let pinchGesture = UIPinchGestureRecognizer(target: self, action: "pinchGesture")
415
- //map.addGestureRecognizer(pinchGesture)
416
-
417
430
// Preferences
418
431
map. tileServer = Preferences . shared. tileServer
419
432
map. useCache = Preferences . shared. useCache
@@ -442,10 +455,9 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
442
455
let font12 = UIFont ( name: " DinAlternate-Bold " , size: 12.0 )
443
456
444
457
// Add the app title Label (Branding, branding, branding! )
445
- appTitleLabel. text = " Open GPX Tracker "
458
+ appTitleLabel. text = kAppTitle
446
459
appTitleLabel. textAlignment = . left
447
460
appTitleLabel. font = UIFont . boldSystemFont ( ofSize: 10 )
448
- //appTitleLabel.textColor = UIColor(red: 0.0/255.0, green: 0.0/255.0, blue: 0.0/255.0, alpha: 1.0)
449
461
appTitleLabel. textColor = UIColor . yellow
450
462
appTitleLabel. backgroundColor = UIColor ( red: 58.0 / 255.0 , green: 57.0 / 255.0 , blue: 54.0 / 255.0 , alpha: 0.80 )
451
463
self . view. addSubview ( appTitleLabel)
0 commit comments