Commit b3f240a2 authored by Gleb Pinigin's avatar Gleb Pinigin

Add workaround for not implemented method commitEditingStyle in AQGridView

parent ee11e35b
......@@ -9,6 +9,7 @@
#import "VLCLinearProgressIndicator.h"
#import "AQGridViewCell.h"
@class AQGridView;
@interface VLCPlaylistGridView : AQGridViewCell
@property (nonatomic, strong) IBOutlet UILabel *titleLabel;
......@@ -18,6 +19,9 @@
@property (nonatomic, strong) IBOutlet UIButton *removeMediaButton;
@property (nonatomic, strong) IBOutlet UIImageView *mediaIsUnreadView;
// Temporary workaround: until better solution
@property (nonatomic, weak) AQGridView *gridView;
@property (nonatomic, retain) MLFile *mediaObject;
- (IBAction)removeMedia:(id)sender;
......
......@@ -8,7 +8,6 @@
#import "VLCPlaylistGridView.h"
#import "VLCAppDelegate.h"
#import "VLCPlaylistViewController.h"
@interface VLCPlaylistGridView (Hack)
@property (nonatomic, retain) NSString *reuseIdentifier;
......@@ -89,8 +88,8 @@
- (IBAction)removeMedia:(id)sender
{
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate.playlistViewController removeMediaObject:self.mediaObject];
NSUInteger cellIndex = [self.gridView indexForCell:self];
[self.gridView.delegate gridView:self.gridView commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndex:cellIndex];
}
@end
......@@ -107,7 +107,6 @@
}
}
- (void)updateViewContents
{
[[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
......@@ -186,6 +185,7 @@
if (cell == nil) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"VLCPlaylistGridView" owner:self options:nil] lastObject];
cell.selectionStyle = AQGridViewCellSelectionStyleGlow;
cell.gridView = gridView;
}
cell.mediaObject = _foundMedia[index];
......@@ -210,6 +210,12 @@
[self.navigationController pushViewController:self.movieViewController animated:YES];
}
- (void)gridView:(AQGridView *)aGridView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndex:(NSUInteger)index
{
if (editingStyle == UITableViewCellEditingStyleDelete)
[self removeMediaObject: _foundMedia[index]];
}
#pragma mark - UI implementation
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment