motion-accessibility 2.0 → 2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a8b8a68fde38c107500ee9ba7391df3cf22d7a6
4
- data.tar.gz: e979abc551392f9dede8c3dbf88199f70b1c34ff
3
+ metadata.gz: 8191afe48954322a4032c1578c7ab842648de5e3
4
+ data.tar.gz: c00d8d340dedd93993e9043f31fd5417eb7fbbd1
5
5
  SHA512:
6
- metadata.gz: b97f12b278ea3522bd242c8ee9c94bcae1f67cbf5e17ba4ff87839ccd2997bc73164f3524e879b574ef6e770b42e849524276efd0399d1a85334a9104e960479
7
- data.tar.gz: 356842305034eb08ce3a4f49aebd4166e7c9156069295d636c9371f43c237143d6a148016e2bf2579dc2fb356bb93ffdf2f31ad370d3fbdc2f16b81b14ff0e26
6
+ metadata.gz: a4fc7b9f31787c4b43680c9bc7427928cf6ce9330e3ab27c4a59787fb56a18b2980ddb76d09305209cec64f647d9dba830b3b7d24409bde206fbbea106d41161
7
+ data.tar.gz: 98058f0d3e877cf4c9834f12030486fc88791747c6a80960ed5ab690b99db06ef82cd778c7528e3768d34ba18d4002aec6ac7431d1f7cf238445edd17551f55c
data/README.md CHANGED
@@ -116,6 +116,7 @@ Accessibility value: nil
116
116
  Accessibility language: nil
117
117
  Accessibility frame: x=0.0 y=0.0 width=100.0 height=100.0
118
118
  Accessibility activation point: x=0.0 y=0.0
119
+ Accessibility path: nil
119
120
  Accessibility view is modal: false
120
121
  Should group accessibility children: false
121
122
  Accessibility elements hidden: false
@@ -238,6 +239,10 @@ The frame of the accessibility element. This defaults to the frame of the view.
238
239
 
239
240
  The point activated when a VoiceOver user activates the view by double tapping it. This defaults to the center of the view. In other words, a VoiceOver can double-tap anywhere on the screen, but it will simulate a sighted user touching the center of the view.
240
241
 
242
+ #### `accessibility_path`
243
+
244
+ If nil, the default, VoiceOver uses the `accessibility_frame` to highlight the element. If set, it will use the path. This method accepts a `UIBezierPath`.
245
+
241
246
  #### `accessibility_modal_view?` or `accessibility_view_is_modal`
242
247
 
243
248
  Ignores elements within views which are siblings of the receiver. If you present a modal view and want VoiceOver to ignore other views on the screen, set this to true.
@@ -270,6 +275,10 @@ Accepts an integer and returns the accessibility hint for the component.
270
275
 
271
276
  These methods trigger when the VoiceOver user performs specific actions. You can implement then in a UIView or an accessibility element.
272
277
 
278
+ #### `accessibility_activate`
279
+
280
+ New in iOS 7, this method performs a custom action when a VoiceOver double-taps the view. You can use this if the view uses a custom gesture, for example. It returns true or false depending on the success of the action.
281
+
273
282
  #### `accessibility_perform_escape`
274
283
 
275
284
  VoiceOver has a special two-finger scrub gesture designed to act as a back button. The standard back button of a UINavigationController implements this method. It dismisses a modal view, and returns the success or failure of the action. For example, you could use this to dismiss a popover.
@@ -430,6 +439,14 @@ Additionally, these two methods relate to the Zoom screen magnification software
430
439
  This notifies Zoom that an app's focus has changed. It takes a zoom type described above, a frame, and the view containing the frame.
431
440
  #### `Accessibility.register_gesture_conflicts_with_zoom`
432
441
  This issues a dialog to the user when a three-fingered gesture conflicts with Zoom. It lets them choose to disable Zoom or continue.
442
+
443
+ ### Speech Attributes
444
+
445
+ iOS 7 adds some speech attributes to use in attributed strings. To get them, just call the `speech_attribute` method on the following symbols.
446
+ - `:punctuation`
447
+ - `:language`
448
+ - `:pitch`
449
+
433
450
  ## contributing
434
451
 
435
452
 
@@ -17,6 +17,8 @@ Attributes = {
17
17
  :accessibility_frame= => :setAccessibilityFrame,
18
18
  :accessibility_activation_point => :accessibilityActivationPoint,
19
19
  :accessibility_activation_point= => :setAccessibilityActivationPoint,
20
+ :accessibility_path => :accessibilityPath,
21
+ :accessibility_path= => :setAccessibilityPath,
20
22
  :accessibility_view_is_modal => :accessibilityViewIsModal,
21
23
  :accessibility_view_is_modal= => :setAccessibilityViewIsModal,
22
24
  :accessibility_modal_view? => :accessibilityViewIsModal,
@@ -78,6 +80,16 @@ causes_page_turn: UIAccessibilityTraitCausesPageTurn,
78
80
  not_enabled: UIAccessibilityTraitNotEnabled
79
81
  }
80
82
 
83
+ if UIDevice.currentDevice.systemVersion.to_f>=7.0
84
+ Speech_Attributes = {
85
+ :punctuation => UIAccessibilitySpeechAttributePunctuation,
86
+ :language => UIAccessibilitySpeechAttributeLanguage,
87
+ :pitch => UIAccessibilitySpeechAttributePitch
88
+ }
89
+ else
90
+ Speech_Attributes={}
91
+ end
92
+
81
93
  PickerView_Attributes = {
82
94
  :accessibility_label_for_component => :accessibilityLabelForComponent,
83
95
  :accessibility_abel_for_component= => :setAccessibilityLabelForComponent,
@@ -103,7 +115,8 @@ Actions = {
103
115
  :accessibility_increment => :accessibilityIncrement,
104
116
  :accessibility_perform_escape => :accessibilityPerformEscape,
105
117
  :accessibility_perform_magic_tap => :accessibilityPerformMagicTap,
106
- :accessibility_scroll => :accessibilityScroll
118
+ :accessibility_scroll => :accessibilityScroll,
119
+ :accessibility_activate => :accessibilityActivate
107
120
  }
108
121
 
109
122
  All_Attributes=Attributes.merge(Container_Attributes).merge(Reading_Content).merge(Actions)
@@ -155,6 +168,7 @@ Attribute_Types = {
155
168
  :accessibilityLanguage=>:string,
156
169
  :accessibilityFrame=>:cgrect,
157
170
  :accessibilityActivationPoint=>:cgpoint,
171
+ :accessibilityPath => :uibezierpath,
158
172
  :accessibilityViewIsModal=>:boolean,
159
173
  :shouldGroupAccessibilityChildren=>:boolean,
160
174
  :accessibilityElementsHidden=>:boolean,
@@ -236,6 +250,10 @@ def accessibility_zoom_type
236
250
  Accessibility::Zoom[self]||(raise("Unknown zoom type #{self}"))
237
251
  end
238
252
 
253
+ def speech_attribute
254
+ Accessibility::Speech_Attributes[self]||(raise "Unknown speech attribute #{self}")
255
+ end
256
+
239
257
  end
240
258
 
241
259
  A11y=Accessibility unless defined?(A11y)
@@ -27,14 +27,19 @@ begin
27
27
  case attribute
28
28
  when :accessibilityTraits then value=inspect_accessibility_traits
29
29
  else
30
- value=self.send(attribute).inspect
30
+ value=self.send(attribute)
31
31
  end
32
+ if value
32
33
  case Accessibility.attribute_type(attribute)
33
34
  when :boolean
34
35
  value=true if value==1
35
36
  value=false if value==0||value.nil?
36
- when :cgrect then value="x=#{self.origin.x} y=#{self.origin.y} width=#{self.size.width} height=#{self.size.height}"
37
- when :cgpoint then value="x=#{self.origin.x} y=#{self.origin.y}"
37
+ when :cgrect then value="x=#{value.origin.x.round(1)} y=#{value.origin.y.round(1)} width=#{value.size.width.round(1)} height=#{value.size.height.round(1)}"
38
+ when :cgpoint then value="x=#{value.x.round(1)} y=#{value.y.round(1)}"
39
+ when :uibezierpath then value="x=#{value.bounds.origin.x.round(1)} y=#{value.bounds.origin.y.round(1)} width=#{value.bounds.size.width.round(1)} height=#{value.bounds.size.height.round(1)}"
40
+ end
41
+ else
42
+ value="nil"
38
43
  end
39
44
  rescue
40
45
  value="Error: #{$!}"
@@ -2,6 +2,7 @@
2
2
  class NSObject
3
3
 
4
4
  Accessibility::Attributes.each do |ruby, ios|
5
+ next unless self.respond_to?(ios)
5
6
  next if ruby==:accessibility_traits=
6
7
  if ruby=~/=$/
7
8
  define_method(ruby) {|value| self.send(ios,value)}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-accessibility
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Seraphin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  requirements: []
66
66
  rubyforge_project:
67
- rubygems_version: 2.0.6
67
+ rubygems_version: 2.0.3
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: This gem provides easy ruby-like wrappers around the protocols which interact