Commit f7449e66183391dde7b6478d94bbd36e6631b122
1 parent
b0579422a5
Exists in
master
and in
1 other branch
update save step of 7 day before date now
Showing 4 changed files with 161 additions and 34 deletions Inline Diff
LifeLog/LifeLog/HomeViewController.m
1 | // | 1 | // |
2 | // HomeViewController.m | 2 | // HomeViewController.m |
3 | // LifeLog | 3 | // LifeLog |
4 | // | 4 | // |
5 | // Created by Nguyen Van Phong on 7/25/17. | 5 | // Created by Nguyen Van Phong on 7/25/17. |
6 | // Copyright © 2017 PhongNV. All rights reserved. | 6 | // Copyright © 2017 PhongNV. All rights reserved. |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "HomeViewController.h" | 9 | #import "HomeViewController.h" |
10 | #import "NSDate+helper.h" | 10 | #import "NSDate+helper.h" |
11 | #import <CoreMotion/CoreMotion.h> | 11 | #import <CoreMotion/CoreMotion.h> |
12 | #import "CMMotionActivityExtra.h" | 12 | #import "CMMotionActivityExtra.h" |
13 | #import "TodayViewController.h" | 13 | #import "TodayViewController.h" |
14 | #import "Utilities.h" | 14 | #import "Utilities.h" |
15 | #import <MBProgressHUD/MBProgressHUD.h> | 15 | #import <MBProgressHUD/MBProgressHUD.h> |
16 | #import "ServerAPI.h" | 16 | #import "ServerAPI.h" |
17 | 17 | ||
18 | static NSInteger numberTotal = 10000; | 18 | static NSInteger numberTotal = 10000; |
19 | 19 | ||
20 | @interface HomeViewController () | 20 | @interface HomeViewController () |
21 | { | 21 | { |
22 | MBProgressHUD *progressHud; | 22 | MBProgressHUD *progressHud; |
23 | } | 23 | } |
24 | @property (nonatomic, weak) IBOutlet UILabel *lblTitle; | 24 | @property (nonatomic, weak) IBOutlet UILabel *lblTitle; |
25 | @property (nonatomic, weak) IBOutlet UIImageView *avatar; | 25 | @property (nonatomic, weak) IBOutlet UIImageView *avatar; |
26 | @property (nonatomic, weak) IBOutlet UILabel *lblDateCurrent; | 26 | @property (nonatomic, weak) IBOutlet UILabel *lblDateCurrent; |
27 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStep; | 27 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStep; |
28 | @property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; | 28 | @property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; |
29 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStepOther; | 29 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStepOther; |
30 | @property (nonatomic, weak) IBOutlet UILabel *lblPercent; | 30 | @property (nonatomic, weak) IBOutlet UILabel *lblPercent; |
31 | @property (nonatomic, weak) IBOutlet UILabel *lblNotice; | 31 | @property (nonatomic, weak) IBOutlet UILabel *lblNotice; |
32 | @property (weak, nonatomic) IBOutlet UISegmentedControl *segmentHome; | 32 | @property (weak, nonatomic) IBOutlet UISegmentedControl *segmentHome; |
33 | 33 | ||
34 | @property (nonatomic, strong) CMPedometer *pedometer; | 34 | @property (nonatomic, strong) CMPedometer *pedometer; |
35 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; | 35 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; |
36 | @property (nonatomic, strong) NSOperationQueue *operationQueue; | 36 | @property (nonatomic, strong) NSOperationQueue *operationQueue; |
37 | @property (nonatomic, strong) NSTimer *timer; | 37 | @property (nonatomic, strong) NSTimer *timer; |
38 | @property (nonatomic, assign) NSInteger bike; | 38 | @property (nonatomic, assign) NSInteger bike; |
39 | @property (nonatomic, assign) NSInteger walking; | 39 | @property (nonatomic, assign) NSInteger walking; |
40 | @property (nonatomic, assign) NSInteger running; | 40 | @property (nonatomic, assign) NSInteger running; |
41 | @property (nonatomic, strong) NSDate *dateCurrent; | 41 | @property (nonatomic, strong) NSDate *dateCurrent; |
42 | 42 | ||
43 | //@property (nonatomic, assign) BOOL isRequesting; | ||
44 | @property (nonatomic, assign) int totalRequest; | 43 | @property (nonatomic, assign) int totalRequest; |
45 | @property (nonatomic, assign) int countComplete; | 44 | @property (nonatomic, assign) int countComplete; |
46 | 45 | ||
47 | @end | 46 | @end |
48 | 47 | ||
49 | @implementation HomeViewController | 48 | @implementation HomeViewController |
50 | 49 | ||
51 | - (void)viewDidLoad { | 50 | - (void)viewDidLoad { |
52 | [super viewDidLoad]; | 51 | [super viewDidLoad]; |
53 | // Do any additional setup after loading the view from its nib. | 52 | |
54 | self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); | 53 | self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); |
55 | 54 | ||
56 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | 55 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; |
57 | 56 | ||
58 | self.avatar.backgroundColor = [UIColor whiteColor]; | 57 | self.avatar.backgroundColor = [UIColor whiteColor]; |
59 | self.avatar.layer.borderWidth = 2.0f; | 58 | self.avatar.layer.borderWidth = 2.0f; |
60 | self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; | 59 | self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; |
61 | self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; | 60 | self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; |
62 | self.avatar.layer.masksToBounds = YES; | 61 | self.avatar.layer.masksToBounds = YES; |
63 | NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; | 62 | NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; |
64 | User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; | 63 | User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; |
65 | if (user != nil) { | 64 | if (user != nil) { |
66 | NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; | 65 | NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; |
67 | NSURL *urlImage = [NSURL URLWithString:linkImage]; | 66 | NSURL *urlImage = [NSURL URLWithString:linkImage]; |
68 | NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; | 67 | NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; |
69 | sessionConfig.timeoutIntervalForRequest = 30.0; | 68 | sessionConfig.timeoutIntervalForRequest = 30.0; |
70 | sessionConfig.timeoutIntervalForResource = 60.0; | 69 | sessionConfig.timeoutIntervalForResource = 60.0; |
71 | sessionConfig.HTTPMaximumConnectionsPerHost = 20; | 70 | sessionConfig.HTTPMaximumConnectionsPerHost = 20; |
72 | sessionConfig.allowsCellularAccess = YES; | 71 | sessionConfig.allowsCellularAccess = YES; |
73 | HomeViewController __weak *weakSelf = self; | 72 | HomeViewController __weak *weakSelf = self; |
74 | NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; | 73 | NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; |
75 | NSURLSessionDataTask *downloadPhotoTask = [session | 74 | NSURLSessionDataTask *downloadPhotoTask = [session |
76 | dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | 75 | dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { |
77 | if (weakSelf == nil) | 76 | if (weakSelf == nil) |
78 | { | 77 | { |
79 | return; | 78 | return; |
80 | } | 79 | } |
81 | if (error == nil) { | 80 | if (error == nil) { |
82 | UIImage *image = [[UIImage alloc] initWithData:data]; | 81 | UIImage *image = [[UIImage alloc] initWithData:data]; |
83 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | 82 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ |
84 | weakSelf.avatar.image = image; | 83 | weakSelf.avatar.image = image; |
85 | }]; | 84 | }]; |
86 | } | 85 | } |
87 | }]; | 86 | }]; |
88 | [downloadPhotoTask resume]; | 87 | [downloadPhotoTask resume]; |
89 | } | 88 | } |
90 | 89 | ||
91 | self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); | 90 | self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); |
92 | 91 | ||
93 | _dateCurrent = [NSDate date]; | 92 | _dateCurrent = [NSDate date]; |
94 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | 93 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; |
95 | 94 | ||
96 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | 95 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); |
97 | 96 | ||
98 | if ([CMPedometer isStepCountingAvailable]) { | 97 | if ([CMPedometer isStepCountingAvailable]) { |
99 | _pedometer = [[CMPedometer alloc] init]; | 98 | _pedometer = [[CMPedometer alloc] init]; |
100 | } | 99 | } |
101 | if ([CMMotionActivityManager isActivityAvailable]) { | 100 | if ([CMMotionActivityManager isActivityAvailable]) { |
102 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; | 101 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; |
103 | } | 102 | } |
104 | _operationQueue = [[NSOperationQueue alloc] init]; | 103 | _operationQueue = [[NSOperationQueue alloc] init]; |
105 | _bike = 0; | 104 | _bike = 0; |
106 | _walking = 0; | 105 | _walking = 0; |
107 | _running = 0; | 106 | _running = 0; |
108 | _segmentHome.selectedSegmentIndex = 1; | 107 | _segmentHome.selectedSegmentIndex = 1; |
109 | // _isRequesting = NO; | ||
110 | _totalRequest = 0; | 108 | _totalRequest = 0; |
111 | _countComplete = 0; | 109 | _countComplete = 0; |
112 | 110 | ||
113 | progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | 111 | progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; |
114 | progressHud.mode = MBProgressHUDModeIndeterminate; | 112 | progressHud.mode = MBProgressHUDModeIndeterminate; |
115 | progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); | 113 | progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); |
114 | [self saveDataStep7LastDay]; | ||
116 | } | 115 | } |
117 | 116 | ||
118 | - (void)viewWillAppear:(BOOL)animated { | 117 | - (void)viewWillAppear:(BOOL)animated { |
119 | [super viewWillAppear:animated]; | 118 | [super viewWillAppear:animated]; |
120 | // _timer = [NSTimer scheduledTimerWithTimeInterval:1.5f target:self selector:@selector(countStep) userInfo:nil repeats:YES]; | 119 | [self saveStepForDay:self.dateCurrent]; |
121 | // [_timer fire]; | 120 | [self requestTopByDate:_dateCurrent]; |
122 | [self countStep]; | 121 | } |
123 | 122 | ||
123 | - (void)requestTopByDate:(NSDate *)date { | ||
124 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | 124 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; |
125 | [dateFormatter setDateFormat:@"yyyy-MM-dd"]; | 125 | [dateFormatter setDateFormat:@"yyyy-MM-dd"]; |
126 | NSString *dateString = [dateFormatter stringFromDate:_dateCurrent]; | 126 | NSString *dateString = [dateFormatter stringFromDate:date]; |
127 | 127 | ||
128 | HomeViewController __weak *weakSelf = self; | 128 | HomeViewController __weak *weakSelf = self; |
129 | [[ServerAPI server] requestTopWithMode:(int)_segmentHome.selectedSegmentIndex andDate:dateString CompletionHandler:^(TopObject *topObject, NSError *error) { | 129 | int mode = 1; |
130 | switch (_segmentHome.selectedSegmentIndex) { | ||
131 | case 0: | ||
132 | mode = 3; | ||
133 | break; | ||
134 | |||
135 | case 1: | ||
136 | mode = 1; | ||
137 | break; | ||
138 | |||
139 | case 2: | ||
140 | mode = 2; | ||
141 | break; | ||
142 | |||
143 | default: | ||
144 | break; | ||
145 | } | ||
146 | [[ServerAPI server] requestTopWithMode:mode andDate:dateString CompletionHandler:^(TopObject *topObject, NSError *error) { | ||
130 | if(weakSelf == nil) { | 147 | if(weakSelf == nil) { |
131 | return ; | 148 | return ; |
132 | } | 149 | } |
133 | if (error == nil) { | 150 | if (error == nil) { |
134 | NSLog(@"TopObject: %@", topObject); | 151 | NSLog(@"TopObject: %@", topObject); |
135 | } | 152 | } |
136 | else { | 153 | else { |
137 | dispatch_async(dispatch_get_main_queue(), ^{ | 154 | dispatch_async(dispatch_get_main_queue(), ^{ |
138 | NSString *message = [error.userInfo objectForKey:@"message"]; | 155 | NSString *message = [error.userInfo objectForKey:@"message"]; |
139 | [Utilities showErrorMessage:message withViewController:weakSelf]; | 156 | [Utilities showErrorMessage:message withViewController:weakSelf]; |
140 | }); | 157 | }); |
141 | } | 158 | } |
142 | }]; | 159 | }]; |
143 | } | 160 | } |
144 | 161 | ||
145 | - (void)viewWillDisappear:(BOOL)animated { | 162 | - (void)viewWillDisappear:(BOOL)animated { |
146 | [super viewWillDisappear:animated]; | 163 | [super viewWillDisappear:animated]; |
147 | //[_timer invalidate]; | ||
148 | } | 164 | } |
149 | 165 | ||
150 | - (void)didReceiveMemoryWarning { | 166 | - (void)didReceiveMemoryWarning { |
151 | [super didReceiveMemoryWarning]; | 167 | [super didReceiveMemoryWarning]; |
152 | // Dispose of any resources that can be recreated. | 168 | // Dispose of any resources that can be recreated. |
153 | } | 169 | } |
154 | 170 | ||
155 | #pragma mark - IBAction | 171 | #pragma mark - IBAction |
156 | - (IBAction)menuButtonTouchUpInside:(id)sender | 172 | - (IBAction)menuButtonTouchUpInside:(id)sender |
157 | { | 173 | { |
158 | 174 | ||
159 | } | 175 | } |
160 | 176 | ||
161 | - (IBAction)todayButtonTouchUpInside:(id)sender | 177 | - (IBAction)todayButtonTouchUpInside:(id)sender |
162 | { | 178 | { |
163 | TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; | 179 | TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; |
164 | [self.navigationController pushViewController:todayVC animated:YES]; | 180 | [self.navigationController pushViewController:todayVC animated:YES]; |
165 | } | 181 | } |
166 | 182 | ||
167 | - (IBAction)leftButtonTouchUpInside:(id)sender | 183 | - (IBAction)leftButtonTouchUpInside:(id)sender |
168 | { | 184 | { |
169 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; | 185 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; |
170 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | 186 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; |
171 | [self countStep]; | 187 | [self saveStepForDay:self.dateCurrent]; |
172 | } | 188 | } |
173 | 189 | ||
174 | - (IBAction)rightButtonTouchUpInside:(id)sender | 190 | - (IBAction)rightButtonTouchUpInside:(id)sender |
175 | { | 191 | { |
176 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; | 192 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; |
177 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | 193 | self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; |
178 | [self countStep]; | 194 | [self saveStepForDay:self.dateCurrent]; |
179 | } | 195 | } |
180 | 196 | ||
181 | - (IBAction)segmentValueChange:(id)sender { | 197 | - (IBAction)segmentValueChange:(id)sender { |
182 | [self updateStepUI]; | 198 | [self updateStepUI]; |
183 | } | 199 | } |
184 | 200 | ||
185 | #pragma mark - Functions Private | 201 | #pragma mark - Functions Private |
186 | - (void)countStep | 202 | - (void)saveStepForDay:(NSDate *)date |
187 | { | 203 | { |
188 | // if (self.isRequesting == YES) { | ||
189 | // return; | ||
190 | // } | ||
191 | if ([CMMotionActivityManager isActivityAvailable]) { | 204 | if ([CMMotionActivityManager isActivityAvailable]) { |
192 | [progressHud showAnimated:YES]; | 205 | [progressHud showAnimated:YES]; |
193 | [progressHud setHidden:NO]; | 206 | [progressHud setHidden:NO]; |
194 | // self.isRequesting = YES; | ||
195 | self.bike = 0; | 207 | self.bike = 0; |
196 | self.walking = 0; | 208 | self.walking = 0; |
197 | self.running = 0; | 209 | self.running = 0; |
198 | NSDate *startDate = [self.dateCurrent beginningAtMidnightOfDay]; | 210 | NSDate *startDate = [date beginningAtMidnightOfDay]; |
199 | NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | 211 | NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; |
200 | 212 | ||
201 | HomeViewController __weak *weakSelf = self; | 213 | HomeViewController __weak *weakSelf = self; |
202 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); | 214 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.forDay", NULL); |
203 | dispatch_async(myQueue, ^{ | 215 | dispatch_async(myQueue, ^{ |
204 | if (weakSelf == nil) { | 216 | if (weakSelf == nil) { |
205 | return ; | 217 | return ; |
206 | } | 218 | } |
207 | 219 | ||
208 | [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | 220 | [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { |
209 | if (error || activities.count <= 0) { | 221 | if (error || activities.count <= 0) { |
210 | weakSelf.totalRequest = 0; | 222 | weakSelf.totalRequest = 0; |
211 | weakSelf.countComplete = 0; | 223 | weakSelf.countComplete = 0; |
212 | dispatch_async(dispatch_get_main_queue(), ^{ | 224 | dispatch_async(dispatch_get_main_queue(), ^{ |
213 | [weakSelf updateStepUI]; | 225 | [weakSelf updateStepUI]; |
214 | }); | 226 | }); |
215 | return ; | 227 | return ; |
216 | } | 228 | } |
217 | // set EndDate | 229 | // set EndDate |
218 | weakSelf.totalRequest = (int)activities.count; | 230 | weakSelf.totalRequest = (int)activities.count; |
219 | NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | 231 | NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; |
220 | for (int i = 0; i < activities.count; i++) { | 232 | for (int i = 0; i < activities.count; i++) { |
221 | CMMotionActivity *activity = [activities objectAtIndex:i]; | 233 | CMMotionActivity *activity = [activities objectAtIndex:i]; |
222 | CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | 234 | CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; |
223 | activityExtra.activity = activity; | 235 | activityExtra.activity = activity; |
224 | if (i == activities.count - 1) { | 236 | if (i == activities.count - 1) { |
225 | activityExtra.endDate = endDate; | 237 | activityExtra.endDate = endDate; |
226 | } | 238 | } |
227 | else { | 239 | else { |
228 | CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | 240 | CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; |
229 | activityExtra.endDate = activityNext.startDate; | 241 | activityExtra.endDate = activityNext.startDate; |
230 | } | 242 | } |
231 | [arrayActivities addObject:activityExtra]; | 243 | [arrayActivities addObject:activityExtra]; |
232 | } | 244 | } |
233 | 245 | ||
234 | for (CMMotionActivityExtra *activityExtra in arrayActivities) { | 246 | for (CMMotionActivityExtra *activityExtra in arrayActivities) { |
235 | // NSLog(@"%@", activityExtra.activity.startDate); | ||
236 | [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | 247 | [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { |
237 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | 248 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; |
238 | int mode = 1; | 249 | int mode = 1; |
239 | if (activityExtra.activity.cycling) { | 250 | if (activityExtra.activity.cycling) { |
240 | // self.bike | 251 | // self.bike |
241 | weakSelf.bike += numberStep; | 252 | weakSelf.bike += numberStep; |
242 | //NSLog(@"Step cycling"); | ||
243 | mode = 3; | 253 | mode = 3; |
244 | } | 254 | } |
245 | else if (activityExtra.activity.walking) { | 255 | else if (activityExtra.activity.walking) { |
246 | // self.walking | 256 | // self.walking |
247 | weakSelf.walking += numberStep; | 257 | weakSelf.walking += numberStep; |
248 | //NSLog(@"Step walking"); | ||
249 | mode = 1; | 258 | mode = 1; |
250 | } | 259 | } |
251 | else if (activityExtra.activity.running) { | 260 | else if (activityExtra.activity.running) { |
252 | weakSelf.running += numberStep; | 261 | weakSelf.running += numberStep; |
253 | //NSLog(@"Step running"); | ||
254 | mode = 2; | 262 | mode = 2; |
255 | } | 263 | } |
256 | else { | 264 | else { |
257 | // unknown | 265 | // unknown |
258 | //NSLog(@"Step unknown"); | ||
259 | } | 266 | } |
260 | // NSLog(@"Number of step--> %ld", numberStep); | ||
261 | weakSelf.countComplete += 1; | 267 | weakSelf.countComplete += 1; |
262 | 268 | ||
263 | // save step to server | 269 | // save step to server |
264 | if (numberStep > 0) { | 270 | if (numberStep > 0) { |
265 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | 271 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; |
266 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | 272 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; |
267 | NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | 273 | NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; |
268 | NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | 274 | NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; |
269 | [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | 275 | [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { |
270 | if (error) { | 276 | if (error) { |
271 | NSLog(@"Error: %@", error); | 277 | NSLog(@"Error: %@", error); |
272 | } | 278 | } |
273 | }]; | 279 | }]; |
274 | } | 280 | } |
275 | dispatch_async(dispatch_get_main_queue(), ^{ | 281 | dispatch_async(dispatch_get_main_queue(), ^{ |
276 | [weakSelf updateStepUI]; | 282 | [weakSelf updateStepUI]; |
277 | }); | 283 | }); |
278 | }]; | 284 | }]; |
279 | } | 285 | } |
280 | // NSLog(@"-----------------------------------------------------"); | ||
281 | }]; | 286 | }]; |
282 | }); | 287 | }); |
283 | } | 288 | } |
284 | else { | 289 | else { |
285 | [progressHud setHidden:YES]; | 290 | [progressHud setHidden:YES]; |
286 | } | 291 | } |
287 | } | 292 | } |
288 | 293 | ||
289 | - (void)updateStepUI //:(NSInteger)numberStep | 294 | - (void)updateStepUI |
290 | { | 295 | { |
291 | if (self.totalRequest == self.countComplete) { | 296 | if (self.totalRequest == self.countComplete) { |
292 | switch (self.segmentHome.selectedSegmentIndex) { | 297 | switch (self.segmentHome.selectedSegmentIndex) { |
293 | case 0: | 298 | case 0: |
294 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.bike]; | 299 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.bike]; |
295 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.bike]; | 300 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.bike]; |
296 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.bike*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 301 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.bike*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
297 | break; | 302 | break; |
298 | 303 | ||
299 | case 1: | 304 | case 1: |
300 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.walking]; | 305 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.walking]; |
301 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.walking]; | 306 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.walking]; |
302 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.walking*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 307 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.walking*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
303 | break; | 308 | break; |
304 | 309 | ||
305 | case 2: | 310 | case 2: |
306 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.running]; | 311 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.running]; |
307 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.running]; | 312 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.running]; |
308 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.running*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 313 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.running*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
309 | break; | 314 | break; |
310 | 315 | ||
311 | default: | 316 | default: |
312 | break; | 317 | break; |
313 | } | 318 | } |
314 | // NSLog(@"Walking: %ld || Running: %ld || Bike: %ld", self.walking, self.running, self.bike); | ||
315 | // self.isRequesting = NO; | ||
316 | self.countComplete = 0; | 319 | self.countComplete = 0; |
317 | self.totalRequest = 0; | 320 | self.totalRequest = 0; |
318 | [progressHud setHidden:YES]; | 321 | [progressHud setHidden:YES]; |
322 | } | ||
323 | } | ||
324 | |||
325 | - (void)saveDataStep7LastDay | ||
326 | { | ||
327 | NSDate *dateNow = [NSDate date]; | ||
328 | for (int index = 0; index < 7; index++) { | ||
329 | dateNow = [dateNow dateByAddingTimeInterval:-(24*60*60)]; | ||
330 | [self saveStepByDate:dateNow]; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | - (void)saveStepByDate:(NSDate *)date | ||
335 | { | ||
336 | if ([CMMotionActivityManager isActivityAvailable]) { | ||
337 | NSDate *startDate = [date beginningAtMidnightOfDay]; | ||
338 | NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | ||
339 | |||
340 | HomeViewController __weak *weakSelf = self; | ||
341 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.7lastday", NULL); | ||
342 | dispatch_async(myQueue, ^{ | ||
343 | if (weakSelf == nil) { | ||
344 | return ; | ||
345 | } | ||
346 | |||
347 | [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | ||
348 | if (error || activities.count <= 0) { | ||
349 | return ; | ||
350 | } | ||
351 | // set EndDate | ||
352 | NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | ||
353 | for (int i = 0; i < activities.count; i++) { | ||
354 | CMMotionActivity *activity = [activities objectAtIndex:i]; | ||
355 | CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | ||
356 | activityExtra.activity = activity; | ||
357 | if (i == activities.count - 1) { | ||
358 | activityExtra.endDate = endDate; | ||
359 | } | ||
360 | else { | ||
361 | CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | ||
362 | activityExtra.endDate = activityNext.startDate; | ||
363 | } | ||
364 | [arrayActivities addObject:activityExtra]; | ||
365 | } | ||
366 | |||
367 | for (CMMotionActivityExtra *activityExtra in arrayActivities) { | ||
368 | [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | ||
369 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | ||
370 | int mode = 1; | ||
371 | if (activityExtra.activity.cycling) { | ||
372 | mode = 3; | ||
373 | } | ||
374 | else if (activityExtra.activity.walking) { | ||
375 | mode = 1; | ||
376 | } | ||
377 | else if (activityExtra.activity.running) { | ||
378 | mode = 2; | ||
379 | } | ||
380 | else { | ||
381 | // unknown | ||
382 | } | ||
383 | |||
384 | // save step to server | ||
385 | if (numberStep > 0) { | ||
386 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | ||
387 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | ||
388 | NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; |
LifeLog/LifeLog/MapViewController.m
1 | // | 1 | // |
2 | // MapViewController.m | 2 | // MapViewController.m |
3 | // LifeLog | 3 | // LifeLog |
4 | // | 4 | // |
5 | // Created by Nguyen Van Phong on 7/25/17. | 5 | // Created by Nguyen Van Phong on 7/25/17. |
6 | // Copyright © 2017 PhongNV. All rights reserved. | 6 | // Copyright © 2017 PhongNV. All rights reserved. |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "MapViewController.h" | 9 | #import "MapViewController.h" |
10 | #import <MapKit/MapKit.h> | 10 | #import <MapKit/MapKit.h> |
11 | #import<CoreLocation/CoreLocation.h> | 11 | #import<CoreLocation/CoreLocation.h> |
12 | #import <CoreMotion/CoreMotion.h> | 12 | #import <CoreMotion/CoreMotion.h> |
13 | #import "NSDate+helper.h" | 13 | #import "NSDate+helper.h" |
14 | #import "Utilities.h" | 14 | #import "Utilities.h" |
15 | 15 | ||
16 | @interface MapViewController ()<CLLocationManagerDelegate, MKMapViewDelegate> | 16 | @interface MapViewController ()<CLLocationManagerDelegate, MKMapViewDelegate> |
17 | { | 17 | { |
18 | CLGeocoder *geocoder; | 18 | CLGeocoder *geocoder; |
19 | CLPlacemark *placemark; | 19 | CLPlacemark *placemark; |
20 | CLLocation *previousLocation; | 20 | CLLocation *previousLocation; |
21 | } | 21 | } |
22 | @property (weak, nonatomic) IBOutlet MKMapView *mapView; | 22 | @property (weak, nonatomic) IBOutlet MKMapView *mapView; |
23 | @property (weak, nonatomic) IBOutlet UILabel *lblTime; | 23 | @property (weak, nonatomic) IBOutlet UILabel *lblTime; |
24 | @property (weak, nonatomic) IBOutlet UISlider *slider; | 24 | @property (weak, nonatomic) IBOutlet UISlider *slider; |
25 | 25 | ||
26 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStep; | 26 | @property (nonatomic, weak) IBOutlet UILabel *lblValueStep; |
27 | @property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; | 27 | @property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; |
28 | 28 | ||
29 | @property (strong, nonatomic) CLLocationManager *locationManager; | 29 | @property (strong, nonatomic) CLLocationManager *locationManager; |
30 | 30 | ||
31 | @property (nonatomic, strong) CMPedometer *pedometer; | 31 | @property (nonatomic, strong) CMPedometer *pedometer; |
32 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; | 32 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; |
33 | @property (nonatomic, strong) NSOperationQueue *operationQueue; | 33 | @property (nonatomic, strong) NSOperationQueue *operationQueue; |
34 | @property (nonatomic, strong) NSTimer *timer; | 34 | @property (nonatomic, strong) NSTimer *timer; |
35 | @property (nonatomic) int countTime; | 35 | @property (nonatomic) int countTime; |
36 | @property (nonatomic, assign) BOOL isRequesting; | 36 | @property (nonatomic, assign) BOOL isRequesting; |
37 | @end | 37 | @end |
38 | 38 | ||
39 | @implementation MapViewController | 39 | @implementation MapViewController |
40 | 40 | ||
41 | - (void)viewDidLoad { | 41 | - (void)viewDidLoad { |
42 | [super viewDidLoad]; | 42 | [super viewDidLoad]; |
43 | // Do any additional setup after loading the view from its nib. | 43 | // Do any additional setup after loading the view from its nib. |
44 | self.title = NSLocalizedString(@"lifelog.tapbar.map", nil); | 44 | self.title = NSLocalizedString(@"lifelog.tapbar.map", nil); |
45 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mapView attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | 45 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mapView attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; |
46 | geocoder = [[CLGeocoder alloc] init]; | 46 | geocoder = [[CLGeocoder alloc] init]; |
47 | [self setupLocation]; | 47 | [self setupLocation]; |
48 | [self setupMapView]; | 48 | [self setupMapView]; |
49 | previousLocation = nil; | 49 | previousLocation = nil; |
50 | 50 | ||
51 | if ([CMPedometer isStepCountingAvailable]) { | 51 | if ([CMPedometer isStepCountingAvailable]) { |
52 | _pedometer = [[CMPedometer alloc] init]; | 52 | _pedometer = [[CMPedometer alloc] init]; |
53 | } | 53 | } |
54 | if ([CMMotionActivityManager isActivityAvailable]) { | 54 | if ([CMMotionActivityManager isActivityAvailable]) { |
55 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; | 55 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; |
56 | } | 56 | } |
57 | self.isRequesting = NO; | 57 | self.isRequesting = NO; |
58 | _countTime = 0; | 58 | _countTime = 0; |
59 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | 59 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); |
60 | } | 60 | } |
61 | 61 | ||
62 | - (void)didReceiveMemoryWarning { | 62 | - (void)didReceiveMemoryWarning { |
63 | [super didReceiveMemoryWarning]; | 63 | [super didReceiveMemoryWarning]; |
64 | // Dispose of any resources that can be recreated. | 64 | // Dispose of any resources that can be recreated. |
65 | } | 65 | } |
66 | 66 | ||
67 | - (void)viewWillAppear:(BOOL)animated { | 67 | - (void)viewWillAppear:(BOOL)animated { |
68 | [super viewWillAppear:animated]; | 68 | [super viewWillAppear:animated]; |
69 | _timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(countStep) userInfo:nil repeats:YES]; | 69 | _timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(countStep) userInfo:nil repeats:YES]; |
70 | [_timer fire]; | 70 | [_timer fire]; |
71 | } | 71 | } |
72 | 72 | ||
73 | - (void)viewWillDisappear:(BOOL)animated { | 73 | //- (void)viewWillDisappear:(BOOL)animated { |
74 | [super viewWillDisappear:animated]; | 74 | // [super viewWillDisappear:animated]; |
75 | [_timer invalidate]; | 75 | // [_timer invalidate]; |
76 | } | 76 | //} |
77 | 77 | ||
78 | #pragma mark - CLLocationManagerDelegate | 78 | #pragma mark - CLLocationManagerDelegate |
79 | -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { | 79 | -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { |
80 | 80 | ||
81 | CLLocation *newLocation = [locations lastObject]; | 81 | CLLocation *newLocation = [locations lastObject]; |
82 | if (previousLocation == nil) { | 82 | if (previousLocation == nil) { |
83 | [self addAnnotationsOnMap:newLocation]; | 83 | [self addAnnotationsOnMap:newLocation]; |
84 | } | 84 | } |
85 | else { | 85 | else { |
86 | CLLocationCoordinate2D area[2]; | 86 | CLLocationCoordinate2D area[2]; |
87 | area[0] = previousLocation.coordinate; | 87 | area[0] = previousLocation.coordinate; |
88 | area[1] = newLocation.coordinate; | 88 | area[1] = newLocation.coordinate; |
89 | MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:area count:2]; | 89 | MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:area count:2]; |
90 | [_mapView addOverlay:polyLine]; | 90 | [_mapView addOverlay:polyLine]; |
91 | } | 91 | } |
92 | 92 | ||
93 | previousLocation = newLocation; | 93 | previousLocation = newLocation; |
94 | } | 94 | } |
95 | 95 | ||
96 | - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error | 96 | - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error |
97 | { | 97 | { |
98 | NSLog(@"Cannot find the location."); | 98 | NSLog(@"Cannot find the location."); |
99 | } | 99 | } |
100 | 100 | ||
101 | #pragma mark - MKMapViewDelegate | 101 | #pragma mark - MKMapViewDelegate |
102 | - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay | 102 | - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay |
103 | { | 103 | { |
104 | if ([overlay isKindOfClass:[MKPolyline class]]) { | 104 | if ([overlay isKindOfClass:[MKPolyline class]]) { |
105 | MKPolylineRenderer *pr = [[MKPolylineRenderer alloc] initWithOverlay:overlay]; | 105 | MKPolylineRenderer *pr = [[MKPolylineRenderer alloc] initWithOverlay:overlay]; |
106 | pr.strokeColor = [UIColor redColor]; | 106 | pr.strokeColor = [UIColor redColor]; |
107 | pr.lineWidth = 5; | 107 | pr.lineWidth = 5; |
108 | return pr; | 108 | return pr; |
109 | } | 109 | } |
110 | return nil; | 110 | return nil; |
111 | } | 111 | } |
112 | 112 | ||
113 | #pragma mark - Functions Private | 113 | #pragma mark - Functions Private |
114 | 114 | ||
115 | - (void)addAnnotationsOnMap:(CLLocation *)locationToPoint { | 115 | - (void)addAnnotationsOnMap:(CLLocation *)locationToPoint { |
116 | MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init]; | 116 | MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init]; |
117 | annotation.coordinate = locationToPoint.coordinate; | 117 | annotation.coordinate = locationToPoint.coordinate; |
118 | [geocoder reverseGeocodeLocation:locationToPoint completionHandler:^(NSArray *placemarks, NSError *error) { | 118 | [geocoder reverseGeocodeLocation:locationToPoint completionHandler:^(NSArray *placemarks, NSError *error) { |
119 | if (error == nil && [placemarks count] >0) { | 119 | if (error == nil && [placemarks count] >0) { |
120 | placemark = [placemarks firstObject]; | 120 | placemark = [placemarks firstObject]; |
121 | NSDictionary *addressDict = placemark.addressDictionary; | 121 | NSDictionary *addressDict = placemark.addressDictionary; |
122 | annotation.title = [NSString stringWithFormat:@"%@", addressDict[@"Name"]]; | 122 | annotation.title = [NSString stringWithFormat:@"%@", addressDict[@"Name"]]; |
123 | [_mapView addAnnotation:annotation]; | 123 | [_mapView addAnnotation:annotation]; |
124 | } | 124 | } |
125 | }]; | 125 | }]; |
126 | } | 126 | } |
127 | 127 | ||
128 | - (void)setupLocation { | 128 | - (void)setupLocation { |
129 | _locationManager = [[CLLocationManager alloc] init]; | 129 | _locationManager = [[CLLocationManager alloc] init]; |
130 | _locationManager.desiredAccuracy = kCLLocationAccuracyBest; | 130 | _locationManager.desiredAccuracy = kCLLocationAccuracyBest; |
131 | _locationManager.delegate = self; | 131 | _locationManager.delegate = self; |
132 | CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; | 132 | CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; |
133 | if (status == kCLAuthorizationStatusNotDetermined || status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusAuthorizedWhenInUse) { | 133 | if (status == kCLAuthorizationStatusNotDetermined || status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusAuthorizedWhenInUse) { |
134 | [_locationManager requestWhenInUseAuthorization]; | 134 | [_locationManager requestWhenInUseAuthorization]; |
135 | [_locationManager requestAlwaysAuthorization]; | 135 | [_locationManager requestAlwaysAuthorization]; |
136 | } | 136 | } |
137 | [_locationManager startUpdatingLocation]; | 137 | [_locationManager startUpdatingLocation]; |
138 | [_locationManager startUpdatingHeading]; | 138 | [_locationManager startUpdatingHeading]; |
139 | } | 139 | } |
140 | 140 | ||
141 | - (void)setupMapView { | 141 | - (void)setupMapView { |
142 | _mapView.delegate = self; | 142 | _mapView.delegate = self; |
143 | _mapView.showsUserLocation = YES; | 143 | _mapView.showsUserLocation = YES; |
144 | _mapView.mapType = MKMapTypeStandard; | 144 | _mapView.mapType = MKMapTypeStandard; |
145 | _mapView.userTrackingMode = MKUserTrackingModeFollowWithHeading; | 145 | _mapView.userTrackingMode = MKUserTrackingModeFollowWithHeading; |
146 | } | 146 | } |
147 | 147 | ||
148 | #pragma mark - Functions Private | 148 | #pragma mark - Functions Private |
149 | - (void)countStep | 149 | - (void)countStep |
150 | { | 150 | { |
151 | _countTime++; | 151 | _countTime++; |
152 | _lblTime.text = [self convertTime:_countTime]; | 152 | _lblTime.text = [self convertTime:_countTime]; |
153 | _slider.value = _countTime; | 153 | _slider.value = _countTime; |
154 | if (self.isRequesting == YES) { | 154 | if (self.isRequesting == YES) { |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | if ([CMMotionActivityManager isActivityAvailable]) { | 157 | if ([CMMotionActivityManager isActivityAvailable]) { |
158 | self.isRequesting = YES; | 158 | self.isRequesting = YES; |
159 | NSDate *endDate = [NSDate date]; | 159 | NSDate *endDate = [NSDate date]; |
160 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; | 160 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; |
161 | MapViewController __weak *weakSelf = self; | 161 | MapViewController __weak *weakSelf = self; |
162 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); | 162 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); |
163 | dispatch_async(myQueue, ^{ | 163 | dispatch_async(myQueue, ^{ |
164 | if (weakSelf == nil) { | 164 | if (weakSelf == nil) { |
165 | return ; | 165 | return ; |
166 | } | 166 | } |
167 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | 167 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { |
168 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | 168 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; |
169 | dispatch_async(dispatch_get_main_queue(), ^{ | 169 | dispatch_async(dispatch_get_main_queue(), ^{ |
170 | [weakSelf updateStepUI:numberStep]; | 170 | [weakSelf updateStepUI:numberStep]; |
171 | }); | 171 | }); |
172 | }]; | 172 | }]; |
173 | }); | 173 | }); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | - (NSString *)convertTime:(int)time | 177 | - (NSString *)convertTime:(int)time |
178 | { | 178 | { |
179 | NSString *result = @""; | 179 | NSString *result = @""; |
180 | int hour = time/3600; | 180 | int hour = time/3600; |
181 | int minute = time/60; | 181 | int minute = time/60; |
182 | int second = time % 60; | 182 | int second = time % 60; |
183 | result = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, minute, second]; | 183 | result = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, minute, second]; |
184 | return result; | 184 | return result; |
185 | } | 185 | } |
186 | 186 | ||
187 | - (void)updateStepUI:(NSInteger)numberStep | 187 | - (void)updateStepUI:(NSInteger)numberStep |
188 | { | 188 | { |
189 | // NSLog(@"Number of step: %ld", numberStep); | 189 | // NSLog(@"Number of step: %ld", numberStep); |
190 | self.isRequesting = NO; | 190 | self.isRequesting = NO; |
191 | self.lblValueStep.text = [Utilities addCommaFromNumber:numberStep]; | 191 | self.lblValueStep.text = [Utilities addCommaFromNumber:numberStep]; |
192 | } | 192 | } |
193 | 193 | ||
194 | @end | 194 | @end |
195 | 195 |
LifeLog/LifeLog/TodayViewController.m
1 | // | 1 | // |
2 | // TodayViewController.m | 2 | // TodayViewController.m |
3 | // LifeLog | 3 | // LifeLog |
4 | // | 4 | // |
5 | // Created by Nguyen Van Phong on 7/29/17. | 5 | // Created by Nguyen Van Phong on 7/29/17. |
6 | // Copyright © 2017 PhongNV. All rights reserved. | 6 | // Copyright © 2017 PhongNV. All rights reserved. |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "TodayViewController.h" | 9 | #import "TodayViewController.h" |
10 | #import <CircleProgressBar/CircleProgressBar.h> | 10 | #import <CircleProgressBar/CircleProgressBar.h> |
11 | #import <CoreMotion/CoreMotion.h> | 11 | #import <CoreMotion/CoreMotion.h> |
12 | #import "NSDate+helper.h" | 12 | #import "NSDate+helper.h" |
13 | #import "Utilities.h" | 13 | #import "Utilities.h" |
14 | 14 | ||
15 | static NSInteger numberTotal = 10000; | 15 | static NSInteger numberTotal = 10000; |
16 | 16 | ||
17 | @interface TodayViewController () | 17 | @interface TodayViewController () |
18 | @property (nonatomic, weak) IBOutlet UILabel *lblTitle; | 18 | @property (nonatomic, weak) IBOutlet UILabel *lblTitle; |
19 | @property (weak, nonatomic) IBOutlet CircleProgressBar *circleProgressToday; | 19 | @property (weak, nonatomic) IBOutlet CircleProgressBar *circleProgressToday; |
20 | @property (weak, nonatomic) IBOutlet UILabel *lblValueStep; | 20 | @property (weak, nonatomic) IBOutlet UILabel *lblValueStep; |
21 | @property (weak, nonatomic) IBOutlet UILabel *lblTotalStep; | 21 | @property (weak, nonatomic) IBOutlet UILabel *lblTotalStep; |
22 | @property (weak, nonatomic) IBOutlet UILabel *lblRemainingStep; | 22 | @property (weak, nonatomic) IBOutlet UILabel *lblRemainingStep; |
23 | @property (weak, nonatomic) IBOutlet UILabel *lblTotalStepOther; | 23 | @property (weak, nonatomic) IBOutlet UILabel *lblTotalStepOther; |
24 | @property (weak, nonatomic) IBOutlet UILabel *lblRemainingStepOther; | 24 | @property (weak, nonatomic) IBOutlet UILabel *lblRemainingStepOther; |
25 | @property (weak, nonatomic) IBOutlet UILabel *lblPercent; | 25 | @property (weak, nonatomic) IBOutlet UILabel *lblPercent; |
26 | 26 | ||
27 | @property (nonatomic, strong) CMPedometer *pedometer; | 27 | @property (nonatomic, strong) CMPedometer *pedometer; |
28 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; | 28 | @property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; |
29 | @property (nonatomic, strong) NSOperationQueue *operationQueue; | 29 | @property (nonatomic, strong) NSOperationQueue *operationQueue; |
30 | @property (nonatomic, strong) NSTimer *timer; | 30 | @property (nonatomic, strong) NSTimer *timer; |
31 | 31 | ||
32 | @property (nonatomic, assign) BOOL isRequesting; | 32 | @property (nonatomic, assign) BOOL isRequesting; |
33 | @end | 33 | @end |
34 | 34 | ||
35 | @implementation TodayViewController | 35 | @implementation TodayViewController |
36 | 36 | ||
37 | - (void)viewDidLoad { | 37 | - (void)viewDidLoad { |
38 | [super viewDidLoad]; | 38 | [super viewDidLoad]; |
39 | // Do any additional setup after loading the view from its nib. | 39 | // Do any additional setup after loading the view from its nib. |
40 | self.lblTitle.text = NSLocalizedString(@"lifelog.today.title", nil); | 40 | self.lblTitle.text = NSLocalizedString(@"lifelog.today.title", nil); |
41 | 41 | ||
42 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | 42 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; |
43 | 43 | ||
44 | if ([CMPedometer isStepCountingAvailable]) { | 44 | if ([CMPedometer isStepCountingAvailable]) { |
45 | _pedometer = [[CMPedometer alloc] init]; | 45 | _pedometer = [[CMPedometer alloc] init]; |
46 | } | 46 | } |
47 | if ([CMMotionActivityManager isActivityAvailable]) { | 47 | if ([CMMotionActivityManager isActivityAvailable]) { |
48 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; | 48 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; |
49 | } | 49 | } |
50 | self.isRequesting = NO; | 50 | self.isRequesting = NO; |
51 | } | 51 | } |
52 | 52 | ||
53 | - (void)viewWillAppear:(BOOL)animated { | 53 | - (void)viewWillAppear:(BOOL)animated { |
54 | [super viewWillAppear:animated]; | 54 | [super viewWillAppear:animated]; |
55 | _timer = [NSTimer scheduledTimerWithTimeInterval:0.3f target:self selector:@selector(countStep) userInfo:nil repeats:YES]; | 55 | _timer = [NSTimer scheduledTimerWithTimeInterval:0.3f target:self selector:@selector(countStep) userInfo:nil repeats:YES]; |
56 | [_timer fire]; | 56 | [_timer fire]; |
57 | } | 57 | } |
58 | 58 | ||
59 | - (void)viewWillDisappear:(BOOL)animated { | 59 | - (void)viewWillDisappear:(BOOL)animated { |
60 | [super viewWillDisappear:animated]; | 60 | [super viewWillDisappear:animated]; |
61 | [_timer invalidate]; | 61 | [_timer invalidate]; |
62 | } | 62 | } |
63 | 63 | ||
64 | - (void)didReceiveMemoryWarning { | 64 | - (void)didReceiveMemoryWarning { |
65 | [super didReceiveMemoryWarning]; | 65 | [super didReceiveMemoryWarning]; |
66 | // Dispose of any resources that can be recreated. | 66 | // Dispose of any resources that can be recreated. |
67 | } | 67 | } |
68 | 68 | ||
69 | #pragma mark - IBAction | 69 | #pragma mark - IBAction |
70 | - (IBAction)menuButtonTouchUpInside:(id)sender | 70 | - (IBAction)menuButtonTouchUpInside:(id)sender |
71 | { | 71 | { |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | - (IBAction)backButtonTouchUpInside:(id)sender | 75 | - (IBAction)backButtonTouchUpInside:(id)sender |
76 | { | 76 | { |
77 | [self.navigationController popViewControllerAnimated:YES]; | 77 | [self.navigationController popViewControllerAnimated:YES]; |
78 | } | 78 | } |
79 | 79 | ||
80 | - (IBAction)buttonShareTouchUpInside:(id)sender { | ||
81 | |||
82 | } | ||
83 | |||
84 | - (IBAction)buttonFacebookTouchUpInside:(id)sender { | ||
85 | NSString * content = @"Finish 500 steps"; | ||
86 | TodayViewController __weak *weakSelf = self; | ||
87 | [Utilities shareFacebook:content withViewController:weakSelf]; | ||
88 | } | ||
89 | |||
90 | - (IBAction)buttonLineTouchUpInside:(id)sender { | ||
91 | NSString * content = @"Finish 500 steps"; | ||
92 | TodayViewController __weak *weakSelf = self; | ||
93 | [Utilities shareLine:content withViewController:weakSelf]; | ||
94 | } | ||
95 | |||
80 | #pragma mark - Functions Private | 96 | #pragma mark - Functions Private |
81 | - (void)countStep | 97 | - (void)countStep |
82 | { | 98 | { |
83 | if (self.isRequesting == YES) { | 99 | if (self.isRequesting == YES) { |
84 | return; | 100 | return; |
85 | } | 101 | } |
86 | if ([CMMotionActivityManager isActivityAvailable]) { | 102 | if ([CMMotionActivityManager isActivityAvailable]) { |
87 | self.isRequesting = YES; | 103 | self.isRequesting = YES; |
88 | NSDate *endDate = [NSDate date]; | 104 | NSDate *endDate = [NSDate date]; |
89 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; | 105 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; |
90 | TodayViewController __weak *weakSelf = self; | 106 | TodayViewController __weak *weakSelf = self; |
91 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); | 107 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); |
92 | dispatch_async(myQueue, ^{ | 108 | dispatch_async(myQueue, ^{ |
93 | if (weakSelf == nil) { | 109 | if (weakSelf == nil) { |
94 | return ; | 110 | return ; |
95 | } | 111 | } |
96 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | 112 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { |
97 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | 113 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; |
98 | dispatch_async(dispatch_get_main_queue(), ^{ | 114 | dispatch_async(dispatch_get_main_queue(), ^{ |
99 | [weakSelf updateStepUI:numberStep]; | 115 | [weakSelf updateStepUI:numberStep]; |
100 | }); | 116 | }); |
101 | }]; | 117 | }]; |
102 | }); | 118 | }); |
103 | } | 119 | } |
104 | } | 120 | } |
105 | 121 | ||
106 | - (void)updateStepUI:(NSInteger)numberStep | 122 | - (void)updateStepUI:(NSInteger)numberStep |
107 | { | 123 | { |
108 | // NSLog(@"Number of step: %ld", numberStep); | 124 | // NSLog(@"Number of step: %ld", numberStep); |
109 | self.isRequesting = NO; | 125 | self.isRequesting = NO; |
110 | float valueProgress = numberStep*1.f/numberTotal; | 126 | float valueProgress = numberStep*1.f/numberTotal; |
111 | [self.circleProgressToday setProgress:valueProgress animated:YES]; | 127 | [self.circleProgressToday setProgress:valueProgress animated:YES]; |
112 | self.lblValueStep.text = [Utilities addCommaFromNumber:numberStep]; | 128 | self.lblValueStep.text = [Utilities addCommaFromNumber:numberStep]; |
113 | self.lblTotalStep.text = [NSString stringWithFormat:@"/ %@", [Utilities addCommaFromNumber:numberTotal]]; | 129 | self.lblTotalStep.text = [NSString stringWithFormat:@"/ %@", [Utilities addCommaFromNumber:numberTotal]]; |
114 | self.lblRemainingStep.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.step.1", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.remaining.step.2", nil)]; | 130 | self.lblRemainingStep.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.step.1", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.remaining.step.2", nil)]; |
115 | self.lblTotalStepOther.text = [NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"lifelog.today.total.other", nil), [Utilities addCommaFromNumber:numberTotal], NSLocalizedString(@"lifelog.today.unit.step", nil)]; | 131 | self.lblTotalStepOther.text = [NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"lifelog.today.total.other", nil), [Utilities addCommaFromNumber:numberTotal], NSLocalizedString(@"lifelog.today.unit.step", nil)]; |
116 | self.lblRemainingStepOther.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.other", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.unit.step", nil)]; | 132 | self.lblRemainingStepOther.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.other", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.unit.step", nil)]; |
117 | self.lblPercent.text = [NSString stringWithFormat:@"%@%i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(numberStep*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 133 | self.lblPercent.text = [NSString stringWithFormat:@"%@%i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(numberStep*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
118 | } | 134 | } |
119 | 135 | ||
120 | @end | 136 | @end |
121 | 137 |
LifeLog/LifeLog/TodayViewController.xib
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | 2 | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> |
3 | <device id="retina4_7" orientation="portrait"> | 3 | <device id="retina4_7" orientation="portrait"> |
4 | <adaptation id="fullscreen"/> | 4 | <adaptation id="fullscreen"/> |
5 | </device> | 5 | </device> |
6 | <dependencies> | 6 | <dependencies> |
7 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | 7 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> |
8 | <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> | 8 | <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> |
9 | <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> | 9 | <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> |
10 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | 10 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
11 | </dependencies> | 11 | </dependencies> |
12 | <objects> | 12 | <objects> |
13 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TodayViewController"> | 13 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TodayViewController"> |
14 | <connections> | 14 | <connections> |
15 | <outlet property="circleProgressToday" destination="oRx-7J-bma" id="ljj-Xx-OOH"/> | 15 | <outlet property="circleProgressToday" destination="oRx-7J-bma" id="ljj-Xx-OOH"/> |
16 | <outlet property="lblPercent" destination="11m-je-qZ1" id="Tjq-td-B22"/> | 16 | <outlet property="lblPercent" destination="11m-je-qZ1" id="Tjq-td-B22"/> |
17 | <outlet property="lblRemainingStep" destination="dEz-7j-nXc" id="03L-hQ-Kiv"/> | 17 | <outlet property="lblRemainingStep" destination="dEz-7j-nXc" id="03L-hQ-Kiv"/> |
18 | <outlet property="lblRemainingStepOther" destination="V2B-wZ-Efk" id="XNr-bG-LbN"/> | 18 | <outlet property="lblRemainingStepOther" destination="V2B-wZ-Efk" id="XNr-bG-LbN"/> |
19 | <outlet property="lblTitle" destination="2SZ-sd-ADD" id="Ztf-W5-jwd"/> | 19 | <outlet property="lblTitle" destination="2SZ-sd-ADD" id="Ztf-W5-jwd"/> |
20 | <outlet property="lblTotalStep" destination="Fvu-lz-xIk" id="i1e-DL-7QA"/> | 20 | <outlet property="lblTotalStep" destination="Fvu-lz-xIk" id="i1e-DL-7QA"/> |
21 | <outlet property="lblTotalStepOther" destination="dQq-cp-R2A" id="ugW-Wi-BFI"/> | 21 | <outlet property="lblTotalStepOther" destination="dQq-cp-R2A" id="ugW-Wi-BFI"/> |
22 | <outlet property="lblValueStep" destination="iCl-1r-Bwp" id="Zpf-6A-8cO"/> | 22 | <outlet property="lblValueStep" destination="iCl-1r-Bwp" id="Zpf-6A-8cO"/> |
23 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | 23 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
24 | </connections> | 24 | </connections> |
25 | </placeholder> | 25 | </placeholder> |
26 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | 26 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
27 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | 27 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> |
28 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | 28 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
29 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 29 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
30 | <subviews> | 30 | <subviews> |
31 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TODAY" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2SZ-sd-ADD" userLabel="LabelTitle"> | 31 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TODAY" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2SZ-sd-ADD" userLabel="LabelTitle"> |
32 | <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> | 32 | <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> |
33 | <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | 33 | <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
34 | <constraints> | 34 | <constraints> |
35 | <constraint firstAttribute="height" constant="44" id="Qgv-Kk-P8u"/> | 35 | <constraint firstAttribute="height" constant="44" id="Qgv-Kk-P8u"/> |
36 | </constraints> | 36 | </constraints> |
37 | <fontDescription key="fontDescription" type="system" pointSize="23"/> | 37 | <fontDescription key="fontDescription" type="system" pointSize="23"/> |
38 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 38 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
39 | <nil key="highlightedColor"/> | 39 | <nil key="highlightedColor"/> |
40 | </label> | 40 | </label> |
41 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RSj-iV-Oaf" userLabel="ButtonMenu"> | 41 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RSj-iV-Oaf" userLabel="ButtonMenu"> |
42 | <rect key="frame" x="335" y="7" width="30" height="30"/> | 42 | <rect key="frame" x="335" y="7" width="30" height="30"/> |
43 | <constraints> | 43 | <constraints> |
44 | <constraint firstAttribute="width" secondItem="RSj-iV-Oaf" secondAttribute="height" multiplier="1:1" id="Paf-pW-iOE"/> | 44 | <constraint firstAttribute="width" secondItem="RSj-iV-Oaf" secondAttribute="height" multiplier="1:1" id="Paf-pW-iOE"/> |
45 | <constraint firstAttribute="width" constant="30" id="ZEC-Fx-ygL"/> | 45 | <constraint firstAttribute="width" constant="30" id="ZEC-Fx-ygL"/> |
46 | </constraints> | 46 | </constraints> |
47 | <state key="normal" image="icon_menu"/> | 47 | <state key="normal" image="icon_menu"/> |
48 | <connections> | 48 | <connections> |
49 | <action selector="menuButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="74L-R4-bfn"/> | 49 | <action selector="menuButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="74L-R4-bfn"/> |
50 | </connections> | 50 | </connections> |
51 | </button> | 51 | </button> |
52 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yOP-KX-J14" userLabel="ButtonBack"> | 52 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yOP-KX-J14" userLabel="ButtonBack"> |
53 | <rect key="frame" x="5" y="3" width="73" height="37"/> | 53 | <rect key="frame" x="5" y="3" width="73" height="37"/> |
54 | <constraints> | 54 | <constraints> |
55 | <constraint firstAttribute="height" constant="37" id="A6m-b2-WXH"/> | 55 | <constraint firstAttribute="height" constant="37" id="A6m-b2-WXH"/> |
56 | <constraint firstAttribute="width" constant="73" id="YO8-PV-PiT"/> | 56 | <constraint firstAttribute="width" constant="73" id="YO8-PV-PiT"/> |
57 | </constraints> | 57 | </constraints> |
58 | <state key="normal" image="today_back_button"/> | 58 | <state key="normal" image="today_back_button"/> |
59 | <connections> | 59 | <connections> |
60 | <action selector="backButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="on4-Ru-Xpf"/> | 60 | <action selector="backButtonTouchUpInside:" destination="-1" eventType="touchUpInside" id="on4-Ru-Xpf"/> |
61 | </connections> | 61 | </connections> |
62 | </button> | 62 | </button> |
63 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_share" translatesAutoresizingMaskIntoConstraints="NO" id="PW6-AR-UCs"> | 63 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_share" translatesAutoresizingMaskIntoConstraints="NO" id="PW6-AR-UCs"> |
64 | <rect key="frame" x="8" y="137" width="42" height="57"/> | 64 | <rect key="frame" x="8" y="137" width="42" height="57"/> |
65 | <constraints> | 65 | <constraints> |
66 | <constraint firstAttribute="height" constant="57" id="7WA-3l-0cr"/> | 66 | <constraint firstAttribute="height" constant="57" id="7WA-3l-0cr"/> |
67 | <constraint firstAttribute="width" constant="42" id="abX-W4-Ho4"/> | 67 | <constraint firstAttribute="width" constant="42" id="abX-W4-Ho4"/> |
68 | </constraints> | 68 | </constraints> |
69 | </imageView> | 69 | </imageView> |
70 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1ak-Ne-wz9" userLabel="ButtonShare"> | ||
71 | <rect key="frame" x="8" y="137" width="42" height="57"/> | ||
72 | <connections> | ||
73 | <action selector="buttonShareTouchUpInside:" destination="-1" eventType="touchUpInside" id="dkw-ed-JhQ"/> | ||
74 | </connections> | ||
75 | </button> | ||
70 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_facebook" translatesAutoresizingMaskIntoConstraints="NO" id="Jtx-be-zjg"> | 76 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_facebook" translatesAutoresizingMaskIntoConstraints="NO" id="Jtx-be-zjg"> |
71 | <rect key="frame" x="8" y="202" width="40" height="40"/> | 77 | <rect key="frame" x="8" y="202" width="40" height="40"/> |
72 | <constraints> | 78 | <constraints> |
73 | <constraint firstAttribute="width" constant="40" id="2Fe-7S-LCC"/> | 79 | <constraint firstAttribute="width" constant="40" id="2Fe-7S-LCC"/> |
74 | <constraint firstAttribute="height" constant="40" id="5hP-gZ-Qrl"/> | 80 | <constraint firstAttribute="height" constant="40" id="5hP-gZ-Qrl"/> |
75 | </constraints> | 81 | </constraints> |
76 | </imageView> | 82 | </imageView> |
83 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HLr-Qj-bm4" userLabel="ButtonFacebook"> | ||
84 | <rect key="frame" x="8" y="202" width="40" height="40"/> | ||
85 | <connections> | ||
86 | <action selector="buttonFacebookTouchUpInside:" destination="-1" eventType="touchUpInside" id="MHi-pC-vsR"/> | ||
87 | </connections> | ||
88 | </button> | ||
77 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_line" translatesAutoresizingMaskIntoConstraints="NO" id="wHy-xz-GJV"> | 89 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_line" translatesAutoresizingMaskIntoConstraints="NO" id="wHy-xz-GJV"> |
78 | <rect key="frame" x="8" y="250" width="40" height="40"/> | 90 | <rect key="frame" x="8" y="250" width="40" height="40"/> |
79 | <constraints> | 91 | <constraints> |
80 | <constraint firstAttribute="width" constant="40" id="ElF-BB-cgs"/> | 92 | <constraint firstAttribute="width" constant="40" id="ElF-BB-cgs"/> |
81 | <constraint firstAttribute="height" constant="40" id="myc-Ev-aCy"/> | 93 | <constraint firstAttribute="height" constant="40" id="myc-Ev-aCy"/> |
82 | </constraints> | 94 | </constraints> |
83 | </imageView> | 95 | </imageView> |
96 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="equ-yC-hU1" userLabel="ButtonLine"> | ||
97 | <rect key="frame" x="8" y="250" width="40" height="40"/> | ||
98 | <connections> | ||
99 | <action selector="buttonLineTouchUpInside:" destination="-1" eventType="touchUpInside" id="9mi-bX-Uqp"/> | ||
100 | </connections> | ||
101 | </button> | ||
84 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRx-7J-bma" customClass="CircleProgressBar"> | 102 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRx-7J-bma" customClass="CircleProgressBar"> |
85 | <rect key="frame" x="60" y="94" width="255" height="255"/> | 103 | <rect key="frame" x="60" y="94" width="255" height="255"/> |
86 | <subviews> | 104 | <subviews> |
87 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qQS-5K-MuA" userLabel="ViewContent"> | 105 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qQS-5K-MuA" userLabel="ViewContent"> |
88 | <rect key="frame" x="59" y="43" width="136" height="170"/> | 106 | <rect key="frame" x="59" y="43" width="136" height="170"/> |
89 | <subviews> | 107 | <subviews> |
90 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_walking" translatesAutoresizingMaskIntoConstraints="NO" id="VwM-9C-Dye"> | 108 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_walking" translatesAutoresizingMaskIntoConstraints="NO" id="VwM-9C-Dye"> |
91 | <rect key="frame" x="61" y="2" width="14" height="25"/> | 109 | <rect key="frame" x="61" y="2" width="14" height="25"/> |
92 | <constraints> | 110 | <constraints> |
93 | <constraint firstAttribute="width" constant="14" id="mn6-eU-59Y"/> | 111 | <constraint firstAttribute="width" constant="14" id="mn6-eU-59Y"/> |
94 | <constraint firstAttribute="height" constant="25" id="rok-3H-sX5"/> | 112 | <constraint firstAttribute="height" constant="25" id="rok-3H-sX5"/> |
95 | </constraints> | 113 | </constraints> |
96 | </imageView> | 114 | </imageView> |
97 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="6,513" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iCl-1r-Bwp"> | 115 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="6,513" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iCl-1r-Bwp"> |
98 | <rect key="frame" x="0.0" y="35" width="136" height="54"/> | 116 | <rect key="frame" x="0.0" y="35" width="136" height="54"/> |
99 | <constraints> | 117 | <constraints> |
100 | <constraint firstAttribute="height" constant="54" id="OWK-YU-E5c"/> | 118 | <constraint firstAttribute="height" constant="54" id="OWK-YU-E5c"/> |
101 | </constraints> | 119 | </constraints> |
102 | <fontDescription key="fontDescription" type="boldSystem" pointSize="45"/> | 120 | <fontDescription key="fontDescription" type="boldSystem" pointSize="45"/> |
103 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 121 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
104 | <nil key="highlightedColor"/> | 122 | <nil key="highlightedColor"/> |
105 | </label> | 123 | </label> |
106 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="/ 10,000" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fvu-lz-xIk"> | 124 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="/ 10,000" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fvu-lz-xIk"> |
107 | <rect key="frame" x="0.0" y="97" width="136" height="24"/> | 125 | <rect key="frame" x="0.0" y="97" width="136" height="24"/> |
108 | <constraints> | 126 | <constraints> |
109 | <constraint firstAttribute="height" constant="24" id="ID6-U3-pcq"/> | 127 | <constraint firstAttribute="height" constant="24" id="ID6-U3-pcq"/> |
110 | </constraints> | 128 | </constraints> |
111 | <fontDescription key="fontDescription" type="system" pointSize="20"/> | 129 | <fontDescription key="fontDescription" type="system" pointSize="20"/> |
112 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 130 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
113 | <nil key="highlightedColor"/> | 131 | <nil key="highlightedColor"/> |
114 | </label> | 132 | </label> |
115 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="目模まであと3487歩です" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dEz-7j-nXc"> | 133 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="目模まであと3487歩です" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dEz-7j-nXc"> |
116 | <rect key="frame" x="0.0" y="129" width="136" height="48"/> | 134 | <rect key="frame" x="0.0" y="129" width="136" height="48"/> |
117 | <constraints> | 135 | <constraints> |
118 | <constraint firstAttribute="height" constant="48" id="IhK-uP-msA"/> | 136 | <constraint firstAttribute="height" constant="48" id="IhK-uP-msA"/> |
119 | </constraints> | 137 | </constraints> |
120 | <fontDescription key="fontDescription" type="system" pointSize="20"/> | 138 | <fontDescription key="fontDescription" type="system" pointSize="20"/> |
121 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 139 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
122 | <nil key="highlightedColor"/> | 140 | <nil key="highlightedColor"/> |
123 | </label> | 141 | </label> |
124 | </subviews> | 142 | </subviews> |
125 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | 143 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
126 | <constraints> | 144 | <constraints> |
127 | <constraint firstItem="VwM-9C-Dye" firstAttribute="top" secondItem="qQS-5K-MuA" secondAttribute="top" constant="2" id="3wt-gj-JSb"/> | 145 | <constraint firstItem="VwM-9C-Dye" firstAttribute="top" secondItem="qQS-5K-MuA" secondAttribute="top" constant="2" id="3wt-gj-JSb"/> |
128 | <constraint firstItem="dEz-7j-nXc" firstAttribute="top" secondItem="Fvu-lz-xIk" secondAttribute="bottom" constant="8" id="8HX-cn-RI5"/> | 146 | <constraint firstItem="dEz-7j-nXc" firstAttribute="top" secondItem="Fvu-lz-xIk" secondAttribute="bottom" constant="8" id="8HX-cn-RI5"/> |
129 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="top" secondItem="VwM-9C-Dye" secondAttribute="bottom" constant="8" id="8th-yr-ele"/> | 147 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="top" secondItem="VwM-9C-Dye" secondAttribute="bottom" constant="8" id="8th-yr-ele"/> |
130 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="A6X-AZ-Tlm"/> | 148 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="A6X-AZ-Tlm"/> |
131 | <constraint firstAttribute="trailing" secondItem="iCl-1r-Bwp" secondAttribute="trailing" id="ALp-VX-Oqk"/> | 149 | <constraint firstAttribute="trailing" secondItem="iCl-1r-Bwp" secondAttribute="trailing" id="ALp-VX-Oqk"/> |
132 | <constraint firstAttribute="trailing" secondItem="Fvu-lz-xIk" secondAttribute="trailing" id="ELm-PN-7hB"/> | 150 | <constraint firstAttribute="trailing" secondItem="Fvu-lz-xIk" secondAttribute="trailing" id="ELm-PN-7hB"/> |
133 | <constraint firstItem="VwM-9C-Dye" firstAttribute="centerX" secondItem="qQS-5K-MuA" secondAttribute="centerX" id="Erd-eu-Lgw"/> | 151 | <constraint firstItem="VwM-9C-Dye" firstAttribute="centerX" secondItem="qQS-5K-MuA" secondAttribute="centerX" id="Erd-eu-Lgw"/> |
134 | <constraint firstItem="dEz-7j-nXc" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="nvf-Kg-Ivk"/> | 152 | <constraint firstItem="dEz-7j-nXc" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="nvf-Kg-Ivk"/> |
135 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="top" secondItem="iCl-1r-Bwp" secondAttribute="bottom" constant="8" id="rFD-e5-Oke"/> | 153 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="top" secondItem="iCl-1r-Bwp" secondAttribute="bottom" constant="8" id="rFD-e5-Oke"/> |
136 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="ykV-Hh-2Se"/> | 154 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="ykV-Hh-2Se"/> |
137 | <constraint firstAttribute="trailing" secondItem="dEz-7j-nXc" secondAttribute="trailing" id="zdo-Fa-Bk6"/> | 155 | <constraint firstAttribute="trailing" secondItem="dEz-7j-nXc" secondAttribute="trailing" id="zdo-Fa-Bk6"/> |
138 | </constraints> | 156 | </constraints> |
139 | </view> | 157 | </view> |
140 | </subviews> | 158 | </subviews> |
141 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 159 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
142 | <constraints> | 160 | <constraints> |
143 | <constraint firstItem="qQS-5K-MuA" firstAttribute="height" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="200/299" id="KK9-9I-hBs"/> | 161 | <constraint firstItem="qQS-5K-MuA" firstAttribute="height" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="200/299" id="KK9-9I-hBs"/> |
144 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerX" secondItem="oRx-7J-bma" secondAttribute="centerX" id="iHf-Qo-LsK"/> | 162 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerX" secondItem="oRx-7J-bma" secondAttribute="centerX" id="iHf-Qo-LsK"/> |
145 | <constraint firstItem="qQS-5K-MuA" firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="width" multiplier="160/299" id="nAQ-00-V9H"/> | 163 | <constraint firstItem="qQS-5K-MuA" firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="width" multiplier="160/299" id="nAQ-00-V9H"/> |
146 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="oCW-BR-PvV"/> | 164 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="oCW-BR-PvV"/> |
147 | <constraint firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="1:1" id="of6-Gd-VOP"/> | 165 | <constraint firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="1:1" id="of6-Gd-VOP"/> |
148 | </constraints> | 166 | </constraints> |
149 | <userDefinedRuntimeAttributes> | 167 | <userDefinedRuntimeAttributes> |
150 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarProgressColor"> | 168 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarProgressColor"> |
151 | <color key="value" red="0.2196078431372549" green="0.74117647058823533" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/> | 169 | <color key="value" red="0.2196078431372549" green="0.74117647058823533" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/> |
152 | </userDefinedRuntimeAttribute> | 170 | </userDefinedRuntimeAttribute> |
153 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarTrackColor"> | 171 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarTrackColor"> |
154 | <color key="value" red="0.21176470588235294" green="0.21176470588235294" blue="0.21176470588235294" alpha="1" colorSpace="calibratedRGB"/> | 172 | <color key="value" red="0.21176470588235294" green="0.21176470588235294" blue="0.21176470588235294" alpha="1" colorSpace="calibratedRGB"/> |
155 | </userDefinedRuntimeAttribute> | 173 | </userDefinedRuntimeAttribute> |
156 | <userDefinedRuntimeAttribute type="number" keyPath="progressBarWidth"> | 174 | <userDefinedRuntimeAttribute type="number" keyPath="progressBarWidth"> |
157 | <real key="value" value="12"/> | 175 | <real key="value" value="12"/> |
158 | </userDefinedRuntimeAttribute> | 176 | </userDefinedRuntimeAttribute> |
159 | <userDefinedRuntimeAttribute type="number" keyPath="startAngle"> | 177 | <userDefinedRuntimeAttribute type="number" keyPath="startAngle"> |
160 | <real key="value" value="-90"/> | 178 | <real key="value" value="-90"/> |
161 | </userDefinedRuntimeAttribute> | 179 | </userDefinedRuntimeAttribute> |
162 | <userDefinedRuntimeAttribute type="number" keyPath="progress"> | 180 | <userDefinedRuntimeAttribute type="number" keyPath="progress"> |
163 | <real key="value" value="0.40999999999999998"/> | 181 | <real key="value" value="0.40999999999999998"/> |
164 | </userDefinedRuntimeAttribute> | 182 | </userDefinedRuntimeAttribute> |
165 | </userDefinedRuntimeAttributes> | 183 | </userDefinedRuntimeAttributes> |
166 | </view> | 184 | </view> |
167 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="目標10,000歩" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQq-cp-R2A" userLabel="Label1"> | 185 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="目標10,000歩" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQq-cp-R2A" userLabel="Label1"> |
168 | <rect key="frame" x="315" y="155.5" width="60" height="33.5"/> | 186 | <rect key="frame" x="315" y="155.5" width="60" height="33.5"/> |
169 | <constraints> | 187 | <constraints> |
170 | <constraint firstAttribute="height" constant="33.5" id="pNJ-9e-Qhb"/> | 188 | <constraint firstAttribute="height" constant="33.5" id="pNJ-9e-Qhb"/> |
171 | </constraints> | 189 | </constraints> |
172 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 190 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
173 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 191 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
174 | <nil key="highlightedColor"/> | 192 | <nil key="highlightedColor"/> |
175 | </label> | 193 | </label> |
176 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="残歩数3487歩" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2B-wZ-Efk" userLabel="Label2"> | 194 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="残歩数3487歩" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2B-wZ-Efk" userLabel="Label2"> |
177 | <rect key="frame" x="315" y="197" width="60" height="50"/> | 195 | <rect key="frame" x="315" y="197" width="60" height="50"/> |
178 | <constraints> | 196 | <constraints> |
179 | <constraint firstAttribute="height" constant="50" id="9oI-Ia-C0h"/> | 197 | <constraint firstAttribute="height" constant="50" id="9oI-Ia-C0h"/> |
180 | </constraints> | 198 | </constraints> |
181 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 199 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
182 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 200 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
183 | <nil key="highlightedColor"/> | 201 | <nil key="highlightedColor"/> |
184 | </label> | 202 | </label> |
185 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="達成率78%" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="11m-je-qZ1" userLabel="Label3"> | 203 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="達成率78%" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="11m-je-qZ1" userLabel="Label3"> |
186 | <rect key="frame" x="315" y="255" width="60" height="33.5"/> | 204 | <rect key="frame" x="315" y="255" width="60" height="33.5"/> |
187 | <constraints> | 205 | <constraints> |
188 | <constraint firstAttribute="height" constant="33.5" id="ale-7X-6Gx"/> | 206 | <constraint firstAttribute="height" constant="33.5" id="ale-7X-6Gx"/> |
189 | </constraints> | 207 | </constraints> |
190 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 208 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
191 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 209 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
192 | <nil key="highlightedColor"/> | 210 | <nil key="highlightedColor"/> |
193 | </label> | 211 | </label> |
194 | </subviews> | 212 | </subviews> |
195 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | 213 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
196 | <constraints> | 214 | <constraints> |
197 | <constraint firstAttribute="trailing" secondItem="11m-je-qZ1" secondAttribute="trailing" id="5wQ-9t-fkx"/> | 215 | <constraint firstAttribute="trailing" secondItem="11m-je-qZ1" secondAttribute="trailing" id="5wQ-9t-fkx"/> |
216 | <constraint firstItem="1ak-Ne-wz9" firstAttribute="top" secondItem="PW6-AR-UCs" secondAttribute="top" id="7Lu-Sw-8Vd"/> | ||
198 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="Bhj-5W-tqM"/> | 217 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="Bhj-5W-tqM"/> |
199 | <constraint firstItem="yOP-KX-J14" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="5" id="Bp4-Am-rzQ"/> | 218 | <constraint firstItem="yOP-KX-J14" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="5" id="Bp4-Am-rzQ"/> |
200 | <constraint firstItem="Jtx-be-zjg" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="C4T-QJ-aV0"/> | 219 | <constraint firstItem="Jtx-be-zjg" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="C4T-QJ-aV0"/> |
201 | <constraint firstItem="dQq-cp-R2A" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="CSy-Of-ifG"/> | 220 | <constraint firstItem="dQq-cp-R2A" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="CSy-Of-ifG"/> |
202 | <constraint firstAttribute="trailing" secondItem="dQq-cp-R2A" secondAttribute="trailing" id="Ct9-ZA-fqo"/> | 221 | <constraint firstAttribute="trailing" secondItem="dQq-cp-R2A" secondAttribute="trailing" id="Ct9-ZA-fqo"/> |
222 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="bottom" secondItem="Jtx-be-zjg" secondAttribute="bottom" id="DGk-ic-g00"/> | ||
203 | <constraint firstItem="oRx-7J-bma" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="60" id="DKw-80-JuB"/> | 223 | <constraint firstItem="oRx-7J-bma" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="60" id="DKw-80-JuB"/> |
204 | <constraint firstItem="11m-je-qZ1" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="FOq-gH-CTf"/> | 224 | <constraint firstItem="11m-je-qZ1" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="FOq-gH-CTf"/> |
225 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="leading" secondItem="Jtx-be-zjg" secondAttribute="leading" id="FhM-mA-AWq"/> | ||
205 | <constraint firstItem="RSj-iV-Oaf" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="JTA-NC-8qU"/> | 226 | <constraint firstItem="RSj-iV-Oaf" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="JTA-NC-8qU"/> |
206 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="top" secondItem="dQq-cp-R2A" secondAttribute="bottom" constant="8" id="KF9-QN-1Vc"/> | 227 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="top" secondItem="dQq-cp-R2A" secondAttribute="bottom" constant="8" id="KF9-QN-1Vc"/> |
207 | <constraint firstItem="wHy-xz-GJV" firstAttribute="top" secondItem="Jtx-be-zjg" secondAttribute="bottom" constant="8" id="LFj-zM-kIs"/> | 228 | <constraint firstItem="wHy-xz-GJV" firstAttribute="top" secondItem="Jtx-be-zjg" secondAttribute="bottom" constant="8" id="LFj-zM-kIs"/> |
208 | <constraint firstAttribute="trailing" secondItem="RSj-iV-Oaf" secondAttribute="trailing" constant="10" id="Ldg-q1-Jsy"/> | 229 | <constraint firstAttribute="trailing" secondItem="RSj-iV-Oaf" secondAttribute="trailing" constant="10" id="Ldg-q1-Jsy"/> |
209 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="Ls8-7Q-gjM"/> | 230 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="Ls8-7Q-gjM"/> |
210 | <constraint firstItem="Jtx-be-zjg" firstAttribute="top" secondItem="PW6-AR-UCs" secondAttribute="bottom" constant="8" id="MMi-Mg-qDV"/> | 231 | <constraint firstItem="Jtx-be-zjg" firstAttribute="top" secondItem="PW6-AR-UCs" secondAttribute="bottom" constant="8" id="MMi-Mg-qDV"/> |
232 | <constraint firstItem="1ak-Ne-wz9" firstAttribute="leading" secondItem="PW6-AR-UCs" secondAttribute="leading" id="NK3-Gl-NZu"/> | ||
211 | <constraint firstAttribute="trailing" secondItem="2SZ-sd-ADD" secondAttribute="trailing" id="O9f-yA-cZ5"/> | 233 | <constraint firstAttribute="trailing" secondItem="2SZ-sd-ADD" secondAttribute="trailing" id="O9f-yA-cZ5"/> |
234 | <constraint firstItem="equ-yC-hU1" firstAttribute="leading" secondItem="wHy-xz-GJV" secondAttribute="leading" id="Oe7-aI-2zb"/> | ||
212 | <constraint firstItem="Jtx-be-zjg" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="U3o-rO-Gcb"/> | 235 | <constraint firstItem="Jtx-be-zjg" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="U3o-rO-Gcb"/> |
213 | <constraint firstItem="oRx-7J-bma" firstAttribute="top" secondItem="2SZ-sd-ADD" secondAttribute="bottom" constant="50" id="WGj-Jf-jSz"/> | 236 | <constraint firstItem="oRx-7J-bma" firstAttribute="top" secondItem="2SZ-sd-ADD" secondAttribute="bottom" constant="50" id="WGj-Jf-jSz"/> |
237 | <constraint firstItem="equ-yC-hU1" firstAttribute="bottom" secondItem="wHy-xz-GJV" secondAttribute="bottom" id="ad4-KH-cYo"/> | ||
238 | <constraint firstItem="equ-yC-hU1" firstAttribute="top" secondItem="wHy-xz-GJV" secondAttribute="top" id="adt-MK-oHP"/> | ||
214 | <constraint firstItem="PW6-AR-UCs" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="bsc-pa-ApI"/> | 239 | <constraint firstItem="PW6-AR-UCs" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="bsc-pa-ApI"/> |
240 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="trailing" secondItem="Jtx-be-zjg" secondAttribute="trailing" id="h5E-wF-FZV"/> | ||
241 | <constraint firstItem="1ak-Ne-wz9" firstAttribute="trailing" secondItem="PW6-AR-UCs" secondAttribute="trailing" id="jXm-mH-e3x"/> | ||
215 | <constraint firstAttribute="trailing" secondItem="V2B-wZ-Efk" secondAttribute="trailing" id="kQV-FL-4Zq"/> | 242 | <constraint firstAttribute="trailing" secondItem="V2B-wZ-Efk" secondAttribute="trailing" id="kQV-FL-4Zq"/> |
243 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="top" secondItem="Jtx-be-zjg" secondAttribute="top" id="lE9-vw-sw6"/> | ||
216 | <constraint firstItem="2SZ-sd-ADD" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="q0L-8m-E0D"/> | 244 | <constraint firstItem="2SZ-sd-ADD" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="q0L-8m-E0D"/> |
245 | <constraint firstItem="equ-yC-hU1" firstAttribute="trailing" secondItem="wHy-xz-GJV" secondAttribute="trailing" id="vDi-q7-eov"/> | ||
246 | <constraint firstItem="1ak-Ne-wz9" firstAttribute="bottom" secondItem="PW6-AR-UCs" secondAttribute="bottom" id="vlQ-WK-pY4"/> | ||
217 | <constraint firstItem="11m-je-qZ1" firstAttribute="top" secondItem="V2B-wZ-Efk" secondAttribute="bottom" constant="8" id="vrX-sS-hWJ"/> | 247 | <constraint firstItem="11m-je-qZ1" firstAttribute="top" secondItem="V2B-wZ-Efk" secondAttribute="bottom" constant="8" id="vrX-sS-hWJ"/> |
218 | <constraint firstItem="2SZ-sd-ADD" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" placeholder="YES" id="w1M-Il-jBT"/> | 248 | <constraint firstItem="2SZ-sd-ADD" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" placeholder="YES" id="w1M-Il-jBT"/> |
219 | <constraint firstAttribute="trailing" secondItem="oRx-7J-bma" secondAttribute="trailing" constant="60" id="y6f-vv-nWJ"/> | 249 | <constraint firstAttribute="trailing" secondItem="oRx-7J-bma" secondAttribute="trailing" constant="60" id="y6f-vv-nWJ"/> |
220 | <constraint firstItem="wHy-xz-GJV" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="yEj-yT-PGx"/> | 250 | <constraint firstItem="wHy-xz-GJV" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="yEj-yT-PGx"/> |
221 | <constraint firstItem="yOP-KX-J14" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="ym9-6w-9C5"/> | 251 | <constraint firstItem="yOP-KX-J14" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="ym9-6w-9C5"/> |
222 | </constraints> | 252 | </constraints> |
223 | <point key="canvasLocation" x="33.5" y="54.5"/> | 253 | <point key="canvasLocation" x="33.5" y="54.5"/> |
224 | </view> | 254 | </view> |
225 | </objects> | 255 | </objects> |
226 | <resources> | 256 | <resources> |
227 | <image name="icon_facebook" width="40" height="40"/> | 257 | <image name="icon_facebook" width="40" height="40"/> |
228 | <image name="icon_line" width="40" height="40"/> | 258 | <image name="icon_line" width="40" height="40"/> |
229 | <image name="icon_menu" width="30" height="30"/> | 259 | <image name="icon_menu" width="30" height="30"/> |
230 | <image name="icon_share" width="42" height="57"/> | 260 | <image name="icon_share" width="42" height="57"/> |
231 | <image name="icon_walking" width="14" height="25"/> | 261 | <image name="icon_walking" width="14" height="25"/> |
232 | <image name="today_back_button" width="73" height="37"/> | 262 | <image name="today_back_button" width="73" height="37"/> |
233 | </resources> | 263 | </resources> |
234 | </document> | 264 | </document> |
235 | 265 |