Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

4.4 fixes

  • Loading branch information...
commit 708c355f676a8fd45bb23f826a4bffc53ba96ef1 1 parent 0e33b26
tomcool420 authored

Showing 1 changed file with 51 additions and 8 deletions. Show diff stats Hide diff stats

  1. +51 8 SMFBookcaseController.m
59 SMFBookcaseController.m
@@ -8,7 +8,8 @@
8 8 #import "SMFBookcaseController.h"
9 9 #import "SMFDefines.h"
10 10 #import "SMFThemeInfo.h"
11   -#import <Backrow/BRThemeInfo.h>
  11 +#import "Backrow/BRThemeInfo.h"
  12 +#import "SMFramework.h"
12 13
13 14 @interface SMFBookcaseController (private)
14 15 - (void)selectEventOccured;
@@ -22,6 +23,7 @@ -(id)init {
22 23 if ((self = [super init])) {
23 24 _shelfControls = [[NSMutableArray alloc] init];
24 25 _shelfTitles = [[NSMutableArray alloc] init];
  26 + _shelfAdapters=[[NSMutableArray alloc]init];
25 27 }
26 28 return self;
27 29 }
@@ -32,6 +34,8 @@ -(void)dealloc {
32 34 [_shelfControls release];
33 35 [_shelfTitles release];
34 36 [_panelControl release];
  37 + [_shelfAdapters release];
  38 + _shelfAdapters=nil;
35 39
36 40 [super dealloc];
37 41 }
@@ -45,9 +49,11 @@ -(void)controlWasActivated {
45 49 }
46 50
47 51 - (void)rebuildBookcase {
  52 +
48 53 [self _removeAllControls];
49 54 [_shelfControls removeAllObjects];
50 55 [_shelfTitles removeAllObjects];
  56 + [_shelfAdapters removeAllObjects];
51 57
52 58 numberOfShelfControls = [self.datasource numberOfShelfsInBookcaseController:self];
53 59 if (numberOfShelfControls < 1) {
@@ -117,15 +123,37 @@ - (void)rebuildBookcase {
117 123 if (title) [dividerLine setLabel:title withAttributes:[[BRThemeInfo sharedTheme] boxTitleAttributesForRelated:NO]];
118 124
119 125 //============================ SHELF ============================
120   - BRMediaShelfControl *shelfControl = [[BRMediaShelfControl alloc] init];
121   - [shelfControl setProvider:[self.datasource bookcaseController:self datastoreProviderForShelfAtIndex:i]];
  126 + BRMediaShelfView * shelfControl;
  127 + if ([SMF_COMPAT usingFourPointFourPlus]) {
  128 + shelfControl=[[BRMediaShelfView alloc]init];
  129 + BRProviderDataSourceAdapter * adap = [[NSClassFromString(@"BRProviderDataSourceAdapter") alloc] init];
  130 + [adap setProviders:[NSArray arrayWithObject:[self.datasource bookcaseController:self datastoreProviderForShelfAtIndex:i]]];
  131 + [shelfControl setDelegate:adap];
  132 + [shelfControl setDataSource:adap];
  133 + [_shelfAdapters addObject:adap];
  134 + [adap release];
  135 + //[adap autorelease];
  136 +
  137 + }
  138 + else
  139 + {
  140 + shelfControl=[[NSClassFromString(@"BRMediaShelfControl") alloc] init];
  141 + [(id)shelfControl setProvider:[self.datasource bookcaseController:self datastoreProviderForShelfAtIndex:i]];
  142 + }
  143 +
122 144 CGRect shelfFrame = shelfControl.frame;
123 145 shelfFrame.size.height = 215.0f;
124 146 [shelfControl setColumnCount:7];
125 147 [shelfControl setCentered:NO];
126 148 [shelfControl setHorizontalGap:23];
127 149 [shelfControl setCoverflowMargin:0.05000000074505806f];
  150 +// [shelfControl _forceDisplayTimerFired:nil];
  151 + [shelfControl loadWithCompletionBlock:nil];
  152 +// [shelfControl _loadControlsInRange:NSMakeRange(0, 3)];
  153 +// [shelfControl _loadControlWithStartIndex:0 start:YES];
  154 +// [shelfControl visibleScrollRectChanged];
128 155 [_shelfControls addObject:shelfControl];
  156 +
129 157
130 158
131 159 //============================ SHELF BOX ============================
@@ -145,6 +173,7 @@ - (void)rebuildBookcase {
145 173 [shelfBox release];
146 174 [shelfControl release];
147 175 [dividerLine release];
  176 + NSLog(@"end shelf box");
148 177 }
149 178
150 179 //============================ BOTTOM SPACER ============================
@@ -169,6 +198,7 @@ - (void)rebuildBookcase {
169 198 [_scrollControl release];
170 199
171 200 [self layoutSubcontrols];
  201 +
172 202 }
173 203
174 204 - (void)refreshShelves {
@@ -178,10 +208,12 @@ - (void)refreshShelves {
178 208 }
179 209
180 210 - (void)refreshShelfAtIndex:(NSInteger)index {
  211 +
181 212 if (index < [_shelfControls count] && index >= 0) {
182   - BRMediaShelfControl *shelfControl = [_shelfControls objectAtIndex:index];
  213 + id shelfControl = [_shelfControls objectAtIndex:index];
183 214 [shelfControl reloadData];
184 215 }
  216 +
185 217 }
186 218
187 219 -(BOOL)brEventAction:(BREvent *)action {
@@ -197,13 +229,23 @@ -(BOOL)brEventAction:(BREvent *)action {
197 229
198 230 //private
199 231 - (void)selectEventOccured {
  232 +
200 233 if (self.delegate) {
201   - BRMediaShelfControl *focusedShelf = nil;
  234 + BRMediaShelfView *focusedShelf = nil;
202 235 id focusedBox = [_panelControl focusedControl];
203 236 id currentFocusedControl = [focusedBox focusedControl];
204   - if (currentFocusedControl && [currentFocusedControl isKindOfClass:[BRMediaShelfControl class]]) {
205   - focusedShelf = (BRMediaShelfControl *)currentFocusedControl;
206   - }
  237 + if ([SMF_COMPAT usingFourPointFourPlus]) {
  238 + if (currentFocusedControl && [currentFocusedControl isKindOfClass:[BRMediaShelfView class]]) {
  239 + focusedShelf = (BRMediaShelfView *)currentFocusedControl;
  240 + }
  241 + }
  242 + else
  243 + {
  244 + if (currentFocusedControl && [currentFocusedControl isKindOfClass:[NSClassFromString(@"BRMediaShelfControl") class]]) {
  245 + focusedShelf = currentFocusedControl;
  246 + }
  247 + }
  248 +
207 249 if (focusedShelf) {
208 250 int shelfIndex = [_shelfControls indexOfObject:focusedShelf];
209 251 if ([self.delegate bookcaseController:self allowSelectionForShelf:focusedShelf atIndex:shelfIndex]) {
@@ -220,6 +262,7 @@ - (void)selectEventOccured {
220 262 }
221 263 }
222 264 }
  265 +
223 266 }
224 267
225 268 @end

0 comments on commit 708c355

Please sign in to comment.
Something went wrong with that request. Please try again.