status_bar 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +47 -5
- data/app/app_delegate.rb +2 -2
- data/app/controllers/demo_controller.rb +4 -4
- data/app/styles/demo_style.rb +2 -2
- data/lib/project/base.rb +18 -11
- data/lib/project/style.rb +1 -1
- data/lib/project/view.rb +2 -2
- data/lib/status_bar.rb +1 -1
- data/spec/demo_controller_spec.rb +138 -23
- data/status_bar.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTkwY2NmMzJjOGY3ZTQ3YWFlZGMxNDMxOTNlODRhY2JkM2Y5YzY4Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGQ1Mjc3NDAyZWU1MmQ3NWNmNGJiOTcxYjRhMWU4NmY0NTQwNWY1MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGU4M2Y5OTIxMWIxZDQ5ODI1OGMzYTY3MTJjNGE1MjBjNWFhMjY2OGU4N2M2
|
10
|
+
OWQ2OTBmNzBlZGMyYzVlY2ZmYjMwOGE4NmQ5NTI2NjZmMzQ2NjYwOGI2NjRl
|
11
|
+
MjU1ODRhNTJlZTIzMDcyMTU3YzlmYTFjMDkwYjhkNzQzNTk5ZWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTBlNjZhYTYwYjZlYmZiOGQwMTMyM2MyMDFmOTRlMDA2YTdjYzdiMmNkNGNj
|
14
|
+
MGZmZDM5NDJjNzM0Zjc5OTgxZGEwYTNmMGM3YjNmMzEwY2UxZDVhNjVmZDhj
|
15
|
+
YmQxODYxY2M4MWNlNjI5YzE4NTVhZjE1YzJhMWFiZmY4NzZhODA=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,41 @@
|
|
1
|
-
|
2
|
-
remote:
|
3
|
-
revision: 24c813f16f5799dd7ddffdf801d83a989270befa
|
1
|
+
PATH
|
2
|
+
remote: ~/Projects/*Defaults/Misc/Gems/status_bar
|
4
3
|
specs:
|
5
|
-
|
4
|
+
status_bar (0.2)
|
5
|
+
bubble-wrap (= 1.4.0)
|
6
|
+
hs
|
7
|
+
sugarcube (= 1.3.5)
|
8
|
+
teacup (= 2.1.13)
|
6
9
|
|
7
10
|
GEM
|
8
11
|
remote: https://rubygems.org/
|
9
12
|
specs:
|
13
|
+
activesupport (3.2.15)
|
14
|
+
i18n (~> 0.6, >= 0.6.4)
|
15
|
+
multi_json (~> 1.0)
|
10
16
|
awesome_print_motion (0.1.0)
|
17
|
+
bubble-wrap (1.4.0)
|
11
18
|
celluloid (0.15.2)
|
12
19
|
timers (~> 1.1.0)
|
20
|
+
claide (0.3.2)
|
21
|
+
cocoapods (0.27.1)
|
22
|
+
activesupport (>= 3.2.15, < 4)
|
23
|
+
claide (~> 0.3.2)
|
24
|
+
cocoapods-core (= 0.27.1)
|
25
|
+
cocoapods-downloader (~> 0.2.0)
|
26
|
+
colored (~> 1.2)
|
27
|
+
escape (~> 0.0.4)
|
28
|
+
json_pure (~> 1.8)
|
29
|
+
open4 (~> 1.3)
|
30
|
+
xcodeproj (~> 0.14.0)
|
31
|
+
cocoapods-core (0.27.1)
|
32
|
+
activesupport (>= 3.2.15, < 4)
|
33
|
+
json_pure (~> 1.8)
|
34
|
+
nap (~> 0.5)
|
35
|
+
cocoapods-downloader (0.2.0)
|
13
36
|
coderay (1.0.9)
|
37
|
+
colored (1.2)
|
38
|
+
escape (0.0.4)
|
14
39
|
ffi (1.9.3)
|
15
40
|
formatador (0.2.4)
|
16
41
|
guard (2.2.2)
|
@@ -22,12 +47,23 @@ GEM
|
|
22
47
|
guard-motion (0.1.2)
|
23
48
|
guard (>= 1.1.0)
|
24
49
|
rake (>= 0.9)
|
50
|
+
hs (0.1.1)
|
51
|
+
bubble-wrap (>= 1.3.0)
|
52
|
+
motion-cocoapods (>= 1.3.7)
|
53
|
+
sugarcube
|
54
|
+
i18n (0.6.5)
|
55
|
+
json_pure (1.8.1)
|
25
56
|
listen (2.2.0)
|
26
57
|
celluloid (>= 0.15.2)
|
27
58
|
rb-fsevent (>= 0.9.3)
|
28
59
|
rb-inotify (>= 0.9)
|
29
60
|
lumberjack (1.0.4)
|
30
61
|
method_source (0.8.2)
|
62
|
+
motion-cocoapods (1.4.0)
|
63
|
+
cocoapods (>= 0.26.2)
|
64
|
+
multi_json (1.8.2)
|
65
|
+
nap (0.5.1)
|
66
|
+
open4 (1.3.0)
|
31
67
|
pry (0.9.12.2)
|
32
68
|
coderay (~> 1.0.5)
|
33
69
|
method_source (~> 0.8)
|
@@ -37,9 +73,14 @@ GEM
|
|
37
73
|
rb-inotify (0.9.2)
|
38
74
|
ffi (>= 0.5.0)
|
39
75
|
slop (3.4.6)
|
76
|
+
sugarcube (1.3.5)
|
40
77
|
teacup (2.1.13)
|
41
78
|
thor (0.18.1)
|
42
79
|
timers (1.1.0)
|
80
|
+
xcodeproj (0.14.1)
|
81
|
+
activesupport (~> 3.0)
|
82
|
+
colored (~> 1.2)
|
83
|
+
rake
|
43
84
|
|
44
85
|
PLATFORMS
|
45
86
|
ruby
|
@@ -47,5 +88,6 @@ PLATFORMS
|
|
47
88
|
DEPENDENCIES
|
48
89
|
awesome_print_motion
|
49
90
|
guard-motion
|
50
|
-
|
91
|
+
status_bar!
|
92
|
+
sugarcube (= 1.3.5)
|
51
93
|
teacup (= 2.1.13)
|
data/app/app_delegate.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
class AppDelegate
|
2
2
|
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
3
3
|
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
4
|
-
@window.
|
5
|
-
@window.backgroundColor = "#000000".uicolor
|
4
|
+
@window.backgroundColor = UIColor.clearColor
|
6
5
|
@window.rootViewController = DemoController.new
|
6
|
+
@window.makeKeyAndVisible
|
7
7
|
|
8
8
|
true
|
9
9
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
class DemoController < UIViewController
|
2
|
-
stylesheet :
|
2
|
+
stylesheet :demo_sheet
|
3
3
|
|
4
|
-
|
4
|
+
attr_reader :status_bar
|
5
|
+
|
6
|
+
layout :demo do
|
5
7
|
@container = subview(UIView, :container) do
|
6
8
|
@show_notice_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_notice_button)
|
7
9
|
@show_activity_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_activity_button)
|
@@ -15,8 +17,6 @@ class DemoController < UIViewController
|
|
15
17
|
def viewDidLoad
|
16
18
|
super
|
17
19
|
|
18
|
-
ap "first viewDidLoad"
|
19
|
-
|
20
20
|
@status_bar = StatusBar::Base.new
|
21
21
|
|
22
22
|
@show_notice_button.when(UIControlEventTouchUpInside) {
|
data/app/styles/demo_style.rb
CHANGED
data/lib/project/base.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
module StatusBar
|
2
2
|
class Base
|
3
3
|
|
4
|
+
attr_reader :view, :current_notice_view
|
5
|
+
|
4
6
|
def initialize
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
# Add statusbar to root view controller, once root controller is there.
|
9
|
+
timer = 0.1.second.every do
|
10
|
+
return if App.shared.keyWindow == nil || App.shared.keyWindow.rootViewController == nil
|
11
|
+
@view = StatusBar::View.new
|
12
|
+
App.shared.keyWindow.rootViewController.view.addSubview(@view.view)
|
13
|
+
App.shared.keyWindow.rootViewController.view.sendSubviewToBack(@view.view)
|
14
|
+
timer.invalidate
|
15
|
+
end
|
9
16
|
|
10
17
|
# Set old orientation and rotation effect
|
11
18
|
@current_notice_view = nil
|
@@ -24,19 +31,19 @@ module StatusBar
|
|
24
31
|
|
25
32
|
# EXTERNAL COMMANDS
|
26
33
|
def show_notice(text)
|
27
|
-
show_notice_view(@
|
34
|
+
show_notice_view(@view.notice_view, text:text)
|
28
35
|
end
|
29
36
|
|
30
37
|
def show_activity_notice(text)
|
31
|
-
show_notice_view(@
|
38
|
+
show_notice_view(@view.activity_view, text:text)
|
32
39
|
end
|
33
40
|
|
34
41
|
def show_success_notice(text)
|
35
|
-
show_notice_view(@
|
42
|
+
show_notice_view(@view.success_view, text:text)
|
36
43
|
end
|
37
44
|
|
38
45
|
def show_error_notice(text)
|
39
|
-
show_notice_view(@
|
46
|
+
show_notice_view(@view.error_view, text:text)
|
40
47
|
end
|
41
48
|
|
42
49
|
def hide_notice
|
@@ -44,7 +51,7 @@ module StatusBar
|
|
44
51
|
end
|
45
52
|
|
46
53
|
def visible?
|
47
|
-
StatusBar::Helper.view_visible?(@
|
54
|
+
StatusBar::Helper.view_visible?(@view.status_bar_view)
|
48
55
|
end
|
49
56
|
|
50
57
|
|
@@ -53,13 +60,13 @@ module StatusBar
|
|
53
60
|
def show_status_bar_view
|
54
61
|
if !visible?
|
55
62
|
App.shared.setStatusBarHidden(true, withAnimation:UIStatusBarAnimationSlide)
|
56
|
-
@
|
63
|
+
@view.status_bar_view.move_to([0, 0])
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
60
67
|
def hide_status_bar_view
|
61
68
|
if visible?
|
62
|
-
@
|
69
|
+
@view.status_bar_view.move_to([0, 20])
|
63
70
|
App.shared.setStatusBarHidden(false, withAnimation:UIStatusBarAnimationSlide)
|
64
71
|
end
|
65
72
|
end
|
@@ -75,7 +82,7 @@ module StatusBar
|
|
75
82
|
notice_view.y = 0 if !visible?
|
76
83
|
notice_view.move_to([0, 0]) if visible?
|
77
84
|
position_inner_views(notice_view)
|
78
|
-
@timer = EM.add_timer 3 { hide_status_bar_view }
|
85
|
+
@timer = EM.add_timer 3 { hide_status_bar_view } if accessory != nil && accessory.class == UIImageView
|
79
86
|
|
80
87
|
show_status_bar_view unless visible?
|
81
88
|
@current_notice_view = notice_view
|
data/lib/project/style.rb
CHANGED
data/lib/project/view.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module StatusBar
|
2
2
|
class View < UIViewController
|
3
|
-
stylesheet :
|
3
|
+
stylesheet :status_bar_sheet
|
4
4
|
|
5
5
|
attr_accessor :status_bar_view, :notice_view, :notice_label, :activity_view, :activity_spinner, :activity_label, :success_view, :success_image, :success_label, :error_view, :error_image, :error_label
|
6
6
|
|
7
|
-
layout :
|
7
|
+
layout :status_bar_vc_view do
|
8
8
|
|
9
9
|
@status_bar_view = subview(UIView, :status_bar_view) do
|
10
10
|
@notice_view = subview(UIView, :notice_view) do
|
data/lib/status_bar.rb
CHANGED
@@ -33,5 +33,5 @@ Motion::Project::App.setup do |app|
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# app.files.unshift Dir.glob(File.join(lib_dir_path, "project/**/*.rb"))
|
36
|
-
app.resources_dirs << File.join(File.dirname(__FILE__), 'resources')
|
36
|
+
# app.resources_dirs << File.join(File.dirname(__FILE__), 'resources')
|
37
37
|
end
|
@@ -1,52 +1,167 @@
|
|
1
1
|
describe "A - DemoController" do
|
2
2
|
tests DemoController
|
3
|
-
|
4
|
-
# I gave up testing, because things good weird. If anyone wants to take up this, I'd love to see how they'd do it.
|
5
3
|
|
6
|
-
|
4
|
+
before do
|
5
|
+
# Buttons
|
6
|
+
@show_notice_button = view("Show Notice")
|
7
|
+
@show_activity_button = view("Show Activity")
|
8
|
+
@show_success_button = view("Show Success")
|
9
|
+
@show_error_button = view("Show Error")
|
10
|
+
@hide_notice_button = view("Hide Notice")
|
11
|
+
@visibility_button = view("Visible?")
|
12
|
+
|
13
|
+
# Statusbar view
|
14
|
+
@status_bar_view = controller.view.viewWithStylename(:status_bar_view)
|
15
|
+
|
16
|
+
# Statusbar subviews
|
17
|
+
@notice_view = controller.view.viewWithStylename(:notice_view)
|
18
|
+
@notice_label = controller.view.viewWithStylename(:notice_label)
|
19
|
+
@activity_view = controller.view.viewWithStylename(:activity_view)
|
20
|
+
@activity_spinner = controller.view.viewWithStylename(:activity_spinner)
|
21
|
+
@activity_label = controller.view.viewWithStylename(:activity_label)
|
22
|
+
@success_view = controller.view.viewWithStylename(:success_view)
|
23
|
+
@success_image = controller.view.viewWithStylename(:success_image)
|
24
|
+
@success_label = controller.view.viewWithStylename(:success_label)
|
25
|
+
@error_view = controller.view.viewWithStylename(:error_view)
|
26
|
+
@error_image = controller.view.viewWithStylename(:error_image)
|
27
|
+
@error_label = controller.view.viewWithStylename(:error_label)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
7
31
|
|
8
|
-
|
9
|
-
|
32
|
+
context "B - View existence" do
|
33
|
+
|
34
|
+
it "buttons" do
|
35
|
+
@show_notice_button.should.not.equal nil
|
36
|
+
@show_activity_button.should.not.equal nil
|
37
|
+
@show_success_button.should.not.equal nil
|
38
|
+
@show_error_button.should.not.equal nil
|
39
|
+
@hide_notice_button.should.not.equal nil
|
40
|
+
@visibility_button.should.not.equal nil
|
10
41
|
end
|
11
42
|
|
12
|
-
it "
|
13
|
-
|
43
|
+
it "statusbar view" do
|
44
|
+
@status_bar_view.should.not.equal nil
|
14
45
|
end
|
15
46
|
|
16
|
-
it "
|
17
|
-
|
47
|
+
it "statusbar subviews" do
|
48
|
+
@notice_view.should.not.equal nil
|
49
|
+
@notice_label.should.not.equal nil
|
50
|
+
@activity_view.should.not.equal nil
|
51
|
+
@activity_spinner.should.not.equal nil
|
52
|
+
@activity_label.should.not.equal nil
|
53
|
+
@success_view.should.not.equal nil
|
54
|
+
@success_image.should.not.equal nil
|
55
|
+
@success_label.should.not.equal nil
|
56
|
+
@error_view.should.not.equal nil
|
57
|
+
@error_image.should.not.equal nil
|
58
|
+
@error_label.should.not.equal nil
|
18
59
|
end
|
19
60
|
|
20
|
-
|
21
|
-
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
context "B - Clicking buttons" do
|
66
|
+
|
67
|
+
it "show notice" do
|
68
|
+
@notice_view.y.should.equal 20
|
69
|
+
tap "Show Notice"
|
70
|
+
wait 0.3 do
|
71
|
+
@notice_view.y.should.equal 0
|
72
|
+
end
|
22
73
|
end
|
23
74
|
|
24
|
-
it "
|
25
|
-
|
75
|
+
it "activity notice" do
|
76
|
+
@activity_view.y.should.equal 20
|
77
|
+
tap "Show Activity"
|
78
|
+
wait 0.3 do
|
79
|
+
@activity_view.y.should.equal 0
|
80
|
+
end
|
26
81
|
end
|
27
82
|
|
28
|
-
it "
|
29
|
-
|
83
|
+
it "success notice" do
|
84
|
+
@success_view.y.should.equal 20
|
85
|
+
tap "Show Success"
|
86
|
+
wait 0.3 do
|
87
|
+
@success_view.y.should.equal 0
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it "error notice" do
|
92
|
+
@error_view.y.should.equal 20
|
93
|
+
tap "Show Error"
|
94
|
+
wait 0.3 do
|
95
|
+
@error_view.y.should.equal 0
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "hide notice" do
|
100
|
+
@status_bar_view.y.should.equal 0
|
101
|
+
tap "Hide Notice"
|
102
|
+
wait 0.3 do
|
103
|
+
@status_bar_view.y.should.equal 20
|
104
|
+
end
|
30
105
|
end
|
31
106
|
|
32
107
|
end
|
33
108
|
|
34
109
|
|
35
110
|
|
36
|
-
|
111
|
+
context "B - Multiple clicks" do
|
37
112
|
|
38
|
-
|
113
|
+
it "show success notice three times" do
|
114
|
+
@success_view.y.should.equal 20
|
115
|
+
tap "Show Success"
|
116
|
+
wait 0.3 do
|
117
|
+
tap "Show Success"
|
118
|
+
@success_view.y.should.equal 0
|
119
|
+
end
|
39
120
|
|
40
|
-
|
121
|
+
wait 0.4 do
|
122
|
+
tap "Show Success"
|
123
|
+
@success_view.y.should.equal 0
|
124
|
+
end
|
41
125
|
|
42
|
-
|
126
|
+
wait 0.5 do
|
127
|
+
@success_view.y.should.equal 0
|
128
|
+
end
|
129
|
+
end
|
43
130
|
|
44
|
-
|
131
|
+
it "show success notice twice with different message" do
|
132
|
+
@notice_view.y.should.equal 20
|
133
|
+
tap "Show Notice"
|
134
|
+
wait 0.3 do
|
135
|
+
@notice_view.y.should.equal 0
|
136
|
+
@notice_label.text.should.equal "This is a notice"
|
137
|
+
controller.status_bar.show_notice "This is another notice"
|
138
|
+
end
|
139
|
+
|
140
|
+
wait 0.4 do
|
141
|
+
@notice_view.y.should.equal 0
|
142
|
+
@notice_label.text.should.equal "This is another notice"
|
143
|
+
end
|
144
|
+
end
|
45
145
|
|
46
|
-
|
146
|
+
it "show success, then notice, then error" do
|
147
|
+
@success_view.y.should.equal 20
|
148
|
+
tap "Show Success"
|
149
|
+
wait 0.3 do
|
150
|
+
@success_view.y.should.equal 0
|
151
|
+
tap "Show Notice"
|
152
|
+
end
|
153
|
+
|
154
|
+
wait 0.4 do
|
155
|
+
@notice_view.y.should < 20
|
156
|
+
tap "Show Error"
|
157
|
+
end
|
158
|
+
|
159
|
+
wait 0.5 do
|
160
|
+
@error_view.y.should < 20
|
161
|
+
end
|
162
|
+
end
|
47
163
|
|
48
|
-
|
164
|
+
end
|
49
165
|
|
50
|
-
# end
|
51
166
|
|
52
167
|
end
|
data/status_bar.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: status_bar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Holger Sindbaek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.1.
|
169
|
+
rubygems_version: 2.1.10
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: RubyMotion status bar wrapper.
|