Skip to content

Commit c2c2175

Browse files
committed
Issue #15 - fix bug with swipe
Fixed bug with swipe cannot be performed due to improper usage of variables with multithreaded operations. fixed possible NPE while setting default windows size from property file. Version changed to 0.0.5.1S
1 parent 0ee7361 commit c2c2175

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>AndroidScreencast</groupId>
55
<artifactId>AndroidScreencast</artifactId>
6-
<version>0.0.5S</version>
6+
<version>0.0.5.1S</version>
77
<name>Android Screencast</name>
88
<properties>
99
<spring-version>4.2.0.RELEASE</spring-version>

src/com/github/xsavikx/android/screencast/api/injector/MultiLineReceiverPrinter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.github.xsavikx.android.screencast.api.injector;
22

3+
import org.springframework.stereotype.Component;
4+
35
import com.android.ddmlib.MultiLineReceiver;
46

7+
@Component
58
public class MultiLineReceiverPrinter extends MultiLineReceiver {
69

710
@Override

src/com/github/xsavikx/android/screencast/ui/JFrameMain.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ public JFrameMain(Environment env, Injector injector, AndroidDevice androidDevic
7070

7171
private void setPrefferedWindowSize() {
7272
if (env.containsProperty(Constants.DEFAULT_WINDOW_HEIGHT) && env.containsProperty(Constants.DEFAULT_WINDOW_WIDTH)) {
73-
int height = env.getProperty(Constants.DEFAULT_WINDOW_HEIGHT, Integer.class).intValue();
74-
int width = env.getProperty(Constants.DEFAULT_WINDOW_WIDTH, Integer.class).intValue();
75-
getContentPane().setPreferredSize(new Dimension(width, height));
73+
Integer height = env.getProperty(Constants.DEFAULT_WINDOW_HEIGHT, Integer.class);
74+
Integer width = env.getProperty(Constants.DEFAULT_WINDOW_WIDTH, Integer.class);
75+
if (height != null && width != null)
76+
getContentPane().setPreferredSize(new Dimension(width.intValue(), height.intValue()));
7677
}
7778
pack();
7879
}

src/com/github/xsavikx/android/screencast/ui/interaction/KeyboardActionListener.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public KeyboardActionListener(int key) {
2020
@Override
2121
public void actionPerformed(ActionEvent e) {
2222
SwingUtilities.invokeLater(new Runnable() {
23-
2423
@Override
2524
public void run() {
2625
getCommandExecutor().execute(AdbInputCommandFactory.getKeyCommand(key));

src/com/github/xsavikx/android/screencast/ui/interaction/MouseActionAdapter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ public void mouseDragged(MouseEvent e) {
6565
public void mouseReleased(MouseEvent e) {
6666
if (timeFromPress >= ONE_SECOND) {
6767
final Point p2 = jp.getRawPoint(e.getPoint());
68+
final int xFrom = dragFromX;
69+
final int yFrom = dragFromY;
70+
final int xTo = p2.x;
71+
final int yTo = p2.y;
6872
SwingUtilities.invokeLater(new Runnable() {
6973

7074
@Override
7175
public void run() {
72-
getCommandExecutor().execute(AdbInputCommandFactory.getSwipeCommand(dragFromX, dragFromY, p2.x, p2.y));
76+
getCommandExecutor().execute(AdbInputCommandFactory.getSwipeCommand(xFrom, yFrom, xTo, yTo));
7377
}
7478
});
7579
dragFromX = -1;

0 commit comments

Comments
 (0)