ruby_motion_query 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/motion/ruby_motion_query/actions.rb +1 -1
- data/motion/ruby_motion_query/animations.rb +26 -1
- data/motion/ruby_motion_query/app.rb +7 -1
- data/motion/ruby_motion_query/base.rb +4 -0
- data/motion/ruby_motion_query/color.rb +3 -7
- data/motion/ruby_motion_query/data.rb +6 -0
- data/motion/ruby_motion_query/device.rb +10 -1
- data/motion/ruby_motion_query/events.rb +13 -2
- data/motion/ruby_motion_query/font.rb +3 -3
- data/motion/ruby_motion_query/image.rb +1 -1
- data/motion/ruby_motion_query/rect.rb +4 -0
- data/motion/ruby_motion_query/stylers/ui_text_field_styler.rb +1 -1
- data/motion/ruby_motion_query/stylers/ui_view_styler.rb +5 -0
- data/motion/ruby_motion_query/stylesheet.rb +11 -0
- data/motion/ruby_motion_query/version.rb +1 -1
- metadata +3 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f671d2796fc4aff7e4d887b96f0264e77f2325a1
|
4
|
+
data.tar.gz: 86fdf864c95877496ec43b14a5eb151b1a74a4f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f58e497f9f38d112c473e329ea51a83e229fab1b4a5a9b27cd1a0df39204dbe581e5d174f59971bfa2f52197a39f22862a62acc449c65439692e68453441ad
|
7
|
+
data.tar.gz: e25c918eb3455eec499c009f577f318f883e7439db5b9cb93706b34432eb77090144c85475fe2d7ef146277eb7a3c96ba5d64b233391f7746ea48dd50417bf90
|
@@ -51,7 +51,7 @@ module RubyMotionQuery
|
|
51
51
|
when UIButton then view.titleForState(UIControlStateNormal)
|
52
52
|
when UIImageView then view.image
|
53
53
|
#when UITableView then
|
54
|
-
|
54
|
+
when UISwitch then view.on?
|
55
55
|
#when UIDatePicker then
|
56
56
|
#when UISegmentedControl then
|
57
57
|
#when UIRefreshControl then
|
@@ -128,6 +128,29 @@ module RubyMotionQuery
|
|
128
128
|
out
|
129
129
|
end
|
130
130
|
|
131
|
+
# @return [RMQ]
|
132
|
+
def sink(opts = {})
|
133
|
+
opts = {
|
134
|
+
duration: 0.4,
|
135
|
+
animations: ->(cq) {
|
136
|
+
cq.style {|st| st.scale = 1.0}
|
137
|
+
}
|
138
|
+
}.merge(opts)
|
139
|
+
|
140
|
+
out = @rmq.animate(
|
141
|
+
duration: opts[:duration_out] || 0.1,
|
142
|
+
animations: ->(q) {
|
143
|
+
q.style {|st| st.scale = 0.9}
|
144
|
+
},
|
145
|
+
completion: ->(did_finish, completion_rmq) {
|
146
|
+
if did_finish
|
147
|
+
completion_rmq.animate(opts)
|
148
|
+
end
|
149
|
+
}
|
150
|
+
)
|
151
|
+
out
|
152
|
+
end
|
153
|
+
|
131
154
|
# @return [RMQ]
|
132
155
|
def sink_and_throb(opts = {})
|
133
156
|
opts = {
|
@@ -220,7 +243,8 @@ module RubyMotionQuery
|
|
220
243
|
duration: 0.5,
|
221
244
|
options: UIViewAnimationOptionCurveEaseIn,
|
222
245
|
before: ->(bq) {
|
223
|
-
|
246
|
+
bq.hide
|
247
|
+
start_frame = bq.get.frame.dup
|
224
248
|
|
225
249
|
case from_direction
|
226
250
|
when :right
|
@@ -232,6 +256,7 @@ module RubyMotionQuery
|
|
232
256
|
else :bottom
|
233
257
|
bq.move(t: rmq.device.height)
|
234
258
|
end
|
259
|
+
bq.show
|
235
260
|
start_frame
|
236
261
|
},
|
237
262
|
animations: ->(aq, return_var) {
|
@@ -121,10 +121,16 @@ module RubyMotionQuery
|
|
121
121
|
def current_view_controller(root_view_controller = nil)
|
122
122
|
if root_view_controller || ((window = RMQ.app.window) && (root_view_controller = window.rootViewController))
|
123
123
|
case root_view_controller
|
124
|
+
when UIMoreNavigationController # This must be above UINavigationController because it's a subclass
|
125
|
+
root_view_controller.visibleViewController
|
124
126
|
when UINavigationController
|
125
127
|
current_view_controller(root_view_controller.visibleViewController)
|
126
128
|
when UITabBarController
|
127
|
-
|
129
|
+
if root_view_controller.viewControllers.count > 5 && root_view_controller.selectedIndex >= 4
|
130
|
+
current_view_controller(root_view_controller.moreNavigationController)
|
131
|
+
else
|
132
|
+
current_view_controller(root_view_controller.selectedViewController)
|
133
|
+
end
|
128
134
|
else
|
129
135
|
if root_view_controller.respond_to?(:visibleViewController)
|
130
136
|
current_view_controller(root_view_controller.visibleViewController)
|
@@ -161,13 +161,9 @@ module RubyMotionQuery
|
|
161
161
|
|
162
162
|
def self.from_base_color(values)
|
163
163
|
base = values[:base] || values[:color]
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
rescue
|
168
|
-
r, g, b, a = Pointer.new('f'), Pointer.new('f'), Pointer.new('f'), Pointer.new('f')
|
169
|
-
base.getRed(r, green: g, blue: b, alpha: a)
|
170
|
-
end
|
164
|
+
type = CGSize.type[/(f|d)/]
|
165
|
+
r, g, b, a = Pointer.new(type), Pointer.new(type), Pointer.new(type), Pointer.new(type)
|
166
|
+
base.getRed(r, green: g, blue: b, alpha: a)
|
171
167
|
|
172
168
|
r = values[:r] || values[:red] || r.value
|
173
169
|
g = values[:g] || values[:green] || g.value
|
@@ -64,6 +64,12 @@ module RubyMotionQuery
|
|
64
64
|
styles[0] = value
|
65
65
|
end
|
66
66
|
|
67
|
+
# view.rmq_data.styles = [:something]
|
68
|
+
# Convenience method for setting the entire styles variable
|
69
|
+
def styles=(s)
|
70
|
+
@_styles = Array(s)
|
71
|
+
end
|
72
|
+
|
67
73
|
#view.rmq_data.styles
|
68
74
|
def styles
|
69
75
|
@_styles ||= []
|
@@ -90,7 +90,9 @@ module RubyMotionQuery
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def simulator?
|
93
|
-
|
93
|
+
if @_simulator.nil?
|
94
|
+
@_simulator = !(UIDevice.currentDevice.name.downcase =~ /simulator/).nil?
|
95
|
+
end
|
94
96
|
@_simulator
|
95
97
|
end
|
96
98
|
|
@@ -114,6 +116,11 @@ module RubyMotionQuery
|
|
114
116
|
@_five_point_five_inch
|
115
117
|
end
|
116
118
|
|
119
|
+
def twelve_point_nine_inch?
|
120
|
+
@_twelve_point_nine_inch = (Device.height == 1366.0) if @_twelve_point_nine_inch.nil?
|
121
|
+
@_twelve_point_nine_inch
|
122
|
+
end
|
123
|
+
|
117
124
|
def retina?
|
118
125
|
if @_retina.nil?
|
119
126
|
main_screen = Device.screen
|
@@ -190,6 +197,8 @@ module RubyMotionQuery
|
|
190
197
|
puts "screen size: 4\""
|
191
198
|
elsif three_point_five_inch?
|
192
199
|
puts "screen size: 3.5\""
|
200
|
+
elsif twelve_point_nine_inch?
|
201
|
+
puts "screen size: 12.9\""
|
193
202
|
end
|
194
203
|
end
|
195
204
|
|
@@ -106,9 +106,20 @@ module RubyMotionQuery
|
|
106
106
|
self
|
107
107
|
end
|
108
108
|
|
109
|
-
def trigger(
|
109
|
+
def trigger(event_name)
|
110
110
|
selected.each do |view|
|
111
|
-
|
111
|
+
event = events(view)[event_name]
|
112
|
+
|
113
|
+
if event
|
114
|
+
case event.block.arity
|
115
|
+
when 2
|
116
|
+
event.block.call(view, event)
|
117
|
+
when 1
|
118
|
+
event.block.call(view)
|
119
|
+
else
|
120
|
+
event.block.call
|
121
|
+
end
|
122
|
+
end
|
112
123
|
end
|
113
124
|
|
114
125
|
self
|
@@ -25,10 +25,10 @@ module RubyMotionQuery
|
|
25
25
|
#
|
26
26
|
#
|
27
27
|
# # Another way is to add named fonts:
|
28
|
-
# RubyMotionQuery::Font.
|
28
|
+
# RubyMotionQuery::Font.add_named :large, STANDARD_FONT, 44
|
29
29
|
#
|
30
30
|
# # In a stylesheet you can just do
|
31
|
-
# font.
|
31
|
+
# font.add_named :large, STANDARD_FONT, 44
|
32
32
|
#
|
33
33
|
# # The use like so in your stylesheet:
|
34
34
|
# font = font.large
|
@@ -75,7 +75,7 @@ module RubyMotionQuery
|
|
75
75
|
#
|
76
76
|
# @example
|
77
77
|
# font = rmq.font.system(18)
|
78
|
-
def system(size =
|
78
|
+
def system(size = UIFont.systemFontSize)
|
79
79
|
UIFont.systemFontOfSize(size)
|
80
80
|
end
|
81
81
|
|
@@ -17,7 +17,7 @@ module RubyMotionQuery
|
|
17
17
|
|
18
18
|
# @return [UIImage]
|
19
19
|
def resource_for_device(file_base_name, opts = {})
|
20
|
-
ext = if RMQ.device.five_point_five_inch?
|
20
|
+
ext = if RMQ.device.five_point_five_inch? || RMQ.device.ipad?
|
21
21
|
"-736h"
|
22
22
|
elsif RMQ.device.four_point_seven_inch?
|
23
23
|
"-667h"
|
@@ -368,6 +368,10 @@ module RubyMotionQuery
|
|
368
368
|
t = root_view_point.y
|
369
369
|
end
|
370
370
|
|
371
|
+
if rmq.app.development? && (w <= 0 || h <= 0)
|
372
|
+
puts "#{view.rmq_data.style_name}: One or more values in your frame is a negative or zero. If this is unexpected, check your styles.\nFrame values: {l: #{l}, t: #{t}, w: #{w}, h: #{h}}"
|
373
|
+
end
|
374
|
+
|
371
375
|
[l,t,w,h]
|
372
376
|
end
|
373
377
|
|
@@ -67,7 +67,7 @@ module RubyMotionQuery
|
|
67
67
|
|
68
68
|
# managing overlay views
|
69
69
|
def clear_button_mode ; view.clearButtonMode ; end
|
70
|
-
def clear_button_mode=(v) ; view.clearButtonMode = v ; end
|
70
|
+
def clear_button_mode=(v) ; view.clearButtonMode = TEXT_FIELD_MODES[v] || v ; end
|
71
71
|
|
72
72
|
def left_view ; view.leftView ; end
|
73
73
|
def left_view=(v) ; view.leftView = v ; end
|
@@ -387,6 +387,11 @@ module RubyMotionQuery
|
|
387
387
|
end
|
388
388
|
def shadow_opacity ; @view.layer.shadowOpacity ; end
|
389
389
|
|
390
|
+
def shadow_radius=(radius)
|
391
|
+
@view.layer.shadowRadius = radius
|
392
|
+
end
|
393
|
+
def shadow_radius ; @view.layer.shadowRadius ; end
|
394
|
+
|
390
395
|
def shadow_path=(path)
|
391
396
|
@view.layer.shadowPath = path
|
392
397
|
end
|
@@ -55,6 +55,13 @@ module RubyMotionQuery
|
|
55
55
|
end
|
56
56
|
alias :remove_styles :remove_style
|
57
57
|
|
58
|
+
def remove_all_styles
|
59
|
+
selected.each do |view|
|
60
|
+
view.rmq_data.styles = nil
|
61
|
+
end
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
58
65
|
# Pass a block to apply styles, an inline way of applynig a style
|
59
66
|
# @example
|
60
67
|
# rmq(view).style{|st| st.background_color = rmq.color.blue}
|
@@ -283,6 +290,10 @@ module RubyMotionQuery
|
|
283
290
|
device.five_point_five_inch?
|
284
291
|
end
|
285
292
|
|
293
|
+
def twelve_point_nine_inch?
|
294
|
+
device.twelve_point_nine_inch?
|
295
|
+
end
|
296
|
+
|
286
297
|
def retina?
|
287
298
|
device.retina?
|
288
299
|
end
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Werth
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bacon
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: rake
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
134
|
version: '0'
|
149
135
|
requirements: []
|
150
136
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.4.
|
137
|
+
rubygems_version: 2.4.5.1
|
152
138
|
signing_key:
|
153
139
|
specification_version: 4
|
154
140
|
summary: RubyMotionQuery - RMQ
|
155
141
|
test_files: []
|
156
|
-
has_rdoc:
|