Module: MotionPrime::ScreenIndicatorsMixin
- Included in:
- Screen
- Defined in:
- motion-prime/screens/extensions/_indicators_mixin.rb
Instance Method Summary collapse
- #hide_activity_indicator(render_target = nil) ⇒ Object
- #hide_progress_indicator(animated = true) ⇒ Object
- #hide_spinner ⇒ Object
- #show_activity_indicator(render_target = nil, options = {}) ⇒ Object
- #show_notice(message, time = 1.0, type = :notice) ⇒ Object
- #show_progress_indicator(text = nil, options = {}) ⇒ Object
- #show_spinner(message = nil) ⇒ Object
Instance Method Details
#hide_activity_indicator(render_target = nil) ⇒ Object
17 18 19 20 21 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 17 def hide_activity_indicator(render_target = nil) @activity_indicator_view ||= {} render_target ||= view @activity_indicator_view[render_target.object_id].try(:stopAnimating) end |
#hide_progress_indicator(animated = true) ⇒ Object
38 39 40 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 38 def hide_progress_indicator(animated = true) @progress_indicator_view.try(:hide, animated) end |
#hide_spinner ⇒ Object
62 63 64 65 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 62 def hide_spinner spinner_element.hide .hide end |
#show_activity_indicator(render_target = nil, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 3 def show_activity_indicator(render_target = nil, = {}) render_target ||= view @activity_indicator_view ||= {} indicator = @activity_indicator_view[render_target.object_id] ||= begin indicator = UIActivityIndicatorView.gray render_target.addSubview(indicator) indicator end center = [:center] || {} indicator.center = CGPointMake(center.fetch(:x, render_target.center.x), center.fetch(:y, render_target.center.y)) indicator.startAnimating end |
#show_notice(message, time = 1.0, type = :notice) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 42 def show_notice(, time = 1.0, type = :notice) hud_type = case type.to_s when 'alert' then MBAlertViewHUDTypeExclamationMark else MBAlertViewHUDTypeCheckmark end unless time === false MBHUDView.hudWithBody(, type: hud_type, hidesAfter: time, show: true) end end |
#show_progress_indicator(text = nil, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 23 def show_progress_indicator(text = nil, = {}) [:styles] ||= [] [:styles] << :base_progress_indicator [:styles] << :"#{self.class_name_without_kvo.underscore.gsub('_screen', '')}_indicator" [:details_label_text] = text if @progress_indicator_view.nil? [:add_to_view] ||= self.view @progress_indicator_view = self.progress_hud().view else self.(@progress_indicator_view, .except(:add_to_view)) @progress_indicator_view.show .has_key?(:animated) ? [:animatetd] : true end end |
#show_spinner(message = nil) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 53 def show_spinner( = nil) if .present? .set_text() .show end spinner_element.show spinner_element.view.init_animation end |