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
VideoLAN
VLC-iOS
Commits
4c9e8560
Commit
4c9e8560
authored
May 24, 2017
by
Soomin Lee
Committed by
Jean-Baptiste Kempf
May 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iOS: Add cancel and confirm button to sleep timer feature
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
25cdd71f
Pipeline
#73
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
Sources/VLCMovieViewController.m
Sources/VLCMovieViewController.m
+43
-0
No files found.
Sources/VLCMovieViewController.m
View file @
4c9e8560
...
...
@@ -553,6 +553,15 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_sleepTimerContainer
.
layer
.
cornerRadius
=
5
;
_sleepTimerContainer
.
autoresizingMask
=
UIViewAutoresizingFlexibleRightMargin
|
UIViewAutoresizingFlexibleLeftMargin
|
UIViewAutoresizingFlexibleBottomMargin
|
UIViewAutoresizingFlexibleTopMargin
;
//Layers used to create a separator for the buttons.
CALayer
*
horizontalSeparator
=
[
CALayer
layer
];
horizontalSeparator
.
frame
=
CGRectMake
(
0
.,
162
.,
300
.,
1
.);
horizontalSeparator
.
backgroundColor
=
[
UIColor
VLCLightTextColor
].
CGColor
;
CALayer
*
verticalSeparator
=
[
CALayer
layer
];
verticalSeparator
.
frame
=
CGRectMake
(
150
.,
162
.,
1
.,
48
.);
verticalSeparator
.
backgroundColor
=
[
UIColor
VLCLightTextColor
].
CGColor
;
_sleepTimeDatePicker
=
[[
UIDatePicker
alloc
]
init
];
if
(
deviceSpeedCategory
>=
3
)
{
_sleepTimeDatePicker
.
opaque
=
NO
;
...
...
@@ -564,6 +573,26 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_sleepTimeDatePicker
.
autoresizingMask
=
UIViewAutoresizingFlexibleRightMargin
|
UIViewAutoresizingFlexibleLeftMargin
|
UIViewAutoresizingFlexibleBottomMargin
|
UIViewAutoresizingFlexibleTopMargin
;
[
_sleepTimerContainer
addSubview
:
_sleepTimeDatePicker
];
[
_sleepTimerContainer
.
layer
addSublayer
:
horizontalSeparator
];
[
_sleepTimerContainer
.
layer
addSublayer
:
verticalSeparator
];
UIButton
*
cancelSleepTimer
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
0
.,
162
.,
150
.,
48
.)];
cancelSleepTimer
.
backgroundColor
=
[
UIColor
clearColor
];
[
cancelSleepTimer
setTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
forState
:
UIControlStateNormal
];
[
cancelSleepTimer
setTintColor
:[
UIColor
VLCLightTextColor
]];
[
cancelSleepTimer
setTitleColor
:[
UIColor
VLCDarkTextShadowColor
]
forState
:
UIControlStateHighlighted
];
[
cancelSleepTimer
addTarget
:
self
action
:
@selector
(
sleepTimerCancel
:
)
forControlEvents
:
UIControlEventTouchDown
];
cancelSleepTimer
.
contentEdgeInsets
=
UIEdgeInsetsMake
(
0
,
0
,
10
,
0
);
[
_sleepTimerContainer
addSubview
:
cancelSleepTimer
];
UIButton
*
confirmSleepTimer
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
150
.,
162
.,
150
.,
48
.)];
confirmSleepTimer
.
backgroundColor
=
[
UIColor
clearColor
];
[
confirmSleepTimer
setTitle
:
NSLocalizedString
(
@"BUTTON_DONE"
,
nil
)
forState
:
UIControlStateNormal
];
[
confirmSleepTimer
setTintColor
:[
UIColor
VLCLightTextColor
]];
[
confirmSleepTimer
setTitleColor
:[
UIColor
VLCDarkTextShadowColor
]
forState
:
UIControlStateHighlighted
];
[
confirmSleepTimer
addTarget
:
self
action
:
@selector
(
sleepTimerAction
:
)
forControlEvents
:
UIControlEventTouchDown
];
confirmSleepTimer
.
contentEdgeInsets
=
UIEdgeInsetsMake
(
0
,
0
,
10
,
0
);
[
_sleepTimerContainer
addSubview
:
confirmSleepTimer
];
/* adapt the date picker style to suit our needs */
[
_sleepTimeDatePicker
setValue
:[
UIColor
whiteColor
]
forKeyPath
:
@"textColor"
];
...
...
@@ -1093,6 +1122,18 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
_sleepTimerContainer
.
hidden
=
NO
;
}
-
(
IBAction
)
sleepTimerCancel
:(
id
)
sender
{
NSTimer
*
sleepTimer
=
[
_vpc
sleepTimer
];
if
(
sleepTimer
)
{
[
sleepTimer
invalidate
];
sleepTimer
=
nil
;
}
[
self
.
statusLabel
showStatusMessage
:
NSLocalizedString
(
@"SLEEP_TIMER_UPDATED"
,
nil
)];
[
self
setControlsHidden
:
YES
animated
:
YES
];
}
-
(
IBAction
)
sleepTimerAction
:(
id
)
sender
{
[
_vpc
scheduleSleepTimerWithInterval
:
_sleepTimeDatePicker
.
countDownDuration
];
...
...
@@ -1104,6 +1145,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
userInfo:
nil
repeats:
YES
];
}
[
self
.
statusLabel
showStatusMessage
:
NSLocalizedString
(
@"SLEEP_TIMER_UPDATED"
,
nil
)];
[
self
setControlsHidden
:
YES
animated
:
YES
];
}
-
(
void
)
moreActions
:(
UIButton
*
)
sender
...
...
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