prime_sliding_menu 0.1.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.
- checksums.yaml +15 -0
- data/README.md +26 -0
- data/lib/prime_sliding_menu/app_delegate.rb +53 -0
- data/lib/prime_sliding_menu/screen.rb +17 -0
- data/lib/prime_sliding_menu/sidebar_container_screen.rb +74 -0
- data/lib/prime_sliding_menu/version.rb +3 -0
- data/lib/prime_sliding_menu.rb +14 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmRmODgxNGI0MzNlNWM1MzFjZjFiYjZjYWYwYmEyZWM3ODRmYzk0MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjkxODRlNjVkOThkYWRiNWU3ODY5MGFmYTc4NWI4ZmQxMTkxNjM2Mg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2U0MjU1YjJkZWRlNGI0NDNjOTExYzc2ZTFmY2VjNzAxNmE5YTE5ZGY3NWM5
|
10
|
+
ZDk0ZWVjOTZkMDFjOWRjYWRkZTNmZDY0YTEyMjBiMjA4Yjk4NjMyZmU0NDA3
|
11
|
+
YzUzYzEyNmE0ZTU4OGRhNzY0YjdlODgxNDI2NGM3MGVhZWZmMDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWZjZjlkZDI2NDhkNGYyN2ZjY2FlYzg2YWE2MWZlNWE3ZjRkMzlkZTBhZGVi
|
14
|
+
ZWFiNDQxNjg5OTI2YmYyMGM0MTI2NTZhMmU4ZjdhZDczMGZhOGJhMGQ4Zjdk
|
15
|
+
OTRlYTJlNmY2NTVjNzE0ZWFkNGU2MjQ0OTJiMTc0MWMyNzllODA=
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# PrimeSlidingMenu
|
2
|
+
|
3
|
+
ECSlidingViewController 2 integration for MotionPrime.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'prime_sliding_menu'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install prime_sliding_menu
|
18
|
+
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module PrimeSlidingMenu
|
2
|
+
module BaseAppDelegate
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
alias_method :open_screen!, :open_screen
|
7
|
+
def open_screen(screen, options = {})
|
8
|
+
screen = prepare_screen_for_open(screen, options)
|
9
|
+
if sidebar_option = options.delete(:sidebar)
|
10
|
+
sidebar_option = :sidebar if sidebar_option == true
|
11
|
+
sidebar = MotionPrime::Screen.create_with_options(sidebar_option, false, {})
|
12
|
+
open_with_sidebar(screen, sidebar, options)
|
13
|
+
else
|
14
|
+
open_screen!(screen, options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_method :open_content_screen!, :open_content_screen
|
19
|
+
def open_content_screen(screen, options = {})
|
20
|
+
if sidebar?
|
21
|
+
@sidebar_container.content_controller = screen
|
22
|
+
else
|
23
|
+
open_content_screen!(screen)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def sidebar?
|
30
|
+
self.window && self.window.rootViewController.is_a?(SidebarContainerScreen)
|
31
|
+
end
|
32
|
+
|
33
|
+
def show_sidebar
|
34
|
+
@sidebar_container.show_sidebar
|
35
|
+
end
|
36
|
+
|
37
|
+
def hide_sidebar
|
38
|
+
@sidebar_container.hide_sidebar
|
39
|
+
end
|
40
|
+
|
41
|
+
def toggle_sidebar
|
42
|
+
@sidebar_container.toggle_sidebar
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def open_with_sidebar(content, sidebar, options = {})
|
47
|
+
@sidebar_container = SidebarContainerScreen.new(sidebar, content, options)
|
48
|
+
open_root_screen(@sidebar_container)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
MotionPrime::BaseAppDelegate.send :include, PrimeSlidingMenu::BaseAppDelegate
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module PrimeSlidingMenu
|
2
|
+
module Screen
|
3
|
+
def show_sidebar
|
4
|
+
app_delegate.show_sidebar
|
5
|
+
end
|
6
|
+
|
7
|
+
def hide_sidebar
|
8
|
+
app_delegate.hide_sidebar
|
9
|
+
end
|
10
|
+
|
11
|
+
def toggle_sidebar
|
12
|
+
app_delegate.toggle_sidebar
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
MotionPrime::Screen.send :include, PrimeSlidingMenu::Screen
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module PrimeSlidingMenu
|
2
|
+
class SidebarContainerScreen < ECSlidingViewController
|
3
|
+
include ::MotionPrime::ScreenBaseMixin
|
4
|
+
|
5
|
+
def self.new(menu, content, options = {})
|
6
|
+
screen = self.alloc.initWithTopViewController(nil)
|
7
|
+
screen.on_create(options.merge(navigation: false)) if screen.respond_to?(:on_create)
|
8
|
+
screen.menu_controller = menu unless menu.nil?
|
9
|
+
screen.content_controller = content unless content.nil?
|
10
|
+
screen.content_controller.view.addGestureRecognizer screen.panGesture
|
11
|
+
screen.setAnchorRightRevealAmount 260.0
|
12
|
+
screen
|
13
|
+
end
|
14
|
+
|
15
|
+
def show_sidebar
|
16
|
+
self.anchorTopViewToRightAnimated(false)
|
17
|
+
end
|
18
|
+
|
19
|
+
def hide_sidebar
|
20
|
+
self.resetTopViewAnimated(false)
|
21
|
+
end
|
22
|
+
|
23
|
+
def toggle_sidebar
|
24
|
+
if self.currentTopViewPosition == 2
|
25
|
+
show_sidebar
|
26
|
+
else
|
27
|
+
hide_sidebar
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def menu_controller=(c)
|
32
|
+
self.underLeftViewController = prepare_controller(c)
|
33
|
+
end
|
34
|
+
|
35
|
+
def content_controller=(c)
|
36
|
+
controller = prepare_controller(c)
|
37
|
+
if should_reinit_content?(controller)
|
38
|
+
self.topViewController = controller
|
39
|
+
else
|
40
|
+
content_controller.viewControllers = [controller]
|
41
|
+
end
|
42
|
+
hide_sidebar
|
43
|
+
end
|
44
|
+
|
45
|
+
def menu_controller
|
46
|
+
self.underLeftViewController
|
47
|
+
end
|
48
|
+
|
49
|
+
def content_controller
|
50
|
+
self.topViewController
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def should_reinit_content?(new_controller)
|
56
|
+
content_controller.nil? ||
|
57
|
+
content_controller.is_a?(MotionPrime::TabBarController) ||
|
58
|
+
new_controller.is_a?(MotionPrime::TabBarController)
|
59
|
+
end
|
60
|
+
|
61
|
+
def prepare_controller(controller)
|
62
|
+
controller = setup_screen_for_open(controller, {})
|
63
|
+
if should_reinit_content?(controller)
|
64
|
+
controller.wrap_in_navigation if controller.respond_to?(:wrap_in_navigation)
|
65
|
+
controller.send(:on_screen_load) if controller.respond_to?(:on_screen_load)
|
66
|
+
controller = controller.main_controller if controller.respond_to?(:main_controller)
|
67
|
+
else
|
68
|
+
controller.navigation_controller = content_controller if controller.respond_to?(:navigation_controller)
|
69
|
+
controller.send(:on_screen_load) if controller.respond_to?(:on_screen_load)
|
70
|
+
end
|
71
|
+
controller
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'motion-cocoapods'
|
2
|
+
require 'motion-prime'
|
3
|
+
|
4
|
+
unless defined?(Motion::Project::Config)
|
5
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
6
|
+
end
|
7
|
+
|
8
|
+
Motion::Require.all(Dir.glob(File.expand_path('../prime_sliding_menu/**/*.rb', __FILE__)))
|
9
|
+
|
10
|
+
Motion::Project::App.setup do |app|
|
11
|
+
app.pods do
|
12
|
+
pod 'ECSlidingViewController', "2.0.0-beta2"
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prime_sliding_menu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Iskander Haziev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: motion-cocoapods
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: motion-require
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ECSlidingViewController 2 integration for MotionPrime.
|
56
|
+
email:
|
57
|
+
- gvalmon@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/prime_sliding_menu/app_delegate.rb
|
63
|
+
- lib/prime_sliding_menu/screen.rb
|
64
|
+
- lib/prime_sliding_menu/sidebar_container_screen.rb
|
65
|
+
- lib/prime_sliding_menu/version.rb
|
66
|
+
- lib/prime_sliding_menu.rb
|
67
|
+
- README.md
|
68
|
+
homepage: ''
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.0.5
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: ECSlidingViewController 2 integration for MotionPrime.
|
92
|
+
test_files: []
|