Class: ToastAction
- Inherits:
-
NotificationsAction
- Object
- MacroObject
- Action
- NotificationsAction
- ToastAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Category: Notifications
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj) ⇒ ToastAction
constructor
A new instance of ToastAction.
- #invoke ⇒ Object
- #to_pc ⇒ Object
- #to_s(colour: false, indent: 0) ⇒ Object
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(obj) ⇒ ToastAction
Returns a new instance of ToastAction.
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 |
# File 'lib/ruby-macrodroid/actions.rb', line 2137 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 = { 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(.merge h) end |
Instance Method Details
#invoke ⇒ Object
2167 2168 2169 |
# File 'lib/ruby-macrodroid/actions.rb', line 2167 def invoke() super(msg: @h[:message_text]) end |
#to_pc ⇒ Object
2171 2172 2173 |
# File 'lib/ruby-macrodroid/actions.rb', line 2171 def to_pc() "popup_message '%s'" % @h[:message_text] end |
#to_s(colour: false, indent: 0) ⇒ Object
2175 2176 2177 2178 |
# File 'lib/ruby-macrodroid/actions.rb', line 2175 def to_s(colour: false, indent: 0) @s = "Popup Message\n%s" % @h[:message_text] super() end |