motion-flow 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 962f2ae3a417c8249553f522c53ef2d3e8b39be7
4
- data.tar.gz: fb7db38ffc2658ba797663fa81e5e9c1f27d5baf
3
+ metadata.gz: a1fc583f1f2d9aafab67995dccc00855398e73e8
4
+ data.tar.gz: 4be8562c6388b93da40411fc72d6564487bea763
5
5
  SHA512:
6
- metadata.gz: 0297471465a02c8acb39c841f8ab27fea76e67563dab435feb52fbe29845edbdef50c2847599b099de4a821ce9c09f9813fd8a59fe58931f2ef14a2e81d14edf
7
- data.tar.gz: 18fc13cbdf9dc56b73c70fdfad852465b06a3953a82e5d09c6e8e22ad902425301b6ea4a3e24047ea753f5d4ce88fc454ac186a497e071868e36ec3fb4911d33
6
+ metadata.gz: 12f7ce6ce0010fc01c2b2d3264e096a2d184befa990bba2057121e9a300299b96d850e6647d89c35d9a0f11c099792d15a3b8058cfccb92ab8c039169ac93033
7
+ data.tar.gz: af8d5ad2d8fd996a0af286d80b2bbd02d363556a0c6e02445e3a902fb9ef434faca02b7b19f91812d7c4457bf3f58b66e5b5cf1b1b6fb0339a0be75a8349af0a
@@ -12,6 +12,8 @@ end
12
12
 
13
13
  module UI
14
14
  class View < CSSNode
15
+ attr_accessor :_previous_width, :_previous_height
16
+
15
17
  def background_color
16
18
  view = proxy.getBackground
17
19
  view.is_a?(Android::Graphics::Drawable::ColorDrawable) ? UI::Color(view.getColor) : nil
@@ -26,7 +28,19 @@ module UI
26
28
  end
27
29
 
28
30
  def hidden=(value)
31
+ if hidden
32
+ self._previous_width = self.width
33
+ self._previous_height = self.height
34
+ self.width = 0
35
+ self.height = 0
36
+ else
37
+ self.width = self._previous_width
38
+ self.height = self._previous_height
39
+ end
40
+
29
41
  proxy.visibility = value ? Android::View::View::INVISIBLE : Android::View::View::VISIBLE
42
+
43
+ self.root.update_layout
30
44
  end
31
45
 
32
46
  def alpha
@@ -53,6 +67,10 @@ module UI
53
67
  _apply_layout
54
68
  end
55
69
 
70
+ def proxy
71
+ @proxy ||= Android::Widget::FrameLayout.new(UI.context)
72
+ end
73
+
56
74
  def _apply_layout
57
75
  if params = proxy.layoutParams
58
76
  left, top, width, height = layout
@@ -80,9 +98,5 @@ module UI
80
98
  end
81
99
  end
82
100
  end
83
-
84
- def proxy
85
- @proxy ||= Android::Widget::FrameLayout.new(UI.context)
86
- end
87
101
  end
88
102
  end
@@ -6,6 +6,8 @@ module UI
6
6
  linear: UIViewAnimationOptionCurveLinear
7
7
  }
8
8
 
9
+ attr_accessor :_previous_width, :_previous_height
10
+
9
11
  def animate(options = {}, &block)
10
12
  animation_options = options.fetch(:options, :linear)
11
13
 
@@ -57,7 +59,19 @@ module UI
57
59
  end
58
60
 
59
61
  def hidden=(hidden)
62
+ if hidden
63
+ self._previous_width = self.width
64
+ self._previous_height = self.height
65
+ self.width = 0
66
+ self.height = 0
67
+ else
68
+ self.width = self._previous_width
69
+ self.height = self._previous_height
70
+ end
71
+
60
72
  proxy.hidden = hidden
73
+
74
+ self.root.update_layout
61
75
  end
62
76
 
63
77
  def alpha
@@ -84,6 +98,14 @@ module UI
84
98
  _apply_layout([0, 0], proxy.frame.origin)
85
99
  end
86
100
 
101
+ def proxy
102
+ @proxy ||= begin
103
+ ui_view = UIView.alloc.init
104
+ ui_view.translatesAutoresizingMaskIntoConstraints = false
105
+ ui_view
106
+ end
107
+ end
108
+
87
109
  def _apply_layout(absolute_point, origin_point)
88
110
  left, top, width, height = layout
89
111
 
@@ -96,13 +118,5 @@ module UI
96
118
 
97
119
  children.each { |x| x._apply_layout(absolute_point, [0, 0]) }
98
120
  end
99
-
100
- def proxy
101
- @proxy ||= begin
102
- ui_view = UIView.alloc.init
103
- ui_view.translatesAutoresizingMaskIntoConstraints = false
104
- ui_view
105
- end
106
- end
107
121
  end
108
122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - HipByte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-14 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  motion-flow allows you to write cross-platform