|
|
|
@ -12,7 +12,6 @@ public class ControlEventReader {
|
|
|
|
private static final int MOUSE_PAYLOAD_LENGTH = 13;
|
|
|
|
private static final int MOUSE_PAYLOAD_LENGTH = 13;
|
|
|
|
private static final int TOUCH_PAYLOAD_LENGTH = 10;
|
|
|
|
private static final int TOUCH_PAYLOAD_LENGTH = 10;
|
|
|
|
private static final int SCROLL_PAYLOAD_LENGTH = 16;
|
|
|
|
private static final int SCROLL_PAYLOAD_LENGTH = 16;
|
|
|
|
private static final int COMMAND_PAYLOAD_LENGTH = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final int TEXT_MAX_LENGTH = 300;
|
|
|
|
public static final int TEXT_MAX_LENGTH = 300;
|
|
|
|
private static final int RAW_BUFFER_SIZE = 1024;
|
|
|
|
private static final int RAW_BUFFER_SIZE = 1024;
|
|
|
|
@ -67,8 +66,10 @@ public class ControlEventReader {
|
|
|
|
case ControlEvent.TYPE_SCROLL:
|
|
|
|
case ControlEvent.TYPE_SCROLL:
|
|
|
|
controlEvent = parseScrollControlEvent();
|
|
|
|
controlEvent = parseScrollControlEvent();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ControlEvent.TYPE_COMMAND:
|
|
|
|
case ControlEvent.TYPE_BACK_OR_SCREEN_ON:
|
|
|
|
controlEvent = parseCommandControlEvent();
|
|
|
|
case ControlEvent.TYPE_EXPAND_NOTIFICATION_PANEL:
|
|
|
|
|
|
|
|
case ControlEvent.TYPE_COLLAPSE_NOTIFICATION_PANEL:
|
|
|
|
|
|
|
|
controlEvent = ControlEvent.createSimpleControlEvent(type);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
Ln.w("Unknown event type: " + type);
|
|
|
|
Ln.w("Unknown event type: " + type);
|
|
|
|
@ -136,14 +137,6 @@ public class ControlEventReader {
|
|
|
|
return ControlEvent.createScrollControlEvent(position, hScroll, vScroll);
|
|
|
|
return ControlEvent.createScrollControlEvent(position, hScroll, vScroll);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ControlEvent parseCommandControlEvent() {
|
|
|
|
|
|
|
|
if (buffer.remaining() < COMMAND_PAYLOAD_LENGTH) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int action = toUnsigned(buffer.get());
|
|
|
|
|
|
|
|
return ControlEvent.createCommandControlEvent(action);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Position readPosition(ByteBuffer buffer) {
|
|
|
|
private static Position readPosition(ByteBuffer buffer) {
|
|
|
|
int x = toUnsigned(buffer.getShort());
|
|
|
|
int x = toUnsigned(buffer.getShort());
|
|
|
|
int y = toUnsigned(buffer.getShort());
|
|
|
|
int y = toUnsigned(buffer.getShort());
|
|
|
|
|