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.



1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
# File 'lib/ruby-macrodroid/triggers.rb', line 1679

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



1692
1693
1694
1695
1696
1697
# File 'lib/ruby-macrodroid/triggers.rb', line 1692

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