Permalink
Browse files

Added new BRDropShadowControl subclass to make handling the animation…

… easier, most of the SMFDropShadow controllers use the subclass, would've shown it to you before pushing but you fell off the face of the planet
  • Loading branch information...
1 parent 3b93a92 commit 639df513ffaf2aa48c58bed45d549e1a5c44dfd9 Kevin Bradley committed Sep 14, 2011
Showing with 937 additions and 182 deletions.
  1. +5 −4 Makefile
  2. +3 −2 SMFComplexDropShadowControl.h
  3. +14 −11 SMFComplexDropShadowControl.mm
  4. +19 −0 SMFDropShadowControl.h
  5. +139 −0 SMFDropShadowControl.m
  6. +4 −0 SMFListDropShadowControl.h
  7. +110 −3 SMFListDropShadowControl.m
  8. +8 −8 SMFMoviePreviewController.m
  9. +2 −2 SMFPopup.mm
  10. +2 −2 SMFTextDropShadowControl.h
  11. +8 −8 SMFTextDropShadowControl.mm
  12. +8 −0 SMFramework.xcodeproj/project.pbxproj
  13. +2 −2 _/DEBIAN/control
  14. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/BRMenuItem_SMF.h
  15. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFBaseAsset.h
  16. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFCenteredMenuController.h
  17. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFClockController.h
  18. +56 −25 _/Library/Frameworks/SMFramework.framework/Headers/SMFCommonTools.h
  19. +6 −6 _/Library/Frameworks/SMFramework.framework/Headers/SMFController.h
  20. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEvent.h
  21. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEventConfiguration.h
  22. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEventManager.h
  23. +44 −40 _/Library/Frameworks/SMFramework.framework/Headers/SMFFolderBrowser.h
  24. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFFolderDelegate.h
  25. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFInvocationCenteredMenuController.h
  26. +34 −16 _/Library/Frameworks/SMFramework.framework/Headers/SMFMediaMenuController.h
  27. +68 −4 _/Library/Frameworks/SMFramework.framework/Headers/SMFMediaPreview.h
  28. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFMenuController.h
  29. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFMenuItem.h
  30. +61 −5 _/Library/Frameworks/SMFramework.framework/Headers/SMFPasscodeController.h
  31. +110 −13 _/Library/Frameworks/SMFramework.framework/Headers/SMFPhotoMethods.h
  32. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFProgressBarControl.h
  33. +7 −2 _/Library/Frameworks/SMFramework.framework/Headers/SMFQueryMenu.h
  34. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFScreenCapture.h
  35. +196 −12 _/Library/Frameworks/SMFramework.framework/Headers/SMFThemeInfo.h
  36. +16 −2 _/Library/Frameworks/SMFramework.framework/Headers/SMFramework.h
  37. BIN _/Library/Frameworks/SMFramework.framework/SMFramework
  38. BIN _/Library/MobileSubstrate/DynamicLibraries/EventCatcher.dylib
  39. +2 −2 eventcatcher/Makefile
  40. BIN eventcatcher/obj/EventCatcher.dylib
  41. BIN eventcatcher/obj/Tweak.xm.o
  42. BIN obj/BRMenuItem_SMF.m.o
  43. BIN obj/SMFBaseAsset.m.o
  44. BIN obj/SMFCenteredMenuController.m.o
  45. BIN obj/SMFClockController.m.o
  46. BIN obj/SMFEvent.m.o
  47. BIN obj/SMFEventConfiguration.m.o
  48. BIN obj/SMFEventManager.m.o
  49. BIN obj/SMFFolderBrowser.m.o
  50. BIN obj/SMFInvocationCenteredMenuController.m.o
  51. BIN obj/SMFMediaMenuController.m.o
  52. BIN obj/SMFMediaPreview.mm.o
  53. BIN obj/SMFMenuController.m.o
  54. BIN obj/SMFMenuItem.m.o
  55. BIN obj/SMFPasscodeController.m.o
  56. BIN obj/SMFPhotoMethods.mm.o
  57. BIN obj/SMFProgressBarControl.m.o
  58. BIN obj/SMFQueryMenu.m.o
  59. BIN obj/SMFScreenCapture.m.o
  60. BIN obj/SMFThemeInfo.m.o
  61. BIN obj/SMFramework
View
@@ -1,7 +1,7 @@
GO_EASY_ON_ME=1
-SDKVERSION=5.0
-FW_DEVICE_IP=test.local
-#FW_DEVICE_IP=appletv.local
+SDKVERSION=4.3
+#FW_DEVICE_IP=test.local
+FW_DEVICE_IP=appletv.local
first: clean package install
include $(THEOS)/makefiles/common.mk
@@ -16,6 +16,7 @@ SMFramework_FILES += SMFMoviePreviewController.m SMFControlFactory.m SMFAssetPr
SMFramework_FILES += SMFBookcaseController.m SMFComplexDropShadowControl.mm SMFComplexProcessDropShadowControl.m SMFPrefsMenuItem.m
SMFramework_FILES += SMFDictionaryEditor.m SMFDictionaryObjectEditor.m SMFCustomQueryMenu.m SMFPrefsSelectionItem.m
SMFramework_FILES += BRMediaShelfView_SMF.m
+SMFramework_FILES += SMFDropShadowControl.m
SMFramework_FILES += Example/SMFExamples.m Example/SMFMoviePreviewDelegateAndDatasourceExample.m Example/SMFBookcaseDelegateAndDatasourceExample.m Example/SMFGridController.m
@@ -41,4 +42,4 @@ after-SMFramework-stage::
cp *.h "$(FW_SHARED_BUNDLE_RESOURCE_PATH)/Headers/"
rm -rf ../ATV2Includes/SMFramework
mkdir ../ATV2Includes/SMFramework
- cp -rf Headers/ ../ATV2Includes/SMFramework/
+ cp -rf Headers/ ../ATV2Includes/SMFramework/
@@ -8,8 +8,9 @@
#import "Backrow/AppleTV.h"
#import "SMFProgressBarControl.h"
+#import "SMFDropShadowControl.h"
-@interface SMFComplexDropShadowControl : BRDropShadowControl {
+@interface SMFComplexDropShadowControl : SMFDropShadowControl {
BRControl *_bg;
BRScrollingTextBoxControl *_scrolling;
BRWaitSpinnerControl *_spinner;
@@ -35,7 +36,7 @@
@property(readwrite,assign)NSObject *delegate;
-(void)appendToText:(NSString *)t;
--(void)addToController:(BRController *)ctrl;
+ //-(void)addToController:(BRController *)ctrl;
-(void)setShowsProgressBar:(BOOL)shows;
-(void)setShowsWaitSpinner:(BOOL)spinner;
@@ -30,34 +30,37 @@ -(id)init
self.backgroundColor=[[SMFThemeInfo sharedTheme]blackColor];
self.borderColor=[[SMFThemeInfo sharedTheme] whiteColor];
self.borderWidth=3.0;
- self.title=@"Installing SMFramework";
+ self.title=@" ";
self.subtitle=@" ";
[self setContent:_bg];
_text=[[NSMutableString alloc] initWithString:@" "];
[self addObserver:self forKeyPath:@"title" options:0 context:nil];
[self addObserver:self forKeyPath:@"subtitle" options:0 context:nil];
return self;
}
--(void)addToController:(BRController *)ctrl
-{
- CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
- [self setFrame:f];
- [ctrl addControl:self];
- [ctrl setFocusedControl:self];
- [ctrl _setFocus:self];
+ //this is taken care of by the superclass now
-}
+//-(void)addToController:(BRController *)ctrl
+//{
+//
+// CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
+// [self setFrame:f];
+// [ctrl addControl:self];
+// [ctrl setFocusedControl:self];
+// [ctrl _setFocus:self];
+//
+//}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)o change:(NSDictionary *)change context:(void *)context
{
if (o==self && [keyPath isEqualToString:@"title"]) {
- NSLog(@"changing title");
+ // NSLog(@"changing title");
[_titleControl setTitle:_title];
[_titleControl layoutSubcontrols];
}
else if(o==self && [keyPath isEqualToString:@"subtitle"])
{
- NSLog(@"changing subtitle");
+ // NSLog(@"changing subtitle");
[_titleControl setTitleSubtext:_subtitle];
[_titleControl layoutSubcontrols];
}
@@ -0,0 +1,19 @@
+//
+// SMFDropShadowControl.h
+// SMFramework
+//
+// Created by Kevin Bradley on 9/13/11.
+// Copyright 2011 nito, LLC. All rights reserved.
+//
+
+#import "Backrow/AppleTV.h"
+
+
+@interface SMFDropShadowControl : BRDropShadowControl {
+
+ BOOL isAnimated;
+
+}
+
+@property (readwrite, assign) BOOL isAnimated;
+@end
View
@@ -0,0 +1,139 @@
+//
+// SMFDropShadowControl.m
+// SMFramework
+//
+// Created by Kevin Bradley on 9/13/11.
+// Copyright 2011 nito, LLC. All rights reserved.
+//
+
+#import "SMFDropShadowControl.h"
+
+
+@implementation SMFDropShadowControl
+
+@synthesize isAnimated;
+
+-(id)init
+{
+ self =[super init];
+ if (self!=nil) {
+
+ self.isAnimated = TRUE; //up to you, can be false by default if you dont like it
+
+ }
+ return self;
+}
+
+
+- (CAAnimationGroup *)zoomOutFadedAnimation:(CATransform3D)zoomTransform
+{
+ CAAnimationGroup *outAnimation = [CAAnimationGroup animation];
+ [outAnimation setAnimations:[NSArray arrayWithObjects:[self zoomOutAnimation:zoomTransform], [self fadeOutAnimation], nil]];
+ outAnimation.duration = .25;
+ outAnimation.fillMode = kCAFillModeForwards; //if you dont set this it reverts to its old mode before removing and looks really stupid.
+ outAnimation.removedOnCompletion = NO;
+ return outAnimation;
+
+}
+
+- (CABasicAnimation *)fadeOutAnimation
+{
+ CABasicAnimation *theAnimation =[CABasicAnimation animationWithKeyPath:@"opacity"];
+ theAnimation.duration=.25;
+ theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
+ theAnimation.toValue=[NSNumber numberWithFloat:0.0];
+ return theAnimation;
+}
+
+- (CABasicAnimation *)zoomOutAnimation:(CATransform3D)zoomTransform
+{
+
+ CABasicAnimation *zoomOutAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ //[zoomOutAnimation setDelegate:self];
+ zoomOutAnimation.beginTime = 0;
+ zoomOutAnimation.repeatCount = 0;
+ zoomOutAnimation.timeOffset = 1;
+ zoomOutAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
+ zoomOutAnimation.toValue = [NSValue valueWithCATransform3D:zoomTransform];
+ zoomOutAnimation.duration = 0.25f;
+ zoomOutAnimation.fillMode = kCAFillModeForwards;
+ zoomOutAnimation.removedOnCompletion = NO;
+ return zoomOutAnimation;
+
+}
+
+- (CABasicAnimation *)zoomInAnimation:(CATransform3D)zoomTransform
+{
+
+ CABasicAnimation *zoomInAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ zoomInAnimation.beginTime = 0;
+ zoomInAnimation.fromValue = [NSValue valueWithCATransform3D:zoomTransform];
+ zoomInAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
+ zoomInAnimation.duration = 0.25f;
+ return zoomInAnimation;
+
+}
+
+
+- (void)removeFromParent
+{
+ if (self.isAnimated == TRUE)
+ {
+ CATransform3D zoomTransform = CATransform3DMakeScale(0.1, 0.1, 1.0);
+ CAAnimationGroup *zoomOutAnimation = [self zoomOutFadedAnimation:zoomTransform];
+ [zoomOutAnimation setDelegate:self];
+ [zoomOutAnimation setValue:@"removeFromParent" forKey:@"Name"];
+ [self addAnimation:zoomOutAnimation forKey:@"removeFromParent"];
+
+ } else {
+
+
+ [super removeFromParent];
+ }
+
+}
+
+-(void)addToController:(BRController *)ctrl
+{
+ CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
+ [self setFrame:f];
+
+ if (self.isAnimated == TRUE)
+ {
+ CATransform3D zoomTransform = CATransform3DMakeScale(0.1, 0.1, 1.0);
+ CABasicAnimation *zoomInAnimation = [self zoomInAnimation:zoomTransform];
+ [zoomInAnimation setValue:@"zoomInAnimation" forKey:@"Name"];
+ [zoomInAnimation setDelegate:self];
+ [self addAnimation:zoomInAnimation forKey:@"zoomInAnimation"];
+
+ }
+
+ [ctrl addControl:self];
+ [ctrl setFocusedControl:self];
+ [ctrl _setFocus:self];
+}
+
+
+- (void)animationDidStart:(CAAnimation *)anim
+{
+
+ //NSLog(@"animationDidStart: %@", anim);
+}
+
+- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
+{
+
+ NSString *animationName = [anim valueForKey:@"Name"];
+
+ if ([animationName isEqualToString:@"removeFromParent"])
+ {
+
+ [super removeFromParent];
+ }
+ [self removeAnimationForKey:animationName];
+
+}
+
+
+
+@end
@@ -31,6 +31,7 @@
NSObject<SMFListDropShadowDelegate> * cDelegate;
NSObject<SMFListDropShadowDatasource>* cDatasource;
BRListControl *list;
+ BOOL isAnimated;
}
/*
* Simply calls [list reload]
@@ -50,7 +51,10 @@
* To remove it: you can call: -(void)removeFromParent
*/
-(void)addToController:(BRController *)ctrl;
+- (CABasicAnimation *)zoomOutAnimation:(CATransform3D)zoomTransform;
+- (CABasicAnimation *)zoomInAnimation:(CATransform3D)zoomTransform;
@property (retain) NSObject<SMFListDropShadowDelegate>* cDelegate;
@property (retain) NSObject<SMFListDropShadowDatasource>* cDatasource;
@property (retain) BRListControl *list;
+@property (readwrite, assign) BOOL isAnimated;
@end
Oops, something went wrong.

0 comments on commit 639df51

Please sign in to comment.