Просмотр исходного кода

ATV: add about and settings skeleton

Felix Paul Kühne 9 лет назад
Родитель
Сommit
2e663ca1bb

+ 8 - 1
VLC for Apple TV/AppleTVAppDelegate.m

@@ -14,6 +14,7 @@
 #import "VLCLocalNetworkTVViewController.h"
 #import "VLCOpenNetworkStreamTVViewController.h"
 #import "VLCPlayerDisplayController.h"
+#import "VLCSettingsAboutTableViewController.h"
 
 @interface AppleTVAppDelegate ()
 {
@@ -22,6 +23,8 @@
     VLCAppSharesTVViewController *_sharesVC;
     VLCLocalNetworkTVViewController *_localNetworkVC;
     VLCOpenNetworkStreamTVViewController *_openNetworkVC;
+    UISplitViewController *_aboutSettingsVC;
+    VLCSettingsAboutTableViewController *_aboutSettingsTableVC;
 }
 
 @end
@@ -56,10 +59,14 @@
     _localNetworkVC = [[VLCLocalNetworkTVViewController alloc] initWithNibName:nil bundle:nil];
     _sharesVC = [[VLCAppSharesTVViewController alloc] initWithNibName:nil bundle:nil];
     _openNetworkVC = [[VLCOpenNetworkStreamTVViewController alloc] initWithNibName:nil bundle:nil];
+    _aboutSettingsVC = [[UISplitViewController alloc] init];
+    _aboutSettingsTableVC = [[VLCSettingsAboutTableViewController alloc] initWithNibName:nil bundle:nil];
+    _aboutSettingsVC.viewControllers = @[_aboutSettingsTableVC];
+    _aboutSettingsVC.title = @"Settings & About";
 
     _mainViewController = [[UITabBarController alloc] init];
     _mainViewController.tabBar.backgroundColor = [UIColor VLCOrangeTintColor];
-    _mainViewController.viewControllers = @[_sharesVC, _localNetworkVC, _openNetworkVC];
+    _mainViewController.viewControllers = @[_sharesVC, _localNetworkVC, _openNetworkVC, _aboutSettingsVC];
 
     VLCPlayerDisplayController *playerDisplayController = [VLCPlayerDisplayController sharedInstance];
     playerDisplayController.childViewController = _mainViewController;

+ 16 - 0
VLC for Apple TV/VLCAboutTVViewController.h

@@ -0,0 +1,16 @@
+/*****************************************************************************
+ * VLC for iOS
+ *****************************************************************************
+ * Copyright (c) 2015 VideoLAN. All rights reserved.
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne # videolan.org>
+ *
+ * Refer to the COPYING file of the official project for license.
+ *****************************************************************************/
+
+#import <UIKit/UIKit.h>
+
+@interface VLCAboutTVViewController : UIViewController
+
+@end

+ 56 - 0
VLC for Apple TV/VLCAboutTVViewController.m

@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * VLC for iOS
+ *****************************************************************************
+ * Copyright (c) 2015 VideoLAN. All rights reserved.
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne # videolan.org>
+ *
+ * Refer to the COPYING file of the official project for license.
+ *****************************************************************************/
+
+#import "VLCAboutTVViewController.h"
+
+@interface VLCAboutTVViewController ()
+{
+    UITextView *_textView;
+}
+
+@end
+
+@implementation VLCAboutTVViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+
+    CGRect frame = self.view.frame;
+    frame.size.width -= 40.;
+    frame.size.height -= 40.;
+    frame.origin.x += 20.;
+    frame.origin.y += 20.;
+
+    _textView = [[UITextView alloc] initWithFrame:frame];
+    _textView.clipsToBounds = YES;
+    _textView.backgroundColor = [UIColor VLCDarkBackgroundColor];
+    _textView.scrollEnabled = YES;
+
+    NSBundle *mainBundle = [NSBundle mainBundle];
+    NSMutableString *htmlContent = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil];
+    [htmlContent replaceOccurrencesOfString:@"VLCFORIOSVERSION" withString:[[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT", nil), [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]] stringByAppendingFormat:@" (%@)<br /><i>%@</i>", [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"], kVLCVersionCodename] options:NSLiteralSearch range:NSMakeRange(800, 1000)];
+    [htmlContent replaceOccurrencesOfString:@"MOBILEVLCKITVERSION" withString:[NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT", nil),[[VLCLibrary sharedLibrary] version]] options:NSLiteralSearch range:NSMakeRange(800, 1100)];
+
+    NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[htmlContent dataUsingEncoding:NSUTF8StringEncoding]
+                                                                            options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
+                                                                                      NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}
+                                                                 documentAttributes:nil error:nil];
+
+    _textView.attributedText = attributedString;
+    [self.view addSubview:_textView];
+}
+
+- (NSString *)title
+{
+    return @"About";
+}
+
+@end

+ 1 - 1
VLC for Apple TV/VLCLocalNetworkTVViewController.xib

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9058" systemVersion="15B30a" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9058" systemVersion="14F1017" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9048"/>
     </dependencies>

+ 13 - 0
VLC for Apple TV/VLCSettingsAboutTableViewController.h

@@ -0,0 +1,13 @@
+//
+//  VLCSettingsAboutTableTableViewController.h
+//  VLC for iOS
+//
+//  Created by Felix Paul Kühne on 20/10/15.
+//  Copyright © 2015 VideoLAN. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface VLCSettingsAboutTableViewController : UITableViewController
+
+@end

+ 73 - 0
VLC for Apple TV/VLCSettingsAboutTableViewController.m

@@ -0,0 +1,73 @@
+//
+//  VLCSettingsAboutTableTableViewController.m
+//  VLC for iOS
+//
+//  Created by Felix Paul Kühne on 20/10/15.
+//  Copyright © 2015 VideoLAN. All rights reserved.
+//
+
+#import "VLCSettingsAboutTableViewController.h"
+#import "VLCAboutTVViewController.h"
+
+@interface VLCSettingsAboutTableViewController ()
+{
+    VLCAboutTVViewController *_aboutVC;
+}
+@end
+
+@implementation VLCSettingsAboutTableViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+
+    self.navigationItem.rightBarButtonItem = self.editButtonItem;
+
+    _aboutVC = [[VLCAboutTVViewController alloc] initWithNibName:nil bundle:nil];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    [self.parentViewController showDetailViewController:_aboutVC sender:nil];
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return 2;
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RecentlyPlayedURLsTableViewCell"];
+    if (!cell) {
+        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"RecentlyPlayedURLsTableViewCell"];
+    }
+
+    cell.textLabel.text = @"text";
+    
+    return cell;
+}
+
+
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+    // Return NO if you do not want the specified item to be editable.
+    return YES;
+}
+
+
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+    if (editingStyle == UITableViewCellEditingStyleDelete) {
+        // Delete the row from the data source
+        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
+        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+    }   
+}
+
+@end

+ 22 - 0
VLC for iOS.xcodeproj/project.pbxproj

@@ -206,6 +206,9 @@
 		7DEC8BDE1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DEC8BDC1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m */; };
 		7DEC8BDF1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DEC8BDD1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib */; };
 		7DEC8BE91BD68BC9006E1093 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 7DEC8BE81BD68BC9006E1093 /* Settings.bundle */; };
+		7DEC8BED1BD68D6A006E1093 /* VLCAboutTVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DEC8BEB1BD68D6A006E1093 /* VLCAboutTVViewController.m */; };
+		7DEC8C1D1BD6913A006E1093 /* VLCSettingsAboutTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DEC8C1C1BD6913A006E1093 /* VLCSettingsAboutTableViewController.m */; };
+		7DEC8C1E1BD69710006E1093 /* About Contents.html in Resources */ = {isa = PBXBuildFile; fileRef = 7D5DD5C617590ABF001421E3 /* About Contents.html */; };
 		7DF04F4D1961F2B8004A5429 /* web-download-fixed.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F491961F2B8004A5429 /* web-download-fixed.png */; };
 		7DF04F4E1961F2B8004A5429 /* web-download.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F4A1961F2B8004A5429 /* web-download.png */; };
 		7DF04F4F1961F2B8004A5429 /* web-open-fixed.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F4B1961F2B8004A5429 /* web-open-fixed.png */; };
@@ -714,6 +717,10 @@
 		7DEC8BDC1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCFullscreenMovieTVViewController.m; sourceTree = "<group>"; };
 		7DEC8BDD1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VLCFullscreenMovieTVViewController.xib; sourceTree = "<group>"; };
 		7DEC8BE81BD68BC9006E1093 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
+		7DEC8BEA1BD68D6A006E1093 /* VLCAboutTVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCAboutTVViewController.h; sourceTree = "<group>"; };
+		7DEC8BEB1BD68D6A006E1093 /* VLCAboutTVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCAboutTVViewController.m; sourceTree = "<group>"; };
+		7DEC8C1B1BD6913A006E1093 /* VLCSettingsAboutTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCSettingsAboutTableViewController.h; sourceTree = "<group>"; };
+		7DEC8C1C1BD6913A006E1093 /* VLCSettingsAboutTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCSettingsAboutTableViewController.m; sourceTree = "<group>"; };
 		7DF04F491961F2B8004A5429 /* web-download-fixed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-download-fixed.png"; path = "Resources/web-download-fixed.png"; sourceTree = SOURCE_ROOT; };
 		7DF04F4A1961F2B8004A5429 /* web-download.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-download.png"; path = "Resources/web-download.png"; sourceTree = SOURCE_ROOT; };
 		7DF04F4B1961F2B8004A5429 /* web-open-fixed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-open-fixed.png"; path = "Resources/web-open-fixed.png"; sourceTree = SOURCE_ROOT; };
@@ -1107,6 +1114,7 @@
 				7DEC8BE41BD6888F006E1093 /* Basics */,
 				7DEC8BE31BD68882006E1093 /* Network UI */,
 				7DEC8BE51BD6889C006E1093 /* Playback */,
+				7DEC8BEF1BD68D71006E1093 /* Settings and stuff */,
 				7DC71D281BC83138001FACAA /* xibs */,
 				7DEC8BE61BD688AD006E1093 /* Resources */,
 				7D13293F1BA1F10100BE647E /* Supporting Files */,
@@ -1699,6 +1707,17 @@
 			name = Resources;
 			sourceTree = "<group>";
 		};
+		7DEC8BEF1BD68D71006E1093 /* Settings and stuff */ = {
+			isa = PBXGroup;
+			children = (
+				7DEC8BEA1BD68D6A006E1093 /* VLCAboutTVViewController.h */,
+				7DEC8BEB1BD68D6A006E1093 /* VLCAboutTVViewController.m */,
+				7DEC8C1B1BD6913A006E1093 /* VLCSettingsAboutTableViewController.h */,
+				7DEC8C1C1BD6913A006E1093 /* VLCSettingsAboutTableViewController.m */,
+			);
+			name = "Settings and stuff";
+			sourceTree = "<group>";
+		};
 		7DFB1567185CC38A008D49BB /* Dropbox */ = {
 			isa = PBXGroup;
 			children = (
@@ -2107,6 +2126,7 @@
 				7DEC8BDF1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib in Resources */,
 				7DC71D271BC830A5001FACAA /* VLCLocalNetworkTVViewController.xib in Resources */,
 				7DC71D221BC83058001FACAA /* VLCAppSharesTVViewController.xib in Resources */,
+				7DEC8C1E1BD69710006E1093 /* About Contents.html in Resources */,
 				7D13294F1BA1F10100BE647E /* Assets.xcassets in Resources */,
 				7DEC8BE91BD68BC9006E1093 /* Settings.bundle in Resources */,
 				7D7EF3DB1BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.xib in Resources */,
@@ -2254,6 +2274,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				7DC71D211BC83058001FACAA /* VLCAppSharesTVViewController.m in Sources */,
+				7DEC8BED1BD68D6A006E1093 /* VLCAboutTVViewController.m in Sources */,
 				7DEC8BD81BD66DA8006E1093 /* VLCMiniPlaybackView.m in Sources */,
 				7D7EF3DA1BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.m in Sources */,
 				7D7EF3DD1BD5779F00CD4CEE /* VLCPlaybackController.m in Sources */,
@@ -2265,6 +2286,7 @@
 				7D1329441BA1F10100BE647E /* AppleTVAppDelegate.m in Sources */,
 				7D1329411BA1F10100BE647E /* main.m in Sources */,
 				7DC71D291BC83590001FACAA /* UIColor+Presets.m in Sources */,
+				7DEC8C1D1BD6913A006E1093 /* VLCSettingsAboutTableViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};