Commit 2a9eb8b8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

ATV ONS: implement URL deletion

parent 5a3acda9
......@@ -10,8 +10,9 @@
*****************************************************************************/
#import <UIKit/UIKit.h>
#import "VLCDeletionCapableViewController.h"
@interface VLCOpenNetworkStreamTVViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@interface VLCOpenNetworkStreamTVViewController : VLCDeletionCapableViewController <UITableViewDataSource, UITableViewDelegate>
@property (readwrite, nonatomic, weak) IBOutlet UITextField *playURLField;
@property (readwrite, nonatomic, weak) IBOutlet UITableView *previouslyPlayedStreamsTableView;
......
......@@ -13,12 +13,14 @@
#import "VLCPlaybackController.h"
#import "VLCPlayerDisplayController.h"
#import "VLCFullscreenMovieTVViewController.h"
#import "CAAnimation+VLCWiggle.h"
@interface VLCOpenNetworkStreamTVViewController ()
{
NSMutableArray *_recentURLs;
UILabel *_noURLsToShowLabel;
}
@property (nonatomic) NSIndexPath *currentlyFocusedIndexPath;
@end
@implementation VLCOpenNetworkStreamTVViewController
......@@ -121,6 +123,11 @@
return _recentURLs.count;
}
- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
self.currentlyFocusedIndexPath = indexPath;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
......@@ -151,4 +158,52 @@
completion:nil];
}
#pragma mark - editing
- (NSIndexPath *)indexPathToDelete
{
NSIndexPath *indexPathToDelete = self.currentlyFocusedIndexPath;
return indexPathToDelete;
}
- (NSString *)itemToDelete
{
NSIndexPath *indexPathToDelete = self.indexPathToDelete;
if (!indexPathToDelete) {
return nil;
}
NSString *ret;
@synchronized(_recentURLs) {
ret = _recentURLs[indexPathToDelete.item];
}
return ret;
}
- (void)setEditing:(BOOL)editing
{
[super setEditing:editing];
UITableViewCell *focusedCell = [self.previouslyPlayedStreamsTableView cellForRowAtIndexPath:self.currentlyFocusedIndexPath];
if (editing) {
[focusedCell.layer addAnimation:[CAAnimation vlc_wiggleAnimation]
forKey:VLCWiggleAnimationKey];
} else {
[focusedCell.layer removeAnimationForKey:VLCWiggleAnimationKey];
}
}
- (void)deleteFileAtIndex:(NSIndexPath *)indexPathToDelete
{
if (!indexPathToDelete) {
return;
}
@synchronized(_recentURLs) {
[_recentURLs removeObjectAtIndex:indexPathToDelete.row];
}
[[NSUbiquitousKeyValueStore defaultStore] setArray:_recentURLs forKey:kVLCRecentURLs];
[self.previouslyPlayedStreamsTableView reloadData];
}
@end
......@@ -6,6 +6,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCOpenNetworkStreamTVViewController">
<connections>
<outlet property="deleteHintView" destination="Wa3-IS-ztU" id="ipW-Hx-fMJ"/>
<outlet property="playURLField" destination="dWa-3n-YCa" id="Eoe-vT-AuM"/>
<outlet property="preferredFocusedView" destination="dWa-3n-YCa" id="0Ez-4Z-KFF"/>
<outlet property="previouslyPlayedStreamsTableView" destination="v0o-s0-Xaz" id="I1r-ie-lFf"/>
......@@ -40,9 +41,14 @@
<outlet property="delegate" destination="-1" id="osW-Kv-1VK"/>
</connections>
</tableView>
<view hidden="YES" contentMode="scaleToFill" placeholderIntrinsicWidth="550" placeholderIntrinsicHeight="100" translatesAutoresizingMaskIntoConstraints="NO" id="Wa3-IS-ztU" customClass="VLCDeleteHintTVView">
<rect key="frame" x="685" y="930" width="550" height="100"/>
</view>
</subviews>
<constraints>
<constraint firstItem="Wa3-IS-ztU" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="0ms-Lt-g1Q"/>
<constraint firstItem="dWa-3n-YCa" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="193" id="6FP-0U-Znd"/>
<constraint firstAttribute="bottom" secondItem="Wa3-IS-ztU" secondAttribute="bottom" constant="50" id="ZDa-1f-46j"/>
<constraint firstItem="v0o-s0-Xaz" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="elq-bO-Tb3"/>
<constraint firstItem="v0o-s0-Xaz" firstAttribute="top" secondItem="dWa-3n-YCa" secondAttribute="bottom" constant="70" id="jCe-Gz-82c"/>
<constraint firstItem="dWa-3n-YCa" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="oFS-xp-QJo"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCRemoteBrowsingCollectionViewController">
......@@ -15,7 +15,6 @@
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" id="NUi-8f-W1D">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="100" minimumInteritemSpacing="50" id="o9k-mG-llf">
<size key="itemSize" width="308" height="308"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
......
......@@ -20,8 +20,6 @@
#define remotePlaybackReuseIdentifer @"remotePlaybackReuseIdentifer"
static NSString *const VLCWiggleAnimationKey = @"VLCWiggleAnimation";
@interface VLCRemotePlaybackViewController () <UICollectionViewDataSource, UICollectionViewDelegate, VLCMediaFileDiscovererDelegate>
{
Reachability *_reachability;
......
......@@ -11,6 +11,8 @@
#import <QuartzCore/QuartzCore.h>
static NSString *const VLCWiggleAnimationKey = @"VLCWiggleAnimation";
@interface CAAnimation (VLCWiggle)
+ (instancetype)vlc_wiggleAnimation;
@end
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