use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class LoopbackLinkProvider method onNetworkChange.
@Override
public void onNetworkChange() {
NetworkPacket np = NetworkPacket.createIdentityPacket(context);
connectionAccepted(np, new LoopbackLink(context, this));
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class KeyListenerView method onKeyUp.
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// We don't want to swallow the back button press
return false;
}
// NOTE: Most keyboards, and specifically the Android default keyboard when
// entering non-ascii characters, will not trigger KeyEvent events as documented
// here: http://developer.android.com/reference/android/view/KeyEvent.html
// Log.e("KeyDown", "------------");
// Log.e("KeyDown", "keyChar:" + (int) event.getDisplayLabel());
// Log.e("KeyDown", "utfChar:" + (char)event.getUnicodeChar());
// Log.e("KeyDown", "intUtfChar:" + event.getUnicodeChar());
final NetworkPacket np = new NetworkPacket(MousePadPlugin.PACKET_TYPE_MOUSEPAD_REQUEST);
boolean modifier = false;
if (event.isAltPressed()) {
np.set("alt", true);
modifier = true;
}
if (event.isCtrlPressed()) {
np.set("ctrl", true);
modifier = true;
}
if (event.isShiftPressed()) {
np.set("shift", true);
}
if (event.isMetaPressed()) {
np.set("super", true);
modifier = true;
}
int specialKey = SpecialKeysMap.get(keyCode, -1);
if (specialKey != -1) {
np.set("specialKey", specialKey);
} else if (event.getDisplayLabel() != 0 && modifier) {
// Alt will change the utf symbol to non-ascii characters, we want the plain original letter
// Since getDisplayLabel will always have a value, we have to check for special keys before
char keyCharacter = event.getDisplayLabel();
np.set("key", new String(new char[] { keyCharacter }).toLowerCase());
} else {
// A normal key, but still not handled by the KeyInputConnection (happens with numbers)
np.set("key", new String(new char[] { (char) event.getUnicodeChar() }));
}
sendKeyPressPacket(np);
return true;
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class MousePadPlugin method sendLeftClick.
public void sendLeftClick() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("singleclick", true);
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class MousePadPlugin method sendSingleHold.
public void sendSingleHold() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("singlehold", true);
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class MousePadPlugin method sendMiddleClick.
public void sendMiddleClick() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("middleclick", true);
device.sendPacket(np);
}
Aggregations