droid_adbs 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 524babd55878be9a7ccbd0bf7270f9d85633c17a
4
- data.tar.gz: 92cbced291a93d398375605881d523d714741ee5
3
+ metadata.gz: 508198017ccbd8a2567e6c2023b45f69962c3a54
4
+ data.tar.gz: 9f8d5dae25f1f915504d3a161b4f44aaf07e2fef
5
5
  SHA512:
6
- metadata.gz: 4904b8dd3f070d28717029063a786872d38a54376cb53c7979d7f7823385263f93fcd0749c09e774bd0781d67ae7260c61417dcdc142bca4d02134dadfcf7840
7
- data.tar.gz: 960946b765bfa98b14874bd40905b3b6f11a988a87a1db4dcb5d4c6967115096e7c670a954f8d3e57ea1b8f7c3fda5012951c0c04e97a47413d8362b8a9fda88
6
+ metadata.gz: 86e94385745123c3f8094907e0b97285bbcb600cfb595c7d9595e916d82f9fc7104c612663ef8f1a44a307b3de6f8ccf6f04c7c16ebcabd913e45502c5e890b2
7
+ data.tar.gz: 0e46b426175666a129582f01038da86163a9bd0649341c869ab943113b66fd951745e3b4a8065bd2ce67fb069350f15345c41258b1b77c6f49e2ee3e46b27458
@@ -0,0 +1,38 @@
1
+ require_relative "../../droid_adbs"
2
+
3
+ module DroidAdbs
4
+ module WM
5
+ class << self
6
+ # @return [Integer] density. If this method fail to get density, then return 0.
7
+ def get_density
8
+ result = `#{::DroidAdbs.shell} wm density`.chomp
9
+ return 0 unless result.match /\APhysical density:.*/
10
+ result.split(/\s/).last.to_i
11
+ end
12
+
13
+ # @return [String] message from adb commands
14
+ def reset_density
15
+ `#{::DroidAdbs.shell} wm density reset`.chomp
16
+ end
17
+
18
+ # Don't forget to call `reset_density` after change density via adb
19
+ # @param [Integer] base_density density with get_density
20
+ # @param [hash] scale :small, :normal, :large, :huge. default is :normal
21
+ # @return [String] message from adb commands
22
+ def set_density(base_density:, scale: :normal)
23
+ density = case scale
24
+ when :small
25
+ (base_density * 0.85).to_i
26
+ when :large
27
+ (base_density * 1.15).to_i
28
+ when :huge
29
+ (base_density * 1.3).to_i
30
+ else # include :normal
31
+ base_density
32
+ end
33
+ `#{::DroidAdbs.shell} wm density #{density}`.chomp
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module DroidAdbs
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/droid_adbs.rb CHANGED
@@ -3,6 +3,7 @@ require_relative "droid_adbs/commons/settings"
3
3
  require_relative "droid_adbs/commons/devices"
4
4
  require_relative "droid_adbs/commons/backup"
5
5
  require_relative "droid_adbs/commons/ime"
6
+ require_relative "droid_adbs/commons/wm"
6
7
  require_relative "droid_adbs/aapt"
7
8
 
8
9
  module DroidAdbs
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droid_adbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - lib/droid_adbs/commons/devices.rb
75
75
  - lib/droid_adbs/commons/ime.rb
76
76
  - lib/droid_adbs/commons/settings.rb
77
+ - lib/droid_adbs/commons/wm.rb
77
78
  - lib/droid_adbs/version.rb
78
79
  homepage: https://github.com/KazuCocoa/droid_adbs
79
80
  licenses: