motion-blitz 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +68 -0
- data/lib/motion-blitz.rb +11 -0
- data/lib/project/motion-blitz.rb +66 -0
- metadata +74 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ebb33744ccfe036aa10bbf9a32239717480ce12e
|
4
|
+
data.tar.gz: c4d0cb2a373ac17a0d4728452a35fa1308a87ca2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 042bf80a3023148acc2282a508780ccafb57169b0d3b107e29ddd07f8e450ff77bab445ba44f941dd3d279bf6f189dffb0d1dfbcf81a63ea7ceabefdfb7e6beb
|
7
|
+
data.tar.gz: d6b453a3e855f2d70893351af2a8ceb6d7c4c71ebba63fc54aa43134665de12cf191a36d4e01fe04c567dff373663fe8a51387ddc12854c0c5d000f17f014c7d
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# motion-blitz
|
2
|
+
|
3
|
+
Lightweight RubyMotion wrapper for SVProgressHUD
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
``` ruby
|
8
|
+
Notifier = Motion::Blitz
|
9
|
+
|
10
|
+
Notifier.show
|
11
|
+
Notifier.show('Hold on!')
|
12
|
+
Notifier.show(:black)
|
13
|
+
Notifier.show('Hold on!', :gradient)
|
14
|
+
|
15
|
+
Notifier.loading # 'Loading...'
|
16
|
+
|
17
|
+
Notifier.progress(0.5)
|
18
|
+
Notifier.progress(0.8, 'Almost Done!')
|
19
|
+
Notifier.progress(0.8, :clear)
|
20
|
+
Notifier.progress(0.8, 'Almost Done!', :black)
|
21
|
+
|
22
|
+
Notifier.dismiss
|
23
|
+
|
24
|
+
Notifier.success
|
25
|
+
Notifier.success('All right!')
|
26
|
+
|
27
|
+
Notifier.error
|
28
|
+
Notifier.error('Whoops!')
|
29
|
+
```
|
30
|
+
|
31
|
+
### Masks
|
32
|
+
|
33
|
+
:none # allow user interactions, don't dim background UI (default)
|
34
|
+
:clear # disable user interactions, don't dim background UI
|
35
|
+
:black # disable user interactions, dim background UI with 50% translucent black
|
36
|
+
:gradient # disable user interactions, dim background UI with translucent radial gradient (a-la-alertView)
|
37
|
+
|
38
|
+
## Setup
|
39
|
+
|
40
|
+
If you're using Bundler, add this line to your app's Gemfile:
|
41
|
+
|
42
|
+
gem 'motion-blitz'
|
43
|
+
|
44
|
+
and then run:
|
45
|
+
|
46
|
+
$ bundle install
|
47
|
+
|
48
|
+
Or install it yourself with:
|
49
|
+
|
50
|
+
$ gem install motion-blitz
|
51
|
+
|
52
|
+
and require motion-blitz in your Rakefile
|
53
|
+
|
54
|
+
require 'rubygems'
|
55
|
+
require 'motion-blitz'
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
1. Fork it
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
5. Create new Pull Request
|
64
|
+
|
65
|
+
## Thanks to
|
66
|
+
[Sam Vermette](https://github.com/samvermette) for [SVProgressHUD](https://github.com/samvermette/SVProgressHUD)
|
67
|
+
|
68
|
+
[Parker Selbert](https://github.com/sorentwo) for the [Norweigan-inspired name](https://github.com/dblandin/motion-blitz/blob/master/lib/project/motion-blitz.rb#L2)
|
data/lib/motion-blitz.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise 'This file must be required within a RubyMotion project Rakefile.'
|
3
|
+
end
|
4
|
+
|
5
|
+
lib_dir_path = File.dirname(File.expand_path(__FILE__))
|
6
|
+
Motion::Project::App.setup do |app|
|
7
|
+
app.files += Dir.glob(File.join(lib_dir_path, 'project/**/*.rb'))
|
8
|
+
|
9
|
+
app.pods ||= Motion::Project::CocoaPods.new(app)
|
10
|
+
app.pods.pod 'SVProgressHUD', '~> 0.9'
|
11
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Motion
|
2
|
+
# blitz (fl•ash), verb
|
3
|
+
# 1. Shine in a bright but brief, sudden, or intermittent way
|
4
|
+
# 2. Control the display of temporary messages via SVProgressHUD
|
5
|
+
|
6
|
+
class Blitz
|
7
|
+
MASKS = {
|
8
|
+
none: SVProgressHUDMaskTypeNone,
|
9
|
+
clear: SVProgressHUDMaskTypeClear,
|
10
|
+
black: SVProgressHUDMaskTypeBlack,
|
11
|
+
gradient: SVProgressHUDMaskTypeGradient
|
12
|
+
}
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def show(message_or_mask = nil, mask = :none)
|
16
|
+
if message_or_mask.is_a? Symbol
|
17
|
+
show(nil, message_or_mask)
|
18
|
+
else
|
19
|
+
check_mask(mask)
|
20
|
+
|
21
|
+
hud_class.showWithStatus(message_or_mask, maskType: MASKS[mask])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def progress(progress, message_or_mask = nil, mask = :none)
|
26
|
+
if message_or_mask.is_a? Symbol
|
27
|
+
progress(progress, nil, message_or_mask)
|
28
|
+
else
|
29
|
+
check_mask(mask)
|
30
|
+
|
31
|
+
hud_class.showProgress(progress, status: message_or_mask, maskType: MASKS[mask])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def loading
|
36
|
+
show('Loading...')
|
37
|
+
end
|
38
|
+
|
39
|
+
def dismiss
|
40
|
+
hud_class.dismiss
|
41
|
+
end
|
42
|
+
|
43
|
+
def image(image, message = nil)
|
44
|
+
hud_class.showImage(image, status: message)
|
45
|
+
end
|
46
|
+
|
47
|
+
def success(message = nil)
|
48
|
+
hud_class.showSuccessWithStatus(message)
|
49
|
+
end
|
50
|
+
|
51
|
+
def error(message = nil)
|
52
|
+
hud_class.showErrorWithStatus(message)
|
53
|
+
end
|
54
|
+
|
55
|
+
def hud_class
|
56
|
+
SVProgressHUD
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def check_mask(mask)
|
62
|
+
raise ArgumentError, "mask must be one of #{MASKS.keys}" unless MASKS.keys.include?(mask)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-blitz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Devon Blandin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: motion-cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: RubyMotion wrapper for SVProgressHUD
|
42
|
+
email: dblandin@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- README.md
|
48
|
+
- lib/motion-blitz.rb
|
49
|
+
- lib/project/motion-blitz.rb
|
50
|
+
homepage: http://github.com/dblandin/motion-blitz
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
metadata: {}
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 2.0.0
|
71
|
+
signing_key:
|
72
|
+
specification_version: 4
|
73
|
+
summary: RubyMotion wrapper for SVProgressHUD
|
74
|
+
test_files: []
|