Module: MotionPrime::ScreenIndicatorsMixin

Included in:
Screen
Defined in:
motion-prime/screens/extensions/_indicators_mixin.rb

Instance Method Summary collapse

Instance Method Details

#hide_activity_indicatorObject



12
13
14
15
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 12

def hide_activity_indicator
  return unless @activity_indicator_view
  @activity_indicator_view.stopAnimating
end

#hide_progress_indicator(animated = true) ⇒ Object



32
33
34
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 32

def hide_progress_indicator(animated = true)
  @progress_indicator_view.try(:hide, animated)
end

#hide_spinnerObject



56
57
58
59
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 56

def hide_spinner
  spinner_element.hide
  spinner_message_element.hide
end

#show_activity_indicatorObject



3
4
5
6
7
8
9
10
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 3

def show_activity_indicator
  if @activity_indicator_view.nil?
    @activity_indicator_view = UIActivityIndicatorView.gray
    @activity_indicator_view.center = CGPointMake(view.center.x, view.center.y)
    view.addSubview @activity_indicator_view
  end
  @activity_indicator_view.startAnimating
end

#show_notice(message, time = 1.0, type = :notice) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 36

def show_notice(message, time = 1.0, type = :notice)
  hud_type = case type.to_s
  when 'alert' then MBAlertViewHUDTypeExclamationMark
  else MBAlertViewHUDTypeCheckmark
  end

  unless time === false
    MBHUDView.hudWithBody(message, type: hud_type, hidesAfter: time, show: true)
  end
end

#show_progress_indicator(text = nil, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 17

def show_progress_indicator(text = nil, options = {})
  options[:styles] ||= []
  options[:styles] << :base_progress_indicator
  options[:styles] << :"#{self.class_name_without_kvo.underscore.gsub('_screen', '')}_indicator"
  options[:details_label_text] = text

  if @progress_indicator_view.nil?
    options[:add_to_view] ||= self.view
    @progress_indicator_view = self.progress_hud(options).view
  else
    self.setup(@progress_indicator_view, options.except(:add_to_view))
    @progress_indicator_view.show options.has_key?(:animated) ? options[:animatetd] : true
  end
end

#show_spinner(message = nil) ⇒ Object



47
48
49
50
51
52
53
54
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 47

def show_spinner(message = nil)
  if message.present?
    spinner_message_element.set_text(message)
    spinner_message_element.show
  end
  spinner_element.show
  spinner_element.view.init_animation
end