update:合并command命令

This commit is contained in:
Barry 2019-06-18 16:37:12 +08:00
commit 1f073c2929
8 changed files with 45 additions and 71 deletions

View file

@ -12,7 +12,6 @@ public class ControlEventReader {
private static final int MOUSE_PAYLOAD_LENGTH = 13;
private static final int TOUCH_PAYLOAD_LENGTH = 10;
private static final int SCROLL_PAYLOAD_LENGTH = 16;
private static final int COMMAND_PAYLOAD_LENGTH = 1;
public static final int TEXT_MAX_LENGTH = 300;
private static final int RAW_BUFFER_SIZE = 1024;
@ -67,8 +66,10 @@ public class ControlEventReader {
case ControlEvent.TYPE_SCROLL:
controlEvent = parseScrollControlEvent();
break;
case ControlEvent.TYPE_COMMAND:
controlEvent = parseCommandControlEvent();
case ControlEvent.TYPE_BACK_OR_SCREEN_ON:
case ControlEvent.TYPE_EXPAND_NOTIFICATION_PANEL:
case ControlEvent.TYPE_COLLAPSE_NOTIFICATION_PANEL:
controlEvent = ControlEvent.createSimpleControlEvent(type);
break;
default:
Ln.w("Unknown event type: " + type);
@ -136,14 +137,6 @@ public class ControlEventReader {
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) {
int x = toUnsigned(buffer.getShort());
int y = toUnsigned(buffer.getShort());