motion-prime 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/ROADMAP.md +3 -0
  5. data/files/Gemfile +1 -1
  6. data/lib/motion-prime.rb +1 -1
  7. data/motion-prime/api_client.rb +7 -5
  8. data/motion-prime/elements/_content_text_mixin.rb +14 -4
  9. data/motion-prime/elements/_text_mixin.rb +6 -2
  10. data/motion-prime/elements/base_element.rb +37 -12
  11. data/motion-prime/elements/button.rb +1 -1
  12. data/motion-prime/elements/draw.rb +6 -0
  13. data/motion-prime/elements/draw/_draw_background_mixin.rb +33 -2
  14. data/motion-prime/elements/draw/image.rb +9 -5
  15. data/motion-prime/elements/draw/label.rb +1 -1
  16. data/motion-prime/elements/label.rb +1 -1
  17. data/motion-prime/helpers/has_normalizer.rb +2 -1
  18. data/motion-prime/helpers/has_style_options.rb +16 -0
  19. data/motion-prime/helpers/has_styles.rb +5 -1
  20. data/motion-prime/models/_association_mixin.rb +17 -2
  21. data/motion-prime/models/_base_mixin.rb +5 -1
  22. data/motion-prime/models/_dirty_mixin.rb +1 -1
  23. data/motion-prime/models/_nano_bag_mixin.rb +18 -5
  24. data/motion-prime/models/_sync_mixin.rb +3 -3
  25. data/motion-prime/models/_timestamps_mixin.rb +3 -3
  26. data/motion-prime/sections/_draw_section_mixin.rb +20 -3
  27. data/motion-prime/sections/_section_with_container_mixin.rb +1 -1
  28. data/motion-prime/sections/abstract_collection.rb +6 -2
  29. data/motion-prime/sections/base_section.rb +6 -6
  30. data/motion-prime/sections/collection/collection_delegate.rb +6 -4
  31. data/motion-prime/sections/form/base_field_section.rb +8 -0
  32. data/motion-prime/sections/page_view.rb +19 -5
  33. data/motion-prime/sections/page_view/page_view_delegate.rb +19 -6
  34. data/motion-prime/sections/table/refresh_mixin.rb +1 -1
  35. data/motion-prime/sections/table/table_delegate.rb +6 -4
  36. data/motion-prime/styles/base.rb +1 -1
  37. data/motion-prime/support/consts.rb +6 -1
  38. data/motion-prime/support/mp_table_view.rb +4 -4
  39. data/motion-prime/version.rb +1 -1
  40. data/motion-prime/views/styles.rb +1 -1
  41. data/motion-prime/views/view_builder.rb +9 -5
  42. data/motion-prime/views/view_styler.rb +16 -15
  43. metadata +37 -36
@@ -14,7 +14,7 @@ module MotionPrime
14
14
  custom_offset_threshold: - collection_view.contentInset.top - refresh_view.size.height,
15
15
  original_top_inset: collection_view.contentInset.top
16
16
  }
17
- screen.set_options_for refresh_view, base_options.merge(options)
17
+ screen.set_options_for refresh_view, base_options.deep_merge(options)
18
18
  end
19
19
 
20
20
  def finish_pull_to_refresh
@@ -5,13 +5,14 @@ module MotionPrime
5
5
 
6
6
  def initialize(options)
7
7
  self.table_section = options[:section].try(:weak_ref)
8
+ @_section_info = table_section.to_s
8
9
  @section_instance = table_section.to_s
9
10
  end
10
11
 
11
- # def dealloc
12
- # pp 'Deallocating table_delegate for ', @section_instance
13
- # super
14
- # end
12
+ def dealloc
13
+ Prime.logger.dealloc_message :collection_delegate, @_section_info
14
+ super
15
+ end
15
16
 
16
17
  def init_pull_to_refresh
17
18
  return unless block = table_section.class.pull_to_refresh_block
@@ -60,6 +61,7 @@ module MotionPrime
60
61
 
61
62
  def scrollViewDidScroll(scroll)
62
63
  table_section.scroll_view_did_scroll(scroll)
64
+ table_section.update_pull_to_refresh_after_scroll(scroll)
63
65
  end
64
66
 
65
67
  def scrollViewWillBeginDragging(scroll)
@@ -11,7 +11,7 @@ MotionPrime::Styles.define :base do
11
11
  left: 0,
12
12
  right: 0,
13
13
  bottom: 0,
14
- separator_inset: 0
14
+ separator_inset: [0,0]
15
15
 
16
16
  style :collection,
17
17
  top: 0,
@@ -8,4 +8,9 @@ UIControlContentHorizontalAlignmentFill
8
8
  UIControlContentVerticalAlignmentCenter
9
9
  UIControlContentVerticalAlignmentTop
10
10
  UIControlContentVerticalAlignmentBottom
11
- UIControlContentVerticalAlignmentFill
11
+ UIControlContentVerticalAlignmentFill
12
+
13
+ if defined?(ALAssetsLibrary)
14
+ ALAuthorizationStatusNotDetermined
15
+ ALAssetsGroupAll
16
+ end
@@ -1,6 +1,6 @@
1
1
  class MPTableView < UITableView
2
- # def dealloc
3
- # pp 'Deallocating table view', self.to_s
4
- # super
5
- # end
2
+ def dealloc
3
+ Prime.logger.dealloc_message :view, self.to_s
4
+ super
5
+ end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -70,7 +70,7 @@ module MotionPrime
70
70
 
71
71
  def extend_and_normalize_options(options = {})
72
72
  style_options = self.for(options.delete(:styles))
73
- normalize_options(style_options.merge(options))
73
+ normalize_options(style_options.deep_merge(options))
74
74
  end
75
75
  end
76
76
  end
@@ -64,12 +64,16 @@ module MotionPrime
64
64
  image = options.delete(:image)
65
65
  highlighted_image = options.delete(:highlighted_image)
66
66
 
67
- if !image.nil? && !highlighted_image.nil?
68
- klass.alloc.initWithImage image.uiimage, highlightedImage: highlighted_image.uiimage
69
- elsif !image.nil?
70
- klass.alloc.initWithImage image.uiimage
71
- else
67
+ if image.nil?
72
68
  klass.alloc.initWithFrame CGRectZero
69
+ else
70
+ image = image.uiimage
71
+ image = image.imageWithRenderingMode(2) if options[:tint_color].present?
72
+ if highlighted_image.nil?
73
+ klass.alloc.initWithImage image.uiimage
74
+ else
75
+ klass.alloc.initWithImage image.uiimage, highlightedImage: highlighted_image.uiimage
76
+ end
73
77
  end
74
78
  },
75
79
  'UIProgressView' => Proc.new{|klass, options|
@@ -4,10 +4,11 @@ module MotionPrime
4
4
  include HasStyles
5
5
  include HasClassFactory
6
6
  include ElementTextMixin
7
+ include HasStyleOptions
7
8
 
8
9
  ORDER = %w[
9
10
  frame
10
- font placeholder_font text title_label title
11
+ font text title_label title
11
12
  minimum_value maximum_value value
12
13
  ]
13
14
 
@@ -57,13 +58,12 @@ module MotionPrime
57
58
 
58
59
  if options.slice(:html, :line_spacing, :line_height, :underline, :fragment_color).any?
59
60
  text_options = extract_attributed_text_options(options)
60
-
61
61
  html = text_options.delete(:html)
62
62
  text_options[:text] = html if html
63
63
  options[:attributed_text] = html ? html_string(text_options) : attributed_string(text_options)
64
64
 
65
65
  # ios 7 bug fix when text is invisible
66
- if text_options.slice(:line_height, :line_spacing, :text_alignment, :line_break_mode).any? && options.fetch(:number_of_lines, 1) == 1
66
+ if view.is_a?(UILabel) && text_options.slice(:line_height, :line_spacing, :text_alignment, :line_break_mode).any? && options.fetch(:number_of_lines, 1) == 1
67
67
  options[:number_of_lines] = 0
68
68
  end
69
69
  end
@@ -79,32 +79,29 @@ module MotionPrime
79
79
 
80
80
  def extract_font_options(options, prefix = nil)
81
81
  key = [prefix, 'font'].compact.join('_').to_sym
82
- name_key = [prefix, 'font_name'].compact.join('_').to_sym
83
- size_key = [prefix, 'font_size'].compact.join('_').to_sym
84
- if options.slice(size_key, name_key).any?
85
- font_name = options.delete(name_key) || :system
86
- font_size = options.delete(size_key) || 14
87
- options[key] ||= font_name.uifont(font_size)
88
- end
82
+ options[key] = extract_font_from(options, prefix)
89
83
  end
90
84
 
91
85
  def extract_attributed_text_options(options)
92
86
  text_attributes = [
93
87
  :text, :html, :line_spacing, :line_height, :underline, :fragment_color,
94
- :text_alignment, :font, :line_break_mode, :number_of_lines
88
+ :text_alignment, :font, :font_name, :font_size, :line_break_mode, :number_of_lines, :text_color
95
89
  ]
96
90
  attributed_text_options = options.slice(*text_attributes)
91
+ exclude_attributes = text_attributes
97
92
  if view.is_a?(UIButton)
93
+ attributed_text_options[:text_color] ||= options[:title_color]
98
94
  attributed_text_options[:text] ||= options[:title]
95
+ exclude_attributes.delete(:line_break_mode)
99
96
  end
100
- options.except!(*text_attributes)
97
+ options.except!(*exclude_attributes)
101
98
  attributed_text_options
102
99
  end
103
100
 
104
101
  def set_option(key, value)
105
102
  # return if value.nil?
106
103
  # ignore options
107
- return if ignore_option?(key)
104
+ return if ignore_option?(key) || value.nil?
108
105
 
109
106
  # apply options
110
107
  result ||= set_color_options(key, value)
@@ -220,14 +217,17 @@ module MotionPrime
220
217
  mask_path = UIBezierPath.bezierPathWithRoundedRect(layer_bounds, byRoundingCorners: corners, cornerRadii: CGSizeMake(radius, radius))
221
218
  mask_layer = CAShapeLayer.layer
222
219
 
223
-
224
220
  mask_layer.frame = layer_bounds
225
221
  mask_layer.path = mask_path.CGPath
226
222
  view.mask = mask_layer
227
223
 
228
224
  if value[:border_color] && value[:border_width]
229
225
  stroke_layer = CAShapeLayer.layer
230
- stroke_layer.path = mask_path.CGPath
226
+ unless value[:sides]
227
+ stroke_layer.path = mask_path.CGPath
228
+ else # suuport sides
229
+ stroke_layer.path = mask_path.CGPath
230
+ end
231
231
  stroke_layer.fillColor = :clear.uicolor.cgcolor
232
232
  stroke_layer.strokeColor = value[:border_color].uicolor.cgcolor
233
233
  stroke_layer.lineWidth = value[:border_width].to_f*2 # another half is hidden by the mask
@@ -277,6 +277,7 @@ module MotionPrime
277
277
  width height top right bottom left
278
278
  max_width max_outer_width min_width min_outer_width
279
279
  max_height max_outer_height min_height min_outer_width
280
+ font_name font_size placeholder_font_name placeholder_font_size placeholder_font
280
281
  bounds
281
282
  ].include?(key.to_s)
282
283
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -9,202 +9,202 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-18 00:00:00.000000000 Z
12
+ date: 2014-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: motion-stump
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: motion-redgreen
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: cocoapods
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: motion-cocoapods
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: motion-require
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: motion-support
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
104
  version: 0.2.6
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: 0.2.6
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: bubble-wrap
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.6.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ~>
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: 1.6.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: sugarcube
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ~>
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
132
  version: 1.6.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ~>
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: 1.6.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: afmotion
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ~>
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
146
  version: 2.1.0
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - ~>
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
153
  version: 2.1.0
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: methadone
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '>='
158
+ - - ">="
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - '>='
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rm-digest
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - '>='
172
+ - - ">="
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  type: :runtime
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - '>='
179
+ - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  - !ruby/object:Gem::Dependency
183
183
  name: thor
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - '>='
186
+ - - ">="
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - '>='
193
+ - - ">="
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: activesupport
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - '>='
200
+ - - ">="
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  type: :runtime
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - '>='
207
+ - - ">="
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  description: RubyMotion apps development framework
@@ -215,9 +215,9 @@ executables:
215
215
  extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
- - .gitignore
219
- - .travis.yml
220
- - .yardopts
218
+ - ".gitignore"
219
+ - ".travis.yml"
220
+ - ".yardopts"
221
221
  - CHANGELOG.md
222
222
  - Gemfile
223
223
  - Gemfile.lock
@@ -299,6 +299,7 @@ files:
299
299
  - motion-prime/helpers/has_normalizer.rb
300
300
  - motion-prime/helpers/has_search_bar.rb
301
301
  - motion-prime/helpers/has_style_chain_builder.rb
302
+ - motion-prime/helpers/has_style_options.rb
302
303
  - motion-prime/helpers/has_styles.rb
303
304
  - motion-prime/models/_association_mixin.rb
304
305
  - motion-prime/models/_base_mixin.rb
@@ -432,17 +433,17 @@ require_paths:
432
433
  - lib
433
434
  required_ruby_version: !ruby/object:Gem::Requirement
434
435
  requirements:
435
- - - '>='
436
+ - - ">="
436
437
  - !ruby/object:Gem::Version
437
438
  version: '0'
438
439
  required_rubygems_version: !ruby/object:Gem::Requirement
439
440
  requirements:
440
- - - '>='
441
+ - - ">="
441
442
  - !ruby/object:Gem::Version
442
443
  version: '0'
443
444
  requirements: []
444
445
  rubyforge_project:
445
- rubygems_version: 2.0.6
446
+ rubygems_version: 2.2.2
446
447
  signing_key:
447
448
  specification_version: 4
448
449
  summary: RubyMotion apps development framework