Class: WidgetPressedTrigger

Inherits:
Trigger show all
Defined in:
lib/ruby-macrodroid/triggers.rb

Overview

Category: User Input

Instance Attribute Summary

Attributes inherited from Trigger

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ WidgetPressedTrigger

Returns a new instance of WidgetPressedTrigger.



1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
# File 'lib/ruby-macrodroid/triggers.rb', line 1830

def initialize(h={})

  options = {
    :swipe_start_area=>0, :swipe_motion=>0, :cleared=>true, 
    :image_id=>2130968576, :image_package_name=>"com.android.providers.settings",
    :image_resource_name=>"com.android.providers.settings", :widget_label=>"", 
    :widget_type=>4
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object Also known as: to_summary



1843
1844
1845
1846
1847
1848
# File 'lib/ruby-macrodroid/triggers.rb', line 1843

def to_s(colour: false)
  # 4 == cutom , 0 = green, 1 = blue, 2 = red, 3 = yellow
  style = %w(Green Blue Red Yellow Custom)[@h[:widget_type]]
  @s = "Widget Button (%s)" % [style] #+ @h.inspect
  super()
end