mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 05:07:40 +00:00
Fixed loopback link
This commit is contained in:
parent
de81a20f82
commit
4b7c5fb85a
@ -81,12 +81,10 @@ public abstract class BasePairingHandler {
|
||||
}
|
||||
|
||||
/* To be implemented by respective pairing handler */
|
||||
public abstract NetworkPackage createPairPackage();
|
||||
public abstract void packageReceived(NetworkPackage np) throws Exception;
|
||||
public abstract void requestPairing();
|
||||
public abstract void acceptPairing();
|
||||
public abstract void rejectPairing();
|
||||
public abstract void pairingDone();
|
||||
public abstract void unpair();
|
||||
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ public class LanPairingHandler extends BasePairingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkPackage createPairPackage() {
|
||||
private NetworkPackage createPairPackage() {
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_PAIR);
|
||||
np.set("pair", true);
|
||||
SharedPreferences globalSettings = PreferenceManager.getDefaultSharedPreferences(mDevice.getContext());
|
||||
@ -196,7 +195,6 @@ public class LanPairingHandler extends BasePairingHandler {
|
||||
mDevice.sendPackage(np);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pairingDone() {
|
||||
// Store device information needed to create a Device object in a future
|
||||
//Log.e("KDE/PairingDone", "Pairing Done");
|
||||
|
@ -20,13 +20,45 @@
|
||||
|
||||
package org.kde.kdeconnect.Backends.LoopbackBackend;
|
||||
|
||||
import org.kde.kdeconnect.Backends.LanBackend.LanPairingHandler;
|
||||
import org.kde.kdeconnect.Device;
|
||||
import android.util.Log;
|
||||
|
||||
public class LoopbackPairingHandler extends LanPairingHandler{
|
||||
import org.kde.kdeconnect.Backends.BasePairingHandler;
|
||||
import org.kde.kdeconnect.Device;
|
||||
import org.kde.kdeconnect.NetworkPackage;
|
||||
|
||||
public class LoopbackPairingHandler extends BasePairingHandler {
|
||||
|
||||
public LoopbackPairingHandler(Device device, PairingHandlerCallback callback) {
|
||||
super(device, callback);
|
||||
}
|
||||
// Extending from LanPairingHandler, as it is similar to it
|
||||
|
||||
@Override
|
||||
public void packageReceived(NetworkPackage np) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestPairing() {
|
||||
Log.i("LoopbackPairing", "requestPairing");
|
||||
mCallback.pairingDone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPairing() {
|
||||
Log.i("LoopbackPairing", "acceptPairing");
|
||||
mCallback.pairingDone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejectPairing() {
|
||||
Log.i("LoopbackPairing", "rejectPairing");
|
||||
mCallback.unpaired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpair() {
|
||||
Log.i("LoopbackPairing", "unpair");
|
||||
mCallback.unpaired();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -142,15 +142,9 @@ public class BackgroundService extends Service {
|
||||
|
||||
private void registerLinkProviders() {
|
||||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
//linkProviders.add(new LoopbackLinkProvider(this));
|
||||
|
||||
//if (settings.getBoolean("loopback_link", true)) {
|
||||
// linkProviders.add(new LoopbackLinkProvider(this));
|
||||
//}
|
||||
|
||||
if (settings.getBoolean("lan_link", true)) {
|
||||
linkProviders.add(new LanLinkProvider(this));
|
||||
}
|
||||
linkProviders.add(new LanLinkProvider(this));
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user