class ToastAction

Category: Notifications

Public Class Methods

new(obj) click to toggle source
Calls superclass method NotificationsAction::new
# File lib/ruby-macrodroid/actions.rb, line 2591
def initialize(obj)
  
  h = if obj.is_a? Hash then
    obj
  elsif obj.is_a? Array
    e, macro = obj
    txt = e.text('item/description')
    {msg: (txt || e.text)}
  end

  if h[:msg] then
    h[:message_text] = h[:msg]
    h.delete :msg
  end
  
  options = {
    message_text: '',
    image_resource_name: 'launcher_no_border',
    image_package_name: 'com.arlosoft.macrodroid',
    image_name: 'launcher_no_border',
    duration: 0,
    display_icon: true,
    background_color: -12434878,
    position: 0
  }

  super(options.merge h)

end

Public Instance Methods

invoke() click to toggle source
Calls superclass method Action#invoke
# File lib/ruby-macrodroid/actions.rb, line 2621
def invoke()
  super(msg: @h[:message_text])
end
to_pc() click to toggle source
# File lib/ruby-macrodroid/actions.rb, line 2625
def to_pc()
  "popup_message '%s'" % @h[:message_text]
end
to_s(colour: false, indent: 0) click to toggle source
Calls superclass method MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 2629
def to_s(colour: false, indent: 0)
  @s = "Popup Message\n%s" % @h[:message_text]
  super()
end