motion-floating-action-button 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -1
- data/lib/motion-floating-action-button/motion-floating-action-button.rb +42 -1
- data/resources/plus.png +0 -0
- data/vendor/motion-floating-action-button/VCFloatingActionButton.h +26 -2
- data/vendor/motion-floating-action-button/VCFloatingActionButton.m +76 -9
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/VCFloatingActionButton.m.o +0 -0
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/libmotion-floating-action-button.a +0 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21f77174714fce7c67752d5b3dfad72ea42f2123
|
4
|
+
data.tar.gz: d10f0b0ed15dd568fe61dfc284fe06d81a0c5dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d503b15e9d35bad03375d7827b89bd9ce9ce79dc3735e3b946cc1c75818a963e982ca2961cb74ab31b0535676b0b58c1000447b46f694ac09fdd049c84626e2
|
7
|
+
data.tar.gz: cfe183e4a5746ebfa72dfee433ffc4dc4833ebaf6565726ce2fa88605834993de6cbc9dd3d9edb9773bd08268af06044df1d7a8d6878fb6acb92bf65bf3458b3
|
data/README.md
CHANGED
@@ -4,8 +4,9 @@ Motion-Swipe for RubyMotion
|
|
4
4
|
|
5
5
|
Trying to add a Google inbox like floating button gem for RubyMotion. PRs for fixes, refactors and features accepted!
|
6
6
|
|
7
|
-
This is a wrapper around gizmoboy7's VCFloatingActionButton written in obj-c.
|
7
|
+
This is a wrapper around gizmoboy7's VCFloatingActionButton written in obj-c. We've included some of the fixes in the issues and pull requests from his repo and have made some customizations here too, so it is diverged and will likely stay that way. See his source: https://github.com/gizmoboy7/VCFloatingActionButton
|
8
8
|
|
9
|
+
We'd like to dedicate this gem to @andrewhavens, may he eschew iOS guidelines in the future.
|
9
10
|
|
10
11
|
__setup needed for storyboard file usage__
|
11
12
|
|
@@ -13,6 +14,21 @@ You need to move the .xib file `resources` into your app's `resources` folder. R
|
|
13
14
|
|
14
15
|
__create a floating action button view__
|
15
16
|
``` ruby
|
17
|
+
|
18
|
+
# If you are not using a nav bar, you can ignore these values.
|
19
|
+
nav_bar_height = self.navigation_controller.navigationBar.frame.size.height
|
20
|
+
nav_bar = self.navigation_controller.navigationBar
|
21
|
+
scroll_view = UITableView.new # haven't played with the scroll view option myself
|
22
|
+
|
23
|
+
@addButton = MotionFloatingActionButton.new(
|
24
|
+
CGRectMake(device.width*3/4, device.height/2+nav_bar_height, device.width*1/4, device.height/2),
|
25
|
+
normal_image: rmq.image.resource('icons/plus'),
|
26
|
+
pressed_image: rmq.image.resource('icons/plus'),
|
27
|
+
scroll_view: scroll_view, #optional
|
28
|
+
navigation_bar: nav_bar, #optional
|
29
|
+
)
|
30
|
+
|
31
|
+
# Older way but should still work
|
16
32
|
@addButton = MotionFloatingActionButton.build({
|
17
33
|
floating_frame: CGRectMake(device.width*3/4, device.height/2, device.width*1/4, device.height/2),
|
18
34
|
normal_image: rmq.image.resource('icons/plus'), # or UIImage.imageNamed('plus')
|
@@ -2,13 +2,54 @@ module MotionFloatingActionButton
|
|
2
2
|
|
3
3
|
module_function
|
4
4
|
|
5
|
+
def new( floating_frame,
|
6
|
+
options
|
7
|
+
)
|
8
|
+
|
9
|
+
normal_image = options[:normal_image] || UIImage.imageNamed('plus')
|
10
|
+
pressed_image = options[:pressed_image] || UIImage.imageNamed('plus')
|
11
|
+
navigation_bar = options[:navigation_bar]
|
12
|
+
scroll_view = options[:scroll_view]
|
13
|
+
|
14
|
+
if scroll_view && navigation_bar
|
15
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame,
|
16
|
+
normalImage: normal_image,
|
17
|
+
andPressedImage: pressed_image,
|
18
|
+
withScrollview: scroll_view,
|
19
|
+
andNavigationBar: navigation_bar
|
20
|
+
)
|
21
|
+
elsif scroll_view
|
22
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame,
|
23
|
+
normalImage: normal_image,
|
24
|
+
andPressedImage: pressed_image,
|
25
|
+
withScrollview: scroll_view,
|
26
|
+
)
|
27
|
+
elsif navigation_bar
|
28
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame,
|
29
|
+
normalImage: normal_image,
|
30
|
+
andPressedImage: pressed_image,
|
31
|
+
andNavigationBar: navigation_bar
|
32
|
+
)
|
33
|
+
else
|
34
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame,
|
35
|
+
normalImage: normal_image,
|
36
|
+
andPressedImage: pressed_image
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
addButton
|
41
|
+
end
|
42
|
+
|
43
|
+
|
5
44
|
def build(args)
|
6
45
|
|
7
46
|
@floating_frame = args[:floating_frame] || CGRectMake(device.width*3/4, device.height/2, device.width*1/4, device.height/2)
|
8
47
|
@normal_image = args[:normal_image]
|
9
48
|
@pressed_image = args[:pressed_image]
|
49
|
+
@navigation_bar = args[:navigation_bar]
|
10
50
|
|
11
|
-
addButton = VCFloatingActionButton.alloc.initWithFrame(@floating_frame, normalImage: @normal_image, andPressedImage: @pressed_image
|
51
|
+
# addButton = VCFloatingActionButton.alloc.initWithFrame(@floating_frame, normalImage: @normal_image, andPressedImage: @pressed_image) #, withScrollview: UITableView.new)
|
52
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(@floating_frame, normalImage: @normal_image, andPressedImage: @pressed_image, andNavigationBar: @navigation_bar)
|
12
53
|
|
13
54
|
addButton
|
14
55
|
end
|
data/resources/plus.png
ADDED
Binary file
|
@@ -32,12 +32,36 @@
|
|
32
32
|
@property (strong,nonatomic) UIImage *pressedImage, *normalImage;
|
33
33
|
@property (strong,nonatomic) NSDictionary *menuItemSet;
|
34
34
|
|
35
|
+
@property UIBlurEffectStyle blurEffectStyle;
|
36
|
+
@property float backgroundAlpha;
|
37
|
+
@property UIColor *menuTextColor;
|
38
|
+
|
35
39
|
|
36
40
|
@property BOOL isMenuVisible;
|
37
41
|
@property UIView *windowView;
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
//For use in a scroll view
|
44
|
+
-(id)initWithFrame:(CGRect)frame
|
45
|
+
normalImage:(UIImage*)passiveImage
|
46
|
+
andPressedImage:(UIImage*)activeImage
|
47
|
+
withScrollview:(UIScrollView*)scrView;
|
48
|
+
|
49
|
+
//For use in not a scroll view
|
50
|
+
-(id)initWithFrame:(CGRect)frame
|
51
|
+
normalImage:(UIImage*)passiveImage
|
52
|
+
andPressedImage:(UIImage*)activeImage;
|
53
|
+
|
54
|
+
-(id)initWithFrame:(CGRect)frame
|
55
|
+
normalImage:(UIImage*)passiveImage
|
56
|
+
andPressedImage:(UIImage*)activeImage
|
57
|
+
andNavigationBar:(UINavigationBar*)navBar;
|
58
|
+
|
59
|
+
//For use with a nav bar and a scroll view
|
60
|
+
-(id)initWithFrame:(CGRect)frame
|
61
|
+
normalImage:(UIImage*)passiveImage
|
62
|
+
andPressedImage:(UIImage*)activeImage
|
63
|
+
withScrollview:(UIScrollView*)scrView
|
64
|
+
andNavigationBar:(UINavigationBar*)navBar;
|
41
65
|
|
42
66
|
|
43
67
|
@end
|
@@ -26,7 +26,9 @@ CGFloat buttonToScreenHeight;
|
|
26
26
|
|
27
27
|
@synthesize bgScroller;
|
28
28
|
|
29
|
-
-(id)initWithFrame:(CGRect)frame
|
29
|
+
-(id)initWithFrame:(CGRect)frame
|
30
|
+
normalImage:(UIImage*)passiveImage
|
31
|
+
andPressedImage:(UIImage*)activeImage
|
30
32
|
{
|
31
33
|
self = [super initWithFrame:frame];
|
32
34
|
if (self)
|
@@ -42,7 +44,6 @@ CGFloat buttonToScreenHeight;
|
|
42
44
|
_menuTable = [[UITableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/4, 0, 0.75*SCREEN_WIDTH,SCREEN_HEIGHT - (SCREEN_HEIGHT - CGRectGetMaxY(self.frame)) )];
|
43
45
|
_menuTable.scrollEnabled = NO;
|
44
46
|
|
45
|
-
|
46
47
|
_menuTable.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/2, CGRectGetHeight(frame))];
|
47
48
|
|
48
49
|
_menuTable.delegate = self;
|
@@ -51,18 +52,81 @@ CGFloat buttonToScreenHeight;
|
|
51
52
|
_menuTable.backgroundColor = [UIColor clearColor];
|
52
53
|
_menuTable.transform = CGAffineTransformMakeRotation(-M_PI); //Rotate the table
|
53
54
|
|
54
|
-
previousOffset = scrView.contentOffset.y;
|
55
|
-
|
56
|
-
bgScroller =
|
55
|
+
// previousOffset = scrView.contentOffset.y;
|
56
|
+
previousOffset = 0;
|
57
|
+
bgScroller = nil;
|
57
58
|
|
58
59
|
_pressedImage = activeImage;
|
59
60
|
_normalImage = passiveImage;
|
60
61
|
[self setupButton];
|
62
|
+
|
63
|
+
self.blurEffectStyle = UIBlurEffectStyleDark;
|
64
|
+
self.backgroundAlpha = 0.8;
|
61
65
|
|
62
66
|
}
|
63
67
|
return self;
|
64
68
|
}
|
65
69
|
|
70
|
+
-(id)initWithFrame:(CGRect)frame
|
71
|
+
normalImage:(UIImage*)passiveImage
|
72
|
+
andPressedImage:(UIImage*)activeImage
|
73
|
+
andNavigationBar:(UINavigationBar*)navBar
|
74
|
+
{
|
75
|
+
self = [self initWithFrame:frame
|
76
|
+
normalImage:passiveImage
|
77
|
+
andPressedImage:activeImage];
|
78
|
+
if(navBar) {
|
79
|
+
int statusBar = [UIApplication sharedApplication].statusBarFrame.size.height;
|
80
|
+
|
81
|
+
_buttonView.frame = CGRectMake(frame.origin.x,
|
82
|
+
frame.origin.y + navBar.frame.size.height + statusBar,
|
83
|
+
frame.size.width,
|
84
|
+
frame.size.height);
|
85
|
+
|
86
|
+
_menuTable.frame = CGRectMake(SCREEN_WIDTH/4,
|
87
|
+
0,
|
88
|
+
0.75*SCREEN_WIDTH,
|
89
|
+
SCREEN_HEIGHT - (SCREEN_HEIGHT - CGRectGetMaxY(self.frame) - navBar.frame.size.height - statusBar));
|
90
|
+
}
|
91
|
+
return self;
|
92
|
+
}
|
93
|
+
|
94
|
+
-(id)initWithFrame:(CGRect)frame
|
95
|
+
normalImage:(UIImage*)passiveImage
|
96
|
+
andPressedImage:(UIImage*)activeImage
|
97
|
+
withScrollview:(UIScrollView*)scrView
|
98
|
+
{
|
99
|
+
self = [self initWithFrame:frame
|
100
|
+
normalImage:passiveImage
|
101
|
+
andPressedImage:activeImage];
|
102
|
+
if (self)
|
103
|
+
{
|
104
|
+
previousOffset = scrView.contentOffset.y;
|
105
|
+
|
106
|
+
bgScroller = scrView;
|
107
|
+
}
|
108
|
+
return self;
|
109
|
+
}
|
110
|
+
|
111
|
+
-(id)initWithFrame:(CGRect)frame
|
112
|
+
normalImage:(UIImage*)passiveImage
|
113
|
+
andPressedImage:(UIImage*)activeImage
|
114
|
+
withScrollview:(UIScrollView*)scrView
|
115
|
+
andNavigationBar:(UINavigationBar*)navBar
|
116
|
+
{
|
117
|
+
self = [self initWithFrame:frame
|
118
|
+
normalImage:passiveImage
|
119
|
+
andPressedImage:activeImage
|
120
|
+
andNavigationBar:navBar];
|
121
|
+
if (self)
|
122
|
+
{
|
123
|
+
previousOffset = scrView.contentOffset.y;
|
124
|
+
|
125
|
+
bgScroller = scrView;
|
126
|
+
}
|
127
|
+
return self;
|
128
|
+
}
|
129
|
+
|
66
130
|
|
67
131
|
-(void)setHideWhileScrolling:(BOOL)hideWhileScrolling
|
68
132
|
{
|
@@ -91,7 +155,8 @@ CGFloat buttonToScreenHeight;
|
|
91
155
|
[_buttonView addGestureRecognizer:buttonTap3];
|
92
156
|
|
93
157
|
|
94
|
-
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
158
|
+
// UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
159
|
+
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:self.blurEffectStyle];
|
95
160
|
UIVisualEffectView *vsview = [[UIVisualEffectView alloc]initWithEffect:blur];
|
96
161
|
|
97
162
|
|
@@ -164,14 +229,14 @@ CGFloat buttonToScreenHeight;
|
|
164
229
|
-(void) showMenu:(id)sender
|
165
230
|
{
|
166
231
|
|
167
|
-
self.pressedImageView.transform = CGAffineTransformMakeRotation(M_PI);
|
232
|
+
self.pressedImageView.transform = CGAffineTransformMakeRotation(-M_PI/4);
|
168
233
|
self.pressedImageView.alpha = 0.0; //0.3
|
169
234
|
[UIView animateWithDuration:animationTime/2 animations:^
|
170
235
|
{
|
171
236
|
self.bgView.alpha = 1;
|
172
237
|
|
173
238
|
|
174
|
-
self.normalImageView.transform = CGAffineTransformMakeRotation(
|
239
|
+
self.normalImageView.transform = CGAffineTransformMakeRotation(M_PI/4);
|
175
240
|
self.normalImageView.alpha = 0.0; //0.7
|
176
241
|
|
177
242
|
|
@@ -194,7 +259,7 @@ CGFloat buttonToScreenHeight;
|
|
194
259
|
{
|
195
260
|
self.bgView.alpha = 0;
|
196
261
|
self.pressedImageView.alpha = 0.f;
|
197
|
-
self.pressedImageView.transform = CGAffineTransformMakeRotation(-M_PI);
|
262
|
+
self.pressedImageView.transform = CGAffineTransformMakeRotation(-M_PI/4);
|
198
263
|
self.normalImageView.transform = CGAffineTransformMakeRotation(0);
|
199
264
|
self.normalImageView.alpha = 1.f;
|
200
265
|
} completion:^(BOOL finished)
|
@@ -351,6 +416,8 @@ CGFloat buttonToScreenHeight;
|
|
351
416
|
cell.imgView.image = [UIImage imageNamed:[_imageArray objectAtIndex:indexPath.row]];
|
352
417
|
cell.title.text = [_labelArray objectAtIndex:indexPath.row];
|
353
418
|
|
419
|
+
cell.title.textColor = self.menuTextColor;
|
420
|
+
|
354
421
|
|
355
422
|
return cell;
|
356
423
|
}
|
Binary file
|
data/vendor/motion-floating-action-button/build-iPhoneSimulator/libmotion-floating-action-button.a
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-floating-action-button
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien Sutevski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
12
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Easily create a floating action button interface.
|
15
15
|
email: dameyawn@gmail.com
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- lib/motion-floating-action-button.rb
|
22
22
|
- lib/motion-floating-action-button/motion-floating-action-button.rb
|
23
23
|
- resources/floatTableViewCell.xib
|
24
|
+
- resources/plus.png
|
24
25
|
- vendor/motion-floating-action-button/VCFloatingActionButton.h
|
25
26
|
- vendor/motion-floating-action-button/VCFloatingActionButton.m
|
26
27
|
- vendor/motion-floating-action-button/build-iPhoneSimulator/VCFloatingActionButton.m.o
|
@@ -54,5 +55,6 @@ rubyforge_project:
|
|
54
55
|
rubygems_version: 2.2.2
|
55
56
|
signing_key:
|
56
57
|
specification_version: 4
|
57
|
-
summary: Cool floating action button feature
|
58
|
+
summary: Cool material design (based on Google's design) floating action button feature
|
59
|
+
for RubyMotion iOS
|
58
60
|
test_files: []
|