-
Notifications
You must be signed in to change notification settings - Fork 0
/
font_scale.rb
44 lines (36 loc) · 888 Bytes
/
font_scale.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
require_relative 'packages'
require 'open3'
class FontScale
def self.name
'font_scale'
end
# https://developer.android.com/reference/android/provider/Settings.System#FONT_SCALE
def self.scales
{
'small' => 0.85,
'default' => 1,
'large' => 1.15,
'largest' => 1.30
}
end
def self.perform(*args)
scale = args[0]
return unless validate_scale_input(scale)
size_int = scales[scale]
Open3.capture2("adb shell settings put system font_scale #{size_int}")
end
def self.similar_sounding_commands
%w[size typeface font scale accessibility]
end
def self.validate_scale_input(scale)
if scale.nil? || !scales.key?(scale)
puts "Unknown scale: #{scale}. Choices are: "
scales.each_key do |key|
puts " #{key}"
end
return false
end
true
end
end