Skip to content

Commit

Permalink
Add sorting button
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedc committed Aug 17, 2022
1 parent 5d3a48c commit cb358bf
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Apple-TV/Assets.xcassets/sortingImage.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "tv",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Apple-TV/VLCOpenNetworkStreamTVViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
@property (readwrite, nonatomic, weak) IBOutlet UIImageView *nothingFoundConeImageView;

@property (readwrite, nonatomic, weak) IBOutlet UIButton *emptyListButton;
@property (readwrite, nonatomic, weak) IBOutlet UIButton *reverseListSortingButton;

- (IBAction)URLEnteredInField:(id)sender;
- (IBAction)emptyListAction:(id)sender;
- (IBAction)reverseListSortingAction:(id)sender;

@end
16 changes: 16 additions & 0 deletions Apple-TV/VLCOpenNetworkStreamTVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ @interface VLCOpenNetworkStreamTVViewController ()
{
NSMutableArray *_recentURLs;
NSMutableDictionary *_recentURLTitles;
BOOL newestFirst;
}
@property (nonatomic) NSIndexPath *currentlyFocusedIndexPath;
@end
Expand Down Expand Up @@ -50,6 +51,9 @@ - (void)viewDidLoad {
self.playURLField.textContentType = UITextContentTypeURL;
}
self.emptyListButton.accessibilityLabel = NSLocalizedString(@"BUTTON_RESET", nil);
self.reverseListSortingButton.accessibilityLabel = NSLocalizedString(@"BUTTON_REVERSE", nil);

newestFirst = false;

self.previouslyPlayedStreamsTableView.backgroundColor = [UIColor clearColor];
self.previouslyPlayedStreamsTableView.rowHeight = UITableViewAutomaticDimension;
Expand Down Expand Up @@ -129,6 +133,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
if (count > 0) {
self.nothingFoundView.hidden = YES;
self.emptyListButton.hidden = NO;
self.reverseListSortingButton.hidden = NO;
}
return count;
}
Expand Down Expand Up @@ -204,6 +209,17 @@ - (void)emptyListAction:(id)sender
[self presentViewController:alertController animated:YES completion:nil];
}

- (IBAction)reverseListSortingAction:(id)sender
{
newestFirst = !newestFirst;

if (newestFirst) {
self.reverseListSortingButton.transform = CGAffineTransformMakeRotation( M_PI );
} else {
self.reverseListSortingButton.transform = CGAffineTransformIdentity;
}
}

#pragma mark - editing

- (NSIndexPath *)indexPathToDelete
Expand Down
20 changes: 17 additions & 3 deletions Apple-TV/VLCOpenNetworkStreamTVViewController.xib
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="20037" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="19529" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="appleTV" appearance="light"/>
<dependencies>
<deployment identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<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="emptyListButton" destination="OXZ-Zx-045" id="kJS-RB-MGp"/>
<outlet property="emptyListButton" destination="OXZ-Zx-045" id="amt-Xy-VhT"/>
<outlet property="nothingFoundConeImageView" destination="aAb-aY-bkT" id="Abp-Yt-oQb"/>
<outlet property="nothingFoundLabel" destination="sdc-e1-PSc" id="dvi-jc-vaR"/>
<outlet property="nothingFoundView" destination="dvt-CP-ALF" id="lg3-aJ-oHg"/>
<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"/>
<outlet property="reverseListSortingButton" destination="S9C-So-1TT" id="Wys-kF-xwY"/>
<outlet property="view" destination="iN0-l3-epB" id="Eym-vH-oyN"/>
</connections>
</placeholder>
Expand Down Expand Up @@ -83,17 +84,29 @@
<action selector="emptyListAction:" destination="-1" eventType="primaryActionTriggered" id="Pp6-st-y2N"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S9C-So-1TT">
<rect key="frame" x="1439" y="190" width="128" height="88"/>
<inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="delete"/>
<buttonConfiguration key="configuration" style="gray" image="sortingImage"/>
<connections>
<action selector="reverseListSortingAction:" destination="-1" eventType="primaryActionTriggered" id="pFj-w5-Hp2"/>
</connections>
</button>
</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 firstItem="S9C-So-1TT" firstAttribute="centerY" secondItem="dWa-3n-YCa" secondAttribute="centerY" id="D1b-zy-Rwv"/>
<constraint firstItem="dvt-CP-ALF" firstAttribute="centerY" secondItem="v0o-s0-Xaz" secondAttribute="centerY" id="GIx-LR-UOF"/>
<constraint firstItem="dvt-CP-ALF" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="961" id="GfH-Fp-I0L"/>
<constraint firstItem="OXZ-Zx-045" firstAttribute="trailing" secondItem="v0o-s0-Xaz" secondAttribute="trailing" id="HGJ-W8-lfl"/>
<constraint firstItem="OXZ-Zx-045" firstAttribute="centerY" secondItem="dWa-3n-YCa" secondAttribute="centerY" id="O9J-Zz-Pur"/>
<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="OXZ-Zx-045" firstAttribute="leading" secondItem="S9C-So-1TT" secondAttribute="trailing" constant="42.5" id="jlD-FU-9bO"/>
<constraint firstItem="dWa-3n-YCa" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="oFS-xp-QJo"/>
<constraint firstItem="dvt-CP-ALF" firstAttribute="centerX" secondItem="v0o-s0-Xaz" secondAttribute="centerX" id="uSF-XP-xr0"/>
<constraint firstAttribute="bottom" secondItem="v0o-s0-Xaz" secondAttribute="bottom" constant="70" id="ydf-eT-5UK"/>
Expand All @@ -105,5 +118,6 @@
<image name="cone" width="143" height="158"/>
<image name="delete" width="24" height="24"/>
<image name="deleteImage" width="48" height="48"/>
<image name="sortingImage" width="48" height="48"/>
</resources>
</document>
1 change: 1 addition & 0 deletions Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"BUTTON_CONTINUE" = "Fortsetzen";
"BUTTON_SET" = "Einstellen";
"BUTTON_RESET" = "Zurücksetzen";
"BUTTON_REVERSE" = "Sortierung ändern";
"BUTTON_RESCAN" = "Erneut durchsuchen";
"PRIVATE_PLAYBACK_TOGGLE" = "Private Wiedergabe";
"SCAN_SUBTITLE_TOGGLE" = "Untertitelsuche (nur HTTP)";
Expand Down
1 change: 1 addition & 0 deletions Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"BUTTON_CONTINUE" = "Continue";
"BUTTON_SET" = "Set";
"BUTTON_RESET" = "Reset";
"BUTTON_REVERSE" = "Reverse sorting order";
"BUTTON_RESCAN" = "Rescan";
"PRIVATE_PLAYBACK_TOGGLE" = "Private Playback";
"SCAN_SUBTITLE_TOGGLE" = "Scan for Subtitles (http-only)";
Expand Down

0 comments on commit cb358bf

Please sign in to comment.