Skip to content
This repository
Browse code

moved progress bars to use orsimpleprogress

  • Loading branch information...
commit b56985b6bb3de44cbf68c421ceb5ce5ce060cf64 1 parent 6791201
Orta authored
4 Puttio/ViewControllers/StatusViewController.m
@@ -72,8 +72,8 @@ - (void)getUserInfo {
72 72 NSString *bandwidthQuotaString = [[userInfoObject valueForKeyPath:@"response.results.bw_quota"] objectAtIndex:0];
73 73 NSString *bandwidthQuotaAvailableString = [[userInfoObject valueForKeyPath:@"response.results.bw_quota_available"] objectAtIndex:0];
74 74
75   - self.spaceProgressView.value = [diskQuotaAvailableString longLongValue] / [diskQuotaString longLongValue] ;
76   - self.bandwidthProgressView.value = [bandwidthQuotaAvailableString longLongValue] / [bandwidthQuotaString longLongValue];
  75 + self.spaceProgressView.progress = [diskQuotaAvailableString longLongValue] / [diskQuotaString longLongValue] ;
  76 + self.bandwidthProgressView.progress = [bandwidthQuotaAvailableString longLongValue] / [bandwidthQuotaString longLongValue];
77 77 }
78 78 }];
79 79 }
3  Puttio/Views/ARTransferCell.h
@@ -8,8 +8,9 @@
8 8
9 9 #import <UIKit/UIKit.h>
10 10
  11 +@class ORSimpleProgress;
11 12 @interface ARTransferCell : UITableViewCell
12 13 @property (weak, nonatomic) IBOutlet UILabel *nameLabel;
13 14 @property (weak, nonatomic) IBOutlet UILabel *detailsLabel;
14   -@property (weak, nonatomic) IBOutlet UIProgressView *progressView;
  15 +@property (weak, nonatomic) IBOutlet ORSimpleProgress *progressView;
15 16 @end
5 Puttio/Views/ORSimpleProgress.h
@@ -9,9 +9,10 @@
9 9 #import <UIKit/UIKit.h>
10 10
11 11 @interface ORSimpleProgress : UIView {
12   - CGFloat value;
  12 + CGFloat _progress;
13 13 }
14 14 @property (strong) UILabel *label;
15 15 @property (strong) UIColor *fillColour;
16   -@property CGFloat value;
  16 +@property (assign) BOOL isLandscape;
  17 +@property CGFloat progress;
17 18 @end
16 Puttio/Views/ORSimpleProgress.m
@@ -9,13 +9,13 @@
9 9 #import "ORSimpleProgress.h"
10 10
11 11 @implementation ORSimpleProgress
12   -@synthesize label, fillColour;
13   -@dynamic value;
  12 +@synthesize label, fillColour, isLandscape;
  13 +@dynamic progress;
14 14
15 15 - (void)awakeFromNib {
16 16 self.alpha = .3;
17 17 self.label = [[UILabel alloc] initWithFrame:self.frame];
18   - value = .3;
  18 + _progress = .3;
19 19 self.backgroundColor = [UIColor putioBlue];
20 20 self.fillColour = [UIColor putioYellow];
21 21 }
@@ -27,14 +27,18 @@ - (void)drawRect:(CGRect)rect {
27 27 CGContextFillRect(c, self.bounds);
28 28
29 29 CGRect filledRect = self.bounds;
30   - filledRect.size.height = filledRect.size.height / value;
  30 + if (self.isLandscape) {
  31 + filledRect.size.width = filledRect.size.width / _progress;
  32 + }else{
  33 + filledRect.size.height = filledRect.size.height / _progress;
  34 + }
31 35 CGContextSetFillColor(c, CGColorGetComponents(self.fillColour.CGColor));
32 36 CGContextFillRect(c, filledRect);
33 37 }
34 38
35   -- (void)setValue:(CGFloat)aValue {
  39 +- (void)setProgress:(CGFloat)progress {
36 40 self.alpha = 1;
37   - value = aValue;
  41 + _progress = progress;
38 42 [self setNeedsDisplay];
39 43 }
40 44
14 Puttio/en.lproj/MainStoryboard.storyboard
@@ -64,10 +64,6 @@
64 64 <rect key="frame" x="0.0" y="0.0" width="280" height="75"/>
65 65 <autoresizingMask key="autoresizingMask"/>
66 66 <subviews>
67   - <progressView opaque="NO" contentMode="scaleToFill" progress="0.5" id="eFg-0k-MsJ">
68   - <rect key="frame" x="12" y="59" width="256" height="9"/>
69   - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
70   - </progressView>
71 67 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Possible 2 line" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="10" id="dVU-tr-veP">
72 68 <rect key="frame" x="12" y="5" width="191" height="46"/>
73 69 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
@@ -82,13 +78,18 @@
82 78 <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
83 79 <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
84 80 </label>
  81 + <view contentMode="scaleToFill" id="gza-sM-zWc" customClass="ORSimpleProgress">
  82 + <rect key="frame" x="14" y="66" width="254" height="6"/>
  83 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  84 + <color key="backgroundColor" red="0.97776401040000005" green="0.92181301120000003" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
  85 + </view>
85 86 </subviews>
86 87 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
87 88 </view>
88 89 <connections>
89 90 <outlet property="detailsLabel" destination="8Vb-Bq-HVi" id="xs2-Ua-35D"/>
90 91 <outlet property="nameLabel" destination="dVU-tr-veP" id="9CK-5v-zd0"/>
91   - <outlet property="progressView" destination="eFg-0k-MsJ" id="tX9-Zn-h0t"/>
  92 + <outlet property="progressView" destination="gza-sM-zWc" id="BmO-hO-EVN"/>
92 93 </connections>
93 94 </tableViewCell>
94 95 <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="MessageCell" rowHeight="28" id="yfM-94-3VS" customClass="ORMessageCell">
@@ -391,7 +392,7 @@
391 392 <relationships>
392 393 <relationship kind="outlet" name="detailsLabel" candidateClass="UILabel"/>
393 394 <relationship kind="outlet" name="nameLabel" candidateClass="UILabel"/>
394   - <relationship kind="outlet" name="progressView" candidateClass="UIProgressView"/>
  395 + <relationship kind="outlet" name="progressView" candidateClass="ORSimpleProgress"/>
395 396 </relationships>
396 397 </class>
397 398 <class className="BrowsingViewController" superclassName="UIViewController">
@@ -448,7 +449,6 @@
448 449 <source key="sourceIdentifier" type="project" relativePath="./Classes/StatusViewController.h"/>
449 450 <relationships>
450 451 <relationship kind="outlet" name="bandwidthProgressView" candidateClass="ORSimpleProgress"/>
451   - <relationship kind="outlet" name="spaceProgressView" candidateClass="ORSimpleProgress"/>
452 452 <relationship kind="outlet" name="tableView" candidateClass="UITableView"/>
453 453 </relationships>
454 454 </class>

0 comments on commit b56985b

Please sign in to comment.
Something went wrong with that request. Please try again.