Compare View
Commits (2)
Changes
Showing 7 changed files 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) int totalRequest; | ||
44 | @property (nonatomic, assign) int countComplete; | 43 | @property (nonatomic, assign) int totalRequest; |
45 | 44 | @property (nonatomic, assign) int countComplete; | |
46 | @end | 45 | |
47 | 46 | @end | |
48 | @implementation HomeViewController | 47 | |
49 | 48 | @implementation HomeViewController | |
50 | - (void)viewDidLoad { | 49 | |
51 | [super viewDidLoad]; | 50 | - (void)viewDidLoad { |
52 | 51 | [super viewDidLoad]; | |
53 | self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); | 52 | |
54 | 53 | self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); | |
55 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | 54 | |
56 | 55 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
57 | self.avatar.backgroundColor = [UIColor whiteColor]; | 56 | |
58 | self.avatar.layer.borderWidth = 2.0f; | 57 | self.avatar.backgroundColor = [UIColor whiteColor]; |
59 | self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; | 58 | self.avatar.layer.borderWidth = 2.0f; |
60 | self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; | 59 | self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; |
61 | self.avatar.layer.masksToBounds = YES; | 60 | self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; |
62 | NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; | 61 | self.avatar.layer.masksToBounds = YES; |
63 | User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; | 62 | NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; |
64 | if (user != nil) { | 63 | User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; |
65 | NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; | 64 | if (user != nil) { |
66 | NSURL *urlImage = [NSURL URLWithString:linkImage]; | 65 | NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; |
67 | NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; | 66 | NSURL *urlImage = [NSURL URLWithString:linkImage]; |
68 | sessionConfig.timeoutIntervalForRequest = 30.0; | 67 | NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; |
69 | sessionConfig.timeoutIntervalForResource = 60.0; | 68 | sessionConfig.timeoutIntervalForRequest = 30.0; |
70 | sessionConfig.HTTPMaximumConnectionsPerHost = 20; | 69 | sessionConfig.timeoutIntervalForResource = 60.0; |
71 | sessionConfig.allowsCellularAccess = YES; | 70 | sessionConfig.HTTPMaximumConnectionsPerHost = 20; |
72 | HomeViewController __weak *weakSelf = self; | 71 | sessionConfig.allowsCellularAccess = YES; |
73 | NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; | 72 | HomeViewController __weak *weakSelf = self; |
74 | NSURLSessionDataTask *downloadPhotoTask = [session | 73 | NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; |
75 | dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | 74 | NSURLSessionDataTask *downloadPhotoTask = [session |
76 | if (weakSelf == nil) | 75 | dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { |
77 | { | 76 | if (weakSelf == nil) |
78 | return; | 77 | { |
79 | } | 78 | return; |
80 | if (error == nil) { | 79 | } |
81 | UIImage *image = [[UIImage alloc] initWithData:data]; | 80 | if (error == nil) { |
82 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | 81 | UIImage *image = [[UIImage alloc] initWithData:data]; |
83 | weakSelf.avatar.image = image; | 82 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ |
84 | }]; | 83 | weakSelf.avatar.image = image; |
85 | } | 84 | }]; |
86 | }]; | 85 | } |
87 | [downloadPhotoTask resume]; | 86 | }]; |
88 | } | 87 | [downloadPhotoTask resume]; |
89 | 88 | } | |
90 | self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); | 89 | |
91 | 90 | self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); | |
92 | _dateCurrent = [NSDate date]; | 91 | |
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)]; | 92 | _dateCurrent = [NSDate date]; |
94 | 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 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | 94 | |
96 | 95 | self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | |
97 | if ([CMPedometer isStepCountingAvailable]) { | 96 | |
98 | _pedometer = [[CMPedometer alloc] init]; | 97 | if ([CMPedometer isStepCountingAvailable]) { |
99 | } | 98 | _pedometer = [[CMPedometer alloc] init]; |
100 | if ([CMMotionActivityManager isActivityAvailable]) { | 99 | } |
101 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; | 100 | if ([CMMotionActivityManager isActivityAvailable]) { |
102 | } | 101 | _motionActivityManager = [[CMMotionActivityManager alloc] init]; |
103 | _operationQueue = [[NSOperationQueue alloc] init]; | 102 | } |
104 | _bike = 0; | 103 | _operationQueue = [[NSOperationQueue alloc] init]; |
105 | _walking = 0; | 104 | _bike = 0; |
106 | _running = 0; | 105 | _walking = 0; |
107 | _segmentHome.selectedSegmentIndex = 1; | 106 | _running = 0; |
108 | _totalRequest = 0; | 107 | _segmentHome.selectedSegmentIndex = 1; |
109 | _countComplete = 0; | ||
110 | 108 | _totalRequest = 0; | |
111 | progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | 109 | _countComplete = 0; |
112 | progressHud.mode = MBProgressHUDModeIndeterminate; | 110 | |
113 | progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); | 111 | progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; |
114 | [self saveDataStep7LastDay]; | 112 | progressHud.mode = MBProgressHUDModeIndeterminate; |
115 | } | 113 | progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); |
114 | [self saveDataStep7LastDay]; | ||
116 | 115 | } | |
117 | - (void)viewWillAppear:(BOOL)animated { | 116 | |
118 | [super viewWillAppear:animated]; | 117 | - (void)viewWillAppear:(BOOL)animated { |
119 | [self saveStepForDay:self.dateCurrent]; | 118 | [super viewWillAppear:animated]; |
120 | [self requestTopByDate:_dateCurrent]; | 119 | [self saveStepForDay:self.dateCurrent]; |
121 | } | 120 | [self requestTopByDate:_dateCurrent]; |
122 | 121 | } | |
123 | - (void)requestTopByDate:(NSDate *)date { | 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:date]; | 126 | NSString *dateString = [dateFormatter stringFromDate:date]; |
127 | 127 | ||
128 | HomeViewController __weak *weakSelf = self; | 128 | HomeViewController __weak *weakSelf = self; |
129 | int mode = 1; | 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 | switch (_segmentHome.selectedSegmentIndex) { | 147 | if(weakSelf == nil) { |
131 | case 0: | 148 | return ; |
132 | mode = 3; | 149 | } |
133 | break; | 150 | if (error == nil) { |
134 | 151 | NSLog(@"TopObject: %@", topObject); | |
135 | case 1: | 152 | } |
136 | mode = 1; | 153 | else { |
137 | break; | 154 | dispatch_async(dispatch_get_main_queue(), ^{ |
138 | 155 | NSString *message = [error.userInfo objectForKey:@"message"]; | |
139 | case 2: | 156 | [Utilities showErrorMessage:message withViewController:weakSelf]; |
140 | mode = 2; | 157 | }); |
141 | break; | 158 | } |
142 | 159 | }]; | |
143 | default: | 160 | } |
144 | break; | 161 | |
145 | } | 162 | - (void)viewWillDisappear:(BOOL)animated { |
146 | [[ServerAPI server] requestTopWithMode:mode andDate:dateString CompletionHandler:^(TopObject *topObject, NSError *error) { | 163 | [super viewWillDisappear:animated]; |
147 | if(weakSelf == nil) { | ||
148 | return ; | 164 | } |
149 | } | 165 | |
150 | if (error == nil) { | 166 | - (void)didReceiveMemoryWarning { |
151 | NSLog(@"TopObject: %@", topObject); | 167 | [super didReceiveMemoryWarning]; |
152 | } | 168 | // Dispose of any resources that can be recreated. |
153 | else { | 169 | } |
154 | dispatch_async(dispatch_get_main_queue(), ^{ | 170 | |
155 | NSString *message = [error.userInfo objectForKey:@"message"]; | 171 | #pragma mark - IBAction |
156 | [Utilities showErrorMessage:message withViewController:weakSelf]; | 172 | - (IBAction)menuButtonTouchUpInside:(id)sender |
157 | }); | 173 | { |
158 | } | 174 | |
159 | }]; | 175 | } |
160 | } | 176 | |
161 | 177 | - (IBAction)todayButtonTouchUpInside:(id)sender | |
162 | - (void)viewWillDisappear:(BOOL)animated { | 178 | { |
163 | [super viewWillDisappear:animated]; | 179 | TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; |
164 | } | 180 | [self.navigationController pushViewController:todayVC animated:YES]; |
165 | 181 | } | |
166 | - (void)didReceiveMemoryWarning { | 182 | |
167 | [super didReceiveMemoryWarning]; | 183 | - (IBAction)leftButtonTouchUpInside:(id)sender |
168 | // Dispose of any resources that can be recreated. | 184 | { |
169 | } | 185 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; |
170 | 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 | #pragma mark - IBAction | 187 | [self saveStepForDay:self.dateCurrent]; |
172 | - (IBAction)menuButtonTouchUpInside:(id)sender | 188 | } |
173 | { | 189 | |
174 | 190 | - (IBAction)rightButtonTouchUpInside:(id)sender | |
175 | } | 191 | { |
176 | 192 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; | |
177 | - (IBAction)todayButtonTouchUpInside:(id)sender | 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 | { | 194 | [self saveStepForDay:self.dateCurrent]; |
179 | TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; | 195 | } |
180 | [self.navigationController pushViewController:todayVC animated:YES]; | 196 | |
181 | } | 197 | - (IBAction)segmentValueChange:(id)sender { |
182 | 198 | [self updateStepUI]; | |
183 | - (IBAction)leftButtonTouchUpInside:(id)sender | 199 | } |
184 | { | 200 | |
185 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; | 201 | #pragma mark - Functions Private |
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)]; | 202 | - (void)saveStepForDay:(NSDate *)date |
187 | [self saveStepForDay:self.dateCurrent]; | 203 | { |
188 | } | ||
189 | |||
190 | - (IBAction)rightButtonTouchUpInside:(id)sender | ||
191 | { | 204 | if ([CMMotionActivityManager isActivityAvailable]) { |
192 | self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; | 205 | [progressHud showAnimated:YES]; |
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)]; | 206 | [progressHud setHidden:NO]; |
194 | [self saveStepForDay:self.dateCurrent]; | ||
195 | } | 207 | self.bike = 0; |
196 | 208 | self.walking = 0; | |
197 | - (IBAction)segmentValueChange:(id)sender { | 209 | self.running = 0; |
198 | [self updateStepUI]; | 210 | NSDate *startDate = [date beginningAtMidnightOfDay]; |
199 | } | 211 | NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; |
200 | 212 | ||
201 | #pragma mark - Functions Private | 213 | HomeViewController __weak *weakSelf = self; |
202 | - (void)saveStepForDay:(NSDate *)date | 214 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.forDay", NULL); |
203 | { | 215 | dispatch_async(myQueue, ^{ |
204 | if ([CMMotionActivityManager isActivityAvailable]) { | 216 | if (weakSelf == nil) { |
205 | [progressHud showAnimated:YES]; | 217 | return ; |
206 | [progressHud setHidden:NO]; | 218 | } |
207 | self.bike = 0; | 219 | |
208 | self.walking = 0; | 220 | [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { |
209 | self.running = 0; | 221 | if (error || activities.count <= 0) { |
210 | NSDate *startDate = [date beginningAtMidnightOfDay]; | 222 | weakSelf.totalRequest = 0; |
211 | NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | 223 | weakSelf.countComplete = 0; |
212 | 224 | dispatch_async(dispatch_get_main_queue(), ^{ | |
213 | HomeViewController __weak *weakSelf = self; | 225 | [weakSelf updateStepUI]; |
214 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.forDay", NULL); | 226 | }); |
215 | dispatch_async(myQueue, ^{ | 227 | return ; |
216 | if (weakSelf == nil) { | 228 | } |
217 | return ; | 229 | // set EndDate |
218 | } | 230 | weakSelf.totalRequest = (int)activities.count; |
219 | 231 | NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | |
220 | [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | 232 | for (int i = 0; i < activities.count; i++) { |
221 | if (error || activities.count <= 0) { | 233 | CMMotionActivity *activity = [activities objectAtIndex:i]; |
222 | weakSelf.totalRequest = 0; | 234 | CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; |
223 | weakSelf.countComplete = 0; | 235 | activityExtra.activity = activity; |
224 | dispatch_async(dispatch_get_main_queue(), ^{ | 236 | if (i == activities.count - 1) { |
225 | [weakSelf updateStepUI]; | 237 | activityExtra.endDate = endDate; |
226 | }); | 238 | } |
227 | return ; | 239 | else { |
228 | } | 240 | CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; |
229 | // set EndDate | 241 | activityExtra.endDate = activityNext.startDate; |
230 | weakSelf.totalRequest = (int)activities.count; | 242 | } |
231 | NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | 243 | [arrayActivities addObject:activityExtra]; |
232 | for (int i = 0; i < activities.count; i++) { | 244 | } |
233 | CMMotionActivity *activity = [activities objectAtIndex:i]; | 245 | |
234 | CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | 246 | for (CMMotionActivityExtra *activityExtra in arrayActivities) { |
235 | activityExtra.activity = activity; | ||
236 | if (i == activities.count - 1) { | 247 | [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { |
237 | activityExtra.endDate = endDate; | 248 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; |
238 | } | 249 | int mode = 1; |
239 | else { | 250 | if (activityExtra.activity.cycling) { |
240 | CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | 251 | // self.bike |
241 | activityExtra.endDate = activityNext.startDate; | 252 | weakSelf.bike += numberStep; |
242 | } | ||
243 | [arrayActivities addObject:activityExtra]; | 253 | mode = 3; |
244 | } | 254 | } |
245 | 255 | else if (activityExtra.activity.walking) { | |
246 | for (CMMotionActivityExtra *activityExtra in arrayActivities) { | 256 | // self.walking |
247 | [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | 257 | weakSelf.walking += numberStep; |
248 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | ||
249 | int mode = 1; | 258 | mode = 1; |
250 | if (activityExtra.activity.cycling) { | 259 | } |
251 | // self.bike | 260 | else if (activityExtra.activity.running) { |
252 | weakSelf.bike += numberStep; | 261 | weakSelf.running += numberStep; |
253 | mode = 3; | ||
254 | } | 262 | mode = 2; |
255 | else if (activityExtra.activity.walking) { | 263 | } |
256 | // self.walking | 264 | else { |
257 | weakSelf.walking += numberStep; | 265 | // unknown |
258 | mode = 1; | ||
259 | } | 266 | } |
260 | else if (activityExtra.activity.running) { | ||
261 | weakSelf.running += numberStep; | 267 | weakSelf.countComplete += 1; |
262 | mode = 2; | 268 | |
263 | } | 269 | // save step to server |
264 | else { | 270 | if (numberStep > 0) { |
265 | // unknown | 271 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; |
266 | } | 272 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; |
267 | weakSelf.countComplete += 1; | 273 | NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; |
268 | 274 | NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | |
269 | // save step to server | 275 | [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { |
270 | if (numberStep > 0) { | 276 | if (error) { |
271 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | 277 | NSLog(@"Error: %@", error); |
272 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | 278 | } |
273 | NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | 279 | }]; |
274 | NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | 280 | } |
275 | [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | 281 | dispatch_async(dispatch_get_main_queue(), ^{ |
276 | if (error) { | 282 | [weakSelf updateStepUI]; |
277 | NSLog(@"Error: %@", error); | 283 | }); |
278 | } | 284 | }]; |
279 | }]; | 285 | } |
280 | } | ||
281 | dispatch_async(dispatch_get_main_queue(), ^{ | 286 | }]; |
282 | [weakSelf updateStepUI]; | 287 | }); |
283 | }); | 288 | } |
284 | }]; | 289 | else { |
285 | } | 290 | [progressHud setHidden:YES]; |
286 | }]; | 291 | } |
287 | }); | 292 | } |
288 | } | 293 | |
289 | else { | 294 | - (void)updateStepUI |
290 | [progressHud setHidden:YES]; | 295 | { |
291 | } | 296 | if (self.totalRequest == self.countComplete) { |
292 | } | 297 | switch (self.segmentHome.selectedSegmentIndex) { |
293 | 298 | case 0: | |
294 | - (void)updateStepUI | 299 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.bike]; |
295 | { | 300 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.bike]; |
296 | if (self.totalRequest == self.countComplete) { | 301 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.bike*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
297 | switch (self.segmentHome.selectedSegmentIndex) { | 302 | break; |
298 | case 0: | 303 | |
299 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.bike]; | 304 | case 1: |
300 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.bike]; | 305 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.walking]; |
301 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.bike*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 306 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.walking]; |
302 | break; | 307 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.walking*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
303 | 308 | break; | |
304 | case 1: | 309 | |
305 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.walking]; | 310 | case 2: |
306 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.walking]; | 311 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.running]; |
307 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.walking*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 312 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.running]; |
308 | break; | 313 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.running*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; |
309 | 314 | break; | |
310 | case 2: | 315 | |
311 | self.lblValueStep.text = [Utilities addCommaFromNumber:self.running]; | 316 | default: |
312 | self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %ld", NSLocalizedString(@"lifelog.today.remaining.other", nil), numberTotal - self.running]; | 317 | break; |
313 | self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), (int)(self.running*100/numberTotal), NSLocalizedString(@"lifelog.today.percent", nil)]; | 318 | } |
314 | break; | ||
315 | |||
316 | default: | 319 | self.countComplete = 0; |
317 | break; | 320 | self.totalRequest = 0; |
318 | } | 321 | [progressHud setHidden:YES]; |
319 | self.countComplete = 0; | 322 | } |
320 | self.totalRequest = 0; | 323 | } |
321 | [progressHud setHidden:YES]; | 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/RankingViewController.h
1 | // | 1 | // |
2 | // RankingViewController.h | 2 | // RankingViewController.h |
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 <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
10 | 10 | ||
11 | #import "BaseTableViewController.h" | 11 | #import "BaseTableViewController.h" |
12 | #import "CollectionView.h" | 12 | #import "CollectionView.h" |
13 | 13 | ||
14 | @interface RankingViewController : BaseTableViewController { | 14 | @interface RankingViewController : BaseTableViewController { |
15 | NSDate * _startDate; | 15 | NSDate * _startDate; |
16 | NSDate * _endDate; | 16 | NSDate * _endDate; |
17 | } | 17 | } |
18 | 18 | ||
19 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionTime; | 19 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionTime; |
20 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionMode; | 20 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionMode; |
21 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionType; | 21 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionType; |
22 | @property (weak, nonatomic) IBOutlet UILabel *lblDateTime; | 22 | @property (weak, nonatomic) IBOutlet UILabel *lblDateTime; |
23 | 23 | ||
24 | - (IBAction)clickButton:(UIButton *)sender; | 24 | - (IBAction)clickBackward:(UIButton *)sender; |
25 | - (IBAction)clickForward:(UIButton *)sender; | ||
25 | @end | 26 | @end |
26 | 27 |
LifeLog/LifeLog/RankingViewController.m
1 | // | 1 | // |
2 | // RankingViewController.m | 2 | // RankingViewController.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 "RankingViewController.h" | 9 | #import "RankingViewController.h" |
10 | #import "RankingTableViewCell.h" | 10 | #import "RankingTableViewCell.h" |
11 | 11 | ||
12 | #import "ServerAPI.h" | 12 | #import "ServerAPI.h" |
13 | #import "Utilities.h" | 13 | #import "Utilities.h" |
14 | 14 | ||
15 | @interface RankingViewController () | 15 | @interface RankingViewController () |
16 | 16 | ||
17 | @end | 17 | @end |
18 | 18 | ||
19 | @implementation RankingViewController | 19 | @implementation RankingViewController |
20 | 20 | ||
21 | - (void)viewDidLoad { | 21 | - (void)viewDidLoad { |
22 | [super viewDidLoad]; | 22 | [super viewDidLoad]; |
23 | // Do any additional setup after loading the view from its nib. | 23 | // Do any additional setup after loading the view from its nib. |
24 | self.title = NSLocalizedString(@"lifelog.rank.title", nil); | 24 | self.title = NSLocalizedString(@"lifelog.rank.title", nil); |
25 | 25 | ||
26 | [self setupView]; | 26 | [self setupView]; |
27 | 27 | ||
28 | _startDate = [NSDate date]; | 28 | _startDate = [NSDate date]; |
29 | _endDate = _startDate; | 29 | _endDate = _startDate; |
30 | self.lblDateTime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; | 30 | self.lblDateTime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; |
31 | 31 | ||
32 | //register nib for table view | 32 | //register nib for table view |
33 | [self.tableBase registerNib:[UINib nibWithNibName:@"RankingTableViewCell" bundle:nil] forCellReuseIdentifier:@"RankCell"]; | 33 | [self.tableBase registerNib:[UINib nibWithNibName:@"RankingTableViewCell" bundle:nil] forCellReuseIdentifier:@"RankCell"]; |
34 | 34 | ||
35 | [self callRequestToUpdateData]; | 35 | [self callRequestToUpdateData]; |
36 | } | 36 | } |
37 | 37 | ||
38 | - (void)didReceiveMemoryWarning { | 38 | - (void)didReceiveMemoryWarning { |
39 | [super didReceiveMemoryWarning]; | 39 | [super didReceiveMemoryWarning]; |
40 | // Dispose of any resources that can be recreated. | 40 | // Dispose of any resources that can be recreated. |
41 | } | 41 | } |
42 | 42 | ||
43 | #pragma mark Setup and Update View | 43 | #pragma mark Setup and Update View |
44 | 44 | ||
45 | - (void)setupView { | 45 | - (void)setupView { |
46 | NSArray *timeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.time.1", nil), NSLocalizedString(@"lifelog.rank.time.2", nil), NSLocalizedString(@"lifelog.rank.time.3", nil), NSLocalizedString(@"lifelog.rank.time.4", nil), nil]; | 46 | NSArray *timeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.time.1", nil), NSLocalizedString(@"lifelog.rank.time.2", nil), NSLocalizedString(@"lifelog.rank.time.3", nil), NSLocalizedString(@"lifelog.rank.time.4", nil), nil]; |
47 | [self.viewCollectionTime setButtonNumber:timeTitle.count]; | 47 | [self.viewCollectionTime setButtonNumber:timeTitle.count]; |
48 | [self.viewCollectionTime setSpacing:1]; | 48 | [self.viewCollectionTime setSpacing:1]; |
49 | [self.viewCollectionTime setArrayTitle:timeTitle]; | 49 | [self.viewCollectionTime setArrayTitle:timeTitle]; |
50 | self.viewCollectionTime.changeCurrentIndex = ^(int index){ | 50 | self.viewCollectionTime.changeCurrentIndex = ^(int index){ |
51 | [self changeDate]; | 51 | [self changeDate]; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | NSArray *modeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.mode.1", nil), NSLocalizedString(@"lifelog.rank.mode.2", nil), NSLocalizedString(@"lifelog.rank.mode.3", nil), NSLocalizedString(@"lifelog.rank.mode.4", nil), nil]; | 54 | NSArray *modeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.mode.1", nil), NSLocalizedString(@"lifelog.rank.mode.2", nil), NSLocalizedString(@"lifelog.rank.mode.3", nil), NSLocalizedString(@"lifelog.rank.mode.4", nil), nil]; |
55 | [self.viewCollectionMode setButtonNumber:modeTitle.count]; | 55 | [self.viewCollectionMode setButtonNumber:modeTitle.count]; |
56 | [self.viewCollectionMode setSpacing:1]; | 56 | [self.viewCollectionMode setSpacing:1]; |
57 | [self.viewCollectionMode setArrayTitle:modeTitle]; | 57 | [self.viewCollectionMode setArrayTitle:modeTitle]; |
58 | self.viewCollectionMode.changeCurrentIndex = ^(int index){ | 58 | self.viewCollectionMode.changeCurrentIndex = ^(int index){ |
59 | [self callRequestToUpdateData]; | 59 | [self callRequestToUpdateData]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | NSArray *typeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.type.1", nil), NSLocalizedString(@"lifelog.rank.type.2", nil), NSLocalizedString(@"lifelog.rank.type.3", nil), NSLocalizedString(@"lifelog.rank.type.4", nil), nil]; | 62 | NSArray *typeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.type.1", nil), NSLocalizedString(@"lifelog.rank.type.2", nil), NSLocalizedString(@"lifelog.rank.type.3", nil), NSLocalizedString(@"lifelog.rank.type.4", nil), nil]; |
63 | [self.viewCollectionType setButtonNumber:typeTitle.count]; | 63 | [self.viewCollectionType setButtonNumber:typeTitle.count]; |
64 | [self.viewCollectionType setSpacing:1]; | 64 | [self.viewCollectionType setSpacing:1]; |
65 | [self.viewCollectionType setArrayTitle:typeTitle]; | 65 | [self.viewCollectionType setArrayTitle:typeTitle]; |
66 | self.viewCollectionMode.changeCurrentIndex = ^(int index){ | 66 | self.viewCollectionMode.changeCurrentIndex = ^(int index){ |
67 | [self callRequestToUpdateData]; | 67 | [self callRequestToUpdateData]; |
68 | }; | 68 | }; |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | #pragma mark IBAction function | 72 | #pragma mark IBAction function |
73 | - (IBAction)clickBackward:(UIButton *)sender { | ||
74 | _endDate = [_endDate dateByAddingTimeInterval:-86400]; | ||
75 | [self changeDate]; | ||
76 | } | ||
73 | 77 | ||
74 | - (IBAction)clickButton:(UIButton *)sender { | 78 | - (IBAction)clickForward:(UIButton *)sender { |
79 | _endDate = [_endDate dateByAddingTimeInterval:86400]; | ||
80 | [self changeDate]; | ||
75 | } | 81 | } |
76 | 82 | ||
77 | #pragma mark UITableView Delegate | 83 | #pragma mark UITableView Delegate |
78 | 84 | ||
79 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | 85 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
80 | RankingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RankCell"]; | 86 | RankingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RankCell"]; |
81 | [cell setRankingData:[_curDataList objectAtIndex:indexPath.row]]; | 87 | [cell setRankingData:[_curDataList objectAtIndex:indexPath.row]]; |
82 | return cell; | 88 | return cell; |
83 | } | 89 | } |
84 | 90 | ||
85 | #pragma mark Private function | 91 | #pragma mark Private function |
86 | - (void)callRequestToUpdateData { | 92 | - (void)callRequestToUpdateData { |
87 | [super callRequestToUpdateData]; | 93 | [super callRequestToUpdateData]; |
88 | 94 | ||
89 | NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | 95 | NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; |
90 | MBProgressHUD *hudView = nil; | 96 | MBProgressHUD *hudView = nil; |
91 | int mode = self.viewCollectionMode.getCurrentIndex + 1; | 97 | int mode = self.viewCollectionMode.getCurrentIndex + 1; |
92 | //dont have all | 98 | //dont have all |
93 | mode = fmin(mode, 3); | 99 | mode = fmin(mode, 3); |
94 | 100 | ||
95 | if(_curPage == 1 && !self.refreshControl.isRefreshing) { | 101 | if(_curPage == 1 && !self.refreshControl.isRefreshing) { |
96 | hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | 102 | hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; |
97 | } | 103 | } |
98 | [[ServerAPI server] requestRankingList:token startDate:_startDate endDate:_endDate mode:mode page:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | 104 | [[ServerAPI server] requestRankingList:token startDate:_startDate endDate:_endDate mode:mode page:_curPage CompletionHandler:^(NSArray *array, NSError *error){ |
99 | dispatch_async(dispatch_get_main_queue(), ^{ | 105 | dispatch_async(dispatch_get_main_queue(), ^{ |
100 | if(hudView != nil) { | 106 | if(hudView != nil) { |
101 | [hudView hideAnimated:true]; | 107 | [hudView hideAnimated:true]; |
102 | } | 108 | } |
103 | }); | 109 | }); |
104 | RankingViewController __weak *weakSelf = self; | 110 | RankingViewController __weak *weakSelf = self; |
105 | [weakSelf updateTableData:array error:error]; | 111 | [weakSelf updateTableData:array error:error]; |
106 | }]; | 112 | }]; |
107 | } | 113 | } |
108 | 114 | ||
109 | - (void) changeDate { | 115 | - (void) changeDate { |
110 | switch (self.viewCollectionTime.getCurrentIndex) { | 116 | switch (self.viewCollectionTime.getCurrentIndex) { |
111 | case 1: | 117 | case 1: |
112 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 7]; | 118 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 7]; |
113 | break; | 119 | break; |
114 | case 2: | 120 | case 2: |
115 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 30]; | 121 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 30]; |
116 | break; | 122 | break; |
117 | case 3: | 123 | case 3: |
118 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 365]; | 124 | _startDate = [_endDate dateByAddingTimeInterval:-86400 * 365]; |
119 | break; | 125 | break; |
120 | default: | 126 | default: |
121 | _startDate = _endDate; | 127 | _startDate = _endDate; |
122 | break; | 128 | break; |
123 | } | 129 | } |
124 | if(_startDate == _endDate) { | 130 | if(_startDate == _endDate) { |
125 | self.lblDateTime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; | 131 | self.lblDateTime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; |
126 | } | 132 | } |
127 | else { | 133 | else { |
128 | NSString * startDateString = [Utilities stringFromDate:_startDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; | 134 | NSString * startDateString = [Utilities stringFromDate:_startDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; |
129 | NSString * endDateString = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; | 135 | NSString * endDateString = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; |
130 | self.lblDateTime.text = [NSString stringWithFormat:@"%@-%@", startDateString, endDateString]; | 136 | self.lblDateTime.text = [NSString stringWithFormat:@"%@-%@", startDateString, endDateString]; |
131 | } | 137 | } |
132 | [self callRequestToUpdateData]; | 138 | [self callRequestToUpdateData]; |
133 | } | 139 | } |
134 | @end | 140 | @end |
135 | 141 |
LifeLog/LifeLog/RankingViewController.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="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | 2 | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" 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="12086"/> | 7 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> |
8 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | 8 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
9 | </dependencies> | 9 | </dependencies> |
10 | <objects> | 10 | <objects> |
11 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RankingViewController"> | 11 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RankingViewController"> |
12 | <connections> | 12 | <connections> |
13 | <outlet property="lblDateTime" destination="5Ro-k6-fvT" id="5uO-ff-Pmc"/> | 13 | <outlet property="lblDateTime" destination="5Ro-k6-fvT" id="5uO-ff-Pmc"/> |
14 | <outlet property="tableBase" destination="R3A-K9-MFe" id="Tf9-Rg-PEW"/> | 14 | <outlet property="tableBase" destination="R3A-K9-MFe" id="Tf9-Rg-PEW"/> |
15 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | 15 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
16 | <outlet property="viewCollectionMode" destination="B33-xX-Jro" id="HP4-Xb-LJm"/> | 16 | <outlet property="viewCollectionMode" destination="B33-xX-Jro" id="HP4-Xb-LJm"/> |
17 | <outlet property="viewCollectionTime" destination="syA-uK-pbr" id="WdA-Cq-Flj"/> | 17 | <outlet property="viewCollectionTime" destination="syA-uK-pbr" id="WdA-Cq-Flj"/> |
18 | <outlet property="viewCollectionType" destination="oUo-Eo-tz5" id="bjw-El-34G"/> | 18 | <outlet property="viewCollectionType" destination="oUo-Eo-tz5" id="bjw-El-34G"/> |
19 | </connections> | 19 | </connections> |
20 | </placeholder> | 20 | </placeholder> |
21 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | 21 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
22 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | 22 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> |
23 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | 23 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
24 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 24 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
25 | <subviews> | 25 | <subviews> |
26 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GBx-lY-9YI" userLabel="ViewHeader"> | 26 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GBx-lY-9YI" userLabel="ViewHeader"> |
27 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | 27 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> |
28 | <subviews> | 28 | <subviews> |
29 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ランキング" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p97-40-8m9" customClass="AutoTransLabel"> | 29 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ランキング" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p97-40-8m9" customClass="AutoTransLabel"> |
30 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | 30 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> |
31 | <fontDescription key="fontDescription" type="system" pointSize="17"/> | 31 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
32 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 32 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
33 | <nil key="highlightedColor"/> | 33 | <nil key="highlightedColor"/> |
34 | <userDefinedRuntimeAttributes> | 34 | <userDefinedRuntimeAttributes> |
35 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.rank.title"/> | 35 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.rank.title"/> |
36 | </userDefinedRuntimeAttributes> | 36 | </userDefinedRuntimeAttributes> |
37 | </label> | 37 | </label> |
38 | <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qPe-ff-jRp"> | 38 | <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qPe-ff-jRp"> |
39 | <rect key="frame" x="0.0" y="5" width="70" height="36"/> | 39 | <rect key="frame" x="0.0" y="5" width="70" height="36"/> |
40 | <constraints> | 40 | <constraints> |
41 | <constraint firstAttribute="width" constant="70" id="bEy-jt-69Q"/> | 41 | <constraint firstAttribute="width" constant="70" id="bEy-jt-69Q"/> |
42 | </constraints> | 42 | </constraints> |
43 | <state key="normal" image="today_back_button"/> | 43 | <state key="normal" image="today_back_button"/> |
44 | </button> | 44 | </button> |
45 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WGc-2i-Swk"> | 45 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WGc-2i-Swk"> |
46 | <rect key="frame" x="330" y="0.0" width="45" height="46"/> | 46 | <rect key="frame" x="330" y="0.0" width="45" height="46"/> |
47 | <constraints> | 47 | <constraints> |
48 | <constraint firstAttribute="width" constant="45" id="nJ2-jH-Z45"/> | 48 | <constraint firstAttribute="width" constant="45" id="nJ2-jH-Z45"/> |
49 | </constraints> | 49 | </constraints> |
50 | <state key="normal" image="icon_menu"/> | 50 | <state key="normal" image="icon_menu"/> |
51 | </button> | 51 | </button> |
52 | </subviews> | 52 | </subviews> |
53 | <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | 53 | <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
54 | <constraints> | 54 | <constraints> |
55 | <constraint firstAttribute="bottom" secondItem="WGc-2i-Swk" secondAttribute="bottom" id="0hd-fk-kJG"/> | 55 | <constraint firstAttribute="bottom" secondItem="WGc-2i-Swk" secondAttribute="bottom" id="0hd-fk-kJG"/> |
56 | <constraint firstAttribute="bottom" secondItem="p97-40-8m9" secondAttribute="bottom" id="78G-b2-wAu"/> | 56 | <constraint firstAttribute="bottom" secondItem="p97-40-8m9" secondAttribute="bottom" id="78G-b2-wAu"/> |
57 | <constraint firstItem="qPe-ff-jRp" firstAttribute="leading" secondItem="GBx-lY-9YI" secondAttribute="leading" id="9ND-Te-qX9"/> | 57 | <constraint firstItem="qPe-ff-jRp" firstAttribute="leading" secondItem="GBx-lY-9YI" secondAttribute="leading" id="9ND-Te-qX9"/> |
58 | <constraint firstItem="qPe-ff-jRp" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" constant="5" id="9ZX-A3-Bnp"/> | 58 | <constraint firstItem="qPe-ff-jRp" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" constant="5" id="9ZX-A3-Bnp"/> |
59 | <constraint firstItem="p97-40-8m9" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" id="CVN-ke-5KK"/> | 59 | <constraint firstItem="p97-40-8m9" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" id="CVN-ke-5KK"/> |
60 | <constraint firstAttribute="height" constant="46" id="SDI-ij-KbH"/> | 60 | <constraint firstAttribute="height" constant="46" id="SDI-ij-KbH"/> |
61 | <constraint firstItem="p97-40-8m9" firstAttribute="leading" secondItem="GBx-lY-9YI" secondAttribute="leading" id="U19-fM-q7G"/> | 61 | <constraint firstItem="p97-40-8m9" firstAttribute="leading" secondItem="GBx-lY-9YI" secondAttribute="leading" id="U19-fM-q7G"/> |
62 | <constraint firstAttribute="bottom" secondItem="qPe-ff-jRp" secondAttribute="bottom" constant="5" id="jU7-xM-YKX"/> | 62 | <constraint firstAttribute="bottom" secondItem="qPe-ff-jRp" secondAttribute="bottom" constant="5" id="jU7-xM-YKX"/> |
63 | <constraint firstItem="WGc-2i-Swk" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" id="knL-Yf-VTN"/> | 63 | <constraint firstItem="WGc-2i-Swk" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="top" id="knL-Yf-VTN"/> |
64 | <constraint firstAttribute="trailing" secondItem="p97-40-8m9" secondAttribute="trailing" id="sLL-ca-92S"/> | 64 | <constraint firstAttribute="trailing" secondItem="p97-40-8m9" secondAttribute="trailing" id="sLL-ca-92S"/> |
65 | <constraint firstAttribute="trailing" secondItem="WGc-2i-Swk" secondAttribute="trailing" id="v0h-pb-83W"/> | 65 | <constraint firstAttribute="trailing" secondItem="WGc-2i-Swk" secondAttribute="trailing" id="v0h-pb-83W"/> |
66 | </constraints> | 66 | </constraints> |
67 | </view> | 67 | </view> |
68 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="syA-uK-pbr" customClass="CollectionView"> | 68 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="syA-uK-pbr" customClass="CollectionView"> |
69 | <rect key="frame" x="0.0" y="46" width="375" height="30"/> | 69 | <rect key="frame" x="0.0" y="46" width="375" height="30"/> |
70 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 70 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
71 | <constraints> | 71 | <constraints> |
72 | <constraint firstAttribute="height" constant="30" id="ezW-Qs-M7K"/> | 72 | <constraint firstAttribute="height" constant="30" id="ezW-Qs-M7K"/> |
73 | </constraints> | 73 | </constraints> |
74 | </view> | 74 | </view> |
75 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B33-xX-Jro" customClass="CollectionView"> | 75 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B33-xX-Jro" customClass="CollectionView"> |
76 | <rect key="frame" x="0.0" y="116" width="375" height="30"/> | 76 | <rect key="frame" x="0.0" y="116" width="375" height="30"/> |
77 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 77 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
78 | <constraints> | 78 | <constraints> |
79 | <constraint firstAttribute="height" constant="30" id="snn-FM-11r"/> | 79 | <constraint firstAttribute="height" constant="30" id="snn-FM-11r"/> |
80 | </constraints> | 80 | </constraints> |
81 | </view> | 81 | </view> |
82 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u5D-xz-8dK"> | 82 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u5D-xz-8dK"> |
83 | <rect key="frame" x="0.0" y="76" width="375" height="40"/> | 83 | <rect key="frame" x="0.0" y="76" width="375" height="40"/> |
84 | <subviews> | 84 | <subviews> |
85 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Ro-k6-fvT"> | 85 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Ro-k6-fvT"> |
86 | <rect key="frame" x="0.0" y="0.0" width="375" height="40"/> | 86 | <rect key="frame" x="0.0" y="0.0" width="375" height="40"/> |
87 | <string key="text" base64-UTF8="YES"> | 87 | <string key="text" base64-UTF8="YES"> |
88 | MjAxNuW5tCAx5pyIMjLml6XjgIDvvI3jgIAyMDE35bm0IDHmnIgyMeaXpQ0KAA | 88 | MjAxNuW5tCAx5pyIMjLml6XjgIDvvI3jgIAyMDE35bm0IDHmnIgyMeaXpQ0KAA |
89 | </string> | 89 | </string> |
90 | <fontDescription key="fontDescription" type="system" pointSize="13"/> | 90 | <fontDescription key="fontDescription" type="system" pointSize="13"/> |
91 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 91 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
92 | <nil key="highlightedColor"/> | 92 | <nil key="highlightedColor"/> |
93 | </label> | 93 | </label> |
94 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eiH-Sk-3VV"> | 94 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eiH-Sk-3VV"> |
95 | <rect key="frame" x="15" y="5" width="30" height="30"/> | 95 | <rect key="frame" x="15" y="5" width="30" height="30"/> |
96 | <constraints> | 96 | <constraints> |
97 | <constraint firstAttribute="height" constant="30" id="kEd-sQ-0ub"/> | 97 | <constraint firstAttribute="height" constant="30" id="kEd-sQ-0ub"/> |
98 | <constraint firstAttribute="width" constant="30" id="sFT-sr-7pL"/> | 98 | <constraint firstAttribute="width" constant="30" id="sFT-sr-7pL"/> |
99 | </constraints> | 99 | </constraints> |
100 | <state key="normal" image="icon_left"/> | 100 | <state key="normal" image="icon_left"/> |
101 | <connections> | 101 | <connections> |
102 | <action selector="clickButton:" destination="-1" eventType="touchUpInside" id="f1Y-rj-F7d"/> | 102 | <action selector="clickBackward:" destination="-1" eventType="touchUpInside" id="8KB-3G-h6v"/> |
103 | </connections> | 103 | </connections> |
104 | </button> | 104 | </button> |
105 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Usl-Cl-d9d"> | 105 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Usl-Cl-d9d"> |
106 | <rect key="frame" x="330" y="5" width="30" height="30"/> | 106 | <rect key="frame" x="330" y="5" width="30" height="30"/> |
107 | <constraints> | 107 | <constraints> |
108 | <constraint firstAttribute="width" constant="30" id="uFf-AY-LsL"/> | 108 | <constraint firstAttribute="width" constant="30" id="uFf-AY-LsL"/> |
109 | <constraint firstAttribute="height" constant="30" id="v8w-hV-CY1"/> | 109 | <constraint firstAttribute="height" constant="30" id="v8w-hV-CY1"/> |
110 | </constraints> | 110 | </constraints> |
111 | <state key="normal" image="icon_right"/> | 111 | <state key="normal" image="icon_right"/> |
112 | <connections> | 112 | <connections> |
113 | <action selector="clickButton:" destination="-1" eventType="touchUpInside" id="OB1-mE-CGE"/> | 113 | <action selector="clickForward:" destination="-1" eventType="touchUpInside" id="sgL-89-hXv"/> |
114 | </connections> | 114 | </connections> |
115 | </button> | 115 | </button> |
116 | </subviews> | 116 | </subviews> |
117 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 117 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
118 | <constraints> | 118 | <constraints> |
119 | <constraint firstAttribute="height" constant="40" id="C5o-Zd-KjG"/> | 119 | <constraint firstAttribute="height" constant="40" id="C5o-Zd-KjG"/> |
120 | <constraint firstAttribute="bottom" secondItem="5Ro-k6-fvT" secondAttribute="bottom" id="DQQ-wh-s1Q"/> | 120 | <constraint firstAttribute="bottom" secondItem="5Ro-k6-fvT" secondAttribute="bottom" id="DQQ-wh-s1Q"/> |
121 | <constraint firstAttribute="trailing" secondItem="5Ro-k6-fvT" secondAttribute="trailing" id="E0c-bJ-AIi"/> | 121 | <constraint firstAttribute="trailing" secondItem="5Ro-k6-fvT" secondAttribute="trailing" id="E0c-bJ-AIi"/> |
122 | <constraint firstItem="5Ro-k6-fvT" firstAttribute="top" secondItem="u5D-xz-8dK" secondAttribute="top" id="Mrk-FC-rqh"/> | 122 | <constraint firstItem="5Ro-k6-fvT" firstAttribute="top" secondItem="u5D-xz-8dK" secondAttribute="top" id="Mrk-FC-rqh"/> |
123 | <constraint firstItem="eiH-Sk-3VV" firstAttribute="centerY" secondItem="u5D-xz-8dK" secondAttribute="centerY" id="k2J-Lc-ZDI"/> | 123 | <constraint firstItem="eiH-Sk-3VV" firstAttribute="centerY" secondItem="u5D-xz-8dK" secondAttribute="centerY" id="k2J-Lc-ZDI"/> |
124 | <constraint firstItem="5Ro-k6-fvT" firstAttribute="leading" secondItem="u5D-xz-8dK" secondAttribute="leading" id="rj5-0J-xs3"/> | 124 | <constraint firstItem="5Ro-k6-fvT" firstAttribute="leading" secondItem="u5D-xz-8dK" secondAttribute="leading" id="rj5-0J-xs3"/> |
125 | <constraint firstItem="Usl-Cl-d9d" firstAttribute="centerY" secondItem="u5D-xz-8dK" secondAttribute="centerY" id="sJX-n3-1pz"/> | 125 | <constraint firstItem="Usl-Cl-d9d" firstAttribute="centerY" secondItem="u5D-xz-8dK" secondAttribute="centerY" id="sJX-n3-1pz"/> |
126 | <constraint firstItem="eiH-Sk-3VV" firstAttribute="leading" secondItem="u5D-xz-8dK" secondAttribute="leading" constant="15" id="to7-WU-7xo"/> | 126 | <constraint firstItem="eiH-Sk-3VV" firstAttribute="leading" secondItem="u5D-xz-8dK" secondAttribute="leading" constant="15" id="to7-WU-7xo"/> |
127 | <constraint firstAttribute="trailing" secondItem="Usl-Cl-d9d" secondAttribute="trailing" constant="15" id="yDF-9k-XlW"/> | 127 | <constraint firstAttribute="trailing" secondItem="Usl-Cl-d9d" secondAttribute="trailing" constant="15" id="yDF-9k-XlW"/> |
128 | </constraints> | 128 | </constraints> |
129 | </view> | 129 | </view> |
130 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oUo-Eo-tz5" customClass="CollectionView"> | 130 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oUo-Eo-tz5" customClass="CollectionView"> |
131 | <rect key="frame" x="0.0" y="577" width="375" height="40"/> | 131 | <rect key="frame" x="0.0" y="577" width="375" height="40"/> |
132 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 132 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
133 | <constraints> | 133 | <constraints> |
134 | <constraint firstAttribute="height" constant="40" id="Trr-Ku-Ssy"/> | 134 | <constraint firstAttribute="height" constant="40" id="Trr-Ku-Ssy"/> |
135 | </constraints> | 135 | </constraints> |
136 | </view> | 136 | </view> |
137 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" rowHeight="80" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="R3A-K9-MFe"> | 137 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" rowHeight="80" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="R3A-K9-MFe"> |
138 | <rect key="frame" x="0.0" y="147" width="375" height="429"/> | 138 | <rect key="frame" x="0.0" y="147" width="375" height="429"/> |
139 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 139 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
140 | <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 140 | <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
141 | <connections> | 141 | <connections> |
142 | <outlet property="dataSource" destination="-1" id="JJX-cg-LPL"/> | 142 | <outlet property="dataSource" destination="-1" id="JJX-cg-LPL"/> |
143 | <outlet property="delegate" destination="-1" id="u0m-93-lsi"/> | 143 | <outlet property="delegate" destination="-1" id="u0m-93-lsi"/> |
144 | </connections> | 144 | </connections> |
145 | </tableView> | 145 | </tableView> |
146 | </subviews> | 146 | </subviews> |
147 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | 147 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
148 | <constraints> | 148 | <constraints> |
149 | <constraint firstItem="B33-xX-Jro" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="2Mu-hy-FVU"/> | 149 | <constraint firstItem="B33-xX-Jro" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="2Mu-hy-FVU"/> |
150 | <constraint firstItem="GBx-lY-9YI" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5CL-wT-MBg"/> | 150 | <constraint firstItem="GBx-lY-9YI" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5CL-wT-MBg"/> |
151 | <constraint firstItem="u5D-xz-8dK" firstAttribute="top" secondItem="syA-uK-pbr" secondAttribute="bottom" id="5uu-dZ-oXI"/> | 151 | <constraint firstItem="u5D-xz-8dK" firstAttribute="top" secondItem="syA-uK-pbr" secondAttribute="bottom" id="5uu-dZ-oXI"/> |
152 | <constraint firstItem="syA-uK-pbr" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="bottom" id="6FQ-vy-d4N"/> | 152 | <constraint firstItem="syA-uK-pbr" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="bottom" id="6FQ-vy-d4N"/> |
153 | <constraint firstItem="u5D-xz-8dK" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="75z-RN-ObF"/> | 153 | <constraint firstItem="u5D-xz-8dK" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="75z-RN-ObF"/> |
154 | <constraint firstItem="R3A-K9-MFe" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="LyL-9p-qcd"/> | 154 | <constraint firstItem="R3A-K9-MFe" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="LyL-9p-qcd"/> |
155 | <constraint firstItem="oUo-Eo-tz5" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="M7I-ue-lip"/> | 155 | <constraint firstItem="oUo-Eo-tz5" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="M7I-ue-lip"/> |
156 | <constraint firstAttribute="trailing" secondItem="B33-xX-Jro" secondAttribute="trailing" id="Pjd-Ay-GaV"/> | 156 | <constraint firstAttribute="trailing" secondItem="B33-xX-Jro" secondAttribute="trailing" id="Pjd-Ay-GaV"/> |
157 | <constraint firstItem="oUo-Eo-tz5" firstAttribute="top" secondItem="R3A-K9-MFe" secondAttribute="bottom" constant="1" id="QMu-aq-2Zt"/> | 157 | <constraint firstItem="oUo-Eo-tz5" firstAttribute="top" secondItem="R3A-K9-MFe" secondAttribute="bottom" constant="1" id="QMu-aq-2Zt"/> |
158 | <constraint firstAttribute="trailing" secondItem="syA-uK-pbr" secondAttribute="trailing" id="Qnl-Pp-y2G"/> | 158 | <constraint firstAttribute="trailing" secondItem="syA-uK-pbr" secondAttribute="trailing" id="Qnl-Pp-y2G"/> |
159 | <constraint firstItem="B33-xX-Jro" firstAttribute="top" secondItem="u5D-xz-8dK" secondAttribute="bottom" id="VOl-jo-wU3"/> | 159 | <constraint firstItem="B33-xX-Jro" firstAttribute="top" secondItem="u5D-xz-8dK" secondAttribute="bottom" id="VOl-jo-wU3"/> |
160 | <constraint firstItem="GBx-lY-9YI" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="YjB-ef-xTt"/> | 160 | <constraint firstItem="GBx-lY-9YI" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="YjB-ef-xTt"/> |
161 | <constraint firstItem="syA-uK-pbr" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="aTf-mb-wlT"/> | 161 | <constraint firstItem="syA-uK-pbr" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="aTf-mb-wlT"/> |
162 | <constraint firstAttribute="bottom" secondItem="oUo-Eo-tz5" secondAttribute="bottom" constant="50" id="cux-Vm-qq7"/> | 162 | <constraint firstAttribute="bottom" secondItem="oUo-Eo-tz5" secondAttribute="bottom" constant="50" id="cux-Vm-qq7"/> |
163 | <constraint firstAttribute="trailing" secondItem="R3A-K9-MFe" secondAttribute="trailing" id="jBn-JI-SQP"/> | 163 | <constraint firstAttribute="trailing" secondItem="R3A-K9-MFe" secondAttribute="trailing" id="jBn-JI-SQP"/> |
164 | <constraint firstItem="R3A-K9-MFe" firstAttribute="top" secondItem="B33-xX-Jro" secondAttribute="bottom" constant="1" id="jTi-59-XsZ"/> | 164 | <constraint firstItem="R3A-K9-MFe" firstAttribute="top" secondItem="B33-xX-Jro" secondAttribute="bottom" constant="1" id="jTi-59-XsZ"/> |
165 | <constraint firstAttribute="trailing" secondItem="u5D-xz-8dK" secondAttribute="trailing" id="mDB-o3-gtA"/> | 165 | <constraint firstAttribute="trailing" secondItem="u5D-xz-8dK" secondAttribute="trailing" id="mDB-o3-gtA"/> |
166 | <constraint firstAttribute="trailing" secondItem="GBx-lY-9YI" secondAttribute="trailing" id="yaf-8r-ySL"/> | 166 | <constraint firstAttribute="trailing" secondItem="GBx-lY-9YI" secondAttribute="trailing" id="yaf-8r-ySL"/> |
167 | <constraint firstAttribute="trailing" secondItem="oUo-Eo-tz5" secondAttribute="trailing" id="zkl-by-qMp"/> | 167 | <constraint firstAttribute="trailing" secondItem="oUo-Eo-tz5" secondAttribute="trailing" id="zkl-by-qMp"/> |
168 | </constraints> | 168 | </constraints> |
169 | <point key="canvasLocation" x="26.5" y="52.5"/> | 169 | <point key="canvasLocation" x="26.5" y="52.5"/> |
170 | </view> | 170 | </view> |
171 | </objects> | 171 | </objects> |
172 | <resources> | 172 | <resources> |
173 | <image name="icon_left" width="30" height="30"/> | 173 | <image name="icon_left" width="30" height="30"/> |
174 | <image name="icon_menu" width="30" height="30"/> | 174 | <image name="icon_menu" width="30" height="30"/> |
175 | <image name="icon_right" width="30" height="30"/> | 175 | <image name="icon_right" width="30" height="30"/> |
176 | <image name="today_back_button" width="73" height="37"/> | 176 | <image name="today_back_button" width="73" height="37"/> |
177 | </resources> | 177 | </resources> |
178 | </document> | 178 | </document> |
179 | 179 |
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 | - (IBAction)buttonShareTouchUpInside:(id)sender { | 96 | #pragma mark - Functions Private |
81 | 97 | - (void)countStep | |
82 | } | 98 | { |
83 | 99 | if (self.isRequesting == YES) { | |
84 | - (IBAction)buttonFacebookTouchUpInside:(id)sender { | 100 | return; |
85 | NSString * content = @"Finish 500 steps"; | 101 | } |
86 | TodayViewController __weak *weakSelf = self; | 102 | if ([CMMotionActivityManager isActivityAvailable]) { |
87 | [Utilities shareFacebook:content withViewController:weakSelf]; | 103 | self.isRequesting = YES; |
88 | } | 104 | NSDate *endDate = [NSDate date]; |
89 | 105 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; | |
90 | - (IBAction)buttonLineTouchUpInside:(id)sender { | 106 | TodayViewController __weak *weakSelf = self; |
91 | NSString * content = @"Finish 500 steps"; | 107 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); |
92 | TodayViewController __weak *weakSelf = self; | 108 | dispatch_async(myQueue, ^{ |
93 | [Utilities shareLine:content withViewController:weakSelf]; | 109 | if (weakSelf == nil) { |
94 | } | 110 | return ; |
95 | 111 | } | |
96 | #pragma mark - Functions Private | 112 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { |
97 | - (void)countStep | 113 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; |
98 | { | 114 | dispatch_async(dispatch_get_main_queue(), ^{ |
99 | if (self.isRequesting == YES) { | 115 | [weakSelf updateStepUI:numberStep]; |
100 | return; | 116 | }); |
101 | } | 117 | }]; |
102 | if ([CMMotionActivityManager isActivityAvailable]) { | 118 | }); |
103 | self.isRequesting = YES; | 119 | } |
104 | NSDate *endDate = [NSDate date]; | 120 | } |
105 | NSDate *startDate = [endDate beginningAtMidnightOfDay]; | 121 | |
106 | TodayViewController __weak *weakSelf = self; | 122 | - (void)updateStepUI:(NSInteger)numberStep |
107 | dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog", NULL); | 123 | { |
108 | dispatch_async(myQueue, ^{ | 124 | // NSLog(@"Number of step: %ld", numberStep); |
109 | if (weakSelf == nil) { | 125 | self.isRequesting = NO; |
110 | return ; | 126 | float valueProgress = numberStep*1.f/numberTotal; |
111 | } | 127 | [self.circleProgressToday setProgress:valueProgress animated:YES]; |
112 | [weakSelf.pedometer queryPedometerDataFromDate:startDate toDate:endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | 128 | self.lblValueStep.text = [Utilities addCommaFromNumber:numberStep]; |
113 | NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | 129 | self.lblTotalStep.text = [NSString stringWithFormat:@"/ %@", [Utilities addCommaFromNumber:numberTotal]]; |
114 | dispatch_async(dispatch_get_main_queue(), ^{ | 130 | self.lblRemainingStep.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.step.1", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.remaining.step.2", nil)]; |
115 | [weakSelf updateStepUI:numberStep]; | 131 | self.lblTotalStepOther.text = [NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"lifelog.today.total.other", nil), [Utilities addCommaFromNumber:numberTotal], NSLocalizedString(@"lifelog.today.unit.step", nil)]; |
116 | }); | 132 | self.lblRemainingStepOther.text = [NSString stringWithFormat:@"%@%ld%@", NSLocalizedString(@"lifelog.today.remaining.other", nil), (numberTotal - numberStep), NSLocalizedString(@"lifelog.today.unit.step", nil)]; |
117 | }]; | 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 | } | 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="16G29" 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 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1ak-Ne-wz9" userLabel="ButtonShare"> | 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="137" width="42" height="57"/> | 77 | <rect key="frame" x="8" y="202" width="40" height="40"/> |
72 | <connections> | 78 | <constraints> |
73 | <action selector="buttonShareTouchUpInside:" destination="-1" eventType="touchUpInside" id="dkw-ed-JhQ"/> | 79 | <constraint firstAttribute="width" constant="40" id="2Fe-7S-LCC"/> |
74 | </connections> | 80 | <constraint firstAttribute="height" constant="40" id="5hP-gZ-Qrl"/> |
75 | </button> | 81 | </constraints> |
76 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_facebook" translatesAutoresizingMaskIntoConstraints="NO" id="Jtx-be-zjg"> | 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 | <rect key="frame" x="8" y="202" width="40" height="40"/> | 89 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_line" translatesAutoresizingMaskIntoConstraints="NO" id="wHy-xz-GJV"> |
78 | <constraints> | 90 | <rect key="frame" x="8" y="250" width="40" height="40"/> |
79 | <constraint firstAttribute="width" constant="40" id="2Fe-7S-LCC"/> | 91 | <constraints> |
80 | <constraint firstAttribute="height" constant="40" id="5hP-gZ-Qrl"/> | 92 | <constraint firstAttribute="width" constant="40" id="ElF-BB-cgs"/> |
81 | </constraints> | 93 | <constraint firstAttribute="height" constant="40" id="myc-Ev-aCy"/> |
82 | </imageView> | 94 | </constraints> |
83 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HLr-Qj-bm4" userLabel="ButtonFacebook"> | 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 | <rect key="frame" x="8" y="202" width="40" height="40"/> | 102 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRx-7J-bma" customClass="CircleProgressBar"> |
85 | <connections> | 103 | <rect key="frame" x="60" y="94" width="255" height="255"/> |
86 | <action selector="buttonFacebookTouchUpInside:" destination="-1" eventType="touchUpInside" id="MHi-pC-vsR"/> | 104 | <subviews> |
87 | </connections> | 105 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qQS-5K-MuA" userLabel="ViewContent"> |
88 | </button> | 106 | <rect key="frame" x="59" y="43" width="136" height="170"/> |
89 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_line" translatesAutoresizingMaskIntoConstraints="NO" id="wHy-xz-GJV"> | 107 | <subviews> |
90 | <rect key="frame" x="8" y="250" width="40" height="40"/> | 108 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_walking" translatesAutoresizingMaskIntoConstraints="NO" id="VwM-9C-Dye"> |
91 | <constraints> | 109 | <rect key="frame" x="61" y="2" width="14" height="25"/> |
92 | <constraint firstAttribute="width" constant="40" id="ElF-BB-cgs"/> | 110 | <constraints> |
93 | <constraint firstAttribute="height" constant="40" id="myc-Ev-aCy"/> | 111 | <constraint firstAttribute="width" constant="14" id="mn6-eU-59Y"/> |
94 | </constraints> | 112 | <constraint firstAttribute="height" constant="25" id="rok-3H-sX5"/> |
95 | </imageView> | 113 | </constraints> |
96 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="equ-yC-hU1" userLabel="ButtonLine"> | 114 | </imageView> |
97 | <rect key="frame" x="8" y="250" width="40" height="40"/> | 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 | <connections> | 116 | <rect key="frame" x="0.0" y="35" width="136" height="54"/> |
99 | <action selector="buttonLineTouchUpInside:" destination="-1" eventType="touchUpInside" id="9mi-bX-Uqp"/> | 117 | <constraints> |
100 | </connections> | 118 | <constraint firstAttribute="height" constant="54" id="OWK-YU-E5c"/> |
101 | </button> | 119 | </constraints> |
102 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRx-7J-bma" customClass="CircleProgressBar"> | 120 | <fontDescription key="fontDescription" type="boldSystem" pointSize="45"/> |
103 | <rect key="frame" x="60" y="94" width="255" height="255"/> | 121 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
104 | <subviews> | 122 | <nil key="highlightedColor"/> |
105 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qQS-5K-MuA" userLabel="ViewContent"> | 123 | </label> |
106 | <rect key="frame" x="59" y="43" width="136" height="170"/> | 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 | <subviews> | 125 | <rect key="frame" x="0.0" y="97" width="136" height="24"/> |
108 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_walking" translatesAutoresizingMaskIntoConstraints="NO" id="VwM-9C-Dye"> | 126 | <constraints> |
109 | <rect key="frame" x="61" y="2" width="14" height="25"/> | 127 | <constraint firstAttribute="height" constant="24" id="ID6-U3-pcq"/> |
110 | <constraints> | 128 | </constraints> |
111 | <constraint firstAttribute="width" constant="14" id="mn6-eU-59Y"/> | 129 | <fontDescription key="fontDescription" type="system" pointSize="20"/> |
112 | <constraint firstAttribute="height" constant="25" id="rok-3H-sX5"/> | 130 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
113 | </constraints> | 131 | <nil key="highlightedColor"/> |
114 | </imageView> | 132 | </label> |
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"> | 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="35" width="136" height="54"/> | 134 | <rect key="frame" x="0.0" y="129" width="136" height="48"/> |
117 | <constraints> | 135 | <constraints> |
118 | <constraint firstAttribute="height" constant="54" id="OWK-YU-E5c"/> | 136 | <constraint firstAttribute="height" constant="48" id="IhK-uP-msA"/> |
119 | </constraints> | 137 | </constraints> |
120 | <fontDescription key="fontDescription" type="boldSystem" pointSize="45"/> | 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 | <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"> | 142 | </subviews> |
125 | <rect key="frame" x="0.0" y="97" width="136" height="24"/> | 143 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
126 | <constraints> | 144 | <constraints> |
127 | <constraint firstAttribute="height" constant="24" id="ID6-U3-pcq"/> | 145 | <constraint firstItem="VwM-9C-Dye" firstAttribute="top" secondItem="qQS-5K-MuA" secondAttribute="top" constant="2" id="3wt-gj-JSb"/> |
128 | </constraints> | 146 | <constraint firstItem="dEz-7j-nXc" firstAttribute="top" secondItem="Fvu-lz-xIk" secondAttribute="bottom" constant="8" id="8HX-cn-RI5"/> |
129 | <fontDescription key="fontDescription" type="system" pointSize="20"/> | 147 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="top" secondItem="VwM-9C-Dye" secondAttribute="bottom" constant="8" id="8th-yr-ele"/> |
130 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 148 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="A6X-AZ-Tlm"/> |
131 | <nil key="highlightedColor"/> | 149 | <constraint firstAttribute="trailing" secondItem="iCl-1r-Bwp" secondAttribute="trailing" id="ALp-VX-Oqk"/> |
132 | </label> | 150 | <constraint firstAttribute="trailing" secondItem="Fvu-lz-xIk" secondAttribute="trailing" id="ELm-PN-7hB"/> |
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"> | 151 | <constraint firstItem="VwM-9C-Dye" firstAttribute="centerX" secondItem="qQS-5K-MuA" secondAttribute="centerX" id="Erd-eu-Lgw"/> |
134 | <rect key="frame" x="0.0" y="129" width="136" height="48"/> | 152 | <constraint firstItem="dEz-7j-nXc" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="nvf-Kg-Ivk"/> |
135 | <constraints> | 153 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="top" secondItem="iCl-1r-Bwp" secondAttribute="bottom" constant="8" id="rFD-e5-Oke"/> |
136 | <constraint firstAttribute="height" constant="48" id="IhK-uP-msA"/> | 154 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="ykV-Hh-2Se"/> |
137 | </constraints> | 155 | <constraint firstAttribute="trailing" secondItem="dEz-7j-nXc" secondAttribute="trailing" id="zdo-Fa-Bk6"/> |
138 | <fontDescription key="fontDescription" type="system" pointSize="20"/> | 156 | </constraints> |
139 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 157 | </view> |
140 | <nil key="highlightedColor"/> | 158 | </subviews> |
141 | </label> | 159 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
142 | </subviews> | 160 | <constraints> |
143 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | 161 | <constraint firstItem="qQS-5K-MuA" firstAttribute="height" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="200/299" id="KK9-9I-hBs"/> |
144 | <constraints> | 162 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerX" secondItem="oRx-7J-bma" secondAttribute="centerX" id="iHf-Qo-LsK"/> |
145 | <constraint firstItem="VwM-9C-Dye" firstAttribute="top" secondItem="qQS-5K-MuA" secondAttribute="top" constant="2" id="3wt-gj-JSb"/> | 163 | <constraint firstItem="qQS-5K-MuA" firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="width" multiplier="160/299" id="nAQ-00-V9H"/> |
146 | <constraint firstItem="dEz-7j-nXc" firstAttribute="top" secondItem="Fvu-lz-xIk" secondAttribute="bottom" constant="8" id="8HX-cn-RI5"/> | 164 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="oCW-BR-PvV"/> |
147 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="top" secondItem="VwM-9C-Dye" secondAttribute="bottom" constant="8" id="8th-yr-ele"/> | 165 | <constraint firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="1:1" id="of6-Gd-VOP"/> |
148 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="A6X-AZ-Tlm"/> | 166 | </constraints> |
149 | <constraint firstAttribute="trailing" secondItem="iCl-1r-Bwp" secondAttribute="trailing" id="ALp-VX-Oqk"/> | 167 | <userDefinedRuntimeAttributes> |
150 | <constraint firstAttribute="trailing" secondItem="Fvu-lz-xIk" secondAttribute="trailing" id="ELm-PN-7hB"/> | 168 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarProgressColor"> |
151 | <constraint firstItem="VwM-9C-Dye" firstAttribute="centerX" secondItem="qQS-5K-MuA" secondAttribute="centerX" id="Erd-eu-Lgw"/> | 169 | <color key="value" red="0.2196078431372549" green="0.74117647058823533" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/> |
152 | <constraint firstItem="dEz-7j-nXc" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="nvf-Kg-Ivk"/> | 170 | </userDefinedRuntimeAttribute> |
153 | <constraint firstItem="Fvu-lz-xIk" firstAttribute="top" secondItem="iCl-1r-Bwp" secondAttribute="bottom" constant="8" id="rFD-e5-Oke"/> | 171 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarTrackColor"> |
154 | <constraint firstItem="iCl-1r-Bwp" firstAttribute="leading" secondItem="qQS-5K-MuA" secondAttribute="leading" id="ykV-Hh-2Se"/> | 172 | <color key="value" red="0.21176470588235294" green="0.21176470588235294" blue="0.21176470588235294" alpha="1" colorSpace="calibratedRGB"/> |
155 | <constraint firstAttribute="trailing" secondItem="dEz-7j-nXc" secondAttribute="trailing" id="zdo-Fa-Bk6"/> | 173 | </userDefinedRuntimeAttribute> |
156 | </constraints> | 174 | <userDefinedRuntimeAttribute type="number" keyPath="progressBarWidth"> |
157 | </view> | 175 | <real key="value" value="12"/> |
158 | </subviews> | 176 | </userDefinedRuntimeAttribute> |
159 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 177 | <userDefinedRuntimeAttribute type="number" keyPath="startAngle"> |
160 | <constraints> | 178 | <real key="value" value="-90"/> |
161 | <constraint firstItem="qQS-5K-MuA" firstAttribute="height" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="200/299" id="KK9-9I-hBs"/> | 179 | </userDefinedRuntimeAttribute> |
162 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerX" secondItem="oRx-7J-bma" secondAttribute="centerX" id="iHf-Qo-LsK"/> | 180 | <userDefinedRuntimeAttribute type="number" keyPath="progress"> |
163 | <constraint firstItem="qQS-5K-MuA" firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="width" multiplier="160/299" id="nAQ-00-V9H"/> | 181 | <real key="value" value="0.40999999999999998"/> |
164 | <constraint firstItem="qQS-5K-MuA" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="oCW-BR-PvV"/> | 182 | </userDefinedRuntimeAttribute> |
165 | <constraint firstAttribute="width" secondItem="oRx-7J-bma" secondAttribute="height" multiplier="1:1" id="of6-Gd-VOP"/> | 183 | </userDefinedRuntimeAttributes> |
166 | </constraints> | 184 | </view> |
167 | <userDefinedRuntimeAttributes> | 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 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarProgressColor"> | 186 | <rect key="frame" x="315" y="155.5" width="60" height="33.5"/> |
169 | <color key="value" red="0.2196078431372549" green="0.74117647058823533" blue="0.90196078431372551" alpha="1" colorSpace="calibratedRGB"/> | 187 | <constraints> |
170 | </userDefinedRuntimeAttribute> | 188 | <constraint firstAttribute="height" constant="33.5" id="pNJ-9e-Qhb"/> |
171 | <userDefinedRuntimeAttribute type="color" keyPath="progressBarTrackColor"> | 189 | </constraints> |
172 | <color key="value" red="0.21176470588235294" green="0.21176470588235294" blue="0.21176470588235294" alpha="1" colorSpace="calibratedRGB"/> | 190 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
173 | </userDefinedRuntimeAttribute> | 191 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
174 | <userDefinedRuntimeAttribute type="number" keyPath="progressBarWidth"> | 192 | <nil key="highlightedColor"/> |
175 | <real key="value" value="12"/> | 193 | </label> |
176 | </userDefinedRuntimeAttribute> | 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 | <userDefinedRuntimeAttribute type="number" keyPath="startAngle"> | 195 | <rect key="frame" x="315" y="197" width="60" height="50"/> |
178 | <real key="value" value="-90"/> | 196 | <constraints> |
179 | </userDefinedRuntimeAttribute> | 197 | <constraint firstAttribute="height" constant="50" id="9oI-Ia-C0h"/> |
180 | <userDefinedRuntimeAttribute type="number" keyPath="progress"> | 198 | </constraints> |
181 | <real key="value" value="0.40999999999999998"/> | 199 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
182 | </userDefinedRuntimeAttribute> | 200 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
183 | </userDefinedRuntimeAttributes> | 201 | <nil key="highlightedColor"/> |
184 | </view> | 202 | </label> |
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"> | 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="155.5" 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="pNJ-9e-Qhb"/> | 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 | <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"> | 212 | </subviews> |
195 | <rect key="frame" x="315" y="197" width="60" height="50"/> | 213 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
196 | <constraints> | 214 | <constraints> |
197 | <constraint firstAttribute="height" constant="50" id="9oI-Ia-C0h"/> | 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 | </constraints> | 217 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="Bhj-5W-tqM"/> |
199 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 218 | <constraint firstItem="yOP-KX-J14" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="5" id="Bp4-Am-rzQ"/> |
200 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 219 | <constraint firstItem="Jtx-be-zjg" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="C4T-QJ-aV0"/> |
201 | <nil key="highlightedColor"/> | 220 | <constraint firstItem="dQq-cp-R2A" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="CSy-Of-ifG"/> |
202 | </label> | 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 | <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"> | 223 | <constraint firstItem="oRx-7J-bma" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="60" id="DKw-80-JuB"/> |
204 | <rect key="frame" x="315" y="255" width="60" height="33.5"/> | 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 | <constraints> | 226 | <constraint firstItem="RSj-iV-Oaf" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="JTA-NC-8qU"/> |
206 | <constraint firstAttribute="height" constant="33.5" id="ale-7X-6Gx"/> | 227 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="top" secondItem="dQq-cp-R2A" secondAttribute="bottom" constant="8" id="KF9-QN-1Vc"/> |
207 | </constraints> | 228 | <constraint firstItem="wHy-xz-GJV" firstAttribute="top" secondItem="Jtx-be-zjg" secondAttribute="bottom" constant="8" id="LFj-zM-kIs"/> |
208 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 229 | <constraint firstAttribute="trailing" secondItem="RSj-iV-Oaf" secondAttribute="trailing" constant="10" id="Ldg-q1-Jsy"/> |
209 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 230 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="Ls8-7Q-gjM"/> |
210 | <nil key="highlightedColor"/> | 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 | </label> | 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 | </subviews> | 235 | <constraint firstItem="Jtx-be-zjg" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="U3o-rO-Gcb"/> |
213 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | 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 | <constraints> | 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="11m-je-qZ1" secondAttribute="trailing" id="5wQ-9t-fkx"/> | 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="1ak-Ne-wz9" firstAttribute="top" secondItem="PW6-AR-UCs" secondAttribute="top" id="7Lu-Sw-8Vd"/> | 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="V2B-wZ-Efk" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="Bhj-5W-tqM"/> | 247 | <constraint firstItem="11m-je-qZ1" firstAttribute="top" secondItem="V2B-wZ-Efk" secondAttribute="bottom" constant="8" id="vrX-sS-hWJ"/> |
218 | <constraint firstItem="yOP-KX-J14" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="5" id="Bp4-Am-rzQ"/> | 248 | <constraint firstItem="2SZ-sd-ADD" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" placeholder="YES" id="w1M-Il-jBT"/> |
219 | <constraint firstItem="Jtx-be-zjg" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="C4T-QJ-aV0"/> | 249 | <constraint firstAttribute="trailing" secondItem="oRx-7J-bma" secondAttribute="trailing" constant="60" id="y6f-vv-nWJ"/> |
220 | <constraint firstItem="dQq-cp-R2A" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="CSy-Of-ifG"/> | 250 | <constraint firstItem="wHy-xz-GJV" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="yEj-yT-PGx"/> |
221 | <constraint firstAttribute="trailing" secondItem="dQq-cp-R2A" secondAttribute="trailing" id="Ct9-ZA-fqo"/> | 251 | <constraint firstItem="yOP-KX-J14" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="ym9-6w-9C5"/> |
222 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="bottom" secondItem="Jtx-be-zjg" secondAttribute="bottom" id="DGk-ic-g00"/> | 252 | </constraints> |
223 | <constraint firstItem="oRx-7J-bma" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="60" id="DKw-80-JuB"/> | 253 | <point key="canvasLocation" x="33.5" y="54.5"/> |
224 | <constraint firstItem="11m-je-qZ1" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="FOq-gH-CTf"/> | 254 | </view> |
225 | <constraint firstItem="HLr-Qj-bm4" firstAttribute="leading" secondItem="Jtx-be-zjg" secondAttribute="leading" id="FhM-mA-AWq"/> | 255 | </objects> |
226 | <constraint firstItem="RSj-iV-Oaf" firstAttribute="centerY" secondItem="2SZ-sd-ADD" secondAttribute="centerY" id="JTA-NC-8qU"/> | 256 | <resources> |
227 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="top" secondItem="dQq-cp-R2A" secondAttribute="bottom" constant="8" id="KF9-QN-1Vc"/> | 257 | <image name="icon_facebook" width="40" height="40"/> |
228 | <constraint firstItem="wHy-xz-GJV" firstAttribute="top" secondItem="Jtx-be-zjg" secondAttribute="bottom" constant="8" id="LFj-zM-kIs"/> | 258 | <image name="icon_line" width="40" height="40"/> |
229 | <constraint firstAttribute="trailing" secondItem="RSj-iV-Oaf" secondAttribute="trailing" constant="10" id="Ldg-q1-Jsy"/> | 259 | <image name="icon_menu" width="30" height="30"/> |
230 | <constraint firstItem="V2B-wZ-Efk" firstAttribute="leading" secondItem="oRx-7J-bma" secondAttribute="trailing" id="Ls8-7Q-gjM"/> | 260 | <image name="icon_share" width="42" height="57"/> |
231 | <constraint firstItem="Jtx-be-zjg" firstAttribute="top" secondItem="PW6-AR-UCs" secondAttribute="bottom" constant="8" id="MMi-Mg-qDV"/> | 261 | <image name="icon_walking" width="14" height="25"/> |
232 | <constraint firstItem="1ak-Ne-wz9" firstAttribute="leading" secondItem="PW6-AR-UCs" secondAttribute="leading" id="NK3-Gl-NZu"/> | 262 | <image name="today_back_button" width="73" height="37"/> |
233 | <constraint firstAttribute="trailing" secondItem="2SZ-sd-ADD" secondAttribute="trailing" id="O9f-yA-cZ5"/> | 263 | </resources> |
234 | <constraint firstItem="equ-yC-hU1" firstAttribute="leading" secondItem="wHy-xz-GJV" secondAttribute="leading" id="Oe7-aI-2zb"/> | 264 | </document> |
235 | <constraint firstItem="Jtx-be-zjg" firstAttribute="centerY" secondItem="oRx-7J-bma" secondAttribute="centerY" id="U3o-rO-Gcb"/> | 265 |