ruby_motion_query 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rmq +2 -2
- data/motion/ruby_motion_query/event.rb +7 -4
- data/motion/ruby_motion_query/rect.rb +26 -2
- data/motion/ruby_motion_query/stylers/ui_button_styler.rb +43 -0
- data/motion/ruby_motion_query/stylers/ui_text_view_styler.rb +1 -0
- data/motion/ruby_motion_query/traverse.rb +11 -0
- data/motion/ruby_motion_query/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36206f4aa5851fc94846f652c572a70611c553e3
|
4
|
+
data.tar.gz: 3094ad46a32906503f7a131b9721bdd413ffe5d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7fd7969a95296f5d3c21c3a556812c71378b03ec657e8059443841b660249f15de0397788727cdd42166ca1e26eeae1db8fbec1d0c6c997575d64703ac0b3c1
|
7
|
+
data.tar.gz: c9e7d776bedfab71771c1df803950dd91edbbae2e3a24b7020967c7fb588b3ff5da932f9ba3138b1ac0910951ee51dad8ec48e11b2b935212b0b1ea79a6c5b6f
|
data/bin/rmq
CHANGED
@@ -57,7 +57,7 @@ class RmqCommandLine
|
|
57
57
|
def create_app(app_name)
|
58
58
|
puts ' Creating app'
|
59
59
|
|
60
|
-
`motion create --template=
|
60
|
+
`motion create --template=https://github.com/infinitered/rmq-template.git #{app_name}`
|
61
61
|
|
62
62
|
puts %{
|
63
63
|
Complete. Things you should do:
|
@@ -89,7 +89,7 @@ class RmqCommandLine
|
|
89
89
|
# TODO Disabling for now, this needs to get latest template
|
90
90
|
def ensure_template_dir
|
91
91
|
return if Dir.exists?(template_dir)
|
92
|
-
`git clone
|
92
|
+
`git clone https://github.com/infinitered/rmq-template.git #{template_dir}`
|
93
93
|
end
|
94
94
|
|
95
95
|
def template_path(template_name)
|
@@ -20,17 +20,20 @@ module RubyMotionQuery
|
|
20
20
|
@block = block
|
21
21
|
|
22
22
|
if @gesture
|
23
|
-
@recognizer = @sdk_event_or_recognizer.alloc.initWithTarget(self, action: :
|
23
|
+
@recognizer = @sdk_event_or_recognizer.alloc.initWithTarget(self, action: "handle_gesture_or_event:")
|
24
24
|
@sender.addGestureRecognizer(@recognizer)
|
25
25
|
else
|
26
|
-
@sender.addTarget(self, action: :
|
26
|
+
@sender.addTarget(self, action: "handle_gesture_or_event:", forControlEvents: @sdk_event_or_recognizer)
|
27
27
|
end
|
28
28
|
else
|
29
29
|
raise "[RMQ Error] Invalid event or gesture or invalid sender (#{event}). Example of use: button.on(:touch) { my_code }"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def handle_gesture_or_event
|
33
|
+
def handle_gesture_or_event(gesture)
|
34
|
+
# Don't fire :long_press events twice.
|
35
|
+
return if @sdk_event_or_recognizer == VIEW_GESTURES[:long_press] && gesture.state == UIGestureRecognizerStateEnded
|
36
|
+
|
34
37
|
# Handle debounce logic
|
35
38
|
if @debounce_length
|
36
39
|
return if (@debounce_stamp + @debounce_length > Time.now)
|
@@ -108,7 +111,7 @@ module RubyMotionQuery
|
|
108
111
|
if self.gesture?
|
109
112
|
@sender.removeGestureRecognizer(@recognizer)
|
110
113
|
else
|
111
|
-
@sender.removeTarget(self, action: :
|
114
|
+
@sender.removeTarget(self, action: "handle_gesture_or_event:", forControlEvents: @sdk_event_or_recognizer)
|
112
115
|
end
|
113
116
|
end
|
114
117
|
end
|
@@ -202,19 +202,30 @@ module RubyMotionQuery
|
|
202
202
|
params_t = params[:t] || params[:top] || params[:y]
|
203
203
|
params_w = params[:w] || params[:width]
|
204
204
|
params_h = params[:h] || params[:height]
|
205
|
+
params_r = params[:r] || params[:right]
|
206
|
+
params_b = params[:b] || params[:bottom]
|
205
207
|
|
206
208
|
below_prev = params[:below_prev] || params[:bp] || params[:below_previous]
|
207
209
|
above_prev = params[:above_prev] || params[:ap] || params[:above_previous]
|
208
210
|
right_of_prev = params[:right_of_prev] || params[:rop] || params[:right_of_previous]
|
209
211
|
left_of_prev = params[:left_of_prev] || params[:lop] || params[:left_of_previous]
|
210
212
|
|
213
|
+
if sv
|
214
|
+
params_l = value_from_symbol(params_l, sv.frame.size.width) if params_l.is_a?(Symbol)
|
215
|
+
params_t = value_from_symbol(params_t, sv.frame.size.height) if params_t.is_a?(Symbol)
|
216
|
+
params_w = value_from_symbol(params_w, sv.frame.size.width) if params_w.is_a?(Symbol)
|
217
|
+
params_h = value_from_symbol(params_h, sv.frame.size.height) if params_h.is_a?(Symbol)
|
218
|
+
params_r = value_from_symbol(params_r, sv.frame.size.width) if params_r.is_a?(Symbol)
|
219
|
+
params_b = value_from_symbol(params_b, sv.frame.size.height) if params_b.is_a?(Symbol)
|
220
|
+
end
|
221
|
+
|
211
222
|
l = params_l || existing_rect.origin.x
|
212
223
|
t = params_t || existing_rect.origin.y
|
213
224
|
w = params_w || existing_rect.size.width
|
214
225
|
h = params_h || existing_rect.size.height
|
215
226
|
|
216
|
-
r =
|
217
|
-
b =
|
227
|
+
r = params_r
|
228
|
+
b = params_b
|
218
229
|
|
219
230
|
fr = params[:from_right] || params[:fr]
|
220
231
|
fb = params[:from_bottom] || params[:fb]
|
@@ -360,6 +371,19 @@ module RubyMotionQuery
|
|
360
371
|
[l,t,w,h]
|
361
372
|
end
|
362
373
|
|
374
|
+
def value_from_symbol(size_symbol, max_value)
|
375
|
+
case size_symbol
|
376
|
+
when :full
|
377
|
+
max_value
|
378
|
+
when :half
|
379
|
+
max_value * 0.5
|
380
|
+
when :quarter
|
381
|
+
max_value * 0.25
|
382
|
+
else
|
383
|
+
puts "\n[RMQ ERROR] width symbol #{size_symbol} can't be parsed.\n\n"
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
363
387
|
end # << self
|
364
388
|
|
365
389
|
def initialize(params, view = nil, grid = nil)
|
@@ -33,6 +33,13 @@ module RubyMotionQuery
|
|
33
33
|
@view.titleColorForState(UIControlStateHighlighted)
|
34
34
|
end
|
35
35
|
|
36
|
+
def color_disabled=(value)
|
37
|
+
@view.setTitleColor(value, forState: UIControlStateDisabled)
|
38
|
+
end
|
39
|
+
def color_disabled
|
40
|
+
@view.titleColorForState(UIControlStateDisabled)
|
41
|
+
end
|
42
|
+
|
36
43
|
def tint_color=(value)
|
37
44
|
@view.tintColor = value
|
38
45
|
end
|
@@ -56,6 +63,13 @@ module RubyMotionQuery
|
|
56
63
|
@view.imageForState(UIControlStateHighlighted)
|
57
64
|
end
|
58
65
|
|
66
|
+
def image_disabled=(value)
|
67
|
+
@view.setImage(value, forState: UIControlStateDisabled)
|
68
|
+
end
|
69
|
+
def image_disabled
|
70
|
+
@view.imageForState(UIControlStateDisabled)
|
71
|
+
end
|
72
|
+
|
59
73
|
def background_image_normal=(value)
|
60
74
|
@view.setBackgroundImage(value, forState: UIControlStateNormal)
|
61
75
|
end
|
@@ -79,6 +93,13 @@ module RubyMotionQuery
|
|
79
93
|
@view.backgroundImageForState(UIControlStateSelected)
|
80
94
|
end
|
81
95
|
|
96
|
+
def background_image_disabled=(value)
|
97
|
+
@view.setBackgroundImage(value, forState: UIControlStateDisabled)
|
98
|
+
end
|
99
|
+
def background_image_disabled
|
100
|
+
@view.backgroundImageForState(UIControlStateDisabled)
|
101
|
+
end
|
102
|
+
|
82
103
|
def adjust_image_when_highlighted=(value)
|
83
104
|
@view.adjustsImageWhenHighlighted = value
|
84
105
|
end
|
@@ -87,6 +108,14 @@ module RubyMotionQuery
|
|
87
108
|
@view.adjustsImageWhenHighlighted
|
88
109
|
end
|
89
110
|
|
111
|
+
def adjust_image_when_disabled=(value)
|
112
|
+
@view.adjustsImageWhenDisabled = value
|
113
|
+
end
|
114
|
+
|
115
|
+
def adjust_image_when_disabled
|
116
|
+
@view.adjustsImageWhenDisabled
|
117
|
+
end
|
118
|
+
|
90
119
|
def selected=(value)
|
91
120
|
@view.setSelected(value)
|
92
121
|
end
|
@@ -135,6 +164,20 @@ module RubyMotionQuery
|
|
135
164
|
@view.attributedTitleForState(UIControlStateHighlighted)
|
136
165
|
end
|
137
166
|
|
167
|
+
def text_disabled=(value)
|
168
|
+
@view.setTitle(value, forState:UIControlStateDisabled)
|
169
|
+
end
|
170
|
+
def text_disabled
|
171
|
+
@view.titleForState(UIControlStateDisabled)
|
172
|
+
end
|
173
|
+
|
174
|
+
def attributed_text_disabled=(value)
|
175
|
+
@view.setAttributedTitle(value, forState: UIControlStateDisabled)
|
176
|
+
end
|
177
|
+
def attributed_text_disabled
|
178
|
+
@view.attributedTitleForState(UIControlStateDisabled)
|
179
|
+
end
|
180
|
+
|
138
181
|
end
|
139
182
|
end
|
140
183
|
end
|
@@ -154,6 +154,17 @@ module RubyMotionQuery
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
+
|
158
|
+
# Same as find, but instantly returns the view, or array of views without using .get
|
159
|
+
#
|
160
|
+
# @param selectors
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# rmq(my_view).find!(UIButton)
|
164
|
+
def find!(*working_selectors)
|
165
|
+
find(*working_selectors).get
|
166
|
+
end
|
167
|
+
|
157
168
|
# @return [RMQ] Instance selecting the children of the selected view(s)
|
158
169
|
#
|
159
170
|
# @param selectors
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_motion_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Werth
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bacon
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.4.
|
150
|
+
rubygems_version: 2.4.6
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: RubyMotionQuery - RMQ
|