Class: LaunchActivityAction

Inherits:
ApplicationAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Applications

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ LaunchActivityAction

Returns a new instance of LaunchActivityAction.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ruby-macrodroid/actions.rb', line 107

def initialize(h={})
 
  # option 0 is by application name, 1 is launch by package name
  #
  options = {
    application_name: 'Chrome',
    package_to_launch: 'com.android.chrome',
    exclude_from_recents: false,
    start_new: false,
    option: 0,
    launch_by_package_name: ''
  }

  super(options.merge h)
  
  @list = %w(option launchByPackageName)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



126
127
128
129
130
131
# File 'lib/ruby-macrodroid/actions.rb', line 126

def to_s(colour: false, indent: 0)
  option = @h[:option] == 0 ? @h[:application_name] : \
      @h[:launch_by_package_name]
  @s = 'Launch ' + option
  super()
end