Commit 86374098 authored by Tobias's avatar Tobias Committed by Felix Paul Kühne

add empty library view

parent a7a5fb3b
......@@ -36,13 +36,13 @@ CHECKOUT OPTIONS:
:git: https://github.com/carolanitz/QuincyKit.git
SPEC CHECKSUMS:
box-ios-sdk-v2: c06d3009266dc2c5c27bbb3882f1e5cf1f3c72cb
box-ios-sdk-v2: e6833ca786bf93da1dbe63e3d0a945b1e1fe1f42
GHSidebarNav: b0c7937f3fdc2889025d307036223bc0dd7c3a0d
InAppSettingsKit: 76d5cfbaa3e3f8aa53fe3628516da7eb1aa6a5cb
OBSlider: 490f108007bfdd5414a38650b211fe403a95b8a0
PLCrashReporter: 655201ef69223866e230a25c973c8f39bcc4b722
QuincyKit: 31f49bf0aa0b20fd25ba3084f617a43424b7af99
QuincyKit: 5a7a96a5886e2096d347da3c738f39fe9326f800
SSKeychain: 88767e903ee8d274ed380e364d96b7a101235286
upnpx: e56e4f26d21c439b2383e03b5ca9082a3d5046a1
COCOAPODS: 0.35.0
COCOAPODS: 0.36.0
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="6751" systemVersion="14C1514" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="AgC-eL-Hgc">
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="7528.3" systemVersion="14C1514" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="AgC-eL-Hgc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7518.3"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="3737"/>
</dependencies>
<scenes>
......@@ -38,8 +38,20 @@
<action selector="nextPagePressed" destination="AgC-eL-Hgc" id="iNm-4n-TvE"/>
</connections>
</button>
<group width="1" alignment="left" layout="vertical" id="Sdu-Gc-HNJ">
<items>
<imageView alignment="center" image="vlcCone" contentMode="scaleAspectFit" id="oPx-9e-qpC"/>
<label width="1" alignment="center" textAlignment="center" numberOfLines="0" id="t8d-XX-2X2">
<fontDescription key="font" style="UICTFontTextStyleHeadline"/>
</label>
<label alignment="left" textAlignment="left" numberOfLines="0" id="hcI-lI-ORA"/>
</items>
</group>
</items>
<connections>
<outlet property="emptyLibraryGroup" destination="Sdu-Gc-HNJ" id="Pj1-Oh-Is8"/>
<outlet property="emptyLibraryLabel" destination="t8d-XX-2X2" id="5MF-Vt-cAr"/>
<outlet property="emptyLibraryLabelLong" destination="hcI-lI-ORA" id="5g5-hU-Gae"/>
<outlet property="nextButton" destination="3AK-kX-V9D" id="Iju-cx-571"/>
<outlet property="previousButton" destination="fUJ-qB-19l" id="r36-II-aik"/>
<outlet property="table" destination="lC4-Vd-sgP" id="mxe-b7-XMx"/>
......
......@@ -20,6 +20,11 @@
@property (weak, nonatomic) IBOutlet WKInterfaceButton *previousButton;
@property (nonatomic, weak) IBOutlet WKInterfaceTable *table;
@property (weak, nonatomic) IBOutlet WKInterfaceButton *nextButton;
@property (weak, nonatomic) IBOutlet WKInterfaceGroup *emptyLibraryGroup;
@property (weak, nonatomic) IBOutlet WKInterfaceLabel *emptyLibraryLabel;
@property (weak, nonatomic) IBOutlet WKInterfaceLabel *emptyLibraryLabelLong;
- (IBAction)previousPagePressed;
- (IBAction)nextPagePressed;
......
......@@ -51,6 +51,10 @@ typedef enum {
mediaLibrary.additionalPersitentStoreOptions = @{NSReadOnlyPersistentStoreOption : @YES};
self.title = NSLocalizedString(@"LIBRARY_ALL_FILES", nil);
self.emptyLibraryLabel.text = NSLocalizedString(@"EMPTY_LIBRARY", nil);
self.emptyLibraryLabelLong.text = NSLocalizedString(@"EMPTY_LIBRARY_LONG", nil);
[[VLCNotificationRelay sharedRelay] addRelayRemoteName:VLCDBUpdateNotificationRemote toLocalName:VLCDBUpdateNotification];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateData) name:VLCDBUpdateNotification object:nil];
......@@ -58,6 +62,7 @@ typedef enum {
tableController.table = self.table;
tableController.previousPageButton = self.previousButton;
tableController.nextPageButton = self.nextButton;
tableController.emptyLibraryInterfaceObjects = self.emptyLibraryGroup;
tableController.pageSize = 5;
tableController.rowType = rowType;
......
......@@ -26,6 +26,11 @@ typedef void(^VLCWatchTableControllerConfigureRowControllerWithObjectBlock)(id r
@property (nonatomic, weak) IBOutlet WKInterfaceButton *nextPageButton;
/*
* Interface object which will be shown when the objects array is empty;
*/
@property (nonatomic, weak) IBOutlet WKInterfaceObject *emptyLibraryInterfaceObjects;
/*
* set eigher rowType if every row should have the same rowType or the
* rowTypeForObjectBlock which returns the matching row type for an object
......
......@@ -29,7 +29,6 @@
[self updateTable];
}
- (void)updateTable {
NSUInteger pageSize = self.pageSize;
......@@ -54,10 +53,6 @@
endIndex = objectsCount;
}
/* set starte for previous and next buttons */
self.previousPageButton.hidden = currentPage == 0;
self.nextPageButton.hidden = endIndex >= objectsCount;
/* get new dispayed objects */
NSRange range = NSMakeRange(startIndex, endIndex-startIndex);
NSArray *newObjects = [self.objects subarrayWithRange:range];
......@@ -99,7 +94,7 @@
[table insertRowsAtIndexes:indexSet withRowType:self.rowType];
}
[newObjects enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[self configureTableCellAtIndex:idx withObject:obj];
[self _configureTableCellAtIndex:idx withObject:obj];
}];
}
}
......@@ -115,19 +110,25 @@
[newObjects enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([addedSet containsObject:obj]) {
NSString *rowType = [self rowTypeForObject:obj];
NSString *rowType = [self _rowTypeForObject:obj];
[table insertRowsAtIndexes:[NSIndexSet indexSetWithIndex:idx] withRowType:rowType];
}
[self configureTableCellAtIndex:idx withObject:obj];
[self _configureTableCellAtIndex:idx withObject:obj];
}];
}
self.rowTypes = rowTypes;
self.displayedObjects = newObjects;
self.displayedIndexes = [NSIndexSet indexSetWithIndexesInRange:range];
}
/* set state for previous and next buttons */
self.previousPageButton.hidden = currentPage == 0;
self.nextPageButton.hidden = endIndex >= objectsCount;
self.emptyLibraryInterfaceObjects.hidden = newObjects.count != 0;
}
- (void)nextPageButtonPressed {
NSUInteger nextPageStartIndex = self.pageSize * (self.currentPage+1);
if (nextPageStartIndex > self.objects.count) {
......@@ -151,7 +152,7 @@
#pragma mark - internal helper
- (NSString *)rowTypeForObject:(id)object {
- (NSString *)_rowTypeForObject:(id)object {
if (self.rowTypeForObjectBlock) {
return self.rowTypeForObjectBlock(object);
}
......@@ -159,7 +160,7 @@
return self.rowType;
}
- (void)configureTableCellAtIndex:(NSUInteger)index withObject:(id)object {
- (void)_configureTableCellAtIndex:(NSUInteger)index withObject:(id)object {
VLCWatchTableControllerConfigureRowControllerWithObjectBlock configureBlock = self.configureRowControllerWithObjectBlock;
NSAssert(configureBlock, @"configureRowControllerWithObjectBlock must be set");
if (configureBlock) {
......
......@@ -5,4 +5,7 @@
"DETAIL"="Details";
"LIBRARY_ALL_FILES"="Alle Dateien";
"LIBRARY_MUSIC"="Musikalben";
"LIBRARY_SERIES"="TV-Sendungen";
\ No newline at end of file
"LIBRARY_SERIES"="TV-Sendungen";
"EMPTY_LIBRARY"="Leere Mediathek";
"EMPTY_LIBRARY_LONG"="Bitte fügen Sie in der VLC iOS App Dateien zu ihrer Mediathek hinzu.";
......@@ -5,4 +5,6 @@
"DETAIL"="Detail";
"LIBRARY_ALL_FILES"="All Files";
"LIBRARY_MUSIC"="Music Albums";
"LIBRARY_SERIES"="TV Shows";
\ No newline at end of file
"LIBRARY_SERIES"="TV Shows";
"EMPTY_LIBRARY"="Empty Media Library";
"EMPTY_LIBRARY_LONG"="Please add files to your Media Library in the VLC iOS App.";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment