prime_reside_menu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +26 -0
- data/lib/prime_reside_menu/app_delegate.rb +50 -0
- data/lib/prime_reside_menu/screen.rb +13 -0
- data/lib/prime_reside_menu/sidebar_container_screen.rb +79 -0
- data/lib/prime_reside_menu/version.rb +3 -0
- data/lib/prime_reside_menu.rb +14 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzgzOTRhZjAzY2ZmNTY1NDE3Y2ZlODc1ZjJjMzU1MGUxMTljNTBkYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2Q3ZGJlOGUxYzZiZDExYWIwNjhkODE2ZTJlMjY3NDVjYTdhMjg4YQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjE4MTczMjVmN2M5OThiMjlhYjFiNzIxMjRkNzA3Y2ZkZDU5MTdkYzg0MzEz
|
10
|
+
MTRhM2U3OGI0OGI1ZmQ2YjY5NmEyYTBmZmVjYWM5NjY1ODM4NTA5NWQ0NzQ5
|
11
|
+
ZDY2ZWZlYTYzMzkyYWQ1OTFjZTEzZmExYjM0NTljMWFlMjg1MGI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODZiNjVlY2U5MDZkMjQwNTg4NDcxMDhkMjIyYzk2YmZmNWE5ODBlYWU0NmQz
|
14
|
+
NWI0OWY1MDFiNWI3ZjNkYWUyMTkxNGE4NDJlZTJiMGE5ZmNiMTIwNGE5ZmVm
|
15
|
+
NTg1YjRlODIwY2Y4YzAzOTcxM2IwM2Y4YThhYzRiMjI1MTEwYzc=
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Prime::Reside::Menu
|
2
|
+
|
3
|
+
RESideMenu integration for MotionPrime.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'prime_reside_menu'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install prime-reside-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,50 @@
|
|
1
|
+
module PrimeResideMenu
|
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
|
+
private
|
42
|
+
def open_with_sidebar(content, sidebar, options = {})
|
43
|
+
@sidebar_container = SidebarContainerScreen.new(sidebar, content, options)
|
44
|
+
@sidebar_container.delegate = self
|
45
|
+
open_root_screen(@sidebar_container)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
MotionPrime::BaseAppDelegate.send :include, PrimeResideMenu::BaseAppDelegate
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module PrimeResideMenu
|
2
|
+
class SidebarContainerScreen < RESideMenu
|
3
|
+
include ::MotionPrime::ScreenBaseMixin
|
4
|
+
|
5
|
+
def self.new(menu, content, options = {})
|
6
|
+
screen = self.alloc.initWithContentViewController(nil, menuViewController: nil)
|
7
|
+
screen.parallaxEnabled = false
|
8
|
+
|
9
|
+
full_width = UIScreen.mainScreen.bounds.size.width
|
10
|
+
|
11
|
+
if scale = options[:content_scale_value]
|
12
|
+
screen.contentViewScaleValue = scale
|
13
|
+
end
|
14
|
+
x_offset = options[:x_offset] || 45
|
15
|
+
screen.contentViewInPortraitOffsetCenterX = full_width*(1 + screen.contentViewScaleValue/2) - x_offset
|
16
|
+
|
17
|
+
if y_offset = options[:y_offset]
|
18
|
+
screen.contentViewInPortraitOffsetCenterY = UIScreen.mainScreen.bounds.size.height/2 + y_offset
|
19
|
+
end
|
20
|
+
|
21
|
+
screen.on_create(options.merge(navigation: false)) if screen.respond_to?(:on_create)
|
22
|
+
screen.menu_controller = menu unless menu.nil?
|
23
|
+
screen.content_controller = content unless content.nil?
|
24
|
+
|
25
|
+
screen
|
26
|
+
end
|
27
|
+
|
28
|
+
def show_sidebar
|
29
|
+
self.presentMenuViewController
|
30
|
+
end
|
31
|
+
|
32
|
+
def hide_sidebar
|
33
|
+
self.hideMenuViewController
|
34
|
+
end
|
35
|
+
|
36
|
+
def menu_controller=(c)
|
37
|
+
self.setMenuViewController prepare_controller(c)
|
38
|
+
end
|
39
|
+
|
40
|
+
def content_controller=(c)
|
41
|
+
controller = prepare_controller(c)
|
42
|
+
if should_reinit_content?(controller)
|
43
|
+
self.setContentViewController controller
|
44
|
+
else
|
45
|
+
content_controller.viewControllers = [controller]
|
46
|
+
end
|
47
|
+
hide_sidebar
|
48
|
+
end
|
49
|
+
|
50
|
+
def menu_controller
|
51
|
+
self.menuViewController
|
52
|
+
end
|
53
|
+
|
54
|
+
def content_controller
|
55
|
+
self.contentViewController
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def should_reinit_content?(new_controller)
|
61
|
+
content_controller.nil? ||
|
62
|
+
content_controller.is_a?(MotionPrime::TabBarController) ||
|
63
|
+
new_controller.is_a?(MotionPrime::TabBarController)
|
64
|
+
end
|
65
|
+
|
66
|
+
def prepare_controller(controller)
|
67
|
+
controller = setup_screen_for_open(controller, {})
|
68
|
+
if should_reinit_content?(controller)
|
69
|
+
controller.wrap_in_navigation if controller.respond_to?(:wrap_in_navigation)
|
70
|
+
controller.send(:on_screen_load) if controller.respond_to?(:on_screen_load)
|
71
|
+
controller = controller.main_controller if controller.respond_to?(:main_controller)
|
72
|
+
else
|
73
|
+
controller.navigation_controller = content_controller if controller.respond_to?(:navigation_controller)
|
74
|
+
controller.send(:on_screen_load) if controller.respond_to?(:on_screen_load)
|
75
|
+
end
|
76
|
+
controller
|
77
|
+
end
|
78
|
+
end
|
79
|
+
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_reside_menu/**/*.rb', __FILE__)))
|
9
|
+
|
10
|
+
Motion::Project::App.setup do |app|
|
11
|
+
app.pods do
|
12
|
+
pod 'RESideMenu', git: 'git@github.com:droidlabs/RESideMenu.git'
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prime_reside_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: RESideMenu integration for MotionPrime.
|
56
|
+
email:
|
57
|
+
- gvalmon@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/prime_reside_menu/app_delegate.rb
|
63
|
+
- lib/prime_reside_menu/screen.rb
|
64
|
+
- lib/prime_reside_menu/sidebar_container_screen.rb
|
65
|
+
- lib/prime_reside_menu/version.rb
|
66
|
+
- lib/prime_reside_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: RESideMenu integration for MotionPrime.
|
92
|
+
test_files: []
|