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.
2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 |
# File 'lib/ruby-macrodroid/actions.rb', line 2277 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
2307 2308 2309 |
# File 'lib/ruby-macrodroid/actions.rb', line 2307 def invoke() super(msg: @h[:message_text]) end |
#to_pc ⇒ Object
2311 2312 2313 |
# File 'lib/ruby-macrodroid/actions.rb', line 2311 def to_pc() "popup_message '%s'" % @h[:message_text] end |
#to_s(colour: false, indent: 0) ⇒ Object
2315 2316 2317 2318 |
# File 'lib/ruby-macrodroid/actions.rb', line 2315 def to_s(colour: false, indent: 0) @s = "Popup Message\n%s" % @h[:message_text] super() end |