Skip to content

Commit b192fb8

Browse files
author
Iurii Sergiichuk
committed
Small update
MyInjectEventApp updated due to AndroidScreencastClient updates. misc changes in code style.
1 parent b5adba2 commit b192fb8

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

src/MyInjectEventApp.jar

4.75 KB
Binary file not shown.

src/com/github/xsavikx/android/screencast/api/StreamUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static void transfert(InputStream is, OutputStream os) {
2121
}
2222
}
2323

24-
public static void transfertResource(Class c, String resourceName,
24+
public static void transfertResource(Class<?> c, String resourceName,
2525
File output) {
2626
InputStream resStream = c.getResourceAsStream(resourceName);
2727
if (resStream == null)

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public void run() {
191191
}
192192
}
193193
}
194+
194195
/**
195196
* @return true if there was a client running
196197
*/
@@ -222,6 +223,7 @@ private static boolean killRunningAgent() {
222223
}
223224
return false;
224225
}
226+
225227
/**
226228
* Logger for this class
227229
*/
@@ -328,12 +330,12 @@ private void injectData(String data) {
328330
}
329331
}
330332

331-
public void injectKeycode(int type, int keyCode) {
333+
public void injectKeycode(int keyCode) {
332334
if (logger.isDebugEnabled()) {
333-
logger.debug("injectKeycode(int, int) - start");
335+
logger.debug("injectKeycode( int) - start");
334336
}
335337

336-
String cmdList = "key/" + type + "/" + keyCode;
338+
String cmdList = "key/" + keyCode;
337339
injectData(cmdList);
338340

339341
if (logger.isDebugEnabled()) {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import javax.swing.JPanel;
1717
import javax.swing.JScrollPane;
1818
import javax.swing.JTextField;
19-
import javax.swing.ListModel;
2019

2120
import com.android.ddmlib.IDevice;
2221

@@ -95,9 +94,6 @@ private void initialize() {
9594
public void mouseClicked(MouseEvent e) {
9695
if (e.getClickCount() == 2) {
9796
int index = jlDevices.locationToIndex(e.getPoint());
98-
ListModel dlm = jlDevices.getModel();
99-
Object item = dlm.getElementAt(index);
100-
;
10197
jlDevices.ensureIndexIsVisible(index);
10298
cancelled = false;
10399
setVisible(false);

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class InjectMouseAdapter extends MouseAdapter {
3838
private int dragFromY = -1;
3939
private long timeFromPress = -1;
4040
private final static long ONE_SECOND = 1000L;
41+
4142
@Override
4243
public void mouseClicked(MouseEvent e) {
4344
if (JFrameMain.this.injector == null)
@@ -85,15 +86,14 @@ public void mouseWheelMoved(MouseWheelEvent arg0) {
8586
if (JFrameMain.this.injector == null)
8687
return;
8788
try {
88-
// injector.injectKeycode(ConstEvtKey.ACTION_DOWN,code);
89-
// injector.injectKeycode(ConstEvtKey.ACTION_UP,code);
9089
JFrameMain.this.injector.injectTrackball(arg0
9190
.getWheelRotation() < 0 ? -1f : 1f);
9291
} catch (IOException e) {
9392
throw new RuntimeException(e);
9493
}
9594
}
9695
}
96+
9797
public class KbActionListener implements ActionListener {
9898

9999
int key;
@@ -106,11 +106,11 @@ public KbActionListener(int key) {
106106
public void actionPerformed(ActionEvent e) {
107107
if (injector == null)
108108
return;
109-
// injector.injectKeycode(ConstEvtKey.ACTION_DOWN, key);
110-
injector.injectKeycode(ConstEvtKey.ACTION_UP, key);
109+
injector.injectKeycode(key);
111110
}
112111

113112
}
113+
114114
private static final long serialVersionUID = -2085909236767692371L;
115115
private JPanelScreen jp = new JPanelScreen();
116116
private JToolBar jtb = new JToolBar();
@@ -145,14 +145,9 @@ public boolean dispatchKeyEvent(KeyEvent e) {
145145
return false;
146146
if (injector == null)
147147
return false;
148-
if (e.getID() == KeyEvent.KEY_PRESSED) {
149-
int code = KeyCodeConverter.getKeyCode(e);
150-
injector.injectKeycode(ConstEvtKey.ACTION_DOWN,
151-
code);
152-
}
153-
if (e.getID() == KeyEvent.KEY_RELEASED) {
148+
if (e.getID() == KeyEvent.KEY_TYPED) {
154149
int code = KeyCodeConverter.getKeyCode(e);
155-
injector.injectKeycode(ConstEvtKey.ACTION_UP, code);
150+
injector.injectKeycode(code);
156151
}
157152
return false;
158153
}

src/com/github/xsavikx/android/screencast/ui/explorer/JFrameExplorer.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,8 @@
2828

2929
public class JFrameExplorer extends JFrame {
3030

31-
private class FileTreeNode extends DefaultMutableTreeNode {
32-
FileInfo fi;
33-
34-
public FileTreeNode(FileInfo fi) {
35-
super(fi.name);
36-
this.fi = fi;
37-
}
38-
39-
}
4031
private class FolderTreeNode extends LazyMutableTreeNode {
41-
32+
private static final long serialVersionUID = 9131974430354670263L;
4233
String name;
4334
String path;
4435

@@ -66,6 +57,7 @@ public String toString() {
6657
}
6758

6859
}
60+
6961
/**
7062
*
7163
*/
@@ -120,7 +112,7 @@ public void valueChanged(TreeSelectionEvent e) {
120112
public void mouseClicked(MouseEvent e) {
121113
if (e.getClickCount() == 2) {
122114
int index = jListFichiers.locationToIndex(e.getPoint());
123-
ListModel dlm = jListFichiers.getModel();
115+
ListModel<Object> dlm = jListFichiers.getModel();
124116
FileInfo item = (FileInfo) dlm.getElementAt(index);
125117
;
126118
launchFile(item);

0 commit comments

Comments
 (0)