tgios 0.0.11 → 0.0.12
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 +8 -8
- data/Gemfile.lock +1 -1
- data/lib/tgios/common_ui_utility.rb +9 -0
- data/lib/tgios/extended_ui_table_view.rb +1 -6
- data/lib/tgios/loading_indicator.rb +45 -30
- data/lib/tgios/photo_scroll_view.rb +30 -16
- data/lib/tgios/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzg1YmIyZmExYmQyMDJmNDQ4NWNiOTRlYWU2YmQ0ZjZhZWViYWY5NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Nzk4YTI2OTNlOWJiMmIyM2Y0MmU0MDdlOGQ2ODliMGEzM2M2NmMxOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDA0MDYzODc2MzI5ZGEyNWNiOTc3OGZhZDNhZGRkZmM0ODgzY2YwM2EyZDdh
|
10
|
+
ZjM3ZTdmYWM1MmQzMzY0YWJiMWI0MTk5Mzk4YTI3ZGMyNzQxM2JhN2RiYWUy
|
11
|
+
NGMyZDZhODRiMjdlYzM2NmY1MDlkMzlkYmI4YmQyZjY0ZWFmNTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGEwYmVkOGMyNjY3YjdjMGM3MzYwZGVhNzExNDFlM2MzM2Q2YTYwZDUyN2My
|
14
|
+
NzU3MGNjOWE5MTdiMmU0Y2I4MzE2N2EyMTViYmRmMThiNDJlMzcxZTE5NzAz
|
15
|
+
NmJjZjZhMTZmYzY1YzFhMmYxMTdhNGZkNzMzYzg1N2ZiYWJiOTM=
|
data/Gemfile.lock
CHANGED
@@ -26,5 +26,14 @@ module Tgios
|
|
26
26
|
normalized_image
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
def self.add_full_subview(super_view, subview)
|
31
|
+
Motion::Layout.new do |l|
|
32
|
+
l.view super_view
|
33
|
+
l.subviews 'subview' => subview
|
34
|
+
l.vertical '|[subview]|'
|
35
|
+
l.horizontal '|[subview]|'
|
36
|
+
end
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end
|
@@ -5,12 +5,7 @@ module Tgios
|
|
5
5
|
def add_full_table_view_to(view, style=:grouped)
|
6
6
|
style ||= :plain
|
7
7
|
table = UITableView.send(style)
|
8
|
-
|
9
|
-
l.view view
|
10
|
-
l.subviews 'table' => table
|
11
|
-
l.vertical '|[table]|'
|
12
|
-
l.horizontal '|[table]|'
|
13
|
-
end
|
8
|
+
CommonUIUtility.add_full_subview(view, table)
|
14
9
|
table
|
15
10
|
end
|
16
11
|
|
@@ -1,47 +1,62 @@
|
|
1
1
|
include PlasticCup
|
2
2
|
module Tgios
|
3
|
-
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
class LoadingView < UIView
|
4
|
+
def initWithFrame(frame)
|
5
|
+
if super
|
6
|
+
self.hidden = true
|
7
|
+
base_view = Base.style(UIView.new, backgroundColor: :black.uicolor, alpha: 0.5)
|
8
|
+
|
9
|
+
@indicator = UIActivityIndicatorView.large
|
10
|
+
[{super_view: self, subview: base_view}, {super_view: self, subview: @indicator}].each do |hash|
|
11
|
+
CommonUIUtility.add_full_subview(hash[:super_view], hash[:subview])
|
12
|
+
end
|
13
|
+
@label = Base.style(UILabel.new,
|
14
|
+
frame: self.bounds,
|
15
|
+
font: lambda {UIFont.systemFontOfSize(22)},
|
16
|
+
textAlignment: :center.uialignment,
|
17
|
+
backgroundColor: :clear.uicolor,
|
18
|
+
textColor: :white.uicolor)
|
19
|
+
@label.sizeToFit
|
13
20
|
Motion::Layout.new do |l|
|
14
|
-
l.view
|
15
|
-
l.subviews '
|
16
|
-
l.vertical '
|
17
|
-
l.horizontal '
|
21
|
+
l.view self
|
22
|
+
l.subviews 'label' => @label
|
23
|
+
l.vertical '[label]-290-|'
|
24
|
+
l.horizontal '|-20-[label]-20-|'
|
18
25
|
end
|
19
26
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Motion::Layout.new do |l|
|
28
|
-
l.view @loading_view
|
29
|
-
l.subviews 'label' => @label
|
30
|
-
l.vertical '[label]-290-|'
|
31
|
-
l.horizontal '|-20-[label]-20-|'
|
32
|
-
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.add_loading_view_to(view)
|
31
|
+
loading_view = LoadingView.alloc.initWithFrame(view.bounds)
|
32
|
+
CommonUIUtility.add_full_subview(view, loading_view)
|
33
|
+
loading_view
|
33
34
|
end
|
34
35
|
|
35
36
|
def start_loading(text='')
|
36
37
|
@label.text = text
|
37
|
-
self.
|
38
|
-
@loading_view.hidden = false
|
38
|
+
self.hidden = false
|
39
39
|
@indicator.startAnimating
|
40
40
|
end
|
41
41
|
|
42
42
|
def stop_loading
|
43
|
-
|
43
|
+
self.hidden = true
|
44
44
|
@indicator.stopAnimating
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
module LoadingIndicator
|
49
|
+
def add_loading_indicator_to(view)
|
50
|
+
@loading_view = LoadingView.add_loading_view_to(view)
|
51
|
+
end
|
52
|
+
|
53
|
+
def start_loading(text='')
|
54
|
+
self.view.endEditing(true)
|
55
|
+
@loading_view.start_loading(text)
|
56
|
+
end
|
57
|
+
|
58
|
+
def stop_loading
|
59
|
+
@loading_view.stop_loading
|
60
|
+
end
|
61
|
+
end
|
47
62
|
end
|
@@ -1,17 +1,31 @@
|
|
1
1
|
module Tgios
|
2
2
|
class PhotoScrollView < UIScrollView
|
3
|
+
attr_accessor :image
|
3
4
|
MAX_SCALE = 4.0
|
4
5
|
|
6
|
+
def init
|
7
|
+
if super
|
8
|
+
self.showsVerticalScrollIndicator = false
|
9
|
+
self.showsHorizontalScrollIndicator = false
|
10
|
+
self.bouncesZoom = true
|
11
|
+
self.decelerationRate = UIScrollViewDecelerationRateFast
|
12
|
+
self.delegate = self
|
13
|
+
self.backgroundColor = :clear.uicolor
|
14
|
+
end
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
5
18
|
def initWithFrame(frame, image: image)
|
6
|
-
|
7
|
-
|
8
|
-
self.
|
9
|
-
self.showsHorizontalScrollIndicator = false
|
10
|
-
self.bouncesZoom = true
|
11
|
-
self.decelerationRate = UIScrollViewDecelerationRateFast
|
12
|
-
self.delegate = self
|
13
|
-
self.backgroundColor = :clear.uicolor
|
19
|
+
init
|
20
|
+
self.frame = frame
|
21
|
+
self.image = image
|
14
22
|
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def image=(image)
|
27
|
+
super
|
28
|
+
frame = self.frame
|
15
29
|
page_rect = CGRectMake(0, 0, image.size.width, image.size.height)
|
16
30
|
|
17
31
|
img_scale = frame.size.width / page_rect.size.width
|
@@ -30,21 +44,21 @@ module Tgios
|
|
30
44
|
|
31
45
|
self.maximumZoomScale = MAX_SCALE / img_scale
|
32
46
|
self.minimumZoomScale = fit_scale / img_scale
|
33
|
-
|
34
|
-
self
|
35
47
|
end
|
36
48
|
|
37
49
|
def layoutSubviews
|
38
50
|
super
|
51
|
+
unless @image_view.nil?
|
52
|
+
bsize = self.bounds.size
|
53
|
+
center_frame = @image_view.frame
|
39
54
|
|
40
|
-
|
41
|
-
|
55
|
+
center_frame.origin.x = center_frame.size.width < bsize.width ? (bsize.width - center_frame.size.width) / 2.0 : 0
|
56
|
+
center_frame.origin.y = center_frame.size.height < bsize.height ? (bsize.height - center_frame.size.height) / 2.0 : 0
|
42
57
|
|
43
|
-
|
44
|
-
|
58
|
+
@image_view.frame = center_frame
|
59
|
+
@image_view.contentScaleFactor = 1.0
|
45
60
|
|
46
|
-
|
47
|
-
@image_view.contentScaleFactor = 1.0
|
61
|
+
end
|
48
62
|
|
49
63
|
end
|
50
64
|
|
data/lib/tgios/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tgios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- April Tsang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sugarcube
|