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.



2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
# File 'lib/ruby-macrodroid.rb', line 2689

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



2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
# File 'lib/ruby-macrodroid.rb', line 2702

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



2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
# File 'lib/ruby-macrodroid.rb', line 2716

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