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
fb5a8ee8
Commit
fb5a8ee8
authored
Dec 25, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
library: implement multi-file deletion and file renaming for the Pad UI
parent
05a052cb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
63 deletions
+70
-63
NEWS
NEWS
+2
-0
Resources/VLCFuturePlaylistCollectionViewCell.xib
Resources/VLCFuturePlaylistCollectionViewCell.xib
+6
-17
Resources/VLCPlaylistCollectionViewCell.xib
Resources/VLCPlaylistCollectionViewCell.xib
+5
-16
Resources/en.lproj/Localizable.strings
Resources/en.lproj/Localizable.strings
+0
-0
Sources/VLCPlaylistCollectionViewCell.h
Sources/VLCPlaylistCollectionViewCell.h
+2
-1
Sources/VLCPlaylistCollectionViewCell.m
Sources/VLCPlaylistCollectionViewCell.m
+9
-23
Sources/VLCPlaylistViewController.m
Sources/VLCPlaylistViewController.m
+46
-6
No files found.
NEWS
View file @
fb5a8ee8
...
...
@@ -25,6 +25,8 @@ Interface:
* Added option to disable file name display optimizations (#10050)
* TV Shows are sorted by Season number / Episode number and Music Albums
respectively by track number
* Added ability to rename any media item in the library view
* Added deletion of multiple media items in one step
* New translations to Czech, Malay, Persian, Spanish (Mexico)
Cloud interaction:
...
...
Resources/VLCFuturePlaylistCollectionViewCell.xib
View file @
fb5a8ee8
...
...
@@ -24,21 +24,6 @@
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"341"
height=
"190"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
</imageView>
<button
hidden=
"YES"
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"37"
userLabel=
"Delete button"
>
<rect
key=
"frame"
x=
"307"
y=
"4"
width=
"33"
height=
"29"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
size=
"button"
/>
<state
key=
"normal"
image=
"DeleteButton.png"
>
<color
key=
"titleColor"
red=
"0.1960784314"
green=
"0.30980392159999998"
blue=
"0.52156862749999999"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"titleShadowColor"
white=
"0.5"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</state>
<state
key=
"highlighted"
>
<color
key=
"titleColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</state>
<connections>
<action
selector=
"removeMedia:"
destination=
"2"
eventType=
"touchUpInside"
id=
"48"
/>
</connections>
</button>
<label
opaque=
"NO"
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"left"
text=
"Title"
lineBreakMode=
"wordWrap"
baselineAdjustment=
"none"
minimumFontSize=
"9"
adjustsLetterSpacingToFitWidth=
"YES"
id=
"4XD-oC-pqG"
>
<rect
key=
"frame"
x=
"10"
y=
"141"
width=
"321"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMinY=
"YES"
/>
...
...
@@ -55,6 +40,10 @@
<color
key=
"highlightedColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<size
key=
"shadowOffset"
width=
"0.0"
height=
"0.0"
/>
</label>
<imageView
hidden=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"checkboxEmpty.png"
id=
"pl6-iw-2ZI"
>
<rect
key=
"frame"
x=
"6"
y=
"6"
width=
"25"
height=
"25"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
<label
opaque=
"NO"
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"left"
text=
"Subtitle — Subtitle"
lineBreakMode=
"wordWrap"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
id=
"jdp-lJ-hIF"
>
<rect
key=
"frame"
x=
"10"
y=
"166"
width=
"293"
height=
"15"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMinY=
"YES"
/>
...
...
@@ -68,8 +57,8 @@
</view>
<size
key=
"customSize"
width=
"298"
height=
"167"
/>
<connections>
<outlet
property=
"isSelectedView"
destination=
"pl6-iw-2ZI"
id=
"1sX-gh-yiU"
/>
<outlet
property=
"mediaIsUnreadView"
destination=
"ftR-Og-FOs"
id=
"5aH-vE-E37"
/>
<outlet
property=
"removeMediaButton"
destination=
"37"
id=
"43"
/>
<outlet
property=
"subtitleLabel"
destination=
"jdp-lJ-hIF"
id=
"YUa-G7-CMl"
/>
<outlet
property=
"thumbnailView"
destination=
"31"
id=
"46"
/>
<outlet
property=
"titleLabel"
destination=
"4XD-oC-pqG"
id=
"Te1-JA-An0"
/>
...
...
@@ -77,7 +66,7 @@
</collectionViewCell>
</objects>
<resources>
<image
name=
"
DeleteButton
.png"
width=
"2
9
"
height=
"2
9
"
/>
<image
name=
"
checkboxEmpty
.png"
width=
"2
5
"
height=
"2
5
"
/>
<image
name=
"gradient-cell-ios7-ipad.png"
width=
"2"
height=
"190"
/>
</resources>
</document>
Resources/VLCPlaylistCollectionViewCell.xib
View file @
fb5a8ee8
...
...
@@ -56,21 +56,10 @@
<rect
key=
"frame"
x=
"16"
y=
"9"
width=
"266"
height=
"154"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
</imageView>
<
button
hidden=
"YES"
opaque
=
"NO"
contentMode=
"scaleToFill"
contentH
orizontal
Alignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"37"
userLabel=
"Delete button
"
>
<rect
key=
"frame"
x=
"
260
"
y=
"
2
"
width=
"
33
"
height=
"2
9
"
/>
<
imageView
hidden=
"YES"
userInteractionEnabled
=
"NO"
contentMode=
"scaleToFill"
h
orizontal
HuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"checkboxEmpty.png"
id=
"0Jc-2h-HQ9
"
>
<rect
key=
"frame"
x=
"
8
"
y=
"
1
"
width=
"
25
"
height=
"2
5
"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
size=
"button"
/>
<state
key=
"normal"
image=
"DeleteButton.png"
>
<color
key=
"titleColor"
red=
"0.1960784314"
green=
"0.30980392159999998"
blue=
"0.52156862749999999"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"titleShadowColor"
white=
"0.5"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</state>
<state
key=
"highlighted"
>
<color
key=
"titleColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</state>
<connections>
<action
selector=
"removeMedia:"
destination=
"2"
eventType=
"touchUpInside"
id=
"48"
/>
</connections>
</button>
</imageView>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
image=
"badgeUnread.png"
id=
"38"
>
<rect
key=
"frame"
x=
"235"
y=
"12"
width=
"44"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMinY=
"YES"
flexibleMaxY=
"YES"
/>
...
...
@@ -79,9 +68,9 @@
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
</view>
<connections>
<outlet
property=
"isSelectedView"
destination=
"0Jc-2h-HQ9"
id=
"I7k-1Q-y1G"
/>
<outlet
property=
"mediaIsUnreadView"
destination=
"38"
id=
"41"
/>
<outlet
property=
"progressView"
destination=
"35"
id=
"42"
/>
<outlet
property=
"removeMediaButton"
destination=
"37"
id=
"43"
/>
<outlet
property=
"seriesNameLabel"
destination=
"34"
id=
"44"
/>
<outlet
property=
"subtitleLabel"
destination=
"33"
id=
"45"
/>
<outlet
property=
"thumbnailView"
destination=
"31"
id=
"46"
/>
...
...
@@ -90,8 +79,8 @@
</collectionViewCell>
</objects>
<resources>
<image
name=
"DeleteButton.png"
width=
"29"
height=
"29"
/>
<image
name=
"badgeUnread.png"
width=
"44"
height=
"44"
/>
<image
name=
"checkboxEmpty.png"
width=
"25"
height=
"25"
/>
<image
name=
"thumbOverlay.png"
width=
"266"
height=
"154"
/>
</resources>
</document>
Resources/en.lproj/Localizable.strings
View file @
fb5a8ee8
B
"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
...
...
Sources/VLCPlaylistCollectionViewCell.h
View file @
fb5a8ee8
...
...
@@ -21,15 +21,16 @@
@property
(
nonatomic
,
strong
)
IBOutlet
UILabel
*
subtitleLabel
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIImageView
*
thumbnailView
;
@property
(
nonatomic
,
strong
)
IBOutlet
VLCLinearProgressIndicator
*
progressView
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
removeMediaButton
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIView
*
mediaIsUnreadView
;
@property
(
nonatomic
,
strong
)
IBOutlet
UILabel
*
seriesNameLabel
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIImageView
*
isSelectedView
;
@property
(
nonatomic
,
retain
)
MLFile
*
mediaObject
;
@property
(
nonatomic
,
weak
)
UICollectionView
*
collectionView
;
-
(
void
)
setEditing
:(
BOOL
)
editing
animated
:(
BOOL
)
animated
;
-
(
void
)
selectionUpdate
;
-
(
IBAction
)
removeMedia
:(
id
)
sender
;
@end
Sources/VLCPlaylistCollectionViewCell.m
View file @
fb5a8ee8
...
...
@@ -20,10 +20,18 @@
-
(
void
)
setEditing
:(
BOOL
)
editing
animated
:(
BOOL
)
animated
{
self
.
removeMediaButton
.
hidden
=
!
editing
;
self
.
isSelectedView
.
hidden
=
!
editing
;
[
self
_updatedDisplayedInformationForKeyPath
:
@"editing"
];
}
-
(
void
)
selectionUpdate
{
if
(
self
.
selected
)
self
.
isSelectedView
.
image
=
[
UIImage
imageNamed
:
@"checkbox"
];
else
self
.
isSelectedView
.
image
=
[
UIImage
imageNamed
:
@"checkboxEmpty"
];
}
-
(
void
)
observeValueForKeyPath
:(
NSString
*
)
keyPath
ofObject
:(
id
)
object
change
:(
NSDictionary
*
)
change
context
:(
void
*
)
context
{
[
self
_updatedDisplayedInformationForKeyPath
:
keyPath
];
...
...
@@ -112,28 +120,6 @@
[
self
setNeedsDisplay
];
}
-
(
IBAction
)
removeMedia
:(
id
)
sender
{
NSString
*
title
;
id
mediaObject
=
self
.
mediaObject
;
if
([
mediaObject
isKindOfClass
:[
MLAlbum
class
]]
||
[
mediaObject
isKindOfClass
:[
MLShowEpisode
class
]]
||
[
mediaObject
isKindOfClass
:[
MLShow
class
]])
title
=
[
mediaObject
name
];
else
title
=
[
mediaObject
title
];
/* ask user if s/he really wants to delete the media file */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DELETE_FILE"
,
@""
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DELETE_FILE_LONG"
,
@""
),
title
]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_DELETE"
,
@""
),
nil
];
[
alert
show
];
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
{
VLCPlaylistViewController
*
delegate
=
(
VLCPlaylistViewController
*
)
self
.
collectionView
.
delegate
;
[
delegate
removeMediaObject
:
self
.
mediaObject
updateDatabase
:
YES
];
}
}
#pragma mark - presentation
-
(
void
)
_configureForShow
:(
MLShow
*
)
show
...
...
Sources/VLCPlaylistViewController.m
View file @
fb5a8ee8
...
...
@@ -496,10 +496,20 @@
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
self
.
editing
)
{
[(
VLCPlaylistCollectionViewCell
*
)[
collectionView
cellForItemAtIndexPath
:
indexPath
]
selectionUpdate
];
return
;
}
NSManagedObject
*
selectedObject
=
_foundMedia
[
indexPath
.
row
];
[
self
openMediaObject
:
selectedObject
];
}
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didDeselectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
[(
VLCPlaylistCollectionViewCell
*
)[
collectionView
cellForItemAtIndexPath
:
indexPath
]
selectionUpdate
];
}
#pragma mark - UI implementation
-
(
void
)
setEditing
:(
BOOL
)
editing
animated
:(
BOOL
)
animated
{
...
...
@@ -526,12 +536,23 @@
[
aCell
setEditing
:
editing
animated
:
animated
];
}];
self
.
collectionView
.
allowsMultipleSelection
=
editing
;
/* UIKit doesn't clear the selection automagically if we leave the editing mode
* so we need to do so manually */
if
(
!
editing
)
{
NSArray
*
selectedItems
=
[
self
.
collectionView
indexPathsForSelectedItems
];
NSUInteger
count
=
selectedItems
.
count
;
for
(
NSUInteger
x
=
0
;
x
<
count
;
x
++
)
[
self
.
collectionView
deselectItemAtIndexPath
:
selectedItems
[
x
]
animated
:
NO
];
}
}
else
{
self
.
navigationController
.
toolbarHidden
=
!
editing
;
self
.
tableView
.
allowsMultipleSelectionDuringEditing
=
editing
;
[
self
.
tableView
setEditing
:
editing
animated
:
YES
];
[
self
.
editButtonItem
setTitle
:
editing
?
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
:
NSLocalizedString
(
@"BUTTON_EDIT"
,
@""
)];
}
self
.
navigationController
.
toolbarHidden
=
!
editing
;
}
-
(
UITableViewCellEditingStyle
)
tableView
:(
UITableView
*
)
aTableView
editingStyleForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
...
...
@@ -563,7 +584,11 @@
-
(
void
)
deleteSelection
{
NSArray
*
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
NSArray
*
indexPaths
;
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
indexPaths
=
[
self
.
collectionView
indexPathsForSelectedItems
];
else
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
NSUInteger
count
=
indexPaths
.
count
;
NSMutableArray
*
objects
=
[[
NSMutableArray
alloc
]
initWithCapacity
:
count
];
...
...
@@ -578,14 +603,22 @@
-
(
void
)
renameSelection
{
NSArray
*
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
NSArray
*
indexPaths
;
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
indexPaths
=
[
self
.
collectionView
indexPathsForSelectedItems
];
else
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
if
(
indexPaths
.
count
<
1
)
{
[
self
_endEditing
];
return
;
}
NSString
*
itemName
=
[(
VLCPlaylistTableViewCell
*
)[
self
.
tableView
cellForRowAtIndexPath
:
indexPaths
[
0
]]
titleLabel
].
text
;
NSString
*
itemName
;
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
itemName
=
[(
VLCPlaylistCollectionViewCell
*
)[
self
.
collectionView
cellForItemAtIndexPath
:
indexPaths
[
0
]]
titleLabel
].
text
;
else
itemName
=
[(
VLCPlaylistTableViewCell
*
)[
self
.
tableView
cellForRowAtIndexPath
:
indexPaths
[
0
]]
titleLabel
].
text
;
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"RENAME_MEDIA_TO"
,
@""
),
itemName
]
message
:
nil
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_RENAME"
,
@""
),
nil
];
[
alert
setAlertViewStyle
:
UIAlertViewStylePlainTextInput
];
[[
alert
textFieldAtIndex
:
0
]
setText
:
itemName
];
...
...
@@ -594,7 +627,11 @@
-
(
void
)
renameMediaObjectTo
:(
NSString
*
)
newName
{
NSArray
*
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
NSArray
*
indexPaths
;
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
indexPaths
=
[
self
.
collectionView
indexPathsForSelectedItems
];
else
indexPaths
=
[
self
.
tableView
indexPathsForSelectedRows
];
id
mediaObject
=
_foundMedia
[[
indexPaths
[
0
]
row
]];
if
([
mediaObject
isKindOfClass
:[
MLAlbum
class
]]
||
[
mediaObject
isKindOfClass
:[
MLShowEpisode
class
]]
||
[
mediaObject
isKindOfClass
:[
MLShow
class
]])
...
...
@@ -602,7 +639,10 @@
else
[
mediaObject
setTitle
:
newName
];
[
self
.
tableView
deselectRowAtIndexPath
:
indexPaths
[
0
]
animated
:
YES
];
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPad
)
[
self
.
collectionView
deselectItemAtIndexPath
:
indexPaths
[
0
]
animated
:
YES
];
else
[
self
.
tableView
deselectRowAtIndexPath
:
indexPaths
[
0
]
animated
:
YES
];
if
(
indexPaths
.
count
>
1
)
[
self
renameSelection
];
...
...
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