class ScreenOnAction

Category: Screen

Public Class Methods

new(obj=nil) click to toggle source
Calls superclass method ScreenAction::new
# File lib/ruby-macrodroid/actions.rb, line 2833
  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    

    options = {
      pie_lock_screen: false,
      screen_off: true,
      screen_off_no_lock: false,
      screen_on_alternative: false
    }

    super(options.merge h)

  end

Public Instance Methods

to_s(colour: false, indent: 0) click to toggle source
Calls superclass method MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 2868
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
Also aliased as: to_summary
to_summary(colour: false, indent: 0)
Alias for: to_s