droid_adbs 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7beed380bcb441e72f4d5e016e097d229731344f
4
- data.tar.gz: 61adf06ec2290a89c7d04e72a64ddbc27b55ee2b
3
+ metadata.gz: 373c4e52dead49c869d4cc4628f0268a0bf5c25c
4
+ data.tar.gz: 7cf25c9bc5a99007c1e6311fddeefdc0c51f8b5f
5
5
  SHA512:
6
- metadata.gz: 7752447ff0079eb96d1fb4e122d7363814ca0911ed3abdf8235b86dbdf96181b7057872af146f8b48a4663cdc08ddb64ca1fbe82fd718be4cc905bb52d82e972
7
- data.tar.gz: 1692a177e213e81b1027e3f2d3a7583f552de32302ff25c050017c7356a1d769733b97712557827b1c7a29fc71ff648c7399846106995b64a6ea57e75260a058
6
+ metadata.gz: a8d616edfb519a5dd5f41867328ab265f6beec44a1b7c1ba499adc07c3f3a9729ed8db675bc585bd70bed5937604acda92ad849eeb2708b08dddcf3d1a7baf00
7
+ data.tar.gz: d87207b04a1d329ab79e1a2705fffd8029a2e7b9b6c87a8004a94810629f6b7be201e15327d895bc0e4cdaa91caf00394192b760f96b7c88cc428a823969a375
@@ -67,7 +67,16 @@ module DroidAdbs
67
67
  # animation settings
68
68
  # @return [String] message from adb command
69
69
  def turn_all_animation_off
70
- if ::DroidAdbs::Devices.device_build_version_sdk.to_i < 17
70
+ turn_all_animation_off_without_reboot
71
+ intent_boot_completed
72
+ puts "adopt settings..."
73
+ false
74
+ end
75
+
76
+ # animation settings
77
+ # @return [String] message from adb command
78
+ def turn_all_animation_off_without_reboot
79
+ unless available_changing_animation?
71
80
  puts "the device is not over API Level 17"
72
81
  return true
73
82
  end
@@ -80,23 +89,32 @@ module DroidAdbs
80
89
  scale_off "window_animation_scale"
81
90
  scale_off "transition_animation_scale"
82
91
  scale_off "animator_duration_scale"
92
+ false
93
+ end
94
+
95
+ # @return [String] message from adb command
96
+ def turn_all_animation_on
97
+ turn_all_animation_on_without_reboot
83
98
  intent_boot_completed
84
99
  puts "adopt settings..."
85
100
  false
86
101
  end
87
102
 
88
103
  # @return [String] message from adb command
89
- def turn_all_animation_on
90
- if ::DroidAdbs::Devices.device_build_version_sdk.to_i < 17
104
+ def turn_all_animation_on_without_reboot
105
+ unless available_changing_animation?
91
106
  puts "the device is not over API Level 17"
92
107
  return true
93
108
  end
94
109
 
110
+ if all_animation_on?
111
+ puts "already all animation settings are on"
112
+ return true
113
+ end
114
+
95
115
  scale_on "window_animation_scale"
96
116
  scale_on "transition_animation_scale"
97
117
  scale_on "animator_duration_scale"
98
- intent_boot_completed
99
- puts "adopt settings..."
100
118
  false
101
119
  end
102
120
 
@@ -133,11 +151,20 @@ module DroidAdbs
133
151
  get_scale_of "transition_animation_scale"
134
152
  end
135
153
 
154
+ def available_changing_animation?
155
+ ::DroidAdbs::Devices.device_build_version_sdk.to_i >= 17
156
+ end
157
+
136
158
  def all_animation_off?
137
159
  return true if window_animation_scale == 0 && transition_animation_scale == 0 && animator_duration_scale == 0
138
160
  false
139
161
  end
140
162
 
163
+ def all_animation_on?
164
+ return true if window_animation_scale == 1 && transition_animation_scale == 1 && animator_duration_scale == 1
165
+ false
166
+ end
167
+
141
168
  end
142
169
  end
143
170
  end
@@ -1,3 +1,3 @@
1
1
  module DroidAdbs
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/droid_adbs.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "droid_adbs/version"
1
+ require_relative "droid_adbs/version"
2
2
  require_relative "droid_adbs/commons/settings"
3
3
  require_relative "droid_adbs/commons/devices"
4
4
  require_relative "droid_adbs/commons/backup"
@@ -37,6 +37,25 @@ module DroidAdbs
37
37
  result
38
38
  end
39
39
 
40
+ # @param app [String] application path
41
+ # @return [String] message from adb command
42
+ def install_with_grant(app)
43
+ result = `#{adb_serial} install -r -g #{app}`
44
+ fail "invalid APK" if result.include?("Invalid APK file:")
45
+ fail "failed to update apk because INSTALL_FAILED_VERSION_DOWNGRADE" if result.include?("INSTALL_FAILED_VERSION_DOWNGRADE")
46
+ result
47
+ end
48
+
49
+ # @param app [String] application path
50
+ # @return [String] message from adb command
51
+ def install_with(app, option = "")
52
+ result = `#{adb_serial} install #{option} #{app}`
53
+ fail "invalid APK" if result.include?("Invalid APK file:")
54
+ fail "failed to update apk because INSTALL_FAILED_VERSION_DOWNGRADE" if result.include?("INSTALL_FAILED_VERSION_DOWNGRADE")
55
+ result
56
+ end
57
+
58
+
40
59
  # @param package [String] package name you would like to uninstall
41
60
  # @return [String] message from adb command
42
61
  def uninstall(package)
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.1
4
+ version: 0.1.2
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-05 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler