Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Carola
vlc-ios
Commits
202bf9df
Commit
202bf9df
authored
Jan 30, 2018
by
Carola Nitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLCAboutViewController: adopt Themes and added toHex method for UIColor
parent
ae04d8f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
20 deletions
+65
-20
Resources/About Contents.html
Resources/About Contents.html
+7
-7
SharedSources/PresentationTheme.swift
SharedSources/PresentationTheme.swift
+29
-5
Sources/VLCAboutViewController.m
Sources/VLCAboutViewController.m
+28
-7
Sources/VLCPlaybackController.h
Sources/VLCPlaybackController.h
+1
-1
No files found.
Resources/About Contents.html
View file @
202bf9df
<html>
<head>
</head>
<body
style=
"background-color:
#1f1f1f
"
>
<body
style=
"background-color:
BACKGROUNDCOLOR
"
>
<style
type=
"text/css"
>
h3
{
color
:
#aaaaaa
}
h5
{
text-decoration
:
plain
;
color
:
#aaaaaa
}
A
:link
{
text-decoration
:
underline
;
color
:
#aaaaaa
}
A
:visited
{
text-decoration
:
none
;
color
:
#aaaaaa
}
A
:active
{
text-decoration
:
none
;
color
:
#aaaaaa
}
h3
{
color
:
TEXTCOLOR
}
h5
{
text-decoration
:
plain
;
color
:
TEXTCOLOR
}
A
:link
{
text-decoration
:
underline
;
color
:
TEXTCOLOR
}
A
:visited
{
text-decoration
:
none
;
color
:
TEXTCOLOR
}
A
:active
{
text-decoration
:
none
;
color
:
TEXTCOLOR
}
body
{
font-family
:
"HelveticaNeue-Light"
,
"Helvetica Neue Light"
,
"Helvetica Neue"
,
Helvetica
,
Arial
,
"Lucida Grande"
,
sans-serif
;
font-weight
:
300
;
}
</style>
<div
style=
"text-align:left; border:solid transparent 1px; padding:0.5em 1em 0.5em 1em; overflow:auto; font-size:10pt; font-family:Helvetica; color:
#aaaaaa
"
;
A:link
{
text-decoration:
underline
;
color:
#aaaaaa
}
>
<div
style=
"text-align:left; border:solid transparent 1px; padding:0.5em 1em 0.5em 1em; overflow:auto; font-size:10pt; font-family:Helvetica; color:
TEXTCOLOR
"
;
A:link
{
text-decoration:
underline
;
color:
TEXTCOLOR
}
>
<p
align=
"center"
>
<table
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
...
...
SharedSources/PresentationTheme.swift
View file @
202bf9df
...
...
@@ -80,13 +80,37 @@ public class PresentationTheme : NSObject {
}
}
public
extension
UIColor
{
@objc
public
extension
UIColor
{
public
convenience
init
(
_
rgbValue
:
UInt32
,
_
alpha
:
CGFloat
=
1.0
)
{
let
red
=
((
CGFloat
)((
rgbValue
&
0xFF0000
)
>>
16
))
/
255.0
let
green
=
((
CGFloat
)((
rgbValue
&
0xFF00
)
>>
8
))
/
255.0
let
blue
=
((
CGFloat
)(
rgbValue
&
0xFF
))
/
255.0
self
.
init
(
red
:
red
,
green
:
green
,
blue
:
blue
,
alpha
:
1.0
)
let
r
=
CGFloat
((
rgbValue
&
0xFF0000
)
>>
16
)
/
255.0
let
g
=
CGFloat
((
rgbValue
&
0xFF00
)
>>
8
)
/
255.0
let
b
=
CGFloat
(
rgbValue
&
0xFF
)
/
255.0
self
.
init
(
red
:
r
,
green
:
g
,
blue
:
b
,
alpha
:
1.0
)
}
func
toHex
(
alpha
:
Bool
=
false
)
->
String
?
{
guard
let
components
=
cgColor
.
components
,
components
.
count
>=
3
else
{
return
nil
}
let
r
=
Float
(
components
[
0
])
let
g
=
Float
(
components
[
1
])
let
b
=
Float
(
components
[
2
])
var
a
=
Float
(
1.0
)
if
components
.
count
==
4
{
a
=
Float
(
components
[
3
])
}
if
alpha
{
return
String
(
format
:
"#%02lX%02lX%02lX%02lX"
,
lroundf
(
r
*
255
),
lroundf
(
g
*
255
),
lroundf
(
b
*
255
),
lroundf
(
a
*
255
))
}
else
{
return
String
(
format
:
"#%02lX%02lX%02lX"
,
lroundf
(
r
*
255
),
lroundf
(
g
*
255
),
lroundf
(
b
*
255
))
}
}
var
toHex
:
String
?
{
return
toHex
()
}
}
...
...
Sources/VLCAboutViewController.m
View file @
202bf9df
...
...
@@ -13,6 +13,7 @@
*****************************************************************************/
#import "VLCAboutViewController.h"
#import "VLC_iOS-Swift.h"
@interface
VLCAboutViewController
()
{
...
...
@@ -26,7 +27,7 @@
-
(
void
)
loadView
{
self
.
view
=
[[
UIView
alloc
]
initWithFrame
:[
UIScreen
mainScreen
].
bounds
];
self
.
view
.
backgroundColor
=
[
UIColor
VLCDarkB
ackground
Color
]
;
self
.
view
.
backgroundColor
=
PresentationTheme
.
current
.
colors
.
b
ackground
;
self
.
view
.
autoresizingMask
=
UIViewAutoresizingFlexibleHeight
|
UIViewAutoresizingFlexibleWidth
;
_webView
=
[[
UIWebView
alloc
]
initWithFrame
:
self
.
view
.
frame
];
...
...
@@ -37,6 +38,8 @@
_webView
.
scrollView
.
indicatorStyle
=
UIScrollViewIndicatorStyleWhite
;
_webView
.
autoresizingMask
=
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleHeight
;
[
self
.
view
addSubview
:
_webView
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
themeDidChange
)
name
:
kVLCThemeDidChangeNotification
object
:
nil
];
}
-
(
void
)
viewDidLoad
...
...
@@ -49,13 +52,31 @@
contributeButton
.
tintColor
=
[
UIColor
whiteColor
];
self
.
navigationItem
.
rightBarButtonItem
=
contributeButton
;
[
self
loadWebContent
];
}
-
(
void
)
loadWebContent
{
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
)];
[
_webView
loadHTMLString
:[
NSString
stringWithString
:
htmlContent
]
baseURL
:[
NSURL
fileURLWithPath
:[[
NSBundle
mainBundle
]
bundlePath
]]];
htmlContent
=
nil
;
NSString
*
textColor
=
PresentationTheme
.
current
.
colors
.
cellTextColor
.
toHex
;
NSString
*
backgroundColor
=
PresentationTheme
.
current
.
colors
.
background
.
toHex
;
NSString
*
version
=
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"VERSION_FORMAT"
,
nil
),
[
mainBundle
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
]];
NSString
*
versionBuildNumberAndCodeName
=
[
version
stringByAppendingFormat
:
@" (%@)<br /><i>%@</i>"
,
[
mainBundle
objectForInfoDictionaryKey
:
@"CFBundleVersion"
],
kVLCVersionCodename
];
NSString
*
vlcLibraryVersion
=
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"BASED_ON_FORMAT"
,
nil
),[[
VLCLibrary
sharedLibrary
]
version
]];
NSString
*
htmlFilePath
=
[
mainBundle
pathForResource
:
@"About Contents"
ofType
:
@"html"
];
NSMutableString
*
htmlContent
=
[
NSMutableString
stringWithContentsOfFile
:
htmlFilePath
encoding
:
NSUTF8StringEncoding
error
:
nil
];
[
htmlContent
replaceOccurrencesOfString
:
@"VLCFORIOSVERSION"
withString
:
versionBuildNumberAndCodeName
options
:
NSLiteralSearch
range
:
NSMakeRange
(
0
,
[
htmlContent
length
])];
[
htmlContent
replaceOccurrencesOfString
:
@"TEXTCOLOR"
withString
:
textColor
options
:
NSLiteralSearch
range
:
NSMakeRange
(
0
,
[
htmlContent
length
])];
[
htmlContent
replaceOccurrencesOfString
:
@"BACKGROUNDCOLOR"
withString
:
backgroundColor
options
:
NSLiteralSearch
range
:
NSMakeRange
(
0
,
[
htmlContent
length
])];
[
htmlContent
replaceOccurrencesOfString
:
@"MOBILEVLCKITVERSION"
withString
:
vlcLibraryVersion
options
:
NSLiteralSearch
range
:
NSMakeRange
(
0
,
[
htmlContent
length
])];
[
_webView
loadHTMLString
:
htmlContent
baseURL
:[
NSURL
fileURLWithPath
:[
mainBundle
bundlePath
]]];
}
-
(
void
)
themeDidChange
{
self
.
view
.
backgroundColor
=
PresentationTheme
.
current
.
colors
.
background
;
_webView
.
backgroundColor
=
PresentationTheme
.
current
.
colors
.
background
;
[
self
loadWebContent
];
}
-
(
BOOL
)
shouldAutorotate
...
...
@@ -77,7 +98,7 @@
-
(
void
)
webViewDidFinishLoad
:(
UIWebView
*
)
webView
{
_webView
.
backgroundColor
=
[
UIColor
VLCDarkB
ackground
Color
]
;
_webView
.
backgroundColor
=
PresentationTheme
.
current
.
colors
.
b
ackground
;
_webView
.
opaque
=
YES
;
}
...
...
Sources/VLCPlaybackController.h
View file @
202bf9df
...
...
@@ -12,7 +12,7 @@
*****************************************************************************/
#import "VLCEqualizerView.h"
#import <MobileVLCKit/MobileVLCKit.h>
extern
NSString
*
const
VLCPlaybackControllerPlaybackDidStart
;
extern
NSString
*
const
VLCPlaybackControllerPlaybackDidPause
;
extern
NSString
*
const
VLCPlaybackControllerPlaybackDidResume
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment