Module: ProMotion::Menu::Visibility

Included in:
Drawer
Defined in:
lib/ProMotion/menu/visibility.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/ProMotion/menu/visibility.rb', line 34

def self.included(base)
  base.class_eval do
    alias_method :max_left_width, :maximumLeftDrawerWidth
    alias_method :max_right_width, :maximumRightDrawerWidth

    alias_method :max_left_width=, :setMaximumLeftDrawerWidth
    alias_method :max_right_width=, :setMaximumRightDrawerWidth
  end
end

Instance Method Details

#hide(animated = true) ⇒ Object



17
18
19
# File 'lib/ProMotion/menu/visibility.rb', line 17

def hide(animated=true)
  closeDrawerAnimated animated, completion: default_completion_block
end

#show(side, animated = true) ⇒ Object



4
5
6
7
# File 'lib/ProMotion/menu/visibility.rb', line 4

def show(side, animated=true)
  self.show_left(animated) if side == :left
  self.show_right(animated) if side == :right
end

#show_left(animated = true) ⇒ Object



9
10
11
# File 'lib/ProMotion/menu/visibility.rb', line 9

def show_left(animated=true)
  openDrawerSide MMDrawerSideLeft, animated: animated, completion: default_completion_block
end

#show_right(animated = true) ⇒ Object



13
14
15
# File 'lib/ProMotion/menu/visibility.rb', line 13

def show_right(animated=true)
  openDrawerSide MMDrawerSideRight, animated: animated, completion: default_completion_block
end

#toggle(side, animated = true) ⇒ Object



21
22
23
24
# File 'lib/ProMotion/menu/visibility.rb', line 21

def toggle(side, animated=true)
  toggle_left(animated) if side == :left
  toggle_right(animated) if side == :right
end

#toggle_left(animated = true) ⇒ Object



26
27
28
# File 'lib/ProMotion/menu/visibility.rb', line 26

def toggle_left(animated=true)
  toggleDrawerSide MMDrawerSideLeft, animated: animated, completion: default_completion_block
end

#toggle_right(animated = true) ⇒ Object



30
31
32
# File 'lib/ProMotion/menu/visibility.rb', line 30

def toggle_right(animated=true)
  toggleDrawerSide MMDrawerSideRight, animated: animated, completion: default_completion_block
end