Skip to content

Commit

Permalink
Issue #15 - fix bug with swipe
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xSAVIKx committed Aug 24, 2015
1 parent 0ee7361 commit c2c2175
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>AndroidScreencast</groupId>
<artifactId>AndroidScreencast</artifactId>
<version>0.0.5S</version>
<version>0.0.5.1S</version>
<name>Android Screencast</name>
<properties>
<spring-version>4.2.0.RELEASE</spring-version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.github.xsavikx.android.screencast.api.injector;

import org.springframework.stereotype.Component;

import com.android.ddmlib.MultiLineReceiver;

@Component
public class MultiLineReceiverPrinter extends MultiLineReceiver {

@Override
Expand Down
7 changes: 4 additions & 3 deletions src/com/github/xsavikx/android/screencast/ui/JFrameMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ public JFrameMain(Environment env, Injector injector, AndroidDevice androidDevic

private void setPrefferedWindowSize() {
if (env.containsProperty(Constants.DEFAULT_WINDOW_HEIGHT) && env.containsProperty(Constants.DEFAULT_WINDOW_WIDTH)) {
int height = env.getProperty(Constants.DEFAULT_WINDOW_HEIGHT, Integer.class).intValue();
int width = env.getProperty(Constants.DEFAULT_WINDOW_WIDTH, Integer.class).intValue();
getContentPane().setPreferredSize(new Dimension(width, height));
Integer height = env.getProperty(Constants.DEFAULT_WINDOW_HEIGHT, Integer.class);
Integer width = env.getProperty(Constants.DEFAULT_WINDOW_WIDTH, Integer.class);
if (height != null && width != null)
getContentPane().setPreferredSize(new Dimension(width.intValue(), height.intValue()));
}
pack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public KeyboardActionListener(int key) {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {

@Override
public void run() {
getCommandExecutor().execute(AdbInputCommandFactory.getKeyCommand(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ public void mouseDragged(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
if (timeFromPress >= ONE_SECOND) {
final Point p2 = jp.getRawPoint(e.getPoint());
final int xFrom = dragFromX;
final int yFrom = dragFromY;
final int xTo = p2.x;
final int yTo = p2.y;
SwingUtilities.invokeLater(new Runnable() {

@Override
public void run() {
getCommandExecutor().execute(AdbInputCommandFactory.getSwipeCommand(dragFromX, dragFromY, p2.x, p2.y));
getCommandExecutor().execute(AdbInputCommandFactory.getSwipeCommand(xFrom, yFrom, xTo, yTo));
}
});
dragFromX = -1;
Expand Down

0 comments on commit c2c2175

Please sign in to comment.