Class: UIInteractionAction
- Inherits:
-
DeviceAction
- Object
- MacroObject
- Action
- DeviceAction
- UIInteractionAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Category: Device Actions
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ UIInteractionAction
constructor
A new instance of UIInteractionAction.
- #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(h = {}) ⇒ UIInteractionAction
Returns a new instance of UIInteractionAction.
982 983 984 985 986 987 988 989 990 991 |
# File 'lib/ruby-macrodroid/actions.rb', line 982 def initialize(h={}) = { ui_interaction_configuration: {:type=>"Copy"}, action: 2 } super(.merge h) end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 |
# File 'lib/ruby-macrodroid/actions.rb', line 993 def to_s(colour: false, indent: 0) ui = @h[:ui_interaction_configuration] option = -> do detail = case ui[:click_option] when 0 # 'Current focus' 'Current focus' when 1 # 'Text content' ui[:text_content] when 2 # 'X, Y location' "%s" % ui[:xy_point].values.join(',') when 3 # 'Identify in app' "id:%s" % ui[:view_id] end end s = case @h[:action] when 0 # 'Click' 'Click' + " [%s]" % option.call when 1 # 'Long Click' 'Long Click' + " [%s]" % option.call when 2 # 'Copy' 'Copy' when 3 # 'Cut' 'Cut' when 4 # 'Paste' "Paste [%s]" % (ui[:use_clipboard] ? 'Clipboard text' : ui[:text]) when 5 # 'Clear selection' 'Clear selection' when 6 # 'Gesture' detail = "%d ms: %d,%d -> %d,%d" % [ui[:duration_ms], ui[:start_x], ui[:start_y], ui[:end_x], ui[:end_y]] "Gesture [%s]" % detail end 'UI Interaction' + "\n " + s #+ ' ' + @h.inspect end |