Skip to content

Commit 98058f3

Browse files
committed
Merge branch 'release/0.0.10s'
2 parents 54284eb + 9914794 commit 98058f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+907
-512
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
language: java
22

3-
branches:
4-
only:
5-
- master
63
before_install:
74
- chmod +x mvnw
85
jdk:

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
AndroidScreencast
22
=================
33

4-
[![Build Status Travis-CI][travis_badge]][travis] [![Dependency Status][versioneye_badge]][versioneye] [![Codacy Badge][codacy_badge]][codacy] [![Join the chat at https://gitter.im/AndroidScreencast/Lobby][gitter_badge]][gitter]
5-
6-
[travis_badge]: https://travis-ci.org/xSAVIKx/AndroidScreencast.svg?branch=master
7-
[travis]: https://travis-ci.org/xSAVIKx/AndroidScreencast
8-
9-
[versioneye_badge]: https://www.versioneye.com/user/projects/588988221618a700318eafb5/badge.svg
10-
[versioneye]: https://www.versioneye.com/user/projects/588988221618a700318eafb5
11-
12-
[codacy_badge]: https://api.codacy.com/project/badge/Grade/064bbd2582b544bb9659a01a2872317c
13-
[codacy]: https://www.codacy.com/app/xSAVIKx/AndroidScreencast?utm_source=github.com&utm_medium=referral&utm_content=xSAVIKx/AndroidScreencast&utm_campaign=badger
14-
15-
16-
17-
[gitter_badge]: https://badges.gitter.im/AndroidScreencast/Lobby.svg
18-
[gitter]: https://gitter.im/AndroidScreencast/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
4+
[![Build Status Travis-CI][travis_badge]][travis] 
5+
[![Dependency Status][versioneye_badge]][versioneye] 
6+
[![Codacy Badge][codacy_badge]][codacy] 
7+
[![Join the chat at https://gitter.im/AndroidScreencast/Lobby][gitter_badge]][gitter] 
8+
[![Apache License][license_badge]][license]
199

2010
# Description
2111

@@ -62,7 +52,7 @@ The resulting artifacts will be created in the `target` subdirectory.
6252
You can run the executable jar via `java -jar target/androidscreencast-VERSION-executable.jar`, replacing VERSION with
6353
the current version.
6454

65-
For example, `java -jar target/androidscreencast-0.0.9s-executable.jar`.
55+
For example, `java -jar target/androidscreencast-0.0.10s-executable.jar`.
6656

6757
Additionally OS-packages would be created with ADB executables bundled:
6858
* `androidscreencast-VERSION-windows.zip`
@@ -82,4 +72,27 @@ So, right now AndroidScreencast support all Android versions equal or greater th
8272

8373
Also, to run AndroidScreencast you will need *adb* installed (or you can use bundled in OS bundles adb).
8474

75+
# Similar Projects
76+
77+
* [Seven Square][seven_square] - QT implementation of Android Screencast (actively developed)
78+
* [Droid@Screen][droid_at_screen] - implementation of Android Screencast in Java (fancy one, last release in 2013)
79+
* [Android Screen Monitor][android_screen_monitor] - implementation of Android Screencast in Java (latest release in 2013)
80+
8581
[Android_4_1_1_Input]: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/com/android/commands/input/Input.java#Input
82+
[seven_square]: https://github.com/yangh/sevensquare
83+
[droid_at_screen]: http://droid-at-screen.org/droid-at-screen/
84+
85+
[travis_badge]: https://travis-ci.org/xSAVIKx/AndroidScreencast.svg?branch=master
86+
[travis]: https://travis-ci.org/xSAVIKx/AndroidScreencast
87+
88+
[versioneye_badge]: https://www.versioneye.com/user/projects/58a746d8b4d2a20055fcb887/badge.svg?style=flat
89+
[versioneye]: https://www.versioneye.com/user/projects/58a746d8b4d2a20055fcb887
90+
91+
[codacy_badge]: https://api.codacy.com/project/badge/Grade/064bbd2582b544bb9659a01a2872317c
92+
[codacy]: https://www.codacy.com/app/xSAVIKx/AndroidScreencast?utm_source=github.com&utm_medium=referral&utm_content=xSAVIKx/AndroidScreencast&utm_campaign=badger
93+
94+
[license_badge]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat
95+
[license]: http://www.apache.org/licenses/LICENSE-2.0
96+
97+
[gitter_badge]: https://badges.gitter.im/AndroidScreencast/Lobby.svg?style=flat
98+
[gitter]: https://gitter.im/AndroidScreencast/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

app.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
adb.path=adb/windows/adb.exe
1+
adb.path=adb/windows/adb2.exe
22
default.window.width=1024
33
default.window.height=768

docs/jnlp/androidscreencast.jnlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<jnlp spec="1.0+" codebase="http://xsavikx.github.io/AndroidScreencast/"
33
href="jnlp/androidscreencast.jnlp"
4-
version="0.0.8s">
4+
version="0.0.10s">
55
<information>
66
<title>Android Screencast</title>
77
<vendor>Iurii Sergiichuk</vendor>
@@ -16,7 +16,7 @@
1616
<resources>
1717
<j2se version="1.8+"/>
1818
<jar main="true" download="eager"
19-
href="https://github.com/xSAVIKx/AndroidScreencast/releases/download/0.0.8S/androidscreencast-0.0.8s-executable.jar"/>
19+
href="https://github.com/xSAVIKx/AndroidScreencast/releases/download/0.0.10s/androidscreencast-0.0.10s-executable.jar"/>
2020
</resources>
2121
<application-desc main-class="com.github.xsavikx.androidscreencast.Main"/>
2222
</jnlp>

pom.xml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.github.xsavikx</groupId>
55
<artifactId>androidscreencast</artifactId>
6-
<version>0.0.9s</version>
6+
<version>0.0.10s</version>
77
<name>Android Screencast</name>
8+
<packaging>jar</packaging>
89
<properties>
9-
<spring.version>4.3.5.RELEASE</spring.version>
10+
<dagger2.version>2.9</dagger2.version>
1011
<ddmlib.version>25.2.0</ddmlib.version>
11-
<log4j.version>1.2.17</log4j.version>
12+
<slf4j.version>1.7.24</slf4j.version>
13+
<logback-classic.version>1.2.1</logback-classic.version>
1214
<guava.version>21.0</guava.version>
1315
<main.class>com.github.xsavikx.androidscreencast.Main</main.class>
1416
<jdk.version>1.8</jdk.version>
@@ -25,24 +27,31 @@
2527
<version>${ddmlib.version}</version>
2628
</dependency>
2729
<dependency>
28-
<groupId>log4j</groupId>
29-
<artifactId>log4j</artifactId>
30-
<version>${log4j.version}</version>
30+
<groupId>org.slf4j</groupId>
31+
<artifactId>slf4j-api</artifactId>
32+
<version>${slf4j.version}</version>
3133
</dependency>
3234
<dependency>
33-
<groupId>org.springframework</groupId>
34-
<artifactId>spring-core</artifactId>
35-
<version>${spring.version}</version>
35+
<groupId>ch.qos.logback</groupId>
36+
<artifactId>logback-classic</artifactId>
37+
<version>${logback-classic.version}</version>
3638
</dependency>
3739
<dependency>
38-
<groupId>org.springframework</groupId>
39-
<artifactId>spring-beans</artifactId>
40-
<version>${spring.version}</version>
40+
<groupId>org.slf4j</groupId>
41+
<artifactId>jcl-over-slf4j</artifactId>
42+
<version>${slf4j.version}</version>
4143
</dependency>
4244
<dependency>
43-
<groupId>org.springframework</groupId>
44-
<artifactId>spring-context</artifactId>
45-
<version>${spring.version}</version>
45+
<groupId>com.google.dagger</groupId>
46+
<artifactId>dagger</artifactId>
47+
<version>${dagger2.version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.google.dagger</groupId>
51+
<artifactId>dagger-compiler</artifactId>
52+
<version>${dagger2.version}</version>
53+
<optional>true</optional>
54+
<scope>provided</scope>
4655
</dependency>
4756
<dependency>
4857
<groupId>com.google.guava</groupId>
@@ -75,7 +84,7 @@
7584
<plugin>
7685
<groupId>org.apache.maven.plugins</groupId>
7786
<artifactId>maven-shade-plugin</artifactId>
78-
<version>2.4.3</version>
87+
<version>3.0.0</version>
7988
<executions>
8089
<execution>
8190
<phase>package</phase>

src/main/java/com/github/xsavikx/androidscreencast/Main.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
package com.github.xsavikx.androidscreencast;
22

3-
import com.github.xsavikx.androidscreencast.app.AndroidScreencastApplication;
43
import com.github.xsavikx.androidscreencast.app.Application;
5-
import com.github.xsavikx.androidscreencast.spring.config.ApplicationContextProvider;
6-
import org.apache.log4j.Logger;
4+
import com.github.xsavikx.androidscreencast.dagger.MainComponentProvider;
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
77

88
import java.util.Arrays;
99

1010
public class Main {
11-
private static final Logger LOGGER = Logger.getLogger(Main.class);
11+
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
1212

1313
public static void main(String args[]) {
14-
LOGGER.debug("main(String[] args=" + Arrays.toString(args) + ") - start");
15-
Application application;
14+
LOGGER.debug("main(String[] args={}) - start", Arrays.toString(args));
1615
try {
17-
application = ApplicationContextProvider.getBean(AndroidScreencastApplication.class);
16+
Application application = MainComponentProvider.mainComponent().application();
1817
application.init();
1918
application.start();
2019
} finally {
21-
LOGGER.debug("main(String[] args=" + Arrays.toString(args) + ") - end");
20+
LOGGER.debug("main(String[] args={}) - end", Arrays.toString(args));
2221
}
2322
}
2423

src/main/java/com/github/xsavikx/androidscreencast/api/AndroidDeviceImpl.java

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,63 +7,64 @@
77
import com.github.xsavikx.androidscreencast.api.injector.OutputStreamShellOutputReceiver;
88
import com.github.xsavikx.androidscreencast.exception.AndroidScreenCastRuntimeException;
99
import com.github.xsavikx.androidscreencast.exception.ExecuteCommandException;
10-
import org.apache.log4j.Logger;
11-
import org.springframework.beans.factory.annotation.Autowired;
12-
import org.springframework.stereotype.Component;
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
1312

13+
import javax.inject.Inject;
14+
import javax.inject.Singleton;
1415
import java.io.ByteArrayOutputStream;
1516
import java.io.File;
1617
import java.lang.reflect.Method;
1718
import java.util.ArrayList;
1819
import java.util.List;
1920

20-
@Component
21+
@Singleton
2122
public class AndroidDeviceImpl implements AndroidDevice {
22-
private static final Logger logger = Logger.getLogger(AndroidDeviceImpl.class);
23+
private static final Logger LOGGER = LoggerFactory.getLogger(AndroidDeviceImpl.class);
2324
private final IDevice device;
2425

25-
@Autowired
26-
public AndroidDeviceImpl(IDevice device) {
26+
@Inject
27+
public AndroidDeviceImpl(final IDevice device) {
2728
this.device = device;
2829
}
2930

3031
@Override
31-
public String executeCommand(String cmd) {
32-
if (logger.isDebugEnabled()) {
33-
logger.debug("executeCommand(String) - start");
32+
public String executeCommand(final String cmd) {
33+
if (LOGGER.isDebugEnabled()) {
34+
LOGGER.debug("executeCommand(String) - start");
3435
}
35-
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();) {
36+
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();) {
3637
device.executeShellCommand(cmd, new OutputStreamShellOutputReceiver(bos));
37-
String returnString = new String(bos.toByteArray(), "UTF-8");
38-
if (logger.isDebugEnabled()) {
39-
logger.debug("executeCommand(String) - end");
38+
final String returnString = new String(bos.toByteArray(), "UTF-8");
39+
if (LOGGER.isDebugEnabled()) {
40+
LOGGER.debug("executeCommand(String) - end");
4041
}
4142
return returnString;
42-
} catch (Exception ex) {
43-
logger.error("executeCommand(String)", ex);
43+
} catch (final Exception ex) {
44+
LOGGER.error("executeCommand(String)", ex);
4445
throw new ExecuteCommandException(cmd);
4546
}
4647
}
4748

4849
@Override
49-
public List<FileInfo> list(String path) {
50-
if (logger.isDebugEnabled()) {
51-
logger.debug("list(String) - start");
50+
public List<FileInfo> list(final String path) {
51+
if (LOGGER.isDebugEnabled()) {
52+
LOGGER.debug("list(String) - start");
5253
}
5354

5455
try {
55-
String s = executeCommand("ls -l " + path);
56-
String[] entries = s.split("\r\n");
57-
List<FileInfo> fileInfos = new ArrayList<>();
58-
for (String entry : entries) {
56+
final String s = executeCommand("ls -l " + path);
57+
final String[] entries = s.split("\r\n");
58+
final List<FileInfo> fileInfos = new ArrayList<>();
59+
for (final String entry : entries) {
5960
String[] data = entry.split(" ");
6061
if (data.length < 4)
6162
continue;
6263
String attributes = data[0];
6364
boolean directory = attributes.charAt(0) == 'd';
6465
String name = data[data.length - 1];
6566

66-
FileInfo fi = new FileInfo();
67+
final FileInfo fi = new FileInfo();
6768
fi.attribs = attributes;
6869
fi.directory = directory;
6970
fi.name = name;
@@ -73,59 +74,59 @@ public List<FileInfo> list(String path) {
7374
fileInfos.add(fi);
7475
}
7576

76-
if (logger.isDebugEnabled()) {
77-
logger.debug("list(String) - end");
77+
if (LOGGER.isDebugEnabled()) {
78+
LOGGER.debug("list(String) - end");
7879
}
7980
return fileInfos;
80-
} catch (Exception ex) {
81-
logger.error("list(String)", ex);
81+
} catch (final Exception ex) {
82+
LOGGER.error("list(String)", ex);
8283
throw new AndroidScreenCastRuntimeException(ex);
8384
}
8485
}
8586

8687
@Override
87-
public void openUrl(String url) {
88-
if (logger.isDebugEnabled()) {
89-
logger.debug("openUrl(String) - start");
88+
public void openUrl(final String url) {
89+
if (LOGGER.isDebugEnabled()) {
90+
LOGGER.debug("openUrl(String) - start");
9091
}
9192

9293
executeCommand("am start " + url);
9394

94-
if (logger.isDebugEnabled()) {
95-
logger.debug("openUrl(String) - end");
95+
if (LOGGER.isDebugEnabled()) {
96+
LOGGER.debug("openUrl(String) - end");
9697
}
9798
}
9899

99100
@Override
100-
public void pullFile(String removeFrom, File localTo) {
101-
if (logger.isDebugEnabled()) {
102-
logger.debug("pullFile(String, File) - start");
101+
public void pullFile(final String removeFrom, final File localTo) {
102+
if (LOGGER.isDebugEnabled()) {
103+
LOGGER.debug("pullFile(String, File) - start");
103104
}
104105

105106
// ugly hack to call the method without FileEntry
106107
try {
107108
if (device.getSyncService() == null)
108-
throw new RuntimeException("SyncService is null, ADB crashed ?");
109-
Method m = device.getSyncService().getClass().getDeclaredMethod("doPullFile", String.class, String.class,
109+
throw new AndroidScreenCastRuntimeException("SyncService is null, ADB crashed ?");
110+
final Method m = device.getSyncService().getClass().getDeclaredMethod("doPullFile", String.class, String.class,
110111
ISyncProgressMonitor.class);
111112
m.setAccessible(true);
112113
device.getSyncService();
113114
m.invoke(device.getSyncService(), removeFrom, localTo.getAbsolutePath(), SyncService.getNullProgressMonitor());
114-
} catch (Exception ex) {
115-
logger.error("pullFile(String, File)", ex);
115+
} catch (final Exception ex) {
116+
LOGGER.error("pullFile(String, File)", ex);
116117

117118
throw new AndroidScreenCastRuntimeException(ex);
118119
}
119120

120-
if (logger.isDebugEnabled()) {
121-
logger.debug("pullFile(String, File) - end");
121+
if (LOGGER.isDebugEnabled()) {
122+
LOGGER.debug("pullFile(String, File) - end");
122123
}
123124
}
124125

125126
@Override
126-
public void pushFile(File localFrom, String remoteTo) {
127-
if (logger.isDebugEnabled()) {
128-
logger.debug("pushFile(File, String) - start");
127+
public void pushFile(final File localFrom, final String remoteTo) {
128+
if (LOGGER.isDebugEnabled()) {
129+
LOGGER.debug("pushFile(File, String) - start");
129130
}
130131

131132
try {
@@ -134,14 +135,14 @@ public void pushFile(File localFrom, String remoteTo) {
134135

135136
device.getSyncService().pushFile(localFrom.getAbsolutePath(), remoteTo, SyncService.getNullProgressMonitor());
136137

137-
} catch (Exception ex) {
138-
logger.error("pushFile(File, String)", ex);
138+
} catch (final Exception ex) {
139+
LOGGER.error("pushFile(File, String)", ex);
139140

140141
throw new AndroidScreenCastRuntimeException(ex);
141142
}
142143

143-
if (logger.isDebugEnabled()) {
144-
logger.debug("pushFile(File, String) - end");
144+
if (LOGGER.isDebugEnabled()) {
145+
LOGGER.debug("pushFile(File, String) - end");
145146
}
146147
}
147148

0 commit comments

Comments
 (0)