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 +4 -4
- data/lib/droid_adbs/commons/wm.rb +38 -0
- data/lib/droid_adbs/version.rb +1 -1
- data/lib/droid_adbs.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508198017ccbd8a2567e6c2023b45f69962c3a54
|
4
|
+
data.tar.gz: 9f8d5dae25f1f915504d3a161b4f44aaf07e2fef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/droid_adbs/version.rb
CHANGED
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.
|
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-
|
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:
|