Class: VolumeButtonTrigger

Inherits:
Trigger show all
Defined in:
lib/ruby-macrodroid.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 = {}) ⇒ VolumeButtonTrigger

Returns a new instance of VolumeButtonTrigger.



2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
# File 'lib/ruby-macrodroid.rb', line 2682

def initialize(h={})

  options = {
    dont_change_volume: true,
    monitor_option: 1,
    not_configured: false,
    option: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
# File 'lib/ruby-macrodroid.rb', line 2695

def to_s(colour: false)
  
  a = [
    'Volume Up', 
    'Volume Down',
    'Volume Up - Long Press', 
    'Volume Down - Long Press'
  ]
  
  lines = [a[@h[:option]]]
  lines << '  ' + (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume')
  @s = lines.join("\n")
end

#to_summary(colour: false) ⇒ Object



2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
# File 'lib/ruby-macrodroid.rb', line 2709

def to_summary(colour: false)
  a = [
    'Volume Up', 
    'Volume Down',
    'Volume Up - Long Press', 
    'Volume Down - Long Press'
  ]
  
  lines = [a[@h[:option]]]
  lines << (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume')
  @s = lines.join(": ")    
end