motion-wizard 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +74 -0
  6. data/Rakefile +1 -0
  7. data/lib/motion-wizard.rb +9 -0
  8. data/lib/motion-wizard/animation_strategy/base_animation_strategy.rb +25 -0
  9. data/lib/motion-wizard/animation_strategy/ios7_slide_left_to_right.rb +18 -0
  10. data/lib/motion-wizard/animation_strategy/ios7_slide_right_to_left.rb +18 -0
  11. data/lib/motion-wizard/animation_strategy/left_to_right.rb +10 -0
  12. data/lib/motion-wizard/animation_strategy/none.rb +11 -0
  13. data/lib/motion-wizard/animation_strategy/right_to_left.rb +10 -0
  14. data/lib/motion-wizard/animation_strategy/slide_animation.rb +21 -0
  15. data/lib/motion-wizard/controllers/content_controller.rb +17 -0
  16. data/lib/motion-wizard/controllers/wizard_view_controller.rb +143 -0
  17. data/lib/motion-wizard/lib/forwardable.rb +12 -0
  18. data/lib/motion-wizard/views/index_item_view.rb +53 -0
  19. data/lib/motion-wizard/views/wizard_navigation_bar.rb +55 -0
  20. data/motion-wizard.gemspec +22 -0
  21. data/samples/wizard-1/.gitignore +16 -0
  22. data/samples/wizard-1/Gemfile +8 -0
  23. data/samples/wizard-1/Rakefile +18 -0
  24. data/samples/wizard-1/app/app_delegate.rb +8 -0
  25. data/samples/wizard-1/app/controllers/steps_view_controller.rb +92 -0
  26. data/samples/wizard-1/app/controllers/wizard_1_view_controller.rb +28 -0
  27. data/samples/wizard-1/app/views/styles/steps.rb +128 -0
  28. data/samples/wizard-1/app/views/styles/wizard_1_view_controller.rb +42 -0
  29. data/samples/wizard-1/resources/Default-568h@2x.png +0 -0
  30. data/samples/wizard-1/spec/main_spec.rb +9 -0
  31. data/samples/wizard-2/.gitignore +16 -0
  32. data/samples/wizard-2/Gemfile +8 -0
  33. data/samples/wizard-2/Rakefile +22 -0
  34. data/samples/wizard-2/app/app_delegate.rb +10 -0
  35. data/samples/wizard-2/app/controllers/steps_view_controller.rb +59 -0
  36. data/samples/wizard-2/app/controllers/wizard_2_view_controller.rb +29 -0
  37. data/samples/wizard-2/app/views/my_custom_index_item_view.rb +25 -0
  38. data/samples/wizard-2/app/views/styles/handlers.rb +7 -0
  39. data/samples/wizard-2/app/views/styles/index_item.rb +36 -0
  40. data/samples/wizard-2/app/views/styles/steps.rb +67 -0
  41. data/samples/wizard-2/app/views/styles/wizard_view_controller.rb +4 -0
  42. data/samples/wizard-2/resources/Default-568h@2x.png +0 -0
  43. data/samples/wizard-2/resources/background-568h@2x.png +0 -0
  44. data/samples/wizard-2/resources/background.png +0 -0
  45. data/samples/wizard-2/resources/background@2x.png +0 -0
  46. data/samples/wizard-2/resources/button.png +0 -0
  47. data/samples/wizard-2/spec/main_spec.rb +9 -0
  48. data/wizard-1.gif +0 -0
  49. data/wizard-2.gif +0 -0
  50. metadata +120 -0
@@ -0,0 +1,9 @@
1
+ describe "Application 'wizard-1'" do
2
+ before do
3
+ @app = UIApplication.sharedApplication
4
+ end
5
+
6
+ it "has one window" do
7
+ @app.windows.size.should == 1
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ .repl_history
2
+ build
3
+ tags
4
+ app/pixate_code.rb
5
+ resources/*.nib
6
+ resources/*.momd
7
+ resources/*.storyboardc
8
+ .DS_Store
9
+ nbproject
10
+ .redcar
11
+ #*#
12
+ *~
13
+ *.sw[po]
14
+ .eprj
15
+ .sass-cache
16
+ .idea
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ # Add your dependencies here:
5
+ gem 'motion-wizard', :path => "../.."
6
+ gem 'teacup'
7
+ gem 'sugarcube'
8
+ gem 'bubble-wrap'
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ $:.unshift("/Library/RubyMotion/lib")
3
+ require 'motion/project/template/ios'
4
+
5
+ begin
6
+ require 'bundler'
7
+ Bundler.require
8
+ require 'sugarcube-repl'
9
+ require 'sugarcube-color'
10
+ require 'sugarcube-image'
11
+ require 'sugarcube-uikit'
12
+ require 'sugarcube-568'
13
+ require 'sugarcube-events'
14
+ require 'sugarcube-constants'
15
+ rescue LoadError
16
+ end
17
+
18
+ Motion::Project::App.setup do |app|
19
+ # Use `rake config' to see complete project settings.
20
+ app.name = 'wizard-2'
21
+ app.info_plist['UIViewControllerBasedStatusBarAppearance'] = false
22
+ end
@@ -0,0 +1,10 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions: launchOptions)
3
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
+ @window.rootViewController = Wizard2ViewController.alloc.init
5
+ @window.makeKeyAndVisible
6
+
7
+ application.statusBarStyle = UIStatusBarStyleLightContent if UIDevice.currentDevice.systemVersion.to_f >= 7
8
+ true
9
+ end
10
+ end
@@ -0,0 +1,59 @@
1
+ class Step1ViewController < UIViewController
2
+ stylesheet :step_1
3
+
4
+ layout :step do
5
+ @button = subview(UIButton, :button)
6
+ end
7
+
8
+ def viewWillAppear(animated)
9
+ super
10
+ @button.on(:touch){ self.next }
11
+ end
12
+
13
+ def viewWillDisappear(animated)
14
+ super
15
+ @button.off(:touch)
16
+ end
17
+ end
18
+
19
+ class Step2ViewController < UIViewController
20
+ stylesheet :step_2
21
+
22
+ layout :step do
23
+ @next_button = subview(UIButton, :next_button)
24
+ @back_button = subview(UIButton, :back_button)
25
+ end
26
+
27
+ def viewWillAppear(animated)
28
+ super
29
+ @next_button.on(:touch) {self.next}
30
+ @back_button.on(:touch) {self.previous}
31
+ end
32
+
33
+ def viewWillDisappear(animated)
34
+ super
35
+ @next_button.off(:touch)
36
+ @back_button.off(:touch)
37
+ end
38
+ end
39
+
40
+ class Step3ViewController < UIViewController
41
+ stylesheet :step_3
42
+
43
+ layout :step do
44
+ @next_button = subview(UIButton, :next_button)
45
+ @back_button = subview(UIButton, :back_button)
46
+ end
47
+
48
+ def viewWillAppear(animated)
49
+ super
50
+ @next_button.on(:touch) {self.finish}
51
+ @back_button.on(:touch) {self.previous}
52
+ end
53
+
54
+ def viewWillDisappear(animated)
55
+ super
56
+ @next_button.off(:touch)
57
+ @back_button.off(:touch)
58
+ end
59
+ end
@@ -0,0 +1,29 @@
1
+ class Wizard2ViewController< MotionWizard::WizardViewController
2
+ steps Step1ViewController,
3
+ Step2ViewController,
4
+ Step2ViewController,
5
+ Step2ViewController,
6
+ Step3ViewController
7
+
8
+ index_item_view_class MyCustomIndexItemView
9
+
10
+ stylesheet :wizard_view_controller
11
+ layout :wizard_view_controller
12
+
13
+ def setup_index_item_at(index_item, index)
14
+ index_item.label.text = case index
15
+ when 0..2
16
+ "I"*(index + 1)
17
+ when 3
18
+ "IV"
19
+ when 4
20
+ "V"
21
+ end
22
+ index_item.restyle!
23
+ end
24
+
25
+ def when_finished
26
+ self.go_to_step(0)
27
+ self.reset!
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ class MyCustomIndexItemView < UIView
2
+ include Teacup::Layout
3
+
4
+ attr_reader :label, :underline
5
+
6
+ def init
7
+ super
8
+ self.stylesheet = :index_item
9
+ layout(self, :index_item) do
10
+ @label = subview(UILabel, :label)
11
+ @underline = subview(UIView, :underline)
12
+ end
13
+ self
14
+ end
15
+
16
+ def select
17
+ @underline.hidden = false
18
+ @label.textColor = :white.uicolor
19
+ end
20
+
21
+ def unselect
22
+ @underline.hidden = true
23
+ @label.textColor = :light_gray.uicolor
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ Teacup.handler UIButton, :titleColor { |button, color|
2
+ button.setTitleColor(color, forState: UIControlStateNormal)
3
+ }
4
+
5
+ Teacup.handler UIButton, :backgroundImage { |button, image|
6
+ button.setBackgroundImage(image, forState: UIControlStateNormal)
7
+ }
@@ -0,0 +1,36 @@
1
+ Teacup::Stylesheet.new :index_item do
2
+ style :index_item,
3
+ backgroundColor: :clear.uicolor
4
+
5
+ style :label,
6
+ size: ["100%", 20],
7
+ center_x: "50%",
8
+ top: "100% - 24",
9
+ textColor: :white.uicolor,
10
+ textAlignment: NSTextAlignmentCenter,
11
+ backgroundColor: :clear.uicolor,
12
+ font: "Helvetica".uifont(18)
13
+
14
+ style :underline,
15
+ size: ["30%", 1],
16
+ center_x: "50%",
17
+ top: "100% - 1",
18
+ backgroundColor: :white.uicolor,
19
+ hidden: true
20
+
21
+ style :selected,
22
+ label: {
23
+ textColor: :white.uicolor,
24
+ },
25
+ underline: {
26
+ hidden: false
27
+ }
28
+
29
+ style :unselected,
30
+ underline: {
31
+ hidden: true
32
+ },
33
+ label: {
34
+ textColor: :gray.uicolor
35
+ }
36
+ end
@@ -0,0 +1,67 @@
1
+ Teacup::Stylesheet.new :steps do
2
+ @font = "Helvetica-Light".uifont(26)
3
+ @background_image = "button".uiimage
4
+ @button_top = "100% - 160"
5
+
6
+ style :step,
7
+ backgroundColor: :clear.uicolor
8
+
9
+ style :big_button,
10
+ size: ["100%", 50],
11
+ center_x: "50%",
12
+ backgroundImage: @background_image,
13
+ titleColor: :white.uicolor
14
+
15
+ end
16
+
17
+ Teacup::Stylesheet.new :step_1 do
18
+ import :steps
19
+
20
+ style :button,
21
+ extends: :big_button,
22
+ title: "Start here >",
23
+ font: @font,
24
+ top: @button_top
25
+ end
26
+
27
+ Teacup::Stylesheet.new :step_2 do
28
+ import :steps
29
+
30
+ style :base_button,
31
+ size: ["50%", 50],
32
+ top: @button_top,
33
+ titleColor: :white.uicolor,
34
+ backgroundImage: @background_image,
35
+ font: @font
36
+
37
+ style :next_button,
38
+ extends: :base_button,
39
+ title: "Next >",
40
+ left: "50%"
41
+
42
+ style :back_button,
43
+ extends: :base_button,
44
+ title: "< Back",
45
+ left: 0
46
+ end
47
+
48
+ Teacup::Stylesheet.new :step_3 do
49
+ import :steps
50
+
51
+ style :base_button,
52
+ size: ["50%", 50],
53
+ top: @button_top,
54
+ titleColor: :white.uicolor,
55
+ backgroundImage: @background_image,
56
+ font: @font
57
+
58
+ style :next_button,
59
+ extends: :base_button,
60
+ title: "Finish",
61
+ left: "50%"
62
+
63
+ style :back_button,
64
+ extends: :base_button,
65
+ title: "< Back",
66
+ left: 0
67
+ end
@@ -0,0 +1,4 @@
1
+ Teacup::Stylesheet.new :wizard_view_controller do
2
+ style :wizard_view_controller,
3
+ backgroundColor: "background".uicolor
4
+ end
@@ -0,0 +1,9 @@
1
+ describe "Application 'wizard-2'" do
2
+ before do
3
+ @app = UIApplication.sharedApplication
4
+ end
5
+
6
+ it "has one window" do
7
+ @app.windows.size.should == 1
8
+ end
9
+ end
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-wizard
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Ignacio Piantanida
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: An small library to create wizard like views controllers
42
+ email:
43
+ - ijpiantanida@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/motion-wizard.rb
54
+ - lib/motion-wizard/animation_strategy/base_animation_strategy.rb
55
+ - lib/motion-wizard/animation_strategy/ios7_slide_left_to_right.rb
56
+ - lib/motion-wizard/animation_strategy/ios7_slide_right_to_left.rb
57
+ - lib/motion-wizard/animation_strategy/left_to_right.rb
58
+ - lib/motion-wizard/animation_strategy/none.rb
59
+ - lib/motion-wizard/animation_strategy/right_to_left.rb
60
+ - lib/motion-wizard/animation_strategy/slide_animation.rb
61
+ - lib/motion-wizard/controllers/content_controller.rb
62
+ - lib/motion-wizard/controllers/wizard_view_controller.rb
63
+ - lib/motion-wizard/lib/forwardable.rb
64
+ - lib/motion-wizard/views/index_item_view.rb
65
+ - lib/motion-wizard/views/wizard_navigation_bar.rb
66
+ - motion-wizard.gemspec
67
+ - samples/wizard-1/.gitignore
68
+ - samples/wizard-1/Gemfile
69
+ - samples/wizard-1/Rakefile
70
+ - samples/wizard-1/app/app_delegate.rb
71
+ - samples/wizard-1/app/controllers/steps_view_controller.rb
72
+ - samples/wizard-1/app/controllers/wizard_1_view_controller.rb
73
+ - samples/wizard-1/app/views/styles/steps.rb
74
+ - samples/wizard-1/app/views/styles/wizard_1_view_controller.rb
75
+ - samples/wizard-1/resources/Default-568h@2x.png
76
+ - samples/wizard-1/spec/main_spec.rb
77
+ - samples/wizard-2/.gitignore
78
+ - samples/wizard-2/Gemfile
79
+ - samples/wizard-2/Rakefile
80
+ - samples/wizard-2/app/app_delegate.rb
81
+ - samples/wizard-2/app/controllers/steps_view_controller.rb
82
+ - samples/wizard-2/app/controllers/wizard_2_view_controller.rb
83
+ - samples/wizard-2/app/views/my_custom_index_item_view.rb
84
+ - samples/wizard-2/app/views/styles/handlers.rb
85
+ - samples/wizard-2/app/views/styles/index_item.rb
86
+ - samples/wizard-2/app/views/styles/steps.rb
87
+ - samples/wizard-2/app/views/styles/wizard_view_controller.rb
88
+ - samples/wizard-2/resources/Default-568h@2x.png
89
+ - samples/wizard-2/resources/background-568h@2x.png
90
+ - samples/wizard-2/resources/background.png
91
+ - samples/wizard-2/resources/background@2x.png
92
+ - samples/wizard-2/resources/button.png
93
+ - samples/wizard-2/spec/main_spec.rb
94
+ - wizard-1.gif
95
+ - wizard-2.gif
96
+ homepage: https://github.com/ijpiantanida/motion-wizard
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.1.5
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: An small library to create wizard like views
120
+ test_files: []