Browse Source

Use Linear Progress Indicator to display playback progress in the iPhone media library

Felix Paul Kühne 12 years ago
parent
commit
61ff29f066

+ 2 - 0
AspenProject/VLCPlaylistTableViewCell.h

@@ -7,12 +7,14 @@
 //
 
 #import <Foundation/Foundation.h>
+#import "VLCLinearProgressIndicator.h"
 
 @interface VLCPlaylistTableViewCell : UITableViewCell
 
 @property (nonatomic, strong) IBOutlet UILabel *titleLabel;
 @property (nonatomic, strong) IBOutlet UILabel *subtitleLabel;
 @property (nonatomic, strong) IBOutlet UIImageView *thumbnailView;
+@property (nonatomic, strong) IBOutlet VLCLinearProgressIndicator*progressIndicator;
 
 + (VLCPlaylistTableViewCell *)cellWithReuseIdentifier:(NSString *)ident;
 + (CGFloat)heightOfCell;

+ 3 - 0
AspenProject/VLCPlaylistViewController.m

@@ -97,6 +97,9 @@
     cell.titleLabel.text = object.title;
     cell.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %.2f MB", [VLCTime timeWithNumber:[object duration]], [object fileSizeInBytes] / 2e6];
     cell.thumbnailView.image = object.computedThumbnail;
+    cell.progressIndicator.progress = object.lastPosition.floatValue;
+    if (cell.progressIndicator.progress < 0.1f)
+        cell.progressIndicator.hidden = YES;
     return cell;
 }
 

+ 47 - 6
Resources/VLCPlaylistTableViewCell.xib

@@ -15,6 +15,7 @@
 			<string>IBUIImageView</string>
 			<string>IBUILabel</string>
 			<string>IBUITableViewCell</string>
+			<string>IBUIView</string>
 		</array>
 		<array key="IBDocument.PluginDependencies">
 			<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -58,7 +59,7 @@
 								<string key="NSFrame">{{137, 5}, {178, 42}}</string>
 								<reference key="NSSuperview" ref="162418872"/>
 								<reference key="NSWindow"/>
-								<reference key="NSNextKeyView" ref="625431089"/>
+								<reference key="NSNextKeyView" ref="442944742"/>
 								<string key="NSReuseIdentifierKey">_NS:9</string>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
@@ -120,16 +121,27 @@
 								</object>
 								<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
 							</object>
+							<object class="IBUIView" id="442944742">
+								<reference key="NSNextResponder" ref="162418872"/>
+								<int key="NSvFlags">292</int>
+								<string key="NSFrame">{{5, 65}, {124, 10}}</string>
+								<reference key="NSSuperview" ref="162418872"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="625431089"/>
+								<string key="NSReuseIdentifierKey">_NS:9</string>
+								<object class="NSColor" key="IBUIBackgroundColor" id="698237866">
+									<int key="NSColorSpace">3</int>
+									<bytes key="NSWhite">MCAwAA</bytes>
+								</object>
+								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+							</object>
 						</array>
 						<string key="NSFrameSize">{320, 79}</string>
 						<reference key="NSSuperview" ref="962619467"/>
 						<reference key="NSWindow"/>
 						<reference key="NSNextKeyView" ref="784253519"/>
 						<string key="NSReuseIdentifierKey">_NS:11</string>
-						<object class="NSColor" key="IBUIBackgroundColor">
-							<int key="NSColorSpace">3</int>
-							<bytes key="NSWhite">MCAwAA</bytes>
-						</object>
+						<reference key="IBUIBackgroundColor" ref="698237866"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
 						<int key="IBUIContentMode">4</int>
@@ -173,6 +185,14 @@
 					</object>
 					<int key="connectionID">10</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">progressIndicator</string>
+						<reference key="source" ref="962619467"/>
+						<reference key="destination" ref="442944742"/>
+					</object>
+					<int key="connectionID">19</int>
+				</object>
 			</array>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<array key="orderedObjects">
@@ -200,6 +220,7 @@
 							<reference ref="784253519"/>
 							<reference ref="207506414"/>
 							<reference ref="625431089"/>
+							<reference ref="442944742"/>
 						</array>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -218,12 +239,19 @@
 						<reference key="object" ref="625431089"/>
 						<reference key="parent" ref="962619467"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">18</int>
+						<reference key="object" ref="442944742"/>
+						<reference key="parent" ref="962619467"/>
+					</object>
 				</array>
 			</object>
 			<dictionary class="NSMutableDictionary" key="flattenedProperties">
 				<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="-2.CustomClassName">UIResponder</string>
 				<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				<string key="18.CustomClassName">VLCLinearProgressIndicator</string>
+				<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="3.CustomClassName">VLCPlaylistTableViewCell</string>
 				<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -234,19 +262,32 @@
 			<nil key="activeLocalization"/>
 			<dictionary class="NSMutableDictionary" key="localizations"/>
 			<nil key="sourceID"/>
-			<int key="maxID">17</int>
+			<int key="maxID">19</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<array class="NSMutableArray" key="referencedPartialClassDescriptions">
 				<object class="IBPartialClassDescription">
+					<string key="className">VLCLinearProgressIndicator</string>
+					<string key="superclassName">UIProgressView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">./Classes/VLCLinearProgressIndicator.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
 					<string key="className">VLCPlaylistTableViewCell</string>
 					<string key="superclassName">UITableViewCell</string>
 					<dictionary class="NSMutableDictionary" key="outlets">
+						<string key="progressIndicator">VLCLinearProgressIndicator</string>
 						<string key="subtitleLabel">UILabel</string>
 						<string key="thumbnailView">UIImageView</string>
 						<string key="titleLabel">UILabel</string>
 					</dictionary>
 					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+						<object class="IBToOneOutletInfo" key="progressIndicator">
+							<string key="name">progressIndicator</string>
+							<string key="candidateClassName">VLCLinearProgressIndicator</string>
+						</object>
 						<object class="IBToOneOutletInfo" key="subtitleLabel">
 							<string key="name">subtitleLabel</string>
 							<string key="candidateClassName">UILabel</string>