Module: DroidAdbs::WM
- Defined in:
- lib/droid_adbs/commons/wm.rb
Class Method Summary collapse
-
.get_density ⇒ Integer
Density.
-
.reset_density ⇒ String
Message from adb commands.
-
.set_density(base_density:, scale: :normal) ⇒ String
Don’t forget to call ‘reset_density` after change density via adb.
Class Method Details
.get_density ⇒ Integer
Returns density. If this method fail to get density, then return 0.
5 6 7 8 9 |
# File 'lib/droid_adbs/commons/wm.rb', line 5 def get_density result = `#{::DroidAdbs.shell} wm density`.strip return 0 unless result.match(/\APhysical density:.*/) result.split(/\s/).last.to_i end |
.reset_density ⇒ String
Returns message from adb commands.
12 13 14 |
# File 'lib/droid_adbs/commons/wm.rb', line 12 def reset_density `#{::DroidAdbs.shell} wm density reset`.strip end |
.set_density(base_density:, scale: :normal) ⇒ String
Don’t forget to call ‘reset_density` after change density via adb
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/droid_adbs/commons/wm.rb', line 20 def set_density(base_density:, scale: :normal) density = case scale when :small (base_density * 0.85).to_i when :large (base_density * 1.15).to_i when :huge (base_density * 1.3).to_i else # include :normal base_density end `#{::DroidAdbs.shell} wm density #{density}`.strip end |