Class: ToastAction

Inherits:
NotificationsAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Notifications

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ ToastAction

Returns a new instance of ToastAction.



1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/ruby-macrodroid/actions.rb', line 1575

def initialize(h={})

  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

Instance Method Details

#invokeObject



1597
1598
1599
# File 'lib/ruby-macrodroid/actions.rb', line 1597

def invoke()
  super(@h[:message_text])
end

#to_pcObject



1601
1602
1603
# File 'lib/ruby-macrodroid/actions.rb', line 1601

def to_pc()
  "popup_message '%s'" % @h[:message_text]
end

#to_s(colour: false) ⇒ Object



1605
1606
1607
# File 'lib/ruby-macrodroid/actions.rb', line 1605

def to_s(colour: false)
  "Popup Message\n  %s" % @h[:message_text]
end