Class: ScreenOnAction
- Inherits:
-
ScreenAction
- Object
- MacroObject
- Action
- ScreenAction
- ScreenOnAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Category: Screen
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj = nil) ⇒ ScreenOnAction
constructor
A new instance of ScreenOnAction.
- #to_s(colour: false, indent: 0) ⇒ Object (also: #to_summary)
Methods inherited from Action
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(obj = nil) ⇒ ScreenOnAction
Returns a new instance of ScreenOnAction.
2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 |
# File 'lib/ruby-macrodroid/actions.rb', line 2591 def initialize(obj=nil) debug = false h = if obj.is_a? Hash then obj elsif obj.is_a? Array =begin puts 'obj: ' + obj.inspect if debug e, macro = obj puts ('e: ' + e.xml.inspect).debug if debug a = e.xpath('item/*') txt = e.text.to_s puts ('txt: ' + txt.inspect).debug if debug state = txt[/Screen (On|Off)/i,1] {screen_off: state.downcase == 'off'} =end {} end = { pie_lock_screen: false, screen_off: true, screen_off_no_lock: false, screen_on_alternative: false } super(.merge h) end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary
2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 |
# File 'lib/ruby-macrodroid/actions.rb', line 2626 def to_s(colour: false, indent: 0) state = @h[:screen_off] ? 'Off' : 'On' state += ' ' + 'No Lock (root only)' if @h[:screen_off_no_lock] #state += ' ' + '(Alternative)' if @h[:screen_on_alternative] @s = 'Screen ' + state super() end |