sugarcube 1.4.6 → 1.5.0

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.4.6)
4
+ sugarcube (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -94,4 +94,7 @@ private
94
94
  def restore(*args)
95
95
  SugarCube::Adjust.restore(*args)
96
96
  end
97
+ def blink(*args)
98
+ SugarCube::Adjust.blink(*args)
99
+ end
97
100
  end
@@ -244,6 +244,27 @@ module SugarCube
244
244
  end
245
245
  alias h shadow
246
246
 
247
+ def blink(color = UIColor.redColor)
248
+ raise "no view has been assigned to SugarCube::Adjust::adjust" unless $sugarcube_view
249
+
250
+ blinking_view = UIView.alloc.initWithFrame([[0,0],$sugarcube_view.frame.size])
251
+ color = color.uicolor if color.respond_to?(:uicolor)
252
+ blinking_view.backgroundColor = color
253
+ if $sugarcube_view.window
254
+ blinking_view.frame = $sugarcube_view.convertRect([[0, 0], $sugarcube_view.bounds.size], toView: $sugarcube_view.window)
255
+ $sugarcube_view.window.addSubview(blinking_view)
256
+ else
257
+ $sugarcube_view.addSubview(blinking_view)
258
+ end
259
+ UIView.animateWithDuration(0.2, animations: ->{ blinking_view.alpha = 0 }, completion: ->(finished) do
260
+ UIView.animateWithDuration(0.2, animations: ->{ blinking_view.alpha = 1 }, completion: ->(finished) do
261
+ UIView.animateWithDuration(0.2, animations: ->{ blinking_view.alpha = 0 }, completion: ->(finished) do
262
+ blinking_view.removeFromSuperview
263
+ end)
264
+ end)
265
+ end)
266
+ end
267
+
247
268
  # @param item this can be a tree-like item (UIView, UIViewController,
248
269
  # CALayer) or an integer, in which case it will select that window from
249
270
  # UIApplication.sharedApplication.window. Defalt is to display the
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.4.6'
2
+ Version = '1.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: