2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Use capabilities to enable presenter pointer

This commit is contained in:
Albert Vaca Cintora
2019-07-19 22:58:52 +02:00
parent 98c366ee6a
commit 2595d97fad
2 changed files with 10 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -86,6 +87,11 @@ public class Device implements BaseLink.PacketReceiver {
private final SharedPreferences settings;
private final CopyOnWriteArrayList<PluginsChangedListener> pluginsChangedListeners = new CopyOnWriteArrayList<>();
private Set<String> incomingCapabilities = new HashSet<>();
public boolean supportsPacketType(String type) {
return incomingCapabilities.contains(type);
}
public interface PluginsChangedListener {
void onPluginsChanged(Device device);
@@ -492,12 +498,14 @@ public class Device implements BaseLink.PacketReceiver {
Set<String> outgoingCapabilities = identityPacket.getStringSet("outgoingCapabilities", null);
Set<String> incomingCapabilities = identityPacket.getStringSet("incomingCapabilities", null);
if (incomingCapabilities != null && outgoingCapabilities != null) {
supportedPlugins = new Vector<>(PluginFactory.pluginsForCapabilities(incomingCapabilities, outgoingCapabilities));
} else {
supportedPlugins = new Vector<>(PluginFactory.getAvailablePlugins());
}
this.incomingCapabilities = incomingCapabilities;
reloadPluginsFromSettings();

View File

@@ -44,7 +44,7 @@ public class PresenterPlugin extends Plugin {
private final static String PACKET_TYPE_MOUSEPAD_REQUEST = "kdeconnect.mousepad.request";
public boolean isPointerSupported() {
return true; //TODO: Check capabilities
return device.supportsPacketType(PACKET_TYPE_PRESENTER);
}
@Override