class ControlMediaAction
note: to find a package id from an App name, try searching for the name on
the Google Play Store and the id will be returned in the URL once the correct app has been clicked. e.g. https://play.google.com/store/apps/details?id=com.google.android.music
Public Class Methods
new(obj=nil)
click to toggle source
Calls superclass method
MediaAction::new
# File lib/ruby-macrodroid/actions.rb, line 2215 def initialize(obj=nil) h = if obj.is_a? Hash then obj elsif obj.is_a? Array e, macro, h2 = obj s = e.text('item/description').to_s app = s[/Simulate Media Button \(([^\)]+)/,1] if app then { application_name: app, package_name: APPS[app], simulate_media_button: true }.merge h2 else { send_media_player_commands: true, simulate_media_button: false } end end #puts 'h: ' + h.inspect options = { option: "Play/Pause", send_media_player_commands: true, simulate_media_button: 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 2251 def to_s(colour: false, indent: 0) @s = 'Media ' + @h[:option] #+ @h.inspect if @h[:simulate_media_button] then @s += "\nSimulate Media Button (%s)" % @h[:application_name] else @s += "\nSimulate Audio Button" end super() end
Also aliased as: to_summary