motion-awesome 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzQ3YmU1MzZlZTMxNzhkODJlNDUzYmQzNTQ4N2RiY2M0MzQ1MDhmYw==
5
+ data.tar.gz: !binary |-
6
+ YzM0MzBkNjdmODA0NjA3NzU1MjA1ZGMwMzlmYTQ3YWQzYjQ0MGI1OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YmU1MDY0NjI4ZGIzOTIwYzEwNTViMGJmNzIwODgyODMzMjljZGYyMDhjOTk2
10
+ ZjJmMDY3NTFjZjc2MTMzODlmMmRhMGEzMzM1MWJiYjJjOTkyYjJlNGZlNzdi
11
+ YzNmODk2NWY1YjNjMDcxMzg1ZmZkOGUyYTdlM2RhOGUxNzFmYTE=
12
+ data.tar.gz: !binary |-
13
+ MDg1NWY4ZWQ5OGY4ZWQzNTNmYjM0ODRlOTQ5ZjhiOGFjNTE0MzBjNzRhZmQz
14
+ MmZhOTE4NGY4ZmJlZTNkNTFiYzBhODhlZWIwYjNkZmQ2ODVhOGU5N2U1YmU2
15
+ ODkzNGIwMTY5YjYyYjdkYWY2NDI4OTM3YmVmMmM4M2RmYzg2MjQ=
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ build
2
+ env.sh
3
+ *.psd
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'motion-map'
4
+ gem 'sugarcube'
5
+ gem 'bubble-wrap'
6
+ gem 'motion-cocoapods'
7
+
8
+ group :development do
9
+ gem 'css_parser'
10
+ gem 'plist'
11
+ end
12
+
13
+ group :spec do
14
+ gem "motion-stump"
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.13)
5
+ i18n (= 0.6.1)
6
+ multi_json (~> 1.0)
7
+ addressable (2.3.4)
8
+ bubble-wrap (1.1.5)
9
+ cocoapods (0.16.4)
10
+ activesupport (~> 3.2.6)
11
+ colored (~> 1.2)
12
+ escape (~> 0.0.4)
13
+ faraday (~> 0.8.1)
14
+ json (~> 1.7.3)
15
+ octokit (~> 1.7)
16
+ open4 (~> 1.3.0)
17
+ rake (~> 10.0.0)
18
+ xcodeproj (~> 0.5.0)
19
+ colored (1.2)
20
+ css_parser (1.3.4)
21
+ addressable
22
+ escape (0.0.4)
23
+ faraday (0.8.6)
24
+ multipart-post (~> 1.1)
25
+ faraday_middleware (0.9.0)
26
+ faraday (>= 0.7.4, < 0.9)
27
+ hashie (1.2.0)
28
+ i18n (0.6.1)
29
+ json (1.7.7)
30
+ motion-cocoapods (1.2.2)
31
+ cocoapods (>= 0.14.0)
32
+ motion-map (0.0.3)
33
+ motion-stump (0.2.1)
34
+ multi_json (1.7.2)
35
+ multipart-post (1.2.0)
36
+ netrc (0.7.7)
37
+ octokit (1.23.0)
38
+ addressable (~> 2.2)
39
+ faraday (~> 0.8)
40
+ faraday_middleware (~> 0.9)
41
+ hashie (~> 1.2)
42
+ multi_json (~> 1.3)
43
+ netrc (~> 0.7.7)
44
+ open4 (1.3.0)
45
+ plist (3.1.0)
46
+ rake (10.0.3)
47
+ sugarcube (0.20.9)
48
+ xcodeproj (0.5.2)
49
+ activesupport (~> 3.2.6)
50
+ colored (~> 1.2)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ bubble-wrap
57
+ css_parser
58
+ motion-cocoapods
59
+ motion-map
60
+ motion-stump
61
+ plist
62
+ sugarcube
data/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # MotionAwesome - as if more awesomeness was needed...
2
+
3
+ ![MotionAwesome Screenshots](http://derailed.github.io/motion-awesome/assets/d.png)
4
+
5
+ FontAwesome (http://fortawesome.github.io/Font-Awesome) is a really cool way to bring in some
6
+ low cost bang! to your web applications.
7
+ Following on that lead, MotionAwesome brings similar awesomeness in the RubyMotion world...
8
+
9
+
10
+ ## For the star-gizzards ;-)
11
+
12
+ ```
13
+ > git clone https://github.com/derailed/motion-awesome.git
14
+ > cd motion-awesome
15
+ > rake
16
+ ```
17
+
18
+ ## Installation
19
+
20
+ ```
21
+ gem install motion-awesome
22
+ ```
23
+
24
+ ## Dependencies
25
+
26
+ - motion-map [https://github.com/derailed/motion-map]
27
+
28
+ ## Usage
29
+
30
+ ### Creating awesome labels
31
+
32
+ ```ruby
33
+ class WannaBeCoolController < XXXController
34
+ include MotionAwesome
35
+
36
+ def viewDidLoad
37
+ label( :flag, size: 200 ) do |label|
38
+ self.view.addSubview(label)
39
+ end
40
+ end
41
+ end
42
+ ```
43
+
44
+ ### Creating awesome buttons
45
+
46
+ ```ruby
47
+ class WannaBeCoolController < XXXController
48
+ include MotionAwesome
49
+
50
+ def viewDidLoad
51
+ button( :legal, size: 40, text:%q{Hit me!} ) do |button|
52
+ button.titleLabel.textColor = 0xFB3223.uicolor
53
+ button.titleLabel.font = UIFont.fontWithName( 'GillSans', size:30 )
54
+ button.addTarget( self,
55
+ action: "cb:",
56
+ forControlEvents: UIControlEventTouchUpInside )
57
+ self.view.addSubview( button )
58
+ end
59
+ end
60
+ ```
61
+
62
+ ## Settings
63
+
64
+
65
+ ### What's my name?
66
+
67
+ With MotionAwesome you have access to all the latest icons available on the FontAwesome site.
68
+
69
+ In order to specify the icon name you can use a symbol for the name minus the 'icon-' prefix and
70
+ sub out the '-' with '_'. Simple!
71
+
72
+ ```
73
+ FontAwesome => MotionAwesome
74
+ icon-flag => :flag
75
+ icon-star-empty => :star_empty
76
+ ```
77
+
78
+ ### Options
79
+
80
+ Awesomization is currently in effect for UILabel and UIButton.
81
+
82
+ The method signatures following this strategy:
83
+
84
+ ```ruby
85
+ awesome_label = label( :icon_name, opts ) do {|comp| ... }
86
+ awesome_button = button( :icon_name, opts ) do {|comp| ... }
87
+ ```
88
+
89
+ Options are as follows:
90
+
91
+ + size: specifies the size of the icon. To size the text portion you can set the font of your liking.
92
+ If no size is specified the icon will be sized according to the active font size.
93
+ + type: :custom | :rounded. Specifies the type of UIButton to create -- For button only! -
94
+ + text: prepends some text to your decorated label or button.
95
+ + color: sets the icon color. If this is not set the icon color will match the text color if specified.
96
+
97
+
98
+ ## ATTA BOY!
99
+
100
+ This gem was inspired by Hiroshi Horiki(@pchw) https://github.com/pchw/fontawesome
101
+
102
+
103
+ ## Contact
104
+
105
+ Fernand Galiana
106
+
107
+ - http://github.com/derailed
108
+ - http://twitter.com/kitesurfer
109
+ - <fernand.galiana@gmail.com>
110
+
111
+ Still work in progress. So please feel to fork or contact me if you run into issues or
112
+ just want to send some good vibes...
113
+
114
+
115
+ ## License
116
+
117
+ MotionAwesome is released under the [MIT](http://opensource.org/licenses/MIT) license.
118
+
119
+
120
+ ## History
121
+ + 0.0.1:
122
+ + Initial drop
123
+ + 0.0.2:
124
+ + Bug fixes and cleanup
125
+ + 0.0.3:
126
+ + Mo' spring cleaning
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ $:.unshift('/Library/RubyMotion/lib')
2
+ require 'motion/project'
3
+ require './lib/motion-awesome'
4
+ require 'sugarcube-gestures'
5
+
6
+ require 'bundler'
7
+ Bundler.require
8
+ Bundler::GemHelper.install_tasks
9
+
10
+ Motion::Project::App.setup do |app|
11
+ app.name = 'Awesome!'
12
+
13
+ app.development do
14
+ app.codesign_certificate = ENV['dev_bs_certificate']
15
+ app.provisioning_profile = ENV['dev_bs_profile']
16
+ end
17
+
18
+ app.pods do
19
+ pod 'WCAlertView'
20
+ end
21
+ end
22
+
23
+ namespace :gen do
24
+ desc 'Generates plist from css'
25
+ task :plist do
26
+ require File.expand_path('../lib/utils/generator.rb', __FILE__)
27
+ MotionAwesome::Generator.gen_plist( File.join( File.dirname(__FILE__), %w[css font-awesome.css] ) )
28
+ end
29
+ end
@@ -0,0 +1,59 @@
1
+ include SugarCube::Adjust
2
+
3
+ class AppDelegate
4
+ attr_reader :samples
5
+
6
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
7
+ return true if RUBYMOTION_ENV == 'test'
8
+
9
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
10
+ nav = UINavigationController.alloc.initWithRootViewController( A.new )
11
+ @window.rootViewController = nav
12
+ @window.rootViewController.wantsFullScreenLayout = true
13
+
14
+ @window.makeKeyAndVisible
15
+
16
+ nav.setNavigationBarHidden( true, animated:true )
17
+
18
+ setup_appearance
19
+
20
+ @samples = %w(A B C D E)
21
+
22
+ true
23
+ end
24
+
25
+ def alert( message )
26
+ WCAlertView.showAlertWithTitle( "Motion-Awesome", message:message,
27
+ customizationBlock: ->(alertView) do
28
+ ;
29
+ end,
30
+ completionBlock: ->(buttonIndex, view) do
31
+ ;
32
+ end,
33
+ cancelButtonTitle:"Roger that!", otherButtonTitles:nil )
34
+ end
35
+
36
+ private
37
+
38
+ def setup_appearance
39
+ UILabel.appearance.setBackgroundColor( UIColor.clearColor )
40
+ style_alerts
41
+ end
42
+
43
+ def style_alerts
44
+ WCAlertView.setDefaultCustomiaztonBlock ->(alertView) do
45
+ alertView.labelTextColor = UIColor.colorWithRed( 103, green:135, blue:221, alpha:1.0 )
46
+ alertView.labelShadowColor = UIColor.colorWithRed(68.0/255, green:114.0/255, blue:221.0/255, alpha:0.2 )
47
+ alertView.buttonTextColor = UIColor.colorWithRed(103.0, green:135.0, blue:221.0, alpha:1.00 )
48
+ alertView.buttonShadowColor = UIColor.colorWithRed( 68.0/255, green:114.0/255, blue:221.0/255, alpha:1.0)
49
+
50
+ topGradient = UIColor.colorWithRed(50.0/255, green:50.0/255, blue:50.0/255, alpha:0.5 )
51
+ middleGradient = UIColor.colorWithRed(0.0/255, green:0.0/255, blue:0.0/255, alpha:0.2 )
52
+ bottomGradient = UIColor.colorWithRed(50.0/255, green:50.0/255, blue:50.0/255, alpha:0.5 )
53
+ alertView.gradientColors = [topGradient,middleGradient,bottomGradient]
54
+
55
+ alertView.outerFrameColor = UIColor.colorWithRed( 103.0/255, green:135.0/255, blue:221.0/255, alpha:1.0)
56
+ end
57
+ end
58
+
59
+ end
@@ -0,0 +1,12 @@
1
+ class A < Z
2
+ def viewDidLoad
3
+ @comp = label( :flag, size: 200 ) do |label|
4
+ label.color = 0x04B0FB.uicolor
5
+ label.backgroundColor = UIColor.clearColor
6
+ label.frame = CGRectMake( 0, 0, 200, 200 )
7
+ label.center = center
8
+ self.view.addSubview(label)
9
+ end
10
+ super
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class B < Z
2
+ def viewDidLoad
3
+ @comp = label( :volume_up, text:"Simply Awesome!" ) do |label|
4
+ label.color = UIColor.redColor
5
+ label.backgroundColor = UIColor.clearColor
6
+ label.font = UIFont.fontWithName( 'AmericanTypewriter', size:30 )
7
+ label.textAlignment = NSTextAlignmentCenter
8
+ label.frame = CGRectMake( 0, 0, 300, 50 )
9
+ label.center = center
10
+ self.view.addSubview(label)
11
+ end
12
+ super
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class C < Z
2
+ def viewDidLoad
3
+ @comp = label( :wrench, text:"Yes please!", color: 0xB0FB03.uicolor ) do |label|
4
+ label.color = 0x539FFB.uicolor
5
+ label.backgroundColor = UIColor.clearColor
6
+ label.font = UIFont.fontWithName( 'copperplate', size:40 )
7
+ label.textAlignment = NSTextAlignmentCenter
8
+ label.frame = CGRectMake( 0, 0, 300, 50 )
9
+ label.center = center
10
+ self.view.addSubview(label)
11
+ end
12
+ super
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ class D < Z
2
+ def viewDidLoad
3
+ @comp = button( :legal, size: 40, text:%q{Hit me!} ) do |button|
4
+ button.titleLabel.textColor = 0xFB3223.uicolor
5
+ button.titleLabel.font = UIFont.fontWithName( 'GillSans', size:30 )
6
+
7
+ button.setBackgroundImage( UIImage.imageNamed( 'button-bg.png'), forState: UIControlStateNormal )
8
+ button.layer.cornerRadius = 10
9
+ button.layer.masksToBounds = true
10
+
11
+ button.frame = CGRectMake( 0, 0, 180, 60 )
12
+ button.center = center
13
+ button.addTarget( self,
14
+ action: "callback:",
15
+ forControlEvents: UIControlEventTouchUpInside )
16
+ self.view.addSubview( button )
17
+ end
18
+ super
19
+ end
20
+
21
+ private
22
+
23
+ def callback( button )
24
+ App.delegate.alert "You're a good citizen..."
25
+ end
26
+
27
+ end
@@ -0,0 +1,27 @@
1
+ class E < Z
2
+ def viewDidLoad
3
+ @comp = button( :github, size:35, text:%q{Fork it!}, color:0xD6FF18.uicolor, type: :custom ) do |button|
4
+ button.titleLabel.textColor = 0x2D31CE.uicolor
5
+ button.titleLabel.font = UIFont.fontWithName( "Vermin Vibes Out Of Ink", size:55 )
6
+
7
+ button.setBackgroundImage( UIImage.imageNamed( 'button-bg.png'), forState: UIControlStateNormal )
8
+ button.layer.cornerRadius = 5
9
+ button.layer.masksToBounds = true
10
+
11
+ button.frame = CGRectMake( 0, 0, 300, 70 )
12
+ button.center = center
13
+ button.contentEdgeInsets = UIEdgeInsetsMake( 0, 0, 0, 0 )
14
+ button.addTarget( self,
15
+ action: "callback:",
16
+ forControlEvents: UIControlEventTouchUpInside )
17
+ self.view.addSubview( button )
18
+ end
19
+ super
20
+ end
21
+
22
+ private
23
+
24
+ def callback( button )
25
+ App.delegate.alert "github.com/derailed/motion-awesome"
26
+ end
27
+ end
@@ -0,0 +1,57 @@
1
+ class Z < UIViewController
2
+ include MotionAwesome
3
+
4
+ attr_accessor :comp
5
+
6
+ def initialize
7
+ @comp = nil
8
+ end
9
+
10
+ def viewDidLoad
11
+ view.setBackgroundColor( 0x000000.uicolor )
12
+
13
+ view.on_tap do
14
+ next_ctrl
15
+ end
16
+ view.on_swipe( :left ) do
17
+ next_ctrl
18
+ end
19
+ view.on_swipe( :right ) do
20
+ prev_ctrl
21
+ end
22
+ end
23
+
24
+ def viewWillAppear( animated )
25
+ refresh_layout
26
+ end
27
+
28
+ def didRotateFromInterfaceOrientation( orientation )
29
+ refresh_layout
30
+ end
31
+
32
+ private
33
+
34
+ def refresh_layout
35
+ comp.center = center
36
+ end
37
+
38
+ def center
39
+ [self.view.frame.size.width/2, self.view.frame.size.height/2]
40
+ end
41
+
42
+ def samples
43
+ App.delegate.samples
44
+ end
45
+
46
+ def prev_ctrl
47
+ current_index = samples.index(self.class.name)
48
+ clazz = Object.const_get( samples[(current_index-1) % samples.size] )
49
+ self.navigationController.pushViewController( clazz.new, animated: true )
50
+ end
51
+
52
+ def next_ctrl
53
+ current_index = samples.index(self.class.name)
54
+ clazz = Object.const_get( samples[(current_index+1) % samples.size] )
55
+ self.navigationController.pushViewController( clazz.new, animated: true )
56
+ end
57
+ end